Skip to content

fix(rex6): review-driven fixes + remaining hardening (follow-up to #348)#349

Closed
RealiCZ wants to merge 2 commits into
cz/feat/rex6-previewfrom
cz/feat/rex6-review-fixes
Closed

fix(rex6): review-driven fixes + remaining hardening (follow-up to #348)#349
RealiCZ wants to merge 2 commits into
cz/feat/rex6-previewfrom
cz/feat/rex6-review-fixes

Conversation

@RealiCZ

@RealiCZ RealiCZ commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #348 (the faithful REX6 migration). Collects the review-driven fixes and the remaining REX6 hardening so the migration PR itself stays a clean, byte-faithful merge. Base is the migration branch (cz/feat/rex6-preview); retarget to main once #348 merges. All changes are REX6-only (unstable spec) or replay-safe hardening of frozen paths — no live-spec behavior changes.

Fixes already applied (each pinned by a regression test)

  • Witness / stateless friendliness: deposit-style transactions skip the fee-recipient snapshots; fee-recipient and deposit-caller reads use a non-hydrating balance/emptiness helper; the EIP-7702 authority scan short-circuits once a pre-frame limit is latched.
  • Arithmetic on attacker-influenced values: the EIP-7702 authority, callee/create, and deposit-caller SALT-gas folds all saturate into initial_gas, so an intrinsically unaffordable transaction is rejected instead of wrapping past the gas-limit check.
  • Forgeable-input trust: the system-tx metering exemption requires the promotion sentinel to be paired with the system caller.
  • Docs / hygiene: mega-evme CLI docs synced to the Rex6 default; stale helper/metering-path comments corrected; spec-gate boundary tests added (killing the mutation-gate survivors); pop-frame cache invariant pinned with debug asserts.

Remaining work (found in the pre-push adversarial sweep; not yet fixed)

  • Caller-only system exemption: is_system_originated's first branch grants the exemption on caller == 0xffff…fffe alone; a replay / t8n / direct transact_raw input can set that caller without entering through run_system_call. Needs the exemption gated on the real system-call entry, not the caller address alone.
  • Authority accounts loaded before caller validation: the REX6 authority scan in validate() reads each authority account (and its code) before pre_execution validates the caller's nonce / funds / code and the final Mega-gas bound; an otherwise-doomed type-4 tx still requests those accounts, which a minimal stateless witness cannot satisfy.
  • CALL delegation-code witness dependency (flagged in passing during the sweep) — to be confirmed and scoped.
  • Previously-ticketed REX6 lifecycle items carried from the preparation line: CREATE pre-frame accounting lifecycle; post-execution fee-reward accounting vs limit latching; source-side SELFDESTRUCT beneficiary-detention marking when volatile access is enabled and the beneficiary is a CREATE-predicted address.

RealiCZ added 2 commits July 21, 2026 17:28
Saturate the authority SALT-gas fold into initial_gas so a heavy-bucket
authorization list is rejected as unaffordable instead of wrapping past the
gas-limit checks; require the system caller alongside the promotion sentinel
before granting the system-tx metering exemption (replay/t8n inputs can carry
forged deposit fields); and read the deposit-caller materialization check
through the non-hydrating balance/emptiness helper.
…tial_gas

Extend the authority-fold hardening to its siblings: the callee/create
new-account storage gas and the deposit-caller materialization gas are also
SALT-priced and can saturate to u64::MAX, so fold them with saturating_add to
keep an unaffordable transaction rejected instead of wrapping past the
gas-limit check. Pinned by a CREATE saturation regression test.
@RealiCZ RealiCZ closed this Jul 21, 2026
@RealiCZ
RealiCZ deleted the cz/feat/rex6-review-fixes branch July 21, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant