-
Notifications
You must be signed in to change notification settings - Fork 813
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
More tests and checks confirming that ledger.controller
is always correct.
#2599
Conversation
bot fmt |
@gpestana https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4590979 was started for your command Comment |
@gpestana Command |
// `ledger.controller` is never stored in raw storage. | ||
let raw = Ledger::<T>::get(stash).unwrap_or_else(|| { | ||
Ledger::<T>::get(ctrl.clone()) | ||
.expect("try_check: bonded stash/ctrl does not have an associated 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.
Should we just log an error or panic? Since try state checks are mostly caused by older issues, we may not want CI to fail for these errors?
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.
Is there any inconsistent/wrong state in a production network?
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
…orrect. (paritytech#2599) A bonded ledger fetched with the `StakingLedger` implementation exposes a method `ledger.controller()` that returns the controller of the ledger. However, that controller is computed and stored under the `ledger.controller` field on the fly - i.e when the ledger is fetched from storage using the `StakingLedger::get` method. The controller field is never stored in storage. This PR add a few more tests checks and improves the ledger try-state checks to make sure these invariants hold true. --------- Co-authored-by: command-bot <> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
A bonded ledger fetched with the
StakingLedger
implementation exposes a methodledger.controller()
that returns the controller of the ledger. However, that controller is computed and stored under theledger.controller
field on the fly - i.e when the ledger is fetched from storage using theStakingLedger::get
method. The controller field is never stored in storage.This PR add a few more tests checks and improves the ledger try-state checks to make sure these invariants hold true.