-
Notifications
You must be signed in to change notification settings - Fork 991
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
Block input bitmap rework #3236
Merged
antiochp
merged 9 commits into
mimblewimble:master
from
antiochp:block_input_bitmap_rework
Feb 24, 2020
Merged
Block input bitmap rework #3236
antiochp
merged 9 commits into
mimblewimble:master
from
antiochp:block_input_bitmap_rework
Feb 24, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Will rebase once #3233 has been merged to fix the croaring issue. |
and reworking rewind to simply iterate over blocks, rewinding each incrementally
just use the order of the inputs in the block
antiochp
force-pushed
the
block_input_bitmap_rework
branch
from
February 21, 2020 15:26
73e13fc
to
00edeaa
Compare
jaspervdm
reviewed
Feb 21, 2020
I think these changes behave as expected, however I am not an expert in this area of the code. Would appreciate it if we have one additional review |
Making an executive decision to merge this now. Feel free to continue review post merge. |
This was referenced Feb 24, 2020
Merged
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #3235.
Extracted the "undo list" concept from the kernel index exploration (#3228) and took advantage of it for outputs (where undo == unspend during rewind).
This allows the
output_pos
index (quick lookup of output pos by output commitment) to more closely track the current utxo set in a transactional manner.We now keep the
output_pos
index updated when applying new blocks and when rewinding existing blocks under a fork scenario.This eliminates the edge-case of needing to account for "false positive" results in the index.
We still do not treat the
output_pos
as authoritative but there are currently believed to be no cases where it will temporarily diverge from the set of unspent output pos.We rebuild (via optimized
init
) the output_pos_index on -We log discrepencies between the index and set of outputs during index rebuild.
This should give us some insight into whether our assumptions are correct here.
If we are comfortable that we can begin treating this index as authoritative then we will only need to rebuild the index on sync (3) above.
This PR is a relatively large change in terms of code changes. But conceptually it is pretty straightforward.
output_pos
index when we callapply_block()
output_pos
on rewind (per block)We used to do something similar but not exactly the same -
The majority of the code change involves breaking the
rewind
functionality out to do it per iteratively block. Before we could simply take the union of all the per-block bitmaps. This has been reworked to rewind block by block to take advantage of our ability to rewind the index itself.We were originally hoping to get the
kernel_index
impl into3.1.0
but this was not possible given the timing of the3.1.0
release. This PR gives us a way of confirming the approach works on the existingoutput_pos
index.