-
Notifications
You must be signed in to change notification settings - Fork 54
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
improve(TokenClient): multicall balance & allowance queries #1496
Merged
Conversation
This file contains 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
TokenClient update is occasionally observed to hang for 10s of seconds. It's a surprisingly RPC-intensive method because it issues a parallel RPC query for each supported token on a chain. This doesn't scale well with each new chain or token that's added, so bundle the queries into a multicall. The legacy implementation is retained for chains that don't support multicall3, which is nominally just hardhat in test.
pxrl
commented
May 8, 2024
pxrl
commented
May 8, 2024
pxrl
commented
May 8, 2024
I've factored out the multicall3 aggregate() call to the SDK. The corresponding PR is here: across-protocol/sdk#644. This PR is now subject to that going in and a new SDK being produced. |
nicholaspai
approved these changes
May 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One potential code reuse suggestion otherwise lgtm
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.
TokenClient update is occasionally observed to hang for 10s of seconds. It's a surprisingly RPC-intensive method because it issues a parallel RPC query for each supported token on a chain. This doesn't scale well with each new chain or token that's added, so bundle the queries into a multicall. The legacy implementation is retained for chains that don't support multicall3, which is nominally just hardhat in test.
To simplify this change, split out the HubPool BondToken query from the regular update() call. The BondToken part is so specific that it could optionally be pulled out of the TokenClient entirely.