@@ -10,7 +10,6 @@ contract ZenithTest is Test {
1010 Zenith.BlockHeader header;
1111 bytes32 commit;
1212 /// @dev blockData is ignored by the contract. it's included for the purpose of DA for the node.
13- bytes32 blockDataHash;
1413 bytes blockData = "" ;
1514
1615 uint256 sequencerKey = 123 ;
@@ -36,37 +35,36 @@ contract ZenithTest is Test {
3635 header.confirmBy = block .timestamp + 10 minutes ;
3736 header.gasLimit = 30_000_000 ;
3837 header.rewardAddress = address (this );
39-
40- blockDataHash = keccak256 (blockData);
38+ header.blockDataHash = keccak256 (blockData);
4139
4240 // derive block commitment from the header
43- commit = target.blockCommitment (header, blockDataHash );
41+ commit = target.blockCommitment (header);
4442 }
4543
4644 // cannot submit block with incorrect sequence number
4745 function test_badSequence () public {
4846 // change to incorrect sequence number
4947 header.sequence = 100 ;
50- commit = target.blockCommitment (header, blockDataHash );
48+ commit = target.blockCommitment (header);
5149
5250 // sign block commitmenet with sequencer key
5351 (uint8 v , bytes32 r , bytes32 s ) = vm.sign (sequencerKey, commit);
5452
5553 vm.expectRevert (abi.encodeWithSelector (Zenith.BadSequence.selector , 1 ));
56- target.submitBlock (header, blockDataHash, v, r, s, blockData);
54+ target.submitBlock (header, v, r, s, blockData);
5755 }
5856
5957 // cannot submit block with expired confirmBy time
6058 function test_blockExpired () public {
6159 // change to expired confirmBy time
6260 header.confirmBy = block .timestamp - 1 ;
63- commit = target.blockCommitment (header, blockDataHash );
61+ commit = target.blockCommitment (header);
6462
6563 // sign block commitmenet with sequencer key
6664 (uint8 v , bytes32 r , bytes32 s ) = vm.sign (sequencerKey, commit);
6765
6866 vm.expectRevert (abi.encodeWithSelector (Zenith.BlockExpired.selector ));
69- target.submitBlock (header, blockDataHash, v, r, s, blockData);
67+ target.submitBlock (header, v, r, s, blockData);
7068 }
7169
7270 // can submit block successfully with acceptable header & correct signature provided
@@ -83,9 +81,9 @@ contract ZenithTest is Test {
8381 header.confirmBy,
8482 header.gasLimit,
8583 header.rewardAddress,
86- blockDataHash
84+ header. blockDataHash
8785 );
88- target.submitBlock (header, blockDataHash, v, r, s, blockData);
86+ target.submitBlock (header, v, r, s, blockData);
8987
9088 // should increment sequence number
9189 assertEq (target.nextSequence (header.rollupChainId), header.sequence + 1 );
@@ -97,7 +95,7 @@ contract ZenithTest is Test {
9795 (uint8 v , bytes32 r , bytes32 s ) = vm.sign (notSequencerKey, commit);
9896
9997 vm.expectRevert (abi.encodeWithSelector (Zenith.BadSignature.selector , vm.addr (notSequencerKey)));
100- target.submitBlock (header, blockDataHash, v, r, s, blockData);
98+ target.submitBlock (header, v, r, s, blockData);
10199 }
102100
103101 // cannot submit block with sequencer signature over different block header data
@@ -107,11 +105,11 @@ contract ZenithTest is Test {
107105
108106 // change header data from what was signed by sequencer
109107 header.confirmBy = block .timestamp + 15 minutes ;
110- bytes32 newCommit = target.blockCommitment (header, blockDataHash );
108+ bytes32 newCommit = target.blockCommitment (header);
111109 address derivedSigner = ecrecover (newCommit, v, r, s);
112110
113111 vm.expectRevert (abi.encodeWithSelector (Zenith.BadSignature.selector , derivedSigner));
114- target.submitBlock (header, blockDataHash, v, r, s, blockData);
112+ target.submitBlock (header, v, r, s, blockData);
115113 }
116114
117115 // cannot submit two rollup blocks within one host block
@@ -128,18 +126,18 @@ contract ZenithTest is Test {
128126 header.confirmBy,
129127 header.gasLimit,
130128 header.rewardAddress,
131- blockDataHash
129+ header. blockDataHash
132130 );
133- target.submitBlock (header, blockDataHash, v, r, s, blockData);
131+ target.submitBlock (header, v, r, s, blockData);
134132
135133 // incerement the header sequence
136134 header.sequence += 1 ;
137- commit = target.blockCommitment (header, blockDataHash );
135+ commit = target.blockCommitment (header);
138136 (v, r, s) = vm.sign (sequencerKey, commit);
139137
140138 // should revert with OneRollupBlockPerHostBlock
141139 // (NOTE: this test works because forge does not increment block.number when it mines a transaction)
142140 vm.expectRevert (abi.encodeWithSelector (Zenith.OneRollupBlockPerHostBlock.selector ));
143- target.submitBlock (header, blockDataHash, v, r, s, blockData);
141+ target.submitBlock (header, v, r, s, blockData);
144142 }
145143}
0 commit comments