Register storage-proof-size host function - #146
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
execute-blockandfollow-chainfail on blocks that contain signed extrinsics, for any runtime that usescumulus-pallet-weight-reclaim:The CLI registers only
sp_io::SubstrateHostFunctions. The weight-reclaim transaction extension calls the cumulusstorage_proof_sizehost 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::HostFunctionsnext to the substrate host functions. One line incli/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-westenddev chain (omni-node, runtime withtry-runtimefeature):Balances::transfer_keep_alive(block 487)Block #487 successfully executedThe 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 Proxyon the same chain: no traps, try-state hooks run per block.