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

use head (not header_head) when rewinding full blocks #3017

Merged
merged 2 commits into from
Sep 4, 2019

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Sep 3, 2019

Resolves #3016

This was nasty.
We fixed the rewind behavior in #3005 to rewind based on the header_head when rewinding the header MMR.

But this has now exposed a lingering issue when processing full blocks. We now need to rewind the txhashset MMRs (output, rangeproof, kernel) based on the chain head itself, not the head of the header MMR.

99% of the time these are consistent and this issue does not surface.
But if head and header_head diverge due to processing "header first" on a previous block we need to then be very careful with -

  • using head_head to rewind the header MMR (as in Fix invalid root #3005)
  • using head to rewind the txhashet MMRs (resolved in this PR)

Reworked the test coverage from #3005 and added additional test scenarios to exercise the problem seen in #3016.

@antiochp antiochp requested a review from garyyu September 3, 2019 12:26
@antiochp antiochp mentioned this pull request Sep 3, 2019
@antiochp antiochp self-assigned this Sep 3, 2019
@antiochp antiochp changed the title use head (not header_head) when rewinding for full blocks use head (not header_head) when rewinding full blocks Sep 3, 2019
@garyyu
Copy link
Contributor

garyyu commented Sep 3, 2019

Nice new test cases design 👍 and thanks for the fixing.

@garyyu garyyu merged commit b291467 into mimblewimble:master Sep 4, 2019
garyyu pushed a commit to gottstech/grin that referenced this pull request Sep 4, 2019
)

* use head (not header_head) when rewinding to find fork point for full blocks

* get rid of shortcut when nothing to rewind - always something to rewind
@antiochp antiochp deleted the fix_invalid_root_full_blocks branch September 4, 2019 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid Root
2 participants