Files
smom-dbis-138/docs/deployment/LXC_DAPP_AND_DUAL_ROUTER_GAPS.md
2026-03-02 12:14:09 -08:00

8.1 KiB
Raw Permalink Blame History

LXC DApp and Dual-Router Coordinator — Completion Gaps

Last Updated: 2026-02-20
Status: Reference for remaining work

This document lists gaps between the LXC DApp VM and Dual-Router BridgeSwap Coordinator plan and the current implementation. Items are ordered by impact (bugs first, then missing features, then nice-to-haves).


Fixed in this pass

  • canSwap / getNonce chain: useReadContract for canSwap and getNonce now pass chainId (mainnet and Chain 138 respectively) so the correct chain is queried even when the wallet is on another chain.

Gaps — all addressed (2026-02-20)

The following gaps were completed:

  1. Lockbox ERC-20: TrustlessBridgeForm now supports deposit type (Native | ERC-20), token selector (WETH, cUSDT, cUSDC with decimals), Approve + Deposit ERC-20.
  2. CCIP destination: BridgePage has a destination chain dropdown; BridgeButtons receives destinationChainSelector for all 10 chains (Ethereum, BSC, Polygon, Base, Optimism, Arbitrum, Avalanche, Cronos, Gnosis).
  3. Per-chain CCIP config: bridge.ts has CCIP_DESTINATIONS and getCcipWeth9BridgeAddress(chainId); CRONOS selector added to CHAIN_SELECTORS.
  4. Admin + TRUSTLESS: contracts.ts imports TRUSTLESS and exposes mainnet/chain138 trustless addresses; re-exports TRUSTLESS.
  5. Finalize claim: TrustlessBridgeForm section "2b. Finalize claim" with deposit ID, canFinalize read, and finalizeClaim write (ChallengeManager).
  6. LXC ENV_FILE when PROXMOX_HOST: Script scps ENV_FILE to the Proxmox host then runs pct push so the container gets .env.
  7. LXC ip-addresses path: Script tries IP_CONFIG_PATH, then SMOM_ROOT/../../config/ip-addresses.conf, then SCRIPT_DIR/../../../config/ip-addresses.conf.
  8. VITE_ / .env docs:* DAPP_LXC_DEPLOYMENT.md has a "Production build: VITE_* and .env" section and IP_CONFIG_PATH in the table.

Gaps (original list, for reference)

1. Trustless: Lockbox ERC-20 deposit not in UI

Plan: “Lockbox 138 deposit (native + ERC-20: ETH, WETH, cUSDT, cUSDC).”

Current: Only native ETH deposit is implemented in the Trustless Bridge tab.

Gap: No UI for Lockbox depositERC20 (WETH, cUSDT, cUSDC on Chain 138). LOCKBOX_138_ABI already includes depositERC20; the form needs token selector, amount, approve flow, and call to depositERC20(token, amount, recipient, nonce).


2. CCIP: All 10 chains not selectable in Custom Bridge

Plan: “Ensure all 10 chains are selectable for CCIP WETH where applicable.”

Current: The Custom Bridge tab uses BridgeButtons with destinationChainSelector={CHAIN_SELECTORS.ETHEREUM_MAINNET} only (hardcoded in BridgePage.tsx).

Gap: Users cannot choose BSC, Polygon, Base, Optimism, Arbitrum, Avalanche, Cronos, or Gnosis as CCIP destination. CHAIN_SELECTORS in bridge.ts already includes BSC, GNOSIS, etc.; the Bridge page (or BridgeButtons) needs a destination chain selector (e.g. dropdown) and pass the chosen destinationChainSelector into BridgeButtons.


3. CCIP: No centralized per-chain contract config for all 10 chains

Plan: “Contract addresses: Centralize per-chain addresses (CCIP WETH bridges, …) in a config driven by env (e.g. VITE_*) or a small JSON so the DApp works against deployed addresses on all networks.”

