3

I got a problem with upgrading my chain

I've upgraded my chain from version A (Client+runtime) to version B (Client+runtime). I remove some host functions in client version B because runtime version B don't need that anymore.

The upgrade proceeds as follows:

  1. I upgrade the runtime first and there is no problem. The chain continues to function.
  2. I upgrade the client later and the problem happened.

I have 4 nodes: 3 validator nodes and 1 public RPC node. After upgrading the client, 3 validators still function normally. Blocks are still being produced. However, it's RPC node the problem.

The RPC node runs with this message in the log Cannot create a runtime error=Other(\"runtime requires function imports which are not present on the host: (the list of host functions I already removed). After some time, the RPC node stops to receive external websocket connections, and after some time, it automatically restarts. And the loop continues. the RPC node still able to import blocks from the network while it's running.

I upgrade the substrate version from polkadot-v0.9.18 to polkadot-v0.9.22. And it's a solochain only.

1 Answer 1

3

After you have once introduced a host function that was used by any runtime, you can not remove it. For future blocks that are using the new runtime, this isn't a problem, because as you already said you will not use the host functions anymore. However, for all nodes that want to sync from genesis or that need to answer runtime api requests of older blocks (like a RPC node), they still need the old host functions.

1
  • Tks for the info @bkchr. As I understand, while syncing (replaying), old host functions are still needed if there exists transactions using the old host functions in the past. . But if there are no transactions using that old host functions from the beginning, we can remove it right?
    – Daniel Lam
    Jun 10, 2022 at 2:51

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.