This article outlines the steps required for the canonical bridge upgrade.
1. Smart Contract
- Discussion Phase:
- Does the design involve only a single chain or both chains?
- What are the affected components (including non-core contracts) after the upgrade?
- If the event signature is changed, update the indexer, bridge validators, and bridge UI.
- Is new contract needed?
- Development Phase:
- AMB -> tokenbridge-contracts/master
- xDAI bridge -> tokenbridge-contracts/xdaibridge
- Omnibridge -> omnibridge
- Framework:
- Truffle: Deprecated; only remains for original code.
- Hardhat: Only for Hashi-related components.
- Foundry: Used by all latest development (including sDAI, USDS migration).
- Testing Phase:
- Unit test: All individual functions that are modified or added.
- Fork test: Ideal for simulating a single-chain environment.
- Fuzzing test: Ideal for checking edge cases.
- End-to-End test: Critical for simulating the cross-chain environment. Can abstract away the bridge validator logic by creating a simple script at this phase.
- Testnet: Deploy to Sepolia and Gnosis Chiado Chain for testnet testing. Alternatively, use Tenderly VirtualTestNet for xDAI bridge testing.
- Audit Phase:
- Defining audit scope:
- Initial audit phase:
- Smart contracts involved.
- Latest GitHub commit.
- Auditing timeline and cost.
- Upgrade procedure validation:
- Bytecode of the deployed contract matches the bytecode of the audited contract.
- Parameters in the upgrade transaction match the expected upgrade procedure, including state changes, events, and balance changes.
- Safe transaction metadata is correct, including Safe transaction hash, domain hash, and message hash. (Tool: SafeUtils).
- Initial audit phase:
- Hosting of audit report:
- The audit report is uploaded by the auditor in public repository. Example
- Should be available in Gnosis Docs and relevant repository on Gnosis Chain.
- Repository management:
- Create a new PR.
- Review and merge to the relevant branch.
- Defining audit scope:
2. Bridge Validators
- Code change process (if required):
- Development phase:
- Repository: tokenbridge/oracle
- Framework:
- Node.js
- Testing phase:
- Unit test
- Fork test
- End-to-End test
- Publish a new image to Docker Hub: gnosischain/tokenbridge-oracles
- Development phase:
- Coordination with bridge validators:
- Publish an instruction article for running the new Docker image with bridge validators.
- Provide a testing environment for bridge validators if needed.
- Verify and make sure all bridge validators are running the correct version before the upgrade.
- Confirm availability with bridge validator in case there is downtime during the upgrade.
3. Bridge Event Indexer
- if event signature is modified:
- Modify indexer code.
- Testing phase.
- Release phase.
4. Bridge UI
- Defining scope:
- Which bridges and logic are modified?
- How does the user flow change?
- Does the indexer logic change?
- Development phase
- Testing phase:
- Test changes on the dev branch.
- Release phase:
- Branch flow: develop -> staging -> production
- Create a new release.
- Deploy to production by DevOps.
5. Communication Phase
- Target audience:
- General users
- 3rd-party applications
- Target channels: Discord, X, Official Docs, Telegram, Farcaster, Slack, Gnosis Forum.
- Create a draft article and coordinate with the communications/marketing team for the release date.
- Nodify 3rd party bridges if event signature or entry point contract change.
- Provide technical details on github for developers and users, includes integration guideline, contract workflow, deployed contract address. Example
6. Bridge Governance
- Create a governance proposal:
- Provide a clear explanation of the purpose of the bridge governance proposal, and relevant details for validation (i.e., technical documentation, audit report, transaction simulation).
- Execute the governance proposal when the threshold of signatures is reached.
- Update in Gnosis Chain Docs governance decision.