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
80e887d7bf
core/state: avoid escape analysis fault when accessing cached state
2020-06-08 16:11:37 +03:00
0b2edf05bb
core/state: make GetCodeSize mirror GetCode implementation wise
2020-05-11 10:28:56 +03:00
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
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
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
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
328de180a7
core/state: fix resurrection state clearing and access
2020-03-04 10:22:48 +02:00
dcb22a9f99
core/state: fix account root hash update point
2020-03-03 16:55:06 +02:00
a4cf279494
core/state: extend snapshotter to handle account resurrections
2020-03-03 15:52:00 +02:00
92ec07d63b
core/state: fix an account resurrection issue
2020-02-27 15:03:10 +02:00
fd39f722a3
core: journal the snapshot inside leveldb, not a flat file
2020-02-25 12:51:10 +02:00
351a5903b0
core/rawdb, core/state/snapshot: runtime snapshot generation
2020-02-25 12:51:08 +02:00
d754091a87
core/state/snapshot: unlink snapshots from blocks, quad->linear cleanup
2020-02-25 12:51:07 +02:00
e146fbe4e7
core/state: lazy sorting, snapshot invalidation
2020-02-25 12:51:05 +02:00
542df8898e
core: initial version of state snapshots
2020-02-25 12:51:04 +02:00
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
fc392395fb
core/state: add more verbosity to panic
2020-01-10 10:12:32 +01:00
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
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
223b950944
core/state: accumulate writes and only update tries when must
2019-09-16 11:05:57 +03:00
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
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
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
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
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
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
da5de012c3
state: fix emptyStatet to emptyRoot ( #19254 )
2019-03-12 11:14:24 +02:00
81801ccc2b
core/state: more memory efficient preimage allocation ( #16663 )
2019-02-07 10:44:45 +01:00
fe26b2f366
core/state: rename 'new' variable ( #18301 )
2018-12-14 14:55:03 +01:00
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
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
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
5d921fa3a0
core, params: polish net gas metering PR a bit
2018-09-18 16:29:51 +03:00
caa2c23a38
core,state: finish implementing Eip 1283
2018-09-18 13:08:32 +03:00
58374e28d9
core, state: initial implementation of Eip-1283
2018-09-18 13:08:28 +03:00
c3f7e3be3b
core/statedb: deep copy logs ( #17489 )
2018-08-23 15:59:58 +03:00
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
f2fdb75dd9
core, consensus: fix some typos in comment code and output log
2018-05-19 15:44:36 +07:00
7a7428a027
core, eth: fix tracer dirty finalization
2018-04-27 14:29:18 +03:00
7205366c9f
core/state: fix ripemd-cornercase in Copy
2018-04-11 15:03:49 +02:00
0c7b99b8cc
core/state: fix bug in copy of copy State
2018-04-11 10:23:01 +02:00
14c9215dd3
state: handle nil in journal dirties
2018-04-10 11:20:02 +02:00
d985b9052a
core/state: avoid linear overhead on journal dirty listing
2018-03-28 09:32:02 +03:00
958ed4f3d9
core/state: rework dirty handling to avoid quadratic overhead
2018-03-28 09:29:28 +03:00
1a8894b3d5
core/state: uniform parameter style ( #16398 )
...
- Uniform code style.
2018-03-28 09:26:37 +03:00
e506d384e9
core/state: fix typo ( #16370 )
2018-03-26 14:45:34 +03:00
55599ee95d
core, trie: intermediate mempool between trie and database ( #15857 )
...
This commit reduces database I/O by not writing every state trie to disk.
2018-02-05 17:40:32 +01:00
6f69cdd109
all: switch gas limits from big.Int to uint64
2018-01-03 14:45:35 +02:00
5dea0f2aa4
core/state: copy trie too, not just content
2017-11-24 14:20:49 +02:00