Skip to content

Commit

Permalink
fix(protocol): use prevrandao for L2 mixHash (#13157)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeffery Walsh <[email protected]>
Co-authored-by: David <[email protected]>
Co-authored-by: jeff <[email protected]>
  • Loading branch information
4 people authored Feb 16, 2023
1 parent ce7329a commit 93daca4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@ library LibProposing {
meta.l1Hash = blockhash(block.number - 1);
meta.timestamp = uint64(block.timestamp);

// if multiple L2 blocks included in the same L1 block,
// their block.mixHash fields for randomness will be the same.
meta.mixHash = bytes32(block.difficulty);
// After The Merge, L1 mixHash contains the prevrandao
// from the beacon chain. Since multiple Taiko blocks
// can be proposed in one Ethereum block, we need to
// add salt to this random number as L2 mixHash
meta.mixHash = keccak256(
abi.encodePacked(block.prevrandao, state.nextBlockId)
);
}

uint256 deposit;
Expand Down

0 comments on commit 93daca4

Please sign in to comment.