# Install opengov-cli
```shell
cargo install --locked --force --git https://github.com/joepetrowski/opengov-cli opengov-cli
```
Note: even if you already have opengov-cli installed you'll likely need to update as the chains are upgraded
## Update stablecoin swap pure proxy on Hydration
We need to include a call that makes the Asset Hub sovereign account on Hydration a proxy of the pure proxy we use for stablecoin swaps there. Currently, the Relay Chain sovereign account is set as a proxy of that pure proxy, and the scheduler triggers the swap calls from the Relay Chain. After migration, the scheduler will trigger them from Asset Hub instead. That’s why this step is required.
AH sov account: https://hydration.subscan.io/account/5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV
Pure proxy account: https://hydration.subscan.io/account/7N4oFqXKgeTXo6CMSY9BVZdHP5J3RhQXY77Fe7qmQwjcxa1w
Ref to verify pure proxy: https://polkadot.subsquare.io/referenda/1501
Hydration call we need to execute:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fhydration-rpc.n.dwellir.com#/extrinsics/decode/0x1d00c5b7975df05c06a272ddc9d80cefafbe02d27c4303c04a8fc07df98000b48ab801001d017369626ce80300000000000000000000000000000000000000000000000000000000000000
Need to form an XCM for this:
0x630004000100c91f041400040100000700e40b5402130100000700e40b540200060102286bee823801002d011d00c5b7975df05c06a272ddc9d80cefafbe02d27c4303c04a8fc07df98000b48ab801001d017369626ce80300000000000000000000000000000000000000000000000000000000000000140d01020400010100506172656e740000000000000000000000000000000000000000000000000000
Chopsticks this
```
npx @acala-network/chopsticks@latest xcm -r polkadot -p polkadot-asset-hub -p hydradx
```
Note the call as a preimage:
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8002#/extrinsics/decode/0x0a008102630004000100c91f041400040100000700e40b5402130100000700e40b540200060102286bee823801002d011d00c5b7975df05c06a272ddc9d80cefafbe02d27c4303c04a8fc07df98000b48ab801001d017369626ce80300000000000000000000000000000000000000000000000000000000000000140d01020400010100506172656e740000000000000000000000000000000000000000000000000000
Dispatch this from root origin in the [relay js window](https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8002#/js):
```
const number = (await api.rpc.chain.getHeader()).number.toNumber()
await api.rpc('dev_setStorage', {
scheduler: {
agenda: [
[
[number + 1], [
{
call: {
Lookup: {
hash: '0xcd97bab37742a04e7e69d4bd939c047b70a40aac708af8b8eb62fe901d10acaf',
len: 160
}
},
origin: {
system: 'Root'
}
}
]
]
]
}
})
// Make a block to include the extrinsic
await api.rpc('dev_newBlock', { count: 1 })
```

All good.
## add invulnerables
we want to add invulnerables to shift the ratio of invuln to permissionless for censorship resistance
0x2802101505ccf25037c2f6847236f22ee081e854b12501f3802dd0bf9e220ba10b56481b6215059890fd3e365f6954b5bcab3c8195024da5188beaafb1b13d954c0281647ba53515051e503909a89514337bf9ce931876a08003396a9def52f867e123cf1420a0f70b1505a471c55caca4be7b4e60c6e94b20f9028883f8c64287d4454130c657383c3442

needs to be wrapped in an XCM transact from the relay to AH
0x630005000100a10f05082f00000602002d022802101505ccf25037c2f6847236f22ee081e854b12501f3802dd0bf9e220ba10b56481b6215059890fd3e365f6954b5bcab3c8195024da5188beaafb1b13d954c0281647ba53515051e503909a89514337bf9ce931876a08003396a9def52f867e123cf1420a0f70b1505a471c55caca4be7b4e60c6e94b20f9028883f8c64287d4454130c657383c3442
Chopsticks this
```
npx @acala-network/chopsticks@latest xcm -r polkadot -p polkadot-asset-hub
```
Note the call as a preimage:
0x0a007502630005000100a10f05082f00000602002d022802101505ccf25037c2f6847236f22ee081e854b12501f3802dd0bf9e220ba10b56481b6215059890fd3e365f6954b5bcab3c8195024da5188beaafb1b13d954c0281647ba53515051e503909a89514337bf9ce931876a08003396a9def52f867e123cf1420a0f70b1505a471c55caca4be7b4e60c6e94b20f9028883f8c64287d4454130c657383c3442
Dispatch this from root origin in the [relay js window](https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8001#/js):
```
const number = (await api.rpc.chain.getHeader()).number.toNumber()
await api.rpc('dev_setStorage', {
scheduler: {
agenda: [
[
[number + 1], [
{
call: {
Lookup: {
hash: '0x742deb639264680f16bca4e0a8b15577007174784d90dc9ba6ceb86afd40df73',
len: 157
}
},
origin: {
system: 'Root'
}
}
]
]
]
}
})
// Make a block to include the extrinsic
await api.rpc('dev_newBlock', { count: 1 })
```

All good.
## Combine both calls in a batch to add as additional
0x1a0208630005000100a10f05082f00000602002d022802101505ccf25037c2f6847236f22ee081e854b12501f3802dd0bf9e220ba10b56481b6215059890fd3e365f6954b5bcab3c8195024da5188beaafb1b13d954c0281647ba53515051e503909a89514337bf9ce931876a08003396a9def52f867e123cf1420a0f70b1505a471c55caca4be7b4e60c6e94b20f9028883f8c64287d4454130c657383c3442630004000100c91f041400040100000700e40b5402130100000700e40b540200060102286bee823801002d011d00c5b7975df05c06a272ddc9d80cefafbe02d27c4303c04a8fc07df98000b48ab801001d017369626ce80300000000000000000000000000000000000000000000000000000000000000140d01020400010100506172656e740000000000000000000000000000000000000000000000000000
## Create ref
### Build upgrade
```shell
❯ opengov-cli build-upgrade --network polkadot --relay-version v2.0.0 --additional 0x1a0208630005000100a10f05082f00000602002d022802101505ccf25037c2f6847236f22ee081e854b12501f3802dd0bf9e220ba10b56481b6215059890fd3e365f6954b5bcab3c8195024da5188beaafb1b13d954c0281647ba53515051e503909a89514337bf9ce931876a08003396a9def52f867e123cf1420a0f70b1505a471c55caca4be7b4e60c6e94b20f9028883f8c64287d4454130c657383c3442630004000100c91f041400040100000700e40b5402130100000700e40b540200060102286bee823801002d011d00c5b7975df05c06a272ddc9d80cefafbe02d27c4303c04a8fc07df98000b48ab801001d017369626ce80300000000000000000000000000000000000000000000000000000000000000140d01020400010100506172656e740000000000000000000000000000000000000000000000000000
```
Using local WASM files from ./upgrade-polkadot-2.0.0/
Generating parachain authorization calls. The runtime hashes are logged if you would like to verify them with srtool.
Polkadot Relay Chain Runtime Hash: 0x625e4190035e51bfaa349c61bc198ed4103658fb4bd5f6716015a4a7f0412bdd
Polkadot Asset Hub Runtime Hash: 0x274e1781dc36a23a922f9ec1e04afe0496a503612c4d57aa4fa0c8bf55b1237a
Polkadot Collectives Runtime Hash: 0x1553beb31f381fff842f1d9272c384c34d2be7abf289b482a54a1054d5f75acc
Polkadot Bridge Hub Runtime Hash: 0x2428a28a8215b4c4cea2f15e7d97521c3e812ffbb378cf058c696b3320efd3f0
Polkadot People Runtime Hash: 0x19d152fef983bf5be332cd07dc6f5c7291d842a4e2d5501eca02a86c10df211d
Polkadot Coretime Runtime Hash: 0xf5833bad367d7164d2d654cc607692fe441988e3104a353b59f11206e5665d25
Batching calls.
Success! The call data was written to ./upgrade-polkadot-2.0.0/polkadot-2.0.0.call
To submit this as a referendum in OpenGov, run:
opengov-cli submit-referendum \
--proposal "./upgrade-polkadot-2.0.0/polkadot-2.0.0.call" \
--network "polkadot" --track <"root" or "whitelistedcaller">
### Generate referendum calls
ref to pass on morning of Monday 3rd November
[28476212](https://polkadot.subscan.io/block/28476212)
```
❯ opengov-cli submit-referendum \
--proposal "./upgrade-polkadot-2.0.0/polkadot-2.0.0.call" \
--network "polkadot" --track "whitelistedcaller" --at 28476212
```
Submit the preimage for the Fellowship referendum:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-collectives-rpc.polkadot.io#/extrinsics/decode/0x2b00d41f0004010004082f00000603c2c9007a216f881700c86fe2dd80e43c2a19e05046c718ecc4910cf38674734c30b2c5025d90a429ce
Open a Fellowship referendum to whitelist the call:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-collectives-rpc.polkadot.io#/extrinsics/decode/0x3d003e020273201ae7b18aa482460bb392b32f393e2e25a11b943b429384849f182c9e03b635000000010a000000
Submit the preimage for the public referendum:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-rpc.dwellir.com#/extrinsics/decode/0x0a00990917031a041c0009625e4190035e51bfaa349c61bc198ed4103658fb4bd5f6716015a4a7f0412bdd630005000100a10f05082f0000060200880009274e1781dc36a23a922f9ec1e04afe0496a503612c4d57aa4fa0c8bf55b1237a630005000100a50f05082f00000602008800091553beb31f381fff842f1d9272c384c34d2be7abf289b482a54a1054d5f75acc630005000100a90f05082f00000602008800092428a28a8215b4c4cea2f15e7d97521c3e812ffbb378cf058c696b3320efd3f0630005000100b10f05082f000006020088000919d152fef983bf5be332cd07dc6f5c7291d842a4e2d5501eca02a86c10df211d630005000100b50f05082f0000060200880009f5833bad367d7164d2d654cc607692fe441988e3104a353b59f11206e5665d251a0208630005000100a10f05082f00000602002d022802101505ccf25037c2f6847236f22ee081e854b12501f3802dd0bf9e220ba10b56481b6215059890fd3e365f6954b5bcab3c8195024da5188beaafb1b13d954c0281647ba53515051e503909a89514337bf9ce931876a08003396a9def52f867e123cf1420a0f70b1505a471c55caca4be7b4e60c6e94b20f9028883f8c64287d4454130c657383c3442630004000100c91f041400040100000700e40b5402130100000700e40b540200060102286bee823801002d011d00c5b7975df05c06a272ddc9d80cefafbe02d27c4303c04a8fc07df98000b48ab801001d017369626ce80300000000000000000000000000000000000000000000000000000000000000140d01020400010100506172656e740000000000000000000000000000000000000000000000000000
Open a public referendum to dispatch the call:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-rpc.dwellir.com#/extrinsics/decode/0x1500160d02c57e09d434fa8cdc9a302fcc85f34665bd250ebb38f58254e5e7cee162b694f766020000003483b201
Batch to submit on Polkadot Relay Chain:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-rpc.dwellir.com#/extrinsics/decode/0x1a04080a00990917031a041c0009625e4190035e51bfaa349c61bc198ed4103658fb4bd5f6716015a4a7f0412bdd630005000100a10f05082f0000060200880009274e1781dc36a23a922f9ec1e04afe0496a503612c4d57aa4fa0c8bf55b1237a630005000100a50f05082f00000602008800091553beb31f381fff842f1d9272c384c34d2be7abf289b482a54a1054d5f75acc630005000100a90f05082f00000602008800092428a28a8215b4c4cea2f15e7d97521c3e812ffbb378cf058c696b3320efd3f0630005000100b10f05082f000006020088000919d152fef983bf5be332cd07dc6f5c7291d842a4e2d5501eca02a86c10df211d630005000100b50f05082f0000060200880009f5833bad367d7164d2d654cc607692fe441988e3104a353b59f11206e5665d251a0208630005000100a10f05082f00000602002d022802101505ccf25037c2f6847236f22ee081e854b12501f3802dd0bf9e220ba10b56481b6215059890fd3e365f6954b5bcab3c8195024da5188beaafb1b13d954c0281647ba53515051e503909a89514337bf9ce931876a08003396a9def52f867e123cf1420a0f70b1505a471c55caca4be7b4e60c6e94b20f9028883f8c64287d4454130c657383c3442630004000100c91f041400040100000700e40b5402130100000700e40b540200060102286bee823801002d011d00c5b7975df05c06a272ddc9d80cefafbe02d27c4303c04a8fc07df98000b48ab801001d017369626ce80300000000000000000000000000000000000000000000000000000000000000140d01020400010100506172656e7400000000000000000000000000000000000000000000000000001500160d02c57e09d434fa8cdc9a302fcc85f34665bd250ebb38f58254e5e7cee162b694f766020000003483b201
Batch to submit on Polkadot Collectives Chain:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-collectives-rpc.polkadot.io#/extrinsics/decode/0x2804082b00d41f0004010004082f00000603c2c9007a216f881700c86fe2dd80e43c2a19e05046c718ecc4910cf38674734c30b2c5025d90a429ce3d003e020273201ae7b18aa482460bb392b32f393e2e25a11b943b429384849f182c9e03b635000000010a000000
## Test ref
We can fork the network with chopsticks and check that we can upgrade the chain without error.
```
npx @acala-network/chopsticks@latest xcm -r polkadot -p polkadot-asset-hub -p polkadot-collectives -p polkadot-people -p polkadot-coretime -p polkadot-bridge-hub -p hydradx
```
Upload the preimage for the referendum on localhost:8006 (polkadot relay) using the call from opengov-cli
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2Flocalhost:8006#/extrinsics/decode/0x0a00990917031a041c0009625e4190035e51bfaa349c61bc198ed4103658fb4bd5f6716015a4a7f0412bdd630005000100a10f05082f0000060200880009274e1781dc36a23a922f9ec1e04afe0496a503612c4d57aa4fa0c8bf55b1237a630005000100a50f05082f00000602008800091553beb31f381fff842f1d9272c384c34d2be7abf289b482a54a1054d5f75acc630005000100a90f05082f00000602008800092428a28a8215b4c4cea2f15e7d97521c3e812ffbb378cf058c696b3320efd3f0630005000100b10f05082f000006020088000919d152fef983bf5be332cd07dc6f5c7291d842a4e2d5501eca02a86c10df211d630005000100b50f05082f0000060200880009f5833bad367d7164d2d654cc607692fe441988e3104a353b59f11206e5665d251a0208630005000100a10f05082f00000602002d022802101505ccf25037c2f6847236f22ee081e854b12501f3802dd0bf9e220ba10b56481b6215059890fd3e365f6954b5bcab3c8195024da5188beaafb1b13d954c0281647ba53515051e503909a89514337bf9ce931876a08003396a9def52f867e123cf1420a0f70b1505a471c55caca4be7b4e60c6e94b20f9028883f8c64287d4454130c657383c3442630004000100c91f041400040100000700e40b5402130100000700e40b540200060102286bee823801002d011d00c5b7975df05c06a272ddc9d80cefafbe02d27c4303c04a8fc07df98000b48ab801001d017369626ce80300000000000000000000000000000000000000000000000000000000000000140d01020400010100506172656e740000000000000000000000000000000000000000000000000000

Also upload the preimage for the fellowship whitelist on collectives using the call from opengov-cli
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2Flocalhost:8001#/extrinsics/decode/0x2b00d41f0004010004082f00000603c2c9007a216f881700c86fe2dd80e43c2a19e05046c718ecc4910cf38674734c30b2c5025d90a429ce

Dispatch the whitelisted call from the fellows origin using the same Lookup hash and length from the fellowship referendum output by opengov-cli (check the referendum call to find the details) in the [js window](https://polkadot.js.org/apps/?rpc=ws://localhost:8001#/js):
```
// Grab the block number of the current head
// api is already imported, no need to add anything but the following.
const number = (await api.rpc.chain.getHeader()).number.toNumber()
// use chopsticks dev_setStorage to inject the call into the scheduler state for the next block.
await api.rpc('dev_setStorage', {
scheduler: {
agenda: [
[
[number + 1], [
{
call: {
Lookup: {
hash: '0x73201ae7b18aa482460bb392b32f393e2e25a11b943b429384849f182c9e03b6',
len: 53
}
},
origin: {
FellowshipOrigins: 'Fellows'
}
}
]
]
]
}
})
// Make a block to include the extrinsic
await api.rpc('dev_newBlock', { count: 1 })
```
Collectives:

Relay:

Dispatch the public referendum call manually from the whitelistedcaller origin in the [js window](https://polkadot.js.org/apps/?rpc=ws://localhost:8006#/js):
```
// Grab the block number of the current head
// api is already imported, no need to add anything but the following.
const number = (await api.rpc.chain.getHeader()).number.toNumber()
// use chopsticks dev_setStorage to inject the call into the scheduler state for the next block. The value of `Inline` is just the call data. Crucially with this call we can set the origin to `Root`
await api.rpc('dev_setStorage', {
scheduler: {
agenda: [
[
[number + 1], [
{
call: {
Lookup: {
hash: '0xc57e09d434fa8cdc9a302fcc85f34665bd250ebb38f58254e5e7cee162b694f7',
len: 614
}
},
origin: {
Origins: 'WhitelistedCaller'
}
}
]
]
]
}
})
// Make a block to include the extrinsic
await api.rpc('dev_newBlock', { count: 1 })
```
On the relay:

7 XCMs: AH, BH, collectives, people, coretime, Hydration proxy call and AH collator selection call
On Hydration:

On AH:

Then go through the relay and system parachains and upload the wasm to ensure that it will work.