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

Check for gaps in block numbers and throw if found during migration #282

Draft
wants to merge 18 commits into
base: celo10
Choose a base branch
from

Conversation

alecps
Copy link

@alecps alecps commented Dec 9, 2024

Fixes https://github.com/celo-org/celo-blockchain-planning/issues/832

Tested locally using baklava datadir with gaps

Copy link

@palango palango left a comment

Choose a reason for hiding this comment

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

Looks good, but I wonder if we should have a separate command to check a datadir before the migration, independent of the pre-migration. What do you think?

op-chain-ops/cmd/celo-migrate/ancients.go Outdated Show resolved Hide resolved
op-chain-ops/cmd/celo-migrate/ancients.go Outdated Show resolved Hide resolved
op-chain-ops/cmd/celo-migrate/non-ancients.go Outdated Show resolved Hide resolved
@alecps alecps changed the title check for gaps in block numbers and throw if found during migration Check for gaps in block numbers and throw if found during migration Dec 10, 2024
@alecps alecps force-pushed the alecps/migrationBlockGaps branch from 6842c02 to 8c18e28 Compare December 10, 2024 20:07
@alecps
Copy link
Author

alecps commented Dec 10, 2024

@palango Interesting idea. I need to think about that a bit more. My first reaction is that it would add an extra step + time to the migration process. I'm also trying to work out if it's even possible to have gaps in ancient blocks, as the ancient db is append only. Having a separate script could be a quick way to bring extra piece of mind. Will give this some more thought tomorrow

@palango
Copy link

palango commented Dec 11, 2024

@palango Interesting idea. I need to think about that a bit more. My first reaction is that it would add an extra step + time to the migration process. I'm also trying to work out if it's even possible to have gaps in ancient blocks, as the ancient db is append only. Having a separate script could be a quick way to bring extra piece of mind. Will give this some more thought tomorrow

Not a requirement, but it might be too late for a full resync if people run the pre-migration shortly before the schedules block.

@piersy
Copy link

piersy commented Dec 11, 2024

My feeling is that a separate command for this is unnecessary, if we want people to check this earlier then we should just message them to run the pre-migration earlier.

@alecps alecps marked this pull request as draft December 12, 2024 20:22
@alecps
Copy link
Author

alecps commented Dec 12, 2024

I've observed some strange behavior that I want to look into more. It seems there may be an earlier gap that this branch does not detect that is preventing blocks from freezing beyond block 5,002,000. This branch only throws on a later gap that starts at block 5835918. It's possible this is a partial gap, where only receipt data is missing. Will re-open this for review when I've gotten to the bottom of what's going on

@alecps alecps force-pushed the alecps/migrationBlockGaps branch from 3bb956f to 66c7b86 Compare December 18, 2024 03:06
@alecps alecps marked this pull request as ready for review December 18, 2024 03:07
@alecps alecps requested review from piersy and palango December 18, 2024 03:07
@alecps
Copy link
Author

alecps commented Dec 18, 2024

I added checks for all the necessary data (receipts, headers, total difficulty, etc.) for both ancient and non-ancient blocks. The script before only checked for gaps in headers. I haven't been able to test with gaps in ancients because I haven't been able to get a node to freeze blockls beyond the first gap. It's unclear whether it's possible to actually have a gap in the ancient data.

@alecps
Copy link
Author

alecps commented Dec 18, 2024

@palango After thinking about it more, I do actually think it would be nice to have a command for testing data integrity. Though it isn't strictly necessary, it might be appreciated by anyone who runs into data corruption issues and wants to quickly check whether the database they're using is okay before trying a second time. We could even consider recommending that people run it first as a precaution, but that might not be necessary. I think it might make sense to add in a follow up PR so that this one doesn't get too big. What do you think?

@palango
Copy link

palango commented Dec 18, 2024

@palango After thinking about it more, I do actually think it would be nice to have a command for testing data integrity. Though it isn't strictly necessary, it might be appreciated by anyone who runs into data corruption issues and wants to quickly check whether the database they're using is okay before trying a second time. We could even consider recommending that people run it first as a precaution, but that might not be necessary. I think it might make sense to add in a follow up PR so that this one doesn't get too big. What do you think?

Totally agree, this can be added separately. And maybe this doesn't need to be coupled to the migration at all, even though it would make sense to reuse code if possible.

@alecps alecps marked this pull request as draft December 19, 2024 22:40
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