Commit graph

16814 commits

Author SHA1 Message Date
Marius van der Wijden
6c1d9e0c66 core/vm: burn gas on contract address collision 2026-03-10 14:50:41 +01:00
Marius van der Wijden
e93ddc03b7 core: fix floor calculation 2026-03-10 14:36:52 +01:00
Marius van der Wijden
6ed41d9d83 core/vm: fix create refunds 2026-03-10 13:46:27 +01:00
Marius van der Wijden
05315157c3 core/vm: fix refund logic 2026-03-10 13:39:50 +01:00
Marius van der Wijden
47f5715f86 core/vm: fix state gas refund logic 2026-03-10 13:03:16 +01:00
Marius van der Wijden
923e807372 core/vm: fix state gas refund logic 2026-03-10 12:54:47 +01:00
Marius van der Wijden
8d6622b86d core/vm: fix authorization gas calculation 2026-03-10 12:43:54 +01:00
Marius van der Wijden
03a86abfaa core/vm: properly account for 2d gas 2026-03-10 12:22:51 +01:00
Marius van der Wijden
88d7fff06a core/vm: reverting a bunch of slop from the ai 2026-03-09 18:43:59 +01:00
Marius van der Wijden
22738576fc core/vm: more fixes from ai 2026-03-09 13:27:42 +01:00
Marius van der Wijden
da4700411e core/vm: more fixes from ai 2026-03-09 12:08:07 +01:00
Stefan
6489aab697
core/vm: fix EIP-8037 CALL state gas ordering + code-store OOG underflow (#33972)
## Summary

Two EIP-8037 state gas accounting fixes:

1. **CALL state gas ordering** — Charge new-account state gas (112 ×
cpsb = 131,488) **before** the 63/64 child gas allocation, not after
2. **Code-store OOG underflow** — Do not inflate `TotalStateGasCharged`
when `UseGas` fails for code deposit, preventing uint64 underflow in
`blockGasUsed()`

## Bug 1: CALL state gas ordering (`operations_acl.go`)

In `makeCallVariantGasCall`, the EIP-8037 state gas for new account
creation was returned in the `GasCosts` struct and charged by the
interpreter's `UseGas`/`Sub` **after** `callGas()` had already computed
the 63/64 child gas allocation using the full (pre-state-gas)
`contract.Gas.RegularGas`.

When the state gas reservoir is empty (common case — reservoir only has
gas when `tx.gasLimit` exceeds `TX_MAX_GAS_LIMIT - intrinsic`), state
gas spills to regular gas. The spill amount (131,488) far exceeds the
1/64 retained gas (~15,600 at 1M gas), causing an underflow/OOG on CALLs
that should succeed.

**Fix:** Charge state gas directly before `callGas()` so the 63/64
calculation uses the reduced regular gas, then return `StateGas: 0` to
avoid double-charging. This matches nethermind's implementation
(`EvmInstructions.Call.cs:187-213`) and besu's approach.

**Spec basis:** EIP-8037 says "State gas charges deduct from
`state_gas_reservoir` first; when the reservoir is exhausted, from
`gas_left`." The 63/64 rule applies to `gas_left`, so state gas
spillover into `gas_left` must happen before the 63/64 computation.

## Bug 2: Code-store OOG underflow (`evm.go`)

In `initNewContract`, when `UseGas` fails for code deposit (code-store
OOG on valid code), the upstream code at `evm.go:666-672` added
`createDataGas.StateGas` to `TotalStateGasCharged` without actually
consuming any gas. For a 14KB init code output, this adds ~17.3M phantom
state gas to TSC.

This inflated TSC propagates through `blockGasUsed()`:
```
execRegularUsed := totalExecUsed - execStateUsed  // uint64 underflow when TSC > totalExecUsed
```
The underflow produces a massive `txRegular` value, causing
`ReturnGasAmsterdam` to reject the block with `gas limit reached`.

**Fix:** Remove the TSC inflation on `UseGas` failure (lines 666-672).
Also remove `ErrCodeStoreOutOfGas` from the `isCodeValidation` condition
(line 621-623), so code-store OOG follows the normal exceptional halt
path: all regular gas consumed, state gas reverted via
`RevertStateGas()`.

**Spec basis:** EIP-8037 §"Contract deployment cost calculation"
explicitly lists code-store OOG as a failure path:
> **Failure paths** (REVERT, OOG/invalid during initcode, **OOG during
code deposit**, or `L > MAX_CODE_SIZE`): Do NOT charge `GAS_CODE_DEPOSIT
* L` or `HASH_COST(L)`

And §"Transaction-level gas accounting":
> On child **exceptional halt**, all state gas consumed by the child,
both from the reservoir and any that spilled into `gas_left`, is
restored to the parent's reservoir.

## Test plan

- [x] geth+besu: 161 blocks (5+ epochs) with heavy spamoor load (eoatx
50 + evm-fuzz 25 + tx-fuzz 15), zero errors
- [x] Without Bug 2 fix: geth+besu chain-split at block ~30 under load —
`blockGasUsed` uint64 underflow
- [x] geth+nethermind: 86+ blocks no-load, 162 blocks eoatx load
(nethermind has separate BAL validation bug under fuzz)
- [x] geth+nimbus: 150+ blocks evm-fuzz with nimbus CALL fix applied —
gasUsed matches
- [x] Verified cross-client: nethermind and besu both charge CALL state
gas before 63/64

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 11:07:36 +01:00
Stefan
51018a536f
miner: fix nil statedb panic in applyTransaction pre-amsterdam (#33968)
## Summary

- When `accessList` is nil (pre-Amsterdam blocks), `stateCopy` is never
assigned and passed as nil to `core.ApplyTransaction`, causing a nil
pointer dereference at `state_processor.go:224`
(`statedb.Database().TrieDB().IsVerkle()`)
- This is a follow-up to 3e27b31d4 which fixed the `StateReaderTracker`
type assertion panic but missed this second crash path in the same
function
- Fix: set `stateCopy = env.state` in the non-Amsterdam path so
`ApplyTransaction` always receives a valid statedb

## Test plan

- [x] Verified fix with 8-client Kurtosis network (`gloas_fork_epoch:
256`, pre-Amsterdam): 36+ slots, zero missed blocks, zero geth errors
- [x] Both geth nodes (lighthouse + lodestar CLs) proposing blocks
successfully with spamoor tx load

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 15:08:07 +01:00
MariusVanDerWijden
3e27b31d45 miner: fix panic pre-prague 2026-03-06 14:05:17 +01:00
Jared Wasinger
db68d48081 add test skip list for devnet 3 tests that are broken in eest 2026-03-05 16:16:09 -05:00
Marius van der Wijden
0140060d96 core: fixed issues from devnet 2026-03-05 19:29:57 +01:00
Marius van der Wijden
e483205878 core: fixed issues from devnet 2026-03-05 18:28:35 +01:00
Marius van der Wijden
95c278fc20 core: fix mining issues 2026-03-05 18:05:05 +01:00
Marius van der Wijden
964a117ea7 core: fixed issues from devnet 2026-03-05 17:46:14 +01:00
Marius van der Wijden
d27b174680 core: fixed issues from devnet 2026-03-05 17:26:27 +01:00
MariusVanDerWijden
d14677f344 core: fix rebasing issues 2026-03-05 13:55:51 +01:00
Jared Wasinger
9fdd74be00 eth, cmd, rlp: implement EIP-7975 (eth/70 - partial block receipt lists) 2026-03-04 21:17:43 -05:00
Jared Wasinger
2ce7a06cbc address more lint errors 2026-03-04 21:17:43 -05:00
Jared Wasinger
59b5a78e11 fix some lint errors (TODO: merge this commit into the 7928 changes 2026-03-04 21:17:43 -05:00
Jared Wasinger
625d40458e update test fixtures to devnet 3. fix build 2026-03-04 21:17:43 -05:00
Jared Wasinger
737e473806 core: implement eip 7954 increase Maximum Contract Size
Co-authored-by: jeevan-sid <g1siddharthr@gmail.com>
2026-03-04 20:03:50 -05:00
Jared Wasinger
7ceb45e2e3 all: implement eip 7928 block access lists 2026-03-04 20:03:46 -05:00
Zsolt Felfoldi
6c639863ba core, core/vm: implement EIP-7708
Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com>
Co-authored-by: raxhvl <raxhvl@users.noreply.github.com>
2026-03-04 19:23:37 -05:00
J
fc8c10476d
internal/ethapi: add MaxUsedGas field to eth_simulateV1 response (#32789)
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
closes #32741
2026-03-04 12:37:47 +01:00
Jonny Rhea
402c71f2e2
internal/telemetry: fix undersized span queue causing dropped spans (#33927)
The BatchSpanProcessor queue size was incorrectly set to
DefaultMaxExportBatchSize (512) instead of DefaultMaxQueueSize (2048).

I noticed the issue on bloatnet when analyzing the block building
traces. During a particular run, the miner was including 1000
transactions in a single block. When telemetry is enabled, the miner
creates a span for each transaction added to the block. With the queue
capped at 512, spans were silently dropped when production outpaced the
span export, resulting in incomplete traces with orphaned spans. While
this doesn't eliminate the possibility of drops under extreme
load, using the correct default restores the 4x buffer between queue
capacity and export batch size that the SDK was designed around.
2026-03-04 11:47:10 +01:00
Jonny Rhea
28dad943f6
cmd/geth: set default cache to 4096 (#33836)
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
Mainnet was already overriding --cache to 4096. This PR just makes this
the default.
2026-03-04 11:21:11 +01:00
Marius van der Wijden
6d0dd08860
core: implement eip-7778: block gas accounting without refunds (#33593)
Implements https://eips.ethereum.org/EIPS/eip-7778

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2026-03-04 18:18:18 +08:00
rjl493456442
dd202d4283
core, ethdb, triedb: add batch close (#33708)
Pebble maintains a batch pool to recycle the batch object. Unfortunately
batch object must be
explicitly returned via `batch.Close` function. This PR extends the
batch interface by adding
the close function and also invoke batch.Close in some critical code
paths.

Memory allocation must be measured before merging this change. What's
more, it's an open
question that whether we should apply batch.Close as much as possible in
every invocation.
2026-03-04 11:17:47 +01:00
Jonny Rhea
814edc5308
core/vm: Switch to branchless normalization and extend EXCHANGE (#33869)
For bal-devnet-3 we need to update the EIP-8024 implementation to the
latest spec changes: https://github.com/ethereum/EIPs/pull/11306

> Note: I deleted tests not specified in the EIP bc maintaining them
through EIP changes is too error prone.
2026-03-04 10:34:27 +01:00
rjl493456442
6d99759f01
cmd, core, eth, tests: prevent state flushing in RPC (#33931)
Fixes https://github.com/ethereum/go-ethereum/issues/33572
2026-03-04 14:40:45 +08:00
DeFi Junkie
fe3a74e610
core/vm: use amsterdam jump table in lookup (#33947)
Return the Amsterdam instruction set from `LookupInstructionSet` when
`IsAmsterdam` is true, so Amsterdam rules no longer fall through to the
Osaka jump table.

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2026-03-04 13:42:25 +08:00
Jonny Rhea
4f75049ea0
miner: avoid unnecessary work after payload resolution (#33943)
In `buildPayload()`, the background goroutine uses a `select` to wait on
the recommit timer, the stop channel, and the end timer. When both
`timer.C` and `payload.stop` are ready simultaneously, Go's `select`
picks a case non-deterministically. This means the loop can enter the
`timer.C` case and perform an unnecessary `generateWork` call even after
the payload has been resolved.

Add a non-blocking check of `payload.stop` at the top of the `timer.C`
case to exit immediately when the payload has already been delivered.
2026-03-04 11:58:51 +08:00
Jonny Rhea
773f71bb9e
miner: enable trie prefetcher in block builder (#33945)
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-03-04 10:17:07 +08:00
Jonny Rhea
856e4d55d8
go.mod: bump go.opentelemetry.io/otel/sdk from 1.39.0 to 1.40.0 (#33946)
https://github.com/ethereum/go-ethereum/pull/33916 + cmd/keeper go mod
tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-03 22:28:09 +01:00
Felix Lange
db7d3a4e0e version: begin v1.17.2 release cycle
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-03-03 13:49:09 +01:00
Felix Lange
16783c167c version: release go-ethereum v1.17.1 stable 2026-03-03 13:41:41 +01:00
Felix Lange
9962e2c9f3
p2p/tracker: fix crash in clean when tracker is stopped (#33940) 2026-03-03 12:54:24 +01:00
Sina M
d318e8eba9
node: disable http2 for auth API (#33922)
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
We got a report that after v1.17.0 a geth-teku node starts to time out
on engine_getBlobsV2 after around 3h of operation. The culprit seems to
be our optional http2 service which Teku attempts first. The exact cause
of the timeout is still unclear.

This PR is more of a workaround than proper fix until we figure out the
underlying issue. But I don't expect http2 to particularly benefit
engine API throughput and latency. Hence it should be fine to disable it
for now.
2026-03-03 00:02:44 +01:00
vickkkkkyy
b25080cac0
miner: account for generateWork elapsed time in payload rebuild timer (#33908)
The payload rebuild loop resets the timer with the full Recommit
duration after generateWork returns, making the actual interval
generateWork_elapsed + Recommit instead of Recommit alone.

Since fillTransactions uses Recommit (2s) as its timeout ceiling, the
effective rebuild interval can reach ~4s under heavy blob workloads —
only 1–2 rebuilds in a 6s half-slot window instead of the intended 3.

Fix by subtracting elapsed time from the timer reset.

### Before this fix

```
t=0s  timer fires, generateWork starts
t=2s  fillTransactions times out, timer.Reset(2s)
t=4s  second rebuild starts
t=6s  CL calls getPayload — gets the t=2s result (1 effective rebuild)
```

### After

```
t=0s  timer fires, generateWork starts
t=2s  fillTransactions times out, timer.Reset(2s - 2s = 0)
t=2s  second rebuild starts immediately
t=4s  timer.Reset(0), third rebuild starts
t=6s  CL calls getPayload — gets the t=4s result (3 effective rebuilds)
```
2026-03-03 00:01:55 +01:00
Csaba Kiraly
48cfc97776
core/txpool/blobpool: delay announcement of low fee txs (#33893)
This PR introduces a threshold (relative to current market base fees),
below which we suppress the diffusion of low fee transactions. Once base
fees go down, and if the transactions were not evicted in the meantime,
we release these transactions.

The PR also updates the bucketing logic to be more sensitive, removing
the extra logarithm. Blobpool description is also
updated to reflect the new behavior.

EIP-7918 changed the maximim blob fee decrease that can happen in a
slot. The PR also updates fee jump calculation to reflect this.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2026-03-02 23:59:33 +01:00
Csaba Kiraly
1eead2ec33
core/types: fix transaction pool price-heap comparison (#33923)
Fixes priceheap comparison in some edge cases.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2026-03-02 23:42:39 +01:00
jwasinger
2726c9ef9e
core/vm: enable 8024 instructions in Amsterdam (#33928) 2026-03-02 17:01:06 -05:00
Guillaume Ballet
5695fbc156
.github: set @gballet as codeowner for keeper (#33920)
Some checks are pending
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-03-02 06:43:21 -07:00
Guillaume Ballet
825436f043
AGENTS.md: add instruction not to commit binaries (#33921)
I noticed that some autonomous agents have a tendency to commit binaries
if asked to create a PR.
2026-03-02 06:42:38 -07:00
Bosul Mun
723aae2b4e
eth/protocols/eth: drop protocol version eth/68 (#33511)
Some checks failed
/ Keeper Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
With this, we are dropping support for protocol version eth/68. The only supported
version is eth/69 now. The p2p receipt encoding logic can be simplified a lot, and
processing of receipts during sync gets a little faster because we now transform
the network encoding into the database encoding directly, without decoding the
receipts first.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2026-02-28 21:43:40 +01:00