Elizaveta Chichindaeva
28908aa3cf
[ #2442 ] English Check
...
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Anna Shaleva
36808b8904
core: clone MPT node while restoring it multiple times
...
We need this to avoid collapse collisions. Example of such collapse
described in
https://github.com/nspcc-dev/neo-go/pull/2019#discussion_r689629704 .
2021-09-07 19:43:27 +03:00
Evgeniy Stratonikov
bd2b1a0521
mpt: add Size
method to trie nodes
...
Knowing serialized size of the node is useful for
preallocating byte-slice in advance.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-06 12:01:16 +03:00
Evgeniy Stratonikov
db80ef28df
mpt: move empty hash node in a separate type
...
We use them quite frequently (consider children for a new branch
node) and it is better to get rid of unneeded allocations.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-06 12:01:16 +03:00
Evgeniy Stratonikov
5b1f6207de
mpt: reduce max key length
...
The constant used is actually a nibbled-path restriction.
Clarify this and make them private.
2021-06-04 11:09:17 +03:00
Anna Shaleva
7f038bd465
mpt: split HashNode in two types
...
First type is non-empty HashNode, and the second one is an Empty node.
2021-04-01 10:19:57 +03:00
Anna Shaleva
7dc9f0bde2
mpt: swap Leaf and Node types
2021-04-01 10:17:08 +03:00
Evgenii Stratonikov
fd9ff4102a
mpt: export func for decoding node with type
...
`NodeObject` can contain auxilliary fields and shouldn't be used from outside.
2020-11-19 12:25:43 +03:00
Roman Khimov
475bf2445a
mpt: restructure nodes a bit, implement serialization and hash cache
...
It drastically reduces the number of allocations and hash calculations.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-30 12:42:15 +03:00
Evgenii Stratonikov
f0b85f8af7
mpt: implement JSON marshaling/unmarshaling
...
Because there is no distinct type field in JSONized nodes, distinction
is made via payload itself, thus all unmarshaling is done via
NodeObject.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-30 12:42:15 +03:00
Evgenii Stratonikov
dc6741bce7
mpt: implement MPT trie
...
MPT is a trie with a branching factor = 16, i.e. it consists of sequences in
16-element alphabet.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-30 12:42:15 +03:00