soroban route implementations#684
Merged
Merged
Conversation
|
@feyishola Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
2 tasks
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 #462
closes #463
closes #464
closes #468
All 25 tests pass. Here's what was created under src/history/routes/stellar/:
soroban-route-snapshot-store.ts — The main implementation with:
SorobanRouteSnapshotStore class — bounded in-memory storage (configurable maxSnapshotsPerRoute + retentionMs pruning), matching the pattern of RouteHealthHistoryTracker
capture(input) — records a snapshot of fee and duration data for a route
getHistory(routeId, query?) — retrieves raw snapshots, filterable by date range and limit
getLatest(routeId) — most recent snapshot for a route
getTrackedRoutes() — lists all known route IDs
getTrend(routeId, query?) — aggregated stats: avg/min/max fee, avg/min/max duration, plus feeTrend and durationTrend ('rising' | 'falling' | 'stable') computed by comparing first-half vs second-half averages
soroban-route-snapshot-store.spec.ts — 25 tests covering storage, chronological ordering, per-route isolation, copy-on-read safety, date range queries, limit queries, trend detection, retention eviction, and clearing.
index.ts — Barrel export that also exposes a default singleton sorobanRouteSnapshotStore.
Here's what was built:
tests/routes/stellar/ — 5 files across 4 directories:
File Role
mocks/bridge-provider.mock.ts MockBridgeProvider with configurable fee/latency/reliability and failure-injection modes (timeout, liquidity, unavailable). Pre-built factory for all known providers (AllBridge, Squid, Wormhole, Stargate, unstable, congested).
fixtures/transfer-scenarios.ts 8 typed TransferScenario objects covering happy path, cost/speed prioritization, provider-unavailable, fee-spike, insufficient-liquidity, all-providers-down, reverse direction, and single-provider. Each declares expected outcome fields for assertion.
harness/route-test-harness.ts RouteTestHarness wires SorobanSmartRoutingEngine + SorobanRouteFallbackPlanner together using mock providers. Exposes run(scenario), runAll(scenarios), and simulateFallback(routes, failedId, reason).
harness/route-validator.ts RouteValidator with framework-agnostic assertion methods: assertOutcome, assertBestProvider, assertFeeAtMost, assertLatencyAtMost, assertFallbackTriggered, assertFallbackReason, assertFallbackBestProvider, and more.
soroban-route-execution.spec.ts 26 automated tests across 9 describe blocks — covers primary selection, cost/speed priority, all fallback reasons, mock provider call tracking, simulateFallback API, and a full batch run validating every fixture scenario.