Commit graph

12 commits

Author SHA1 Message Date
Daniel Liu
6d4670a4ec
core, trie: refactor trie API #26995 (#1147)
In this PR, all TryXXX(e.g. TryGet) APIs of trie are renamed to XXX(e.g. Get) with an error returned.

The original XXX(e.g. Get) APIs are renamed to MustXXX(e.g. MustGet) and does not return any error -- they print a log output. A future PR will change the behaviour to panic on errorrs.

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2026-01-16 15:51:13 +05:30
Daniel Liu
940fd2adbd
core, trie: port changes from pbss #26637 (#1127) 2025-12-07 15:38:38 +05:30
Daniel Liu
07328dcec4
core, eth, trie: abstract node scheme #25532 (#1123)
This PR introduces a node scheme abstraction. The interface is only implemented by `hashScheme` at the moment, but will be extended by `pathScheme` very soon.

Apart from that, a few changes are also included which is worth mentioning:

-  port the changes in the stacktrie, tracking the path prefix of nodes during commit
-  use ethdb.Database for constructing trie.Database. This is not necessary right now, but it is required for path-based used to open reverse diff freezer

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-11-17 11:25:08 +05:30
Daniel Liu
0b7b02b8e0
trie: lint whitespace #25312 (#1098) 2025-08-28 18:49:37 +08:00
Daniel Liu
d52bfaa5ca
all: introduce trie owner notion #24750 (#1090)
* cmd, core/state, light, trie, eth: add trie owner notion

* all: refactor

* tests: fix goimports

* core/state/snapshot: fix ineffasigns

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-08-22 16:37:39 +08:00
Paweł Bylica
ad16ad23a5 trie: more tests for stacktrie (#23936) 2025-04-07 16:44:32 +08:00
aaronbuchwald
f25180b7f8 trie: add missing copyright header (#23530)
* Add missing copyright header

* Update stacktrie_test.go

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2025-04-07 16:44:32 +08:00
Martin Holst Swende
e3efb24444 trie: make stacktrie support binary marshal/unmarshal (#22685) 2025-04-07 16:44:32 +08:00
Martin Holst Swende
a8bd860e2f trie: make stacktrie not mutate input values (#22673)
The stacktrie is a bit un-untuitive, API-wise: since it mutates input values.
Such behaviour is dangerous, and easy to get wrong if the calling code 'forgets' this quirk. The behaviour is fixed by this PR, so that the input values are not modified by the stacktrie.

Note: just as with the Trie, the stacktrie still references the live input objects, so it's still _not_ safe to mutate the values form the callsite.
2025-04-07 16:44:32 +08:00
Daniel Liu
3eb9f63513 core/types: implement DerivableList interface for transactions and receipts (#21502) 2025-04-07 16:44:32 +08:00
Martin Holst Swende
f7fd4af087 trie: stacktrie fixes (#21799)
* trie: fix error in stacktrie not committing small roots

* trie: improved tests

* trie: fix error in stacktrie with small nodes

* trie: add (skipped) testcase for stacktrie

* trie: fix docs in stacktrie
2025-04-07 16:44:32 +08:00
Daniel Liu
54f73e471f trie: Derivesha with stacktrie (#21407) 2025-04-07 16:44:32 +08:00