This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Enhancement] Convert fast-unstake to use StakingInterface, decouplin… #12424
[Enhancement] Convert fast-unstake to use StakingInterface, decouplin… #12424
Changes from 4 commits
3a11e89
4f39589
9b8e123
25520d6
ad90903
89b32b5
f51c073
41d04ad
7fc52f8
d3958ba
2ff689c
1fc6510
28d15d7
0705029
39cf580
8093567
30a5882
37107ef
097a9d1
613a701
e785dd5
03586d7
20a4f29
9807cf2
3639af8
b7827d5
5232b99
f881456
c3cee71
068c565
ff36f90
6f862e4
bff58a4
bdb525e
4bd57b1
f6040ec
8c5604d
731fab2
b90082a
1eee8a5
1f4fad2
27530dc
90cec9f
b1560aa
75a36bb
b3e843e
963837b
cbed2f9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kianenigma We might want to get rid of those, seems redundant now.:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I see why the old code was not returning
StakingLedger
. We cannot useStakingLedger
inpallet-nomination-pools
orpallet-fast-unstake
because it is defined in pallet-stakin.Putting it in a shared crate is also too much of a stretch in my opinion, because these types are arguably an implementation detail.
I think we should keep these, not have
get_ledger
andget_exposure
and instead create other API function that express a condition, a state or a behavior rather than the explicit type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we introduce a special type that will take values out of StakingLedger? Like type
Ledger
. It could even be an alias for now and then change if needed.This makes very little sense to keep as is, because:
We'd need to call three different methods that operate on exactly the same storage item. Actually no, 4!
At the very least that's not very dry and also a bit of overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my answer to this and many other aspects can be found in ru/feature/fast-unstake-istaking...kiz-ru/feature/fast-unstake-istaking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe something to keep in mind: https://github.com/paritytech/ci_cd/issues/626
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to keep it readable, but yeah, I guess those comments could be longer. Need to find a good tool for intellij
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now this API is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although -- I take it back. We have
get_ledger
. a similarget_exposure
would fit nicer next to it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's quite a bit different, because we have multiple exposures.
So do we just return all the exposures that match staker, era? Otherwise it's inefficient.
I think it's best to keep this api tbh, because we are iterating by prefix. Or otherwise
get_exposures
with era.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually fine -- see my comment about
get_ledger
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine, we don't need eras anywhere else for now, so keeping this signature specific to the use-case sounds good and concise.