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

feat(zkevm-integration): implement add-draft-interface #132

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented Oct 18, 2024

contracts/ronin/profile/Profile.sol Outdated Show resolved Hide resolved
contracts/ronin/profile/Profile.sol Outdated Show resolved Hide resolved
/**
* @inheritdoc IProfile
*/
function changeSequencerAddr(address id, address sequencer) external onlyAdmin {
Copy link
Contributor

Choose a reason for hiding this comment

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

As the default sequencer, aggregator is profile id, it's very likely that we need to change sequencer, aggregator address after creating rollup. But this function requires admin not the candidate admin, so this operation must go through proposal. Does it match with the requirements?

Copy link
Collaborator

@TuDo1403 TuDo1403 Oct 24, 2024

Choose a reason for hiding this comment

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

latest sync with @phuctd95 I can confirm this follows the requirements.

@TuDo1403 TuDo1403 force-pushed the implement-feature/zkevm-integration/add-draft-interface branch from 47b12b9 to 3f357bb Compare October 24, 2024 08:05
Copy link
Author

github-actions bot commented Oct 24, 2024

Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary

reentrancy-eth

Impact: High
Confidence: Medium

function _distributeRewardToTreasuriesAndCalculateTotalDelegatorsReward(
uint256 lastPeriod,
address[] memory cids
)
private
returns (
uint256[] memory delegatorBlockMiningRewards,
uint256[] memory delegatorL2BlockMiningRewards,
uint256[] memory delegatorFastFinalityRewards
)
{
address vId; // validator id
address payable treasury;
uint256 length = cids.length;
delegatorBlockMiningRewards = new uint256[](length);
delegatorL2BlockMiningRewards = new uint256[](length);
delegatorFastFinalityRewards = new uint256[](length);
(uint256 minRate, uint256 maxRate) = IStaking(getContract(ContractType.STAKING)).getCommissionRateRange();
for (uint256 i; i < length; ++i) {
vId = cids[i];
treasury = _candidateInfo[vId].__shadowedTreasury;
// Distribute the L2 mining reward to the treasury address of the validator regardless of the jail status.
delegatorL2BlockMiningRewards[i] = _delegatorL2MiningReward[vId];
_distributeL2MiningReward(vId, treasury);
if (!_isJailedById(vId) && !_miningRewardDeprecatedById(vId, lastPeriod)) {
(uint256 validatorFFReward, uint256 delegatorFFReward) = _calcCommissionReward({
vId: vId,
totalReward: _fastFinalityReward[vId],
maxCommissionRate: maxRate,
minCommissionRate: minRate
});
delegatorBlockMiningRewards[i] = _delegatorMiningReward[vId];
delegatorFastFinalityRewards[i] = delegatorFFReward;
_distributeMiningReward(vId, treasury);
_distributeFastFinalityReward(vId, treasury, validatorFFReward);
} else {
_totalDeprecatedReward += _validatorMiningReward[vId] + _delegatorMiningReward[vId] + _fastFinalityReward[vId];
}
delete _delegatorMiningReward[vId];
delete _validatorMiningReward[vId];
delete _fastFinalityReward[vId];
delete _delegatorL2MiningReward[vId];
delete _validatorL2MiningReward[vId];
}
}

function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {
unchecked {
uint256 newPeriod = _computePeriod(block.timestamp);
bool periodEnding = _isPeriodEnding(newPeriod);
uint256 lastPeriod = currentPeriod();
uint256 epoch = epochOf(block.number);
uint256 nextEpoch = epoch + 1;
IRandomBeacon randomBeacon = IRandomBeacon(getContract(ContractType.RANDOM_BEACON));
// This request is actually only invoked at the first epoch of the period.
randomBeacon.execRequestRandomSeedForNextPeriod(lastPeriod, newPeriod);
// Get all candidate ids
address[] memory allCids = _candidateIds;
_syncFastFinalityReward({ epoch: epoch, validatorIds: allCids });
if (periodEnding) {
ISlashIndicator slashIndicatorContract = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR));
// Slash submit random beacon proof unavailability first, then update credit scores.
randomBeacon.execRecordAndSlashUnavailability(lastPeriod, newPeriod, address(slashIndicatorContract), allCids);
slashIndicatorContract.execUpdateCreditScores(allCids, lastPeriod);
(
uint256[] memory delegatorBlockMiningRewards,
uint256[] memory delegatorL2BlockMiningRewards,
uint256[] memory delegatorFastFinalityRewards
) = _distributeRewardToTreasuriesAndCalculateTotalDelegatorsReward(lastPeriod, allCids);
_settleAndTransferDelegatingRewards(
lastPeriod, allCids, delegatorBlockMiningRewards, delegatorL2BlockMiningRewards, delegatorFastFinalityRewards
);
_tryRecycleLockedFundsFromEmergencyExits();
_recycleDeprecatedRewards();
address[] memory revokedCandidateIds = _syncCandidateSet(newPeriod);
if (revokedCandidateIds.length > 0) {
// Re-update `allCids` after unsatisfied candidates get removed.
allCids = _candidateIds;
slashIndicatorContract.execResetCreditScores(revokedCandidateIds);
}
// Wrap up the beacon period includes (1) finalizing the beacon proof, and (2) determining the validator list for the next period by new proof.
// Should wrap up the beacon after unsatisfied candidates get removed.
randomBeacon.execFinalizeBeaconAndPendingCids(lastPeriod, newPeriod, allCids);
_periodEndBlock[lastPeriod] = block.number;
_currentPeriodStartAtBlock = block.number + 1;
}
// Clear the previous validator set and block producer set before sync the new set from beacon.
_clearPreviousValidatorSetAndBlockProducerSet();
// Query the new validator set for upcoming epoch from the random beacon contract.
// Save new set into the contract storage.
address[] memory newValidatorIds = _syncValidatorSet(randomBeacon, newPeriod, nextEpoch);
// Activate applicable validators into the block producer set.
_updateApplicableValidatorToBlockProducerSet(newPeriod, nextEpoch, newValidatorIds);
emit WrappedUpEpoch(lastPeriod, epoch, periodEnding);
_periodOf[nextEpoch] = newPeriod;
_lastUpdatedPeriod = newPeriod;
}
}

