This is a different approach from #401, but I'm not completely sure that it fixes the exact same bug. TLDR: when PBSS was introduced, we started using UnknownNode since there can no longer be a reference to the child in the parent.
Notably, this replaced HashedNodes containing a commitment and a stem, which could be used in the event a key [a, b, c, d, ...] was read/written to a proof-of-absence stem [a, b, c, e, ...]. This can happen during the re-execution of a block, in which a new leaf is created, that shares a prefix with a proof-of-absence stem.
If the UnkownNode no longer exists, reading/writing this new key no longer works. To fix this, this PR introduces an optional stem field in UnkownNode, which purpose is to hold this "proof of absence stem" that is currently missing from the tree, so that one can detect if a read/write is invalid execution, or should return nil/insert a new LeafNode.
This PR comes with a test, that should be moved to #400.
401 got merged. It didn't end up being as simple as I hoped, but it's true that it has the advantage of not needed a special handling case in the parent, so the child call will work correctly no matter what the parent's context is. It's more maintainable, eventhough it's a tad less readable imo but time will tell.
This is a different approach from #401, but I'm not completely sure that it fixes the exact same bug. TLDR: when PBSS was introduced, we started using
UnknownNode
since there can no longer be a reference to the child in the parent. Notably, this replacedHashedNode
s containing a commitment and a stem, which could be used in the event a key[a, b, c, d, ...]
was read/written to a proof-of-absence stem[a, b, c, e, ...]
. This can happen during the re-execution of a block, in which a new leaf is created, that shares a prefix with a proof-of-absence stem.If the
UnkownNode
no longer exists, reading/writing this new key no longer works. To fix this, this PR introduces an optionalstem
field inUnkownNode
, which purpose is to hold this "proof of absence stem" that is currently missing from the tree, so that one can detect if a read/write is invalid execution, or should returnnil
/insert a newLeafNode
.This PR comes with a test, that should be moved to #400.