Skip to content

feat!: Satin keyless deployment, system calls, in-EVM system address, revert-class stop, fork hooks - #388

Merged
RealiCZ merged 120 commits into
cz/feat/satin-w3from
cz/feat/satin-w4
Oct 22, 2026
Merged

RealiCZ merged 120 commits into
cz/feat/satin-w3from
cz/feat/satin-w4

Conversation

@RealiCZ

@RealiCZ RealiCZ commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Wave 4 of the Satin engine, on top of the wave-3 pull request (#387, base cz/feat/satin-w3): three mechanisms, a refactor batch that reworks two of them and the limit layers' hot path, the revm fork's three new hooks, and lazy detention bookkeeping. Each lane was merged from its own branch with --no-ff; fixes and review commits sit between the merges.

  • Native keyless deployment. A keylessDeploy(bytes,uint256) call to KeylessDeploy (0x6342…0003) deploys the Nick's-Method creation it carries as an ordinary CREATE of the recovered signer, in a real revm frame on the contract in which no code runs: no second EVM, no state to merge. The legacy engine's nine rules, their precedence, its error ABI and the system contract are unchanged. A signer at nonce 1 stays there whether its deployment succeeds or fails, so failed attempts, which anyone can submit, never make the address undeployable.
  • System calls and the pre-block calls. A system call runs on at most 30M of regular gas; the rest of its gas limit is its EIP-8037 reservoir. The EIP-2935, EIP-4788 and, when a role change is due, applyPendingChanges() calls run through one helper and one error rule: a database error the database calls fatal is an internal error; any other failure refuses the block.
  • The live system address, read inside the EVM. Only a transaction of the system shape (a legacy call to a whitelisted contract, today the Oracle) reads the registry's _currentSystemAddress, from its own journal at validation, and is promoted when its caller matches. The block executor no longer reads or plumbs the address, and an EVM built outside block execution follows a rotation with no setup.
  • The revert-class stop. A transaction-level crossing (data size, KV updates, state gas, detention's compute limit) latches the transaction and rewrites every frame's result, an inspector's included, to MegaLimitExceeded(kind, limit); a frame-budget crossing reverts that frame alone.
  • Measured hot-path savings. Four implementation-only changes in the limit layers, each kept after it was measured: nine benchmarks cheaper by up to 3.2%.
  • The revm fork's three hooks. Deployed code is held at the fork's code-deposit admission (ContextTr::admit_code_deposit), in place of a retrace of return_create the engine ran on every creation's return; gas detention decides a precompile call it holds from the call's price (Precompile::required_gas); and a frame detention stops settles on the fork's crossing record, which now holds the regular gas the frame had before the charge that crossed.
  • The fork pins. The twelve revm crates move from v40.0.3-mega.3 to v40.0.3-mega.4 (b706bb1a), op-revm from v20.0.0-mega.2 to v20.0.0-mega.3 (58bc98e2), which prices its size-limited precompiles. Cargo.lock moves those and revm-statetest-types, nothing else.
  • Lazy detention bookkeeping. Until a read sets a compute limit, detention keeps one record per frame revm builds a child of and nothing else of the frames; the first read rebuilds the compute figure from those records. A debug build keeps the figures from the first frame on, by the same update body, and holds the rebuilt ones to them. No result changes; the call-heavy benchmarks save 33 to 88 Ir per call.

Behaviour changes to note.

  • A transaction from the live system address without the system shape (a non-legacy type, a creation, a call off the whitelist) is now ordinary, validated and charged as a user's; the legacy engine and Satin before this wave refused it. The Oracle authorises writes on msg.sender alone (onlySystemAddress), so a non-legacy transaction signed by the system key to the Oracle is accepted and its writes land, executed as a user's: fees, every per-transaction limit, detention, bucket pricing, history. Only the key's holder can send one.
  • A keylessDeploy call that returns touches the KeylessDeploy account, as any call touches its target; one that reverts takes the touch back. The account holds code and was loaded to start the transaction, so state root, receipts, gas and witness do not change.
  • A detention stop bills less. A frame gas detention stops gets back the regular gas it had before the charge that crossed, so a stopped transaction is billed its compute at the crossing, less than one charge short of the limit, where it was billed the limit; an answer that crosses (an interceptor's that spends past the allowance, a precompile's) is billed nothing past the compute at the call. The revert data, MegaLimitExceeded(2, limit), is unchanged.
  • limit_exceeded.used of a compute stop is the transaction's compute at the crossing, the figure the regular ledger bills, where it was the limit: the same rule at every crossing site, at most the limit unless a halting frame's leftover, counted as compute, took the transaction past it before the charge.
  • A creation that can pay its code's state gas but not its history now runs out of gas whatever the limit, as return_create has it, where the retrace stopped one charge short of return_create and made the shortfall a limit stop. Below the execution cap only: above it the reservoir pays.
  • A priced precompile past the allowance is answered as the crossing without running, where it ran on the allowance and ran out of it. One priced past its whole forward runs on the forward and runs out of gas, a failed call its caller survives, as without the read, where it was the stop. A node's own or a replaced precompile still runs on the allowance.

Breaking, against the base:

  • transact_blockhashes_contract_call and transact_beacon_root_contract_call take a MegaEvm instead of any alloy-evm Evm, and return an error for a call that does not succeed.
  • MegaBlockExecutionError gains ApplyPendingChangesFailed; PreBlockStateSource gains PendingChanges and ApplyPendingChanges. Neither enum is #[non_exhaustive].
  • A pre-block call's database error is classified by DBErrorMarker::is_fatal: a fatal one (every one under revm's State without a block access list) is BlockExecutionError::other, where an EIP-2935 or EIP-4788 call's was a BlockValidationError; a non-fatal one refuses the block with the call's validation error.
  • system::sent_from_system_address is removed and system::has_system_transaction_shape added. JournalInspectTr::inspect_storage loads the slot's account without its code.
  • GAS inside a system call reads at most 30M. A keylessDeploy call that used to revert with NotIntercepted() now deploys.
  • LimitCheck::ExceedsLimit::used for LimitKind::ComputeGas, an outcome's limit_exceeded.used, is the compute at the crossing, not the limit.
  • The fork's WithheldCrossing::new and withheld() are replaced by with_remaining and remaining(), which hold the regular gas a frame had before the charge, not its withheld part; code that reads the record itself must follow.
  • The last two lanes delete or rename no public engine API: the retrace they remove (meter_deployed_code, deposit_state_gas, hold_deposit_state_gas) was private, and AdditionalLimit::on_create_return (now on_code_deposit) and detention's bookkeeping are crate-private.
  • Added and removed again within the wave: MegaContext::{system_address, set_system_address, with_system_address}, system::resolve_system_address, PreBlockStateSource::SystemAddress, MegaBlockExecutionError::{MissingSequencerRegistry, SequencerRegistryCodeMismatch, ZeroSystemAddress}.

Tests. The wave ports 137 parked legacy tests and retires none: _pending/ drops from 169 to 32. The 49 tests that pinned the old detention bill now derive each stop, and its bill, from the regular charges their programs make after the read.

Reviews. Five independent reviews found no consensus-relevant defect; they led to seventeen, five, three and four commits. The one behaviour change among review commits is the error class of a pre-block call's database error.


Native keyless deployment

  • The frame. The dispatch (keyless::is_dispatched) takes the transaction's own call, at depth 0, in frame_init before interception; a contract's keylessDeploy call runs the bytecode, which reverts NotIntercepted(). revm builds the frame as any call's, with its own checkpoint, gas and lane; its first run (keyless::run) returns a rule's refusal or starts the creation as its child, forwarding min(gasLimitOverride, remaining). A call carrying value is refused NoEtherTransfer() after the overhead, before revm builds its frame.
  • The creation is an ordinary CREATE frame: the 98% data-size and KV share, the creator record, the upfront state-gas hold, the latch, detention, EIP-7708 logs, the transaction's ORIGIN and GASPRICE.
  • The settlement. keyless::returning reads the creation's outcome before revm merges it; keyless::settle gives back the signer's account charge when the creation did not create the account, and takes the nonce back, before the call resumes. The call then answers in the ABI: the deployed address, or the creation's error. A transaction limit, detention's stop or the call's own budget reverts the call and the whole deployment, the signer's nonce included. gasUsed is what the creation spent from either pool, before refunds.
  • Rule 4, a signer nonce of at most 1. From nonce 0 the bump to 1 stands: the replay barrier. From nonce 1 the settlement sets the nonce back, success or failure, when the creation's bump is the deployment's last nonce change, so a resubmission of a deployed one is refused ContractAlreadyExists(). A signer whose own constructor code spends a nonce that survives it (a delegated signer's CREATE or CREATE2) keeps every bump and is refused SignerNonceTooHigh from then on.
  • Precedence was checked against the legacy engine on pairs of failing rules; two refusals are this engine's own, after every rule (CREATE charges the call cannot pay, a forward they leave short).

At CPSB 1,530, CPHB 88 and the minimum bucket, in the order charged:

Charge Pool Amount Given back
overhead regular 100,000 never
signer's account, when the nonce bump creates it state 183,600 × m(signer) on a refusal or a revert of the call
CREATE regular gas regular 32,000 + 2 per init-code word never
created account state 183,600 × m(deploy address) when the creation fails
signer's nonce record history 3,520 with a revert; when a deployment from nonce 1 takes the bump back
created account's record history 3,520 when the creation fails
forward regular min(override, remaining) the unspent part
Moved from the legacy engine Legacy (sandbox) Satin (native)
ORIGIN / GASPRICE signer / 0 the transaction's
empty signer at the minimum bucket 0 gas 183,600 state gas
refusal after the signer's account is charged keeps the charge gives it back
gasUsed after the sandbox's refund, inner intrinsic included before refunds
transaction-level limit halt, no merge latch revert, deployment taken back
volatile reads not detained the transaction's, detained
database or SALT failure InternalError() revert the transaction fails with its cause

Detention. The call is detained as the transaction's own frame, held before it charges anything, so the overhead and the CREATE regular gas are compute; it suspends on its creation as any frame on its child. A signer that is the block beneficiary is detained (b0e99984). A deployment carrying value logs Transfer(signer → deploy address).

Tests. tests/system/keyless/ has 151 tests, including frame (the call on revm's frame stack, what an inspector sees, the touch, the no-code case) and differential, 155 scenarios run plain and under three inspectors. All 75 parked keyless rows are ported. A constructor has one less level of call depth than in the legacy engine.


System calls and the pre-block calls

  • The split. spec_cfg turns on the fork's system_call_state_gas_margin_in_reservoir, so Handler::system_call_gas keeps at most 30M as regular gas, which GAS reads, and moves the rest to the reservoir, on both system-call paths. A transaction, the system-address one included, is still split by the 200M execution cap.
  • Still exempt. A system call prices at the minimum bucket, pays no history, is held to no per-transaction limit and is not detained, so it settles exactly as op-revm's does. MegaEvm::transact_system_call_with_gas_limit runs one on a gas limit the caller names and commits nothing.
  • The pre-block sequence is EIP-2935, EIP-4788, the seven deploys, the registry's due check and applyPendingChanges() when a change is due; each step's state reaches the pre-block observer before it is committed. A failed call refuses the block before its state reaches the observer; on the base, a failed EIP-2935 or EIP-4788 call's state was committed as if it had succeeded.
  • The budget is pre_block_call_gas_limit = max(block gas limit, 30M), the legacy engine's: what it adds above 30M is reservoir, paid for only when used. The neutral configuration leaves the switch off, as revm's runner does.
System call Gas limit Regular Reservoir
EIP-2935, EIP-4788, applyPendingChanges() (pre-block) max(block gas limit, 30M) 30M block gas limit − 30M, or none
alloy-evm transact_system_call, revm SystemCallEvm revm's 31,566,720 30M 1,566,720
MegaEvm::transact_system_call_with_gas_limit the caller's min(limit, 30M) the rest

Tests. tests/satin/system_call.rs compares each case field by field with op-revm on the same CfgEnv; tests/block/eips.rs pins the refusals, both database-error classes, and 400 fresh slots that succeed in a 250M block and are refused in a 30M one; tests/block/sequencer_registry.rs a rotation with a real EIP-712 proof. 45 parked rows are ported.


The live system address, read inside the EVM

  • The read. MegaHandler::validate_env first tests the transaction's own fields (has_system_transaction_shape: type 0, a call to an address on MEGA_SYSTEM_TX_WHITELIST). Only a shaped transaction reads the registry: its code hash must be that of the code this engine deploys, then the _currentSystemAddress slot, both cold and journaling nothing, the account loaded without its code. A matching caller is validated (chain id, nonce, EIP-3607) and promoted.
  • Every transaction of a block agrees. The address cannot change after the block's pre-block call: a change is scheduled for a later block and applied by that block's pre-block call. The per-transaction reset moved into validate_env, so every entry point that runs the handler resets.
  • What moves. The pre-block witness loses the read; a shaped transaction's state and witness carry the registry account, without code, and the one slot. The expected code hash must be chosen per spec when the registry is next upgraded, or a replay by the newer binary would silently demote system transactions.

Tests. A rotation around its activation block; an EVM outside block execution promoting the rotated address; the read leaving the slot and the registry cold; another shape never reading the registry; the witness entries; the behaviour change over four shapes; database errors.


Measured hot-path savings

None changes an execution result; each commit was built and measured on its own.

  • 6dc052ca. A child's 98% share computed in u64 as r − ⌈r/50⌉, checked against the u128 product: −71 Ir per child frame start.
  • ed76ddd2. #[inline] on the lane pop: −37 to −41 Ir per frame return.
  • 2e1e8ca1. A returning frame's caller is checked only when the return hands it something no check held; a debug_assert! checks every skipped return: −8 to −21 Ir per return.
  • 6946eb38, 90d097bc. Whether a frame's caller refuses its start is staged by the opcode wrapper and taken by frame_init, compared in debug builds with a fresh lookup: −58 to −67 Ir per value-moving frame start.
Benchmark Base Head of the lane Change
transact/deep_calls/satin 476,905 467,606 −9,299 (−1.9%)
transact/intercepted_calls/satin 491,115 482,049 −9,066 (−1.8%)
transact/system_address_misses/satin 1,151,099 1,114,033 −37,066 (−3.2%)
transact/salt_new_accounts/satin 103,133 100,117 −3,016 (−2.9%)
block/transfers 2,583,220 2,576,657 −6,563 (−0.3%)
block/storage_writes 1,696,467 1,693,936 −2,531

The other three measured moved by −102 to −39 Ir. Two costs of +3 and +4 Ir were kept, below the 45 Ir the untouched op-revm controls moved between the same builds.


The revert-class stop

A transaction-level crossing reverts the crossing frame with MegaLimitExceeded(kind, limit) and latches the transaction; every frame above returns the same revert without running another instruction, and the transaction settles like an EIP-8037 revert. A frame budget reverts its frame alone. A real out-of-gas, and a precompile given less than its price, still halt and burn.

The matrix (tests/satin/stops.rs): 4 limits × {own frame, three calls down} × {100M, 300M} × {no inspector, one rewriting every result into a success}, each cell billed against a twin transaction that reverts where the stopped one crossed; beside it a creation column under an inspector that also revives creations, frame-budget rows, halt rows, frames answered without running three calls down, and the keyless column.

Two gaps closed. aaa49cd6: the latch now rewrites any result, a halt an inspector made included. ecd066fe: under the latch, a revived stopped creation is put back and the latch reports the stop, where it failed the transaction; a creation stopped by its own budget latches nothing and is still refused. All 17 parked rows assigned to the stop are ported.


The revm fork's three hooks

  • Code-deposit admission. MegaContext implements ContextTr::admit_code_deposit, which return_create asks once it has made every charge for a deposit (regular costs, SALT-priced state gas, history) and before it commits the creation. It holds the code's state gas to the state-gas limit, then counts its bytes as data size and history bytes on the creation's lane; a crossing refuses the deposit with the stop's revert data and the creation reverts on the gas it had before the deposit, leaving no code. It replaces the retrace of return_create the engine ran after every creation's return (120 lines out of evm/execution.rs).
  • The precompile price. Detention decides a precompile call it holds to an allowance below its forward from Precompile::required_gas on the Satin table's own entry (PricedPrecompiles, hold_precompile), as the behaviour change above says; a crossing is answered without running (Detention::cross_at_price) and settled as the stop. The KZG entry carries its flat price, op-revm's size-limited wrappers that of the run they wrap. No price is read for an address a node replaced through with_dyn_precompiles, an entry whose id changed, any entry once the neutral configuration installed the fixture fork's set, or a node's own precompiles: those run on the allowance and are settled on the forward.
  • The settlement. Detention::stop puts the frame's gas back to the crossing record, so the charge is not made and the spendable and withheld parts go back to the caller. The engine marks its own crossing answers the same way, so an answer that crosses spent nothing. used is the compute before the charge at every site.
  • Order. The re-pin commit (a0cd8ff5) keeps the old billing through a small adapter, so every differential is byte-identical at it; the settlement commit (ea7c2b59) removes it.

Tests. The 49 tests that pinned the old bill derive each stop from a model of the regular charges a program makes after its read (Charges in tests/satin/detention.rs); every disagreement between model and engine was a charge the model had missed, named and added. New tests cover the price-first decision at each boundary, the replaced-address and foreign-set rules, a node's own precompile, the KZG price against its run, each size-limited wrapper's EIP prices and detention, the neutral set, and the one-charge-short deposit. Against the lane's base the gate outcome files are byte-identical; the keyless differential record moves in 24 of 620 entries, all detention stops, in gas, ledgers and used only.

Residuals, documented. An input priced between the allowance and the forward that would fail a check the precompile makes after its gas check is the stop, where without the read its caller survives the failed call. A change made around the engine through the precompile map's mutable accessors, or a whole set put in its place through EvmTr::all_mut or alloy-evm's components_mut, is not seen; neither accessor can signal a change, since revm calls all_mut on every frame and alloy-evm's tracer calls components_mut. A node changes the set through with_dyn_precompiles or the factory's builder.


Lazy detention bookkeeping

  • What is kept, and when. Until a read sets a compute limit, detention keeps what a halt burns and the volatile-access switch, and of the frames only one record per frame revm builds a child of: MegaEvm::frame_init records the caller's regular gas spent and gas limit (record_caller, Detention::on_child_build) after every answer and before revm builds the child. The first read that sets a limit rebuilds what the frames it runs under add to the compute (Detention::track): each one's regular gas spent less the gas limit of the frame above it, the reading frame's own for the last. From there every frame is kept as before.
  • Why it is the same figure. Nothing touches a caller's gas between its suspension and its record; a running frame's gas limit is fixed when revm builds it; every frame below the reading one was built in the transaction while no read had set a limit, so its caller was recorded then. The records are cleared per transaction, and the reading frame's depth is its interpreter's (interpreter.input.depth), which revm sets from the depth it builds the frame at.
  • The proof. A debug build also keeps the figures from the first frame on, by the same update body (FrameFigures), and asserts the rebuilt ones, and every one kept after them, equal: 608 rebuilds over the suite, up to depth 3; two deliberate breaks of the rebuild fail 9 and 48 tests. A record of 4,970 transactions (result, ledgers, usage, stop, detention verdict), the keyless record and the gate outcome files are byte-identical before and after. In release, where the copy compiles out, the whole suite passes, and the detention tests assert each stop's exact used and regular ledger.
  • The untracked path. An answer settles inline while no read has set a limit, and a frame that runs untracked reads only the limit.

Performance

Instruction counts from callgrind on arm64 Linux, run as CodSpeed runs them; the CodSpeed report on this pull request is the reference.

  • Hot-path savings: up to −3.2% (above).
  • The fork's hooks: the code-deposit admission removes the retrace, about −28 Ir per frame run; the price-first decision gives part of it back on frame starts, +2.8k on system_address_misses once it was made a small value with the detained path out of line. The re-pin alone moves the block benchmarks (+11,029 on block/transfers) and the untouched op-revm controls (+181, +324): the fork's code and layout.
  • Lazy bookkeeping: −62.9, −33.0 and −88.1 Ir per call on deep_calls, intercepted_calls and system_address_misses; salt_new_accounts +336 and +690, the caller records' allocation at the first child a fresh EVM builds, which a block's EVM makes once.
  • The fifth review's four commits: +1 Ir per transaction (the records' clear), −1 per frame run (no depth to store); the rest is codegen: Detention::on_frame_run now inlines (−1.2k to −3.6k), revm's mstore shows its known 10,828 flip on system_address_misses, and the block benchmarks, which run with detention off, move +1,552 and +1,232 with revm-database and hashbrown inlining.
Benchmark 8b28cb3f 4413e643 Change
transact/deep_calls/satin 476,161 469,370 −6,791 (−1.4%)
transact/intercepted_calls/satin 496,296 482,051 −14,245 (−2.9%)
transact/system_address_misses/satin 1,147,469 1,123,935 −23,534 (−2.1%)
transact/salt_new_accounts/satin 102,973 101,309 −1,664 (−1.6%)
transact/logs/satin 219,734 217,832 −1,902 (−0.9%)
block/transfers 2,570,901 2,573,662 +2,761 (+0.1%)
block/storage_writes 1,698,228 1,697,769 −459

ether_transfer and storage_writes moved −67 and −175; the op-revm controls +178 and +102, most of it at the re-pin.


Merges and reviews

  • Merges. 9020513e (keyless) conflicted in 13 files; its behavioural resolution puts the keyless dispatch before interception and every answer through settle_answer. e308b014 (system calls) merged cleanly, e6fad521 (the stop) conflicted only in docs and the pending-tests README. Of the batch, a55d6297 and 7dd593c0 merged cleanly and 31af0e51 (the keyless frame) conflicted in AGENTS.md, evm/context.rs and evm/execution.rs; the keyless differential record across the batch is line for line that lane's own diff. 1acbf32d (the fork's hooks) and a8dd8f62 (lazy bookkeeping) merged cleanly: each tree is its lane's head.
  • First and second reviews, seventeen commits (102376c9…4b05d25c): one helper and one error rule for the pre-block calls, the database error classified by is_fatal, one place for an answer given before a frame is built, the keyless column and depth-3 cells of the matrix, a debug assertion that no frame returns a halt under the latch, schedule-derived limits, docs.
  • Third review, of the batch, five commits (3ff80ff1…8b28cb3f), none changing a result: docs and a test that a call where the state holds no contract code commits nothing for the contract.
  • Fourth review, of the fork's hooks: 5d16c64e asserts the deposit's state-gas stop is the creation's own end, which two mutants moving the hold to the caller's next charge used to pass; 4d9a7f89 drops the answer stop's regular-spent term, always zero once the gas is put back, asserting it in debug builds; 9e8172cf documents the whole-set residual above and pins it with a test.
  • Fifth review, of the lazy bookkeeping, found nothing above informational; its three suggestions are these commits: 2ba369a0 clears the caller records per transaction, keeping the allocation, which retires a stale-entry invariant and a release-only fallback; 6f245221 gives the kept figures and their debug copy one update body; 86d049bc takes a read's depth from the frame that makes it, removing a field; 4413e643 hoists a call clippy flagged out of the rebuild loop.
  • The op-revm re-pin, c1231f66…b7d58ef6: the pin, a test per wrapper, docs. Only wrapper tests move; gate outcomes and the keyless record are byte-identical.

Open items

  • Confirm the behaviour change: a system-address transaction of another shape is ordinary, with the Oracle consequence above. Keeping the refusal would mean reading the registry for every transaction.
  • Pre-existing. A transaction arriving with the system source hash is system-originated whoever sent it; a block cannot carry one.
  • The registry code hash must be chosen per spec at the registry's next upgrade.
  • Call revival. The return gate checks a success past its own budget because an inspector may revive a call its budget stopped; refusing call revival outright, as creation revival is, would be a separate decision.
  • Scope to confirm. b0e99984 (a beneficiary signer is detained) goes beyond the keyless merge's aim; it is its own commit and can be dropped alone.
  • Neutral configuration. The Amsterdam system-call switch is off, matching revm's runner; revisit when a fixture release adds a system-call case.
  • Not taken from the fourth review: one map lookup instead of two when a held precompile is priced.
  • Byte prices. At MEGA_SATIN_CPSB=312.5, not a required setting, six satin tests failed on the system-call branch, in files it does not touch; the base was not checked.
  • Keyless wall clock. Before the frame refactor a deployment took about 82 µs against op-revm's 2.5 µs for the same init code, mostly signer recovery.
  • From wave 3. Its open items stand, except two. The parked tests are 32: the common execution layer 21, inspector support 4, and 7 awaiting a decision on preload-warm cold charging or 98/100 forwarding.

Test plan

All results are on b7d58ef6, the head, unless stated otherwise.

Check Result
cargo fmt --check, cargo clippy … --all-features --locked, cargo sort --check …, the riscv no_std check, Prettier, git diff --check origin/satin..HEAD exit 0 each; clippy reports no warnings
cargo tree -i revm / -i op-revm one each: v40.0.3 (…?tag=v40.0.3-mega.4#b706bb1a), v20.0.0 (…?tag=v20.0.0-mega.3#58bc98e2)
cargo test --workspace --locked 1,342 passed, 0 failed, 1 ignored doctest: 334 unit + 114 block + 528 satin + 321 system in mega-evm; 23 + 12 in the runner; 4 CLI; 5 + 1 in system-contracts
the same with --release 1,328 passed, 0 failed: the 14 debug-only tests (7 unit, 2 block, 5 satin) compile out
cargo test -p mega-evm --features satin-price-override,test-utils, prices unset and at CPSB 2000 / CPHB 100 1,299 passed in both runs (336 unit + 114 + 528 + 321), 2 ignored
state-test --fork Osaka / --fork Amsterdam, equivalence, release, CI's pinned flags gate passed: 19,465 executed / 52 skipped / 2 deviated, listed; 15,754 / 72 / 37, listed; 0 unattributed, 0 unreproduced
state-test --mode satin report, unchanged from wave 3: 2,084 and 1,875 passed
cargo bench -p mega-evm --bench <b> -- --test every benchmark runs: transact 40, corpus 13, factory 2, block 3
earlier commits cargo check --workspace --all-targets --locked warning-free on every commit of 8b28cb3f..b7d58ef6, each first-parent commit 9020513e…8c7fc20a and each of the 22 earlier review commits; the first row's checks and the tests passed on 8c7fc20a, dd64719b, e6fad521, 879208d9, 4b05d25c, 8b28cb3f, 4413e643 and each lane's head
diff mutation gates, sharded: before the reviews c0882c78..e6fad521; the first two reviews, two gates over e6fad521..4b05d25c; the batch 4b05d25c..cb8d1501 and its review ..8b28cb3f PASS: 181 mutants (134 caught, 47 unviable); 52 (17, 35); 148 (115, 33) and 6 (5, 1)
diff mutation gates, sharded: the fork's hooks 8b28cb3f..e4b8bde5; the fourth review and lazy bookkeeping 1acbf32d..70a57fe0; its review a8dd8f62..4413e643; the op-revm re-pin 4413e643..b7d58ef6 PASS: 53 mutants (33 caught, 20 unviable); 44 (37, 7); 23 (20, 3); none (tests and docs only)
every diff mutation gate 0 missed, 0 timed out; the unviable are whole-body replacements with a default of a type that has none. Each earlier branch passed its own gate, every viable mutant caught
infra mutation gate PASS: 35 of 35 viable caught; its one file is unchanged in the wave. mutants/ and .cargo/ unchanged: no suppression added
tests/_pending/README.md, regenerated and checked against the tree up to date: 32 pending, from 169

A depth-0 keylessDeploy call is rewritten, before interception and before
an inspector sees it, into a CREATE frame the signer starts at its
Nick's-Method address. The call becomes a frame no code runs in: its lane
and journal checkpoint are pushed, it pays the fixed overhead and what the
CREATE opcode charges its frame (the signer's account when the nonce bump
creates it, the created account, the two frame-start records), and it
forwards the override capped to what it has left. The creation's result is
settled into it and answered in the IKeylessDeploy ABI.
Every rule of the legacy engine, its error and what a refusal leaves: the
overhead and nothing else. The balance rule asks for the value alone, a
failed read or SALT lookup fails the transaction with its cause, and rule 4
counts real nonces, so a signer gets two failing attempts and not a third.
Ports the parked rows that pinned the rules.
The canonical deployments, every outcome the ABI reports, the nonce the
creation spends, the logs, value and storage a constructor keeps, ORIGIN
and GASPRICE of the transaction, the fees, the SALT and oracle
environments the creation runs in, and a failed transaction leaving
nothing for the next. Ports the remaining parked rows; the volatile-access
rows go to detention, and the residual-overflow halt is retired.
A keyless call charges the signer's account because the creation's start
bumps the signer's nonce, which is what creates it. A creation an inspector
answers in its place never starts, so the charge goes back at settlement
when the signer's nonce was not spent. Pins what an inspector sees of a
keyless deployment: the creation from its start to its end and every step
of its init code, and a refused call as the call it is.
A frame budget reverts the creation alone and the call reports it; a
transaction limit stops the transaction and takes the deployment back
whole, the signer's nonce included; the state gas of the creation's start
is held once the creation is built, and the code it deposits before it is
written. Pins the three leakage paths for the call: an answer carries the
reservoir, a stopped transaction gives back all but what ran, and the
unspent forward comes back the same on success and on revert.
A case that can only be reached below the cap says why: above it the
transaction's frame is forwarded the cap itself and the reservoir pays the
call's state and history charges.
…on op-revm

The canonical CREATE2 factory through keylessDeploy, checked to deploy
before it is measured, and its init code as an op-revm creation
transaction.
The module table, the system contracts' dispatch, a keyless paragraph and
the lanes contract in AGENTS.md; the keyless patterns and anti-patterns in
the system module's guide; the crate README; and the error variants that
now have no producer.
…t reach

The halt reason, which the ABI drops, is its own function with a test; the
answers to a creation revm reports at another address, which no deployment
reaches, share the one comparison every deployment makes; and the signer's
account is given back on the nonce alone, a signer that had one having been
charged nothing.
A signer that sends its own deployment makes no record of its own; init
code of exactly the limit passes rule 8; and a transaction its body
latched is answered with the stop and never rewritten, on the inspected
path too.
… nonce past 1

A keylessDeploy call is permissionless and the signed transaction public,
so a nonce every failed deployment spent let anybody make a signer's
address undeployable with two failing calls. A failed deployment now keeps
the signer's nonce bump only from 0 to 1: from nonce 1 the settlement sets
the nonce back and takes the bump's write record and its history back. A
deployment that succeeds keeps revm's bump, and rule 4 is unchanged.
…ation

The call's journal checkpoint was taken before the inspector's create hook,
so a depth-aware tracer hung the creation under an empty depth-0 node and
the call to KeylessDeploy appeared nowhere. The inspector is now told the
call starts, then the creation as its child one journal depth below, and
the call's end once the creation is settled into it: the inspected
execution settles the deployment before the last-frame step does, and
reports the call's end with the answer it gave.
…egacy engine's error

The signer's account is charged where the legacy engine charged it, after
the signer's rules, and the forward is checked right after, before the
deploy address and the balance are read. The charges of the creation's
start come after every rule, and the forward is checked again after them.
A matrix of calls failing two rules at once pins that each reports the
error the legacy engine reported.
…rges

The call paid for the creation's start what the CREATE opcode charges in
state and history gas, but not its regular gas: the schedule's create entry
and EIP-3860's cost per word of init code. It now pays both after every
rule, before the created account and the records, as the opcode orders
them; the fixed overhead stays, for decoding the transaction and recovering
its signer. The figures are pinned at one and two words and at the maximum
init-code size, below and above the execution cap.
The rules keep the legacy engine's order, so a call several rules refuse
reports the legacy engine's error; the call pays the CREATE opcode's
regular gas on top of the overhead, which pays for decoding and signer
recovery; gasUsed is counted before refunds; and a selector the contract
declares, such as version(), answers.
…for detention

The retired row also pinned that a keyless deployment a transaction limit
stops still reports the volatile data its creation read, and that the stop
stays the limit's rather than detention's. That is detention's behaviour,
as for the five sibling rows: the test goes back to the parked file under
detention, and the README is regenerated.
…e stop

An answer that spends past the allowance is marked as a crossing of what
the frame would have had withheld. State and history gas that spilled onto
its regular gas would have drawn the withheld part first, and the revert
that settles the stop credits the spill back, so the crossing now leaves
the spill out rather than returning it twice.
…piles are priced

The release prices op-revm's size-limited precompile wrappers through `Precompile::required_gas`:
the wrapped run's price within the input size limit, and 0 above it, where the wrapper refuses
the input before any gas check. It pins the revm fork at the tag the engine already uses, so
`Cargo.lock` moves only op-revm's source.

The Satin set dispatches four of the nine: the Karst BN254 pairing and the Jovian BLS12-381 G1
MSM, G2 MSM and pairing. Gas detention now decides a call to one of them from its price rather
than running it on the allowance, so the tests that pinned an unpriced wrapper move to the priced
behaviour: every Satin entry is priced, and a node's own precompile is what keeps the clamp. The
pairing of three pairs and a stray byte is still the stop past the allowance, now answered without
running.
… its price

The Satin set dispatches four of op-revm's size-limited precompiles: the BN254 pairing and the
BLS12-381 G1 MSM, G2 MSM and pairing. Their prices are pinned against the formulas of EIP-1108
and EIP-2537 up to each size limit, and at nothing past it, where the wrapper refuses the input
before any gas check.

Gas detention's decision is pinned for each of the four, at the unit level and through a
transaction: within the allowance the call runs on its forward, as without the read; past the
allowance and within the forward it is answered without running and stops the transaction; past
the forward it runs on the forward and is a failed call its caller survives. An input past the
size limit runs on its forward under any allowance.
Every entry of the Satin set now carries a price, op-revm's size-limited wrappers of the BN254
pairing and the BLS12-381 MSMs and pairing included, so gas detention decides a call to one of
them from its price. The precompile module, the detention module, AGENTS.md and the crate README
no longer list the wrappers among the precompiles the engine cannot price, which are a node's own
and an address a node replaced, and name the op-revm fork's prices among what detention builds on.
@RealiCZ RealiCZ added spec:new Introduces a new MegaSpecId variant api:breaking Crate interface change — downstream users must update comp:core Changes to the `mega-evm` core crate dependencies Pull requests that update a dependency file agent Generated by AI agents labels Sep 27, 2026
@github-actions

Copy link
Copy Markdown

🧬 Mutation testing — ✅ PASS

Nothing to test — no mutants were generated on the changed lines.

@claude

claude Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Label check: spec:new looks incorrect on this PR.

Per the label's own description, spec:new means "Introduces a new MegaSpecId variant." This PR (Satin wave 4) doesn't touch MegaSpecId, MegaHardfork/MegaHardforks, or the chain schedule (block/hardfork.rs, block/chain.rs aren't in the diff) — it only adds mechanisms on top of the existing single SATIN rung (keyless deployment, system calls, the live system-address read, the revert-class stop, etc.), all references in the diff are to the existing MegaSpecId::SATIN.

Per AGENTS.md, Satin is currently the active unstable spec ("SATIN is the unstable spec under active development ... its behavior may change until it is sealed"), which matches the spec:unstable label's description ("Changes to the unstable spec"). Suggest swapping spec:new → spec:unstable.

The other labels look right: comp:core (all substantive changes are in crates/mega-evm) and api:breaking (the PR description has an explicit "Breaking" section listing several public API changes).

@codspeed

codspeed Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 14 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 56 untouched benchmarks
⏩ 385 skipped benchmarks1


Comparing cz/feat/satin-w4 (fab6638) with cz/feat/satin-w3 (1caeed1)

Open in CodSpeed

Footnotes

  1. 385 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.9%. Comparing base (c0882c7) to head (fab6638).

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

🧬 Mutation testing — ✅ PASS

Diff mutation score: 100.0% (268/268 viable mutants killed)

  • caught: 268
  • survived (real gaps): 0
  • timed out (inconclusive): 0
  • suppressed (equivalent/dead-code): 0
  • unviable: 388 · timeout total: 0

No new test gaps introduced by this change. 🎉

@RealiCZ RealiCZ added spec:unstable Changes to the unstable spec (currently REX5) and removed spec:new Introduces a new MegaSpecId variant labels Sep 27, 2026
@RealiCZ
RealiCZ added this pull request to stack #403 October 12, 2026 12:39
@RealiCZ
RealiCZ removed this pull request from stack #403 October 21, 2026 06:32
@RealiCZ
RealiCZ added this pull request to stack #408 October 22, 2026 06:45
@RealiCZ
RealiCZ marked this pull request as ready for review October 22, 2026 06:45
@RealiCZ
RealiCZ removed this pull request from stack #408 October 22, 2026 06:47
…ation gate, spec draft, no Rex7 (#390)

Co-authored-by: mega-putin <mega-putin[bot]@users.noreply.github.com>
@RealiCZ
RealiCZ merged commit 1caeed1 into cz/feat/satin-w3 Oct 22, 2026
23 of 24 checks passed
@RealiCZ
RealiCZ deleted the cz/feat/satin-w4 branch October 22, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Generated by AI agents api:breaking Crate interface change — downstream users must update comp:core Changes to the `mega-evm` core crate dependencies Pull requests that update a dependency file spec:unstable Changes to the unstable spec (currently REX5)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant