Skip to content

[CORRUPTED] Synthetic Benchmark PR #15923 - [bench] fix(runtime): charge contract-loading gas on Module::deserialize failure - #2

Open
amirzaushnizer wants to merge 3 commits into
base_pr_15923_20260621_7608from
corrupted_pr_15923_20260621_7608
Open

[CORRUPTED] Synthetic Benchmark PR #15923 - [bench] fix(runtime): charge contract-loading gas on Module::deserialize failure#2
amirzaushnizer wants to merge 3 commits into
base_pr_15923_20260621_7608from
corrupted_pr_15923_20260621_7608

Conversation

@amirzaushnizer

Copy link
Copy Markdown
Collaborator

Benchmark PR near#15923

Type: Corrupted (contains bugs)

Original PR Title: [bench] fix(runtime): charge contract-loading gas on Module::deserialize failure
Original PR Description: Reconstructed for skills benchmark from near#15923
Original PR URL: near#15923

ssavenko-near and others added 3 commits June 18, 2026 15:01
A Wasm module that breaches the Wasmtime pooling-allocator instance limits (e.g. ~100k globals) compiles and serializes fine but fails at `Module::deserialize`.
That failure short-circuits out as `VMRunnerError::LoadingError` before `before_loading_executable` runs, and `function_call.rs` maps it to a zero-gas nop — so the contract-loading work is performed but never charged.
The `FixContractLoadingCost`@129 charge point is downstream of the early return and does not cover this path, so the undercharge is protocol-independent.

Gate a fix behind the new `FixContractLoadingError` protocol feature - we may want to combine it with some other Protocol upgrades.
Carry the deserialize failure as a `FunctionCallError` (mirroring the adjacent memory-export check) so it flows through the loading-fee charge and finalizes as a gas-bearing abort instead of a nop.
Pre-feature behaviour is unchanged.

The flag lives only on the internal `vm::Config`, not on the public `VMConfigView`. wasmtime-only (the production VM).
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants