Skip to content

fix(cast): replay Nitro transactions - #15729

Open
mattsse wants to merge 4 commits into
masterfrom
mattsse/fix-cast-run-chain-replay
Open

fix(cast): replay Nitro transactions#15729
mattsse wants to merge 4 commits into
masterfrom
mattsse/fix-cast-run-chain-replay

Conversation

@mattsse

@mattsse mattsse commented Jul 14, 2026

Copy link
Copy Markdown
Member

cast run decoded full blocks with the selected Ethereum or OP network type, so Nitro's 0x6a system transaction made otherwise standard Arbitrum and Robinhood blocks fail before replay. This decodes RPC blocks through AnyNetwork while preserving OP envelope bytes during conversion.

Nitro charges the L1 poster-gas component before EVM execution and reports it separately in receipts. Local replay previously exposed that gas to the transaction, which could change execution results. The replay now deducts receipt-reported poster gas before execution and adds it back to the displayed total. Robinhood's chain IDs are also recognized for Nitro block-number semantics, and Nitro Cancun blocks may omit the parent beacon root.

Fixes #7514. Closes OSS-556.

This PR was written with Codex, including investigation, code generation, and test generation.

Decode full blocks through AnyNetwork so Nitro system transactions do not invalidate otherwise standard blocks. Charge Nitro poster gas before EVM execution, recognize Robinhood's chain IDs, and preserve OP transaction envelopes during conversion.
@mattsse
mattsse force-pushed the mattsse/fix-cast-run-chain-replay branch from 109d6ad to 37007b5 Compare July 14, 2026 12:50
@mattsse mattsse changed the title fix(cast): replay chain-specific transactions fix(cast): replay Nitro transactions Jul 14, 2026
@mablr mablr self-assigned this Jul 15, 2026
mablr added 3 commits July 15, 2026 14:57
Reconstruct Tempo AA envelopes decoded through AnyNetwork before converting them to TempoTxEnv. Dispatch replay based on the converted transaction kind so batched calls are not mistaken for creates.
Require matching Nitro receipts and reject missing, malformed, or overflowing poster-gas values. Use checked gas accounting so invalid RPC data cannot silently change replay behavior.
@mablr
mablr marked this pull request as ready for review July 15, 2026 14:28
mablr
mablr previously approved these changes Jul 15, 2026

@mablr mablr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit hacky (AnyNetwork), but it works fine and keeps pretty simple.

@mattsse

mattsse commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

yeah @mablr not super happy with this just yet, maybe we can simplify this a bit?

@mablr

mablr commented Jul 15, 2026

Copy link
Copy Markdown
Member

Yeah, this is definitely cursed, we already ended up elsewhere with such hacks (eg. forks).

We can defer this to foundry 2.0 (close this PR), alloy network/rpc definitely need a rework.

@mablr mablr added the T-blocked Type: blocked label Jul 16, 2026
@mablr
mablr dismissed their stale review July 16, 2026 14:47

changed direction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-blocked Type: blocked

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

cast run produces incorrect simulation of Arbitrum transaction (succeeds where it should fail)

3 participants