# How to upgrade Common Good Parachain Runtime As these parachains are managed by the relay chain governance, we cannot just authorize the upgrade and call the enactment call from the parachain side. For this reason, we should use XCM transact call to be able to dispatch the call that will arrive to the parachain. ## Big picture: - Construct the authorize upgrade encoded call from the parachain. - The authorize encoded is wrapped in a XCM call that will be executed from the relay chain. - Once the on-chain governance passes and the authorize is submitted, then WASM blob containing the new runtime code should be pushed using an unsigned transaction on the parachain. This step pushes the new code to the relay chain that will enact the new runtime code. IMPORTANT: The code hashes for the compressed and the non compressed runtimes are NOT identical. If the proposal is made for a compressed runtime, only the compressed runtime can later be submitted. ## 1) Build the `authorizeUpgrade` call (on parachain side ) Note: Nothing should be executed on this step, the purpose is to build the encoded call. 1) From the cumulus release notes pick the `Blake2-256 hash` of the runtime WASM to be used. Example: [https://github.com/paritytech/cumulus/releases/tag/parachains-v9.0.0](https://github.com/paritytech/cumulus/releases/tag/parachains-v9.0.0) 2) Construct the encoded call using the extrinsic **parachainSystem** → **authorizeUpgrade** and provide the `Blake2-256 hash` code. ![](https://i.imgur.com/btaiwRC.png) Keep the value `encoded call data` that will be used in the next steps. ## 2)Build XCM call to dispatch the upgrade (on relay chain) As we mentioned at the begining of this document, this XCM call should be executed by the on chain governance process, in other words the call should be executed with Root permission. So the output of this step is not to execute the call per-se, but to construct the call that will be used on the governance proposal that will execute the authorize upgrade on the parachain. 1) Build the following extrinsic from the relay chain side: ``` xcmPallet send(dest, message) dest: XcmVersionedMultiLocation { V1: { parents: 0 interior: { X1: { Parachain: 1,000 } } } } message: XcmVersionedXcm { V2: [ { Transact: { originType: Superuser requireWeightAtMost: 1,000,000,000 call: { encoded: <encoded call data for authorizeUpgrade> } } } ] } ``` Screenshot of the call: ![](https://i.imgur.com/FcFahBF.png) ![](https://i.imgur.com/E1nRgwV.png) 2) Get the `encoded call` data and `encoded call hash` is what it should be provided to the council member to submit the motion. 3) Execute `enactAuthorizedUpgrade` (on parachain) Once the on chain governance proposal passed and the authorized was executed and processed by the parachain, the enactAuthorizedUpgrade should be executed manually so we can finish with the enactment of the new runtime code. TODO: paste screenshot of the events in the parachain showing the dmp message and the upgrade authorized call. 1) Execute with an unsigned transaction the extrinsic **parachainSystem** → **enactAuthorizedUpgrade** and provide this time the actual WASM file. ![](https://i.imgur.com/gdCYKRF.png) ![](https://i.imgur.com/5iMEobP.png) 2) Once the submission was executed successfully check on the relay chain that the enactment is scheduled (usually it takes an hour to do so) For checking this you can get this time on the relay chain going to **Network** → **Parachains** TODO: Put some screenshots to show parachain being upgraded and the event that shows the store function was executed