-
Notifications
You must be signed in to change notification settings - Fork 53
Automatic removal of orphan nodes #36
Automatic removal of orphan nodes #36
Conversation
sha256(testKey) = 0001... sha256(testKey2) = 1000... sha256(foo) = 0010...
no case produces nil sideNodes; nothing modifies the stored hashes
avoids ambiguity when pruning values
Thanks for continuing this work and this PR! Changing the leaf value (341c998) seems to a breaking change. Is this necessary to implementing orphan removal, and why? There already shouldn't be any ambiguity about which key a leaf is for, as it's already prefixed in the leaf's value. |
@musalbas sorry, my commit message wasn't very clear. The problem only arises when deleting a leaf with a duplicate value - there's no way to know if a value is still referenced by another leaf. Another solution would be some kind of reference count. (this test case fails when using just |
@roysc The implementation storing the hash of the value for the leaf value is an implementation detail. It's in no way required. You could instead store values in the separate map I suggest you start by refactoring as per #14, then pruning will follow readily. Feel free to re-open this PR or a new one if you can get pruning working without modifying the current test suite (unless there's a bug in them of course). |
@adlerjohn my apologies for not respecting the commitment spec. Using And could you clarify what you mean by modifying the current test suite? Are you referring only to the changes in the commitment spec, or changes in the LazyLedger/Celestia core? I haven't modified any existing tests here. |
Yes, the suggestion is a separate KV store just for values. There's no inherent reason to put both values and nodes in the same KV store.
Yes, to clarify I mean that the commitment as specified here must be the same before and after any PR dealing with implementation details. |
I'm not able to reopen this PR, new one: #37 |
Completes work from #24 :