Skip to content

Add transaction_index::HostFunctions with NO-OP impl to the polkadot-prepare/execute-worker#10370

Closed
bkontur wants to merge 24 commits intomasterfrom
bko-bulletin-para-support
Closed

Add transaction_index::HostFunctions with NO-OP impl to the polkadot-prepare/execute-worker#10370
bkontur wants to merge 24 commits intomasterfrom
bko-bulletin-para-support

Conversation

@bkontur
Copy link
Copy Markdown
Contributor

@bkontur bkontur commented Nov 20, 2025

Relates to: paritytech/polkadot-bulletin-chain#74
Similar issue for smoldot: paritytech/smoldot-archive#2182

Context

The pallet-transaction-storage pallet and its store function uses transaction index HostFunctions, e.g. sp_io::transaction_index::index(extrinsic_index, data.len() as u32, content_hash);. All our binaries (polkadot, polkadot-parachain, polkadot-omni-node) support these HostFunctions via sp_io::SubstrateHostFunctions.

Problem

When using this pallet within a parachain, the problem arises during parachain validation on the relay chain. The polkadot-execute / prepare-worker environment does not include these HostFunctions — resulting in the error shown below.

2025-11-19 09:51:12.068  WARN tokio-runtime-worker parachain::pvf: execution worker concluded, error occurred: candidate validation: invalid: worker reported: execute: Execution aborted due to trap: call
 to a missing function env:ext_transaction_index_index_version_1
WASM backtrace:
error while executing at wasm backtrace:
    0: 0x5f8de0 - bulletin_westend_runtime.wasm!sp_io::transaction_index::extern_host_function_impls::index::h35478cdbc56a306c
    1: 0x6bb403 - bulletin_westend_runtime.wasm!<wasm function 8748>
    2: 0x413640 - bulletin_westend_runtime.wasm!frame_support::storage::transactional::with_transaction::h79ce9a055b33819e
    3: 0x90389 - bulletin_westend_runtime.wasm!<pallet_transaction_storage::pallet::Call<T> as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter::{{closure}}::h9dddca92896e
d49d
    4: 0x9ed1b - bulletin_westend_runtime.wasm!environmental::local_key::LocalKey<T>::with::h7e22e1a435c399fc
    5: 0x51407a - bulletin_westend_runtime.wasm!<bulletin_westend_runtime::RuntimeCall as frame_support::traits::dispatch::UnfilteredDispatchable>::dispatch_bypass_filter::h691bb264c7871775
    6: 0x5129d7 - bulletin_westend_runtime.wasm!<bulletin_westend_runtime::RuntimeCall as sp_runtime::traits::Dispatchable>::dispatch::h4935ba6fe14584db
    7: 0x35eed5 - bulletin_westend_runtime.wasm!<T as sp_runtime::traits::transaction_extension::dispatch_transaction::DispatchTransaction<Call>>::dispatch_transaction::h4c377a6a3677b5ef
    8: 0x3ce879 - bulletin_westend_runtime.wasm!<sp_runtime::generic::checked_extrinsic::CheckedExtrinsic<AccountId,Call,Extension> as sp_runtime::traits::Applyable>::apply::h92f77e6a58d26237
    9: 0x4a0135 - bulletin_westend_runtime.wasm!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::do_apply_extrinsic::had25d7fd331d0474
   10: 0x49ed31 - bulletin_westend_runtime.wasm!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllPalletsWithSystem,COnRuntimeUpgrade>::execute_block::hdb1b331a7c0334be
   11: 0x4e7237 - bulletin_westend_runtime.wasm!<cumulus_pallet_aura_ext::BlockExecutor<T,I> as frame_support::traits::misc::ExecuteBlock<Block>>::execute_block::h3c1578a9fc377780
   12: 0xa0f0d - bulletin_westend_runtime.wasm!environmental::local_key::LocalKey<T>::with::hac4bfb5192978ed0
   13: 0xde8b2 - bulletin_westend_runtime.wasm!cumulus_pallet_parachain_system::validate_block::implementation::validate_block::hc6a4c2b1a877fa32
   14: 0x446339 - bulletin_westend_runtime.wasm!validate_block
   15: 0x6b70cb - bulletin_westend_runtime.wasm!<wasm function 8248> artifact_id=ArtifactId { code_hash: 0x41ef24a292f50152812d6b39ce316a1a4bb71648c9bfba970c05b2c04038f0c7, executor_params_prep_hash: 0x5
0b16a713c0f8774ba3a0757c722b48c6eb4c1972f6e58c54fd0851f21a08633 } worker=Worker(1v1) worker_rip=false

Solution

This PR adds sp_io::transaction_index::HostFunctions as a no-op to the cumulus-pallet-parachain-system's validate_block.

@bkontur
Copy link
Copy Markdown
Contributor Author

