-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Stash/controller model for staking #1782
Conversation
srml/balances/src/lib.rs
Outdated
|
|
||
| fn total_issuance() -> Self:: Balance { | ||
| fn total_issuance() -> Self::Balance { | ||
| Self::total_issuance() |
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.
isn't this an infinite recursive call? or is there any mechanism to ensure this calls total_issuance generated by decl_storage?
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 not new, but it does look dodgy...
…rate into gav-new-staking
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 fixed the global tests and merge conflicts in the last commit and of course had to build the wasm files again. I only learned afterward that once wasm is re-built a impl version bump is usually needed. Is this the case when now the PR impl_version is already bumped w.r.t. master?
In either case, if someone with a bit more experience with versioning confirms that this spec/impl versioning is ok then this is all good to merge. Rest of the minor test cases can be created via the separate phragmen PR.
shawntabrizi
left a comment
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.
Looks good to merge in with a temporary validator choosing algorithm.
There should be a second pass at tests once Phragmen is in, and there are TODO items everywhere this will need to be addressed.
Additionally, I think it makes sense to drop ensure_account_liquid with ensure_account_can_withdraw, but that can be discussed elsewhere.
Almost forgot this one
| let controller = ensure_signed(origin)?; | ||
| let _ledger = Self::ledger(&controller).ok_or("not a controller")?; | ||
| <Nominators<T>>::remove(&controller); | ||
| ensure!(prefs.unstake_threshold <= MAX_UNSTAKE_THRESHOLD, "unstake threshold too large"); |
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.
ensure! after you've made changes to storage. Rookie error :-P
srml/staking/src/lib.rs
Outdated
| } | ||
|
|
||
| impl<T: Trait> EnsureAccountLiquid<T::AccountId, BalanceOf<T>> for Module<T> { | ||
| // TODO: Consider replacing uses of this function in favor for ensure_account_can_withdraw |
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 remains here on purpose. Contracts module cannot be changed in order to use the finer-grained function.
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 it remains on purpose, we should create an issue for it :)
|
|
||
| /* | ||
| #[test] | ||
| fn slot_stake_is_least_staked_validator_and_limits_maximum_punishment() { |
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.
@shawntabrizi shouldn't we uncomment this 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.
Yeah, please commit no commented-out-code.
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.
fixed
|
I'd think |
* First steps to stash/controller separation * More drafting * More drafting * Finish draft. * Optimisation * Remove accidental commit * Make it build. * Fix linked map for traits. * Fix Option<_> variant. * Improve naming a tad * Rebuild runtime * Builds! * First test. * Bump RT version * Minor fix * Update Mock * adds the correct reward testcase (+staking eras which was already ok) * fixes the basic staking testcase to work properly (along with a small fix in the module) * New logic to avoid controller transferring stash. * Fix some build issues. * adding some comments to tests * Fix impls. * adds a few more lines to explain the test case * More fixes. * gets the basic test up and running again * Fix rest of build * Rebuild wasm * Fix docs. * fix staking test with new chnages * updating some tests, pending questions * More working tests * adds double staking test * Docs * remove invalid slashing test * Payee stuff. * Fix build * Docs * Fix test * Fix a couple of tests * Layout plan for finishing tests before Pragmen * Add some working tests * re-build staking and reward tests * Add more tests * fix offline grace test * Nominator should have payee checked for cleanup * adds more nomination tets * adds validator prefs tests * Fix and clean up some TODOs * Fix a couple of issues * Fix tests * noting warnings from tests * final fix of local tests * Fix slot_stake bug * Half baked test * Add logic to limit `unstake_threshold` set in storage * Make sure to check before writing! Almost forgot this one * Move a couple of comments * fix last broken slot_stake test * Ignore broken test
Implements #1709.
Also:
EnsureAccountLiquidby adding a finer grained querier.Associated spec/docs are at https://github.com/paritytech/substrate/blob/1a2ec9eec1fe9b3cc2677bac629fd7e9b0f6cf8e/srml/staking/Staking.md
TODO:
IntentionsandNominatingover toDesiredNominatorsFor, renameCurrentNominatorsFortoStakersand populate at new era naively fromDesired.sudothat checks to make sure theCallis to the governance module.