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

feat: migrate SpokePoolIndexer to new Indexer #64

Conversation

amateima
Copy link
Contributor

@amateima amateima commented Oct 7, 2024

No description provided.

Copy link

linear bot commented Oct 7, 2024

@amateima amateima marked this pull request as draft October 7, 2024 10:58
@amateima amateima marked this pull request as ready for review October 7, 2024 11:03
this.insertWithFinalisationCheck(
entities.FilledV3Relay,
eventsChunk,
["depositId", "originChainId"],
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could override invalid fills that are stored in the database, should we use another set of keys? Maybe the relayHash

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

this.insertWithFinalisationCheck(
entities.RequestedSpeedUpV3Deposit,
eventsChunk,
["depositId", "originChainId"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add updatedOutputAmount, updatedMessage and updatedRecipient? Taking into account there could be more than one speedUp event for a single deposit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the transaction hash as the 3rd component of the unique key 👍

this.insertWithFinalisationCheck(
entities.TokensBridged,
eventsChunk,
["chainId", "leafId", "l2TokenAddress", "transactionHash"],
Copy link
Contributor

Choose a reason for hiding this comment

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

If transactionHash changes due to the reorg, I'm thinking we might end having both the first event we saw and the finalised one in the database. But the delete unfinalised query should handle this case, right?

Copy link
Contributor Author

@amateima amateima Oct 8, 2024

Choose a reason for hiding this comment

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

But the delete unfinalised query should handle this case, right?

Good observation. and yes, the delete unfinalised query should handle it

Comment on lines 103 to 104
configStoreClient.eventSearchConfig.toBlock = blockRange.to;
hubPoolClient.eventSearchConfig.toBlock = blockRange.to;
Copy link
Contributor

Choose a reason for hiding this comment

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

this toBlock refers to the SpokePool's chain? Should we somehow translate that to mainnet block numbers?

Copy link
Contributor Author

@amateima amateima Oct 8, 2024

Choose a reason for hiding this comment

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

Ah, you're right. I removed the to blocks for the config client and hub client

@amateima amateima requested a review from melisaguevara October 8, 2024 07:58
Copy link
Contributor

@melisaguevara melisaguevara left a comment

Choose a reason for hiding this comment

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

lgtm! 😄

@amateima amateima merged commit 048b8b6 into master Oct 8, 2024
3 checks passed
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.

3 participants