Commit graph

16963 commits

Author SHA1 Message Date
MariusVanDerWijden
fc0e03c667 core: new tests, behavior on exceptional halt 2026-04-30 18:43:30 +02:00
MariusVanDerWijden
6c1c599804 core: fix collisions 2026-04-30 13:35:24 +02:00
MariusVanDerWijden
d55c8f41d7 core: fix selfdestructs 2026-04-30 13:16:17 +02:00
MariusVanDerWijden
22c2891559 core/txpool: remove intrinsic gas bump 2026-04-28 13:54:44 +02:00
Stefan
6e6f8f26e5 params: mark amsterdam blob-schedule entry as optional (#34833)
## Summary

Marks `amsterdam` as `optional` in the blob-schedule fork-validation
table in `params/config.go::CheckConfigForkOrder`, so that a chain
config setting `amsterdamTime` no longer requires a corresponding
`blobSchedule.amsterdam` entry to be present.

## Why

Hive's `clients/<el>/mapper.jq` removed the `amsterdam` block from the
generated `blobSchedule` in
[ethereum/hive#1387](https://github.com/ethereum/hive/pull/1387)
("Remove Amsterdam blob param defaults — values are wrong; we agreed to
remove named forks from blob config").

With strict validation in place, every hive simulator that activates
Amsterdam — including `ethereum/eels/consume-engine` against
`bal-devnet-4` — now fails immediately at `geth init`:

```
Fatal: Failed to write genesis block: invalid chain configuration:
missing entry for fork "amsterdam" in blobSchedule
```

This shows up in the latest scheduled CI runs of
[ethpandaops/hive-tests](https://github.com/ethpandaops/hive-tests) as a
flood of `"could not start client … terminated unexpectedly"` errors on
Amsterdam tests (the simulator job is marked "success" only because the
simulator process itself completes — `tests=46285 failed=24369`).

The `bal-devnet-3` branch already carried a relaxation for the same
reason (commit
[`265d74b75`](https://github.com/ethereum/go-ethereum/commit/265d74b75)
commented the entire check out). This change is narrower:
- only `amsterdam` is marked optional,
- every other fork (`cancun`, `prague`, `osaka`, `bpo1..bpo5`) keeps its
strict check,
- `cur.config.validate()` still runs whenever a caller *does* supply a
blob entry, so misconfigured Amsterdam blob params remain rejected.

It also matches the pattern already used in the fork-ordering table just
above, where `amsterdam` and the BPO timestamps are likewise marked
`optional: true`.

## Test plan

- `go build ./...` and `go test ./params/...` pass locally.
- Reproduced the original failure: a freshly-built
`ethpandaops/geth:bal-devnet-4` errors at `geth init` on a genesis with
`amsterdamTime` set but no `blobSchedule.amsterdam`. With this patch
applied, the same `geth init` succeeds and writes the genesis state.
- Suggest re-running `ethpandaops/hive-tests` workflow
`hive-devnet-4.yaml` against this branch (`common_client_tag:
qu0b/relax-amsterdam-blobschedule-validation`, `client_source: git`) to
confirm Amsterdam tests start the client cleanly.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:54:44 +02:00
MariusVanDerWijden
c466102093 core: fixed costPerStateByte 2026-04-28 13:54:44 +02:00
MariusVanDerWijden
a86553ca43 core/types/bal: make txIndex uint32 2026-04-28 13:54:44 +02:00
MariusVanDerWijden
453b96292e core: dump BAL on mismatch 2026-04-28 13:54:44 +02:00
MariusVanDerWijden
a2ff54cdb1 cmd/evm: fix compile 2026-04-28 13:54:44 +02:00
MariusVanDerWijden
6e79849f2f core: fix genesis BAL hash 2026-04-28 13:54:44 +02:00
Jared Wasinger
6f8fc82d38 tests: add back devnet spec test runner 2026-04-28 13:54:44 +02:00
MariusVanDerWijden
a0f2390745 internal/ethapi: add BAL to rpc 2026-04-28 13:54:44 +02:00
Barnabas Busa
d45a9771ed miner: supply a slot number when synthesising pending block post-Amsterdam
getPending builds the pending block on demand via generateWork, but after
EIP-7843 (#33589) prepareWork rejects the call unless generateParams.slotNum
is non-nil once Amsterdam is active:

    if miner.chainConfig.IsAmsterdam(header.Number, header.Time) {
        if genParams.slotNum == nil {
            return nil, errors.New("no slot number set post-amsterdam")
        }
        header.SlotNumber = genParams.slotNum
    }

getPending never populated slotNum, so on any Amsterdam-activated chain
eth_getBalance(addr, "pending") (and every other RPC that resolves through
the pending state) fails with "pending state is not available", breaking
faucets and nonce trackers that poll pending.

Fix by synthesising a slot number from the parent header when available,
mirroring how the Shanghai branch above already conditionally populates
withdrawals. The pending block is empty post-merge so the exact slot value
is not user-visible; SlotNumber+1 (or zero) is sufficient to satisfy the
prepareWork invariant.

Observed on a bal-devnet-3 Geth build: every eth_getBalance(...,"pending")
returned -32000 "pending state is not available" until the faucet was
repointed at a non-Geth EL. Other clients (Nethermind, Besu, Reth, Erigon,
Ethrex) serve pending on the same chain without issue.
2026-04-28 13:54:44 +02:00
Barnabas Busa
075cc6417a core/txpool: report actual 110% threshold in intrinsic gas error
When a chain has gasCostPerStateByte != 0 (EIP-8037), the txpool
admission requires tx.Gas() >= ceil(intrGas.RegularGas * 10/9), but
the error message reported intrGas.RegularGas as the "minimum needed",
which is the unscaled value below the real threshold.

This is confusing: the user sees e.g. "gas 21000, minimum needed 21000"
for a simple transfer and assumes the comparison is broken, when in
fact the pool wants 23334.

Compute the threshold once and report it in the error.
2026-04-28 13:54:44 +02:00
Barnabas Busa
18025f9001 beacon/engine: regenerate gen_ed.go to include BlockAccessList
ExecutableData.BlockAccessList was added to the struct in types.go but
gen_ed.go was never regenerated, so MarshalJSON/UnmarshalJSON silently
dropped the field. engine_getPayloadV6 responses were emitted without
blockAccessList, which Prysm rejected with "missing required field
'blockAccessList' for ExecutionPayload", preventing any block
production post-genesis.

Regenerated via `go generate ./beacon/engine/`.
2026-04-28 13:54:44 +02:00
Barnabas Busa
2fa6e40365 core: set empty BlockAccessListHash on Amsterdam genesis 2026-04-28 13:54:44 +02:00
Marius van der Wijden
6ded1620db core: apply fixes for BAL (claude) 2026-04-28 13:54:44 +02:00
Marius van der Wijden
0cb107dfd6 core: apply fixes for 8037 2026-04-28 13:54:44 +02:00
Marius van der Wijden
a91cb20ae9 core: apply fixes for 8037 2026-04-28 13:54:44 +02:00
Marius van der Wijden
fa45d1a38f core: apply fixes for 8037 2026-04-28 13:54:44 +02:00
Marius van der Wijden
2d708415d7 core: apply fixes for 8037 2026-04-28 13:54:44 +02:00
Marius van der Wijden
c6c5536226 core: apply fixes for 8037 2026-04-28 13:54:44 +02:00
MariusVanDerWijden
16ba4de5a0 core: implement eip-7981: Increase Access List Cost 2026-04-28 13:54:44 +02:00
Marius van der Wijden
3cd0340d34 build: update BAL tests 2026-04-28 13:54:44 +02:00
Marius van der Wijden
abe23523c4 core/vm: fix ordering (8037 2026-04-28 13:54:44 +02:00
Jared Wasinger
e66e51e04f all: implement BAL single-threaded execution and validation 2026-04-28 13:54:44 +02:00
MariusVanDerWijden
3c21252fec core: implement EIP-8037: state creation gas cost increase 2026-04-26 11:39:41 +02:00
rayoo
b70d9a4b8e
core/state,core/types/bal: copy stateReadList in StateDB.Copy
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
The stateReadList field introduced by #34776 to track the state access
footprint for EIP-7928 was not propagated by StateDB.Copy. Every other
per-transaction field that lives alongside it (accessList,
transientStorage, journal, witness, accessEvents) is copied explicitly,
so this field was simply missed.

After Copy the copy's stateReadList is nil while the original keeps its
entries, so the nil-safe guards on StateAccessList.AddAccount / AddState
silently drop every access recorded on the copy. For any post-Amsterdam
code path that copies a prepared state and keeps reading from the copy,
the BAL footprint becomes incomplete.

Add a Copy method on bal.StateAccessList and invoke it from
StateDB.Copy, matching the pattern used for accessList and accessEvents.

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
2026-04-24 17:30:03 +02:00
rayoo
8091994e7b
eth/protocols/snap: fix data race on testPeer counters (#34802)
The testPeer request counters (nAccountRequests, nStorageRequests,
nBytecodeRequests, nTrienodeRequests) were plain int fields incremented
with ++. These increments happen in Request* methods that are invoked
concurrently by the Syncer from multiple goroutines
(assignBytecodeTasks, assignStorageTasks, etc.), causing a data race
reliably detected by go test -race.

Change the counters to atomic.Int64 so increments and reads are
synchronized without introducing a mutex.

Fixes races detected in TestMultiSyncManyUseless,
TestMultiSyncManyUselessWithLowTimeout,
TestMultiSyncManyUnresponsive, TestSyncWithStorageAndOneCappedPeer,
TestSyncWithStorageAndCorruptPeer, and
TestSyncWithStorageAndNonProvingPeer.
2026-04-24 13:37:34 +02:00
Bosul Mun
0da22dee45
eth/fetcher: lazy-allocate hashes slice in scheduleFetches
scheduleFetches.func1 is the biggest allocator in the long-duration
profile of node (11% of total alloc_space).
Each peer-iteration pre-allocated make([]common.Hash, 0, maxTxRetrievals),
even for peers that end up collecting no new hashes (all their announces
were already being fetched by someone else).

Defer the slice allocation to the first append. Peers that collect zero hashes
now pay zero allocation, which is the common case on the timeoutTrigger
path where all peers with any announces are iterated.
2026-04-24 13:24:52 +02:00
Sina M
c876755839
Update eth/fetcher/tx_fetcher.go
Co-authored-by: jwasinger <j-wasinger@hotmail.com>
2026-04-24 12:12:26 +02:00
YQ
33c1bd59ff
rpc: send WebSocket close frame on client disconnect (#33909)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
When `rpc.Client.Close()` is called, the TCP connection is torn down
without sending a WebSocket Close frame. The server sees `websocket:
close 1006 (abnormal closure): unexpected EOF` instead of a clean 1000
(normal closure).

### Root cause

`websocketCodec.close()` delegates to `jsonCodec.close()` which calls
`c.conn.Close()` — gorilla/websocket's `Conn.Close` explicitly "[closes
the underlying network connection without sending or waiting for a close
message](https://pkg.go.dev/github.com/gorilla/websocket#Conn.Close)"
(per RFC 6455).

### Fix

Send a WebSocket Close control frame (opcode 0x8, status 1000) before
closing the underlying connection. Uses `WriteControl` with the same
`encMu` mutex pattern already used by `pingLoop` for write
serialization, and reuses the existing `wsPingWriteTimeout` (5s)
constant.

`WriteControl` errors are safe to ignore — the connection may already be
broken by the time we attempt the close frame.

Fixes #30482
2026-04-24 11:27:39 +02:00
cui
6ece4cd143
crypto: fix unit test (#34811)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-04-24 10:02:34 +08:00
Bosul Mun
526ad4f6f1
crypto/kzg4844: add cell-related functions (#34766)
Some checks are pending
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
This PR adds three cell-level kzg functions required for the sparse
blobpool (eth/72).

- VerifyCells: Verifies cells corresponding to proofs. This is used to
verify cells received from eth/72 peers.
- ComputeCells: Computes cells from blobs. This is needed because user
submissions and eth/71 transaction deliveries contain blobs, while
eth/72 peers expect cells.
- RecoverBlobs: Recovers blobs from partial cells. This is needed to
support both eth/71 and eth/72

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2026-04-23 15:39:07 +02:00
Sina Mahmoodi
2ca74d2ef9 eth/fetcher: lazy-allocate hashes slice in scheduleFetches
scheduleFetches.func1 is the single biggest allocator in the Pyroscope
profile of a busy node (~13.5 GB/hr, 8% of total alloc_space). Each
peer-iteration pre-allocated 'make([]common.Hash, 0, maxTxRetrievals)'
= 8 KB, even for peers that end up collecting no new hashes (all their
announces were already being fetched by someone else).

Defer the slice allocation to the first append. Peers that collect zero
hashes now pay zero allocation, which is the common case on the
timeoutTrigger path where all peers with any announces are iterated.

New benchmarks BenchmarkScheduleFetches_{100peers_10new,
100peers_allFetching, 500peers_3new} (benchstat, 6 samples):

  scenario            ns/op       B/op        allocs/op
  100p/10new          unchanged   unchanged   unchanged   (fast path)
  100p/allFetching   -62%        -92%        -20%
  500p/3new          -22%        -44%         -7%
  geomean            -33%        -65%         -9%
2026-04-23 08:38:40 +00:00
Matus Kysel
8e2107dc39
cmd/devp2p: fix disconnect decoding in rlpx ping (#34781)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The rlpx ping command mishandled disconnect responses on two counts:
the error return from rlp.DecodeBytes was ignored, so decode failures
silently produced an "invalid disconnect message" error with no context;
and the decoder assumed the spec-compliant list form exclusively, while
older geth and some other implementations send the reason as a bare
byte.
                                                                  
Accept both wire forms (matching the legacy-tolerant behavior already
  in p2p.decodeDisconnectMessage), and on decode failure include the raw
payload so operators can see exactly what the peer sent. Add a unit
  test for the decoder covering both forms plus the empty-payload error
  path.
2026-04-22 16:48:38 +02:00
Sina M
b0ead5e17b
.gitea: add installer and archive steps for windows (#34793)
Adds the installer + archive steps that were done on appveyor to gitea
builder.
2026-04-22 16:18:29 +02:00
Guillaume Ballet
eb3283fb2e
accounts/usbwallet: revert github.com/karalabe/hid to fix freebsd build (#34784)
This PR reverts the last change to the freebsd build, and it fixes the
_direct_ FreeBSD build.

Here, we change the upstream of github.com/karalabe/hid to its new home,
github.com/ethereum/hid. The new dependency includes a dummy.go file
that makes `go mod vendor` work.

##### Origin of the problem

Enrique is maintaining the FreeBSD ports, and FreeBSD ports only support
vendored go modules. It turns out that `go mod vendor` will not include
C files if there is no `.go` file in the directory. Since the C files
were missing for `karalabe/hid`, the ports maintainer tried to use the
version of `hidapi` that is provided by the ports. To do so, he had to
modify the way things are included. This broke the _out of ports_
FreeBSD build.
2026-04-22 12:32:19 +02:00
Sina M
87b030780e
.github: add windows runner (#34742)
Difference to Appveyor:

- Missing 386 build. Hit some issue because user-space memory there is
around 2Gbs. Also seems generally extremely niche.
- Not doing the archive step and NSIS installer and uploads (those are
done on the builder).
2026-04-22 12:18:56 +02:00
rjl493456442
6f02965aab
core: track the state access footprint (#34776)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
This is a pre-requisite PR for landing the BAL construction
2026-04-22 13:42:49 +08:00
cui
3abc4cea35
core/state: use address hash cache if available (#34780) 2026-04-22 11:05:59 +08:00
cui
dca3cf02a2
core: pre-allocate the receipt slice (#34786) 2026-04-22 11:02:44 +08:00
rjl493456442
d422ab39d5
consensus, core, internal, miner: remove FinalizeAndAssemble (#34726)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR removes `FinalizeAndAssemble` from the consensus engine
interface
and relocates block assembly logic outside of the consensus engine.

Block assembly is consensus-agnostic. Most validations can be performed 
by the caller. For example:

- Withdrawals must be nil prior to Shanghai
- After Shanghai upgrade, withdrawals must be non-nil, even if empty.

The only notable consensus-specific validation is related to uncles. In
clique,
the concept of uncles does not exist, and any block containing uncles
should
be considered invalid.

Within the block production package, the policy is to produce blocks
according
to the latest chain specification. As a result, Clique-specific block
production
is no longer supported. This tradeoff is considered acceptable.
2026-04-21 20:58:21 +02:00
Guillaume Ballet
c374e74ee1
trie/bintrie: print todot path in binary (#34777)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The nodes were named using the byte representation of the path, instead
of the binary representation. This was confusing to other client devs
trying to achieve interop.
2026-04-21 14:50:09 +02:00
Barnabas Busa
f568ab9931
internal/telemetry: add gRPC transport for OTLP trace export (#33941)
## Summary
- Add `grpc://` and `grpcs://` URL scheme support for OTLP trace export
alongside existing `http://`/`https://`
- The OTLP spec defines two transports: HTTP (port 4318) and gRPC (port
4317). Many observability backends (Jaeger, Tempo, Datadog) prefer gRPC
for lower overhead
- Both `otlptracehttp` and `otlptracegrpc` return `*otlptrace.Exporter`,
so only exporter construction changes — everything downstream (batch
processor, tracer provider, lifecycle) is untouched
- Update flag usage strings to be transport-agnostic

## Example usage
```
geth --rpc.telemetry --rpc.telemetry.endpoint grpc://localhost:4317
geth --rpc.telemetry --rpc.telemetry.endpoint grpcs://tempo-grpc.example.com:443
```

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-21 14:48:21 +02:00
cui
077d83387a
metrics: reset internal value slice in Clear (#34761) 2026-04-21 13:58:49 +02:00
Marius van der Wijden
ac406c2fe7
core: implement eip-7976: Increase Calldata Floor Cost (#34748)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Increases calldata floor cost from 10/40 to 64/64
2026-04-21 16:20:02 +08:00
Toni Wahrstätter
e447a2696d
core/rawdb: clarify ReadLastPivotNumber comment (#34773)
clarify that `ReadLastPivotNumber` returns `nil` only when snap sync has
never been attempted, since the marker is written during snap sync and
never cleared.
2026-04-21 09:19:03 +08:00
rjl493456442
acbf699c33
core/state: export StateUpdate struct (#34724)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
In the recent refactoring, the state commit logic has been abstracted, 
making it more flexible to design state databases for various use cases.
For example, execution-only modes where state mutation is disabled.

As part of this change, the database interface was extended with a 
Commit function. However, it currently accepts an unexported struct
`stateUpdate`, which prevents downstream projects from customizing
the state commit behavior.

To address this limitation, the stateUpdate type is now exported.
2026-04-20 17:12:10 +02:00
rjl493456442
7e388fd09e
core/state: separate trie reader to mptReader and ubtReader (#34763)
This PR separates the trie reader to mptTrieReader and ubtTrieReader for
improved readability and extensibility.

---------

Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-20 15:04:42 +02:00