Skip to content
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 MinDelegatorStk in favor of MinDelegation pallet-staking const #2381

Merged
merged 5 commits into from
Jul 10, 2023

Conversation

nbaztec
Copy link
Contributor

@nbaztec nbaztec commented Jul 6, 2023

What does it do?

removes MinDelegatorStk in favor of MinDelegation pallet-staking const.

On almost all our networks the values were same and therefore redundant. Additionally this caused additional complexity/odd behavior during revoke, where for delegations D1 with a MinDelegation (= 3) bond and D2 with a higher MinDelegatorStk bond (= 5), D2 would not be able to schedule a revoke since the delegators total bond would be below the MinDelegatorStk (5)

This was previously circumvented via the schedule_leave_delegators extrinsic, that was deprecated and is set to be removed.

This PR simplifies the process by removing the MinDelegatorStk and simply using the MinDelegation as the sole condition for a delegation to be instantiated, which by definition makes the user a delegator.

tl;dr A user is a delegator if it has atleast 1 delegation with a bond value of MinDelegation or more.

⚠️ Breaking Changes ⚠️

❗ Removes MinDelegatorStk from pallet-parachain-staking config, in favor of MinDelegation

❗ The extrinsics delegate and delegateWithAutoCompound now return DelegationBelowMin error instead of the former DelegatorBondBelowMin when being called with a value less than MinDelegation

@nbaztec nbaztec added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited breaking Needs to be mentioned in breaking changes labels Jul 6, 2023
Copy link
Contributor

@notlesh notlesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I know that we had this deployed in most cases as MinDelegatorStk == MinDelegation, but are there any concerns for runtimes where this isn't the case?

I tried to do some basic analysis of this, but it gets complicated because there are potentially checks across runtimes (e.g. you could schedule a request in runtime X and execute it in runtime X+1). It looks to me like such cases would leave an unexecutable request in storage because it will always error when executed. That said, this is probably no different than adjusting the constant between runtimes...

@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

Coverage generated "Fri Jul 7 13:00:25 UTC 2023":
https://s3.amazonaws.com/moonbeam-coverage/pulls/2381/html/index.html

Master coverage: 70.94%
Pull coverage: 70.92%

@nbaztec nbaztec merged commit 3c8038b into master Jul 10, 2023
@nbaztec nbaztec deleted the nish-remove-min-delegator-stk branch July 10, 2023 10:57
@noandrea noandrea changed the title [MOON-2467] remove MinDelegatorStk in favor of MinDelegation pallet-staking const Remove MinDelegatorStk in favor of MinDelegation pallet-staking const Aug 31, 2023
@notlesh notlesh added D1-audited👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D1-audited👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants