Skip to main content

Runtime Upgrade

How to propose a forkless runtime upgrade#

Step 1: Prepare WASM binary#

  • Clone node repo

  • Switch to the root directory of the cloned project

cd node

  • Build the Wasm bytecode

cargo build --release

Step 2: Submit a Preimage Hash of the Proposal for a forkless runtime upgrade#

  • Go to Democracy page https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fwestlake.datahighway.com#/democracy

  • The first step is to submit a preimage of the proposal. Click on Submit preimage

  • Choose system as call and setCode as function

  • Click the code input field, and select the Wasm binary that defines the upgraded runtime: target/release/wbuild/datahighway-runtime/datahighway_runtime.compact.wasm

  • Copy the preimage hash. This represents the proposal. You will use this hash when submitting the actual proposal.

  • Leave the value for the _weight parameter at the default of 0.

  • Click "Submit Transaction" and then "Sign and Submit".

Submit Preimage

Important If you forgot to copy the preimage hash, you can easily regenerate and copy it again by choosing the same extrinsic (it won't allow to submit it again but you can get preimage hash).

Step 3: Submit the Proposal#

  • Select the account from which you want to submit the proposal.

  • Enter the preimage hash related to the proposal.

  • Set the locked balance.

  • Click the Submit proposal button and sign the transaction

Submit Proposal

Step 4: Seconding the Proposal#

  • Select the account to second the proposal

  • Verify the number of tokens required to second the proposal and Click the "Second" button and sign the transaction

Second Proposal1

Second Proposal2

Second Proposal3

Important By seconding a proposal you will move it higher up the rank of proposals. The most seconded proposal โ€” in value, not number of supporters โ€” will be brought to a referendum every launch period. If nobody seconds a proposal, it would still reach to referendum.

Step 5: Voting on the Proposal#

  • The most seconded proposal moves to public referendum

  • Once in referendum, token holders vote "Aye" or "Nay" on the proposal by locking tokens. Two factors account the vote weight: amount locked (i.e. conviction) and locking period

  • If the proposal passes, it is enacted after a certain amount of time

Vote1

Vote2

Vote3

Important If referendum does not pass due to any reason (either nobody votes or more Nay and less Aye), you can re-submit proposal using same preimage hash.

Step 6: Dispatch#

  • After the voting period has expired, the proposal will be visible under the "Dispatch" tab if approved.

Dispatch

After the dispatch period has expired, Runtime_upgrade will start and you can see upgraded version on top left corner.

Runtime

Reference#

Important: If you want to test locally, you may need to modify the current runtime configuration of democracy module such as Launch Period, EnactmentPeriod and Voting Period.