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(SpokePool): Optimize which params are indexed #250

Merged
merged 2 commits into from
Mar 20, 2023
Merged

Conversation

nicholaspai
Copy link
Member

@nicholaspai nicholaspai commented Mar 15, 2023

This should be safe to merge post-audit since it only affects event params indexed property.

FundsDeposited and FilledRelay should index on originChainId/destinationChainid and depositId since this is all thats needed to uniquely identify a deposit.

This would make the relayer's job easier for certain functions like looking up a specific deposit for a fill, if it knows which SpokePool contract to look up events on, it can index on depositId and destinationChainId to efficiently find the deposit.

Conversely, if looking up a fill for a deposit, then the relayer would want to index on originChainId and depositId assuming it knows which SpokePool was the destination one and is the one it needs to query events on.

See this comment for example

`FundsDeposited` and `FilledRelay` should index on `originChainId`/`destinationChainid` and `depositId` since this is all thats needed to uniquely identify a deposit.

This would make the relayer's job easier for certain functions like looking up a specific deposit for a fill, if it knows which `SpokePool` contract to look up events on, it can index on `depositId` and `destinationChainId` to efficiently find the deposit.

Conversely, if looking up a fill for a deposit, then the relayer would want to index on `originChainId` and `depositId` assuming it knows which `SpokePool` was the destination one and is the one it needs to query events on.

See [this](https://github.com/across-protocol/relayer-v2/blob/master/src/clients/SpokePoolClient.ts#L316) comment for example
@nicholaspai nicholaspai requested review from mrice32 and pxrl March 15, 2023 14:13
Copy link
Contributor

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

Good call, makes sense!

@nicholaspai nicholaspai merged commit 3f5d16f into master Mar 20, 2023
@nicholaspai nicholaspai deleted the events branch March 20, 2023 22:20
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.

2 participants