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

Add initialize2 for rollup to set state root #641

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/bin/rollup_deployed.hex

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions bindings/bindings/rollup.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/rollup_more.go

Large diffs are not rendered by default.

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 state root with bytes32(0)!");

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

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