-
Notifications
You must be signed in to change notification settings - Fork 203
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: load withdrawal tx history by priority #2128
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -41,11 +39,9 @@ export async function fetchTokenWithdrawalsFromEventLogs({ | |||
const erc20Bridger = await Erc20Bridger.fromProvider(l2Provider) | |||
const promises: ReturnType<Erc20Bridger['getWithdrawalEvents']>[] = [] | |||
|
|||
const senderNonce = await getNonce(sender, { provider: l2Provider }) |
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.
moved to fetchWithdrawals.ts
so we do it just once
}: { | ||
sender?: string | ||
receiver?: string | ||
fromBlock: BlockTag | ||
toBlock: BlockTag | ||
l2Provider: Provider | ||
l2GatewayAddresses?: string[] | ||
}) { |
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.
extracted into type FetchTokenWithdrawalsFromEventLogsParams
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.
this function will now be used only to keep track of custom custom gateways
...s/arb-token-bridge-ui/src/util/withdrawals/fetchTokenWithdrawalsFromEventLogsSequentially.ts
Outdated
Show resolved
Hide resolved
const ethWithdrawalsFromEventLogs = await fetchETHWithdrawalsFromEventLogs({ | ||
receiver, | ||
fromBlock: toBlock + 1, | ||
toBlock: 'latest', | ||
l2Provider: l2Provider | ||
}) | ||
|
||
await wait(2_000) | ||
|
||
const tokenWithdrawalsFromEventLogs = |
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.
load eth withdrawals before token withdrawals
@@ -0,0 +1,3 @@ | |||
export function wait(ms: number) { |
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.
Not super sure about the filename since wait
is generic, doesn't have much to do with exponential wait-time, and might be hard to discover later.
Unless we plan on adding a lot more related functions here, I guess just having wait
from CommonUtils
would suffice?
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.
Will be taken up in next PR.
const standardGateway = network.tokenBridge?.childErc20Gateway | ||
const customGateway = network.tokenBridge?.childCustomGateway | ||
const wethGateway = network.tokenBridge?.childWethGateway | ||
const otherGateways = await fetchL2Gateways(provider) |
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.
Outside the scope of the current PR, but since it touches this code, we might want to rename fetchL2Gateways
to a better generic name. Infact I would suggest we don;t need the fetchL2Gateways
file anymore and we can move it inside this file only.
The function can be called fetchOtherGateways
to better match it's usage.
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.
Will be taken up in next PR.
Summary
Steps to test