function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {
unchecked {
uint256 newPeriod = _computePeriod(block.timestamp);
bool periodEnding = _isPeriodEnding(newPeriod);
uint256 lastPeriod = currentPeriod();
uint256 epoch = epochOf(block.number);
uint256 nextEpoch = epoch + 1;
IRandomBeacon randomBeacon = IRandomBeacon(getContract(ContractType.RANDOM_BEACON));
// This request is actually only invoked at the first epoch of the period.
randomBeacon.execRequestRandomSeedForNextPeriod(lastPeriod, newPeriod);
// Get all candidate ids
address[] memory allCids = _candidateIds;
_syncFastFinalityReward({ epoch: epoch, validatorIds: allCids });
if (periodEnding) {
ISlashIndicator slashIndicatorContract = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR));
// Slash submit random beacon proof unavailability first, then update credit scores.
randomBeacon.execRecordAndSlashUnavailability(lastPeriod, newPeriod, address(slashIndicatorContract), allCids);
slashIndicatorContract.execUpdateCreditScores(allCids, lastPeriod);
(
uint256[] memory delegatorBlockMiningRewards,
uint256[] memory delegatorL2BlockMiningRewards,
uint256[] memory delegatorFastFinalityRewards
) = _distributeRewardToTreasuriesAndCalculateTotalDelegatorsReward(lastPeriod, allCids);
_settleAndTransferDelegatingRewards(
lastPeriod, allCids, delegatorBlockMiningRewards, delegatorL2BlockMiningRewards, delegatorFastFinalityRewards
);
_tryRecycleLockedFundsFromEmergencyExits();
_recycleDeprecatedRewards();
address[] memory revokedCandidateIds = _syncCandidateSet(newPeriod);
if (revokedCandidateIds.length > 0) {
// Re-update `allCids` after unsatisfied candidates get removed.
allCids = _candidateIds;
slashIndicatorContract.execResetCreditScores(revokedCandidateIds);
}
// Wrap up the beacon period includes (1) finalizing the beacon proof, and (2) determining the validator list for the next period by new proof.
// Should wrap up the beacon after unsatisfied candidates get removed.
randomBeacon.execFinalizeBeaconAndPendingCids(lastPeriod, newPeriod, allCids);
_periodEndBlock[lastPeriod] = block.number;
_currentPeriodStartAtBlock = block.number + 1;
}
// Clear the previous validator set and block producer set before sync the new set from beacon.
_clearPreviousValidatorSetAndBlockProducerSet();
// Query the new validator set for upcoming epoch from the random beacon contract.
// Save new set into the contract storage.
address[] memory newValidatorIds = _syncValidatorSet(randomBeacon, newPeriod, nextEpoch);
// Activate applicable validators into the block producer set.
_updateApplicableValidatorToBlockProducerSet(newPeriod, nextEpoch, newValidatorIds);
emit WrappedUpEpoch(lastPeriod, epoch, periodEnding);
_periodOf[nextEpoch] = newPeriod;
_lastUpdatedPeriod = newPeriod;
}
}

