Péter Szilágyi
d8da0b3d81
core/state, eth, trie: stabilize memory use, fix memory leak
2020-08-26 13:05:06 +03:00
gary rong
87c0ba9213
core, eth, les, trie: add a prefix to contract code ( #21080 )
2020-08-21 15:10:40 +03:00
Giuseppe Bertone
2ff464b29d
core/state: fixed some comments ( #21450 )
2020-08-19 09:54:21 +03:00
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>
2020-07-16 15:06:19 +03:00
Péter Szilágyi
80e887d7bf
core/state: avoid escape analysis fault when accessing cached state
2020-06-08 16:11:37 +03:00
Péter Szilágyi
0b2edf05bb
core/state: make GetCodeSize mirror GetCode implementation wise
2020-05-11 10:28:56 +03:00
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>
2020-05-08 21:52:20 +03:00
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.
2020-05-07 15:13:34 +02:00
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
2020-04-29 12:53:08 +03:00
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
2020-03-23 12:34:27 +02:00
Péter Szilágyi
328de180a7
core/state: fix resurrection state clearing and access
2020-03-04 10:22:48 +02:00
Péter Szilágyi
dcb22a9f99
core/state: fix account root hash update point
2020-03-03 16:55:06 +02:00
Péter Szilágyi
a4cf279494
core/state: extend snapshotter to handle account resurrections
2020-03-03 15:52:00 +02:00
Péter Szilágyi
92ec07d63b
core/state: fix an account resurrection issue
2020-02-27 15:03:10 +02:00
Péter Szilágyi
fd39f722a3
core: journal the snapshot inside leveldb, not a flat file
2020-02-25 12:51:10 +02:00
Péter Szilágyi
351a5903b0
core/rawdb, core/state/snapshot: runtime snapshot generation
2020-02-25 12:51:08 +02:00
Péter Szilágyi
d754091a87
core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
2020-02-25 12:51:07 +02:00
Martin Holst Swende
e146fbe4e7
core/state: lazy sorting, snapshot invalidation
2020-02-25 12:51:05 +02:00
Péter Szilágyi
542df8898e
core: initial version of state snapshots
2020-02-25 12:51:04 +02:00
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
2020-02-03 17:28:30 +02:00
Martin Holst Swende
fc392395fb
core/state: add more verbosity to panic
2020-01-10 10:12:32 +01:00
Felix Lange
dd21f079e8
core/state: fix staticcheck warnings ( #20357 )
...
Also remove dependency on gopkg.in/check.v1 in tests.
2019-11-22 15:56:05 +01:00
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
2019-09-24 10:49:59 +03:00
Péter Szilágyi
223b950944
core/state: accumulate writes and only update tries when must
2019-09-16 11:05:57 +03:00
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
2019-08-08 16:44:11 +03:00
gary rong
36f81118f6
core/state: fix state iterator ( #19127 )
...
* core/state: fix state iterator
* core: fix state iterator more elegant
2019-04-05 09:44:02 +03:00
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.
2019-03-27 13:39:25 +01:00
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.
2019-03-26 15:48:31 +01:00
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
2019-03-25 10:01:18 +02:00
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
2019-03-14 15:25:12 +02:00
Sheldon
da5de012c3
state: fix emptyStatet to emptyRoot ( #19254 )
2019-03-12 11:14:24 +02:00
atsushi-ishibashi
81801ccc2b
core/state: more memory efficient preimage allocation ( #16663 )
2019-02-07 10:44:45 +01:00
Shuai Qi
fe26b2f366
core/state: rename 'new' variable ( #18301 )
2018-12-14 14:55:03 +01:00
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.
2018-11-08 21:37:19 +01:00
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.
2018-10-23 21:51:41 +02:00
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
2018-10-18 21:41:22 +02:00
Péter Szilágyi
5d921fa3a0
core, params: polish net gas metering PR a bit
2018-09-18 16:29:51 +03:00
Martin Holst Swende
caa2c23a38
core,state: finish implementing Eip 1283
2018-09-18 13:08:32 +03:00
Martin Holst Swende
58374e28d9
core, state: initial implementation of Eip-1283
2018-09-18 13:08:28 +03:00
gary rong
c3f7e3be3b
core/statedb: deep copy logs ( #17489 )
2018-08-23 15:59:58 +03:00
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).
2018-06-21 11:28:05 +02:00
hadv
f2fdb75dd9
core, consensus: fix some typos in comment code and output log
2018-05-19 15:44:36 +07:00
Péter Szilágyi
7a7428a027
core, eth: fix tracer dirty finalization
2018-04-27 14:29:18 +03:00
Martin Holst Swende
7205366c9f
core/state: fix ripemd-cornercase in Copy
2018-04-11 15:03:49 +02:00
Martin Holst Swende
0c7b99b8cc
core/state: fix bug in copy of copy State
2018-04-11 10:23:01 +02:00
Martin Holst Swende
14c9215dd3
state: handle nil in journal dirties
2018-04-10 11:20:02 +02:00
Péter Szilágyi
d985b9052a
core/state: avoid linear overhead on journal dirty listing
2018-03-28 09:32:02 +03:00
Martin Holst Swende
958ed4f3d9
core/state: rework dirty handling to avoid quadratic overhead
2018-03-28 09:29:28 +03:00
Jia Chenhui
1a8894b3d5
core/state: uniform parameter style ( #16398 )
...
- Uniform code style.
2018-03-28 09:26:37 +03:00
Jia Chenhui
e506d384e9
core/state: fix typo ( #16370 )
2018-03-26 14:45:34 +03:00