Skip to content

Commit 9cfaac6

Browse files
committed
refactor: new event format
1 parent db0defe commit 9cfaac6

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

src/Zenith.sol

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,20 @@ contract Zenith is Passage, AccessControlDefaultAdminRules {
5050

5151
/// @notice Emitted when a new rollup block is successfully submitted.
5252
/// @param sequencer - the address of the sequencer that signed the block.
53-
/// @param header - the block header information for the block.
53+
/// @param rollupChainId - the chainId of the rollup chain.
54+
/// @param sequence - the sequence number of the rollup block.
55+
/// @param confirmBy - the timestamp by which the block must be submitted.
56+
/// @param gasLimit - the gas limit for the rollup block.
57+
/// @param rewardAddress - the address to receive the rollup block reward.
5458
/// @param blockDataHash - keccak256(blockData). the Node will discard the block if the hash doens't match.
5559
event BlockSubmitted(
56-
address indexed sequencer, BlockHeader indexed headerHash, BlockHeader header, bytes32 blockDataHash
60+
address indexed sequencer,
61+
uint256 indexed rollupChainId,
62+
uint256 indexed sequence,
63+
uint256 confirmBy,
64+
uint256 gasLimit,
65+
address rewardAddress,
66+
bytes32 blockDataHash
5767
);
5868

5969
/// @notice Emit the entire block data for easy visibility
@@ -117,7 +127,15 @@ contract Zenith is Passage, AccessControlDefaultAdminRules {
117127
lastSubmittedAtBlock[header.rollupChainId] = block.number;
118128

119129
// emit event
120-
emit BlockSubmitted(sequencer, header, header, blockDataHash);
130+
emit BlockSubmitted(
131+
sequencer,
132+
header.rollupChainId,
133+
header.sequence,
134+
header.confirmBy,
135+
header.gasLimit,
136+
header.rewardAddress,
137+
blockDataHash
138+
);
121139
}
122140

123141
/// @notice Construct hash of block details that the sequencer signs.

test/Zenith.t.sol

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ contract ZenithTest is Test {
1818

1919
event BlockSubmitted(
2020
address indexed sequencer,
21-
Zenith.BlockHeader indexed headerHash,
22-
Zenith.BlockHeader header,
21+
uint256 indexed rollupChainId,
22+
uint256 indexed sequence,
23+
uint256 confirmBy,
24+
uint256 gasLimit,
25+
address rewardAddress,
2326
bytes32 blockDataHash
2427
);
2528

@@ -73,7 +76,15 @@ contract ZenithTest is Test {
7376

7477
// should emit BlockSubmitted event
7578
vm.expectEmit();
76-
emit BlockSubmitted(vm.addr(sequencerKey), header, header, blockDataHash);
79+
emit BlockSubmitted(
80+
vm.addr(sequencerKey),
81+
header.rollupChainId,
82+
header.sequence,
83+
header.confirmBy,
84+
header.gasLimit,
85+
header.rewardAddress,
86+
blockDataHash
87+
);
7788
target.submitBlock(header, blockDataHash, v, r, s, blockData);
7889

7990
// should increment sequence number
@@ -110,7 +121,15 @@ contract ZenithTest is Test {
110121

111122
// should emit BlockSubmitted event
112123
vm.expectEmit();
113-
emit BlockSubmitted(vm.addr(sequencerKey), header, header, blockDataHash);
124+
emit BlockSubmitted(
125+
vm.addr(sequencerKey),
126+
header.rollupChainId,
127+
header.sequence,
128+
header.confirmBy,
129+
header.gasLimit,
130+
header.rewardAddress,
131+
blockDataHash
132+
);
114133
target.submitBlock(header, blockDataHash, v, r, s, blockData);
115134

116135
// incerement the header sequence

0 commit comments

Comments
 (0)