I'm working on upgrading a Substrate-based standalone chain that was launched several years ago.

Recently, we made a transition from polkadot-v0.9.34 to polkadot-v0.9.35. After we did that, we are no longer able to run the synchronization process for new nodes with the existing chain in full mode. The node client fails with an error related to missing host function imports:

Error: Service(Client(VersionInvalid("Other error happened while constructing the runtime: runtime requires function imports which are not present on the host:

I did some research, and I found that the above functions were completely removed from the Substrate in PR #12852 and the sandboxing host function interface was deprecated.

I noticed, there is allow_missing_host_functions configuration variable in the Executor. If I set it to true, the error above disappears and node starts synchronization successfully. However, when it reaches some block in the history (where I guess the missing functions were applied), the synchronization fails with error:

2024-03-15 08:43:18 đź’” Error importing block 0x2ed7e6f52f7b61f2ff80f1a75346632d19f9b8e74058416c74cf23a4d53100e1: consensus error: Import failed: Import failed: Error at calling runtime api: Execution failed: Execution aborted due to trap: call to a missing function env:ext_sandbox_memory_new_version_1
WASM backtrace:
error while executing at wasm backtrace:
    0: 0x1c7476 - <unknown>!sp_io::sandbox::extern_host_function_impls::memory_new::hf909f2487304ad97
    1: 0x1bb241 - <unknown>!<pallet_contracts::wasm::WasmVm as pallet_contracts::exec::Vm<T>>::execute::hc83d43044fd5df3c
    2: 0xedbed - <unknown>!pallet_contracts::exec::ExecutionContext<T,V,L>::instantiate::h83b4ab02e4b21482
    3: 0xc8b37 - <unknown>!<node_runtime::Call as frame_support::traits::UnfilteredDispatchable>::dispatch_bypass_filter::h7a1f50faa398ce9b
    4: 0xd4100 - <unknown>!<node_runtime::Call as frame_support::traits::UnfilteredDispatchable>::dispatch_bypass_filter::h7a1f50faa398ce9b
    5: 0x141899 - <unknown>!frame_executive::Executive<System,Block,Context,UnsignedValidator,AllModules,COnRuntimeUpgrade>::apply_extrinsic_with_len::h33fc117f4f45f904
    6: 0x13c363 - <unknown>!Core_execute_block  

So, the question is, what is the proper way to fix the synchronization in full mode with the old chain using the node-client that is upgraded to polkadot-v0.9.35? As the mentioned sandboxing functions were removed from the substrate, how we should process old blocks now? It seems like the only way to fix that, is to add the mentioned functions back to our node by some sort of extension. But I'm not sure how doable it is without forking the whole Substrate repo. Our node is based on the substrate-node-template. How should we fix that?

1 Answer 1


You will have to manually add stubs to these host functions to your node iirc. We had to do this years ago on Edgeware in order to get things working after similar issues occurred.

Once you implement the missing host functions just add that to your executor setup. Likely these APIs have changed (this project is many years out of date/old) but the general approach likely remains the same.

To recap.

  1. Implement stubs for missing host functions.
  2. Add them to your node's executor.
  3. Run the node!

Resource links

  • Thank you, I tried to implement the stubs for the removed sandbox as you suggested and provided a nearly empty implementation for the mentioned functions. It helps to get rid of the first error (about missing imports). However, after the synchronization is started with --sync full, when the node reaches the block where the functions were applied, the process fails with the error Storage root must match that calculated., i.e. the empty stubs lead to an inconsistent state. I guess the only way to fix it is to provide the original implementation of the sandbox environment that was removed. Mar 20 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.