Commit Graph

209 Commits

Author SHA1 Message Date
Pierre Grimaud
7f756dc118
cmd/evm/testdata: fix typos in docs (#27742) 2023-07-18 14:07:25 +02:00
Martin Holst Swende
b058cf454b
core, tests: EIP-4844 transaction processing logic (#27721)
This updates the reference tests to the latest version and also adds logic
to process EIP-4844 blob transactions into the state transition. We are now
passing most Cancun fork tests.

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-07-15 23:27:36 +02:00
jwasinger
d233b6b23a
core: replace instances of 'suicide' with 'selfdestruct' to improve code consistency. (#27716)
---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
2023-07-15 10:35:30 -04:00
cui fliter
80b7bfe70d
accounts, cmd/evm: fix docstrings (#27703)
fix function name in comment

Signed-off-by: cui fliter <imcusg@gmail.com>
2023-07-12 06:01:55 -04:00
rjl493456442
6d2aeb43d5
cmd, core/state, eth, tests, trie: improve state reader (#27428)
The state availability is checked during the creation of a state reader.

-    In hash-based database, if the specified root node does not exist on disk disk, then
    the state reader won't be created and an error will be returned.

-    In path-based database, if the specified state layer is not available, then the
    state reader won't be created and an error will be returned.

This change also contains a stricter semantics regarding the `Commit` operation: once it has been performed, the trie is no longer usable, and certain operations will return an error.
2023-06-20 15:31:45 -04:00
John Chase
cd3b8c3d78
cmd/evm: fix typos in documentation (#27501) 2023-06-19 08:44:54 +02:00
cui fliter
604da5c84b
cmd/evm: fix typos in docs (#27478)
fix some typos

Signed-off-by: cui fliter <imcusg@gmail.com>
2023-06-15 08:55:00 -04:00
Martin Holst Swende
8eb0c2de76
cmd/evm: make evm blocktest output logs if so instructed (#27396)
* cmd/evm: make evm blocktest output logs if so instructed

* Apply suggestions from code review

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2023-06-06 04:27:40 -04:00
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
2023-06-05 16:43:25 +03:00
Delweng
e9c3183c52
cmd: use errrors.New instead of empty fmt.Errorf (#27329)
Signed-off-by: jsvisa <delweng@gmail.com>
2023-05-24 12:21:29 +02:00
Martin Holst Swende
1a18283e85
cmd/evm: make batched state-test execution possible (#27318)
implements the ability to run several state-tests in one instance. By not providing a statetest path to the `evm statetest` command, the path(s) will instead be read from `stdin`.
2023-05-23 06:23:17 -04:00
Park Changwan
bfded65ed8
core/state: do not ignore null addr while iterative dump (#27320)
fixes bug which caused the zero-address to be ignored during an iterative state-dump.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-05-23 06:10:26 -04:00
Péter Szilágyi
85a4b82b33
all: tie timestamp based forks to the passage of London (#27279) 2023-05-19 11:27:19 +03:00
rjl493456442
a14301823e
all: new empty trie with types.EmptyRootHash instead of null (#27230) 2023-05-11 10:19:42 +03:00
Péter Szilágyi
dde2da0efb
all: remove ethash pow, only retain shims needed for consensus and tests (#27178)
* all: remove ethash pow, only retain shims needed for consensus and tests

* all: thank you linter

* all: disallow launching Geth in legacy PoW mode

* cmd/env/internal/t8ntool: remove dangling ethash flag
2023-05-03 12:58:39 +03:00
Roberto Bayardo
f8aa623536
core/types: fix discrepancy in receipt.EffectiveGasPrice json encoding tags (#27114)
Regenerate receipt json code to remove omit empty. Previously, there was a discrepancy between the generated code and the source. 

---------

Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-04-26 02:37:11 -04:00
Péter Szilágyi
bbc565ab05
core/types, params: add blob transaction type, RLP encoded for now (#27049)
* core/types, params: add blob transaction type, RLP encoded for now

* all: integrate Cancun (and timestamp based forks) into MakeSigner

* core/types: fix 2 back-and-forth type refactors

* core: fix review comment

* core/types: swap blob tx type id to 0x03
2023-04-21 12:52:02 +03:00
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>
2023-04-04 09:50:13 -04:00
Guruprasad Kamath
bed07cd590
cmd/evm: use correct parent number for t8n base fee calculation (#27032)
Currently the t8n tool uses the same block number for the current block and its parent while calculating the base fee. This causes incorrect base fee calculation for the london fork block. This commit sets the parent block number to be one less than the current block number
2023-04-03 03:33:17 -04:00
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.
2023-03-23 05:15:40 -04:00
Roberto Bayardo
67ac5f0ae7
core, core/types: plain Message struct (#25977)
Here, the core.Message interface turns into a plain struct and
types.Message gets removed.

This is a breaking change to packages core and core/types. While we do
not promise API stability for package core, we do for core/types. An
exception can be made for types.Message, since it doesn't have any
purpose apart from invoking the state transition in package core.
types.Message was also marked deprecated by the same commit it
got added in, 4dca5d4db7 (November 2016).

The core.Message interface was added in December 2014, in commit
db494170dc, for the purpose of 'testing' state transitions. It's the
same change that made transaction struct fields private. Before that,
the state transition used *types.Transaction directly.

Over time, multiple implementations of the interface accrued across
different packages, since constructing a Message is required whenever
one wants to invoke the state transition. These implementations all
looked very similar, a struct with private fields exposing the fields
as accessor methods.

By changing Message into a struct with public fields we can remove all
these useless interface implementations. It will also hopefully
simplify future changes to the type with less updates to apply across
all of go-ethereum when a field is added to Message.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-03-09 14:19:12 +01:00
Martin Holst Swende
08f6a2a89d
cmd/evm: update readmes for the tests (#26841) 2023-03-09 07:06:47 -05:00
Guruprasad Kamath
cb1f6bdbc8
cmd/evm: correct alloc for t8n testdata (#26822)
Fixes a minor error in the testdata
2023-03-07 05:32:52 -05:00
rjl493456442
77e33e5a49
core, miner: revert block gas counter in case of invalid transaction (#26799)
This change fixes a flaw where, in certain scenarios, the block sealer did not accurately reset the remaining gas after failing to include an invalid transaction. Fixes #26791
2023-03-07 05:23:52 -05:00
rjl493456442
fe01a2f63b
all: use unified emptyRootHash and emptyCodeHash (#26718)
The EmptyRootHash and EmptyCodeHash are defined everywhere in the codebase, this PR replaces all of them with unified one defined in core/types package, and also defines constants for TxRoot, WithdrawalsRoot and UncleRoot
2023-02-21 06:12:27 -05:00
Mario Vega
90f15a0230
cmd/evm: add blocktest subcommand to evm (#26526)
Adds blocktest subcommand to the evm command, which is very similar to statetest, but instead of loading a StateTest static test it loads a BlockchainTest from a json file and runs it.

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
2023-01-27 08:30:13 -05:00
Marius van der Wijden
2a2b0419fb
all: implement withdrawals (EIP-4895) (#26484)
This change implements withdrawals as specified in EIP-4895.

Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: marioevz <marioevz@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-01-25 15:32:25 +01:00
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>
2023-01-25 12:12:28 +01:00
ucwong
f2758a8dac
cmd/evm: typo fix in docs (#26506) 2023-01-16 13:14:21 -05:00
Ikko Eltociear Ashimine
c858da555d
cmd/evm: fix typo in README.md (#26500) 2023-01-16 11:23:24 +01:00
Andrei Maiboroda
793f0f9ec8
core/vm: implement EIP-3860: Limit and meter initcode (#23847)
Implementation of https://eips.ethereum.org/EIPS/eip-3860, limit and meter initcode. This PR enables EIP-3860 as part of the Shanghai fork. 


Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2023-01-11 04:05:47 -05:00
Martin Holst Swende
41fe9d646c
cmd/evm: update documentation (#26385) 2023-01-03 12:37:48 +01:00
Martin Holst Swende
b818e73ef3
tests: update tests (#26314)
This PR builds on #26299, but also updates the tests to the most recent version, which includes tests regarding TheMerge.

This change adds checks to the beacon consensus engine, making it more strict in validating the pre- and post-headers, and not relying on the caller to have already correctly sanitized the headers/blocks.
2022-12-20 09:56:52 -05:00
rjl493456442
cda051eba7
core, cmd: fill blockNumber in logs (#26345)
* core, cmd: fill blockNumber in logs

* Update core/state/statedb.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* core/types: revert

* core/state: improve comments

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-12-13 07:54:16 -05:00
Martin Holst Swende
41306b0af3
cmd/evm: output stateroot in statetest result (#26297)
This adds stateRoot as a field in the JSON output.
2022-12-05 18:58:32 +01:00
Mark Tyneway
b4ea2bf7dd
all: implement EIP-1153 transient storage (#26003)
Implements TSTORE and TLOAD as specified by the following EIP:

https://eips.ethereum.org/EIPS/eip-1153
https://ethereum-magicians.org/t/eip-1153-transient-storage-opcodes/553


Co-authored-by: Sara Reynolds <snreynolds2506@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2022-11-16 10:18:52 +01:00
Martin Holst Swende
dffd93b475
cmd/evm: slight change in how t8n handles coinbase pre eip-158 (#26139)
This PR fixes a subtle bug in t8n. After this PR, t8n behaves like our state-test runner in certain pre-EIP-158 scenarios
2022-11-09 09:34:42 +01:00
lightclient
fbdeff99ce
cmd/evm: calc base fee if parent data is present (#26051)
Currently, in order to chain together sequential valid t8n transitions the caller must manually calculate the block base fee. This PR adds support for the necessary parent fee market data to calculate the base fee for the current transition.

Concretely, env is extended to accept the following:

    parentBaseFee
    parentGasUsed
    parentGasLimit

Example usage can be found in ./cmd/evm/testdata/25.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-10-28 12:25:37 +02:00
Martin Holst Swende
5a02b2d6d0
all: fix spelling mistakes (#25961) 2022-10-11 09:37:00 +02:00
Felix Lange
65f3c1b46f
internal/version: use gitCommit injection in version handling code (#25851)
This changes the CI build to store the git commit and date into package
internal/version instead of package main. Doing this essentially merges our
two ways of tracking the go-ethereum version into a single place, achieving
two objectives:

- Bad block reports, which use version.Info(), will now have the git commit
  information even when geth is built in an environment such as
  launchpad.net where git access is unavailable.

- For geth builds created by `go build ./cmd/geth` (i.e. not using `go run
  build/ci.go install`), git information stored by the go tool is now used
  in the p2p node name as well as in `geth version` and `geth
  version-check`.
2022-09-23 14:08:25 +02:00
Felix Lange
b628d72766
build: upgrade to go 1.19 (#25726)
This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.

In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.

With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.
2022-09-10 13:25:40 +02:00
rjl493456442
a41ea8a97c
all: cleanup the APIs for initializing genesis (#25473)
* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment
2022-08-09 12:44:39 +03:00
rjl493456442
9d76a9b94f
core, trie, eth, cmd: rework preimage store (#25287)
* core, trie, eth, cmd: rework preimage store

* trie: address comment
2022-07-27 20:37:04 +02:00
Delweng
b196ad1c16
all: add whitespace linter (#25312)
* golangci: typo

Signed-off-by: Delweng <delweng@gmail.com>

* golangci: add whietspace

Signed-off-by: Delweng <delweng@gmail.com>

* *: rm whitesapce using golangci-lint

Signed-off-by: Delweng <delweng@gmail.com>

* cmd/puppeth: revert accidental resurrection

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2022-07-25 13:14:03 +03:00
Seungbae.yu
2697e44d81
all: change format 0x%x to %#x (#25221) 2022-07-04 11:03:32 +03:00
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
2022-06-27 18:22:36 +02:00
Marius van der Wijden
d8f963811d
cmd, params: implement Gray Glacier hard-fork (EIP-5133) (#25088)
* cmd/geth, params: implement Gray Glacier (EIP-5133)

* cmd/evm: add gray glacier tests

* params: nitpicks

* params: fixes
2022-06-15 14:10:38 +03:00
lmittmann
bc013bc42e
all: prefer new(big.Int) over big.NewInt(0) (#25087)
minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`
2022-06-14 15:09:48 +03:00
Felix Lange
9244d5cd61
all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
Håvard Anda Estensen
07508ac0e9
all: replace uses of ioutil with io and os (#24869) 2022-05-16 11:59:35 +02:00