rjl493456442
503f1f7ada
all: activate pbss as experimental feature ( #26274 )
...
* all: activate pbss
* core/rawdb: fix compilation error
* cma, core, eth, les, trie: address comments
* cmd, core, eth, trie: polish code
* core, cmd, eth: address comments
* cmd, core, eth, les, light, tests: address comment
* cmd/utils: shorten log message
* trie/triedb/pathdb: limit node buffer size to 1gb
* cmd/utils: fix opening non-existing db
* cmd/utils: rename flag name
* cmd, core: group chain history flags and fix tests
* core, eth, trie: fix memory leak in snapshot generation
* cmd, eth, internal: deprecate flags
* all: enable state tests for pathdb, fixes
* cmd, core: polish code
* trie/triedb/pathdb: limit the node buffer size to 256mb
---------
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
1 year ago
rjl493456442
88f3d61468
all: expose block number information to statedb ( #27753 )
...
* core/state: clean up
* all: add block number infomration to statedb
* core, trie: rename blockNumber to block
1 year ago
Marius van der Wijden
c537ace249
core: 4844 opcode and precompile ( #27356 )
...
* core: crypto: implement BLOBHASH and pointEval precompile
* core: crypto: fixed nitpicks, moved precompile return value
* core/vm: fix review comments
1 year ago
rjl493456442
a14301823e
all: new empty trie with types.EmptyRootHash instead of null ( #27230 )
2 years ago
Martin Holst Swende
ab1a404b01
all: remove debug-field from vm config ( #27048 )
...
This PR removes the Debug field from vmconfig, making it so that if a tracer is set, debug=true is implied.
---------
Co-authored-by: 0xTylerHolmes <tyler@ethereum.org>
Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
2 years ago
lightclient
37ecff0967
cmd/evm, tests: record preimages if dump is expected ( #26955 )
...
With #25287 we made it so that preimages were not recorded by default. This had the side effect that the evm command is no longer able to dump state since it does a preimage lookup to determine the address represented by a key.
This change enables the recording of preimages when the dump command is given.
2 years ago
Martin Holst Swende
2b57a27d9e
all: make timestamp-based fork checks based on uint64 ( #26474 )
...
This PR changes the API so that uint64 is used for fork timestamps.
It's a good choice because types.Header also uses uint64 for time.
Co-authored-by: Felix Lange <fjl@twurst.com>
2 years ago
rjl493456442
a41ea8a97c
all: cleanup the APIs for initializing genesis ( #25473 )
...
* all: polish tests
* core: apply feedback from Guillaume
* core: fix comment
2 years ago
Seungbae.yu
2697e44d81
all: change format `0x%x` to `%#x` ( #25221 )
2 years ago
willian.eth
52ed3570c4
cmd: migrate to urfave/cli/v2 ( #24751 )
...
This change updates our urfave/cli dependency to the v2 branch of the library.
There are some Go API changes in cli v2:
- Flag values can now be accessed using the methods ctx.Bool,
ctx.Int, ctx.String, ... regardless of whether the flag is 'local' or
'global'.
- v2 has built-in support for flag categories. Our home-grown category
system is removed and the categories of flags are assigned as part of
the flag definition.
For users, there is only one observable difference with cli v2: flags must now
strictly appear before regular arguments. For example, the following command is
now invalid:
geth account import mykey.json --password file.txt
Instead, the command must be invoked as follows:
geth account import --password file.txt mykey.json
2 years ago
Håvard Anda Estensen
07508ac0e9
all: replace uses of ioutil with io and os ( #24869 )
3 years ago
jwasinger
7d7a96530b
cmd/evm: ensure input length is even ( #24721 )
...
* cmd/evm: ensure input length is even
* cmd/evm: minor nit + lintfix
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Sina Mahmoodi
1876cb443b
all: move loggers to eth/tracers ( #23892 )
...
* all: mv loggers to eth/tracers
* core/vm: minor
* eth/tracers: tmp comment out testStoreCapture
* eth/tracers: uncomment and fix logger test
* eth/tracers: simplify test
* core/vm: re-add license
* core/vm: minor
* rename LogConfig to Config
3 years ago
Sina Mahmoodi
8d7e6062ec
eth/tracers: support for golang tracers + add golang callTracer ( #23708 )
...
* eth/tracers: add basic native loader
* eth/tracers: add GetResult to tracer interface
* eth/tracers: add native call tracer
* eth/tracers: fix call tracer json result
* eth/tracers: minor fix
* eth/tracers: fix
* eth/tracers: fix benchTracer
* eth/tracers: test native call tracer
* eth/tracers: fix
* eth/tracers: rm extra make
Co-authored-by: Martin Holst Swende <martin@swende.se>
* eth/tracers: rm extra make
* eth/tracers: make callFrame private
* eth/tracers: clean-up and comments
* eth/tracers: add license
* eth/tracers: rework the model a bit
* eth/tracers: move tracecall tests to subpackage
* cmd/geth: load native tracers
* eth/tracers: minor fix
* eth/tracers: impl stop
* eth/tracers: add native noop tracer
* renamings
Co-authored-by: Martin Holst Swende <martin@swende.se>
* eth/tracers: more renamings
* eth/tracers: make jstracer non-exported, avoid cast
* eth/tracers, core/vm: rename vm.Tracer to vm.EVMLogger for clarity
* eth/tracers: minor comment fix
* eth/tracers/testing: lint nitpicks
* core,eth: cancel evm on nativecalltracer stop
* Revert "core,eth: cancel evm on nativecalltracer stop"
This reverts commit 01bb908790
.
* eth/tracers: linter nits
* eth/tracers: fix output on err
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Marius van der Wijden
b8d7c662cd
core, rpc: disable memory output by default in traces ( #23558 )
...
* core: cmd: invert disableMemory
* core: fix missed inversion
* cmd/evm: preserve Flags but change default value
* Apply suggestions from code review
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Martin Holst Swende <martin@swende.se>
3 years ago
Sina Mahmoodi
5441a8fa47
all: remove noop vm config flags ( #23111 )
...
* all: rm external interpreter and ewasm config
* core/vm: rm Interpreter interface
* cmd/geth: deprecate interpreter config fields
3 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
Alex Prut
810f9e057d
all: remove redundant conversions and import names ( #21903 )
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
Paweł Bylica
d56dc038d2
cmd/evm: Rework execution stats ( #20792 )
...
- Dump stats also for --bench flag.
- From memory stats only show number and size of allocations. This is what `test -bench` shows. I doubt others like number of GC runs are any useful, but can be added if requested.
- Now the mem stats are for single execution in case of --bench.
5 years ago
Péter Szilágyi
542df8898e
core: initial version of state snapshots
5 years ago
Paweł Bylica
49cf000df7
cmd/evm: Add --bench flag for benchmarking ( #20330 )
...
The --bench flag uses the testing.B to execute the EVM bytecode many times and get the average exeuction time out of it.
5 years ago
Michael Forney
9e71f55bfa
cmd/evm: Allow loading input from file ( #20273 )
...
Make it possible to load input from a file. Simlar to `--code` / `--codefile`, have `--input`/`--inputfile`.
5 years ago
Michael Forney
9c81387bef
cmd/evm: remove surrounding whitespace in hex input code ( #20211 )
...
This way, the output of `evm compile` can be used directly in `evm
--codefile code.txt run`, without stripping the trailing newline first.
5 years ago
Martin Holst Swende
16f0fb70f1
cmd/evm: make evm default to all ethash protocol changes
5 years ago
Martin Holst Swende
2ca89ea479
cmd/evm: evm input minor fixes ( #19740 )
...
* cmd/evm: evm input minor fixes, handle prefix, validate length, fixes #18041
* cmd/evm: remove whitespace
5 years ago
Martin Holst Swende
1da5e0ebb0
core/state, cmd/geth: streaming json output for dump command ( #15475 )
...
* core/state, cmd/geth: streaming json output dump cmd + optional code+storage
* dump: add option to continue even if preimages are missing
* core, evm: lint nits
* cmd: use local flags for dump, omit empty code/storage
* core/state: fix state dump test
5 years ago
Péter Szilágyi
054412e335
all: clean up and proerly abstract database access
6 years ago
Paweł Bylica
d37f987639
cmd/evm: Add --vm.evm flag to support EVMC ( #18457 )
6 years ago
Martin Holst Swende
42a914a84f
cmd/evm, core/vm, eth: implement api methods to do stdjson dump to local filesystem
6 years ago
Matthew Di Ferrante
3d21d455dc
cmd/evm: commit statedb if dump is requested ( #18208 )
...
Add a call `statedb.Commit(true)` if the `Dump` flag is on, as otherwise the `storage` output in the dump is always empty.
6 years ago
Kevin
3fec73500b
cmd/evm: EVM prestate initialization ( #17685 )
...
* Bugfix #17216 : evm loads prestate file properly now
* code gofmted
6 years ago
Péter Szilágyi
83e2761c3a
Revert "cmd/evm: change error msg output to stderr ( #17118 )"
...
This reverts commit fb9f7261ec
.
6 years ago
Chen Quan
fb9f7261ec
cmd/evm: change error msg output to stderr ( #17118 )
...
* cmd/evm: change error msg output to stderr
* cmd/evm: fix some linter error
6 years ago
gary rong
7beccb29be
all: get rid of error when creating memory database ( #16716 )
...
* all: get rid of error when create mdb
* core: clean up variables definition
* all: inline mdb definition
7 years ago
Martin Holst Swende
8dfa4f46a9
evm/main: use blocknumber from genesis
7 years ago
Felix Lange
c7ab3e5544
common: delete StringToAddress, StringToHash ( #16436 )
...
* common: delete StringToAddress, StringToHash
These functions are confusing because they don't parse hex, but use the
bytes of the string. This change removes them, replacing all uses of
StringToAddress(s) by BytesToAddress([]byte(s)).
* eth/filters: remove incorrect use of common.BytesToAddress
7 years ago
dm4
3ebcf92b42
cmd/evm: print vm output when debug flag is on ( #16326 )
7 years ago
Péter Szilágyi
b7e57ca1d0
cmd/evm, core/vm, internal/ethapi: don't disable call gas metering
7 years ago
Péter Szilágyi
55599ee95d
core, trie: intermediate mempool between trie and database ( #15857 )
...
This commit reduces database I/O by not writing every state trie to disk.
7 years ago
Martin Holst Swende
286ec5df40
cmd/evm, core/vm, internal/ethapi: Show error when exiting ( #14985 )
...
* cmd/evm, core/vm, internal/ethapi: Add 'err' to tracer interface CaptureEnd
* cmd/evm: fix nullpointer when there is no error
7 years ago
Martin Holst Swende
3040243042
cmd/evm: add --receiver, support code from stdin ( #14873 )
7 years ago
Felix Lange
9e5f03b6c4
core/state: access trie through Database interface, track errors ( #14589 )
...
With this commit, core/state's access to the underlying key/value database is
mediated through an interface. Database errors are tracked in StateDB and
returned by CommitTo or the new Error method.
Motivation for this change: We can remove the light client's duplicated copy of
core/state. The light client now supports node iteration, so tracing and storage
enumeration can work with the light client (not implemented in this commit).
7 years ago
Martin Holst Swende
9a44e1035e
cmd/evm, core/vm: add --nomemory, --nostack to evm ( #14617 )
7 years ago
Martin Holst Swende
80f7c6c299
cmd/evm: add --prestate, --sender, --json flags for fuzzing ( #14476 )
8 years ago
Jeffrey Wilcke
3ee75bec9f
cmd/evm: added mem/cpu profiling
8 years ago
Jeffrey Wilcke
f30733c806
cmd/evm: removed -sysstat and moved content to -debug flag
...
Added the ability to directly compile and run ethereum assembly using
the evm utility: `evm run <file>`. This is equivalant to `evm compile
<file> | evm run`.
8 years ago
Jeffrey Wilcke
bf4155846c
core/evm, core/vm: improved evm trace output
...
* Improved the standard evm tracer output and renamed it to WriteTrace
which now takes an io.Writer to write the logs to.
* Added WriteLogs which writes logs to the given writer in a readable
format.
* evm utility now also prints logs generated during the execution.
8 years ago
Jeffrey Wilcke
230cf2ec91
cmd/evm, core/asm: add EVM assembler ( #3686 )
...
The evm compile command implements a simple assembly language that compiles to
EVM bytecode.
8 years ago
Felix Lange
d0eba23af3
all: disable log message colors outside of geth
...
Also tweak behaviour so colors are only enabled when stderr is a terminal.
8 years ago