Skip to content

Commit

Permalink
fix(protocol): fix parent metahash check for the first block (#16607)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Apr 3, 2024
1 parent 613b194 commit ce9e67b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ library LibProposing {

bytes32 parentMetaHash =
_state.blocks[(b.numBlocks - 1) % _config.blockRingBufferSize].metaHash;
// assert(parentMetaHash != 0);

// Check if parent block has the right meta hash
// This is to allow the proposer to make sure the block builds on the expected latest chain
// state
// Check if parent block has the right meta hash. This is to allow the proposer to make sure
// the block builds on the expected latest chain state.
if (params.parentMetaHash != 0 && parentMetaHash != params.parentMetaHash) {
revert L1_UNEXPECTED_PARENT();
}
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/contracts/L1/libs/LibVerifying.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ library LibVerifying {
blk.nextTransitionId = 2;
blk.proposedAt = uint64(block.timestamp);
blk.verifiedTransitionId = 1;
blk.metaHash = bytes32(uint256(1)); // Give the genesis metahash a non-zero value.

// Init the first state transition
TaikoData.TransitionState storage ts = _state.transitions[0][1];
Expand Down

0 comments on commit ce9e67b

Please sign in to comment.