-
Notifications
You must be signed in to change notification settings - Fork 9
How to Upgrade Substrate
First step is to get the original Substrate code we started modifying. (The version you have currently in the qdao-node)
cd ~/work/paritytech/
git clone git@github.com:paritytech/substrate.git
cd substrate
git checkout polkadot-v0.9.30
- Edit
rustfmt.toml
- Change
hard_tabs
tofalse
- Change
cargo +nightly fmt --all
Now you got the code we copied into qdao-node. Say you got your QRUCIAL-DAO repository cloned at ~/work/Qrucial/
, now you copy over your client code:
rm -rf ~/work/Qrucial/QRUCIAL-DAO/qdao-node/{client,runtime,audit-pallet,exo-pallet}/*
cp -r bin/node-template/node/* ~/work/Qrucial/QRUCIAL-DAO/qdao-node/client/
cp -r bin/node-template/runtime/* ~/work/Qrucial/QRUCIAL-DAO/qdao-node/runtime/
cp -r bin/node-template/pallets/template/* ~/work/Qrucial/QRUCIAL-DAO/qdao-node/audit-pallet/
cp -r bin/node-template/pallets/template/* ~/work/Qrucial/QRUCIAL-DAO/qdao-node/exo-pallet/
Now you have a diff in the QRUCIAL-DAO repo that you can commit on a new temporary branch (say, call it update-to-substrate-0.9.37
).
cd ~/work/Qrucial/QRUCIAL-DAO/
git checkout -b update-to-substrate-0.9.37
git add .; git commit -m "Reverting to original 0.9.30 code"
Now you need to create a diff between Substrate 0.9.30 and 0.9.37 in the substrate repo:
cd ~/work/paritytech/
git restore .
git checkout polkadot-v0.9.37
- Edit
rustfmt.toml
- Change
hard_tabs
tofalse
- Change
cargo +nightly fmt --all
Create the diff between 0.9.30 and 0.9.37 in the QRUCIAL-DAO repo:
rm -rf ~/work/Qrucial/QRUCIAL-DAO/qdao-node/{client,runtime,audit-pallet,exo-pallet}/*
cp -r bin/node-template/node/* ~/work/Qrucial/QRUCIAL-DAO/qdao-node/client/
cp -r bin/node-template/runtime/* ~/work/Qrucial/QRUCIAL-DAO/qdao-node/runtime/
cp -r bin/node-template/pallets/template/* ~/work/Qrucial/QRUCIAL-DAO/qdao-node/audit-pallet/
cp -r bin/node-template/pallets/template/* ~/work/Qrucial/QRUCIAL-DAO/qdao-node/exo-pallet/
Make a commit with the diff in the QRUCIAL-DAO repo:
cd ~/work/Qrucial/QRUCIAL-DAO/
git add .; git commit -m "Upgrade from 0.9.30 to 0.9.37"
Finally we cherry-pick this last commit onto the currect codebase of the QRUCIAL-DAO repo:
git checkout milestone2
git cherry-pick update-to-substrate-0.9.37
Obviously you will get conflicts. You need to resolve them, a 3-way merge tool is preferred for that. After all of that, you will need to add the resolved files to the staging and finish the cherry-pick:
- Resolve conflicts
- This is where you need to use your brain a lot.
- Let me share a secret here: We started off using the
node-template
runtime from Substrate (crate name isnode-template-runtime
), but there are a few lines related toweight_v2
that are taken from thenode
runtime (crate name iskitchensink-runtime
). Sorry, taking over and adjusting those lines is a manual step. - Take your time, try to compile and run the tests locally when you think you are ready!
git add .
git cherry-pick --continue
Now you got milestone2
upgraded from 0.9.30 to 0.9.37
by QDAO