ethereumjs-monorepo icon indicating copy to clipboard operation
ethereumjs-monorepo copied to clipboard

Trie inconsistency of del/put

Open jochem-brouwer opened this issue 3 years ago • 3 comments

If we put on a key where one of the nodes (i.e. the final one before we write a node) in the path is not available (i.e. get branch node key): do not care

If we delete a key where one of the nodes in the path is not available: throw

This is inconstent.

jochem-brouwer avatar Sep 14 '22 18:09 jochem-brouwer

Isn't this rather even close to a bug? 🤔

Is it somewhat recognizable on put that the operation then didn't work properly? Otherwise I would think this can be very much put in the bug-category and we should (I am not a trie expert, so feel free to comment/disagree) fix this by throwing for put as well (guess we can include this in a non-breaking release).

holgerd77 avatar Sep 15 '22 13:09 holgerd77

Well, if we start throwing on put as well, then this is breaking, right?

jochem-brouwer avatar Sep 16 '22 08:09 jochem-brouwer

Well, if we start throwing on put as well, then this is breaking, right?

Technically rather yes, though one could also put this in the bugfix-category (if my understanding is correct that in case of such a put operation you end up with a corrupt trie anyhow.

I would therefore be inclined to say: since this has somewhat the notion of a bugfix and we are super early with the breaking releases not being very much used/adopted yes, we can/could just take this in.

Also open for other voices here of course, just my thoughts and personal weightings.

holgerd77 avatar Sep 16 '22 11:09 holgerd77

Is this still a thing?

If so: we should fix/adjust before the breaking releases.

If not: we should close.

holgerd77 avatar Jul 31 '23 17:07 holgerd77

I'm not super sure what I wanted to do here, and if I think about it throwing on put makes no sense since it will insert paths for most cases anyways. So I will close, not sure what my line of thought here was.

jochem-brouwer avatar Aug 01 '23 08:08 jochem-brouwer

Ok, cool, thanks for the honest analysis. 🙂

holgerd77 avatar Aug 01 '23 09:08 holgerd77