Contract Upgrades
Instructions on how to upgrade Snowbridge contracts
There are two main cases for upgrading Snowbridge contracts.
Gateway upgrade: upgrading the Gateway contracts logic.
BEEFY upgrade: Upgrading the BEEFY client, which also includes a Gateway upgrade as the BEEFY client set in the Gateway is immutable.
1. Building contracts
2. Deploying the BEEFY client (Optional, required only for a BEEFY upgrade)
TBC: deploy_beefy_client
does not exist yet.
3. Deploy the Gateway logic
This will deploy a new instance. You will be required to provide the BeefyClient contract address, either the existing BEEFY client when doing a Gateway upgrade or the newly deployed BEEFY client if doing a BEEFY upgrade. Take note of the Gateway logic address for use in later steps.
4. Building the `snowbridge-preimage` Tool
To perform an upgrade you need to use the snowbridge-preimage
tool to build a pre-image of the upgrade. It can be built using the following command. Notice the network is provided and has to match the environment being deployed, the options are rococo
, kusama
and polkadot
. Using rococo
as an example.
5. Building the Preimage
You can now use the control tool to build the preimage. This will differ based on whether you are the upgrade requires a storage initialization to run.
Getting the code hash
GATEWAY_LOGIC_CONTRACT_ADDRESS
is from step 3. Deploy the Gateway logic.
INFURA_PROJECT_ID
is the project id for using infura.
Get the code
You need to keccak256
hash the contract code to generate the GATEWAY_LOGIC_CODE_HASH
. Online keccak256 tool.
If there are code changes only an initializer will not be needed. If there are new storage layout members then an initializer will be needed. Do a diff
between the version that is currently on-chain and the version you are upgrading to and verify.
Generating preimage without Initializer
Generating preimage with Initializer
Here we pass the additional parameters required for the initializer (0x000000000000
) and the gas requirement (5000
).
6. Submitting a referendum with `opengov-cli`
Now that we have the preimage we can submit a governance proposal using the opengov-cli
.
Build the tool from the repo below:
upgrade.call
is from 5. Building the Preimage
TBC: Confirm track, and test the actual process
Last updated