1

Our goal is to migrate code to the newer substrate version and keep the block history. My old running node substrate version is tag = 'monthly-2021-09+1' -> New substrate version is branch = "polkadot-v0.9.19" So for this updated the entire code as per the requrement of branch = "polkadot-v0.9.19". In local it is working fine, on upgrade on local new instance there is no issue.

But when I have tried to upgrade the running runtime, node with (tag = 'monthly-2021-09+1' ) following command System->setcode, Got the event Sudo -> DispatchResult -> Ok. But when I have checked the log following error are present.

**Unknown error: Client(Application(VersionInvalid("RuntimeConstruction(Other(\"host doesn't provide such function: env:ext_storage_root_version_2\"))"))) 
   

2022-05-12 08:08:40 💤 Idle (2 peers), best: #447165 (0x0432…f858), finalized #419084 (0x8e60…80d9), ⬇ 293.4kiB/s ⬆ 0.1kiB/s    
2022-05-12 08:08:40 Unsupported Offchain Worker API version: (Err(Application(VersionInvalid("RuntimeConstruction(Other(\"host doesn't provide such function: env:ext_storage_root_version_2\"))"))), Err(Application(VersionInvalid("RuntimeConstruction(Other(\"host doesn't provide such function: env:ext_storage_root_version_2\"))")))). Consider turning off offchain workers if they are not part of your runtime..**   

Got the above error in log, and the node are not producing the blocks.
Can anyone tell me what is the difference in upgrade, what mistake I have done.

Or After changing the version of substrate need to upgarde in a different way?.

2
  • I get the same error when trying to upgrade a Frontier-based chain from Sep2021 release to May2022 release using this tutorial
    – afm
    May 31, 2022 at 22:28
  • My error is this can_author_with returned: Failed to get runtime version at BlockId::Hash(0x...) and will disable authoring. Error: VersionInvalid("RuntimeConstruction(Other(\"host doesn't provide such function: env:ext_storage_root_version_2\"))")
    – afm
    May 31, 2022 at 22:32

2 Answers 2

2

If there are changes not only to the runtime but also to the node, then this issue is normally caused by upgrading the runtime before upgrading the client.

Try upgrading the client, then the runtime.

4

This error is thrown because there were changes not only to the runtime, but to the "host" (everything but the runtime) as well. When you submit the upgrade transaction, it only affects the runtime, but not the rest of the node. It looks like the runtime is trying to call a function that is new, and the host doesn't have it.

The way I was able to do it is the following:

  • Build your new node (runtime + host) in a separate place
  • Get the WASM blob and submit it to the current chain. It will "brick", showing the error you got before
  • Stop the chain and replace the binary file of the current chain with the new binary file from the new build
  • Re-start the chain, pointing to the same --base_path <PATH> as before.

It should work, since the new runtime is now on storage.

edit: I also found the same solution from the KILT protocol team, as you can see here in the last session "Update All of the Node"

5
  • Only I have to update the new binary with old chain-specs file will it work ?
    – Asmita
    Jun 3, 2022 at 13:53
  • After submitting the upgrade tx, try to simply run the same command you used to start the network the first time, only change the binary.
    – afm
    Jun 3, 2022 at 14:12
  • Thanku, I will follow the same.
    – Asmita
    Jun 3, 2022 at 18:37
  • @Asmita if that worked for you please accept it as the correct answer :-)
    – afm
    Jun 9, 2022 at 21:30
  • This answer worked for me, Thank you for your help.
    – Asmita
    Jun 29, 2022 at 12:49

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.