Current:

  • Trustless: Centralized in bridge.ts as TRUSTLESS (Chain 138 + mainnet only).
  • CCIP: Only Chain 138 has CONTRACTS.WETH9, CONTRACTS.WETH9_BRIDGE, etc. There is no single config (or JSON) that maps chainId → CCIP WETH9 / WETH10 bridge (and related) addresses for BSC, Polygon, Base, Optimism, Arbitrum, Avalanche, Cronos, Gnosis.

Gap: Add a per-chain CCIP config (e.g. chainId → { WETH9_BRIDGE, WETH10_BRIDGE, LINK? }) driven by env or JSON, and wire BridgeButtons (and any CCIP UI) to use it so the DApp can target all 10 chains with the correct contract addresses.


4. Admin panels not wired to shared trustless config

Plan: “Keep existing admin panels (TwoWayBridge, MultiChainAdmin, etc.) and wire them to the same per-chain contract config.”

Current: Admin panels use config/contracts.ts and/or hardcoded addresses; they do not import or use TRUSTLESS from bridge.ts.

Gap: Optional consistency improvement: have TwoWayBridge (and any other trustless-related admin) read Lockbox/Inbox/Coordinator addresses from TRUSTLESS (or a shared module that re-exports them) so there is a single source of truth.


5. Trustless: No “finalize claim” action in DApp

Plan: “Add (or complete) flows for: … finalize claim, and bridgeAndSwap …”

Current: We have “Check canSwap” (read-only) and “Bridge and Swap” (write). There is no button or flow to finalize a claim (e.g. call Inbox or ChallengeManager to finalize).

Gap: If the operator/user is expected to finalize claims from the DApp (rather than only via relay/backend), add a “Finalize claim” action that calls the appropriate mainnet contract (e.g. ChallengeManager finalization) when the challenge window has passed. Depends on product decision: is finalization relay-only or also user-triggered?


6. LXC deploy script: pct push when using PROXMOX_HOST

Current: When PROXMOX_HOST is set (script run from a different machine), ENV_FILE is not pushed into the container because pct push runs on the remote host and the file lives on the runner.

Gap: Either document that the operator must copy .env into the container manually (e.g. scp .env root@proxmox:/tmp/ && ssh root@proxmox 'pct push 5801 /tmp/.env /srv/smom-dbis-138/.env') or add a step that scps ENV_FILE to the Proxmox host into a temp path then runs pct push via SSH so the container gets the file.


7. LXC deploy script: config/ip-addresses.conf path

Current: Script does source "${SMOM_ROOT}/../../config/ip-addresses.conf". That assumes the repo is under proxmox/smom-dbis-138 (so ../../ is proxmox). If the script is run from a clone that only has smom-dbis-138, the path is wrong.

Gap: Make the config path robust: e.g. allow override via IP_CONFIG_PATH, or try both SMOM_ROOT/../../config/ip-addresses.conf and SMOM_ROOT/config/ip-addresses.conf (or a path relative to script), and document expected repo layout.


8. DApp build in LXC: .env for VITE_* when cloning

Current: Build runs npm run build in the container. VITE_* are baked in at build time. If ENV_FILE is not pushed (see gap 6), the build uses no env and falls back to defaults in bridge.ts and networks.ts.

Gap: Document that for production builds with custom contract addresses or RPC URLs, the operator must ensure a .env (or .env.production) with the right VITE_* is present in the container before npm run build, and how to achieve that (e.g. push before build, or inject in CI and rsync into container).


Summary

# Area Gap Priority / notes
1 Trustless UI Lockbox ERC-20 (WETH, cUSDT, cUSDC) deposit Feature
2 CCIP UI Destination chain selector (all 10 chains) Feature
3 Config Per-chain CCIP contract addresses (10 chains) Needed for gap 2 and full CCIP use
4 Admin Wire admin to TRUSTLESS config Optional consistency
5 Trustless UI “Finalize claim” action (if product wants it) Product-dependent
6 LXC script ENV_FILE push when using PROXMOX_HOST UX / automation
7 LXC script Robust path to ip-addresses.conf Robustness
8 DApp/LXC docs Document VITE_* and .env for production build Documentation

Implementing 13 would bring the DApp to full “all possible uses” and “all 10 chains” as in the plan; 48 are improvements and clarity.