Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
105 lines
6.9 KiB
Markdown
105 lines
6.9 KiB
Markdown
# Tezos Bridging Deployment Runbook
|
||
|
||
This runbook describes how to deploy and configure all possible bridging to the Tezos ecosystem: **Etherlink** (EVM chain 42793) and **Tezos L1** (native Michelson).
|
||
|
||
## Prerequisites (external verification)
|
||
|
||
Before implementation or production use:
|
||
|
||
1. **CCIP (Etherlink)**
|
||
- Check [CCIP supported networks](https://docs.chain.link/ccip/supported-networks) for Etherlink (chain 42793).
|
||
- If supported: obtain the **CCIP chain selector** for 42793 and set it in `alltra-lifi-settlement/src/config/chains.ts` (ETHERLINK.selector) and set `ccipSupported: true`.
|
||
|
||
2. **LiFi (Etherlink)**
|
||
- Check LiFi API (e.g. `https://li.quest/v1/chains`) for chain 42793.
|
||
- If present: set `lifiSupported: true` in `alltra-lifi-settlement/src/config/chains.ts` for ETHERLINK.
|
||
- If not present: use the same request process as [REQUESTING_CCIP_LIFI_SUPPORT.md](../../alltra-lifi-settlement/docs/REQUESTING_CCIP_LIFI_SUPPORT.md) for Etherlink.
|
||
|
||
---
|
||
|
||
## Part A: Etherlink (chain 42793)
|
||
|
||
### A1. BridgeRegistry
|
||
|
||
- **No contract change.** Destination is registered at runtime.
|
||
- **Action:** After BridgeRegistry is deployed, ensure Etherlink is registered.
|
||
Use [InitializeRegistry.s.sol](../../smom-dbis-138/scripts/bridge/interop/InitializeRegistry.s.sol), which registers 42793 as "Etherlink Mainnet".
|
||
If running initialization manually, call:
|
||
- `registerDestination(42793, "Etherlink Mainnet", minFinalityBlocks, timeoutSeconds, baseFee, feeRecipient)`.
|
||
- When registering tokens (e.g. BRG-VLT, BRG-ISO), include **42793** in `allowedDestinations` (or use integration defaults that already include 42793).
|
||
|
||
### A2. VaultBridgeIntegration / eMoneyBridgeIntegration / WTokenBridgeIntegration
|
||
|
||
- **Done in code:** 42793 (Etherlink) is already in the default destination arrays in:
|
||
- [VaultBridgeIntegration.sol](../../../smom-dbis-138/contracts/bridge/integration/VaultBridgeIntegration.sol)
|
||
- [eMoneyBridgeIntegration.sol](../../../smom-dbis-138/contracts/bridge/integration/eMoneyBridgeIntegration.sol)
|
||
- [WTokenBridgeIntegration.sol](../../../smom-dbis-138/contracts/bridge/integration/WTokenBridgeIntegration.sol)
|
||
- **Existing deployments:** Use `setDefaultDestinations` / `setDefaultEvmDestinations` to add 42793 if not redeploying.
|
||
|
||
### A3. CCIP bridges (UniversalCCIPBridge, CCIPWETH9Bridge, CCIPWETH10Bridge)
|
||
|
||
- **Condition:** Only if CCIP supports Etherlink (see Prerequisites).
|
||
- **Steps:**
|
||
1. Deploy **receiver** bridge contracts on Etherlink (same interfaces as on source chain).
|
||
2. For each token and each bridge: call `addDestination(token, etherlinkChainSelector, receiverBridgeOnEtherlink)`.
|
||
- **Reference:** [DeployWETHBridges.s.sol](../../smom-dbis-138/script/deploy/bridge/DeployWETHBridges.s.sol), [execute-bridge-config.sh](../../smom-dbis-138/scripts/deployment/execute-bridge-config.sh).
|
||
|
||
### A4. ChainRegistry and EVMAdapter (Etherlink)
|
||
|
||
- **Script:** [DeployAllAdapters.s.sol](../../smom-dbis-138/script/deploy/chains/DeployAllAdapters.s.sol) already deploys an EVM adapter for Etherlink and registers chain 42793.
|
||
- **Env:** `UNIVERSAL_BRIDGE_ADDRESS`, `CHAIN_REGISTRY_ADDRESS`, `PRIVATE_KEY`.
|
||
- **Run:** `forge script script/deploy/chains/DeployAllAdapters.s.sol --rpc-url <RPC> --broadcast` (from `smom-dbis-138`).
|
||
|
||
### A5. LiFi / alltra-lifi-settlement
|
||
|
||
- **Config:** [chains.ts](../../../alltra-lifi-settlement/src/config/chains.ts) includes an **ETHERLINK** entry (chainId 42793, rpcUrl, explorerUrl, nativeCurrency from eip155-42793). Set `selector`, `usdcAddress`, `ccipSupported`, `lifiSupported` after Prerequisites verification.
|
||
- **Docs:** [CHAIN_SUPPORT.md](../../alltra-lifi-settlement/docs/CHAIN_SUPPORT.md) includes Etherlink in the support matrix and verification section.
|
||
|
||
### A6. BRG scripts and token registration
|
||
|
||
- **Scripts:** [register-vault-deposit-tokens.sh](../../smom-dbis-138/scripts/bridge/register-vault-deposit-tokens.sh), [register-iso-deposit-tokens.sh](../../smom-dbis-138/scripts/bridge/register-iso-deposit-tokens.sh) document that 42793 (Etherlink) and 1 (Tezos L1) should be included in allowedDestinations when registering tokens.
|
||
- **Default destinations:** New deployments of VaultBridgeIntegration / eMoneyBridgeIntegration / WTokenBridgeIntegration already include 42793; `registerDepositTokenDefault` / `registereMoneyTokenDefault` / `registerWTokenDefault` will include Etherlink.
|
||
|
||
---
|
||
|
||
## Part B: Tezos L1 (native Michelson)
|
||
|
||
### B1. TezosAdapter
|
||
|
||
- **Contract:** [TezosAdapter.sol](../../smom-dbis-138/contracts/bridge/adapters/non-evm/TezosAdapter.sol)
|
||
Implements IChainAdapter: lock tokens, emit TezosBridgeInitiated; oracle calls `confirmTransaction(requestId, tezosTxHash)` when Tezos tx is confirmed.
|
||
|
||
### B2/B4. ChainRegistry and BridgeRegistry
|
||
|
||
- **ChainRegistry:** Tezos L1 is registered via [DeployAllAdapters.s.sol](../../smom-dbis-138/script/deploy/chains/DeployAllAdapters.s.sol) as `registerNonEVMChain("Tezos-Mainnet", ChainType.Other, tezosAdapter, "https://tzkt.io", ...)`.
|
||
- **BridgeRegistry:** [InitializeRegistry.s.sol](../../smom-dbis-138/scripts/bridge/interop/InitializeRegistry.s.sol) registers Tezos-Mainnet with **chainId 1** (non-EVM slot). For tokens that may bridge to Tezos L1, include **1** in `allowedDestinations`.
|
||
|
||
### B3. Deploy TezosAdapter and register
|
||
|
||
- Run [DeployAllAdapters.s.sol](../../smom-dbis-138/script/deploy/chains/DeployAllAdapters.s.sol); it deploys TezosAdapter and registers "Tezos-Mainnet" in ChainRegistry.
|
||
|
||
### B5. Tezos-side relay
|
||
|
||
- **Runbook:** [TEZOS_L1_RELAY_RUNBOOK.md](../../smom-dbis-138/docs/bridge/TEZOS_L1_RELAY_RUNBOOK.md) describes:
|
||
- TezosAdapter event schema (TezosBridgeInitiated)
|
||
- Relay flow: watch events → perform Tezos-side mint/transfer → call `confirmTransaction`
|
||
- ORACLE_ROLE usage and security notes.
|
||
|
||
---
|
||
|
||
## Implementation order
|
||
|
||
1. **Prerequisites:** Verify CCIP and LiFi for Etherlink (42793); record selectors and flags in chains.ts and CHAIN_SUPPORT.md.
|
||
2. **Etherlink:** A1 (BridgeRegistry via InitializeRegistry) and A2 (integrations already include 42793) → A4 (DeployAllAdapters) → A5 (LiFi config/docs) → A3 if CCIP supports Etherlink → A6 (BRG scripts/docs).
|
||
3. **Tezos L1:** B1 (TezosAdapter exists) → B2/B4 (BridgeRegistry destination 1 in InitializeRegistry) → B3 (DeployAllAdapters) → B5 (relay runbook).
|
||
4. **Doc:** This runbook; update after Prerequisites verification.
|
||
|
||
---
|
||
|
||
## References
|
||
|
||
- [InitializeRegistry.s.sol](../../smom-dbis-138/scripts/bridge/interop/InitializeRegistry.s.sol) – BridgeRegistry destinations (Etherlink 42793, Tezos-Mainnet 1, XRPL 0).
|
||
- [DeployAllAdapters.s.sol](../../smom-dbis-138/script/deploy/chains/DeployAllAdapters.s.sol) – EVMAdapter(42793), TezosAdapter, ChainRegistry registration.
|
||
- [execute-bridge-config.sh](../../smom-dbis-138/scripts/deployment/execute-bridge-config.sh) – CCIP addDestination pattern.
|
||
- [TEZOS_L1_RELAY_RUNBOOK.md](../../smom-dbis-138/docs/bridge/TEZOS_L1_RELAY_RUNBOOK.md) – Tezos L1 relay behavior and event schema.
|