-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathScrollChainMockFinalize.sol
52 lines (43 loc) · 1.71 KB
/
ScrollChainMockFinalize.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-License-Identifier: MIT
pragma solidity =0.8.24;
import {ScrollChain} from "../L1/rollup/ScrollChain.sol";
contract ScrollChainMockFinalize is ScrollChain {
/***************
* Constructor *
***************/
constructor(
uint64 _chainId,
address _messageQueueV1,
address _messageQueueV2,
address _verifier,
address _system
) ScrollChain(_chainId, _messageQueueV1, _messageQueueV2, _verifier, _system) {}
/*****************************
* Public Mutating Functions *
*****************************/
/// @notice Finalize bundle without proof, See the comments of {ScrollChain-finalizeBundleWithProof}.
function finalizeBundle(
bytes calldata batchHeader,
bytes32 postStateRoot,
bytes32 withdrawRoot
) external OnlyProver whenNotPaused {
// actions before verification
(, bytes32 batchHash, uint256 batchIndex, uint256 totalL1MessagesPoppedOverall, ) = _beforeFinalizeBatch(
batchHeader,
postStateRoot
);
// actions after verification
_afterFinalizeBatch(batchIndex, batchHash, totalL1MessagesPoppedOverall, postStateRoot, withdrawRoot, true);
}
function finalizeBundlePostEuclidV2NoProof(
bytes calldata batchHeader,
uint256 totalL1MessagesPoppedOverall,
bytes32 postStateRoot,
bytes32 withdrawRoot
) external {
// actions before verification
(, bytes32 batchHash, uint256 batchIndex, , ) = _beforeFinalizeBatch(batchHeader, postStateRoot);
// actions after verification
_afterFinalizeBatch(batchIndex, batchHash, totalL1MessagesPoppedOverall, postStateRoot, withdrawRoot, false);
}
}