@@ -7,29 +7,25 @@ contract Zenith is Passage {
7
7
/// @notice The address that is allowed to set/remove sequencers.
8
8
address public immutable sequencerAdmin;
9
9
10
+ /// @notice The block number at which the Zenith contract was deployed.
11
+ uint256 public deployBlockNumber;
12
+
10
13
/// @notice Block header information for the rollup block, signed by the sequencer.
11
14
/// @param rollupChainId - the chainId of the rollup chain. Any chainId is accepted by the contract.
12
- /// @param sequence - the sequence number of the rollup block. Must be monotonically increasing. Enforced by the contract.
13
- /// @param confirmBy - the timestamp by which the block must be submitted. Enforced by the contract.
15
+ /// @param hostBlockNumber - the host block number in which the rollup block must be submitted. Enforced by the contract.
14
16
/// @param gasLimit - the gas limit for the rollup block. Ignored by the contract; enforced by the Node.
15
17
/// @param rewardAddress - the address to receive the rollup block reward. Ignored by the contract; enforced by the Node.
16
18
/// @param blockDataHash - keccak256(rlp-encoded transactions). the Node will discard the block if the hash doens't match.
17
19
/// this allows the sequencer to sign over finalized set of transactions,
18
20
/// without the Zenith contract needing to interact with raw transaction data (which may be provided via blobs or calldata).
19
21
struct BlockHeader {
20
22
uint256 rollupChainId;
21
- uint256 sequence;
22
- uint256 confirmBy;
23
+ uint256 hostBlockNumber;
23
24
uint256 gasLimit;
24
25
address rewardAddress;
25
26
bytes32 blockDataHash;
26
27
}
27
28
28
- /// @notice The sequence number of the next block that can be submitted for a given rollup chainId.
29
- /// @dev Because sequences must start at 1, accessors must add 1 to this number.
30
- /// rollupChainId => (nextSequence - 1)
31
- mapping (uint256 => uint256 ) sequences;
32
-
33
29
/// @notice The host block number that a block was last submitted at for a given rollup chainId.
34
30
/// rollupChainId => host blockNumber that block was last submitted at
35
31
mapping (uint256 => uint256 ) public lastSubmittedAtBlock;
@@ -38,13 +34,8 @@ contract Zenith is Passage {
38
34
/// address => TRUE if it's a permissioned sequencer
39
35
mapping (address => bool ) public isSequencer;
40
36
41
- /// @notice Thrown when a block submission is attempted with a sequence number that is not the next block for the rollup chainId.
42
- /// @dev Blocks must be submitted in strict monotonic increasing order.
43
- /// @param expected - the correct next sequence number for the given rollup chainId.
44
- error BadSequence (uint256 expected );
45
-
46
- /// @notice Thrown when a block submission is attempted when the confirmBy time has passed.
47
- error BlockExpired ();
37
+ /// @notice Thrown when a block submission is attempted in the incorrect host block.
38
+ error IncorrectHostBlock ();
48
39
49
40
/// @notice Thrown when a block submission is attempted with a signature by a non-permissioned sequencer,
50
41
/// OR when signature is produced over different block header than is provided.
@@ -60,17 +51,13 @@ contract Zenith is Passage {
60
51
/// @notice Emitted when a new rollup block is successfully submitted.
61
52
/// @param sequencer - the address of the sequencer that signed the block.
62
53
/// @param rollupChainId - the chainId of the rollup chain.
63
- /// @param sequence - the sequence number of the rollup block.
64
- /// @param confirmBy - the timestamp by which the block must be submitted.
65
54
/// @param gasLimit - the gas limit for the rollup block.
66
55
/// @param rewardAddress - the address to receive the rollup block reward.
67
56
/// @param blockDataHash - keccak256(rlp-encoded transactions). the Node will discard the block if the hash doens't match transactions provided.
68
57
/// @dev including blockDataHash allows the sequencer to sign over finalized block data, without needing to calldatacopy the `blockData` param.
69
58
event BlockSubmitted (
70
59
address indexed sequencer ,
71
60
uint256 indexed rollupChainId ,
72
- uint256 indexed sequence ,
73
- uint256 confirmBy ,
74
61
uint256 gasLimit ,
75
62
address rewardAddress ,
76
63
bytes32 blockDataHash
@@ -83,22 +70,7 @@ contract Zenith is Passage {
83
70
Passage (_defaultRollupChainId, _withdrawalAdmin)
84
71
{
85
72
sequencerAdmin = _sequencerAdmin;
86
- }
87
-
88
- /// @notice Returns the next sequence number.
89
- /// @dev Because sequences must start at 1, we add 1 to the mapping value.
90
- /// @param _rollupChainId - the chainId of the rollup chain. Any chainId is accepted by the contract.
91
- /// @return The next sequence number.
92
- function nextSequence (uint256 _rollupChainId ) public view returns (uint256 ) {
93
- return sequences[_rollupChainId] + 1 ;
94
- }
95
-
96
- /// @notice Increments the sequence number and returns it.
97
- /// @dev Because sequences must start at 1, we add 1 to the mapping value.
98
- /// @param _rollupChainId - the chainId of the rollup chain. Any chainId is accepted by the contract.
99
- /// @return The next sequence number.
100
- function incrementSequence (uint256 _rollupChainId ) internal returns (uint256 ) {
101
- return ++ sequences[_rollupChainId];
73
+ deployBlockNumber = block .number ;
102
74
}
103
75
104
76
/// @notice Add a sequencer to the permissioned sequencer list.
@@ -129,19 +101,14 @@ contract Zenith is Passage {
129
101
/// @param v - the v component of the Sequencer's ECSDA signature over the block header.
130
102
/// @param r - the r component of the Sequencer's ECSDA signature over the block header.
131
103
/// @param s - the s component of the Sequencer's ECSDA signature over the block header.
132
- /// @custom:reverts BadSequence if the sequence number is not the next block for the given rollup chainId.
133
- /// @custom:reverts BlockExpired if the confirmBy time has passed.
104
+ /// @custom:reverts IncorrectHostBlock if the hostBlockNumber does not match the current block.
134
105
/// @custom:reverts BadSignature if the signer is not a permissioned sequencer,
135
106
/// OR if the signature provided commits to a different header.
136
107
/// @custom:reverts OneRollupBlockPerHostBlock if attempting to submit a second rollup block within one host block.
137
108
/// @custom:emits BlockSubmitted if the block is successfully submitted.
138
109
function submitBlock (BlockHeader memory header , uint8 v , bytes32 r , bytes32 s , bytes calldata ) external {
139
- // assert that the sequence number is valid and increment it
140
- uint256 _nextSequence = incrementSequence (header.rollupChainId);
141
- if (_nextSequence != header.sequence) revert BadSequence (_nextSequence);
142
-
143
- // assert that confirmBy time has not passed
144
- if (block .timestamp > header.confirmBy) revert BlockExpired ();
110
+ // assert that the host block number matches the current block
111
+ if (block .number != header.hostBlockNumber) revert IncorrectHostBlock ();
145
112
146
113
// derive sequencer from signature over block header
147
114
bytes32 blockCommit = blockCommitment (header);
@@ -156,13 +123,7 @@ contract Zenith is Passage {
156
123
157
124
// emit event
158
125
emit BlockSubmitted (
159
- sequencer,
160
- header.rollupChainId,
161
- header.sequence,
162
- header.confirmBy,
163
- header.gasLimit,
164
- header.rewardAddress,
165
- header.blockDataHash
126
+ sequencer, header.rollupChainId, header.gasLimit, header.rewardAddress, header.blockDataHash
166
127
);
167
128
}
168
129
@@ -174,9 +135,8 @@ contract Zenith is Passage {
174
135
"init4.sequencer.v0 " ,
175
136
block .chainid ,
176
137
header.rollupChainId,
177
- header.sequence ,
138
+ header.hostBlockNumber ,
178
139
header.gasLimit,
179
- header.confirmBy,
180
140
header.rewardAddress,
181
141
header.blockDataHash
182
142
);
0 commit comments