Skip to content

Conversation

mrice32
Copy link
Contributor

@mrice32 mrice32 commented Jul 31, 2025

This makes three changes to reduce RPC usage in the API:

  1. Enable caching at the provider level.
  2. Compute fill deadline without calling destination chain RPC.
  3. Remove amount dependency in RPC call when checking HubPool utilization, which will allow this call to be identical (and therefore cachable) on different calls to suggested-fees.

Copy link

vercel bot commented Jul 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
app-frontend-v3 Ready Ready Preview Comment Sep 5, 2025 4:19pm
sepolia-frontend-v3 Ready Ready Preview Comment Sep 5, 2025 4:19pm

Signed-off-by: Matt Rice <[email protected]>
mrice32 added 2 commits July 30, 2025 22:26
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
dohaki
dohaki previously approved these changes Jul 31, 2025
Copy link
Contributor

@dohaki dohaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks for looking into this. Left one question

api/_utils.ts Outdated
@@ -1300,7 +1302,8 @@ function getProviderFromConfigJson(
3, // max. concurrency used in `SpeedProvider`
5, // max. concurrency used in `RateLimitedProvider`
"RPC_PROVIDER", // cache namespace
1 // disable RPC calls logging
0, // disable RPC calls logging
redisCache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you verify that something gets written to Upstash?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, doesn't look like it is from the preview. Will take a pass tonight to figure out why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the issue was fixed. We needed a distance from HEAD.

Fixing this revealed some issues related to differences from our regular redis client vs the upstash one. For some reason, I'm seeing it strip quote characters (which breaks the provider caching). I was able to put in a workaround, but PTAL and let me know if you have a better idea.

@@ -355,7 +353,10 @@ export async function extractDepositDataStruct(
exclusiveRelayer:
crossSwapQuotes.bridgeQuote.suggestedFees.exclusiveRelayer,
quoteTimestamp: crossSwapQuotes.bridgeQuote.suggestedFees.timestamp,
fillDeadline: await getFillDeadline(spokePool),
fillDeadline: getFillDeadline(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 💪

melisaguevara
melisaguevara previously approved these changes Jul 31, 2025
Signed-off-by: Matt Rice <[email protected]>
@mrice32 mrice32 dismissed stale reviews from melisaguevara and dohaki via 7bf236d August 6, 2025 03:47
@mrice32 mrice32 requested a review from dohaki August 6, 2025 03:53
melisaguevara
melisaguevara previously approved these changes Sep 4, 2025
Copy link
Contributor

@melisaguevara melisaguevara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

pxrl
pxrl previously approved these changes Sep 4, 2025
dohaki
dohaki previously approved these changes Sep 5, 2025
Copy link
Contributor

@dohaki dohaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dohaki dohaki dismissed stale reviews from pxrl, melisaguevara, and themself via 09e134a September 5, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants