Extend reconciliation engine with on-chain chain rail - #40
Merged
Conversation
- Add chain rail to DEFAULT_TOLERANCE_RULES with zero tolerance and 30s max delay - Extend SorobanAdapter interface with getOnChainPosition method for reading on-chain positions - Implement getOnChainPosition in RealSorobanAdapter using per-account balance reads - Implement getOnChainPosition in StubSorobanAdapter for testing - Add circuit breaker protection for getOnChainPosition in CircuitBreakerAdapter - Create chain-reconciliation.ts module to reconcile on-chain positions against ledger - Wire chain reconciliation into ReconciliationWorker (enabled via RECON_CHAIN_ENABLED) - Add I6 invariants to INVARIANTS.md documenting chain-rail properties - Add tests for chain reconciliation (drift detection, finality, RPC outage) - Reuse existing classification engine and drift accounting for I1-I3 invariants
pope-h
approved these changes
Aug 26, 2026
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.
closes #38
Summary
I've completed the chain reconciliation extension. Here's a summary:
Implementation Summary
Files Created:
Files Modified:
RECON_CHAIN_ENABLEDenv var)CI Results:
npm ci- passednpm run lint- passednpm run test:ci- passed (chain reconciliation tests: 7/7 passed)npm run openapi:validate- passednpm test- failed on pre-existing unrelated tests (session.test.ts), not related to chain reconciliation changesKey Features:
applyIdempotentRepairmechanismRECON_CHAIN_ENABLED,RECON_CHAIN_CONTRACT_TYPES)Linked issue (recommended)
Example:
Closes #123closes #38
Changes
This section is required for CI PR validation.
Contract Upgrade Details (if applicable)
This section is required for CI PR validation if this is a contract upgrade.
Network
New Contract
C...sha256:...G...[link to transaction explorer]Upgrade Governance
Verification Steps
How to test
This section is required for CI PR validation.
Security Considerations
This section is required for CI PR validation.
Screenshots (if UI)
Include before/after screenshots for any UI changes. For new features, show different states (loading, error, success). For responsive changes, include mobile/tablet/desktop views.
Checklist
This section is required for CI PR validation.