Updating Testnet
This document describes how to update all the token bridge contracts in testnet for the purpose of resetting an emitter address for a chain. In this example, we will be updating "all" token bridge contracts to reset the emitter address for Sui. This is necessary because the Sui testnet environment gets reset periodically, requiring that the Deltaswap contracts be redeployed, changing the emitter address.
It should be noted that "all" does not literally mean all chains. At this time, this process does not support the following:
Algorand
Near
Supporting these chains just requires adding the appropriate documentation / scripting to support a contract upgrade to reset a given emitter address.
Additionally, some chains allow you to overwrite an existing registration with a new one, so you do not need to upgrade the contract to reset a registration. This includes:
Solana
Aptos
Sui
It should also be noted that this is a work in progress. Over time, some of these steps may be automated in the worm
tool or other scripts.
Process Setup
To set up for this process, start with a clean repo and follow these steps.
Checkout the
deploy_update_all_in_testnet
branch.Rebase the branch off the latest
main
.
Upgrading EVM Chains
The EVM contracts do not allow updating a registration for a chain that is already registered, so you need to upgrade the contract to clear the registration, and then submit the new VAA.
Edit
ethereum/contracts/bridge/BridgeImplementation.sol
to set the chain ID that you want reset (default is chain 21 for Sui).cd to
ethereum
and donpm run build
Update the gas parameters in
ethereum/truffle-config.js
for Karura and Acala.Use the
getKaruraTestnetGas.sh
andgetAcalaTestnetGas.sh
scripts to query for the latest gas prices and update thegasPrice
andgas
parameters for karura_testnet and acala_testnet. TODO: Automate this or put these scripts in the repo.
Run
./upgrade_all_test
. This should upgrade each EVM chain and submit the contract upgrade VAA for it.Deal with any chains that fail, on a case by case basis. If you need to rerun a single chain, do something like this:
Upgrading Cosmwasm Contracts
The cosmwasm contracts do not allow updating a registration for a chain that is already registered, so you need to upgrade the contract to clear the registration, and then submit the new VAA.
Edit
cosmwasm/contracts/token-bridge/src/contract.rs
to set the chain ID that you want reset (default is chain 21 for Sui).cd to
cosmwasm
and domake artifacts
Resetting the Registration on Terra2
Deploy the new code to Terra2 by doing the following. This should give you the
code_id
.
The admin of the Terra2 token bridge in testnet has not been transferred to the contract itself, so you cannot use the standard contract upgrade VAA to complete the upgrade. Instead, do the following:
Resetting the Registration on XPLA
Deploy the new code to XPLA by doing the following. This should give you the
code_id
.
Generate the contract upgrade VAA.
Submit the contract upgrade VAA.
Submitting the Chain Registration on each Chain
Generate the new chain registration VAA using the new emitter address (which for Sui is different from the contract address) and update the entry in the Testnet V2 notion page:
Submit the VAA to each chain like this:
Verifying the Registrations
To verify that the registrations are all correct for a given chain, you can do the following. This command currently works for Solana, EVM, Terra2, XPLA, Aptos, Sui and Sei.
Last updated