Skip to content

Commit

Permalink
add initialize2 for rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
Agnar Song committed Nov 20, 2024
1 parent c56fb93 commit 836e4a4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions contracts/contracts/l1/rollup/Rollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ contract Rollup is IRollup, OwnableUpgradeable, PausableUpgradeable {
emit UpdateProofRewardPercent(0, _proofRewardPercent);
}

function initialize2(bytes32 _prevStateRoot) external reinitializer(2) {
require(_getInitializedVersion() == 2, "must have initialized!");
require(_prevStateRoot != bytes32(0), "can not set stateroot with bytes32(0)!");

if (committedStateRoots[lastCommittedBatchIndex] == bytes32(0)) {
committedStateRoots[lastCommittedBatchIndex] = _prevStateRoot;
}
}

/************************
* Restricted Functions *
************************/
Expand Down

0 comments on commit 836e4a4

Please sign in to comment.