Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: fetch withdrawals in parallel when possible #2147

Merged
merged 11 commits into from
Dec 19, 2024

Conversation

spsjvc
Copy link
Member

@spsjvc spsjvc commented Dec 17, 2024

Summary

Steps to test

@cla-bot cla-bot bot added the cla-signed label Dec 17, 2024
Copy link

vercel bot commented Dec 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
arbitrum-token-bridge ✅ Ready (Inspect) Visit Preview Dec 19, 2024 0:43am

@spsjvc spsjvc changed the title perf: optimize withdrawals queries perf: fetch withdrawals in parallel when possible Dec 17, 2024
Comment on lines -103 to -118
const gateways = await getGateways(provider)
const senderNonce = await backOff(() => getNonce(sender, { provider }))

// sender queries; only add if nonce > 0
if (senderNonce > 0) {
addQuery(buildQueryParams({ sender, gateways: [gateways.standardGateway] }))
addQuery(buildQueryParams({ sender, gateways: [gateways.wethGateway] }))
addQuery(buildQueryParams({ sender, gateways: [gateways.customGateway] }))
addQuery(buildQueryParams({ sender, gateways: gateways.otherGateways }))
}

// receiver queries
addQuery(buildQueryParams({ receiver, gateways: [gateways.standardGateway] }))
addQuery(buildQueryParams({ receiver, gateways: [gateways.wethGateway] }))
addQuery(buildQueryParams({ receiver, gateways: [gateways.customGateway] }))
addQuery(buildQueryParams({ receiver, gateways: gateways.otherGateways }))
Copy link
Member Author

Choose a reason for hiding this comment

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

baiscally, all this was moved to fetchWithdrawals so you can have some more control from the outside

@spsjvc spsjvc marked this pull request as ready for review December 18, 2024 11:48
@@ -1,4 +1,4 @@
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import { Provider, StaticJsonRpcProvider } from '@ethersproject/providers'
Copy link
Member

Choose a reason for hiding this comment

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

unused import

@spsjvc spsjvc merged commit 28c9287 into master Dec 19, 2024
73 of 75 checks passed
@spsjvc spsjvc deleted the perf-optimize-withdrawals branch December 19, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants