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

Handle Reorgs #132

Open
willm30 opened this issue Sep 18, 2023 · 0 comments
Open

Handle Reorgs #132

willm30 opened this issue Sep 18, 2023 · 0 comments

Comments

@willm30
Copy link
Contributor

willm30 commented Sep 18, 2023

What is a reorg?

https://river.com/learn/terms/r/reorganization
https://cointelegraph.com/explained/what-is-chain-reorganization-in-blockchain-technology
https://www.alchemy.com/overviews/what-is-a-reorg

How to handle

Here are my notes from a call I had with Jakub, Raul and Alex:

when listening to blocks, for each block that comes in, we need to confirm that it's parent hash is the previous block we processed, else it's a reorg.

If it's a reorg, we need to go back the last block we saw that is consistent with the reorg, and re-sync from that block

We need to keep a list of the last 500 blocks we have processed, each block containing:

  • block number
  • block hash

-- We also need to think about undoing state changes in the db for blocks that got reorged (and which may, thus, no longer exist on chain)

Recommendations

Speak to Alex to remind yourself of the details before starting work on this.

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

No branches or pull requests

1 participant