Repository navigation
Conversation
Add an `arbitrum` crate that executes signed Ethereum transactions with Arbitrum Nitro's rules: ArbOS versions mapped onto evm2 specs, the L1 poster gas charged before execution and excluded from refunds, the ArbOS gas cap, dropped tips, the opt-in EIP-7623 floor, fee distribution to the network, infrastructure and L1 pricer accounts, L2 backlog growth, the per-version precompile sets, and the NUMBER, BLOCKHASH, GASPRICE and BLOBBASEFEE overlays. ArbSys, ArbInfo and the ArbGasInfo getters are ported; other ArbOS precompiles, Stylus programs and Nitro's own transaction types abort or are left to block execution. Robinhood Chain (4663, 46630) is recognized as an Arbitrum chain, covering the chain-ID part of foundry-rs/foundry#15729. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1647f-fd32-700c-be1e-0705332186c6
Model ArbOS versions as an enum of the versions Nitro defines upgrades for, replacing the numeric newtype, and decode the header version fallibly. Turn the ArbOS subspaces into constants, drop the wrapper and helper types the crate did not need, move imports to the top and constants before const functions, and replace the module unit tests with end-to-end tests, including one pinning the ArbOS state layout to Arbitrum One's slots. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1647f-fd32-700c-be1e-0705332186c6
speedmax
reviewed
Nov 10, 2026
speedmax
left a comment
There was a problem hiding this comment.
Review
Verdict: Comment. The Nitro port is scoped honestly, and the ArbOS storage layout, header mixHash split, and poster-gas exclusion from the refund look right. Two claims are stronger than the evidence, and one ported method diverges instead of aborting.
This crate replays a signed Ethereum transaction against a database the caller already filled. It does not follow a sequencer feed, compute poster gas, or serve RPC. Chain-id recognition is not execution coverage.
Warnings
crates/arbitrum/src/precompiles.rs:284—getStorageGasAvailablereturns 0. The module says unported methods abort rather than diverge. This one is ported and diverges.crates/arbitrum/src/chain.rs:45— Robinhood 4663/46630 is a match arm. Every test and the 302-tx replay use Arbitrum One. A Hood header past ArbOS 61 will not decode; the enum stops at 61.crates/arbitrum/src/precompiles.rs:298—myCallersAddressWithoutAliasingaborts below the top frame. A contract that calls ArbSys through another contract dies.- No checks on the PR. The replay harness is not in the diff, so the 302-tx claim is not reviewable here.
Suggestions
- Add one test that
is_arbitrum_chain(4663)is true and thatversion(spec, 4663)still applies the same rules. Chain id does not change the rules; the test should say that. getStorageGasAvailableshould fatal-abort, same aswithdrawEth, until it returns Nitro's remaining storage gas.
Looks good
- Stylus and unported precompiles abort the transaction instead of returning a fake success.
NUMBER/BLOCKHASHstay on the L1 view;arbBlockNumberuses the L2 number.- Poster gas is charged and then excluded from the refund. Tests cover the zero-basefee and held-gas cases.
- System addresses are Nitro constants, not Arbitrum One deployments, so the same slots work on an Orbit fork if the caller supplies that chain's state.
Reviewed by Hermes Agent
Take main's alloy-rs/evm2 pin and adapt the arbitrum crate: precompiles read their input through Evm::message_input, the call depth is measured from Evm::initial_call_depth, and GASPRICE reads the transaction environment from the host.
Document that myCallersAddressWithoutAliasing aborts below the top-level frame, since Nitro walks its call stack there, and test the three depths. Note that getStorageGasAvailable returns 0 as in Nitro. Narrow is_arbitrum_chain to chain identification, and run arbChainID under the Robinhood Chain ID.
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.
Adds an
arbitrumcrate that runs signed Ethereum transactions on evm2 with Arbitrum Nitro's rules: ArbOS versions mapped onto their Ethereum specs, L1-basedNUMBERandBLOCKHASH, the L1 poster gas charged before execution and kept out of refunds, the ArbOS gas cap, tip dropping, fee distribution and backlog updates, and Nitro's per-version precompile sets withArbSys,ArbInfoand theArbGasInfogetters ported.It also covers foundry-rs/foundry#15729 without the
AnyNetworkworkaround:is_arbitrum_chainrecognizes the Robinhood Chain IDs, poster gas is an input onArbTxEnvelopetaken from the receipt'sgasUsedForL1, and Nitro's own transaction types are exposed so block decoding can skip them. Chain-ID recognition only identifies the chain: execution is checked against Arbitrum One only, so Robinhood Chain runs these rules only if its ArbOS version, batch poster and precompiles match. Those transaction types, Stylus, the multi-gas pricing model and the other ArbOS precompiles are not ported; Stylus code, unported precompile calls andArbSys.myCallersAddressWithoutAliasingbelow the top-level frame abort the transaction instead of diverging.A replay of 302 Arbitrum One transactions from ArbOS 10 through 61 matched on status, gas, logs, balances and storage. The branch is merged with
mainand uses its evm2 pin.