Skip to content

Commit be70144

Browse files
authored
feat: rm BlockData event (#42)
* refactor: rm BlockData event * snapshot * comment
1 parent 72cac64 commit be70144

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

.gas-snapshot

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ZenithTest:test_badSequence() (gas: 60049)
2-
ZenithTest:test_badSignature() (gas: 66665)
3-
ZenithTest:test_blockExpired() (gas: 55344)
4-
ZenithTest:test_notSequencer() (gas: 58385)
5-
ZenithTest:test_onePerBlock() (gas: 105869)
6-
ZenithTest:test_submitBlock() (gas: 90173)
1+
ZenithTest:test_badSequence() (gas: 60188)
2+
ZenithTest:test_badSignature() (gas: 66804)
3+
ZenithTest:test_blockExpired() (gas: 55419)
4+
ZenithTest:test_notSequencer() (gas: 58524)
5+
ZenithTest:test_onePerBlock() (gas: 104196)
6+
ZenithTest:test_submitBlock() (gas: 88425)

src/Zenith.sol

+4-14
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ contract Zenith is Passage {
7171
bytes32 blockDataHash
7272
);
7373

74-
/// @notice Emit the entire block data for easy visibility
75-
event BlockData(bytes blockData);
76-
7774
/// @notice Emitted when a sequencer is added or removed.
7875
event SequencerSet(address indexed sequencer, bool indexed permissioned);
7976

@@ -121,35 +118,28 @@ contract Zenith is Passage {
121118
emit SequencerSet(sequencer, false);
122119
}
123120

124-
/// @notice Submit a rollup block with block data submitted via calldata.
125-
/// @dev Blocks are submitted by Builders, with an attestation to the block data signed by a Sequencer.
121+
/// @notice Submit a rollup block.
122+
/// @dev Blocks are submitted by Builders, with an attestation to the block signed by a Sequencer.
126123
/// @param header - the header information for the rollup block.
127-
/// @param blockDataHash - keccak256(blockData). the Node will discard the block if the hash doens't match.
124+
/// @param blockDataHash - keccak256(rlp-encoded transactions). the Node will discard the block if the hash doens't match transactions provided.
128125
/// @dev including blockDataHash allows the sequencer to sign over finalized block data, without needing to calldatacopy the `blockData` param.
129126
/// @param v - the v component of the Sequencer's ECSDA signature over the block header.
130127
/// @param r - the r component of the Sequencer's ECSDA signature over the block header.
131128
/// @param s - the s component of the Sequencer's ECSDA signature over the block header.
132-
/// @param blockData - block data information. could be packed blob hashes, or direct rlp-encoded transctions. blockData is ignored by the contract logic.
133129
/// @custom:reverts BadSequence if the sequence number is not the next block for the given rollup chainId.
134130
/// @custom:reverts BlockExpired if the confirmBy time has passed.
135131
/// @custom:reverts BadSignature if the signer is not a permissioned sequencer,
136132
/// OR if the signature provided commits to a different header.
137133
/// @custom:reverts OneRollupBlockPerHostBlock if attempting to submit a second rollup block within one host block.
138134
/// @custom:emits BlockSubmitted if the block is successfully submitted.
139-
/// @custom:emits BlockData to expose the block calldata; as a convenience until calldata tracing is implemented in the Node.
140135
function submitBlock(
141136
BlockHeader memory header,
142137
bytes32 blockDataHash,
143138
uint8 v,
144139
bytes32 r,
145140
bytes32 s,
146-
bytes calldata blockData
141+
bytes calldata
147142
) external {
148-
_submitBlock(header, blockDataHash, v, r, s);
149-
emit BlockData(blockData);
150-
}
151-
152-
function _submitBlock(BlockHeader memory header, bytes32 blockDataHash, uint8 v, bytes32 r, bytes32 s) internal {
153143
// assert that the sequence number is valid and increment it
154144
uint256 _nextSequence = incrementSequence(header.rollupChainId);
155145
if (_nextSequence != header.sequence) revert BadSequence(_nextSequence);

test/Zenith.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ 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-
bytes blockData = "0x1234567890abcdef";
1413
bytes32 blockDataHash;
14+
bytes blockData = "";
1515

1616
uint256 sequencerKey = 123;
1717
uint256 notSequencerKey = 300;

0 commit comments

Comments
 (0)