diff --git a/docs/operations/test-runtime-upgrades.md b/docs/operations/test-runtime-upgrades.md index 7f8b308831..90999b752b 100644 --- a/docs/operations/test-runtime-upgrades.md +++ b/docs/operations/test-runtime-upgrades.md @@ -53,7 +53,22 @@ $ b2sum -l 256 preimage.bin | awk '{print "0x"$1}' $ export PREIMAGE_HASH=0x15165c85152568b7f523e374ce1a5172f2aa148721d5dae0441f86c201c1a77b4 ``` -6. Create a chopsticks configuration file for the Polkadot relay chain, substituting the values generated previously: +6. Prepend compact-encoded length prefix to preimage, and convert back to hex, save as PREIMAGE\_WITH\_LENGTH\_PREFIX: + +```rust +use codec::Encode; +use std::fs::File; + +fn main() { + let mut file = File::open("preimage.bin")?; + let mut buf: Vec = Vec::new(); + file.read_to_end(&mut buf)?; + let bytes_encoded = buf.encode(); + println!("0x{}", hex::encode(bytes_encoded)); +} +``` + +7. Create a chopsticks configuration file for the Polkadot relay chain, substituting the values generated previously: `polkadot.yml` @@ -81,7 +96,7 @@ import-storage: } ``` -7. Use these Chopstics config files for AssetHub and BridgeHub +8. Use these Chopstics config files for AssetHub and BridgeHub `polkadot-asset-hub.yml` @@ -117,7 +132,7 @@ import-storage: free: 1000000000000000 ``` -8. Run Chopsticks +9. Run Chopsticks ```sh yarn start xcm -r polkadot.yml -p polkadot-asset-hub.yml -p polkadot-bridge-hub.yml @@ -125,7 +140,7 @@ yarn start xcm -r polkadot.yml -p polkadot-asset-hub.yml -p polkadot-bridge-hub. A verification step that can be performed to see if the preimage has been added successfully is to check the `preimage` storage in the chain state. The authorized preimage should be in the list of added preimages. -9. Execute the upgrade on the relay chain using Polkadot-JS: +10. Execute the upgrade on the relay chain using Polkadot-JS: ```rust const number = (await api.rpc.chain.getHeader()).number.toNumber() @@ -156,29 +171,29 @@ await api.rpc('dev_setStorage', { await api.rpc('dev_newBlock', { count: 1 }) ``` -10. Advance a few blocks on the relay chain +11. Advance a few blocks on the relay chain ```rust await api.rpc('dev_newBlock', { count: 2 }) ``` -11. Advance by one block on bridgehub (not sure if necessary, need to experiment) +12. Advance by one block on bridgehub (not sure if necessary, need to experiment) ```rust await api.rpc('dev_newBlock', { count: 1 }) ``` -12. Now that the upgrade has been authorized on BridgeHub, we can execute the upgrade by calling parachainSystem.enactAuthorizedUpgrade, passing the parachain WASM blob previously generated by opengov-cli: +13. Now that the upgrade has been authorized on BridgeHub, we can execute the upgrade by calling parachainSystem.enactAuthorizedUpgrade, passing the parachain WASM blob previously generated by opengov-cli:
-12. Advance a few blocks on both bridgehub AND the relay chain +14. Advance a few blocks on both bridgehub AND the relay chain ```rust await api.rpc('dev_newBlock', { count: 1 }) ``` -14. The parachain should now be upgraded. +15. The parachain should now be upgraded. ## Caveats