rjl493456442
59ac229f87
core/state/snapshot: detect and clean up dangling storage snapshot in generation ( #24811 )
...
* core/state/snapshot: check dangling storages when generating snapshot
* core/state/snapshot: polish
* core/state/snapshot: wipe the last part of the dangling storages
* core/state/snapshot: fix and add tests
* core/state/snapshot: fix comment
* README: remove mentions of fast sync (#24656 )
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
* core, cmd: expose dangling storage detector for wider usage
* core/state/snapshot: rename variable
* core, ethdb: use global iterators for snapshot generation
* core/state/snapshot: polish
* cmd, core/state/snapshot: polish
* core/state/snapshot: polish
* Update core/state/snapshot/generate.go
Co-authored-by: Martin Holst Swende <martin@swende.se>
* ethdb: extend db test suite and fix memorydb iterator
* ethdb/dbtest: rollback changes
* ethdb/memorydb: simplify iteration
* core/state/snapshot: update dangling counter
* core/state/snapshot: release iterators
* core/state/snapshot: update metrics
* core/state/snapshot: update time metrics
* metrics/influxdb: temp solution to present counter meaningfully, remove it
* add debug log, revert later
* core/state/snapshot: fix iterator panic
* all: customized snapshot iterator for backward iteration
* core, ethdb: polish
* core/state/snapshot: remove debug log
* core/state/snapshot: address comments from peter
* core/state/snapshot: reopen the iterator at the next position
* ethdb, core/state/snapshot: address comment from peter
* core/state/snapshot: reopen exhausted iterators
Co-authored-by: Tbnoapi <63448616+nuoomnoy02@users.noreply.github.com>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Marius van der Wijden
86d5477079
core/state/snapshot: fix race condition ( #24685 )
...
Fixes three race conditions found through fuzzing by David Theodore
3 years ago
s7v7nislands
5a584c2133
all: use common.FileExist for checking file existence ( #24748 )
3 years ago
Martin Holst Swende
0914234d10
cmd/geth, core/state/snapshot: fix flaw in dangling-storage check + inspect difflayers ( #24677 )
...
This PR fixes the flaw that @rjl493456442 found in https://github.com/ethereum/go-ethereum/pull/#issuecomment-1093817551 , namely, that the snapshot iterator uses the combined (disk + difflayers) 'view', wheres the raw iterator uses only the disk 'view'.
This PR instead splits up the work: one phase is iterating the disk layer data, another phase is loading the journalled difflayers and performing the same check there.
3 years ago
Eng Zer Jun
8d066f1f42
all: use T.TempDir to create temporary test directories ( #24633 )
...
This commit replaces ioutil.TempDir with t.TempDir in tests. The
directory created by t.TempDir is automatically removed when the test
and all its subtests complete.
Prior to this commit, temporary directory created using ioutil.TempDir
had to be removed manually by calling os.RemoveAll, which is omitted in
some tests. The error handling boilerplate e.g.
defer func() {
if err := os.RemoveAll(dir); err != nil {
t.Fatal(err)
}
}
is also tedious, but t.TempDir handles this for us nicely.
Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
3 years ago
Péter Szilágyi
f6891ba40d
core/state/snapshot: remove noop map item assignment
3 years ago
rjl493456442
25bd17d725
core/state/snapshot: clean up the generation code ( #24479 )
3 years ago
aaronbuchwald
c3701b265e
core/rawdb: add specified key length iterator ( #24535 )
3 years ago
Ceyhun Onur
8401e4277a
core/rawdb: add HasCode, HashTrieNode and use them where possible ( #24454 )
3 years ago
Péter Szilágyi
48605b5f61
core/statedb: always clear out access list when setting a new one
3 years ago
Martin Holst Swende
51e7968b8b
core/state: fix read-meters + simplify code ( #24304 )
3 years ago
Martin Holst Swende
51eb5f8ca8
cmd/geth: add db cmd to show metadata ( #23900 )
...
* cmd/geth: add db cmd to show metadata
* cmd/geth: better output generator status
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
* cmd: minor
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
3 years ago
Péter Szilágyi
58d1988349
core, eth, les, trie: remove the sync bloom, used by fast sync
3 years ago
Taeik Lim
85064ed09b
all: fix 'the the' in comments ( #24036 )
3 years ago
Martin Holst Swende
9055cc14ec
core/vm, core/state/snapshot: remove unused code ( #23956 )
...
* core/state/snapshot: remove wiper functionality
* core/vm: remove unused 'unofficial' opcodes
3 years ago
Martin Holst Swende
526c3f6b9e
core/state/snapshot: fix benchmarks ( #23804 )
3 years ago
Ziyuan Zhong
312e02bca9
core/state/snapshot: fix BAD BLOCK error when snapshot is generating ( #23635 )
...
* core/state/snapshot: fix BAD BLOCK error when snapshot is generating
* core/state/snapshot: alternative fix for the snapshot generator
* add comments and minor update
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
rjl493456442
f915f6873f
core/state/snapshot: fix data race in layer flattening ( #23628 )
...
* core/state/snapshot: fix data race in layer flattening
* core/state/snapshot: fix typo
3 years ago
hsyodyssey
84bccd0900
core/state: fix typos in comments ( #23702 )
3 years ago
hsyodyssey
12f971fb2d
core/state: fix typo in comment ( #23665 )
3 years ago
Guillaume Ballet
443afc975c
core/state: move state account to core/types + abstracted "write account to trie" ( #23567 )
...
* core/state: abstracted "write account to trie" method
* fix appveyor build
* Apply suggestions from code review
Co-authored-by: Martin Holst Swende <martin@swende.se>
* review feedback
* core/state/accounts: move Account to core/types
* core/types: rename Account -> StateAccount
* core/state: restore EncodeRLP for stateObject
* core/types: add the missing file
* more review feedback
* more review feedback
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
3 years ago
Ikko Ashimine
31be5d41d9
core: fix typo in iterator.go ( #23502 )
...
strorage -> storage
3 years ago
gary rong
a5a5237178
core, light, tests, trie: add state metrics ( #23433 )
3 years ago
Péter Szilágyi
9d6480c3cd
core/state/snapshot: gofmt
3 years ago
Tyler Chambers
66948316f7
core/state/snapshot: clarify comment about snapshot repair ( #23305 )
...
Co-authored-by: Tyler Chambers <me@tylerchambers.net>
Co-authored-by: Felix Lange <fjl@twurst.com>
3 years ago
Ziyuan Zhong
57d9e0ac75
core/state/snapshot: fix typo in comment ( #23219 )
3 years ago
Péter Szilágyi
3b38a83274
core/state/pruner: fix state bloom sync permission in Windows
3 years ago
Marius van der Wijden
28ba686cbf
core/state: add trie prefetcher tests ( #23216 )
...
* core/state: add trie prefetcher tests
* core/state: add missing license
3 years ago
aaronbuchwald
82c5085399
cre/state: fix outdated statedb Prepare comment ( #23320 )
3 years ago
Marius van der Wijden
8fe47b0a0d
core/state: avoid unnecessary alloc in trie prefetcher ( #23198 )
3 years ago
Marius van der Wijden
686b2884ee
all: removed blockhash from statedb ( #23126 )
...
This PR removes the blockhash from the statedb
3 years ago
Li Dongwei
bca8c03e57
core/state: remove unused methods ReturnGas, GetStorageProofByHash ( #23092 )
...
Co-authored-by: lidongwei <lidongwei@huobi.com>
3 years ago
Guillaume Ballet
2cde472650
core/state: fix typos in test error message ( #22962 )
3 years ago
gary rong
c73652da0b
core/state/snapshot: fix flaky tests ( #22944 )
...
* core/state/snapshot: fix flaky tests
* core/state/snapshot: fix tests
4 years ago
Martin Holst Swende
addd8824cf
cmd/geth, eth, core: snapshot dump + unify with trie dump ( #22795 )
...
* cmd/geth, eth, core: snapshot dump + unify with trie dump
* cmd/evm: dump API fixes
* cmd/geth, core, eth: fix some remaining errors
* cmd/evm: dump - add limit, support address startkey, address review concerns
* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
4 years ago
Martin Holst Swende
cc606be74c
all: define London+baikal, undefine yolov3, add london override flag ( #22822 )
...
* all: define London+baikal, undefine yolov3, add london override flag
* cmd, core, params: add baikal genesis definition
4 years ago
Péter Szilágyi
745757ac6b
core, eth: abort snapshot generation on snap sync and resume later
4 years ago
aaronbuchwald
bbb57fd64b
core/state: remove toAddr helper in tests ( #22772 )
4 years ago
Péter Szilágyi
fae165a5de
core, eth, ethdb, trie: simplify range proofs
4 years ago
Martin Holst Swende
a81cf0d2b3
trie: remove redundant returns + use stacktrie where applicable ( #22760 )
...
* trie: add benchmark for proofless range
* trie: remove unused returns + use stacktrie
4 years ago
Martin Holst Swende
49281ab84f
core/state/snapshot, true: reuse dirty data instead of hitting disk when generating ( #22667 )
...
* 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: Péter Szilágyi <peterke@gmail.com>
4 years ago
gary rong
d6ffa14035
core: nuke legacy snapshot supporting ( #22663 )
4 years ago
Martin Holst Swende
09d44e9925
core/state/snapshot: avoid copybytes for stacktrie
4 years ago
gary rong
7088f1e814
core, eth: faster snapshot generation ( #22504 )
...
* eth/protocols: persist received state segments
* core: initial implementation
* core/state/snapshot: add tests
* core, eth: updates
* eth/protocols/snapshot: count flat state size
* core/state: add metrics
* core/state/snapshot: skip unnecessary deletion
* core/state/snapshot: rename
* core/state/snapshot: use the global batch
* core/state/snapshot: add logs and fix wiping
* core/state/snapshot: fix
* core/state/snapshot: save generation progress even if the batch is empty
* core/state/snapshot: fixes
* core/state/snapshot: fix initial account range length
* core/state/snapshot: fix initial account range
* eth/protocols/snap: store flat states during the healing
* eth/protocols/snap: print logs
* core/state/snapshot: refactor (#4 )
* core/state/snapshot: refactor
* core/state/snapshot: tiny fix and polish
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
* core, eth: fixes
* core, eth: fix healing writer
* core, trie, eth: fix paths
* eth/protocols/snap: fix encoding
* eth, core: add debug log
* core/state/generate: release iterator asap (#5 )
core/state/snapshot: less copy
core/state/snapshot: revert split loop
core/state/snapshot: handle storage becoming empty, improve test robustness
core/state: test modified codehash
core/state/snapshot: polish
* core/state/snapshot: optimize stats counter
* core, eth: add metric
* core/state/snapshot: update comments
* core/state/snapshot: improve tests
* core/state/snapshot: replace secure trie with standard trie
* core/state/snapshot: wrap return as the struct
* core/state/snapshot: skip wiping correct states
* core/state/snapshot: updates
* core/state/snapshot: fixes
* core/state/snapshot: fix panic due to reference flaw in closure
* core/state/snapshot: fix errors in state generation logic + fix log output
* core/state/snapshot: remove an error case
* core/state/snapshot: fix condition-check for exhausted snap state
* core/state/snapshot: use stackTrie for small tries
* core/state/snapshot: don't resolve small storage tries in vain
* core/state/snapshot: properly clean up storage of deleted accounts
* core/state/snapshot: avoid RLP-encoding in some cases + minor nitpicks
* core/state/snapshot: fix error (+testcase)
* core/state/snapshot: clean up tests a bit
* core/state/snapshot: work in progress on better tests
* core/state/snapshot: polish code
* core/state/snapshot: fix trie iteration abortion trigger
* core/state/snapshot: fixes flaws
* core/state/snapshot: remove panic
* core/state/snapshot: fix abort
* core/state/snapshot: more tests (plus failing testcase)
* core/state/snapshot: more testcases + fix for failing test
* core/state/snapshot: testcase for malformed data
* core/state/snapshot: some test nitpicks
* core/state/snapshot: improvements to logging
* core/state/snapshot: testcase to demo error in abortion
* core/state/snapshot: fix abortion
* cmd/geth: make verify-state report the root
* trie: fix failing test
* core/state/snapshot: add timer metrics
* core/state/snapshot: fix metrics
* core/state/snapshot: udpate tests
* eth/protocols/snap: write snapshot account even if code or state is needed
* core/state/snapshot: fix diskmore check
* core/state/snapshot: review fixes
* core/state/snapshot: improve error message
* cmd/geth: rename 'error' to 'err' in logs
* core/state/snapshot: fix some review concerns
* core/state/snapshot, eth/protocols/snap: clear snapshot marker when starting/resuming snap sync
* core: add error log
* core/state/snapshot: use proper timers for metrics collection
* core/state/snapshot: address some review concerns
* eth/protocols/snap: improved log message
* eth/protocols/snap: fix heal logs to condense infos
* core/state/snapshot: wait for generator termination before restarting
* core/state/snapshot: revert timers to counters to track total time
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
4 years ago
Edgar Aroutiounian
c79fc209cd
core/state/snapshot: fix data race in diff layer ( #22540 )
4 years ago
Péter Szilágyi
61ff3e86b2
core/state/snapshot, ethdb: track deletions more accurately ( #22582 )
...
* core/state/snapshot, ethdb: track deletions more accurately
* core/state/snapshot: don't reset the iterator, leveldb's screwy
* ethdb: don't mess with the insert batches for now
4 years ago
gary rong
76700ac892
core/state/pruner: move the compaction out of the pruning procedure ( #22579 )
...
The main idea behind it is: the range compaction is very expensive
which can take a few hours to finish. During this long procedure,
a lot of exceptions can occur, e.g.
- Geth is killed manually
- Geth is killed because of machine crash
- etc
In order to minimize the effect of the exceptions, the compaction
is moved out of the pruning. So that even the compaction is not
finished, the pruning is regarded as done.
4 years ago
Péter Szilágyi
a31f6d54df
core/state/snapshot: fix panic on missing parent
4 years ago
gary rong
0c70b83e00
all: add read-only option to database ( #22407 )
...
* all: add read-only option to database
* all: fixes tests
* cmd/geth: migrate flags
* cmd/geth: fix the compact
* cmd/geth: fix the format
* cmd/geth: fix log
* cmd: add chain-readonly
* core: add readonly notion to freezer
* core/rawdb: add log
* core/rawdb: fix freezer close
* cmd: fix
* cmd, core: construct db
* core: update tests
4 years ago
Martin Holst Swende
498458b410
core/state: fix eta calculation on pruning ( #22386 )
4 years ago