Skip to content

feat: wasm evm (via alloy-rs/evm2) - #366

Closed
jxom wants to merge 17 commits into
mainfrom
jxom/evm2-wasm
Closed

feat: wasm evm (via alloy-rs/evm2)#366
jxom wants to merge 17 commits into
mainfrom
jxom/evm2-wasm

Conversation

@jxom

@jxom jxom commented Aug 4, 2026

Copy link
Copy Markdown
Member

Adds a TS EVM interpreter via alloy-rs/evm2.

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ox Error Error Aug 6, 2026 8:18am

Request Review

@jxom jxom changed the title build(wasm): add evm2 adapter feat: wasm evm (via alloy-rs/evm2) Aug 4, 2026
@jxom jxom changed the title feat: wasm evm (via alloy-rs/evm2) feat: ts evm (via alloy-rs/evm2) Aug 4, 2026
@socket-security

socket-security Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​serde_json@​1.0.1518210093100100
Addedcargo/​alloy-consensus@​2.3.09910093100100
Addedcargo/​alloy-eip7928@​0.4.510010093100100
Addedcargo/​alloy-eips@​2.3.010010093100100
Addedcargo/​alloy-primitives@​1.6.110010093100100
Addedcargo/​dlmalloc@​0.2.1410010093100100

View full report

@socket-security

socket-security Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: cargo zerocopy is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?cargo/alloy-primitives@1.6.1cargo/alloy-consensus@2.3.0cargo/zerocopy@0.8.55

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore cargo/zerocopy@0.8.55. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/ox@366

commit: 57e7e08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2aaa049a7d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/evm/internal/codec.ts
Comment thread wasm/evm2/src/database.rs Outdated
Comment thread wasm/evm2/src/lib.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46c30834de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread wasm/evm2/src/database.rs
Comment thread scripts/wasm/build-evm2.ts
Comment thread src/evm/internal/codec.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b94bd230c2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/evm/internal/database.ts
Comment thread scripts/wasm/build-evm2.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2eab42ff2b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread wasm/evm2/src/database.rs
@jxom jxom changed the title feat: ts evm (via alloy-rs/evm2) feat: wasm evm (via alloy-rs/evm2) Aug 4, 2026
Binds a pinned alloy-rs/evm2 revision to WebAssembly through a versioned ABI,
with a host database bridge, generated artifact, and internal TypeScript loader.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 492ce019d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread wasm/evm2/src/database.rs Outdated
Comment on lines +186 to +187
Bytecode::new_raw_checked(Vec::from(&self.code[..length]).into())
.map_err(|_| HostError::Bytecode(B256::ZERO))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fall back to legacy for malformed delegation prefixes

