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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extrinsic to restore corrupt staking ledgers #3706
Extrinsic to restore corrupt staking ledgers #3706
Changes from all commits
03d821c
68df5d2
fc57112
4038ca1
af010de
87ad1e5
03cf845
9eea773
fbbf7f8
64cbee1
a6cb392
8f52d0a
c3ed2c3
11920e4
42525dc
c9aba77
ae4a192
df0cf74
a57a699
e0bcbd3
209f3b0
b3e4a73
42bb49d
7099763
aaba944
5da7bc8
61eb993
5f04bb9
46360fe
2ed2ed6
9426202
10fc869
f27ef5b
a3100f8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
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.
Could return something like
LedgerIntgrityState::DanglingLock
.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.
and this branch should be defensive as in to the best of our knowledge, no ledger should be in this error state right?
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.
We actually may get into this state when the stash associated with a corrupted ledger calls kill on the ledger, this specific case is explained here: https://hackmd.io/DLb5jEYWSmmvqXC9ae4yRg#/5
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.
A ledger can also have both lock out of sync and stash mismatch?
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.
if the stash is a mismatch, it means it is someone else's ledger, so I think it is kinda meaningless to even check
LockCorrupted
.Corrupted
always also impliesLockCorrupted
as well.And I think we only have
Corrupted
now, or do we have anyLockCorrupted
atm as well?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.
Yes, it can. If there's a bond_extra on a corrupted ledger, we may get that issue (see e.g. this case).
The reason to differentiate between
Corrupted
andLockCorrupted
is that theLockCorrupted
restore requires themaybe_total
to be Some, i.e. in this case, we want to ensure that the lock and the ledger's total is re-written. On the other hand,Corrupted
we will use the lock's value to reset the ledger's total (or, optionally, re-write it withmaybe_total
).We could also collapse both and return an error if the total to reset the ledger is 0, ie.
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.
How is the running time for this try state check? Don't mind putting this in release for now if it is not super long but want to point out that you are reading some storages multiple times and it can be optimized to be much faster.
Ideally we read any storage only once and keep it in memory for further checks.