Exercise 08

Objectives: code-substitute, chainspec file

Needs: Exercise 03, Exercise 05

Content: Here we are going to meet the first emergency mechanism: code-substitute.

Familiarize yourself with: https://www.notion.so/cardinalcryptography/Recovery-code_substitute (you don't need to study the Experiments section).

We will perform two runtime changes:

  1. Start a local chain from the main branch (without any of our previous changes). Pass --execution Wasm flag, so that the nodes use the on-chain blob right away instead of the native runtime. (We need it, because the code-substitute mechanism overrides only the on-chain code - otherwise we would have to make artificial runtime update just to give up native runtime).

  2. Build a new runtime wasm blob introducing pallet banishment from Exercise 03. Don't bump spec_version!

  3. Prepare a new chainspec with the new runtime as code-substitute. You can use scripts/set_code_substitute.py tool.

  4. Restart nodes with the new chainspec (you can use run_node.sh script, with BOOTSTRAP=false). Confirm, that the chain is moving forward from the point it was stopped. Confirm, that the new pallet has been added.

  5. Build another runtime introducing changes to pallet banishment from Exercise 05. Don't forget to bump spec_version to be higher than the one from code-substitute.

  6. Perform a proper runtime update.

  7. Confirm that the new changes have been introduced, thus cancelling the substitution from chainspec.

In this exercise, we used a code-substitute mechanism for an update, that normally should have been performed in a proper way (cliain or UI). This mechanism is dedicated to emergencies.

References:

Last updated

Was this helpful?