function execDeprecatePools(
address[] calldata poolIds,
uint256 newPeriod
) external override onlyContract(ContractType.VALIDATOR) {
if (poolIds.length == 0) {
return;
}
for (uint256 i = 0; i < poolIds.length;) {
address poolId = poolIds[i];
PoolDetail storage _pool = _poolDetail[poolId];
// Deactivate the pool admin in the active mapping.
delete _adminOfActivePoolMapping[_pool.__shadowedPoolAdmin];
// Deduct and transfer the self staking amount to the pool admin.
uint256 deductingAmount = _pool.stakingAmount;
if (deductingAmount > 0) {
_deductStakingAmount(_pool, deductingAmount);
if (!_unsafeSendRONLimitGas(payable(_pool.__shadowedPoolAdmin), deductingAmount, DEFAULT_ADDITION_GAS)) {
emit StakingAmountTransferFailed(_pool.pid, _pool.__shadowedPoolAdmin, deductingAmount, address(this).balance);
}
}
// Settle the unclaimed reward and transfer to the pool admin.
uint256 lastRewardAmount = _claimReward(poolId, _pool.__shadowedPoolAdmin, newPeriod);
if (lastRewardAmount > 0) {
_unsafeSendRONLimitGas(payable(_pool.__shadowedPoolAdmin), lastRewardAmount, DEFAULT_ADDITION_GAS);
}
unchecked {
++i;
}
}
emit PoolsDeprecated(poolIds);
}

