feat(stellar): route locks, Soroban compatibility, simulation diffs, and pre-exec safety - #1050
Merged
mijinummi merged 1 commit intoAug 27, 2026
Conversation
…ning Prevent selected bridge routes from being swapped during preparation, verify Soroban contracts against the BridgeWise interface, diff simulations, and block unsafe Stellar executions before signing. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@p3ris0n 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! 🚀 |
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.
Summary
This PR ships four related Stellar/Soroban pre-execution guards as one change set. Together they pin the route the user selected, confirm the on-chain contract matches BridgeWise’s expected interface, surface material simulation drift when a tx or route changes, and block signing unless a full safety pipeline passes.
Why
During preparation, quotes can refresh and routes can be recalculated. Without a lock, the user can sign a different path than the one they picked. Independently, Soroban deployments can drift in methods or arguments, simulation results can change after parameter tweaks, and several safety checks currently live as separate concerns that are easy to skip before signing.
#997 — Stellar bridge route lock
Problem: Concurrent quote refreshes or route recalculations can cause the user to sign a different route from the one originally selected.
Solution:
StellarBridgeRouteLockService(src/routing/locks/stellar/) associates a lock with an execution ID.Behavior
executionId+ selected route (provider, assets, quoted in/out).guardRouteUpdate/ re-acquire). The same route can be re-acquired (idempotent).releaseAfterExecution) or when the TTL expires (sweepExpired/ lazy purge on read).src/execution/route-lock.ts.Acceptance
Tests:
tests/routing/locks/stellar-bridge-route-lock.spec.ts#998 — Soroban contract compatibility checker
Problem: Contract deployments can differ in methods, arguments, or supported behavior versus the BridgeWise interface.
Solution: Expected capabilities live in
src/contracts/metadata/bridgewise-interface.ts.SorobanContractCompatibilityChecker(src/soroban/compatibility/) compares resolvedContractInterfaceMetadataagainst that spec.Expected interface (defaults)
bridge(source_chain, target_chain, amount, recipient)quote(source_chain, target_chain, amount)cancel(operation_id)Result shape
Returns
compatible,issues[](codes such asMISSING_METHOD,ARGUMENT_COUNT_MISMATCH,ARGUMENT_NAME_MISMATCH,ARGUMENT_TYPE_MISMATCH,METADATA_MISSING), plusverifiedMethods/missingMethods. Incompatible contracts are rejected (compatible: false).Acceptance
Tests:
tests/soroban/compatibility/soroban-contract-compatibility-checker.spec.ts#996 — Soroban transaction simulation diff
Problem: Changes to transaction parameters can significantly alter resource usage or expected outcomes, and those shifts are hard to see without a structured before/after.
Solution:
SorobanSimulationDiffService(src/soroban/simulation/diff/) compares two simulation snapshots.Compared
|delta|≥ threshold)Configurable
MaterialDifferenceThresholds(default: any change of 1+ is material). Result includeshasChanges,hasMaterialDifferences,resourceChanges,outputChanged,eventChanges, and a human-readablesummary.Re-exported from
src/soroban/simulation.Acceptance
Tests:
tests/soroban/simulation/soroban-simulation-diff.spec.ts#999 — Stellar bridge pre-execution safety pipeline
Problem: Multiple independent checks need to be coordinated before the user signs.
Solution:
StellarPreExecutionSafetyPipeline(src/execution/safety/stellar/) always runs the full set of validators insrc/execution/validation/. Any error blocks signing. Failures includecode,reason, and an actionableactionstring.Checks (all executed)
Consolidated result:
safe,blocked,checkedAt, per-check results, and a flatfailureslist.Acceptance
Tests:
tests/execution/safety/stellar-pre-execution-safety-pipeline.spec.tsHow these pieces fit
The pipeline can consume compatibility output; the lock should still be held through signing so a late quote refresh cannot swap the route.
Test plan
safe; stale quote, missing trustline, low output, incompatible contract, insufficient balance, and resource overruns setblockedwith actionable failuresapps/api/tsconfig.json(this PR does not change app wiring; services are standalone and can be composed at the execution layer)Closes #996
Closes #997
Closes #998
Closes #999