Commit 6e1c4e9
authored
Register storage-proof-size host function (#146)
## Problem
`execute-block` and `follow-chain` fail on blocks that contain signed
extrinsics, for any runtime that uses `cumulus-pallet-weight-reclaim`:
```
Execution aborted due to trap: call to a missing function
env:ext_storage_proof_size_storage_proof_size_version_1
```
The CLI registers only `sp_io::SubstrateHostFunctions`. The
weight-reclaim transaction extension calls the cumulus
`storage_proof_size` host function on every signed extrinsic. The
executor cannot resolve it, so block execution traps.
All current system-chain runtimes use this pallet (checked: 9 runtimes
in polkadot-sdk, 11 in runtimes). The two commands are therefore
unusable against modern parachains.
## Fix
Register
`cumulus_primitives_proof_size_hostfunction::storage_proof_size::HostFunctions`
next to the substrate host functions. One line in `cli/main.rs`, plus
the dependency.
When no proof recording is active, the host function returns `u64::MAX`.
Weight-reclaim treats that as "recording disabled" and skips reclaim.
This is the correct behavior for try-runtime execution.
## Validation
Controlled A/B on a local `asset-hub-westend` dev chain (omni-node,
runtime with `try-runtime` feature):
| Binary | Block content | Result |
|---|---|---|
| unpatched | only inherents (block 486) | executes |
| unpatched | one signed `Balances::transfer_keep_alive` (block 487) |
trap: missing function |
| patched | same block 487 | `Block #487 successfully executed` |
The empty-block success explains why the bug can go unnoticed: it only
appears when a block carries a signed extrinsic.
Also verified against ~500 blocks with `follow-chain --try-state Proxy`
on the same chain: no traps, try-state hooks run per block.1 parent 31453aa commit 6e1c4e9
4 files changed
Lines changed: 14 additions & 3 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 | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
364 | | - | |
365 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
366 | 374 | | |
0 commit comments