function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {
unchecked {
uint256 newPeriod = _computePeriod(block.timestamp);
bool periodEnding = _isPeriodEnding(newPeriod);
uint256 lastPeriod = currentPeriod();
uint256 epoch = epochOf(block.number);
uint256 nextEpoch = epoch + 1;
IRandomBeacon randomBeacon = IRandomBeacon(getContract(ContractType.RANDOM_BEACON));
// This request is actually only invoked at the first epoch of the period.
randomBeacon.execRequestRandomSeedForNextPeriod(lastPeriod, newPeriod);
// Get all candidate ids
address[] memory allCids = _candidateIds;
_syncFastFinalityReward({ epoch: epoch, validatorIds: allCids });
if (periodEnding) {
ISlashIndicator slashIndicatorContract = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR));
// Slash submit random beacon proof unavailability first, then update credit scores.
randomBeacon.execRecordAndSlashUnavailability(lastPeriod, newPeriod, address(slashIndicatorContract), allCids);
slashIndicatorContract.execUpdateCreditScores(allCids, lastPeriod);
(
uint256[] memory delegatorBlockMiningRewards,
uint256[] memory delegatorL2BlockMiningRewards,
uint256[] memory delegatorFastFinalityRewards
) = _distributeRewardToTreasuriesAndCalculateTotalDelegatorsReward(lastPeriod, allCids);
_settleAndTransferDelegatingRewards(
lastPeriod, allCids, delegatorBlockMiningRewards, delegatorL2BlockMiningRewards, delegatorFastFinalityRewards
);
_tryRecycleLockedFundsFromEmergencyExits();
_recycleDeprecatedRewards();
address[] memory revokedCandidateIds = _syncCandidateSet(newPeriod);
if (revokedCandidateIds.length > 0) {
// Re-update `allCids` after unsatisfied candidates get removed.
allCids = _candidateIds;
slashIndicatorContract.execResetCreditScores(revokedCandidateIds);
}
// Wrap up the beacon period includes (1) finalizing the beacon proof, and (2) determining the validator list for the next period by new proof.
// Should wrap up the beacon after unsatisfied candidates get removed.
randomBeacon.execFinalizeBeaconAndPendingCids(lastPeriod, newPeriod, allCids);
_periodEndBlock[lastPeriod] = block.number;
_currentPeriodStartAtBlock = block.number + 1;
}
// Clear the previous validator set and block producer set before sync the new set from beacon.
_clearPreviousValidatorSetAndBlockProducerSet();
// Query the new validator set for upcoming epoch from the random beacon contract.
// Save new set into the contract storage.
address[] memory newValidatorIds = _syncValidatorSet(randomBeacon, newPeriod, nextEpoch);
// Activate applicable validators into the block producer set.
_updateApplicableValidatorToBlockProducerSet(newPeriod, nextEpoch, newValidatorIds);
emit WrappedUpEpoch(lastPeriod, epoch, periodEnding);
_periodOf[nextEpoch] = newPeriod;
_lastUpdatedPeriod = newPeriod;
}
}

function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {
unchecked {
uint256 newPeriod = _computePeriod(block.timestamp);
bool periodEnding = _isPeriodEnding(newPeriod);
uint256 lastPeriod = currentPeriod();
uint256 epoch = epochOf(block.number);
uint256 nextEpoch = epoch + 1;
IRandomBeacon randomBeacon = IRandomBeacon(getContract(ContractType.RANDOM_BEACON));
// This request is actually only invoked at the first epoch of the period.
randomBeacon.execRequestRandomSeedForNextPeriod(lastPeriod, newPeriod);
// Get all candidate ids
address[] memory allCids = _candidateIds;
_syncFastFinalityReward({ epoch: epoch, validatorIds: allCids });
if (periodEnding) {
ISlashIndicator slashIndicatorContract = ISlashIndicator(getContract(ContractType.SLASH_INDICATOR));
// Slash submit random beacon proof unavailability first, then update credit scores.
randomBeacon.execRecordAndSlashUnavailability(lastPeriod, newPeriod, address(slashIndicatorContract), allCids);
slashIndicatorContract.execUpdateCreditScores(allCids, lastPeriod);
(
uint256[] memory delegatorBlockMiningRewards,
uint256[] memory delegatorL2BlockMiningRewards,
uint256[] memory delegatorFastFinalityRewards
) = _distributeRewardToTreasuriesAndCalculateTotalDelegatorsReward(lastPeriod, allCids);
_settleAndTransferDelegatingRewards(
lastPeriod, allCids, delegatorBlockMiningRewards, delegatorL2BlockMiningRewards, delegatorFastFinalityRewards
);
_tryRecycleLockedFundsFromEmergencyExits();
_recycleDeprecatedRewards();
address[] memory revokedCandidateIds = _syncCandidateSet(newPeriod);
if (revokedCandidateIds.length > 0) {
// Re-update `allCids` after unsatisfied candidates get removed.
allCids = _candidateIds;
slashIndicatorContract.execResetCreditScores(revokedCandidateIds);
}
// Wrap up the beacon period includes (1) finalizing the beacon proof, and (2) determining the validator list for the next period by new proof.
// Should wrap up the beacon after unsatisfied candidates get removed.
randomBeacon.execFinalizeBeaconAndPendingCids(lastPeriod, newPeriod, allCids);
_periodEndBlock[lastPeriod] = block.number;
_currentPeriodStartAtBlock = block.number + 1;
}
// Clear the previous validator set and block producer set before sync the new set from beacon.
_clearPreviousValidatorSetAndBlockProducerSet();
// Query the new validator set for upcoming epoch from the random beacon contract.
// Save new set into the contract storage.
address[] memory newValidatorIds = _syncValidatorSet(randomBeacon, newPeriod, nextEpoch);
// Activate applicable validators into the block producer set.
_updateApplicableValidatorToBlockProducerSet(newPeriod, nextEpoch, newValidatorIds);
emit WrappedUpEpoch(lastPeriod, epoch, periodEnding);
_periodOf[nextEpoch] = newPeriod;
_lastUpdatedPeriod = newPeriod;
}
}

