Commit Graph

15638 Commits

Author SHA1 Message Date
Martin Holst Swende 8639d5c044
core/txpool: don't track blobtxs, don't track invalid txs 2025-01-07 09:53:18 +01:00
Martin Holst Swende 231a2a5794
eth/catalyst: skip flaky test 2025-01-07 09:47:32 +01:00
Martin Holst Swende 7fd1563c81
core/txpool/legacypool: post-rebase fixup 2025-01-07 09:47:30 +01:00
Martin Holst Swende 14fd80ef39
eth/catalyst: test timeout bump 2025-01-07 09:47:28 +01:00
Martin Holst Swende 4e0edac2ef
core/txpool/legacypool: fix non-determinism in test 2025-01-07 09:47:26 +01:00
Martin Holst Swende 581264d6b9
core/txpool/tracker: address review concerns (pkg name + unused) 2025-01-07 09:47:25 +01:00
Martin Holst Swende 09abeed32b
core/txpool/tracking: fix nil deref 2025-01-07 09:47:23 +01:00
Martin Holst Swende 2b8a21db25
core/txpool, eth/catalyst: api changes, test update, external triggering of recheck
core/txpool/tracking: add ability to trigger recheck externally
core/txpool: remove local param from api
eth/catalyst: update tests for new API
miner, eth: update tests for changed txpool api
eth/catalyst: remove trace-log-output from tests
core/txpool: fix nits, also store on insert
2025-01-07 09:47:22 +01:00
Martin Holst Swende 183fc1085e
core/txpool/legacypool: get the tests in order 2025-01-07 09:47:20 +01:00
Martin Holst Swende c2efd6fc19
core/txpool: split out tracker from the legacy pool 2025-01-07 09:47:18 +01:00
Martin Holst Swende ca63de4eb9
core/txpool: remove locals-tracking from subpools 2025-01-07 09:47:17 +01:00
Martin Holst Swende 02bfc7b065
miner: implement prioritized addresses (reuse --txpool.locals) 2025-01-07 09:47:15 +01:00
Martin Holst Swende 65a11cc6e3
core/txpool/legacypool: implement transaction tracking for handling local txs
core/txpool/legacypool: handle the case when journalling is disabled
core/txpool: store txs to journal on insert
2025-01-07 09:47:09 +01:00
Martin HS 9298074633
eth/protocols/eth: prevent hanging dispatch (#30918)
This PR attempts to fix a strange test-failure (timeout) observed on a
windows-32 platform.

https://ci.appveyor.com/project/ethereum/go-ethereum/builds/51174391/job/d8ascanwwltrlqd5

A goroutine is stuck trying to deliver a response:
```
goroutine 9632 [select, 29 minutes]:
github.com/ethereum/go-ethereum/eth/protocols/eth.(*Peer).dispatchResponse(0x314f100, 0x3e5f6d0, 0x3acbb84)
	C:/projects/go-ethereum/eth/protocols/eth/dispatcher.go:172 +0x2a5
github.com/ethereum/go-ethereum/eth/protocols/eth.handleBlockHeaders({0x12abe68, 0x30021b8}, {0x12a815c, 0x40b41c0}, 0x314f100)
	C:/projects/go-ethereum/eth/protocols/eth/handlers.go:301 +0x173
github.com/ethereum/go-ethereum/eth/protocols/eth.handleMessage({0x12abe68, 0x30021b8}, 0x314f100)
	C:/projects/go-ethereum/eth/protocols/eth/handler.go:205 +0x4f6
github.com/ethereum/go-ethereum/eth/protocols/eth.Handle({0x12abe68, 0x30021b8}, 0x314f100)
	C:/projects/go-ethereum/eth/protocols/eth/handler.go:149 +0x33
github.com/ethereum/go-ethereum/eth.testSnapSyncDisabling.func1(0x314f100)
	C:/projects/go-ethereum/eth/sync_test.go:65 +0x33
github.com/ethereum/go-ethereum/eth.(*handler).runEthPeer(0x30021b8, 0x314f100, 0x427f648)
	C:/projects/go-ethereum/eth/handler.go:355 +0xe65
created by github.com/ethereum/go-ethereum/eth.testSnapSyncDisabling in goroutine 11
	C:/projects/go-ethereum/eth/sync_test.go:64 +0x54f
FAIL	github.com/ethereum/go-ethereum/eth	1800.138s

```

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-01-06 16:31:53 +01:00
georgehao 6897a4a9e0
core/types: improve printList in DeriveSha test (#30969) 2025-01-06 16:28:28 +01:00
Marius van der Wijden c5a8d34851
core/rawdb: fix panic in freezer (#30973)
Fixes an issue where the node panics when an LStat fails with something 
other than os.ErrNotExist

closes https://github.com/ethereum/go-ethereum/issues/30968
2025-01-06 14:52:01 +08:00
Sina M a9ab53d751
internal/ethapi: update default simulation timestamp increment to 12 (#30981)
Update the default timestamp increment to 12s for `eth_simulate` endpoint
2025-01-03 20:15:06 +08:00
Felix Lange 06883c1686
eth/tracers/logger: skip system calls (#30923)
This commit makes it so that the struct logger will not emit logs while
system calls are being executed. This will make it consistent with
the JSON and MD loggers. It is as it stands hard to distinguish when
system calls are being processed vs when a tx is being processed.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-01-02 18:37:58 +01:00
gitglorythegreat 85ffbde427
all: use cmp.Compare (#30958) 2025-01-02 14:06:47 +01:00
gitglorythegreat 0feb999d3f
crypto/bn256: fix MulScalar (#30974)
The `a` parameter should be used in the `MulScalar` function. The
upstream cloudflare and google repos have already merged fixes.

Reference:
*
8d7daa0c54
* https://github.com/cloudflare/bn256/pull/33
2025-01-02 14:04:06 +01:00
かげ f4e8e877f6
internal/flags: update copyright year to 2025 (#30976) 2025-01-02 09:48:25 +08:00
Felix Lange 341647f186
params: update system contracts for prague devnet-5 (#30938) 2024-12-19 16:03:05 +01:00
Felix Lange f1e6372eea
core, core/types: rename AuthList to SetCodeAuthorizations (#30935)
As a follow-up to #30933, I propose to also use the SetCode prefix in
our internal APIs for the authorization list.
2024-12-19 10:06:33 +01:00
Felix Lange f861535f1e
cmd/evm: update tests for SetCodeAuthorization JSON encoding change (#30936)
Fixing a regression introduced by 73a4ecf675, which I accidentally
pushed to the master branch directly.
2024-12-18 20:17:49 +01:00
Felix Lange 73a4ecf675 core/types: rename SetCodeAuthorization 'v' to 'yParity'
The API spec requires the name yParity.
2024-12-18 19:46:15 +01:00
Felix Lange 9d4b29f291
core/types: updates for EIP-7702 API functions (#30933)
Here I am proposing two small changes to the exported API for EIP-7702:

(1) `Authorization` has a very generic name, but it is in fact only used
for one niche use case: authorizing code in a `SetCodeTx`. So I propose
calling it `SetCodeAuthorization` instead. The signing function is
renamed to `SignSetCode` instead of `SignAuth`.
   
(2) The signing function for authorizations should take key as the first
parameter, and the authorization second. The key will almost always be
in a variable, while the authorization can be given as a literal.
2024-12-18 19:10:53 +01:00
Martin HS 1321a42525
cmd/evm: make evm statetest accept non-json files (#30927)
This fixes a regression introduced recently. Without this fix, it's not
possible to use statetests without `.json` suffix. This is problematic for
goevmlab `minimizer`, which appends the suffix `.min` during processing.
2024-12-18 00:18:36 +01:00
Felix Lange 06dfb42365
core/types, internal/ethapi: fixes for prague RPC encoding (#30926)
Fixing some issues I found while regenerating RPC tests for Prague:

- Authorization signature values were not encoded as hex
- `requestsRoot` in block should be `requestsHash`
- `authorizationList` should work for `eth_call`
2024-12-17 19:47:10 +01:00
Martin HS 5b9a3ea9d2
core/vm: make all opcodes proper type (#30925)
Noticed this omission while doing some work on goevmlab. We don't
properly type some of the opcodes, but apparently implicit casting works
in all the internal usecases.
2024-12-17 18:37:29 +01:00
dependabot[bot] feaf1c95b1
build(deps): bump golang.org/x/crypto from 0.26.0 to 0.31.0 (#30921)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from
0.26.0 to 0.31.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-17 15:26:03 +01:00
Felix Lange 71c28d8d2b
core: fixes for Prague fork in GenerateChain (#30924)
Adding some missing functionality I noticed while updating the hivechain
tool for the Prague fork:

- we forgot to process the parent block hash
- added `ConsensusLayerRequests` to get the requests list of the block
2024-12-17 15:16:17 +01:00
maskpp 3c208cdea8
accounts/abi/bind: make it possible to wait for tx hash (#30079)
This change adds methods which makes it possible for to wait for a transaction with a specific hash when deploying contracts during abi bind interaction.

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2024-12-17 09:12:10 +01:00
Martin HS 5c58612e12
core/vm, go.mod: update uint256 and use faster method to write to memory (#30868)
Updates geth to use the latest uint256, and use faster memory-writer
2024-12-17 08:58:26 +01:00
rjl493456442 bc1ec69008
trie/pathdb: state iterator (snapshot integration pt 4) (#30654)
In this pull request, the state iterator is implemented. It's mostly a copy-paste
from the original state snapshot package, but still has some important changes
to highlight here:

(a) The iterator for the disk layer consists of a diff iterator and a disk iterator.

Originally, the disk layer in the state snapshot was a wrapper around the disk, 
and its corresponding iterator was also a wrapper around the disk iterator.
However, due to structural differences, the disk layer iterator is divided into
two parts:

- The disk iterator, which traverses the content stored on disk.
- The diff iterator, which traverses the aggregated state buffer.

Checkout `BinaryIterator` and `FastIterator` for more details.

(b) The staleness management is improved in the diffAccountIterator and
diffStorageIterator

Originally, in the `diffAccountIterator`, the layer’s staleness had to be checked 
within the Next function to ensure the iterator remained usable. Additionally, 
a read lock on the associated diff layer was required to first retrieve the account 
blob. This read lock protection is essential to prevent concurrent map read/write. 
Afterward, a staleness check was performed to ensure the retrieved data was 
not outdated.

The entire logic can be simplified as follows: a loadAccount callback is provided 
to retrieve account data. If the corresponding state is immutable (e.g., diff layers
in the path database), the staleness check can be skipped, and a single account 
data retrieval is sufficient. However, if the corresponding state is mutable (e.g., 
the disk layer in the path database), the callback can operate as follows:

```go
func(hash common.Hash) ([]byte, error) {
    dl.lock.RLock()
    defer dl.lock.RUnlock()

    if dl.stale {
        return nil, errSnapshotStale
    }
    return dl.buffer.states.mustAccount(hash)
}
```

The callback solution can eliminate the complexity for managing
concurrency with the read lock for atomic operation.
2024-12-16 21:10:08 +08:00
lightclient f808d7357e
all: implement eip-7702 set code tx (#30078)
This PR implements EIP-7702: "Set EOA account code". 
Specification: https://eips.ethereum.org/EIPS/eip-7702

> Add a new transaction type that adds a list of `[chain_id, address,
nonce, y_parity, r, s]` authorization tuples. For each tuple, write a
delegation designator `(0xef0100 ++ address)` to the signing account’s
code. All code reading operations must load the code pointed to by the
designator.

---------

Co-authored-by: Mario Vega <marioevz@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2024-12-16 11:29:37 +01:00
Lucas 804d45cc2e
p2p: DNS resolution for static nodes (#30822)
Closes #23210 

# Context 
When deploying Geth in Kubernetes with ReplicaSets, we encountered two
DNS-related issues affecting node connectivity. First, during startup,
Geth tries to resolve DNS names for static nodes too early in the config
unmarshaling phase. If peer nodes aren't ready yet (which is common in
Kubernetes rolling deployments), this causes an immediate failure:


```
INFO [11-26|10:03:42.816] Starting Geth on Ethereum mainnet...
INFO [11-26|10:03:42.817] Bumping default cache on mainnet         provided=1024 updated=4096
Fatal: config.toml, line 81: (p2p.Config.StaticNodes) lookup idontexist.geth.node: no such host
``` 

The second issue comes up when pods get rescheduled to different nodes -
their IPs change but peers keep using the initially resolved IP, never
updating the DNS mapping.

This PR adds proper DNS support for enode:// URLs by deferring resolution
to connection time. It also handles DNS failures gracefully instead of failing
fatally during startup, making it work better in container environments where
IPs are dynamic and peers come and go during rollouts.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-12-13 12:46:12 +01:00
Antony Denyer 88cbfab332
internal/ethapi: add block override to estimateGas (#30695)
Add block overrides to `eth_estimateGas` to align consistency with
`eth_call`.


https://github.com/ethereum/go-ethereum/issues/27800#issuecomment-1658186166

Fixes https://github.com/ethereum/go-ethereum/issues/28175

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2024-12-12 12:39:03 +01:00
lorenzo c1c2507148
p2p: fix DiscReason encoding/decoding (#30855)
This fixes an issue where the disconnect message was not wrapped in a list.
The specification requires it to be a list like any other message.

In order to remain compatible with legacy geth versions, we now accept both
encodings when parsing a disconnect message.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-12-12 12:33:42 +01:00
gitglorythegreat c7e740f40c
core/state: remove pointless wrapper functions (#30891) 2024-12-11 11:05:59 +01:00
Darren Kelly 330190e476
accounts/abi: support unpacking solidity errors (#30738)
This PR adds the error fragments to `func (abi ABI) getArguments` which
allows typed decoding of errors.
2024-12-10 14:30:24 +01:00
Hteev Oli 4ed36ea1f8
build: update to Go 1.23.4 (#30872) 2024-12-10 14:22:43 +01:00
Martin HS 9045b79bc2
metrics, cmd/geth: change init-process of metrics (#30814)
This PR modifies how the metrics library handles `Enabled`: previously,
the package `init` decided whether to serve real metrics or just
dummy-types.

This has several drawbacks: 
- During pkg init, we need to determine whether metrics are enabled or
not. So we first hacked in a check if certain geth-specific
commandline-flags were enabled. Then we added a similar check for
geth-env-vars. Then we almost added a very elaborate check for
toml-config-file, plus toml parsing.

- Using "real" types and dummy types interchangeably means that
everything is hidden behind interfaces. This has a performance penalty,
and also it just adds a lot of code.

This PR removes the interface stuff, uses concrete types, and allows for
the setting of Enabled to happen later. It is still assumed that
`metrics.Enable()` is invoked early on.

The somewhat 'heavy' operations, such as ticking meters and exp-decay,
now checks the enable-flag to prevent resource leak.

The change may be large, but it's mostly pretty trivial, and from the
last time I gutted the metrics, I ensured that we have fairly good test
coverage.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-12-10 13:27:29 +01:00
Zheyuan He 4ecf08584c
core/vm: remove unnecessary comment (#30887) 2024-12-10 13:10:17 +01:00
Martin HS 75f847390f
cmd/evm: consolidate evm output switches (#30849)
This PR attempts to clean up some ambiguities and quirks from recent
changes to evm flag handling.

This PR mainly focuses on `evm run` subcommand, to use the same flags
for configuring tracing/output options as `statetest/blocktest` does.

Additionally, it adds quite a lot of tests for expected outputs of the
various subcommands, to avoid accidental changes.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-12-10 09:43:24 +01:00
rjl493456442 a91dcf3ee5
core/state: enable partial-functional reader (snapshot integration pt 3) (#30650)
It's a pull request based on https://github.com/ethereum/go-ethereum/pull/30643

In this pull request, the partial functional state reader is enabled if **legacy snapshot
is not enabled**. The tracked flat states in pathdb will be used to serve the state
retrievals, as the second implementation to fasten the state access.

This pull request should be a noop change in normal cases.
2024-12-10 10:10:49 +08:00
steven a722adb774
core/txpool: remove unused parameter `local` (#30871) 2024-12-09 19:29:19 +01:00
Guillaume Ballet 08e6bdb550
trie/utils: ensure master can generate a correct genesis for kaustinen7 (#30856)
This imports the following fixes:

 - update gnark to 1.1.0
 - update go-verkle to 0.2.2
 - fix: main storage offset bug (gballet/go-ethereum#329)
 - fix: tree key generation (gballet/go-ethereum#401)

---------

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Ignacio Hagopian <jsign.uy@gmail.com>
2024-12-06 12:14:05 +01:00
Nebojsa Urosevic 67a3b08795
core/tracing: extends tracing.Hooks with OnSystemCallStartV2 (#30786)
This PR extends the Hooks interface with a new method,
`OnSystemCallStartV2`, which takes `VMContext` as its parameter.

Motivation

By including `VMContext` as a parameter, the `OnSystemCallStartV2` hook
achieves parity with the `OnTxStart` hook in terms of provided insights.
This alignment simplifies the inner tracer logic, enabling consistent
handling of state changes and internal calls within the same framework.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2024-12-04 09:40:37 +01:00
Martin HS f0e7382f38
cmd/evm, eth/tracers: refactor structlogger and make it streaming (#30806)
This PR refactors the structlog a bit, making it so that it can be used
in a streaming mode.

-------------

OBS: this PR makes a change in the input `config` config, the third
input-parem field to `debug.traceCall`. Previously, seteting it to e.g.
` {"enableMemory": true, "limit": 1024}` would mean that the response
was limited to `1024` items. Since an 'item' may include both memory and
storage, the actual size of the response was undertermined.
After this change, the response will be limited to `1024` __`bytes`__
(or thereabouts).



-----------


The commandline usage of structlog now uses the streaming mode, leaving
the non-streaming mode of operation for the eth_Call.

There are two benefits of streaming mode 
1. Not have to maintain a long list of operations, 
2. Not have to duplicate / n-plicate data, e.g. memory / stack /
returndata so that each entry has their own private slice.


---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-12-04 08:52:59 +01:00
Felix Lange 84cabb587b
CODEOWNERS: add some more entries for auto assignment (#30851) 2024-12-03 16:11:26 +01:00