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

improve: Optimize getRunningBalances computation #2085

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

nicholaspai
Copy link
Member

@nicholaspai nicholaspai commented Feb 11, 2025

Improves relayer and monitor performance by loading more data from arweave optimistically, or in the relayer's case, not at all.

While working on across-protocol/sdk#884, I realized that the only usage of the BundleDataClient' getLatestPoolRebalanceRoot function is the InventoryClient's getLatestRunningBalances function.

getLatestPoolRebalanceRoot is unneccessarily complicated and I actually think we can bypass it entirely in the InventoryClient.

The goal of getLatestRunningBalances is to estimate the latest running balances most accurately. This can be done entirely with reconstructing a bundle:

  • get the last validated running balance for a chain and token
  • get all deposits for that chain and token sent after the last validated bundle end block corresponding to the running balance we computed in the first step
  • approximate all refunds taken on the chain and token since the last validated running balance we computed in the first step

@nicholaspai nicholaspai changed the title improve: Use optimized version of getLatestPoolRebalanceRoot improve: Optimize getRunningBalances computation Feb 12, 2025
@nicholaspai nicholaspai marked this pull request as ready for review February 12, 2025 20:03
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.

1 participant