fix: refresh expired swap quotes before signing - #260
Open
0xApotheosis wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedNext included review available in 43 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (17)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
0xApotheosis
force-pushed
the
fix/swap-quote-expiry
branch
from
September 8, 2026 03:12
7346d1c to
42e6f7e
Compare
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
Refreshes swap quotes after network switching and after any token approval confirms, instead of submitting the original calldata after a delay. Refreshed amounts, provider, spender and network fees are shown in the card; changed terms require acceptance before continuing. Allowance is checked against each refreshed spender.
Bebop quotes retain their expiry. Relay uses a conservative 60-second window from request start. Missing, expired and nearly expired quotes cannot reach the wallet request. Refreshes preserve the exact assets, sell amount and accounts, including swaps originally specified in USD.
Verification
Use the local frontend and backend with working provider keys and an EVM wallet. Request
swap 100 USDC on Base for FOX on Ethereumwith sufficient USDC and gas./api/swap/refreshsupplies a new transaction and deadline. The card must show the refreshed quote./api/swap/refreshresponse to changeswapData.buyAmountCryptoPrecision. The card must wait for Accept updated quote; Cancel swap must stop execution. Do not sign transactions from modified responses.expiresAt, then accept. Expect another refresh before any wallet request. Override the refresh response to HTTP 502: expect an error, with no fallback to the old transaction.Confirmed: a live unsigned Relay quote for Base USDC → Ethereum FOX returned a valid deadline with ~59 seconds remaining. Deterministic execution tests cover approval refresh, spender changes, acceptance after expiry, cancellation, provider failures, changed swap identity and wallet changes. Wallet UI checks above have not been exercised; browser access was unavailable.
Deployment / limitation
This PR contains both backend and frontend changes; no separate PR is required. The new frontend calls
/api/swap/refresh, so the backend should be live before the frontend is promoted. If the frontend deploys first, swap preparation temporarily fails at quote refresh until the backend deploy completes; it never falls back to the old transaction.The final guard runs immediately before wallet signing with a 10-second buffer. An EVM wallet can still hold its own signing dialog open past the deadline; the app cannot revoke a request already handed to it.