fix: align L2 header fields between assemble and import paths#58
fix: align L2 header fields between assemble and import paths#58
Conversation
- mix_hash fixed to zero in MorphBlockAssembler (matches geth L2 behavior) - withdrawals_root/blob_gas_used/excess_blob_gas always None on import side - extract header_and_body_from_executable_data() helper for clarity - remove unused EMPTY_WITHDRAWALS and EthereumHardforks imports
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe PR removes the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
anylots
left a comment
There was a problem hiding this comment.
It is recommended to add test coverage: ensure that corresponding unit tests and integration tests are included.
Yeah, these issues were caught by the e2e tests in the subsequent PR, and there will be corresponding tests to cover them. |
Summary
Fixes a block hash mismatch between the
assembleL2Block(assemble path) andnewL2Block(import path) by ensuring both sides construct identical headers.Root Causes
mix_hash:MorphBlockAssemblerusedprevrandao()which can be non-zero, while the import side usedB256::ZERO. Morph L2 always keepsmix_hash = 0(confirmed from geth source).withdrawals_root/blob_gas_used/excess_blob_gas: Import side conditionally set these based on Shanghai/Cancun hardfork activation, butMorphBlockAssembleralways emitsNonefor all three (Morph L2 has no withdrawals or blob transactions). This caused a hash divergence on any network where Shanghai/Cancun is active.Changes
crates/evm/src/assemble.rs:mix_hash: Default::default()(wasprevrandao())crates/engine-api/src/builder.rs:withdrawals_root,blob_gas_used,excess_blob_gas→ alwaysNoneheader_and_body_from_executable_data()helperEMPTY_WITHDRAWALSandEthereumHardforksimportsTest plan
cargo check -p morph-engine-api -p morph-evmpassesnewL2Blockno longer returns hash mismatch errorsSummary by CodeRabbit