-
Notifications
You must be signed in to change notification settings - Fork 202
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
Feat/delegation impr v3 #6605
Open
sasurobert
wants to merge
28
commits into
rc/barnard
Choose a base branch
from
feat/delegation-impr-v3
base: rc/barnard
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/delegation impr v3 #6605
+1,334
−58
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…should-err Claim rewards with call value should err
increaseFee with 30 epoch cooldown
# Conflicts: # common/enablers/enableEpochsHandler_test.go # config/tomlConfig_test.go # node/metrics/metrics.go # node/metrics/metrics_test.go # statusHandler/statusMetricsProvider.go # statusHandler/statusMetricsProvider_test.go
Barnard delegation 3.5 5 nov
Migrate from sp to sp
# Conflicts: # vm/systemSmartContracts/delegation.go
Integration tests migrate delegation
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
Barnard to deleg 14 11
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reasoning behind the pull request
Delegation improvements after Staking Phase 4.0:
Proposed changes
Delegation Fixes after Staking Phase 4.0:
Add a flag and check for call value
Proposal: add storage for last epoch when change happened and do not allow a new change of FEE for the next 30 days.
There are always errors, so will always change the fee downwards, but upwards only once per 30 days.
Delegation improvements after Staking Phase 4.0:
MIP-18 - Migration feature for delegated EGLD to improve the efficiency of the dynamic validator market
This is a feature request asked by a lot of community members and someone has written a proposal as well. The solution I propose is to enable users to move funds from one provider to another once per 30 days.
changeStakingProvider@amount@sourceSCAddress@destinationSCAddress
vmInput.Caller address is the delegator, it is the user address, or the SC address in case of liquid staking contracts or DAO.
vmInput.RecipientAddress is the delegation manager contract, which will forward the call to the delegation contract the user wants to move his funds.
sourceSCAddress and destinationSCAddress are verified to be a system delegation contract.
removeDelegationFromSource@delegatorAddress@amount: does basic checks, can be called by delegation manager address only, and removes from the user the specified amount if the user has enough delegation there.
The system checks what was the last time the delegator moved funds to this contract, by checking a new storage in which the epoch was saved.
If epoch == 0 or epoch + 30 < currentEpoch we can go to the next step of moving.
Rewards are calculated for the user and saved into claimable rewards (this code already exists and used when user delegates more), and the new amount of delegation is computed by subtracting the amount value.
moveDelegationToDestination@delegatorAddress@amount: does basic checks, can be called by delegation manager address only, adds the stated amount to the user’s delegation. It creates new storage where the current epoch is saved, the user cannot changeProvider from this place for the next 30 days.He can always unStake and unBond.
It will call the internal delegate function, compute rewards for the user if the user already had delegation, increase the delegation amount for the user
New function in ValidatorSC is called which makes unStake and unBond in one call for the staking provider, actually the only thing it needs to do is to change the TotalStakedAmount from the staking provider, without adding it to the unStakedFunds. Unstaking of nodes is happening at the end of the epoch if the SP does not have enough funds (this process is the existing code - which works like this even now).
moveStakeFromValidatorToValidator@stakeAmount@valiadtorA@validatorB - it can be called by system delegationContracts only. The caller is the delegation contract from which the funds are moved out.
This function will also increase the TotalStakedAmount for validatorB. Nothing else to do.
removeDelegationFromSource, moveDelegationToDestination and moveStakeFromValidatorToValidator are called synchronously. If one of them fails, no changes are made.
Process finished.
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?