@@ -36,16 +36,10 @@ contract Zenith is HostPassage, AccessControlDefaultAdminRules {
36
36
/// @notice Thrown when a block submission is attempted when the confirmBy time has passed.
37
37
error BlockExpired ();
38
38
39
- /// @notice Thrown when a block submission is attempted with a signature over different data.
40
- /// @param hashes - the encoded blob hashes attached to the transaction.
41
- /// @param v - the v component of the Sequencer's ECSDA signature over the block commitment.
42
- /// @param r - the r component of the Sequencer's ECSDA signature over the block commitment.
43
- /// @param s - the s component of the Sequencer's ECSDA signature over the block commitment.
44
- error BadSignature (bytes hashes , uint8 v , bytes32 r , bytes32 s );
45
-
46
- /// @notice Thrown when a block submission is attempted with a signature by a non-permissioned sequencer.
47
- /// @param sequencer - the signer of the block data that is not a permissioned sequencer.
48
- error NotSequencer (address sequencer );
39
+ /// @notice Thrown when a block submission is attempted with a signature by a non-permissioned sequencer,
40
+ /// OR when signature is produced over different data than is provided.
41
+ /// @param derivedSequencer - the derived signer of the block data that is not a permissioned sequencer.
42
+ error BadSignature (address derivedSequencer );
49
43
50
44
/// @notice Emitted when a new rollup block is successfully submitted.
51
45
/// @param sequencer - the address of the sequencer that signed the block.
@@ -69,8 +63,8 @@ contract Zenith is HostPassage, AccessControlDefaultAdminRules {
69
63
/// @param s - the s component of the Sequencer's ECSDA signature over the block commitment.
70
64
/// @custom:reverts BadSequence if the sequence number is not the next block for the given rollup chainId.
71
65
/// @custom:reverts BlockExpired if the confirmBy time has passed.
72
- /// @custom:reverts BadSignature if the signature provided commits to different block data.
73
- /// @custom:reverts NotSequencer if the signer is not a permissioned sequencer .
66
+ /// @custom:reverts BadSignature if the signer is not a permissioned sequencer,
67
+ /// OR if the signature provided commits to different block data .
74
68
/// @custom:emits BlockSubmitted if the block is successfully submitted.
75
69
function submitBlock (BlockHeader memory header , uint32 [] memory blobIndices , uint8 v , bytes32 r , bytes32 s )
76
70
external
@@ -83,17 +77,13 @@ contract Zenith is HostPassage, AccessControlDefaultAdminRules {
83
77
if (block .timestamp > header.confirmBy) revert BlockExpired ();
84
78
85
79
// derive block commitment from sequence number and blobhashes
86
- ( bytes32 blockCommit , bytes memory hashes ) = blockCommitment (header, blobIndices);
80
+ bytes32 blockCommit = blockCommitment (header, blobIndices);
87
81
88
82
// derive sequencer from signature
89
83
address sequencer = ecrecover (blockCommit, v, r, s);
90
84
91
- // if the derived signer is address(0), the signature is invalid over the derived blockCommit
92
- // emit the data required to inspect the signature off-chain
93
- if (sequencer == address (0 )) revert BadSignature (hashes, v, r, s);
94
-
95
- // assert that sequencer is permissioned
96
- if (! hasRole (SEQUENCER_ROLE, sequencer)) revert NotSequencer (sequencer);
85
+ // assert that signature is valid && sequencer is permissioned
86
+ if (! hasRole (SEQUENCER_ROLE, sequencer)) revert BadSignature (sequencer);
97
87
98
88
// emit event
99
89
emit BlockSubmitted (sequencer, header, blobIndices);
@@ -132,10 +122,9 @@ contract Zenith is HostPassage, AccessControlDefaultAdminRules {
132
122
function blockCommitment (BlockHeader memory header , uint32 [] memory blobIndices )
133
123
internal
134
124
view
135
- returns (bytes32 commit , bytes memory hashes )
125
+ returns (bytes32 commit )
136
126
{
137
- hashes = getHashes (blobIndices);
138
- commit = getCommit (header, hashes);
127
+ commit = getCommit (header, getHashes (blobIndices));
139
128
}
140
129
141
130
/// @notice Encode an array of blob hashes, given their indices in the transaction.
0 commit comments