Commit graph

226 commits

Author SHA1 Message Date
Daniel Liu
793293f041
trie: move locking into trieDB insert method #25030 (#1091)
Move locking into trieDB insert function

Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
2025-08-22 16:38:30 +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
Daniel Liu
ee81b721fc
core, trie: implement trie tracer #24403 (#1088)
Trie tracer is an auxiliary tool to capture all deleted nodes
which can't be captured by trie.Committer. The deleted nodes
can be removed from the disk later.

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-08-21 13:38:56 +08:00
Daniel Liu
a8b841c0a0
trie: implement NodeBlob API for trie iterator #24391 (#1084)
This functionality is needed in new path-based storage scheme, but
can be implemented in a seperate PR though.

When an account is deleted, then all the storage slots should be
nuked out from the disk as well. In hash-based storage scheme they
are still left in the disk but in new scheme, they will be iterated
and marked as deleted.

But why the NodeBlob API is needed in this scenario? Because when
the node is marked deleted, the previous value is also required to
be recorded to construct the reverse diff.

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-08-20 16:28:58 +08:00
Daniel Liu
9cad0a0cc0
all: create global hasher pool #31769 (#1233)
This PR creates a global hasher pool that can be used by all packages.
It also removes a bunch of the package local pools.

It also updates a few locations to use available hashers or the global
hashing pool to reduce allocations all over the codebase.
This change should reduce global allocation count by ~1%

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-08-20 15:11:09 +08:00
Daniel Liu
13fe871c25
trie: test for edgecase in VerifyRangeProof #24257 (#1083) 2025-08-20 15:04:35 +08:00
Daniel Liu
b196b7231c
trie: fix range prover #24266 (#1082)
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-08-20 14:54:24 +08:00
Daniel Liu
5702df86ee
trie: readonly interface for trie iterator resolver #24221 (#1081) 2025-08-20 14:52:56 +08:00
Daniel Liu
a75fa97f56
core, trie: use db.has over db.get where possible #24117 (#1078) 2025-08-20 14:51:32 +08:00
Daniel Liu
8750881da2
trie: remove the sync bloom, used by fast sync #24047 (#1077) 2025-08-08 09:31:26 +08:00
Daniel Liu
f0ee1211cc
trie: reject deletions when verifying range proofs #23960 (#1076)
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2025-08-08 09:23:50 +08:00
Daniel Liu
3da4549e07
core/state: move state account to core/types + abstracted write account to trie #23567 (#1072) 2025-08-08 09:13:34 +08:00
Daniel Liu
7464f0a7f3
trie: better error-handling #23657 (#1073) 2025-08-04 14:38:48 +08:00
Daniel Liu
655f975bbb
trie: simplify range proofs #22762 (#1067) 2025-08-04 14:36:02 +08:00
Daniel Liu
cb888541c5
core, trie: add state metrics #23433 (#1071) 2025-08-04 11:19:42 +08:00
Daniel Liu
77522e51ec
core, trie: decode the value for storage dump #19943 (#1189)
* core, trie: decode the value for storage dump

* core/state: address comment

Co-authored-by: gary rong <garyrong0905@gmail.com>
2025-07-28 16:52:06 +08:00
Daniel Liu
cf5766177a
trie: remove the duplicate write for preimage #23001 (#1068) 2025-07-28 16:50:39 +08:00
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