-
Notifications
You must be signed in to change notification settings - Fork 336
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
Remove deprecated leave delegator functionality #2349
Conversation
Coverage generated "Tue Aug 8 16:19:31 UTC 2023": Master coverage: 87.39% |
/// Request to leave the set of delegators. If successful, the caller is scheduled to be | ||
/// allowed to exit via a [DelegationAction::Revoke] towards all existing delegations. | ||
/// Success forbids future delegation requests until the request is invoked or cancelled. | ||
#[pallet::call_index(19)] |
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.
One thing that is really important is to help make sure we never reuse these call indices. At a minimum, leaving a comment would help, but I think some test cases would be better.
It might suffice to leave these indices unused for a full runtime upgrade cycle, but also note that other projects which use parachain_staking
will have the same potential problem with reuse. The safe choice is clearly to prohibit them from being used again in the future.
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.
To elaborate: in the past we had a problem where an extrinsic got recorded in the scheduler with a specific call index, and the pallet shuffled the call indices around during a runtime upgrade. So the extrinsic was decoded and recorded in one runtime and then executed (with its call index misinterpreted) in the next runtime.
These calls probably wouldn't end up in the scheduler, so maybe that's not a problem. It still is safe and harmless to make sure we avoid them in the future, though...
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 I thought about it and even wanted to write a test, but realized that we need to cherry-pick this PR https://github.com/paritytech/substrate/pull/13558/files into substrate (and maybe maintain until it lands in a release) to get this test to actually get the call_indices
defined on a pallet. Alternatively we can just always return an error and keep the extrinsic as is.
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.
Shawn had the same suggestion: leave some dummy functions with these call indices which are no-ops. This would probably be the best way to ensure they aren't used.
For the record, he also didn't think it was a big deal :)
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'd actually be against a no-op since this gives the user a false sense of security when they dispatch it. They might just assume a success for whatever they thought might happen with that dispatchable :) An error is more explicit to call for attention in that regard.
However, in scope of this PR do we have any opinions if we should/should not add such a function?
Maybe @librelois has an opinion?
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.
An error is more explicit to call for attention in that regard.
I agree, I think that the best way is to keep theses calls but always return a new error like "RemovedCall"
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.
You think it's also worthwhile to rename the calls to removed_call_{{index}}
?
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.
Agree with the above: an explicit failure is good, and making the name obnoxiously obvious about its purpose is good. The whole point is to squat on the call indices.
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.
Thanks updated, please check
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.
Did a quick check to see if there's still some usage of the deprecated calls. Searching in Subscan for DelegatorExitScheduled
events in the last year:
- Moonbeam: 8 events in the last year, 1 in the last three months
- Moonriver: 3 events in the last year, 1 in the last three months
- Moonbase: 2 events in the last year (1 by me)
I think we're good to remove them
* remove leave delegator functionality * remove precompile methods * return error for removed call indices
* progress on PoV tests * started precompile migration * finished author precompile tests * bn and callpermit precompiles done * collective precompile done * beginning conviction voting tests * Updated to moonwall4 * fix * added erc20 precompile tests * progress on local asset precompile * Added Local assets tests * modexp tests done * Added proxy tests * progress on proxy tests * finished proxy tests * updated precompile tests * added more precompile tests * progress * added more precompile tests * refactored wormhole tests * added XCM transactor tests * started xcm utils tests * Precompile tests done * done proxy tests * randomness tests * randomness tests * randomness tests * finished randomness tests * added receipt tests * staking tests * more staking tests * more staking * progress * completed staking tests * added subscription tests * added sudo tests * added treasury tests * update moonwall config * added missing conviction tests * txpool progress * tx pool tests done * CI fix * updated prettier CI * editorconfig * pnpm cache * changed CI * fix CI * changes * fix CI * fixed some tests * more test fixes * fixed tests * lint * editor config * pkg fix * updated lockfile * pkg updates * fix import * fix import * archived old-style dev-tests * lint * PR comments * Port ERC20-XCM tests. Add excess gas tests (#2410) * ERC20XCM tests * Add tsx * Moved expect out of xcm helper * Removed unused imports * removed old tests * editorconfig grr * removed smoke tests * Upgraded randomness smoketest * updated randomness comments * Fix conviction MaxVotes (#2401) * Reduce the ConvictionVoting MaxVotes from 512 to 30 * Set MaxVote to 20 * Run toml-sort and update repo reference (#2426) * [MOON-2434] remove deprecated leave delegator functionality (#2349) * remove leave delegator functionality * remove precompile methods * return error for removed call indices * removed scheduleLeaveDelegators calls * de-bun 🫓 the CI * fix * smoke-fix * fixed ci --------- Co-authored-by: Francisco Gamundi <52399794+fgamundi@users.noreply.github.com> Co-authored-by: Alan Sapede <alan.sapede@gmail.com>
* progress on PoV tests * started precompile migration * finished author precompile tests * bn and callpermit precompiles done * collective precompile done * beginning conviction voting tests * Updated to moonwall4 * fix * added erc20 precompile tests * progress on local asset precompile * Added Local assets tests * modexp tests done * Added proxy tests * progress on proxy tests * finished proxy tests * updated precompile tests * added more precompile tests * progress * added more precompile tests * refactored wormhole tests * added XCM transactor tests * started xcm utils tests * Precompile tests done * done proxy tests * randomness tests * randomness tests * randomness tests * finished randomness tests * added receipt tests * staking tests * more staking tests * more staking * progress * completed staking tests * added subscription tests * added sudo tests * added treasury tests * update moonwall config * added missing conviction tests * txpool progress * tx pool tests done * CI fix * updated prettier CI * editorconfig * pnpm cache * changed CI * fix CI * changes * fix CI * fixed some tests * more test fixes * fixed tests * lint * editor config * pkg fix * updated lockfile * pkg updates * fix import * fix import * archived old-style dev-tests * lint * PR comments * Port ERC20-XCM tests. Add excess gas tests (#2410) * ERC20XCM tests * Add tsx * Moved expect out of xcm helper * Removed unused imports * removed old tests * editorconfig grr * begin xcm migration * migrate more xcm tests to moonwall using xcmv3 * removed smoke tests * Upgraded randomness smoketest * updated randomness comments * Fix conviction MaxVotes (#2401) * Reduce the ConvictionVoting MaxVotes from 512 to 30 * Set MaxVote to 20 * Run toml-sort and update repo reference (#2426) * [MOON-2434] remove deprecated leave delegator functionality (#2349) * remove leave delegator functionality * remove precompile methods * return error for removed call indices * removed scheduleLeaveDelegators calls * de-bun 🫓 the CI * fix * migrate hrmp-asset-transfer tests * apply some fixes * migrate test-mock-hrmp-transact-ethereum * small fixes * migrate test-mock-hrmp-transact * migrate more tests to moonwall * migrate test-xcmv3-new-instructions and max weight * create separate folders for v2 and v3 * migrate test-mock-hrmp-transact tests to v3 * migrate mock-hrmp-transact-ethereum tests to v3 * fix network "Any" in tests * fix order in xcmv2 tests * fix order in xcmv3 tests * remove replaceNetworkAny * prettier * fmt * fix orders * remove "Any" type from test-xcm-erc20-v3-filter * use proper GLMR constant * remove cast to any in xcmv2 tests * remove cast to any in xcmv3 tests and re-org * small fixes * add expect messages * refactor registerForeignAsset * fixes in test-mock-dmp-queue * remove BN from AssetMetadata * use proper readContract function * use proper deployContract function * remove BN from requireWeightAtMost * use sovereignAccountOfSibling helper function * remove expectOk --------- Co-authored-by: timbrinded <79199034+timbrinded@users.noreply.github.com> Co-authored-by: Francisco Gamundi <52399794+fgamundi@users.noreply.github.com> Co-authored-by: Alan Sapede <alan.sapede@gmail.com>
* progress on PoV tests * started precompile migration * finished author precompile tests * bn and callpermit precompiles done * collective precompile done * beginning conviction voting tests * Updated to moonwall4 * fix * added erc20 precompile tests * progress on local asset precompile * Added Local assets tests * modexp tests done * Added proxy tests * progress on proxy tests * finished proxy tests * updated precompile tests * added more precompile tests * progress * added more precompile tests * refactored wormhole tests * added XCM transactor tests * started xcm utils tests * Precompile tests done * done proxy tests * randomness tests * randomness tests * randomness tests * finished randomness tests * added receipt tests * staking tests * more staking tests * more staking * progress * completed staking tests * added subscription tests * added sudo tests * added treasury tests * update moonwall config * added missing conviction tests * txpool progress * tx pool tests done * CI fix * updated prettier CI * editorconfig * pnpm cache * changed CI * fix CI * changes * fix CI * fixed some tests * more test fixes * fixed tests * lint * editor config * pkg fix * updated lockfile * pkg updates * fix import * fix import * archived old-style dev-tests * lint * PR comments * Port ERC20-XCM tests. Add excess gas tests (#2410) * ERC20XCM tests * Add tsx * Moved expect out of xcm helper * Removed unused imports * removed old tests * editorconfig grr * begin xcm migration * migrate more xcm tests to moonwall using xcmv3 * removed smoke tests * Upgraded randomness smoketest * updated randomness comments * Fix conviction MaxVotes (#2401) * Reduce the ConvictionVoting MaxVotes from 512 to 30 * Set MaxVote to 20 * Run toml-sort and update repo reference (#2426) * [MOON-2434] remove deprecated leave delegator functionality (#2349) * remove leave delegator functionality * remove precompile methods * return error for removed call indices * removed scheduleLeaveDelegators calls * de-bun 🫓 the CI * fix * migrate hrmp-asset-transfer tests * apply some fixes * migrate test-mock-hrmp-transact-ethereum * small fixes * migrate test-mock-hrmp-transact * migrate more tests to moonwall * migrate test-xcmv3-new-instructions and max weight * create separate folders for v2 and v3 * migrate test-mock-hrmp-transact tests to v3 * migrate mock-hrmp-transact-ethereum tests to v3 * fix network "Any" in tests * fix order in xcmv2 tests * fix order in xcmv3 tests * remove replaceNetworkAny * prettier * fmt * fix orders * remove "Any" type from test-xcm-erc20-v3-filter * use proper GLMR constant * remove cast to any in xcmv2 tests * remove cast to any in xcmv3 tests and re-org * small fixes * add expect messages * refactor registerForeignAsset * fixes in test-mock-dmp-queue * remove BN from AssetMetadata * use proper readContract function * use proper deployContract function * remove BN from requireWeightAtMost * use sovereignAccountOfSibling helper function * remove expectOk --------- Co-authored-by: timbrinded <79199034+timbrinded@users.noreply.github.com> Co-authored-by: Francisco Gamundi <52399794+fgamundi@users.noreply.github.com> Co-authored-by: Alan Sapede <alan.sapede@gmail.com>
What does it do?
removes deprecated leave delegator functionality
❗
schedule_leave_delegators
schedule_revoke_delegation
removed_call_19
that always returns aRemovedCall
error.❗
execute_leave_delegators
execute_delegation_request
removed_call_20
that always returns aRemovedCall
error.❗
cancel_leave_delegators
cancel_delegation_request
removed_call_21
that always returns aRemovedCall
error.❗
execute_delegation_request
emits aDelegationRevoked
event before aDelegatorLeft
event if the last delegation for a delegator is revoked, which was not the case forexecute_leave_delegators
which would only emit theDelegatorLeft
event.