When stored account code begins with the EIP-7702 prefix but is not an exact 23-byte designator—for example 0xef01new_raw_checked rejects it, and the shipped WASM adapter reports a database failure. Such bytes can exist in genesis or pre-EIP-3541 state and are ordinary legacy bytecode, so evm2 should execute them and return an invalid-opcode TxResult; retain autodetection for valid designators but fall back to legacy bytecode when the checked parse fails.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66d08d2c29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/evm/Evm.ts Outdated
return attempt(evm, () =>
apply(evm, {
...evm['~config'],
block: merge(evm['~config'].block, block),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Snapshot queued block updates before async execution

When this runs on an async EVM, the closure can be delayed behind an in-flight database read, so merge reads the caller's block object later rather than at setBlock call time. If the caller reuses or mutates that options object before the queue drains, the EVM applies a different block environment than the one submitted, unlike the synchronous path and evm2's value-based setter; snapshot the block fields before entering attempt (and apply the same pattern to setBlockAndExecutionConfig).

Useful? React with 👍 / 👎.

Comment thread src/evm/Evm.ts Outdated
evm: Evm<asynchronous>,
options: setExecutionConfig.Options,
): Awaitable<asynchronous, void> {
const specId = options.specId ?? evm['~config'].specId

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Default spec ID after the async queue drains

For async EVMs, this default is computed before the operation is serialized, so a queued setExecutionConfig({ version }) can capture the old spec while an earlier queued setter is still changing it. For example, issuing setExecutionConfig({ specId: 'cancun' }) and then setExecutionConfig({ version: ... }) in the same tick leaves the engine back on the original spec instead of keeping Cancun, even though omitting specId is documented as unchanged; move the ?? evm['~config'].specId fallback into the attempt callback while still snapshotting the explicit option value.

Useful? React with 👍 / 👎.

Comment thread src/evm/Evm.ts Outdated
evm: Evm<asynchronous>,
options: setExecutionConfig.Options,
): Awaitable<asynchronous, void> {
const specId = options.specId ?? evm['~config'].specId

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve omitted spec IDs at execution time

For async EVMs, this default is computed before the operation is serialized, so a queued setExecutionConfig({ version }) can capture the old spec while an earlier queued setter is still changing it. For example, issuing setExecutionConfig({ specId: 'cancun' }) and then setExecutionConfig({ version: ... }) in the same tick leaves the engine back on the original spec instead of keeping Cancun, even though omitting specId is documented as unchanged; move the ?? evm['~config'].specId fallback into the attempt callback while still snapshotting the explicit option value.

Useful? React with 👍 / 👎.

Comment thread src/evm/PendingState.ts Outdated
(entry) =>
entry.codeHash.toLowerCase() === current.codeHash.toLowerCase(),
)?.code
return { ...current, ...(code ? { code } : {}) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Copy pending bytecode before exposing it

When a detached pending state contains bytecode, this returns the stored Uint8Array by reference; StateChange.visit routes the same stored array to sinks. If an inspector, persistence layer, or tee branch mutates or zeroizes that buffer, the PendingState is corrupted and later accountInfo/visit calls observe code different from the detached evm2 state, so copy bytecode bytes at the boundary before returning or routing them.

Useful? React with 👍 / 👎.

Comment thread src/evm/Evm.ts
const source = evm['~driver']
if (!source) return run() as never
// Queued: awaiting a source yields control, and the engine is exclusive.
return source.serialize(() => driver.until(source, run)) as never

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject async operations submitted while borrowed

On async EVMs this schedules the engine call in a later microtask, so a caller can submit Evm.callTx, setBlock, or another operation while an ExecutedTx is still outstanding and then commit/discard that handle before the queue reaches this closure; the queued operation then succeeds against post-resolution state instead of being rejected like the synchronous path and evm2's exclusive-borrow lifecycle. Check the borrow synchronously when the operation is submitted, or serialize handle resolutions through the same queue, so calls made while the handle holds the EVM cannot be reordered past its resolution.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

* feat(evm): record executions with an inspector

* fix(evm): bound and reset traces correctly

* test(evm): assert setters are awaitable on asynchronous evms

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3fa593d49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/evm/Evm.ts Outdated
Comment on lines +820 to +823
limit: options.limit ?? 1_048_576,
memory: options.memory ?? false,
stack: options.stack ?? false,
steps: options.steps ?? false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Snapshot inspector options before queueing

On async EVMs this closure is scheduled through serialize, so these options.* reads can happen after the caller has already mutated or reused the options object. In that case Evm.setInspector(evm, options) may install a different trace configuration than the one submitted (for example toggling steps or changing limit before the microtask/queued read drains); copy the four option fields before entering attempt.

Useful? React with 👍 / 👎.

Comment thread src/evm/internal/bindings.ts Outdated
Comment on lines +126 to +127
const pointer = exports.ox_alloc(request.length)
if (pointer === 0) throw new ReentrancyError()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Mark allocation traps as fatal

When a large-but-allowed request makes ox_alloc trap (for example because the runtime cannot grow linear memory enough), the adapter's RUNNING flag can remain set, but this call is outside the trap handler that records trapped. The first failure therefore escapes as the raw WebAssembly error and later calls can be reported as ReentrancyError instead of the documented dead-instance TrapError; wrap ox_alloc in the same fatal-trap path used for ox_call.

Useful? React with 👍 / 👎.

* feat(evm): record executions with an inspector

* fix(evm): bound and reset traces correctly

* test(evm): assert setters are awaitable on asynchronous evms

* feat(evm): wrap block access lists

* fix(evm): report uncovered reads from the operations that raise them
* feat(evm): wrap block execution

* refactor(evm): identify the block accumulator by token

* fix(evm): carry bytecode with applied state, and only changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9af6a427b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread wasm/evm2/src/bal.rs Outdated
///
/// EIP-3860 caps deployed code at 24576 bytes; this leaves room for the initcode
/// limit above it rather than tracking the active specification here.
const MAX_CODE: usize = 49152;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Raise the BAL code ceiling to the Amsterdam limit

When setBal receives a code change between 49,153 and 65,536 bytes, reader.bytes(MAX_CODE) rejects it even though Amsterdam permits 65,536-byte deployed code (and this adapter already uses MAX_CODE_SIZE_AMSTERDAM for account code). A BAL built from an execution using the higher configured limit can therefore be emitted successfully but cannot be attached again; size this bound for the largest supported deployed-code limit rather than the initcode limit.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

Comment thread src/evm/Evm.ts Outdated
export function startBlockState<asynchronous extends boolean>(
evm: Evm<asynchronous>,
): Awaitable<asynchronous, BlockState.Token> {
return attempt(evm, () => evm['~engine'].startBlockState())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bind block-state tokens to their originating EVM

When two EVM instances have each started the same generation (commonly token 1n), passing the token from one instance to takeBlockState or ExecutedTx.commitTo on the other silently matches the other instance's local accumulator. This can drain or write the wrong block state instead of rejecting the cross-instance token; carry the owning engine identity with the token and validate it before dispatch.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

Comment thread src/evm/PendingState.ts
...(options.original ? { original: options.original } : {}),
}
return from({
...changes,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update change records when editing pending state

After insertAccount returns, the grouped accounts array contains the replacement but the spread preserves the original records; StateChange.visit reads only records, while commitSource reads the grouped arrays. A caller that edits detached state and streams it for persistence or auditing therefore observes the old account even though committing that same state applies the new one. Update the record stream alongside the grouped view, and apply the same fix to insertStorage.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

Comment thread src/evm/Evm.ts Outdated
*
* // Transaction `i` records at index `i + 1`.
* Evm.setBalIndex(evm, 1n)
* Evm.transact(evm, transaction)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve the BAL example transaction before taking the list

When this public example is followed, Evm.transact leaves an ExecutedTx outstanding and the EVM remains exclusively borrowed, so the immediately following Evm.takeBal(evm) throws BorrowedError instead of returning the built list. Commit the returned handle with ExecutedTx.commit before taking the BAL so the documented flow is executable and actually records the transaction.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fd10d145d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread wasm/evm2/src/state.rs
Comment on lines +328 to +329
record::STORAGE_WIPE => {
let _address = reader.address()?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve self-destruct wipes when applying detached state

When a detached transaction self-destructs an account—either before Cancun or after creating the account in the same transaction under EIP-6780—this branch consumes and discards its storage-wipe record. Consequently, Evm.commitSource(evm, ExecutedTx.detach(executed).pendingState) does not reproduce a normal evm2 commit: storage changes can remain in the accepted overlay instead of being cleared, producing incorrect state for later execution. Preserve the wipe and associated lifecycle information through the reconstructed state source rather than dropping it.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3001387feb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/evm/Evm.ts Outdated
Comment on lines +908 to +909
return attempt(evm, () =>
evm['~engine'].setBal({ bal, fallback: options.fallback ?? false }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Snapshot the BAL before queuing it

When evm uses Database.fromAsync, attempt schedules this closure through the promise queue, so setBal returns before bal and options.fallback are read. If the caller reuses or mutates either value—even later in the same tick, or while an earlier database read drains—the engine can attach different coverage and state from what was submitted, unlike the synchronous path and evm2's value-based setter; copy or encode both inputs before entering attempt.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

Comment thread src/evm/Evm.ts
Comment on lines +923 to +927
type ErrorType =
| AbiError
| BorrowedError
| EncodeError
| ReentrancyError

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include oversized BAL failures in the error union

When a caller attaches a BAL whose encoded request exceeds the adapter's 64 MiB limit, engine.setBal reaches bindings.call and throws RequestTooLargeError, but the public setBal.ErrorType omits that error even though callTx.ErrorType and transact.ErrorType declare the same boundary failure. Consumers using this exported union for exhaustive error handling therefore miss an error that valid setBal inputs can produce; include RequestTooLargeError in the union.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3228787c36

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/evm/Evm.ts
version?: Version | undefined
}

type ErrorType = EncodeError | VersionError | Errors.GlobalErrorType

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include ABI failures in create's error union

When a version override fits the TypeScript wire type but not wasm32's usize—for example maxCodeSize: 2n ** 32n—encoding succeeds, read_usize returns an ABI failure, and create throws Evm.AbiError. Because this exported union omits AbiError, consumers cannot exhaustively type error handling for an input the public API accepts; include it in create.ErrorType.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

Comment thread src/evm/Evm.ts
Comment on lines +1302 to +1304
address: options.address,
caller: options.caller ?? System.address,
data: Bytes.fromHex(options.data ?? '0x'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Snapshot system-call options before queueing

When this is called on an asynchronous EVM, attempt schedules the closure through the promise queue, so mutating or reusing options immediately after Evm.systemCall returns can change the target, caller, or calldata that eventually executes. This can apply state for a different system call than the submitted one, unlike the synchronous path and evm2's value-based SystemTx; copy and encode these fields before entering attempt.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

* fix(evm): read operation inputs when they are submitted

* fix(evm): build envelopes from fields the caller can actually supply

* fix(evm): keep caller-held state and sink guards intact

* fix(evm): accept the state and code a caller can hold

* fix(evm): remove the read ceiling, hold the borrow, ship license texts

* fix(evm): copy what a queued operation holds and keep its failures async

* fix(evm): merge queued blocks and resolve licenses for every source

* test(evm): group cases by the export they exercise

* fix(evm): classify bytecode alike and keep edits in evm2 order

* fix(evm): snapshot the state commitSource applies

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a2b2237e7b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread wasm/evm2/src/state.rs
Comment on lines +334 to +335
let decoded = Bytecode::new_raw_checked(bytes.to_vec().into())
.map_err(|_| abi::Error::Bytecode)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fall back to legacy when rebuilding pending bytecode

When commitSource reapplies detached state containing pre-EIP-3541 code that begins with 0xef01 but is not a 23-byte delegation designator, this checked parser returns an AbiError, even though the database path now correctly classifies the same bytes as legacy and evm2 can hold them. Consequently, detaching and reapplying an otherwise valid legacy execution cannot reproduce a normal commit; use the same checked-then-legacy fallback here.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57e7e08b9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread wasm/evm2/src/lib.rs
Comment on lines +307 to +313
op::START_BLOCK_STATE => match reader.finish() {
Ok(()) => start_block_state(),
Err(error) => abi_failure(error),
},
op::TAKE_BLOCK_STATE => match read_token(&mut reader) {
Ok(token) => take_block_state(token),
Err(error) => abi_failure(error),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the EVM borrow before block-state operations

On a synchronous EVM with an outstanding ExecutedTx, these dispatch arms bypass engine() and access the global block accumulator directly. Consequently, startBlockState can silently discard the active accumulator and takeBlockState can drain it while the transaction still exclusively borrows the EVM, whereas the async submission path rejects both with BorrowedError; apply the same borrow check used by other non-resolution operations before mutating the accumulator.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

Comment thread wasm/evm2/src/lib.rs
Comment on lines +307 to +313
op::START_BLOCK_STATE => match reader.finish() {
Ok(()) => start_block_state(),
Err(error) => abi_failure(error),
},
op::TAKE_BLOCK_STATE => match read_token(&mut reader) {
Ok(token) => take_block_state(token),
Err(error) => abi_failure(error),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the EVM borrow before block-state operations

On a synchronous EVM with an outstanding ExecutedTx, these dispatch arms bypass engine() and access the global block accumulator directly. Consequently, startBlockState can silently discard the active accumulator and takeBlockState can drain it while the transaction still exclusively borrows the EVM, whereas the async submission path rejects both with BorrowedError; apply the same borrow check used by other non-resolution operations.

AGENTS.md reference: AGENTS.md:L49-L49

Useful? React with 👍 / 👎.

@jxom jxom closed this Aug 10, 2026
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