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

Fix for crosslink snap db. #4675

Merged
merged 2 commits into from
May 25, 2024
Merged

Fix for crosslink snap db. #4675

merged 2 commits into from
May 25, 2024

Conversation

Frozen
Copy link
Contributor

@Frozen Frozen commented May 22, 2024

Fix for crosslink snap db.

@Frozen Frozen self-assigned this May 22, 2024
@sophoah
Copy link
Contributor

sophoah commented May 23, 2024

Here the reasoning for that PR :

Crosslink before an epoch or blocks that have been pruned using snapDB will set exist to nil in
https://github.com/harmony-one/harmony/blob/main/node/node_newblock.go#L243

exist, err := node.Blockchain().ReadCrossLink(pending.ShardID(), pending.BlockNum())

This is what happened last time in mainnet when we tried to add a crosslink for a block/epoch we didn't have. Our solution back then was to remove those pending crosslink because we knew they were already processed.

in theory, crosslink already added on s0 chain are all continuous, so we can create a function that check the lastcrosslink (added on chain) and delete the pending crosslink when the block number in the shard to be processed is older.

@GheisMohammadi GheisMohammadi self-requested a review May 23, 2024 11:57
@Frozen Frozen merged commit 8abcc74 into dev May 25, 2024
4 checks passed
@Frozen Frozen deleted the fix/crosslink-snap-db branch May 25, 2024 22:24
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