Péter Szilágyi
d8da0b3d81
core/state, eth, trie: stabilize memory use, fix memory leak
4 years ago
gary rong
87c0ba9213
core, eth, les, trie: add a prefix to contract code ( #21080 )
4 years ago
Giuseppe Bertone
2ff464b29d
core/state: fixed some comments ( #21450 )
4 years ago
Martin Holst Swende
295693759e
core/vm: less allocations for various call variants ( #21222 )
...
* core/vm/runtime/tests: add more benchmarks
* core/vm: initial work on improving alloc count for calls to precompiles
name old time/op new time/op delta
SimpleLoop/identity-precompile-10M-6 117ms ±75% 43ms ± 1% -63.09% (p=0.008 n=5+5)
SimpleLoop/loop-10M-6 79.6ms ± 4% 70.5ms ± 1% -11.42% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
SimpleLoop/identity-precompile-10M-6 24.4MB ± 0% 4.9MB ± 0% -79.94% (p=0.008 n=5+5)
SimpleLoop/loop-10M-6 13.2kB ± 0% 13.2kB ± 0% ~ (p=0.357 n=5+5)
name old allocs/op new allocs/op delta
SimpleLoop/identity-precompile-10M-6 382k ± 0% 153k ± 0% -59.99% (p=0.000 n=5+4)
SimpleLoop/loop-10M-6 40.0 ± 0% 40.0 ± 0% ~ (all equal)
* core/vm: don't allocate big.int for touch
name old time/op new time/op delta
SimpleLoop/identity-precompile-10M-6 43.3ms ± 1% 42.4ms ± 7% ~ (p=0.151 n=5+5)
SimpleLoop/loop-10M-6 70.5ms ± 1% 76.7ms ± 1% +8.67% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
SimpleLoop/identity-precompile-10M-6 4.90MB ± 0% 2.46MB ± 0% -49.83% (p=0.008 n=5+5)
SimpleLoop/loop-10M-6 13.2kB ± 0% 13.2kB ± 1% ~ (p=0.571 n=5+5)
name old allocs/op new allocs/op delta
SimpleLoop/identity-precompile-10M-6 153k ± 0% 76k ± 0% -49.98% (p=0.029 n=4+4)
SimpleLoop/loop-10M-6 40.0 ± 0% 40.0 ± 0% ~ (all equal)
* core/vm: reduce allocs in staticcall
name old time/op new time/op delta
SimpleLoop/identity-precompile-10M-6 42.4ms ± 7% 37.5ms ± 6% -11.68% (p=0.008 n=5+5)
SimpleLoop/loop-10M-6 76.7ms ± 1% 69.1ms ± 1% -9.82% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
SimpleLoop/identity-precompile-10M-6 2.46MB ± 0% 0.02MB ± 0% -99.35% (p=0.008 n=5+5)
SimpleLoop/loop-10M-6 13.2kB ± 1% 13.2kB ± 0% ~ (p=0.143 n=5+5)
name old allocs/op new allocs/op delta
SimpleLoop/identity-precompile-10M-6 76.4k ± 0% 0.1k ± 0% ~ (p=0.079 n=4+5)
SimpleLoop/loop-10M-6 40.0 ± 0% 40.0 ± 0% ~ (all equal)
* trie: better use of hasher keccakState
* core/state/statedb: reduce allocations in getDeletedStateObject
* core/vm: reduce allocations in all call derivates
* core/vm: reduce allocations in call variants
- Make returnstack `uint32`
- Use a `sync.Pool` of `stack`s
* core/vm: fix tests
* core/vm: goimports
* core/vm: tracer fix + staticcall gas fix
* core/vm: add back snapshot to staticcall
* core/vm: review concerns + make returnstack pooled + enable returndata in traces
* core/vm: fix some test tracer method signatures
* core/vm: run gencodec, minor comment polish
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
4 years ago
Péter Szilágyi
80e887d7bf
core/state: avoid escape analysis fault when accessing cached state
4 years ago
Péter Szilágyi
0b2edf05bb
core/state: make GetCodeSize mirror GetCode implementation wise
5 years ago
Martin Holst Swende
82f9ed49fa
core/state: avoid statedb.dbErr due to emptyCode ( #21051 )
...
* core/state: more verbose stateb errors
* core/state: fix flaw
* core/state: fixed lint
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
5 years ago
Martin Holst Swende
b0b65d017f
core/state: abort commit if read errors have occurred ( #21039 )
...
This finally adds the error check that the documentation of StateDB.dbErr
promises to do. dbErr was added in 9e5f03b6c
(June 2017), and the check was
already missing in that commit. We somehow survived without it for three years.
5 years ago
gary rong
26d271dfbb
core/state/snapshot: implement storage iterator ( #20971 )
...
* core/state/snapshot: implement storage iterator
* core/state/snapshot, tests: implement helper function
* core/state/snapshot: fix storage issue
If an account is deleted in the tx_1 but recreated in the tx_2,
the it can happen that in this diff layer, both destructedSet
and storageData records this account. In this case, the storage
iterator should be able to iterate the slots belong to new account
but disable further iteration in deeper layers(belong to old account)
* core/state/snapshot: address peter and martin's comment
* core/state: address comments
* core/state/snapshot: fix test
5 years ago
Martin Holst Swende
074efe6c8d
core: fix two snapshot iterator flaws, decollide snap storage prefix
...
* core/state/snapshot/iterator: fix two disk iterator flaws
* core/rawdb: change SnapshotStoragePrefix to avoid prefix collision with preimagePrefix
5 years ago
Péter Szilágyi
328de180a7
core/state: fix resurrection state clearing and access
5 years ago
Péter Szilágyi
dcb22a9f99
core/state: fix account root hash update point
5 years ago
Péter Szilágyi
a4cf279494
core/state: extend snapshotter to handle account resurrections
5 years ago
Péter Szilágyi
92ec07d63b
core/state: fix an account resurrection issue
5 years ago
Péter Szilágyi
fd39f722a3
core: journal the snapshot inside leveldb, not a flat file
5 years ago
Péter Szilágyi
351a5903b0
core/rawdb, core/state/snapshot: runtime snapshot generation
5 years ago
Péter Szilágyi
d754091a87
core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
5 years ago
Martin Holst Swende
e146fbe4e7
core/state: lazy sorting, snapshot invalidation
5 years ago
Péter Szilágyi
542df8898e
core: initial version of state snapshots
5 years ago
Martin Holst Swende
5a9c96454e
trie: separate hashes and committer, collapse on commit
...
* trie: make db insert use size instead of full data
* core/state: minor optimization in state onleaf allocation
* trie: implement dedicated committer and hasher
* trie: use dedicated committer/hasher
* trie: linter nitpicks
* core/state, trie: avoid unnecessary storage trie load+commit
* trie: review feedback, mainly docs + minor changes
* trie: start deprecating old hasher
* trie: fix misspell+lint
* trie: deprecate hasher.go, make proof framework use new hasher
* trie: rename pure_committer/hasher to committer/hasher
* trie, core/state: fix review concerns
* trie: more review concerns
* trie: make commit collapse into hashnode, don't touch dirtyness
* trie: goimports fixes
* trie: remove panics
5 years ago
Martin Holst Swende
fc392395fb
core/state: add more verbosity to panic
5 years ago
Felix Lange
dd21f079e8
core/state: fix staticcheck warnings ( #20357 )
...
Also remove dependency on gopkg.in/check.v1 in tests.
5 years ago
Péter Szilágyi
a308f012ba
core/state: fix copy-commit-copy ( #20113 )
...
* core/state: revert noop finalise, fix copy-commit-copy
* core/state: reintroduce net sstore tracking, extend tests for it
5 years ago
Péter Szilágyi
223b950944
core/state: accumulate writes and only update tries when must
5 years ago
gary rong
c9cdf144d5
graphql, internal/ethapi: support overriding accounts in eth_call ( #19917 )
...
* graphql, internal/ethapi: extend eth_call
This PR offers the third option parameter for eth_call API.
Caller can specify a batch of contracts for overriding the
original account metadata(nonce, balance, code, state).
It has a few advantages:
* It's friendly for debugging
* It's can make on-chain contract lighter for getting rid of
state access functions
* core, internal: address comments
5 years ago
gary rong
36f81118f6
core/state: fix state iterator ( #19127 )
...
* core/state: fix state iterator
* core: fix state iterator more elegant
6 years ago
Brent
7fb89697fd
core/types: add block location fields to receipt ( #17662 )
...
Solves #15210 without changing consensus, in a backwards compatible way,
by adding tx inclusion information to the Receipt struct.
6 years ago
Martin Holst Swende
59e1953246
core, ethdb, trie: mode dirty data to clean cache on flush ( #19307 )
...
This PR is a more advanced form of the dirty-to-clean cacher (#18995 ),
where we reuse previous database write batches as datasets to uncache,
saving a dirty-trie-iteration and a dirty-trie-rlp-reencoding per block.
6 years ago
Péter Szilágyi
86989e3fcd
core: split out detailed trie access metrics from insertion time ( #19316 )
...
* core: split out detailed trie access metrics from insertion time
* cmd, core, metrics: support expensive optional metrics
6 years ago
Péter Szilágyi
91eec1251c
cmd, core, eth, trie: get rid of trie cache generations ( #19262 )
...
* cmd, core, eth, trie: get rid of trie cache generations
* core, trie: get rid of remainder of cache gen boilerplate
6 years ago
Sheldon
da5de012c3
state: fix emptyStatet to emptyRoot ( #19254 )
6 years ago
atsushi-ishibashi
81801ccc2b
core/state: more memory efficient preimage allocation ( #16663 )
6 years ago
Shuai Qi
fe26b2f366
core/state: rename 'new' variable ( #18301 )
6 years ago
Felix Lange
870efeef01
core/state: remove lock ( #18065 )
...
The lock in StateDB is useless. It's only held in Copy, but Copy is safe
for concurrent use because all it does is read.
6 years ago
Felix Lange
7f22b59f87
core/state: simplify proof methods ( #17965 )
...
This fixes the import cycle build error in core/vm tests.
There is no need to refer to core/vm for a type definition.
6 years ago
Simon Jentzsch
97fb08342d
EIP-1186 eth_getProof ( #17737 )
...
* first impl of eth_getProof
* fixed docu
* added comments and refactored based on comments from holiman
* created structs
* handle errors correctly
* change Value to *hexutil.Big in order to have the same output as parity
* use ProofList as return type
6 years ago
Péter Szilágyi
5d921fa3a0
core, params: polish net gas metering PR a bit
6 years ago
Martin Holst Swende
caa2c23a38
core,state: finish implementing Eip 1283
6 years ago
Martin Holst Swende
58374e28d9
core, state: initial implementation of Eip-1283
6 years ago
gary rong
c3f7e3be3b
core/statedb: deep copy logs ( #17489 )
6 years ago
Péter Szilágyi
d926bf2c7e
trie: cache collapsed tries node, not rlp blobs ( #16876 )
...
The current trie memory database/cache that we do pruning on stores
trie nodes as binary rlp encoded blobs, and also stores the node
relationships/references for GC purposes. However, most of the trie
nodes (everything apart from a value node) is in essence just a
collection of references.
This PR switches out the RLP encoded trie blobs with the
collapsed-but-not-serialized trie nodes. This permits most of the
references to be recovered from within the node data structure,
avoiding the need to track them a second time (expensive memory wise).
6 years ago
hadv
f2fdb75dd9
core, consensus: fix some typos in comment code and output log
7 years ago
Péter Szilágyi
7a7428a027
core, eth: fix tracer dirty finalization
7 years ago
Martin Holst Swende
7205366c9f
core/state: fix ripemd-cornercase in Copy
7 years ago
Martin Holst Swende
0c7b99b8cc
core/state: fix bug in copy of copy State
7 years ago
Martin Holst Swende
14c9215dd3
state: handle nil in journal dirties
7 years ago
Péter Szilágyi
d985b9052a
core/state: avoid linear overhead on journal dirty listing
7 years ago
Martin Holst Swende
958ed4f3d9
core/state: rework dirty handling to avoid quadratic overhead
7 years ago
Jia Chenhui
1a8894b3d5
core/state: uniform parameter style ( #16398 )
...
- Uniform code style.
7 years ago
Jia Chenhui
e506d384e9
core/state: fix typo ( #16370 )
7 years ago