feat: Implement Cross-Chain Re-Entrancy & Double-Spend Anomaly Detect… - #1005
Merged
Mosas2000 merged 1 commit intoJul 30, 2026
Merged
Conversation
…ion Engine with Automated Flash-Pause (StellaBridge#1003)
Contributor
Author
|
Please review my work. |
Contributor
|
The implementation of the Cross-Chain Re-Entrancy & Double-Spend Anomaly Detection Engine is exceptionally well-architected. |
Contributor
|
The sub-second graph analysis and automated flash-pause mechanisms seamlessly integrate with the event federation and circuit breaker services. Given the robust test coverage for double-spend, nonce jumps, and re-entrancy vectors. Thank you for your perfect work. |
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.
Description
Closes #1003
This PR implements the real-time Cross-Chain Re-Entrancy & Double-Spend Anomaly Detection Engine with Automated Flash-Pause (
crossChainAnomalyEngine.service.ts).During high cross-chain throughput, exploits such as token double-minting across EVM-Stellar bridge relayers or re-entrancy attacks during cross-chain state updates can occur within sub-second block windows. This engine inspects event streams in real time to catch exploits before standard batch reconciliation jobs run.
Summary of Changes
Stream Graph Analyzer (
crossChainAnomalyEngine.service.ts):pause_contractRPC (pause_bridge/pause_global), sets emergency circuit breaker flags in Redis, increments Prometheus metrics (circuitBreakerTrips), and records critical alert events when the anomaly threshold is breached within a 5-second window.isEmergencyBreakerActive) and recovery reset (resetEmergencyBreaker) methods.Event Stream Federation Integration (
EventFederationService.ts):CrossChainAnomalyEngineServiceinto event stream ingestion (_ingest) to process federated stream events automatically in real time.Testing:
crossChainAnomalyEngine.service.test.tscovering double-spend, sequence jump, re-entrancy detection, Flash-Pause triggering, and breaker recovery flows.anomalyEngine.integration.test.tssimulating double-mint exploits across relayers.Verification
npm --prefix backend run test:unit -- tests/services/crossChainAnomalyEngine.service.test.ts(All 7 unit tests passed)npm --prefix backend run build(TypeScript compilation succeeded with 0 errors)