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

Earlier prevention of processing if no parent state #6871

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

flcl42
Copy link
Contributor

@flcl42 flcl42 commented Mar 27, 2024

Fixes hive tests related to synchronization

Changes

  • Fix fast sync transition handling

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing (manual)

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

@flcl42 flcl42 force-pushed the bugfix/should-not-process-when-no-parent-state branch from d32cdc2 to 1786ccb Compare April 2, 2024 10:58
@flcl42 flcl42 marked this pull request as ready for review April 2, 2024 10:59
@flcl42 flcl42 self-assigned this Apr 2, 2024
@flcl42 flcl42 marked this pull request as draft April 2, 2024 15:06
if (shouldProcess)
{
BlockHeader? parentHeader = _blockTree.FindHeader(headers[0].ParentHash!);
if (parentHeader is not null && !_stateReader.HasStateForBlock(parentHeader))
Copy link
Contributor

@asdacap asdacap Apr 2, 2024

Choose a reason for hiding this comment

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

Can't we do it with full state finder and just check if the full state number is < parent header? I just don't like unnecessary change, probably not a big deal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, it could be the case that the state was downloaded (in another thread) and the state is the parent of parent causing this to never pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So we need to check for every block looks like

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 guess would be perfect to track what state is being downloaded and download blocks without processing till that block + don't download if potential state is not known

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sync event driven, not state-check-on-timer driven?

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.

None yet

2 participants