-
Notifications
You must be signed in to change notification settings - Fork 61
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
Swap nodes issue #337
Comments
AFAICT |
With multi-block proof you only validate once when you ingest the multi-block proof. Ex: Before verifying block 10, you ingest the accumulator proof for blocks 10-19. You don't receive any other accumulator proof until block 20. Maybe something is messing up with that part. This error is happening on block 18 after ingesting the multi-block proof before modifying block 10. |
Ok I think the issue is with the remembering with additions. I'm able to reproduce a simple example.
We have the above forest before doing any modifications at block 7. We'll delete the following:
We delete
Now that we're finished with deletions, we add the following:
Since
Since this is multi-block proofs and we don't ingest/verify before each modification, the pollard does not change. Then at block 8 we have the following deletions but we result in an error because we forgot
I'm not quite sure how to go about it but it's seems to me that the way we're remembering leaves now won't work when you don't ingest/verify before every modification. One thing you could do is just have a populateWithoutProof() function that just tries to fill in what was forgotten but this seems inefficient. |
Cool find and interesting that this hasn't come up before, I guess multi-block is what's triggering it. What's happening in your example:
at this point 6 and 7 are unknown as well as 10. That makes sense & the remembering / pruning seems OK. The problem is when you delete 1, 3, 4, 5, then the deletion process wants to swap 11 and 9. The code currently won't let this happen and complains "sibling not found". When it swaps 9 and 11, it also needs to swap (2, 3) and (6, 7). (2, 3) is 9.niece, which is OK. (6, 7) is 10.niece, which would be a nil pointer crash, so This probably / hopefully won't break anything else. |
it does not trigger the problem in issue #337 though. It just swaps 1, 2
OK I made a branch "nilswap" and uploaded it here. I'm getting a different problem, because the deletion algorithm doesn't try to swap 9, 11, but instead just swaps 1, 2. Which means 12 isn't recomputed, which is should be! Will look at fixing that which may also fix the bug you had here. If you link to test code which gives the "sibling not found" error I can make sure. |
@adiabat The below code snippet recreates the error I had while testing the multi-block stuff.
|
One line change of
in the function
|
The code I had was actually producing the same error, I just was not catching any errors from Seems fixable |
I'm getting an error with
swapNodes()
when implementing caching for multi-block proofs. It works fine when the pollard remembers everything and just prunes everything but the roots for every range (ex: remember every utxo created between the blocks 10-19. Then prune to the roots right after modification at block 19).However, when trying to specify what to cache, I'm getting an error like so:
For the above forest, the targets are
[1 2 5 7 10 11 12 14 17]
. During modification, I'm getting an error withswapNodes()
:swapNodes 38 37 node not found
.Would the position
37
have to be remembered in the forest for the above deletion to work properly?The text was updated successfully, but these errors were encountered: