Commit d6725e9
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](paritytech/wasm-instrument@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>1 parent 545cd70 commit d6725e9
6 files changed
Lines changed: 16 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1844 | 1844 | | |
1845 | 1845 | | |
1846 | 1846 | | |
1847 | | - | |
| 1847 | + | |
1848 | 1848 | | |
1849 | 1849 | | |
1850 | 1850 | | |
1851 | 1851 | | |
1852 | | - | |
| 1852 | + | |
1853 | 1853 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
168 | 172 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
306 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
| 579 | + | |
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
587 | | - | |
| 587 | + | |
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
| |||
0 commit comments