Repository navigation
Description
Background
QA finding X1: morph-reth's txpool accepts contract-creation transactions whose initcode exceeds the EIP-3860 limit (49 152 B), while morph-geth correctly rejects them.
| geth | reth (before fix) | |
|---|---|---|
| 50 000 B initcode | -32000 max initcode size exceeded: code size 50000 limit 49152 |
accepts, returns hash, tx sits forever in pending |
Root Cause
morph-mainnet / hoodi genesis use morph-geth's non-standard shanghaiBlock field (inherited from scroll-tech's go-ethereum). alloy's Genesis parser only recognises the upstream timestamp-based shanghaiTime, so MorphChainSpec.is_shanghai_active_at_timestamp returns false everywhere, and reth's EthTransactionValidator silently skips the EIP-3860 size guard at reth_transaction_pool::validate::eth.rs:468.
Functional Description
Reject contract-creation transactions whose initcode exceeds 49 152 B at the txpool layer in MorphTransactionValidator, independent of reth's Shanghai fork-activation check.
Why not just activate Shanghai in the chainspec?
Force-activating Shanghai/Cancun would flip is_shanghai_active_at_timestamp for every consumer in reth, most notably EthStorage::read_block_bodies, which would start filling body.withdrawals with Some(vec![]) after activation. morph-geth's Body has no withdrawals slot, so RPC responses would diverge byte-for-byte. We would also need to override MorphPayloadAttributesBuilder to keep withdrawals / parent_beacon_block_root pinned to None.
Enforcing the bound directly in MorphTransactionValidator keeps:
- chainspec untouched
- RPC output bit-identical to morph-geth
- the size cap correctly enforced
This mirrors morph's existing pattern of managing fork semantics outside reth's standard fork path (e.g. MorphHardfork -> SpecId mapping in crates/chainspec/src/hardfork.rs).
EIP-3860 Intrinsic-Gas Surcharge
Already covered. Morph registers Prague at Viridian time, so reth's ensure_intrinsic_gas lands on SpecId::PRAGUE (PRAGUE ⊃ SHANGHAI), which includes initcode_cost. The only window where this would not hold is during cold-sync of pre-Viridian blocks on a fresh node — but mempool admission is not active during sync.
Acceptance Criteria
- 49 153 B initcode → rejected with
ExceedsMaxInitCodeSize - 49 152 B initcode → not blocked by EIP-3860
-
cargo nextest run --workspacepasses -
cargo nextest run -p morph-node --features test-utils -E 'binary(it)'passes -
cargo clippy --all --all-targets -- -D warningsclean -
cargo fmt --all -- --checkclean - No regressions in existing txpool / RPC behavior
Activity