SIGN IN SIGN UP

build(deps): bump wasm-instrument from 0.2.0 to 0.4.0

Bumps [wasm-instrument](https://github.com/paritytech/wasm-instrument)
from 0.2.0 to 0.4.0.

- [Changelog](https://github.com/paritytech/wasm-instrument/blob/master/CHANGELOG.md)
- [Commits](https://github.com/paritytech/wasm-instrument/compare/0.2.0...v0.4.0)

The new version switches the per-block gas counter and the
`memory.grow` charge helper from 32-bit to 64-bit arithmetic. Our call
sites were adjusted accordingly:

- `runtime/wasm/src/mapping.rs`: use the new `host_function::Injector`
  backend API for `gas_metering::inject`.
- `runtime/wasm/src/gas_rules.rs`: implement the new
  `call_per_local_cost()` method, returning 0 so locals initialization
  remains free.
- `runtime/wasm/src/module/instance.rs`: the injected `gas` host
  function now receives an `i64` cost argument instead of `i32`;
  update the Rust handler signature from `u32` to `u64`.

The 64-bit arithmetic in the grow-counter helper also fixes an
overflow that was previously under-charging gas for large
`memory.grow` calls. In 0.2.0 the helper multiplied the page count by
`gas_per_page` (~50.8M in our rules) using `I32Mul`, which wrapped
mod 2^32 for any grow larger than ~84 pages (~5.25 MiB). 0.4.0 extends
the page count to `i64` before the multiplication, so the full cost is
charged.

The two `yaml_parsing_v0_0_*` tests in `runtime/test/src/test.rs`
pin exact `gas_used` totals. The YAML input
`"x".repeat(10_000_001)` causes three large grow events, so each test
reports exactly `3 * 2^32 = 12,884,901,888` more gas than before.
Update the expected values to match the now-correct totals.

Note for downstream: this is a semantic change in gas accounting for
subgraph handlers that grow memory past ~5.25 MiB in a single call.
Such handlers will consume more gas than they did on 0.2.0; this may
warrant a release note or API-version gating, which is out of scope
for this dependency bump.

Signed-off-by: dependabot[bot] <support@github.com>
D
dependabot[bot] committed
e241e50bfe70c081334772d76d3b4fec6349672d
Parent: de95257
Committed by David Lutterkort <lutter@watzmann.net> on 4/29/2026, 12:55:23 PM