What is router
On EVM based chain, bifrost rely on Router to emit correct events to determine what had happened, all inbound/outbound transactions go through a smart contract, we call it Router. Current Router is on V4. Each connected EVM-based ETH forks have a router (currently Ethereum and Avalanche C-Chain).
Router contract hold all ERC20 assets, but not the native asset (e.g. ETH or AVAX). The native assets will be sent to asgard address directly.
Where is Router code?
https://gitlab.com/thorchain/ethereum/eth-router , if you need to make changes to this router, please raise a PR in this repository
How to upgrade Router?
Note: Newer version router needs to be compatible with old router.
What you can do?
- You can add new functions, new events
What you can't do?
- Don't change existing function signature , Don't add parameter , don't remove parameter , don't change return value etc.
- Don't change events , don't add new fields , don't remove fields
Router upgrade procedure
Before router upgrade , make sure you already make relevant changes in thornode repo. Replace <chain> in the below variables with the lowercase, shortened chain identifier (e.g. eth, avax).
- New router has been deployed , and the router address has been updated.
<chain>OldRouteris your current router address,<chain>NewRouteris your new router address
Before upgrade , make sure the network is healthy , all active nodes / standby nodes are online. If some nodes are not healthy , bifrost are not online it will cause the node's vault in a bad state
Detail upgrade procedure
Replace <CHAIN> in each Mimir key with capitalized, shortened chain identifier (e.g. ETH, AVAX)
- Set admin mimir
ChurnInterval->432000to stop churn - Set admin mimir
StopSolvencyCheck<CHAIN>->1to stop Solvency checker onCHAIN, this will make sure the migration fund will not cause solvency checker to halt the chain - Set admin mimir
MimirUpgradeContract<CHAIN>->1to update the router - Set admin mimir
ChurnInterval->43200 - Wait a churn to kick off , and make sure funds have been migrated from older router to new router. And vault retired successfully
- Set admin mimir
StopSolvencyCheck<CHAIN>->0to resume solvency checker onCHAIN