feat(REP-0024): implement logic and unit-tests#166
Open
TuDo1403 wants to merge 10 commits intorelease/v0.8.2from
Open
feat(REP-0024): implement logic and unit-tests#166TuDo1403 wants to merge 10 commits intorelease/v0.8.2from
TuDo1403 wants to merge 10 commits intorelease/v0.8.2from
Conversation
added 5 commits
May 27, 2025 13:49
…/rep-0024 chore(`rep-0024`): merge from `release/v0.8.2`
added 5 commits
June 13, 2025 14:55
Collaborator
huyhuynh3103
left a comment
There was a problem hiding this comment.
Do you have the storage layout log?
| error ErrEmptyArray(); | ||
|
|
||
| struct Reward { | ||
| uint64 startBlock; |
Collaborator
There was a problem hiding this comment.
Using uint64 for block numbers is quite risky, since we have a plan to update the block time to 1 second
| /// @dev The boolean flag to check if REP-10 is activated. | ||
| bool internal _isREP10Activated; | ||
| bool internal __deprecatedIsREP10Activated; | ||
| Reward[] internal _blockRewards; |
| ) internal { | ||
| uint256 length = rewards.length; | ||
| if (length == 0) revert ErrEmptyArray(); | ||
| delete _blockRewards; |
Collaborator
There was a problem hiding this comment.
This just sets the array length to zero and leaves the values at each index untouched, right? Is that expected?
Contributor
Author
There was a problem hiding this comment.
no that actually delete the block reward array imo
| /** | ||
| * @inheritdoc IStakingVesting | ||
| */ | ||
| function receiveRON() external payable { } |
Collaborator
There was a problem hiding this comment.
This logic is not mentioned in REP
Contributor
Author
There was a problem hiding this comment.
this is untouched.
| _lastBlockSendingBonus = block.number; | ||
|
|
||
| blockProducerBonus = forBlockProducer ? blockProducerBlockBonus(block.number) : 0; | ||
| bridgeOperatorBonus = forBridgeOperator ? bridgeOperatorBlockBonus(block.number) : 0; |
Collaborator
There was a problem hiding this comment.
This logic also is not mentioned in REP#24
Contributor
Author
There was a problem hiding this comment.
deprecated long ago
This file contains hidden or 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
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.
This pull request introduces significant updates to the
StakingVestingcontract and its related interface to enhance flexibility and remove deprecated functionality. Key changes include replacing static bonus configurations with dynamic block rewards, adding new error types and events for better validation and tracking, and deprecating REP-10-related logic.Spec: https://github.com/ronin-chain/REPs/blob/main/REP-0024/REP-0024.md
Enhancements to Block Rewards and Validation
Rewardstruct and replaced static bonus configurations with dynamic block rewards managed through new methods (updateBlockRewards,setBlockRewardRange, etc.) inIStakingVestingandStakingVesting. These methods enforce validation rules such as bounds checking and descending order of start blocks. [1] [2] [3]ErrOutOfBound,ErrOutOfOrder,ErrEmptyArray) and theBlockRewardRangeUpdatedevent to improve input validation and tracking of reward updates. [1] [2]Deprecation of Unused Functionality
REP10FastFinalityRewardActivatedand associated storage variables, to streamline the contract. [1] [2] [3]bridgeOperatorBlockBonus,setBridgeOperatorBonusPerBlock, etc.), as they are no longer used. [1] [2] [3]Interface and Method Updates
blockProducerBlockBonusto return auint64and calculate the bonus dynamically based on the current block number and configured rewards. [1] [2]getBlockRewardRange) and current block rewards (getBlockRewards) for better transparency. [1] [2]Internal Contract Refactoring
_setBlockRewardRangeand_updateBlockRewardsinternal methods inStakingVestingto encapsulate reward-related logic and enforce validation._blockProducerBonusPerBlock,_bridgeOperatorBonusPerBlock, etc.) to clean up the contract.Test and Script Adjustments
updateBlockRewardsmethod. [1] [2]