Skip to content

Register storage-proof-size host function - #146

Merged
rockbmb merged 3 commits into
mainfrom
register-proof-size-hostfunction
Aug 10, 2026
Merged

Register storage-proof-size host function#146
rockbmb merged 3 commits into
mainfrom
register-proof-size-hostfunction

Conversation

@rockbmb

@rockbmb rockbmb commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

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.

The CLI registered only sp_io::SubstrateHostFunctions. Runtimes that
use cumulus-pallet-weight-reclaim call the storage_proof_size host
function during extrinsic dispatch. With execute-block or follow-chain,
any block that contains a signed extrinsic then fails with:

  Execution aborted due to trap: call to a missing function
  env:ext_storage_proof_size_storage_proof_size_version_1

All current system-chain runtimes (polkadot-sdk and fellowship) use
that pallet, so the two commands were unusable against them.

Fix: register the cumulus proof-size host function next to the
substrate ones. It returns u64::MAX when no proof recording is active,
which weight-reclaim treats as disabled - correct for try-runtime use.
@rockbmb rockbmb self-assigned this Aug 10, 2026
@rockbmb rockbmb added bug Something isn't working rust Pull requests that update rust code labels Aug 10, 2026
@rockbmb
rockbmb merged commit 6e1c4e9 into main Aug 10, 2026
7 checks passed
@rockbmb
rockbmb deleted the register-proof-size-hostfunction branch August 10, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant