Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
1.7 KiB
1.7 KiB
Multi-Chain Execution — Reorg Handling
Last Updated: 2026-01-31
Document Version: 1.0
Status: Active Documentation
Scope: Chains 138, 651940; SAL and execution step state after a reorg.
Detection
- Chain adapters expose
detectReorg(blockNumber, expectedBlockHash). - EII or EO should compare expected block hash (from earlier receipt/block fetch) with current block at same height; if mismatch, reorg occurred.
Confirmation thresholds
- 138: e.g. 20 blocks (configurable in chain config).
- 651940: e.g. 20 blocks.
- Treat receipt as confirmed after N blocks; finalized after N + reorg window (e.g. another 20).
Actions
-
Roll back SAL
- Identify last common ancestor block (e.g. highest block number where our stored block hash still matches chain).
- Revert SAL positions and journal entries that depended on blocks after that ancestor (or mark them disputed and recompute from chain).
-
Execution steps
- For steps in reorged blocks: mark step status as failed or reverted; release nonce if tx was dropped.
- If intent TTL not expired: re-execute affected steps (new tx); update intent_id → step → tx_hash.
-
Mirroring
- Do not submit new commitments for reorged range until chain stabilizes.
- If commit was already sent to MirrorRegistry for a range that was reorged: document; optional future schema could support “revoked” or superseding commit.
-
Prevention
- Use configurable confirmation thresholds per chain; wait for finalized depth before updating SAL and before including in mirror commit.
Verification
- After reorg: re-fetch blocks in affected range; confirm block hashes stable for reorg_window blocks; then resume ingestion and commitment.