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

Enable faster sync #3108

Merged
merged 10 commits into from
Nov 26, 2019
Merged

Enable faster sync #3108

merged 10 commits into from
Nov 26, 2019

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Nov 4, 2019

Non-consensus related implementation for RFC mimblewimble/grin-rfcs#29

  • refactor vec_backend so we can use it outside of tests
  • introduce a "hash only" vec_backend for the accumulator
  • introduce bitmap_accumulator -
    • MMR backed by a hash only vec backend
    • leaves are 1024 bit chunks of the leafset bitmap
    • it is relatively small, keep it in memory only
    • no need to store data in leaves (hash only) as data is maintained in the existing leafset
  • implement "rewind" logic so we handle bitmap_accumulator correctly during a fork/reorg
    • it is not append-only as the bitmap updates over time
  • build new bitmap accumulator root for each new block
    • log only (no consensus changes)

We will eventually be able to use this bitmap accumulator root to verify fragments of the leafset against subtrees of the existing output PMMR. This will allow us to verify "fast sync" data in chunks, without needing to download the full txhashset.zip which is increasingly becoming a bottleneck and single point of failure during initial fast sync.


TODO -

  • test coverage for various bitmap accumulator scenarios (particularly rewind)
  • test coverage for bitmap fragment serialization (endianness etc)

@antiochp antiochp added enhancement must-have Required for the associated milestone labels Nov 4, 2019
@antiochp antiochp added this to the 3.0.0 milestone Nov 4, 2019
@antiochp antiochp changed the title add bitmap accumulator Enable faster sync Nov 12, 2019
@antiochp antiochp marked this pull request as ready for review November 13, 2019 13:47
@antiochp antiochp self-assigned this Nov 13, 2019
@antiochp antiochp force-pushed the bitmap_acc branch 2 times, most recently from 8f9ebe6 to 6fe57ad Compare November 14, 2019 16:28
@antiochp
Copy link
Member Author

antiochp commented Nov 15, 2019

We now log this for every new block -

20191115 11:48:41.272 DEBUG grin_chain::types - validate roots: 00000c3194d8 at 435707, 
output_root: 4856008b7c31, output pmmr: 4856008b7c31 (bitmap: 7a488eb915b8, merged: 454f61a2a6df)

It would be good to get this merged and have multiple nodes deployed with this code so we can verify the merged root looks acceptable across a wider sample of nodes on the network.

Note: We are not currently using the merged root for validation, simply logging it for visibility.
The RFC proposal is to move to validating this root at the HF.

@quentinlesceller
Copy link
Member

quentinlesceller commented Nov 15, 2019

@antiochp taking a look today this weekend.

@tromp
Copy link
Contributor

tromp commented Nov 15, 2019 via email

core/src/ser.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@tromp tromp left a comment

Choose a reason for hiding this comment

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

i added some comments and questions to the code diffs.

@antiochp antiochp force-pushed the bitmap_acc branch 2 times, most recently from a3bae98 to 57d5782 Compare November 20, 2019 12:50
@antiochp
Copy link
Member Author

I'm going to merge this now. It adds the accumulator without relying on it yet. And adds logging around the accumulator which I'd like to start seeing on multiple nodes on mainnet and floonet sooner rather than later.
There are no consensus changes in this PR - these are coming soon as part of the scheduled HF2.

@antiochp antiochp merged commit 11ac7d8 into mimblewimble:master Nov 26, 2019
@antiochp antiochp mentioned this pull request Dec 11, 2019
@antiochp antiochp deleted the bitmap_acc branch January 9, 2020 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement must-have Required for the associated milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants