Skip to content

soroban route implementations#684

Merged
mijinummi merged 1 commit into
MDTechLabs:mainfrom
feyishola:feat/snap-store
Jun 28, 2026
Merged

soroban route implementations#684
mijinummi merged 1 commit into
MDTechLabs:mainfrom
feyishola:feat/snap-store

Conversation

@feyishola

Copy link
Copy Markdown
Contributor

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.

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@mijinummi mijinummi merged commit 4548d60 into MDTechLabs:main Jun 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants