Commit graph

2641 commits

Author SHA1 Message Date
Felix Lange
9e0611b660
core/vm, cmd/evm: remove EOF (#32000)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Docker Image (push) Has been cancelled
With EOF removed from the Osaka fork, and no longer being tested, the
implementation will now just be bitrotting. I'm opting to remove it so
it doesn't get in the way of other changes.
2025-06-11 14:50:46 +02:00
Sina M
0983cd789e
eth/filters: add timestamp to derived logs (#31887)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Docker Image (push) Waiting to run
The block timestamp field is now added to the logs returned
by eth_getLogs.
2025-06-10 11:52:02 +02:00
rjl493456442
51c1bb76f4
cmd/workload: introduce transaction-trace test (#31288)
This pull request introduces a new test suite in workload framework, for
transaction tracing.

**test generation**
`go run . tracegen --trace-tests trace-test.json http://host:8545`

and you can choose to store the trace result in a specific folder
`go run . tracegen --trace-tests trace-test.json --trace-output
./trace-result http://host:8545`

**test run**
`./workload test -run Trace/Transaction --trace-invalid ./trace-invalid
http://host:8545`

The mismatched trace result will be saved in the specific folder for
further investigation.
2025-06-09 16:36:24 +02:00
Felix Lange
0007f62da5
cmd/geth: fix era1 download location to match store (#31951)
This changes the era1 downloader to place the files into the correct
location where geth will actually use them. Also adds integration with
the new --datadir.era flag.
2025-06-05 16:19:47 +02:00
Joe Chen
35c5b4fafd
cmd/utils: update SepoliaFlag usage (#31961)
The Sepolia testnet has transitioned to pos following The Merge.
2025-06-04 15:07:15 +02:00
Sina M
a7d9b52eaf
core/rawdb: integrate eradb backend for RPC (#31604)
This implements a backing store for chain history based on era1 files.
The new store is integrated with the freezer. Queries for blocks and receipts
below the current freezer tail are handled by the era store.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
2025-06-03 10:47:38 +02:00
Arya Nair
d821f7f297
cmd/geth, cmd/utils: log prefunded account/key in ephemeral development mode (#31898)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR modifies the disclaimer/banner that is printed when starting up
Geth in dev mode:
* if the client is spun up in ephemeral dev mode with a keystore
override, the address of the first (prefunded) account is printed.
* if the client is spun up in ephemeral mode without a keystore
override, the genesis allocation contains a single static prefunded EOA
account. It's address and private key are logged.
* the banner is printed at the end of client initialization to make it
more prominent. Previously, it was logged towards the beginning of
client initialization and subsequent logging from startup filled the
terminal, pushing it out of view of the user.

Other change is that we now use a static prefunded dev account instead
of generating a random one when instantiating a new dev mode chain.

This is an example of what the banner looks like:
```
WARN [05-28|23:05:16.475] You are running Geth in --dev mode. Please note the following:
WARN [05-28|23:05:16.475] 
WARN [05-28|23:05:16.475]   1. This mode is only intended for fast, iterative development without assumptions on
WARN [05-28|23:05:16.475]      security or persistence.
WARN [05-28|23:05:16.475]   2. The database is created in memory unless specified otherwise. Therefore, shutting down
WARN [05-28|23:05:16.475]      your computer or losing power will wipe your entire block data and chain state for
WARN [05-28|23:05:16.475]      your dev environment.
WARN [05-28|23:05:16.475]   3. A random, pre-allocated developer account will be available and unlocked as
WARN [05-28|23:05:16.475]      eth.coinbase, which can be used for testing. The random dev account is temporary,
WARN [05-28|23:05:16.475]      stored on a ramdisk, and will be lost if your machine is restarted.
WARN [05-28|23:05:16.475]   4. Mining is enabled by default. However, the client will only seal blocks if transactions
WARN [05-28|23:05:16.475]      are pending in the mempool. The miner's minimum accepted gas price is 1.
WARN [05-28|23:05:16.475]   5. Networking is disabled; there is no listen-address, the maximum number of peers is set
WARN [05-28|23:05:16.475]      to 0, and discovery is disabled.
WARN [05-28|23:05:16.475] 
WARN [05-28|23:05:16.475] 
WARN [05-28|23:05:16.475]  Running in ephemeral mode.  The following account has been prefunded in the genesis:
WARN [05-28|23:05:16.475] 
WARN [05-28|23:05:16.475]        Account
WARN [05-28|23:05:16.475]        ------------------
WARN [05-28|23:05:16.475]        0x71562b71999873db5b286df957af199ec94617f7 (10^49 ETH)
WARN [05-28|23:05:16.475]  
WARN [05-28|23:05:16.475]        Private Key
WARN [05-28|23:05:16.475]        ------------------
WARN [05-28|23:05:16.475]        0xb71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291
WARN [05-28|23:05:16.475] 
```

closes #31796

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
2025-05-29 12:20:39 +08:00
Csaba Kiraly
e79177d1bc
cmd/utils: remove duplicate code for influxDB tags (#31854)
Some checks are pending
i386 linux tests / Lint (push) Waiting to run
i386 linux tests / build (push) Waiting to run
remove duplicate code

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-05-19 12:56:12 +02:00
Felix Lange
85ae3e16f1
cmd/devp2p/internal/ethtest: tests for BlockRangeUpdate (#31843)
Some checks are pending
i386 linux tests / Lint (push) Waiting to run
i386 linux tests / build (push) Waiting to run
I added a test for BlockRangeUpdate in #29158 but forgot to enable it.
Here I'm adding two more tests for it. Also applied a small refactoring
to combine calls to `dial()` and `peer()` into a single function, since
these two calls are duplicated in each test.
2025-05-18 10:25:16 +02:00
Marius van der Wijden
7e79254605
eth/protocols/eth: implement eth/69 (#29158)
This PR implements eth/69. This protocol version drops the bloom filter
from receipts messages, reducing the amount of data needed for a sync
by ~530GB (2.3B txs * 256 byte) uncompressed. Compressed this will
be reduced to ~100GB

The new version also changes the Status message and introduces the
BlockRangeUpdate message to relay information about the available history
range.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-05-16 17:10:47 +02:00
Sina M
57e985ecab
cmd/utils: remove deprecated LES flags (#31838)
They were not widely used in users setups.
2025-05-16 10:20:36 +02:00
Felix Lange
3ceec0ea9b
cmd/geth, internal/era/eradl: add era1 downloader tool (#31823)
This adds a geth subcommand for downloading era1 files and placing them into
the correct location. The tool can be used even while geth is already running
on the datadir. Downloads are checked against a hard-coded list of checksums
for mainnet and sepolia.

```
./geth download-era --server $SERVER --block 333333
./geth download-era --server $SERVER --block 333333-444444
./geth download-era --server $SERVER --epoch 0-10
./geth download-era --server $SERVER --all
```

The implementation reuses the file downloader we already had for
fetching build tools. I've done some refactoring on it to make sure it
can support the new use case, and there are some changes to the build
here as well.
2025-05-15 22:53:26 +02:00
maskpp
52dbd206bb
cmd/utils: always record preimages in dev mode (#31821)
Fix a todo: force-enable this in --dev mode

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
2025-05-15 15:32:20 +08:00
rjl493456442
181dd2e660
cmd/geth, internal: fix flaky console tests (#31784)
This pull request bumps the timeout for flaky console tests on appveyor.
2025-05-08 15:15:36 +02:00
jwasinger
51b34efebc
cmd/utils: don't allow network ID override if a preset network is specified (#31630) 2025-05-06 12:40:03 +08:00
Abel
ed93a5ac04
cmd/devp2p: test for non-existent block request (#31506)
Add tests for GetBlockHeaders that verify client does not disconnect when unlikely block numbers are requested, e.g. max uint64.
---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-05-02 08:31:50 -06:00
ericxtheodore
701df4baad
cmd/geth: fix compatErr in initGenesis (#31746) 2025-04-30 18:37:48 +08:00
zhiqiangxu
ba0a61bc28
cmd/geth: print crit log if chain config is not compatible (#31743) 2025-04-30 11:00:17 +08:00
Marius van der Wijden
947fd3a834
crypto/kzg4844: add ComputeCells functionality (#31378)
For PeerDAS, we need to compute cell proofs. Both ckzg and gokzg support
computing these cell proofs.
This PR does the following:

- Update the go-kzg library from "github.com/crate-crypto/go-kzg-4844"
to "github.com/crate-crypto/go-eth-kzg" which will be the new upstream
for go-kzg moving forward
- Update ckzg from v1.0.0 to v2.0.1 and switch to /v2
- Updates the trusted setup to contain the g1 points both in lagrange
and monomial form
- Expose `ComputeCells` to compute the cell proofs
2025-04-29 14:42:17 +02:00
Gabriel-Trintinalia
1296cdb748
core: fail execution if system call fails to execute (#31639)
see: https://github.com/ethereum/pm/issues/1450#issuecomment-2800911584
2025-04-19 13:42:54 +02:00
Delweng
e3e9d7ccb6
cmd/geth: remove the unused bloomfilter.size flag (#31646) 2025-04-16 15:50:05 +08:00
Felix Lange
48ec86abbb
core: initialize history pruning in BlockChain (#31636)
I added the history mode configuration in eth/ethconfig initially, since
it seemed like the logical place. But it turns out we need access to the
intended pruning setting at a deeper level, and it actually needs to be
integrated with the blockchain startup procedure.

With this change applied, if a node previously had its history pruned,
and is subsequently restarted **without** the `--history.chain
postmerge` flag, the `BlockChain` initialization code will now verify
the freezer tail against the known pruning point of the predefined
network and will restore pruning status. Note that this logic is quite
restrictive, we allow non-zero tail only for known networks, and only
for the specific pruning point that is defined.
2025-04-15 14:32:46 +02:00
Delweng
21b035eb29
cmd/geth: set trie,gc and other cache flags for import chain (#31577)
Signed-off-by: jsvisa <delweng@gmail.com>
2025-04-07 13:16:26 +08:00
Felföldi Zsolt
9f83e9e673
beacon/blsync: add checkpoint import/export file feature (#31469)
This PR adds a new `--beacon.checkpoint.file` config flag to geth and
blsync which specifies a checkpoint import/export file. If a file with
an existing checkpoint is specified, it is used for initialization
instead of the hardcoded one (except when `--beacon.checkpoint` is also
specified simultaneously). Whenever the client encounters a new valid
finality update with a suitable finalized beacon block root at an epoch
boundary, it saves the block root in hex format to the checkpoint file.
2025-04-03 16:04:11 +02:00
Felix Lange
49f0d49e89
cmd/devp2p/internal/v5test: log test descriptions (#31551)
This adds the test description text to the output, instead of keeping it
as a Go comment. Logs are visible in the hive UI where these tests run,
while Go comments are not.
2025-04-03 15:58:37 +02:00
rjl493456442
90d44e715d
core, eth/downloader: implement pruning mode sync (#31414)
This pull request introduces new sync logic for pruning mode. The downloader will now skip
insertion of block bodies and receipts before the configured history cutoff point.

Originally, in snap sync, the header chain and other components (bodies and receipts) were
inserted separately. However, in Proof-of-Stake, this separation is unnecessary since the
sync target is already verified by the CL.

To simplify the process, this pull request modifies `InsertReceiptChain` to insert headers
along with block bodies and receipts together. Besides, `InsertReceiptChain` doesn't have
the notion of reorg, as the common ancestor is always be found before the sync and extra
side chain is truncated at the beginning if they fall in the ancient store. The stale
canonical chain flags will always be rewritten by the new chain. Explicit reorg logic is
no longer required in `InsertReceiptChain`.
2025-04-03 15:16:35 +02:00
fuder.eth
e6098437a6
all: fix typos in docs and comments (#31548)
Co-authored-by: lightclient <lightclient@protonmail.com>
2025-04-02 13:52:40 -06:00
owen
82f01f9f24
README: fixup typos (#31540)
Fixes a few typos in readme.
2025-04-02 11:19:25 -06:00
Delweng
4add312c8a
cmd: apply snapshot cache flag in the MakeChain (#31534) 2025-04-01 20:10:22 +08:00
Delweng
714fa4f2e6
cmd/geth: update geth subcommand arguments (#31293) 2025-03-28 15:15:13 +08:00
Shude Li
4ff5093df1
all: use fmt.Appendf instead of fmt.Sprintf where possible (#31301) 2025-03-25 14:53:02 +01:00
Sina M
8fe09df54f
cmd/geth: add prune history command (#31384)
This adds a new subcommand 'geth prune-history' that removes the pre-merge history
on supported networks. Geth is not fully ready to work in this mode, please do not run
this command on your production node.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-03-21 13:12:56 +01:00
Felföldi Zsolt
03cc2942c2
cmd/workload: fixed filter test request error handling (#31424)
This PR fixes the broken request error handling of the workload filter
tests. Until now `validateHistoryPruneErr` was invoked with `fq.Err` as
an input which was always nil and a timeout or http error was reported
as a result content mismatch.
Also, in case of `errPrunedHistory` it is wrong to return here without
setting an error because then it will look like a valid empty result and
the check will later fail. So instead `errPrunedHistory` is always
returned now (without printing an error message) and the callers of
`run` should handle this special case (typically ignore silently).
2025-03-20 09:23:10 +01:00
maskpp
8e3cd41b04
cmd/utils: force hash scheme for archive mode (#31439) 2025-03-20 13:14:13 +08:00
Felix Lange
80b8d7a13c
core/types: cleanup tx signer logic (#31434)
This removes the signer type-train in favor of defining a single object
that can handle all tx types. Supported types are enabled via a map.
Notably, the new signer also supports disabling legacy transactions.
2025-03-19 16:05:44 +01:00
Delweng
dba58830e9
cmd: set name to chaindata for all the opened db (#31352)
When I'm running `geth import --metrics`, the metrics is different to
normal `geth --metrics`, so the grafana dashboard needs to be updated,
eg: `eth_db_chaindata_disk_read` vs `disk_read`.

So I think we should always set the name to `eth/db/chaindata` for more
convenient.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
2025-03-18 21:32:29 +08:00
Marius van der Wijden
668118bfe1
params: add hoodi testnet definition (#31406)
Adds support for the new hoodi testnet. Hoodi is meant for stakers to test
their setup. For more info please refer to https://hoodi.ethpandaops.io/.
2025-03-18 12:07:49 +01:00
Felföldi Zsolt
d85f796356
eth/filters: implement log filter using new log index (#31080)
This PR is #2 of a 3-part series that implements the new log index
intended to replace core/bloombits.
Based on https://github.com/ethereum/go-ethereum/pull/31079
Replaces https://github.com/ethereum/go-ethereum/pull/30370

This part replaces the old bloombits based log search logic in
`eth/filters` to use the new `core/filtermaps` logic.

FilterMaps data structure explanation:
https://gist.github.com/zsfelfoldi/a60795f9da7ae6422f28c7a34e02a07e

Log index generator code overview:
https://gist.github.com/zsfelfoldi/97105dff0b1a4f5ed557924a24b9b9e7

Search pattern matcher code overview:
https://gist.github.com/zsfelfoldi/5981735641c956afb18065e84f8aff34

Note that the possibility of a tree hashing scheme and remote proof
protocol are mentioned in the documents above but they are not exactly
specified yet. These specs are WIP and will be finalized after the local
log indexer/filter code is finalized and merged.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-03-17 18:59:04 +01:00
jwasinger
64bd21393e
cmd/abigen, accounts/abi/bind: implement abigen version 2 (#31379)
This PR implements a new version of the abigen utility (v2) which exists
along with the pre-existing v1 version.

Abigen is a utility command provided by go-ethereum that, given a
solidity contract ABI definition, will generate Go code to transact/call
the contract methods, converting the method parameters/results and
structures defined in the contract into corresponding Go types. This is
useful for preventing the need to write custom boilerplate code for
contract interactions.

Methods in the generated bindings perform encoding between Go types and
Solidity ABI-encoded packed bytecode, as well as some action (e.g.
`eth_call` or creating and submitting a transaction). This limits the
flexibility of how the generated bindings can be used, and prevents
easily adding new functionality, as it will make the generated bindings
larger for each feature added.

Abigen v2 was conceived of by the observation that the only
functionality that generated Go bindings ought to perform is conversion
between Go types and ABI-encoded packed data. Go-ethereum already
provides various APIs which in conjunction with conversion methods
generated in v2 bindings can cover all functionality currently provided
by v1, and facilitate all other previously-desired use-cases.

## Generating Bindings

To generate contract bindings using abigen v2, invoke the `abigen`
command with the `--v2` flag. The functionality of all other flags is
preserved between the v2 and v1 versions.

## What is Generated in the Bindings

The execution of `abigen --v2` generates Go code containing methods
which convert between Go types and corresponding ABI-encoded data
expected by the contract. For each input-accepting contract method and
the constructor, a "packing" method is generated in the binding which
converts from Go types to the corresponding packed solidity expected by
the contract. If a method returns output, an "unpacking" method is
generated to convert this output from ABI-encoded data to the
corresponding Go types.

For contracts which emit events, an unpacking method is defined for each
event to unpack the corresponding raw log to the Go type that it
represents.

Likewise, where custom errors are defined by contracts, an unpack method
is generated to unpack raw error data into a Go type.

## Using the Generated Bindings

For a smooth user-experience, abigen v2 comes with a number of utility
functions to be used in conjunction with the generated bindings for
performing common contract interaction use-cases. These include:

* filtering for historical logs of a given topic
* watching the chain for emission of logs with a given topic
* contract deployment methods
* Call/Transact methods

https://geth.ethereum.org will be updated to include a new tutorial page
for abigen v2 with full code examples. The page currently exists in a
PR: https://github.com/ethereum/go-ethereum/pull/31390 .

There are also extensive examples of interactions with contract bindings
in [test
cases](cc855c7ede/accounts/abi/bind/v2/lib_test.go)
provided with this PR.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-03-17 15:56:55 +01:00
Shude Li
1cdf4d6da7
eth/catalyst: set FeeRecipient in dev mode (#31316)
this adds 2 features to improve `geth --dev` experience.

1. we don't need to use `dev_SetFeeRecipient` to set initial coinbase
address. it was a pain.
2. we don't need to unlock keystore if we don't use it. we had it
because of clique.
2025-03-17 09:32:44 +01:00
Vladimir Támara Patiño
7d99f7df00
cmd/utils: fix geth test issue on OpenBSD (#31357) 2025-03-15 18:35:10 +01:00
danceratopz
475e87cbc1
cmd/evm: fix statetest with multi-fork statetest fixtures (#31374)
Fixes `evm statetest` for state test fixtures with multiple fork entries
in their `post` field (e.g.,
[chainId.json](81862e4848/GeneralStateTests/stChainId/chainId.json (L39))).

When these re-activated flags aren't exposed, `statetest` only executes
the fixture for a single fork entry instead of all of the forks as
expected.

This only affects ethereum/tests state test fixtures, not
ethereum/execution-spec-tests (EEST) state tests. EEST writes a separate
fixture/test case (i.e. a separate top-level dict entry in the .json)
for each fork configuration as apposed to combining multiple forks in
one fixture test case: New EEST state tests targeting Prague behavior
are not affected.
2025-03-14 17:56:24 +01:00
jwasinger
444a6d007a
cmd/workload: implement checks for history-pruned node (#31355)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-03-13 15:21:47 +01:00
Chen Kai
5117f77af9
p2p/discover: expose discv5 functions for portal JSON-RPC interface (#31117)
Fixes #31093

Here we add some API functions on the UDPv5 object for the purpose of implementing
the Portal Network JSON-RPC API in the shisui client.

---------

Signed-off-by: Chen Kai <281165273grape@gmail.com>
2025-03-13 15:16:01 +01:00
Felix Lange
1ca2da81e6
eth/ethconfig: add HistoryMode (#31365)
Here I am adding a config option and geth flag (`--history.chain`) for
configuring history pruning. There are two options available:

- `--history.chain all` is the default and will keep all history like
before.
- `--history.chain postmerge` will configure the history cutoff point to
the merge block.

The option doesn't actually do anything right now, but we need it as a
precursor for other history pruning changes.
2025-03-13 11:43:00 +01:00
Delweng
915d9d9de5
cmd: ctrl-c to halt the whole import process (#31360)
When I press Ctrl-C during the import of multiple files, the import
process will still attempt to import the subsequent files. However, in
normal circumstances, users would expect the import to stop immediately
upon pressing Ctrl-C.

And because the current file was not finished importing, subsequent
import tasks often fail due to an `unknown ancestor` error.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-03-12 12:20:40 +01:00
lightclient
4cdd7c8631
cmd,eth,les: replace Cancun override flag with Prague (#31341)
It's that time of the cycle, should have this ready to go for mainnet
Prague release.
2025-03-10 07:10:16 -06:00
jwasinger
d2bbde2f2d
eth: check blob transaction validity on the peer goroutine when received (#31219)
This ensures that if we receive a blob transaction announcement where we cannot
link the tx to the sidecar commitments, we will drop the sending peer. This check
is added in the protocol handler for the PooledTransactions message.

Tests for this have also been added in the cross-client "eth" protocol test suite.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-03-01 14:10:38 +01:00
Martin HS
767c202e47
all: drop x/exp direct dependency (#30558)
This is a not-particularly-important "cleanliness" PR. It removes the
last remnants of the `x/exp` package, where we used the `maps.Keys`
function.

The original returned the keys in a slice, but when it became 'native'
the signature changed to return an iterator, so the new idiom is
`slices.Collect(maps.Keys(theMap))`, unless of course the raw iterator
can be used instead.

In some cases, where we previously collect into slice and then sort, we
can now instead do `slices.SortXX` on the iterator instead, making the
code a bit more concise.

This PR might be _slighly_ less optimal, because the original `x/exp`
implementation allocated the slice at the correct size off the bat,
which I suppose the new code won't.

Putting it up for discussion.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-02-27 15:53:52 +01:00
Felföldi Zsolt
939a804146
cmd/workload: RPC workload tests for filters and history (#31189)
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-02-27 00:07:14 +01:00