bkontur commented Nov 20, 2025

/cmd prdoc --audience runtime_dev node_dev --bump patch

@bkontur bkontur added T0-node This PR/Issue is related to the topic “node”. T14-system_parachains This PR/Issue is related to system parachains. labels Nov 20, 2025
Copy link
Copy Markdown
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proper way of doing this is that you override these host functions in validate_block/implementation.rs as done for the other host functions.

@bkontur
Copy link
Copy Markdown
Contributor Author

bkontur commented Nov 24, 2025

The proper way of doing this is that you override these host functions in validate_block/implementation.rs as done for the other host functions.

@bkchr Ooooh, nice :) I had previously just followed the log error, and this is really better since it’s part of the runtime and not the binary. Thank you — tested and working :)

@bkontur bkontur requested a review from bkchr November 24, 2025 23:38
@bkontur
Copy link
Copy Markdown
Contributor Author

bkontur commented Nov 25, 2025

aaah, "check compatibility" now hits the chopsticks issue: https://github.com/paritytech/polkadot-sdk/actions/runs/19652937174/job/56283788628#step:6:29, which is a smol-dot issue: paritytech/smoldot-archive#2182,
which is fixed and ready to be merged: paritytech/smoldot-archive#2189

cc: @tomaka please, please

sp_io::offchain_index::host_clear.replace_implementation(host_offchain_index_clear),
cumulus_primitives_proof_size_hostfunction::storage_proof_size::host_storage_proof_size
.replace_implementation(host_storage_proof_size),
sp_io::transaction_index::host_index.replace_implementation(host_transaction_index_index),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please put this behind a feature. Otherwise all parachain nodes will require these host functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please put this behind a feature. Otherwise all parachain nodes will require these host functions.

Thank you, good point, fixed: 0f4c666

@bkontur bkontur requested a review from bkchr November 27, 2025 14:50
@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/19739906850
Failed job name: test-linux-stable-int

@bkontur bkontur added the A4-backport-stable2512 Pull request must be backported to the stable2512 release branch label Dec 3, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 24, 2025
Relates to:
paritytech/polkadot-bulletin-chain#74

This PR adds the required support and features for running Bulletin as a
parachain. It is a top-level PR that merges three partial features/PRs,
which can also be reviewed/merged separately:

1. Add `transaction_index::HostFunctions` with NO-OP impl to the cumulus
ParachainSystem `validate_block` for polkadot-prepare/execute-worker -
#10370
2. Add custom inherent provider for pallet-transaction-storage to omni
node - #10494
3. Configurable StoragePeriod feeded to the inherent provider over
runtime API - #10656

---------

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
Co-authored-by: EgorPopelyaev <egor@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Bastian Köcher <info@kchr.de>
@bkontur
Copy link
Copy Markdown
Contributor Author

bkontur commented Dec 28, 2025

merged as a part of #10662

@bkontur bkontur closed this Dec 28, 2025
@bkontur bkontur deleted the bko-bulletin-para-support branch December 28, 2025 09:31
sigurpol pushed a commit that referenced this pull request Dec 29, 2025
Relates to:
paritytech/polkadot-bulletin-chain#74

This PR adds the required support and features for running Bulletin as a
parachain. It is a top-level PR that merges three partial features/PRs,
which can also be reviewed/merged separately:

1. Add `transaction_index::HostFunctions` with NO-OP impl to the cumulus
ParachainSystem `validate_block` for polkadot-prepare/execute-worker -
#10370
2. Add custom inherent provider for pallet-transaction-storage to omni
node - #10494
3. Configurable StoragePeriod feeded to the inherent provider over
runtime API - #10656

---------

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
Co-authored-by: EgorPopelyaev <egor@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Bastian Köcher <info@kchr.de>
sigurpol pushed a commit that referenced this pull request Dec 30, 2025
Relates to:
paritytech/polkadot-bulletin-chain#74

This PR adds the required support and features for running Bulletin as a
parachain. It is a top-level PR that merges three partial features/PRs,
which can also be reviewed/merged separately:

1. Add `transaction_index::HostFunctions` with NO-OP impl to the cumulus
ParachainSystem `validate_block` for polkadot-prepare/execute-worker -
#10370
2. Add custom inherent provider for pallet-transaction-storage to omni
node - #10494
3. Configurable StoragePeriod feeded to the inherent provider over
runtime API - #10656

---------

Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Iulian Barbu <iulian.barbu@parity.io>
Co-authored-by: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
Co-authored-by: EgorPopelyaev <egor@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Bastian Köcher <info@kchr.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A4-backport-stable2512 Pull request must be backported to the stable2512 release branch T0-node This PR/Issue is related to the topic “node”. T14-system_parachains This PR/Issue is related to system parachains.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants