Commit graph

209 commits

Author SHA1 Message Date
Daniel Liu
f552cebfcd
trie: remove redundant returns + use stacktrie where applicable #22760 (#1066)
* trie: add benchmark for proofless range

* trie: remove unused returns + use stacktrie

Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-07-28 16:49:31 +08:00
Daniel Liu
a9d4fffc97
trie: move fuzzers into native packages #28467 (#1239) 2025-07-17 17:55:19 +08:00
Daniel Liu
8f90413200
trie: fix range prover #22210 (#1061)
Fixes a special case when the trie only has a single trie node and the range proof only contains a single element.

Co-authored-by: gary rong <garyrong0905@gmail.com>
2025-07-11 09:20:18 +08:00
Daniel Liu
8ba50ab2aa
trie: remove deprecated uses of math.rand (#1136) 2025-06-25 16:57:23 +08:00
Daniel Liu
416c5cb7dd
trie: upgarde for snap protocol #21482 (#1058) 2025-06-25 16:55:07 +08:00
Daniel Liu
dbe173e794
core, trie: speed up some tests with quadratic processing flaw #21987 (#1057) 2025-06-25 16:17:05 +08:00
Daniel Liu
937b3d75e0
core, eth, trie: prepare trie sync for path based operation #21504 (#1046) 2025-06-21 08:30:25 +08:00
Daniel Liu
ea459d68a3
trie: fix spelling mistakes (#1122) 2025-06-20 16:29:57 +08:00
Daniel Liu
3a6beedb8c
trie: fix parallel typo in trie/hasher.go #25241 (#1095) 2025-06-17 13:32:04 +08:00
Daniel Liu
6200e8d7de
core, trie: change format 0x%x to %#x #25221 (#1094) 2025-06-17 13:31:20 +08:00
Daniel Liu
dabaf392a7
trie: fix size accounting in cleaner #25007 (#1093)
Decrease children size instead of dirties size when marking dirties as cleaned up in trie cleaner

Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
2025-06-17 13:29:57 +08:00
Daniel Liu
e4de0e82a2
trie: remove unused makeHashNode #24702 (#1089)
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
2025-06-17 13:28:59 +08:00
Daniel Liu
205a94ea4f
trie: fix two issues in trie iterator #24539 (#1086)
* trie: fix memory leak in trie iterator

In the trie iterator, live nodes are tracked in a stack while iterating.
Popped node states should be explictly set to nil in order to get
garbage-collected.

* trie: fix empty trie iterator
2025-06-17 13:27:57 +08:00
Daniel Liu
f07824db20
core, ethdb, tests, trie: implement NewBatchWithSize API for batcher #24392 (#1085) 2025-06-17 13:26:50 +08:00
Daniel Liu
bebc87e2f0
trie: fix typos (#1080) 2025-06-17 13:25:40 +08:00
Daniel Liu
5e8a096844
eth/fetcher, trie: unit test reliability fixes #23020 #23415 (#1070)
Some tests take quite some time during exit, which I think causes
some appveyor fails like this:

    https://ci.appveyor.com/project/ethereum/go-ethereum/builds/39511210/job/xhom84eg2e4uulq3

One of the things that seem to take time during exit is waiting
(up to 100ms) for the syncbloom to close. This PR changes it to use
a channel, instead of looping with a 100ms wait.

This also includes some unrelated changes improving the reliability of
eth/fetcher tests, which fail a lot because they are time-dependent.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-06-17 13:21:18 +08:00
Daniel Liu
a41a92978d
trie: small optimization of delete in fullNode case #22979 (#1069) 2025-06-17 13:17:07 +08:00
Daniel Liu
1f05c3e5fd
trie: reuse dirty data instead of hitting disk when generating #22667 (#1065)
* core/state/snapshot: reuse memory data instead of hitting disk when generating

* trie: minor nitpicks wrt the resolver optimization

* core/state/snapshot, trie: use key/value store for resolver

* trie: fix linter

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2025-06-17 13:15:22 +08:00
Daniel Liu
45d89bd4d1
trie: faster snapshot generation #22504 (#1062) 2025-06-17 13:13:14 +08:00
Daniel Liu
93c2745b7b
all: disable recording preimage of trie keys #21402 (#1054) 2025-06-17 13:10:47 +08:00
Daniel Liu
d6cecbf570
trie: extend range proof #21250 (#1050) 2025-06-17 13:06:36 +08:00
Daniel Liu
1490033ec9
trie: fix typos #23768 (#1074) 2025-06-04 17:13:58 +08:00
Daniel Liu
7fbf862806
trie: improve the node iterator seek operation #22470 (#1064) 2025-06-03 12:18:46 +08:00
Daniel Liu
958ad72b8e
trie: fix bloom crash on fast sync restart #22332 (#1060) 2025-06-03 11:54:40 +08:00
Daniel Liu
b18f9f2705
trie: use github.com/holiman/bloomfilter/v2 #22044 (#1059) 2025-06-03 11:52:45 +08:00
Daniel Liu
c4a98d2ddb
trie: remove redundant conversions (#1056) 2025-06-03 11:50:02 +08:00
Daniel Liu
aa7c8644c3
all: fix tests on 32-bit and windows + minor rpc fixes #21871 (#1055) 2025-06-03 11:47:11 +08:00
Daniel Liu
63ff193931
trie: avoid copybytes for stacktrie #22686 (#1063)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-06-03 10:58:46 +08:00
Daniel Liu
5b071d1b0d
trie: rename NodeFlag to nodeFlag (#1049) 2025-05-26 15:18:47 +08:00
Daniel Liu
5dd41a6765
trie: support empty range proof #21199 (#1048)
Co-authored-by: gary rong <garyrong0905@gmail.com>
2025-05-26 15:18:14 +08:00
Daniel Liu
b9626bfebf
trie: fix gaped range proof test case #21484 (#1047)
Co-authored-by: gary rong <garyrong0905@gmail.com>
2025-05-26 15:17:31 +08:00
Daniel Liu
6395c15280
core/state, eth, trie: stabilize memory use, fix memory leak #21491 (#1040) 2025-05-20 15:14:47 +08:00
Daniel Liu
b94b29b8d0
trie: check nil bloom (#1039) 2025-05-20 15:13:34 +08:00
Daniel Liu
b9a6c8c32d
cmd, core, eth, trie: add trie read caching layer (#18087) (#946) 2025-04-16 17:27:43 +08:00
Daniel Liu
5759893f2b
trie: quell linter warnings in commiter.go (#21329) (#945) 2025-04-16 17:10:42 +08:00
Daniel Liu
bf893cb73b
trie: reduce allocs in insertPreimage (#21261) (#943)
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2025-04-16 17:08:31 +08:00
Daniel Liu
5328a637c0 trie: use unified emptyRootHash and emptyCodeHash (#26718) 2025-04-07 16:44:32 +08:00
Daniel Liu
c8b39cabae trie: faster trie node encoding (#24126) 2025-04-07 16:44:32 +08:00
Paweł Bylica
4df7801137 trie: simplify StackTrie implementation (#23950)
Trim the search key from head as it's being pushed deeper into the trie. Previously the search key was never modified but each node kept information how to slice and compare it in keyOffset. Now the keyOffset is not needed as this information is included in the slice of the search key. This way the keyOffset can be removed and key manipulation
simplified.
2025-04-07 16:44:32 +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
Daniel Liu
dcea73039c trie: bloom-filter based pruning mechanism (#21724) 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
Martin Holst Swende
87270e3988 trie: fix flaw in stacktrie pool reuse (#21699) 2025-04-07 16:44:32 +08:00
gary rong
1424987768 trie: polish commit function (#21692)
* trie: polish commit function

* trie: fix typo
2025-04-07 16:44:32 +08:00
gary rong
9da3ae1075 trie: polishes to trie committer (#21351)
* trie: update tests to check commit integrity

* trie: polish committer

* trie: fix typo

* trie: remove hasvalue notion

According to the benchmarks, type assertion between the pointer and
interface is extremely fast.

BenchmarkIntmethod-12           1000000000               1.91 ns/op
BenchmarkInterface-12           1000000000               2.13 ns/op
BenchmarkTypeSwitch-12          1000000000               1.81 ns/op
BenchmarkTypeAssertion-12       2000000000               1.78 ns/op

So the overhead for asserting whether the shortnode has "valuenode"
child is super tiny. No necessary to have another field.

* trie: linter nitpicks

Co-authored-by: Martin Holst Swende <martin@swende.se>
2025-04-07 16:44:32 +08:00
Daniel Liu
54f73e471f trie: Derivesha with stacktrie (#21407) 2025-04-07 16:44:32 +08:00