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

feat(lib/blocktree): Prune returns ordered pruned forks #3050

Closed
wants to merge 12 commits into from

Conversation

qdm12
Copy link
Contributor

@qdm12 qdm12 commented Jan 17, 2023

Changes

The blocktree Prune method returns a mapping from fork origin block hash (part of the canonical chain) to an ordered slice of block hashes forming the now-dropped forked chain of blocks.

This allows the pruner to be 'fork-aware' and to find which deltas can be deleted safely from each fork, on finalisation. For example if a dropped fork chain inserted database key XYZ, we should remove it BUT we need to ensure this same key was not inserted by a block on the canonical chain as well. To do this, we need all the dropped forks ordered to work with their deltas and compare them with the canonical chain.

Tests

go test -tags integration github.com/ChainSafe/gossamer/lib/blocktree

Issues

Needed for PR #2831

Primary Reviewer

@timwu20

@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Merging #3050 (54ae58f) into development (a179855) will increase coverage by 0.05%.
The diff coverage is 82.75%.

Additional details and impacted files
@@               Coverage Diff               @@
##           development    #3050      +/-   ##
===============================================
+ Coverage        51.01%   51.06%   +0.05%     
===============================================
  Files              224      224              
  Lines            28103    28127      +24     
===============================================
+ Hits             14336    14364      +28     
+ Misses           12385    12380       -5     
- Partials          1382     1383       +1     

@qdm12 qdm12 force-pushed the qdm12/lib/blocktree/prune-forks branch 2 times, most recently from 0ece6da to 1b0f3b1 Compare January 24, 2023 14:41
@qdm12 qdm12 force-pushed the qdm12/lib/blocktree/prune-forks branch 2 times, most recently from 51e79e9 to d297833 Compare January 25, 2023 13:50
@timwu20
Copy link
Contributor

timwu20 commented Feb 2, 2023

@qdm12 is this still required given we're removing the online pruner?

@qdm12
Copy link
Contributor Author

qdm12 commented Feb 4, 2023

@qdm12 is this still required given we're removing the online pruner?

Yes it's required for #2831 - I can bundle it in #2831 if you prefer though.

@qdm12 qdm12 force-pushed the qdm12/lib/blocktree/prune-forks branch from d297833 to a0487a9 Compare March 11, 2023 10:43
@timwu20 timwu20 closed this Aug 14, 2023
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