shadowing-state

Impact: High
Confidence: High

uint256[49] private ______gap;

uint256[50] private ______gap;

uninitialized-state

Impact: High
Confidence: High

uint256 internal _firstTrackedPeriodEnd;

uint256 internal _numberOfBlocksInEpoch;

mapping(uint32 rollupId => address cid) internal _rollupId2Id;

mapping(uint256 epoch => uint256 period) internal _periodOf;

mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;

uint256 internal _lastUpdatedPeriod;

mapping(address => uint256) internal _blockProducerJailedBlock;

mapping(address cid => bool isBlockProducer) internal _validatorMap;

mapping(uint256 period => uint256 endedAtBlock) internal _periodEndBlock;

mapping(uint256 idx => address cid) internal _validatorIds;

uint256 internal _currentPeriodStartAtBlock;

Copy link
Author

github-actions bot commented Oct 24, 2024

Storage Layout Change Report

Layout Changes for ProfileXComponents

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/profile/ProfileXComponents.sol	.729635267 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/profile/ProfileXComponents.sol	.730635281 +0000
@@ -3,4 +3,5 @@
     2          _consensus2Id                mapping(TConsensus => address)
     3          _profileChangeCooldown       uint256
     4          _vrfKeyHash2Id               mapping(bytes32 => address)
-    5          __gap                        bytes32[46]
+🏴  5          _rollupId2Id                 mapping(uint32 => address)
+🏴  6          __gap                        bytes32[45]

Layout Changes for ProfileHandler

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/profile/ProfileHandler.sol	.380630559 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/profile/ProfileHandler.sol	.386630640 +0000
@@ -3,4 +3,5 @@
     2          _consensus2Id                mapping(TConsensus => address)
     3          _profileChangeCooldown       uint256
     4          _vrfKeyHash2Id               mapping(bytes32 => address)
-    5          __gap                        bytes32[46]
+🏴  5          _rollupId2Id                 mapping(uint32 => address)
+🏴  6          __gap                        bytes32[45]

Layout Changes for ProfileStorage

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/profile/ProfileStorage.sol	.181627874 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/profile/ProfileStorage.sol	.181627874 +0000
@@ -3,4 +3,5 @@
     2          _consensus2Id                mapping(TConsensus => address)
     3          _profileChangeCooldown       uint256
     4          _vrfKeyHash2Id               mapping(bytes32 => address)
-    5          __gap                        bytes32[46]
+🏴  5          _rollupId2Id                 mapping(uint32 => address)
+🏴  6          __gap                        bytes32[45]

Layout Changes for Profile

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/profile/Profile.sol	.607633621 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/profile/Profile.sol	.607633621 +0000
@@ -3,7 +3,7 @@
     2          _consensus2Id                mapping(TConsensus => address)
     3          _profileChangeCooldown       uint256
     4          _vrfKeyHash2Id               mapping(bytes32 => address)
-    5          __gap                        bytes32[46]
-
+🏴  5          _rollupId2Id                 mapping(uint32 => address)
+🏴  6          __gap                        bytes32[45]
     51         _initialized                 uint8
     51: 1       _initializing                bool

Layout Changes for Profile_Mainnet

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/profile/Profile_Mainnet.sol	.310629614 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/profile/Profile_Mainnet.sol	.310629614 +0000
@@ -3,7 +3,7 @@
     2          _consensus2Id                mapping(TConsensus => address)
     3          _profileChangeCooldown       uint256
     4          _vrfKeyHash2Id               mapping(bytes32 => address)
-    5          __gap                        bytes32[46]
-
+🏴  5          _rollupId2Id                 mapping(uint32 => address)
+🏴  6          __gap                        bytes32[45]
     51         _initialized                 uint8
     51: 1       _initializing                bool

Layout Changes for SlashingExecution

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/validator/SlashingExecution.sol	.128789051 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/validator/SlashingExecution.sol	.128789051 +0000
@@ -32,5 +32,6 @@
     173        _lockedConsensusList         address[]
     174        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     175        _lockedFundReleased          mapping(address => bool)
-    176        ______gap                    uint256[44]
-
+🏴  176        _validatorL2MiningReward     mapping(address => uint256)
+🏴  177        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  178        ______gap                    uint256[42]

Layout Changes for CoinbaseExecution

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/validator/CoinbaseExecution.sol	.018787567 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/validator/CoinbaseExecution.sol	.018787567 +0000
@@ -42,5 +42,6 @@
     230        _lockedConsensusList         address[]
     231        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     232        _lockedFundReleased          mapping(address => bool)
-    233        ______gap                    uint256[44]
-
+🏴  233        _validatorL2MiningReward     mapping(address => uint256)
+🏴  234        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  235        ______gap                    uint256[42]

Layout Changes for EmergencyExit

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/validator/EmergencyExit.sol	.280791102 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/validator/EmergencyExit.sol	.280791102 +0000
@@ -38,5 +38,6 @@
     226        _lockedConsensusList         address[]
     227        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     228        _lockedFundReleased          mapping(address => bool)
-    229        ______gap                    uint256[44]
-
+🏴  229        _validatorL2MiningReward     mapping(address => uint256)
+🏴  230        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  231        ______gap                    uint256[42]

Layout Changes for CoinbaseExecutionDependant

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/validator/CoinbaseExecutionDependant.sol	.200790023 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/validator/CoinbaseExecutionDependant.sol	.200790023 +0000
@@ -42,5 +42,6 @@
     230        _lockedConsensusList         address[]
     231        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     232        _lockedFundReleased          mapping(address => bool)
-    233        ______gap                    uint256[44]
-
+🏴  233        _validatorL2MiningReward     mapping(address => uint256)
+🏴  234        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  235        ______gap                    uint256[42]

Layout Changes for RoninValidatorSet

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/validator/RoninValidatorSet.sol	.048787972 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/validator/RoninValidatorSet.sol	.048787972 +0000
@@ -44,5 +44,6 @@
     231        _lockedConsensusList         address[]
     232        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     233        _lockedFundReleased          mapping(address => bool)
-    234        ______gap                    uint256[44]
-
+🏴  234        _validatorL2MiningReward     mapping(address => uint256)
+🏴  235        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  236        ______gap                    uint256[42]

Layout Changes for RoninValidatorSetConstructor

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/validator/RoninValidatorSetConstructor.sol	.114788862 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/validator/RoninValidatorSetConstructor.sol	.114788862 +0000
@@ -44,5 +44,6 @@
     231        _lockedConsensusList         address[]
     232        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     233        _lockedFundReleased          mapping(address => bool)
-    234        ______gap                    uint256[44]
-
+🏴  234        _validatorL2MiningReward     mapping(address => uint256)
+🏴  235        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  236        ______gap                    uint256[42]

Layout Changes for SlashingExecutionDependant

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/validator/SlashingExecutionDependant.sol	.111788822 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/validator/SlashingExecutionDependant.sol	.111788822 +0000
@@ -32,5 +32,6 @@
     173        _lockedConsensusList         address[]
     174        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     175        _lockedFundReleased          mapping(address => bool)
