fix(rpc): set prevrandao to zero for eth_simulateV1 simulated blocks#21399
Merged
fix(rpc): set prevrandao to zero for eth_simulateV1 simulated blocks#21399
Conversation
In geth, simulated block headers are created with MixDigest (prevrandao) zero-initialized by default. Only when a prevRandao/random override is explicitly provided does it get set to a non-zero value. Reth was inheriting prevrandao from the parent block's environment, causing mixHash in the response to differ from geth's output. This fix sets prevrandao to B256::ZERO before applying block overrides, matching geth's behavior. If user provides a random override, it will be applied by apply_block_overrides. Fixes failing Hive rpc-compat tests for eth_simulateV1. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019bf01b-ec5c-775e-9997-98c5dd7248ac
e1fd061 to
b392fa2
Compare
klkvr
approved these changes
Jan 26, 2026
rakita
pushed a commit
that referenced
this pull request
Jan 26, 2026
…21399) Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In geth, simulated block headers are created with
MixDigest(prevrandao) zero-initialized by default. Only when aprevRandao/randomoverride is explicitly provided does it get set to a non-zero value.Reth was inheriting
prevrandaofrom the parent block's environment, causingmixHashin the response to differ from geth's output.This fix sets
prevrandaotoB256::ZERObefore applying block overrides, matching geth's behavior. If user provides arandomoverride, it will be applied byapply_block_overrides.Test Plan
Fixes failing Hive rpc-compat tests for
eth_simulateV1, specificallyethSimulate-blockhash-simplewhich expectsmixHashto be0x0000...0000.Related
eth_simulateV1compatibility work