feat(bridge): add multi-chain Wormhole / EVM bridge monitor with reconciliation#835
Merged
Conversation
…itor-with-reconciliation
Alaka-ibr
pushed a commit
to Alaka-ibr/Bridge-Watch
that referenced
this pull request
Jul 21, 2026
…hain-Wormhole/EVM-bridge-monitor-with-reconciliation feat(bridge): add multi-chain Wormhole / EVM bridge monitor with reconciliation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a multi-chain bridge monitoring subsystem for Wormhole and EVM bridges to detect off-chain mismatches between EVM lock balances and Stellar wrapped supplies.
Closes #831
Problem
System only monitored Stellar-native bridges. For Wormhole and other multi-chain bridges, we had no visibility into EVM-side lock contracts. Mismatches between EVM locked assets and Stellar wrapped supply could go undetected.
Solution
EVM Bridge Watcher Module
backend/src/bridges/watchers/evm-watcher.tsusingviemto fetch lock contract balancesEVM_RPC_URLSmapbalanceOf/totalLockedfrom Wormhole Token Bridge contracts every 60sbridge_lock_balancestable:chain_id,contract_address,balance,block_number,recorded_atCross-Chain Reconciliation Metrics
backend/src/bridges/reconciliation.tsreconciliation_ratio = evm_locked / stellar_wrapped|ratio - 1| > 0.02(2% threshold configurable)bridge_evm_locked_total,bridge_stellar_wrapped_total,bridge_reconciliation_diffBridgeMismatchHighif diff > threshold for >5 minDatabase Configuration
bridges.config.json+wormhole.config.tswith Wormhole bridge addresses0x3ee18B2214AFF97000D974cf647E7C347E8fa585, emitter addresses per chainm_2024_12_evm_bridges: newevm_bridgestable withchain,address,type=wrapped|nativeRELOAD_BRIDGES_CONFIGendpointBridges Stats Tab
GET /api/v1/bridges/:id/evm-locks→{ chain, address, lockedBalance, lastUpdated, blockNumber }GET /api/v1/bridges/:id/reconciliation→{ evmTotal, stellarTotal, diff, ratio, status: ok|warning|critical }BridgesStatsTab.tsxnow shows EVM lock details table + reconciliation gaugeTesting Done
balanceOffor 3 chains; retry on RPC timeout workswarning; 1,000,000 vs 950,000 →criticalGET /bridges/wormhole/reconciliationreturns ratio + status; anomaly triggers alert in logspnpm test bridges→ 18 new tests passpnpm lint && pnpm typecheck→ cleanNotes
Large subsystem: ~800 LOC + new tables. Requires
EVM_RPC_URLSenv var set. No breaking API changes; additive endpoints only. Threshold configurable viaBRIDGE_RECONCILIATION_THRESHOLD=0.02. Future: add LayerZero support using same watcher interface.Checklist
/metricsdocs/bridges/multi-chain.md