-    176        ______gap                    uint256[44]
-
+🏴  176        _validatorL2MiningReward     mapping(address => uint256)
+🏴  177        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  178        ______gap                    uint256[42]

Layout Changes for CommonStorage

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/ronin/validator/storage-fragments/CommonStorage.sol	.254790751 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/ronin/validator/storage-fragments/CommonStorage.sol	.254790751 +0000
@@ -30,5 +30,6 @@
     171        _lockedConsensusList         address[]
     172        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     173        _lockedFundReleased          mapping(address => bool)
-    174        ______gap                    uint256[44]
-
+🏴  174        _validatorL2MiningReward     mapping(address => uint256)
+🏴  175        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  176        ______gap                    uint256[42]

Layout Changes for MockProfile

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/mocks/MockProfile.sol	.265480606 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/mocks/MockProfile.sol	.265480606 +0000
@@ -3,8 +3,8 @@
     2          _consensus2Id                mapping(TConsensus => address)
     3          _profileChangeCooldown       uint256
     4          _vrfKeyHash2Id               mapping(bytes32 => address)
-    5          __gap                        bytes32[46]
-
+🏴  5          _rollupId2Id                 mapping(uint32 => address)
+🏴  6          __gap                        bytes32[45]
     51         _initialized                 uint8
     51: 1       _initializing                bool
     51: 2       _verificationFailed          bool

Layout Changes for MockRoninValidatorSetExtended

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/mocks/validator/MockRoninValidatorSetExtended.sol	.944557222 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/mocks/validator/MockRoninValidatorSetExtended.sol	.944557222 +0000
@@ -44,8 +44,8 @@
     231        _lockedConsensusList         address[]
     232        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     233        _lockedFundReleased          mapping(address => bool)
-    234        ______gap                    uint256[44]
-
-
+🏴  234        _validatorL2MiningReward     mapping(address => uint256)
+🏴  235        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  236        ______gap                    uint256[42]
     278        _initialized                 bool
     279        _epochs                      uint256[]

Layout Changes for MockRoninValidatorSetOverridePrecompile

--- https://github.com/ronin-chain/dpos-contract/blob/3cfb9321dd623494b6a169a8b6b7d1464d4f7a59/src/mocks/validator/MockRoninValidatorSetOverridePrecompile.sol	.981557721 +0000
+++ https://github.com/ronin-chain/dpos-contract/blob/9bbee5535e63931a6acd210546092dd72b43c644/src/mocks/validator/MockRoninValidatorSetOverridePrecompile.sol	.981557721 +0000
@@ -44,5 +44,6 @@
     231        _lockedConsensusList         address[]
     232        _exitInfo                    mapping(address => struct ICommonInfo.EmergencyExitInfo)
     233        _lockedFundReleased          mapping(address => bool)
-    234        ______gap                    uint256[44]
-
+🏴  234        _validatorL2MiningReward     mapping(address => uint256)
+🏴  235        _delegatorL2MiningReward     mapping(address => uint256)
+🏴  236        ______gap                    uint256[42]

}

console.log(StdStyle.green("Cheat fast forward to 1 epoch ...\n"));
LibWrapUpEpoch.wrapUpEpoch();
}

function _randomlySubmitL2BlockReward(
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing check the state change accurately

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

@TuDo1403 TuDo1403 force-pushed the implement-feature/zkevm-integration/add-draft-interface branch from 3f357bb to 452796c Compare October 25, 2024 07:02
@TuDo1403 TuDo1403 force-pushed the implement-feature/zkevm-integration/add-draft-interface branch from 9bbee55 to 3dab0b3 Compare October 25, 2024 07:31
@TuDo1403 TuDo1403 merged commit 3dab0b3 into feature/zkevm-integration Oct 25, 2024
1 of 4 checks passed
@TuDo1403 TuDo1403 deleted the implement-feature/zkevm-integration/add-draft-interface branch October 25, 2024 07:32
@TuDo1403 TuDo1403 restored the implement-feature/zkevm-integration/add-draft-interface branch October 25, 2024 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants