Skip to content

Conversation

@laggu
Copy link
Contributor

@laggu laggu commented Feb 18, 2025

check if tx is successful before add tx to localTxTracker.

As localTxTracker keep tx and tries to add the tx to txpool, it can make failed rpc tx to success in some case
which is confused for developer.


example

rpc failed due to insufficient funds for gas.
developer might think the tx was not accepted by node but the tx is in localTxTracker
after developer send eth to the address for gas, the tx in localTxTracker will be in block

@MariusVanDerWijden
Copy link
Member

WDYT about doing it like this:

	if err := b.eth.txPool.Add([]*types.Transaction{signedTx}, false)[0]; err != nil {
	    return err
	}
	if locals := b.eth.localTxTracker; locals != nil {
		locals.Track(signedTx)
	}
	return nil

@rjl493456442
Copy link
Member

rjl493456442 commented Feb 18, 2025

Thanks for catching it.

Unfortunately it's a bit more complicated. The error could occur in several different circumstances,
e.g. invalid gas limit, low gas price, already known transaction and so on.

We should prevent tracking invalid transactions, like with invalid gas limit. But for the transactions
with low gas price, they should be tracked and be resubmitted later.

@holiman
Copy link
Contributor

holiman commented Feb 18, 2025 via email

@MariusVanDerWijden
Copy link
Member

Yep sorry, I checked it again and I agree with Martin. In the case of an underpriced transaction, the tx should still be added to the locals tracker. Maybe we should return a special error in that case to make the user aware that the transaction had a runtime error but is still being tracked

@laggu
Copy link
Contributor Author

laggu commented Feb 19, 2025

Afaicr, the localstracker doesn't track invalid txs, already. I think this PR basically makes the localstracker totally moot/unused. Seems wrong to me

I might be wrong but I cannot find localstracker checking if tx is invalid from below file
https://github.com/ethereum/go-ethereum/blob/dab746b3efb24954a9d556e910a53fe527846bf4/core/txpool/locals/tx_tracker.go

@laggu
Copy link
Contributor Author

laggu commented Feb 21, 2025

Yep sorry, I checked it again and I agree with Martin. In the case of an underpriced transaction, the tx should still be added to the locals tracker. Maybe we should return a special error in that case to make the user aware that the transaction had a runtime error but is still being tracked

As a web3 developer, speical state that a transaction returns error but it can be added to a block in the future is very confusing
error is an error. I think web3 developer should handle error case (include underpriced transaction)

@rjl493456442
Copy link
Member

@MariusVanDerWijden PTAL

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes LGTM

}
// Ignore the transactions which are failed for fundamental
// validation such as invalid parameters.
if tracker.pool.ValidateTxBasics(tx) != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should maybe add tracing log here, so we can see why a transaction was not tracked

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of log do you prefer? Info or Debug?

I am a bit concerned the Info logs might be overwhelming for certain types of node, e.g. rpc node.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug

// submitted transactions may be resubmitted later via the local tracker, which
// could cause confusion that a previously "rejected" transaction is later
// accepted.
return b.eth.txPool.Add([]*types.Transaction{signedTx}, false)[0]
Copy link
Contributor

@fjl fjl Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let's not return the error here!
We should instead return the error from locals.Track if there is one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems it's getting difficult to know a transaction has error or not...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. As localTxPool feature can be disabled by --txpool.nolocals flag
please return error like now when the flag is on

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}
// Ignore the transactions which are failed for fundamental
// validation such as invalid parameters.
if tracker.pool.ValidateTxBasics(tx) != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tx can stay local tx pool forever
seems it need more logic like retry count

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local transactions won’t remain stuck in the transaction pool indefinitely.

If a transaction fails stateful checks—such as the pool being full or the gas price being too low to replace an existing transaction—it will be resubmitted. However, we know that the state of the tx pool will change over time, meaning the locally tracked transaction may or may not be accepted quickly.

If the transaction has a relatively low gas price (but still higher than the minimum enforced by the node operator), it may remain stuck. This aligns with the original behavior of retaining local transactions. The only way to unblock it is by replacing it with a transaction that has a higher gas price.

Additionally, resubmitting the transaction every minute is not CPU-intensive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I was concerned is not cpu but memory.
It can cause memory leak as tx can reamin localTxTracker in some case

Attackers can use it to stop nodes by OOM killed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The local tracker only takes care the transactions submitted via the RPC endpoints, not the ones from the p2p network.

The node operators are supposed to take care of the node by themselves and can disable the local notion with public endpoints, e.g. infura node.

@fjl fjl added this to the 1.15.4 milestone Feb 28, 2025
@fjl fjl merged commit ebc3232 into ethereum:master Mar 1, 2025
1 of 2 checks passed
@laggu laggu deleted the local-tx-tracker branch March 3, 2025 01:46
jimmygchen pushed a commit to jimmygchen/go-ethereum that referenced this pull request Mar 12, 2025
In transaction-sending APIs such as `eth_sendRawTransaction`, a submitted transaction 
failing the configured txpool validation rules (i.e. fee too low) would cause an error to be
returned, even though the transaction was successfully added into the locals tracker.
Once added there, the transaction may even be included into the chain at a later time,
when fee market conditions change.

This change improves on this by performing the validation in the locals tracker, basically
skipping some of the validation rules for local transactions. We still try to add the tx to the
main pool immediately, but an error will only be returned for transactions which are 
fundamentally invalid.

---------

Co-authored-by: Gary Rong <[email protected]>
MariusVanDerWijden pushed a commit to MariusVanDerWijden/go-ethereum that referenced this pull request Mar 13, 2025
In transaction-sending APIs such as `eth_sendRawTransaction`, a submitted transaction 
failing the configured txpool validation rules (i.e. fee too low) would cause an error to be
returned, even though the transaction was successfully added into the locals tracker.
Once added there, the transaction may even be included into the chain at a later time,
when fee market conditions change.

This change improves on this by performing the validation in the locals tracker, basically
skipping some of the validation rules for local transactions. We still try to add the tx to the
main pool immediately, but an error will only be returned for transactions which are 
fundamentally invalid.

---------

Co-authored-by: Gary Rong <[email protected]>
thedevbirb referenced this pull request in chainbound/taiko-geth Mar 26, 2025
* accounts/usbwallet: support dynamic tx (#30180)

Adds support non-legacy transaction-signing using ledger

---------

Co-authored-by: Martin Holst Swende <[email protected]>

* signer/core: extended support for EIP-712 array types (#30620)

This change updates the EIP-712 implementation to resolve [#30619](https://github.com/ethereum/go-ethereum/issues/30619).

The test cases have been repurposed from the ethers.js [repository](https://github.com/ethers-io/ethers.js/blob/main/testcases/typed-data.json.gz), but have been updated to remove tests that don't have a valid domain separator; EIP-712 messages without a domain separator are not supported by geth.

---------

Co-authored-by: Martin Holst Swende <[email protected]>

* cmd/evm:  benchmarking via `statetest` command + filter by name, index and fork (#30442)

When `evm statetest --bench` is specified, benchmark the execution
similarly to `evm run`.

Also adds the ability to filter tests by name, index and fork. 

---------

Co-authored-by: Martin Holst Swende <[email protected]>

* beacon/blsync: remove cli dependencies (#30720)

This PR moves chain config related code (config file processing, fork
logic, network defaults) from `beacon/types` and `beacon/blsync` into
`beacon/params` while the command line flag logic of the chain config is
moved into `cmd/utils`, thereby removing the cli dependencies from
package `beacon` and its sub-packages.

* core/state: invoke OnCodeChange-hook on selfdestruct (#30686)

This change invokes the OnCodeChange hook when selfdestruct operation is performed, and a contract is removed. This is an event which can be consumed by tracers.

* trie/utils: remove unneeded initialization (#30472)

* travis: build and upload RISC-V docker images too (#30739)

Requested by @barnabasbusa

* core/state, triedb/database: refactor state reader (#30712)

Co-authored-by: Martin HS <[email protected]>

* eth/protocols/eth: add ETH68 protocol handler fuzzers (#30417)

Adds a protocol handler fuzzer to fuzz the ETH68 protocol handlers

* tests: fix test panic (#30741)

Fix panic in tests

* p2p/netutil: unittests for addrutil (#30439)

add unit tests for `p2p/addrutil`

---------

Co-authored-by: Martin HS <[email protected]>

* docs: fix typo (#30740)

fixes a typo on one of the postmortems

* core/state: tests on the binary iterator (#30754)

Fixes an error in the binary iterator, adds additional testcases

---------

Co-authored-by: Gary Rong <[email protected]>

* cmd/geth: remove unlock commandline flag (#30737)

This is one further step towards removing account management from
`geth`. This PR deprecates the flag `unlock`, and makes the flag moot:
unlock via geth is no longer possible.

* build: upgrade -dlgo version to Go 1.23.3 (#30742)

New release: https://groups.google.com/g/golang-announce/c/X5KodEJYuqI

* core: fix typos (#30767)

* all: remove kilic dependency from bls12381 fuzzers (#30296)

The [kilic](https://github.com/kilic/bls12-381) bls12381 implementation
has been archived. It shouldn't be necessary to include it as a fuzzing
target any longer.

This also adds fuzzers for G1/G2 mul that use inputs that are guaranteed
to be valid. Previously, we just did random input fuzzing for these
precompiles.

* core/txpool, eth/catalyst: clear transaction pool in Rollback (#30534)

This adds an API method `DropTransactions` to legacy pool, blob pool and
txpool interface. This method removes all txs currently tracked in the
pools.

It modifies the simulated beacon to use the new method in `Rollback`
which removes previous hacky implementation that also erroneously reset
the gas tip to 1 gwei.

---------

Co-authored-by: Felix Lange <[email protected]>

* rpc: run tests in parallel (#30384)

Continuation of https://github.com/ethereum/go-ethereum/pull/30381

* version: go-ethereum v1.14.12 stable

* version: begin v1.14.13 release cycle

* version: fix typo in v1.14.13 release cycle name

* core/vm/program: evm bytecode-building utility (#30725)

In many cases, there is a need to create somewhat nontrivial bytecode. A
recent example is the verkle statetests, where we want a `CREATE2`- op
to create a contract, which can then be invoked, and when invoked does a
selfdestruct-to-self.

It is overkill to go full solidity, but it is also a bit tricky do
assemble this by concatenating bytes. This PR takes an approach that
has been used in in goevmlab for several years.

Using this utility, the case can be expressed as: 
```golang
	// Some runtime code
	runtime := program.New().Ops(vm.ADDRESS, vm.SELFDESTRUCT).Bytecode()
	// A constructor returning the runtime code
	initcode := program.New().ReturnData(runtime).Bytecode()
	// A factory invoking the constructor
	outer := program.New().Create2AndCall(initcode, nil).Bytecode()
```

We have a lot of places in the codebase where we concatenate bytes, cast
from `vm.OpCode` . By taking tihs approach instead, thos places can be made a
bit more maintainable/robust.

* core, eth, internal, cmd: rework EVM constructor (#30745)

This pull request refactors the EVM constructor by removing the
TxContext parameter.

The EVM object is frequently overused. Ideally, only a single EVM
instance should be created and reused throughout the entire state
transition of a block, with the transaction context switched as needed
by calling evm.SetTxContext.

Unfortunately, in some parts of the code, the EVM object is repeatedly
created, resulting in unnecessary complexity. This pull request is the
first step towards gradually improving and simplifying this setup.

---------

Co-authored-by: Martin Holst Swende <[email protected]>

* core, eth, internal, miner: remove unnecessary parameters (#30776)

Follow-up to #30745 , this change removes some unnecessary parameters.

* internal/ethapi: remove double map-clone (#30788)

`ActivePrecompiledContracts()` clones the precompiled contract map, thus
its callsite does not need to clone it

* all: typos in comments (#30779)

fixes some typos

* trie: replace custom logic with bytes.HasPrefix (#30771)

in `trie`
- Replace custom logic with `bytes.HasPrefix`
- Remove unnecessary code in `GetNode`

* core, triedb: remove destruct flag in state snapshot (#30752)

This pull request removes the destruct flag from the state snapshot to
simplify the code.

Previously, this flag indicated that an account was removed during a
state transition, making all associated storage slots inaccessible.
Because storage deletion can involve a large number of slots, the actual
deletion is deferred until the end of the process, where it is handled
in batches.

With the deprecation of self-destruct in the Cancun fork, storage
deletions are no longer expected. Historically, the largest storage
deletion event in Ethereum was around 15 megabytes—manageable in memory.

In this pull request, the single destruct flag is replaced by a set of
deletion markers for individual storage slots. Each deleted storage slot
will now appear in the Storage set with a nil value.

This change will simplify a lot logics, such as storage accessing,
storage flushing, storage iteration and so on.

* internal/flags: fix "flag redefined" bug for alias on custom flags (#30796)

This change fixes a bug on the `DirectoryFlag` and the `BigFlag`, which would trigger a `panic` with the message "flag redefined" in case an alias was added to such a flag.

* eth/tracers/logger: fix json-logger output missing (#30804)

Fixes a flaw introduced in
https://github.com/ethereum/go-ethereum/pull/29795 , discovered while
reviewing https://github.com/ethereum/go-ethereum/pull/30633 .

* eth/tracers/logger: improve markdown logger (#30805)

This PR improves the output of the markdown logger a bit.

- Remove `RStack` field, 
- Move `Stack` last, since it may have very large vertical expansion
- Make the pre- and post-exec  metadata structured into a bullet-list

* internal/ethapi: remove double map-clone (#30803)

Similar to https://github.com/ethereum/go-ethereum/pull/30788

* accounts/abi:  fix MakeTopics mutation of big.Int inputs (#30785)

#28764 updated `func MakeTopics` to support negative `*big.Int`s.
However, it also changed the behavior of the function from just
_reading_ the input `*big.Int` via `Bytes()`, to leveraging
`big.U256Bytes` which is documented as being _destructive_:

This change updates `MakeTopics` to not mutate the original, and 
also applies the same change in signer/core/apitypes.

* core/state/snapshot: simplify snapshot rebuild (#30772)

This PR is purely for improved readability; I was doing work involving
the file and think this may help others who are trying to understand
what's going on.

1. `snapshot.Tree.Rebuild()` now returns a function that blocks until
regeneration is complete, allowing `Tree.waitBuild()` to be removed
entirely as all it did was search for the `done` channel behind this new
function.
2. Its usage inside `New()` is also simplified by (a) only waiting if
`!AsyncBuild`; and (b) avoiding the double negative of `if !NoBuild`.

---------

Co-authored-by: Martin HS <[email protected]>

* eth/ethconfig: improve error message if TTD missing (#30807)

This updates the message you get when trying to initialize Geth with
genesis.json that doesn't have `terminalTotalDifficulty`. The previous
message was a bit obscure, I had to check the code to find out what the
problem was.

* core/tracing: add GetCodeHash to StateDB (#30784)

This PR extends the tracing.StateDB interface by adding a GetCodeHash function.

* Revert "core/state/snapshot: simplify snapshot rebuild (#30772)" (#30810)

This reverts commit 23800122b37695be50565f8221858a16ce1763db.

The original pull request introduces a bug and some flaky tests are
detected because of this flaw.

```
--- FAIL: TestRecoverSnapshotFromWipingCrash (0.27s)
    blockchain_snapshot_test.go:158: The disk layer is not integrated snapshot is not constructed
{"pc":0,"op":88,"gas":"0x7148","gasCost":"0x2","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PC"}
{"pc":1,"op":255,"gas":"0x7146","gasCost":"0x1db0","memSize":0,"stack":["0x0"],"depth":1,"refund":0,"opName":"SELFDESTRUCT"}
{"output":"","gasUsed":"0x0"}
{"output":"","gasUsed":"0x1db2"}
{"pc":0,"op":116,"gas":"0x13498","gasCost":"0x3","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH21"}
```

Before the original PR, the snapshot would block the function until the
disk layer
was fully generated under the following conditions:

(a) explicitly required by users with `AsyncBuild = false`.
(b) the snapshot was being fully rebuilt or *the disk layer generation
had resumed*.

Unfortunately, with the changes introduced in that PR, the snapshot no
longer waits
for disk layer generation to complete if the generation is resumed. It
brings lots of
uncertainty and breaks this tiny debug feature.

* cmd/evm: don't reuse state between iterations, show errors (#30780)

Reusing state between benchmark iterations resulted in inconsistent
results across runs, which surfaced in https://github.com/ethereum/go-ethereum/issues/30778 .

If these errors are triggered again, they will now trigger panic. 

---------

Co-authored-by: Martin HS <[email protected]>

* core: better document reason for dropping error on return (#30811)

Add a comment for error return of nil

Signed-off-by: wangjingcun <[email protected]>

* core/state/snapshot: handle legacy journal (#30802)

This workaround is meant to minimize the possibility for snapshot generation
once the geth node upgrades to new version (specifically #30752 )

In #30752, the journal format in state snapshot is modified by removing
the destruct set. Therefore, the existing old format (version = 0) will be
discarded and all in-memory layers will be lost. Unfortunately, the lost 
in-memory layers can't be recovered by some other approaches, and the 
entire state snapshot will be regenerated (it will last about 2.5 hours).

This pull request introduces a workaround to adopt the legacy journal if
the destruct set contained is empty. Since self-destruction has been
deprecated following the cancun fork, the destruct set is expected to be nil for
layers above the fork block. However, an exception occurs during contract 
deployment: pre-funded accounts may self-destruct, causing accounts with 
non-zero balances to be removed from the state. For example,
https://etherscan.io/tx/0xa087333d83f0cd63b96bdafb686462e1622ce25f40bd499e03efb1051f31fe49).


For nodes with a fully synced state, the legacy journal is likely compatible with
the updated definition, eliminating the need for regeneration. Unfortunately,
nodes performing a full sync of historical chain segments or encountering 
pre-funded account deletions may face incompatibilities, leading to automatic 
snapshot regeneration.

* trie: combine validation loops in VerifyRangeProof (#30823)

Small optimization. It's guaranteed that `len(keys)` == `len(values)`,
so we can combine the checks in a single loop rather than 2 separate
loops.

* all: exclude empty outputs in requests commitment (#30670)

Implements changes from these spec PRs:

- https://github.com/ethereum/EIPs/pull/8989
- https://github.com/ethereum/execution-apis/pull/599

* cmd/bootnode: remove bootnode utility (#30813)

Since we don't really support custom networks anymore, we don't need the
bootnode utility. In case a discovery-only node is wanted, it can still be run using cmd/devp2p.

* core/types: add length check in CalcRequestsHash (#30829)

The existing implementation is correct when building and verifying
blocks, since we will only collect non-empty requests into the block
requests list.

But it isn't correct for cases where a requests list containing empty
items is sent by the consensus layer on the engine API. We want to
ensure that empty requests do not cause a difference in validation
there, so the commitment computation should explicitly skip them.

* triedb/pathdb: track flat state changes in pathdb (snapshot integration pt 2) (#30643)

This pull request ports some changes from the main state snapshot
integration one, specifically introducing the flat state tracking in
pathdb.

Note, the tracked flat state changes are only held in memory and won't
be persisted in the disk. Meanwhile, the correspoding state retrieval in
persistent state is also not supported yet. The states management in
disk is more complicated and will be implemented in a separate pull
request.

Part 1: https://github.com/ethereum/go-ethereum/pull/30752

* core/state: introduce code reader interface (#30816)

This PR introduces a `ContractCodeReader` interface with functions defined:

type ContractCodeReader interface {
	Code(addr common.Address, codeHash common.Hash) ([]byte, error)
	CodeSize(addr common.Address, codeHash common.Hash) (int, error)
}

This interface can be implemented in various ways. Although the codebase
currently includes only one implementation, additional implementations
could be created for different purposes and scenarios, such as a code
reader designed for the Verkle tree approach or one that reads code from
the witness.

*Notably, this interface modifies the function’s semantics. If the
contract code is not found, no error will be returned. An error should
only be returned in the event of an unexpected issue, primarily for
future implementations.*

The original state.Reader interface is extended with ContractCodeReader
methods, it gives us more flexibility to manipulate the reader with additional
logic on top, e.g. Hooks.

type Reader interface {
	ContractCodeReader
	StateReader
}

---------

Co-authored-by: Felix Lange <[email protected]>

* core: switch EVM tx context in ApplyMessage (#30809)

This change relocates the EVM tx context switching to the ApplyMessage function.
With this change, we can remove a lot of EVM.SetTxContext calls before
message execution.

### Tracing API changes

- This PR replaces the `GasPrice` field of the `VMContext` struct with
  `BaseFee`. Users may instead take the effective gas price from
  `tx.EffectiveGasTipValue(env.BaseFee)`.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* eth/tracers: fix state hooks in API (#30830)

When a tx/block was being traced through the API the state hooks weren't
being called as they should. This is due to #30745 moving the hooked
statedb one level up in the state processor. This PR fixes that.

---------

Co-authored-by: Martin HS <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* cmd/evm: improve block/state test runner (#30633)

* unify `staterunner` and `blockrunner` CLI flags, especially around
tracing
* added support for struct logger or json logging (although having issue
#30658)
* new --cross-check flag to validate the stateless witness collection
  / execution matches stateful
* adds support for tracing the stateless execution when a tracer is set
  (to more easily debug differences)
* --human for more readable test summary
* directory or file input, so if you pass tests/spec-tests/fixtures/blockchain_tests it will execute all
blockchain tests

* fuzzing: fix oss-fuzz fuzzer (#30845)

The fuzzer added recenly to fuzz the eth handler doesn't
build on oss-fuzz, because it also has dependencies in the peer_test.go.

This change fixes it, I hope, by adding that file also for preprocessing.

* internal/debug: rename --trace to --go-execution-trace (#30846)

This flag is very rarely needed, so it's OK for it to have a verbose
name. The name --trace also conflicts with the concept of EVM tracing,
which is much more heavily used.

* eth/downloader: move SyncMode to package eth/ethconfig (#30847)

Lots of packages depend on eth/downloader just for the SyncMode type.
Since we have a dedicated package for eth protocol configuration, it
makes more sense to define SyncMode there, turning eth/downloader into
more of a leaf package.

* CODEOWNERS: add some more entries for auto assignment (#30851)

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Ignacio Hagopian <[email protected]>

* core/txpool: remove unused parameter `local`  (#30871)

* 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.

* 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 <[email protected]>

* core/vm: remove unnecessary comment (#30887)

* 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 <[email protected]>

* build: update to Go 1.23.4 (#30872)

* accounts/abi: support unpacking solidity errors (#30738)

This PR adds the error fragments to `func (abi ABI) getArguments` which
allows typed decoding of errors.

* core/state: remove pointless wrapper functions (#30891)

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Martin Holst Swende <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* 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.

* 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

* 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 <[email protected]>

* 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

* 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] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 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.

* 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`

* 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.

* 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.

* core/types: rename SetCodeAuthorization 'v' to 'yParity'

The API spec requires the name yParity.

* cmd/evm: update tests for SetCodeAuthorization JSON encoding change (#30936)

Fixing a regression introduced by 73a4ecf675f6, which I accidentally
pushed to the master branch directly.

* 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.

* params: update system contracts for prague devnet-5 (#30938)

* internal/flags: update copyright year to 2025 (#30976)

* 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:
*
https://cs.opensource.google/go/x/crypto/+/8d7daa0c54b357f3071e11eaef7efc4e19a417e2
* https://github.com/cloudflare/bn256/pull/33

* all: use cmp.Compare (#30958)

* 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 <[email protected]>

* internal/ethapi: update default simulation timestamp increment to 12 (#30981)

Update the default timestamp increment to 12s for `eth_simulate` endpoint

* 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

* core/types: improve printList in DeriveSha test (#30969)

* 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 <[email protected]>

* cmd/clef: fix JS issues in documentation (#30980)

Fixes a couple of js-flaws in the docs

* triedb/pathdb: fix tester generator (#30972)

This change fixes is a rare bug in test generator: If the run is very unlucky it
can use `modifyAccountOp` / `deleteAccountOp` without creating any
account, leading to have a trie root same as the parent.

This change makes the first operation always be a creation.

* README: remove private network section from readme (#31005)

* triedb/pathdb: configure different node hasher in pathdb (#31008)

As the node hash scheme in verkle and merkle are totally different, the
original default node hasher in pathdb is no longer suitable. Therefore,
this pull request configures different node hasher respectively.

* build: upgrade golangci-lint to v1.63.4 (#31019)

This PR upgrades `golangci-lint` to v1.63.4 and fixes a warn message
which is reported by v1.63.4:

```text
WARN [config_reader] The configuration option `run.skip-dirs-use-default` is deprecated, please use `issues.exclude-dirs-use-default`.
```

Also fixes 2 warnings which are reported by v1.63.4:

```text
core/txpool/blobpool/blobpool.go:1754:12: S1005: unnecessary assignment to the blank identifier (gosimple)
        for acct, _ := range p.index {
                  ^
core/txpool/legacypool/legacypool.go:1989:19: S1005: unnecessary assignment to the blank identifier (gosimple)
        for localSender, _ := range pool.locals.accounts {
                         ^
```

* eth/tracers/logger: return revert reason (#31013)

Fix the error comparison in tracer to prevent dropping revert reason data

---------

Co-authored-by: Martin <[email protected]>
Co-authored-by: rjl493456442 <[email protected]>

* cmd/devp2p/internal/ethtest: using slices.SortFunc to simplify the code (#31012)


Co-authored-by: Felix Lange <[email protected]>

* core/txpool/legacypool: fix flaky test TestAllowedTxSize (#30975)

- it was failing because the maximum data length (previously `dataSize`)
was set to `txMaxSize - 213` but should had been `txMaxSize - 103` and
the last call `dataSize+1+uint64(rand.Intn(10*txMaxSize)))` would
sometimes fail depending on rand.Intn.
- Maximal transaction data size comment (invalid) replaced by code logic
to find the maximum tx length without its data length
- comments and variable naming improved for clarity
- 3rd pool add test replaced to add just 1 above the maximum length,
which is important to ensure the logic is correct

* core: remove unused function parameters (#31001)

* cmd, core, miner: rework genesis setup (#30907)

This pull request refactors the genesis setup function, the major
changes are highlighted here:

**(a) Triedb is opened in verkle mode if `EnableVerkleAtGenesis` is
configured in chainConfig or the database has been initialized previously with
`EnableVerkleAtGenesis` configured**.

A new config field `EnableVerkleAtGenesis` has been added in the
chainConfig. This field must be configured with True if Geth wants to initialize 
the genesis in Verkle mode.

In the verkle devnet-7, the verkle transition is activated at genesis.
Therefore, the verkle rules should be used since the genesis. In production
networks (mainnet and public testnets), verkle activation always occurs after
the genesis block. Therefore, this flag is only made for devnet and should be
deprecated later. Besides, verkle transition at non-genesis block hasn't been
implemented yet, it should be done in the following PRs.

**(b) The genesis initialization condition has been simplified**
There is a special mode supported by the Geth is that: Geth can be
initialized with an existing chain segment, which can fasten the node sync
process by retaining the chain freezer folder.

Originally, if the triedb is regarded as uninitialized and the genesis block can
be found in the chain freezer, the genesis block along with genesis state will be
committed. This condition has been simplified to checking the presence of chain
config in key-value store. The existence of chain config can represent the genesis
has been committed.

* all: fix some typos in comments and names (#31023)

* core/types: change SetCodeTx.ChainID to uint256 (#30982)

We still need to decide how to handle non-specfic `chainId` in the JSON
encoding of authorizations. With `chainId` being a uint64, the previous
implementation just used value zero. However, it might actually be more
correct to use the value `null` for this case.

* eth/gasprice: ensure cache purging goroutine terminates with subscription (#31025)

* beacon/engine: check for empty requests (#31010)

According to
https://github.com/ethereum/execution-apis/blob/main/src/engine/prague.md#engine_newpayloadv4:

> Elements of the list MUST be ordered by request_type in ascending
order. Elements with empty request_data MUST be excluded from the list.

---------

Co-authored-by: lightclient <[email protected]>

* core: use sync.Once for SenderCacher initialization (#31029)

This changes the SenderCacher so its goroutines will only be started on first use.
Avoids starting them when package core is just imported but core.BlockChain isn't used.

* core/txpool/legacypool: ensure pending nonces are reset by SubPool.Clear (#31020)

closes https://github.com/ethereum/go-ethereum/issues/30842

* core/tracing: document `OnCodeChange` now being called from SelfDestruct (#31007)

Co-authored-by: Sina M <[email protected]>

* all: implement state history v2 (#30107)

This pull request delivers the new version of the state history, where
the raw storage key is used instead of the hash.

Before the cancun fork, it's supported by protocol to destruct a
specific account and therefore, all the storage slot owned by it should
be wiped in the same transition.

Technically, storage wiping should be performed through storage
iteration, and only the storage key hash will be available for traversal
if the state snapshot is not available. Therefore, the storage key hash
is chosen as the identifier in the old version state history.

Fortunately, account self-destruction has been deprecated by the
protocol since the Cancun fork, and there are no empty accounts eligible
for deletion under EIP-158. Therefore, we can conclude that no storage
wiping should occur after the Cancun fork. In this case, it makes no
sense to keep using hash.

Besides, another big reason for making this change is the current format
state history is unusable if verkle is activated. Verkle tree has a
different key derivation scheme (merkle uses keccak256), the preimage of
key hash must be provided in order to make verkle rollback functional.
This pull request is a prerequisite for landing verkle.

Additionally, the raw storage key is more human-friendly for those who
want to manually check the history, even though Solidity already
performs some hashing to derive the storage location.

---

This pull request doesn't bump the database version, as I believe the
database should still be compatible if users degrade from the new geth
version to old one, the only side effect is the persistent new version
state history will be unusable.

---------

Co-authored-by: Zsolt Felfoldi <[email protected]>

* ethdb/memorydb: faster DeleteRange (#31038)

This PR replaces the iterator based DeleteRange implementation of
memorydb with a simpler and much faster loop that directly deletes keys
in the order of iteration instead of unnecessarily collecting keys in
memory and sorting them.

---------

Co-authored-by: Martin HS <[email protected]>

* cmd/abigen: require either `--abi` or `--combined-json` (#31045)

This PR addresses issue #30768 , which highlights that running
cmd/abigen/abigen --pkg my_package example.json (erroneously omitting
the --abi flag) generates an empty binding, when it should fail
explicitly.

---------

Co-authored-by: jwasinger <[email protected]>

* core/types: correct chainId check for pragueSigner (#31032)

Use zero value check for the pragueSigner

This aligns with cancunSigner and londonSigner as well.

* build: upgrade -dlgo version to Go 1.23.5 (#31037)

* core/types: initialize ChainID in SetCodeTx copy method (#31054)

* core/txpool:  terminate subpool reset goroutine if pool was closed (#31030)

if the pool terminates before `resetDone` can be read, then the
go-routine will hang.

* cmd/evm: refactor handling output-files for `t8n` (#30854)

As part of trying to make the inputs and outputs of the evm subcommands
more streamlined and aligned, this PR modifies how `evm t8n` manages
output-files.

Previously, we do a kind of wonky thing where between each transaction,
we invoke a `getTracer` closure. In that closure, we create a new
output-file, a tracer, and then make the tracer stream output to the
file. We also fiddle a bit to ensure that the file becomes properly
closed.

It is a kind of hacky solution we have in place. This PR changes it, so
that from the execution-pipeline point of view, we have just a regular
tracer. No fiddling with re-setting it or closing files.

That particular tracer, however, is a bit special: it takes care of
creating new files per transaction (in the tx-start-hook) and closing
(on tx-end-hook). Also instantiating the right type of underlying
tracer, which can be a json-logger or a custom tracer.

---------

Co-authored-by: Gary Rong <[email protected]>

* eth/filters: ensure API timeoutLoop terminates with event system (#31056)

Discovered from failing test introduced
https://github.com/ethereum/go-ethereum/pull/31033 . We should ensure
`timeoutLoop` terminates if the filter event system is terminated.

* go.mod: remove toolchain line (#31057)

We have our own system for downloading the toolchain, and really don't
want Go's to get in the way of that. We may switch to Go's builtin
toolchain support, but not now.

* cmd/evm: restore --bench flag to evm statetest (#31055)

Refactoring of the `evm` command moved where some commands were valid.
One command, `--bench`, used to work in `evm statetest`. The pluming is
still in place. This PR puts the `--bench` flag in the place the trace
flags were moved, and adds tests to validate the bench flag operates in
`run` and `statetest`

---------

Co-authored-by: Felix Lange <[email protected]>

* p2p: support configuring NAT in TOML file (#31041)

This is an alternative for #27407 with a solution based on gencodec.
With the PR, one can now configure like this:

```
# config.toml
[Node.P2P]
NAT = "extip:33.33.33.33"
```

```shell
$ geth --config config.toml
...
INFO [01-17|16:37:31.436] Started P2P networking      self=enode://[email protected]:30303
```

* go.mod: gencodec stable v0.1.0 (#31062)

* triedb/pathdb: fix state revert on v2 history (#31060)

State history v2 has been shipped and will take effect after the Cancun fork.
However, the state revert function does not differentiate between v1 and v2,
instead blindly using the storage map key for state reversion. 

This mismatch between the keys of the live state set and the state history
can trigger a panic: `non-existent storage slot for reverting`.

This flaw has been fixed in this PR.

* trie: reduce allocations in stacktrie (#30743)

This PR uses various tweaks and tricks to make the stacktrie near
alloc-free.

```
[user@work go-ethereum]$ benchstat stacktrie.1 stacktrie.7
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/trie
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
             │ stacktrie.1  │             stacktrie.7              │
             │    sec/op    │    sec/op     vs base                │
Insert100K-8   106.97m ± 8%   88.21m ± 34%  -17.54% (p=0.000 n=10)

             │   stacktrie.1    │             stacktrie.7              │
             │       B/op       │     B/op      vs base                │
Insert100K-8   13199.608Ki ± 0%   3.424Ki ± 3%  -99.97% (p=0.000 n=10)

             │  stacktrie.1   │             stacktrie.7             │
             │   allocs/op    │ allocs/op   vs base                 │
Insert100K-8   553428.50 ± 0%   22.00 ± 5%  -100.00% (p=0.000 n=10)
```
Also improves derivesha:
```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
                          │ derivesha.1 │             derivesha.2              │
                          │   sec/op    │    sec/op     vs base                │
DeriveSha200/stack_trie-8   477.8µ ± 2%   430.0µ ± 12%  -10.00% (p=0.000 n=10)

                          │ derivesha.1  │             derivesha.2              │
                          │     B/op     │     B/op      vs base                │
DeriveSha200/stack_trie-8   45.17Ki ± 0%   25.65Ki ± 0%  -43.21% (p=0.000 n=10)

                          │ derivesha.1 │            derivesha.2             │
                          │  allocs/op  │ allocs/op   vs base                │
DeriveSha200/stack_trie-8   1259.0 ± 0%   232.0 ± 0%  -81.57% (p=0.000 n=10)

```

---------

Co-authored-by: Gary Rong <[email protected]>

* eth/catalyst: fail on duplicate request types (#31071)

Refer to: https://github.com/ethereum/execution-apis/pull/623

* accounts/usbwallet: fix ledger access for latest firmware and add Ledger Flex (#31004)

The latest firmware for Ledger Nano S Plus now returns `0x5000` for it's
product ID, which doesn't match any of the product IDs enumerated in
`hub.go`.

This PR removes the assumption about the interfaces exposed, and simply
checks the upper byte for a match.

Also adds support for the `0x0007` / `0x7000` product ID (Ledger Flex).

* core/vm: implement EIP-2537 spec updates (#30978)

Reference:

- Remove MUL precompiles: https://github.com/ethereum/EIPs/pull/8945
- Pricing change for pairing operation:
https://github.com/ethereum/EIPs/pull/9098
- Pricing change for add, mapping and mul operations:
https://github.com/ethereum/EIPs/pull/9097
- Pricing change for MSM operations:
https://github.com/ethereum/EIPs/pull/9116

---------

Co-authored-by: Marius van der Wijden <[email protected]>

* p2p/nat: add stun protocol (#31064)

This implements a basic mechanism to query the node's external IP using
a STUN server. There is a built-in list of public STUN servers for convenience.
The new detection mechanism must be selected explicitly using `--nat=stun` 
and is not enabled by default in Geth.

Fixes #30881

---------

Co-authored-by: Felix Lange <[email protected]>

* fix README.md (#31076)

Hi
I fixed 2 minor spelling issues.

---------

Co-authored-by: lightclient <[email protected]>

* chore: fix various comments (#31082)

* all: nuke total difficulty (#30744)

The total difficulty is the sum of all block difficulties from genesis
to a certain block. This value was used in PoW for deciding which chain
is heavier, and thus which chain to select. Since PoS has a different
fork selection algorithm, all blocks since the merge have a difficulty
of 0, and all total difficulties are the same for the past 2 years.

Whilst the TDs are mostly useless nowadays, there was never really a
reason to mess around removing them since they are so tiny. This
reasoning changes when we go down the path of pruned chain history. In
order to reconstruct any TD, we **must** retrieve all the headers from
chain head to genesis and then iterate all the difficulties to compute
the TD.

In a world where we completely prune past chain segments (bodies,
receipts, headers), it is not possible to reconstruct the TD at all. In
a world where we still keep chain headers and prune only the rest,
reconstructing it possible as long as we process (or download) the chain
forward from genesis, but trying to snap sync the head first and
backfill later hits the same issue, the TD becomes impossible to
calculate until genesis is backfilled.

All in all, the TD is a messy out-of-state, out-of-consensus computed
field that is overall useless nowadays, but code relying on it forces
the client into certain modes of operation and prevents other modes or
other optimizations. This PR completely nukes out the TD from the node.
It doesn't compute it, it doesn't operate on it, it's as if it didn't
even exist.

Caveats:

- Whenever we have APIs that return TD (devp2p handshake, tracer, etc.)
we return a TD of 0.
- For era files, we recompute the TD during export time (fairly quick)
to retain the format content.
- It is not possible to "verify" the merge point (i.e. with TD gone, TTD
is useless). Since we're not verifying PoW any more, just blindly trust
it, not verifying but blindly trusting the many year old merge point
seems just the same trust model.
- Our tests still need to be able to generate pre and post merge blocks,
so they need a new way to split the merge without TTD. The PR introduces
a settable ttdBlock field on the consensus object which is used by tests
as the block where originally the TTD happened. This is not needed for
live nodes, we never want to generate old blocks.
- One merge transition consensus test was disabled. With a
non-operational TD, testing how the client reacts to TTD is useless, it
cannot react.

Questions:

- Should we also drop total terminal difficulty from the genesis json?
It's a number we cannot react on any more, so maybe it would be cleaner
to get rid of even more concepts.

---------

Co-authored-by: Gary Rong <[email protected]>

* .github: add lint step (#31068)

* core/{.,state,vm},miner,eth/tracers,tests: implement 7709 with a syscall flag (#31036)

Same as #31015 but requires the contract to exist. Not compatible with
any verkle testnet up to now.

This adds a `isSytemCall` flag so that it is possible to detect when a
system call is executed, so that the code execution and other locations
are not added to the witness.

---------

Signed-off-by: Guillaume Ballet <[email protected]>
Co-authored-by: Ignacio Hagopian <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* build: bump test timeout (#31095)

Travis often fails because the test times out.

* .travis.yml: change arch for Docker build to arm64 (#31096)

This is an attempt to work around a gcc issue in the Docker build.

* Revert ".travis.yml: change arch for Docker build to arm64 (#31096)"

This reverts commit 7b96ec4dae8d4ddeffc761c7757c12e2d2b8bf74.

* build: retry PPA upload up to three times (#31099)

* crypto: add IsOnCurve check (#31100)

* build: provide a flag to disable publishing in dockerx build (#31098)

This changes the `-upload` flag to just toggle the upload. The remote
image name is now configured using the `-hub` flag.

* version: begin v1.15.0 release cycle

* all: add build tags for wasip1 (#31090)

* core: implement eip-7623 floor data gas (#30946)

This PR builds on #29040 and updates it to the new version of the spec.
I filled the EEST tests and they pass.

Link to spec: https://eips.ethereum.org/EIPS/eip-7623

---------

Co-authored-by: Marius van der Wijden <[email protected]>
Co-authored-by: lightclient <[email protected]>
Co-authored-by: lightclient <[email protected]>

* core/vm: EXTCODE* return delegation designator for 7702 (#31089)

Implements https://github.com/ethereum/EIPs/pull/9248

* params: update system contract addresses for devnet-6 (#31102)

Finalize Prague system contract addresses. Reference:

* https://github.com/ethereum/EIPs/pull/9287
* https://github.com/ethereum/EIPs/pull/9288
* https://github.com/ethereum/EIPs/pull/9289

* eth/catalyst: fix validation of type 0 request (#31103)

I caught this error on Hive. It was introduced by
https://github.com/ethereum/go-ethereum/pull/31071 because after adding
the equality check the request type 0 will be rejected.

* core/vm: simplify tracer hook invocation in interpreter loop (#31074)

Removes duplicate code in the interpreter loop.

* tests/fuzzers/bls12381: fix error message in fuzzCrossG2Add (#31113)

Fixes a typo in the error message within the `fuzzCrossG2Add`
function. The panic message incorrectly references "G1 point addition
mismatch" when it should be "G2 point addition mismatch," as the
function deals with G2 points.

This doesn't affect functionality but could cause confusion during
debugging. I've updated the message to reflect the correct curve.

* core/rawdb: introduce flush offset in freezer (#30392)

This is a follow-up PR to #29792 to get rid of the data file sync.

**This is a non-backward compatible change, which increments the
database version from 8 to 9**.

We introduce a flushOffset for each freezer table, which tracks the position
of the most recently fsync’d item in the index file. When this offset moves
forward, it indicates that all index entries below it, along with their corresponding
data items, have been properly persisted to disk. The offset can also be moved
backward when truncating from either the head or tail of the file.

Previously, the data file required an explicit fsync after every mutation, which
was highly inefficient. With the introduction of the flush offset, the synchronization
strategy becomes more flexible, allowing the freezer to sync every 30 seconds
instead.

The data items above the flush offset are regarded volatile and callers must ensure
they are recoverable after the unclean shutdown, or explicitly sync the freezer
before any proceeding operations.

---------

Co-authored-by: Felix Lange <[email protected]>

* core: copy genesis before modifying (#31097)

This PR fixes a data race in SetupGenesisWithOverride.

* params: start osaka fork (#31125)

This PR defines the Osaka fork. An easy first step to start our work on
the next hardfork

(This is needed for EOF testing as well)

---------

Co-authored-by: lightclient <[email protected]>

* params,core: add max and target value to chain config (#31002)

Implements [EIP-7840](https://github.com/ethereum/EIPs/pull/9129) and
[EIP-7691](https://github.com/ethereum/EIPs/blob/d96625a4dcbbe2572fa006f062bd02b4582eefd5/EIPS/eip-7691.md).

---------

Co-authored-by: Marius van der Wijden <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* core: assign default difficulty to zero for chain without ethash (#31067)

I hit this case while trying something with the simulated backend. The
EVM only enables instruction set forks after the merge when 'Random' is
set. In the simulated backend, the random value will be set via the
engine API for all blocks after genesis. But for the genesis block
itself, the random value will not be assigned in the vm.BlockContext
because the genesis has a non-zero difficulty. For my case, this meant
that estimateGas did not work for the first transaction sent on the
simulated chain, since the contract contained a PUSH0 instruction.

This could also be fixed by explicitly configuring a zero difficulty in
the simulated backend. However, I think that zero difficulty is a better
default these days.

---------

Co-authored-by: lightclient <[email protected]>

* core/txpool: remove locals-tracking from txpools (#30559)

Replaces  #29297, descendant from #27535

---------

This PR removes `locals` as a concept from transaction pools. Therefore,
the pool now acts as very a good simulation/approximation of how our
peers' pools behave. What this PR does instead, is implement a
locals-tracker, which basically is a little thing which, from time to
time, asks the pool "did you forget this transaction?". If it did, the
tracker resubmits it.

If the txpool _had_ forgotten it, chances are that the peers had also
forgotten it. It will be propagated again.

Doing this change means that we can simplify the pool internals, quite a
lot.

### The semantics of `local` 

Historically, there has been two features, or usecases, that has been
combined into the concept of `locals`.

1. "I want my local node to remember this transaction indefinitely, and
resubmit to the network occasionally"
2. "I want this (valid) transaction included to be top-prio for my
miner"


This PR splits these features up, let's call it `1: local` and `2:
prio`. The `prio` is not actually individual transaction, but rather a
set of `address`es to prioritize.
The attribute `local` means it will be tracked, and `prio` means it will
be prioritized by miner.

For `local`: anything transaction received via the RPC is marked as
`local`, and tracked by the tracker.
For `prio`: any transactions from this sender is included first, when
building a block. The existing commandline-flag `--txpool.locals` sets
the set of `prio` addresses.

---------

Co-authored-by: Gary Rong <[email protected]>

* core/txpool/blobpool: fix incorrect arguments in test (#31127)

Fixes the linter on master which was broken by
https://github.com/ethereum/go-ethereum/pull/30559

* consensus/misc/eip4844: use head's target blobs, not parent (#31101)

A clarification was made to EIP-7691 stating that at the fork boundary
it is required to use the target blob count associated with the head
block, rather than the parent as implemented here.

See for more: https://github.com/ethereum/EIPs/pull/9249

* consensus/misc/eip4844: more changes for blob gas calculation (#31128)

This PR changes the signature of `CalcExcessBlobGas` to take in just
the header timestamp instead of the whole object. It also adds a sanity
check for the parent->child block order to `VerifyEIP4844Header`.

* core/tracing: state journal wrapper (#30441)

Here we add some more changes for live tracing API v1.1:

- Hook `OnSystemCallStartV2` was introduced with `VMContext` as parameter.
- Hook `OnBlockHashRead` was introduced.
- `GetCodeHash` was added to the state interface
- The new `WrapWithJournal` construction helps with tracking EVM reverts in the tracer.

---------

Co-authored-by: Felix Lange <[email protected]>

* all: update license comments and AUTHORS (#31133)

* build: update to Go 1.23.6 (#31130)


Co-authored-by: Felix Lange <[email protected]>

* build: update EEST fixtures to prague devnet-6 (#31088)


Co-authored-by: lightclient <[email protected]>

* version: release go-ethereum v1.15.0

* version: begin v1.15.1 release cycle

* cmd/devp2p/internal/ethtest: remove TD from status validation (#31137)

After recent changes in Geth (removing TD):

https://github.com/ethereum/go-ethereum/commit/39638c81c56db2b2dfe6f51999ffd3029ee212cb#diff-d70a44d4b7a0e84fe9dcca25d368f626ae6c9bc0b8fe9690074ba92d298bcc0d

Non-Geth clients are failing many devp2p tests with an error:
`peering failed: status exchange failed: wrong TD in status: have 1 want 0`

Right now only Geth is passing it - all other clients are affected by
this change. I think there should be no validation of TD when checking `Status`
message in hive tests. Now Geth has 0 (and hive tests requires 0) and
all other clients have actual TD. And on real networks there is no validation
of TD when peering

* params,core/forkid: enable prague on holesky and sepolia (#31139)

Agreed to the following fork dates for Holesky and Sepolia on ACDC 150

Holesky slot: 3710976	(Mon, Feb 24 at 21:55:12 UTC)
Sepolia slot: 7118848	(Wed, Mar 5 at 07:29:36 UTC)

* consensus/beacon: remove TestingTTDBlock (#31153)

This removes the method `TestingTTDBlock` introduced by #30744. It was
added to make the beacon consensus engine aware of the merge block in
tests without relying on the total difficulty. However, tracking the
merge block this way is very annoying. We usually configure forks in the
`ChainConfig`, but the method is on the consensus engine, which isn't
always created in the same place. By sidestepping the `ChainConfig` we
don't get the usual fork-order checking, so it's possible to enable the
merge before the London fork, for example. This in turn can lead to very
hard-to-debug outputs and validation errors.

So here I'm changing the consensus engine to check the
`MergeNetsplitBlock` instead. Alternatively, we assume a network is
merged if it has a `TerminalTotalDifficulty` of zero, which is a very
common configuration in tests.

* p2p/discover: remove unused parameter in revalidationList.get (#31155)

* p2p/discover: make discv5 response timeout configurable (#31119)

* core/txpool/legacypool: add support for SetCode transactions (#31073)

The new SetCode transaction type introduces some additional complexity
when handling the transaction pool.

This complexity stems from two new account behaviors:

1. The balance and nonce of an account can change during regular
   transaction execution *when they have a deployed delegation*.
2. The nonce and code of an account can change without any EVM execution
   at all. This is the "set code" mechanism introduced by EIP-7702.

The first issue has already been considered extensively during the design
of ERC-4337, and we're relatively confident in the solution of simply
limiting the number of in-flight pending transactions an account can have
to one. This puts a reasonable bound on transaction cancellation. Normally
to cancel, you would need to spend 21,000 gas. Now it's possible to cancel
for around the cost of warming the account and sending value
(`2,600+9,000=11,600`). So 50% cheaper.

The second issue is more novel and needs further consideration.
Since authorizations are not bound to a specific transaction, we
cannot drop transactions with conflicting authorizations. Otherwise,
it might be possible to cherry-pick authorizations from txs and front
run them with different txs at much lower fee amounts, effectively DoSing
the authority. Fortunately, conflicting authorizations do not affect the
underlying validity of the transaction so we can just accept both.

---------

Co-authored-by: Marius van der Wijden <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* internal/ethapi: fix panic in debug methods (#31157)

Fixes an error when the block is not found in debug methods.

* trie: copy preimage store pointer in StateTrie.Copy (#31158)

This fixes an error where executing `evm run --dump ...` omits preimages
from the dump (because the statedb used for execution is a copy of
another instance).

* go.mod: update blst to v0.3.14 (#31165)

closes https://github.com/ethereum/go-ethereum/issues/31072

BLST released their newest version which includes a fix for go v.1.24:
https://github.com/supranational/blst/releases/tag/v0.3.14

I went through all commits between 0.3.14 and 0.3.13 for a sanity check

* core: sanity-check fork configuration in genesis (#31171)

This is to prevent a crash on startup with a custom genesis configuration.
With this change in place, upgrading a chain created by geth v1.14.x and
below will now print an error instead of crashing:

    Fatal: Failed to register the Ethereum service: invalid chain configuration: missing entry for fork "cancun" in blobSchedule

Arguably this is not great, and it should just auto-upgrade the config.
We'll address this in a follow-up PR for geth v1.15.2

* core/rawdb: skip setting flushOffset in read-only mode (#31173)

This PR addresses a flaw in the freezer table upgrade path.

In v1.15.0, freezer table v2 was introduced, including an additional 
field (`flushOffset`) maintained in the metadata file. To ensure 
backward compatibility, an upgrade path was implemented for legacy
freezer tables by setting `flushOffset` to the size of the index file.

However, if the freezer table is opened in read-only mode, this file 
write operation is rejected, causing Geth to shut down entirely.

Given that invalid items in the freezer index file can be detected and 
truncated, all items in freezer v0 index files are guaranteed to be
complete. Therefore, when operating in read-only mode, it is safe to
use the  freezer data without performing an upgrade.

* version: release go-ethereum v1.15.1 stable

* version: begin v1.15.2 release cycle

* core/types: create block's bloom by merging receipts' bloom (#31129)

Currently, when calculating block's bloom, we loop through all the
receipt logs to calculate the hash v…
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Jul 3, 2025
In transaction-sending APIs such as `eth_sendRawTransaction`, a submitted transaction 
failing the configured txpool validation rules (i.e. fee too low) would cause an error to be
returned, even though the transaction was successfully added into the locals tracker.
Once added there, the transaction may even be included into the chain at a later time,
when fee market conditions change.

This change improves on this by performing the validation in the locals tracker, basically
skipping some of the validation rules for local transactions. We still try to add the tx to the
main pool immediately, but an error will only be returned for transactions which are 
fundamentally invalid.

---------

Co-authored-by: Gary Rong <[email protected]>
rjl493456442 pushed a commit that referenced this pull request Jul 18, 2025
…32237)

This PR removes the now‑unused `txValidationFn` field from BlobPool.
It became obsolete after a PR  #31202 
was merged.

Resolves #32236
howjmay pushed a commit to iotaledger/go-ethereum that referenced this pull request Aug 27, 2025
…thereum#32237)

This PR removes the now‑unused `txValidationFn` field from BlobPool.
It became obsolete after a PR  ethereum#31202 
was merged.

Resolves ethereum#32236
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
In transaction-sending APIs such as `eth_sendRawTransaction`, a submitted transaction 
failing the configured txpool validation rules (i.e. fee too low) would cause an error to be
returned, even though the transaction was successfully added into the locals tracker.
Once added there, the transaction may even be included into the chain at a later time,
when fee market conditions change.

This change improves on this by performing the validation in the locals tracker, basically
skipping some of the validation rules for local transactions. We still try to add the tx to the
main pool immediately, but an error will only be returned for transactions which are 
fundamentally invalid.

---------

Co-authored-by: Gary Rong <[email protected]>
gballet pushed a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
…thereum#32237)

This PR removes the now‑unused `txValidationFn` field from BlobPool.
It became obsolete after a PR  ethereum#31202 
was merged.

Resolves ethereum#32236
oleg-ssvlabs added a commit to compose-network/op-geth that referenced this pull request Dec 1, 2025
* all: incorporate state history indexing status into eth_syncing response (#32099)

This pull request tracks the state indexing progress in eth_syncing
RPC response, i.e. we will return non-null syncing status until indexing
has finished.

* version: release go-ethereum v1.16.0 stable

* version: begin v1.16.1 release cycle

* .gitea: trigger PPA upload on tag

* .travis.yml: remove travis configuration

* all: replace override.prague with osaka (#32093)

replace `--override.prague` with `--override.osaka`

Signed-off-by: jsvisa <[email protected]>

* node: do not double-wrap KV stores (#32089)

For no apparent reason, KV stores were getting wrapped in `nofreezedb`
first and then in `freezerdb`.

* eth: correct tracer initialization in BlockchainConfig (#32107)

core.BlockChainConfig.VmConfig is not a pointer, so setting the Tracer
on the `vmConfig` object after it was passed to options does *not* apply
it to options.VmConfig

This fixes the issue by setting the value directly inside the `options`
object and removing the confusing `vmConfig` variable to prevent further
mistakes.

* .gitea: switch release builds to static linking (#32118)

This is to avoid compatibility issues with mismatched glibc versions
between the builder and deployment target.

Fixes #32102

* .gitea: fix 386 upload

* .gitea: disable cron schedule

* triedb: reset state indexer after snap synced (#32104)

Fix the issue after initial snap sync with `gcmode=archive` enabled.

```
NewPayload: inserting block failed       error="history indexing is out of order, last: null, requested: 1"
```

---------

Signed-off-by: Delweng <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* eth/filters: add address limit to filters (#31876)

The address filter was never checked against a maximum limit, which can
be somewhat abusive for API nodes. This PR adds a limit similar to
topics

## Description (AI generated)

This pull request introduces a new validation to enforce a maximum limit
on the number of addresses allowed in filter criteria for Ethereum logs.
It includes updates to the `FilterAPI` and `EventSystem` logic, as well
as corresponding test cases to ensure the new constraint is properly
enforced.

### Core functionality changes:

* **Validation for maximum addresses in filter criteria**:
- Added a new constant, `maxAddresses`, set to 100, to define the
maximum allowable addresses in a filter.
- Introduced a new error, `errExceedMaxAddresses`, to handle cases where
the number of addresses exceeds the limit.
- Updated the `GetLogs` method in `FilterAPI` to validate the number of
addresses against `maxAddresses`.
- Modified the `UnmarshalJSON` method to return an error if the number
of addresses in the input JSON exceeds `maxAddresses`.
- Added similar validation to the `SubscribeLogs` method in
`EventSystem`.

### Test updates:

* **New test cases for address limit validation**:
- Added a test in `TestUnmarshalJSONNewFilterArgs` to verify that
exceeding the maximum number of addresses triggers the
`errExceedMaxAddresses` error.
- Updated `TestInvalidLogFilterCreation` to include a test case for an
invalid filter with more than `maxAddresses` addresses.
- Updated `TestInvalidGetLogsRequest` to test for invalid log requests
with excessive addresses.

These changes ensure that the system enforces a reasonable limit on the
number of addresses in filter criteria, improving robustness and
preventing potential performance issues.

---------

Co-authored-by: zsfelfoldi <[email protected]>

* Fix log indexer noise after debug_setHead operations (#31934)

## Summary
This PR resolves Issue #31929 by reducing log noise generated by the log
indexer after `debug_setHead` operations.

## Problem Description
When `debug_setHead` is called to rewind the blockchain, blocks are
removed from the database. However, the log indexer's `ChainView`
objects may still hold references to these deleted blocks. When
`extendNonCanonical()` attempts to access these missing headers, it
results in:

1. **Repeated ERROR logs**: `Header not found number=X hash=0x...`
2. **Log noise** that can mask other important errors  
3. **User confusion** about whether this indicates a real problem

## Root Cause Analysis
The issue occurs because:
- `debug_setHead` removes blocks from the blockchain database
- Log indexer's `ChainView` may still reference deleted block hashes
- `extendNonCanonical()` in `core/filtermaps/chain_view.go` tries to
fetch these missing headers
- The existing `return false` logic properly handles the error, but logs
at ERROR level

## Solution
This is a **logging improvement only** - no functional logic changes:

### Changes Made
1. **Log level**: Changed from `ERROR` to `DEBUG` 
2. **Log message**: Enhanced with descriptive context about chain view
extension
3. **Comments**: Added explanation for when this situation occurs
4. **Behavior**: Maintains existing error handling (`return false` was
already present)

### Code Changes
```go
// Before
log.Error("Header not found", "number", number, "hash", hash)
return false

// After  
// Header not found - this can happen after debug_setHead operations
// where blocks have been deleted. Return false to indicate the chain view
// is no longer valid rather than logging repeated errors.
log.Debug("Header not found during chain view extension", "number", number, "hash", hash)
return false
```

## Testing

### Automated Tests
- ✅ All existing filtermaps tests pass: `go test ./core/filtermaps -v`
- ✅ No regressions in related functionality

### Manual Verification
1. **Before fix**: Started geth in dev mode, generated blocks, called
`debug_setHead(3)` → **5 repeated ERROR logs**
2. **After fix**: Same scenario → **4 DEBUG logs, no ERROR noise**

### Test Environment
```bash
# Setup test environment
rm -rf ./dev-test-data
./build/bin/geth --dev --datadir ./dev-test-data --http --http.api debug,eth,net,web3 --verbosity 4

# Generate test blocks and trigger issue
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"debug_setHead","params":["0x3"],"id":1}' http://localhost:8545
```


## Related Issues
- Fixes #31929

## Additional Context
This issue was reported as spurious error messages appearing after
`debug_setHead` operations. The investigation revealed that while the
error handling was functionally correct, the ERROR log level was
inappropriate for this expected scenario in development/debugging
workflows.

The fix maintains full compatibility while significantly improving the
debugging experience for developers using `debug_setHead`.

---------

Co-authored-by: Sun Tae, Kim <[email protected]>
Co-authored-by: zsfelfoldi <[email protected]>

* core/filtermaps: clean up log format of unindexing message (#32123)

Sorry for not fully fixed in https://github.com/ethereum/go-ethereum/pull/31761, now the log 
format of unindexing message is cleaned up, to make it consistent with the indexing message.

* eth/catalyst: fix the log message in newPayloadV4 (#32125)

It should be `newPayloadV4 must only be called for prague payloads` for
the V4 payload error

* internal/ethapi: prealloc map for the txpool api (#32110)

use `make(map, len(txpool))` to prealloc the map for the txpool content,
to avoid the map growing in the loop.

* ethapi: reduce some of the wasted effort in GetTransactionReceipt (#32021)

Towards https://github.com/ethereum/go-ethereum/issues/26974

---------

Co-authored-by: Gary Rong <[email protected]>

* internal: remove unused shh and swarm modules from console (#32073)

Similar to https://github.com/ethereum/go-ethereum/pull/31856, remove
the not availabe shh, swarm modules in the console.

---------

Co-authored-by: Gary Rong <[email protected]>

* core/filtermaps: define APIs for map, epoch calculation (#31659)

This pull request refines the filtermap implementation, defining key
APIs for map and
epoch calculations to improve readability.

This pull request doesn't change any logic, it's a pure cleanup.

---------

Co-authored-by: zsfelfoldi <[email protected]>

* core/types: blockTimestamp in logs is hex-encoded (#32129)

closes #32120

* core/rawdb, triedb/pathdb: fix two inaccurate comments (#32130)

* eth/catalyst: fix edge case in simulated backend (#31871)

geth cmd: `geth --dev --dev.period 5`
call: `debug.setHead` to rollback several blocks.

If the `debug.setHead` call is delayed, it will trigger a panic with a
small probability, due to using the null point of
`fcResponse.PayloadID`.

---------

Co-authored-by: Marius van der Wijden <[email protected]>

* accounts/abi: generate TryPack* methods for abigen v2 bindings (#31692)

1. Fix the error return format.
**todo**: ~~`bindtype` needs more complex logic to fix it.~~
`
if err != nil {
  return nil, err
}
if err == nil {
  return obj, nil
}
`
2. ~~Return pointer type object to avoid copying the whole struct
content.~~
3. Give the panic decision to the user.
4. Fix empty line at the end of function.

**TODO**: ~~fix some related test cases.~~

---------

Co-authored-by: Jared Wasinger <[email protected]>

* version: release go-ethereum v1.16.1 stable

* version: begin v1.16.2 release cycle

* beacon/blsync: update logs for blsync (Fixes #31968 ) (#32046)

Small update for logs when syncing with blsync. Downgrades the "latest
filled block is not available" to warn.

Co-authored-by: shantichanal <[email protected]>

* cmd/workload: rework tracegen to run tracing at block level (#32092)

This PR changes the trace test to block level, aiming for better
execution performance.

---------

Co-authored-by: zsfelfoldi <[email protected]>

* core/state: add GetStateAndCommittedState (#31585)

Improves the SSTORE gas calculation a bit. Previously we would pull up
the state object twice. This is okay for existing objects, since they
are cached, however non-existing objects are not cached, thus we needed
to go through all 128 diff layers as well as the disk layer twice, just
for the gas calculation

```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/vm
cpu: AMD Ryzen 9 5900X 12-Core Processor            
               │ /tmp/old.txt │            /tmp/new.txt             │
               │    sec/op    │   sec/op     vs base                │
Interpreter-24   1118.0n ± 2%   602.8n ± 1%  -46.09% (p=0.000 n=10)
```

---------

Co-authored-by: Gary Rong <[email protected]>

* cmd/utils, internal/debug: hide the deprecated flags (#32128)

Some of the flags were deprecated, so try to hide them in the help
message. And move the `--vmodule` and `--logjson` flags to the
DeprecatedCategory.

* .gitea: add windows build (experimental)

* cmd/utils: show full deprecated flags (#32141)

This is a follow up PR after #32128 , Seems I've missed to add
--txlookuplimit as hidden. In hte meanwhile, I also add the other 
deprecated flags into the output of `show-deprecated-flags`

* cmd/utils: update flag description of gcmode (#32145)

* .gitea: add workflow_dispatch for release build

* .gitea: update PATH

* .gitea: set PATH

* gitea: try with cmd

* gitea: set PATH in script

* .gitea: fix typo in windows workflow

* core/vm: move nil-check out of the interpreter loop (#32068)

Moves the jumptable nil check our of the interpreter loop.
Benchmarks show a 2-10% improvement.

* core/vm: implement EIP-7939 - CLZ opcode (#31989)

https://eips.ethereum.org/EIPS/eip-7939

---------

Co-authored-by: spencer-tb <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* core/txpool/blobpool: lower log level for warnings (#32142)

- Change the log level to `warning`, during syncing blocks, the `final
== nil` is normal.
- Change to log tx hash.

* .github, internal/flags: improve actions test runs (#32150)

This change enables more tests to run on GitHub actions. First, it
removes the `-short` flag passed to `go test`, unskipping some longer
running tests. We also enable the full consensus tests to run by
enabling submodules during git clone.

The EF now operates org wide runners with the `self-hosted-ghr` label.
These are auto-scaling runners which should ideally allow us to process
any amount of testing load we throw at them. The new runners have `HOME`
configured differently from the actual user home directory, so our
internal test for resolving `~` had to be adapted to work in this scenario.

* consensus/misc/eip4844: implement EIP-7918  (#31965)

https://eips.ethereum.org/EIPS/eip-7918

---------

Co-authored-by: Felix Lange <[email protected]>

* core/vm: implement EIP-7951 - precompile for secp256r1 (#31991)

https://github.com/ethereum/EIPs/pull/9833

Based on #27540, #30043

---------

Co-authored-by: Ulaş Erdoğan <[email protected]>

* cmd, eth/catalyst: exit geth only if exitWhenSynced is specified (#32149)

This pull request modifies the behavior of `--synctarget` to terminate
the node only when `--exitWhenSynced` is explicitly specified.

* eth/catalyst:  abort dev mode block commit if shut down is triggered (#32166)

alternate approach to https://github.com/ethereum/go-ethereum/pull/31328
suggested by @MariusVanDerWijden . This prevents Geth from outputting a
lot of logs when trying to commit on-demand dev mode blocks while the
client is shutting down.

The issue is hard to reproduce, but I've seen it myself and it is
annoying when it happens. I think this is a reasonable simple solution,
and we can revisit if we find that the output is still too large (i.e.
there is a large delay between initiating shut down and the simulated
beacon receiving the signal, while in this loop).

Co-authored-by: Marius van der Wijden <[email protected]>

* miner, core, core/txpool: implement EIP 7825 - TX Gas Limit Cap (#31824)

Implements EIP-7825

---------

Co-authored-by: Gary Rong <[email protected]>
Co-authored-by: lightclient <[email protected]>
Co-authored-by: MariusVanDerWijden <[email protected]>

* core/vm: update gas cost of CLZ to five (#32172)

https://github.com/ethereum/EIPs/commit/a794de3fcf71bb8c71e8bafdba11f63133ce4516

* core,miner: implement EIP-7934 - RLP Execution Block Size Limit (#31990)

This PR adds a block validation check for the maximum block size, as required by
EIP-7934, and also applies a slightly lower size limit during block building.

---------

Co-authored-by: spencer-tb <[email protected]>
Co-authored-by: Felix Lange <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* cmd/utils: add the missing check for the HoodiFlag in blsync (#32179)

Hoodi network flag should be exclusive to other network flags for both blysnc standalone and integrated mode.

* cmd/clef: update Safe API documentation links in changelog (#32136)

This PR updates the outdated documentation URL from docs.gnosis.io to
the new official docs.safe.global domain. The change reflects the
rebranding from Gnosis Safe to Safe and ensures that users are directed
to the current API documentation for transaction service reference.

* core/types:  add block-level access list structures with encoding/decoding (#31948)

This adds the SSZ types from the 
[EIP-7928](https://eips.ethereum.org/EIPS/eip-7928) and also adds
encoder/decoder generation using https://github.com/ferranbt/fastssz.

The fastssz dependency is updated because the generation will not work
properly with the master branch version due to a bug in fastssz.

---------

Co-authored-by: Gary Rong <[email protected]>

* eth/downloader: fix ancient limit in snap sync (#32188)

This pull request fixes an issue in disabling direct-ancient mode in
snap sync.

Specifically, if `origin >= frozen && origin != 0`, it implies a part of
chain data has been written into the key-value store, all the following 
writes into ancient store scheduled by downloader will be rejected 
with error 

`ERROR[07-10|03:46:57.924] Error importing chain data to ancients
err="can't add block 1166 hash: the append operation is out-order: have
1166 want 0"`.

This issue is detected by the https://github.com/ethpandaops/kurtosis-sync-test, 
which initiates the first snap sync cycle without the finalized header and
implicitly disables the direct-ancient mode. A few seconds later the second 
snap sync cycle is initiated with the finalized information and direct-ancient mode
is enabled incorrectly.

* .github: remove karalabe from CODEOWNERS

* cmd/geth: update vcheck testdata, add docs on generating signatures (#32121)

Fixed typo in security release URL by replacing:
Old: https://blog.ethereum.org/2020/11/12/geth_security_release/
New: https://blog.ethereum.org/2020/11/12/geth-security-release/

---------

Co-authored-by: lightclient <[email protected]>

* signer/core/apitypes: require blob txs to have tx.to set (#32197)

Check the `to` address before building the blob tx.

---------

Co-authored-by: jwasinger <[email protected]>

* accounts/keystore: update links to documenation (#32194)

---


**Description:**  
- Replaced outdated GitHub wiki links with the official Ethereum
documentation for Web3 Secret Storage.
- Updated references in `keystore.go` and `passphrase.go` for improved
accuracy and reliability.


---

* ethclient/gethclient: remove race condition in tests (#32206)

alternative to https://github.com/ethereum/go-ethereum/pull/32200

The race condition is not happening yet, since there is only a single
call to `newTestBackend`, but there might be more in the future

* params: EIP-7892 - Blob Parameter Only Hardforks (#32193)

This is a resubmit of https://github.com/ethereum/go-ethereum/pull/31820
against the `master` branch.

---------

Co-authored-by: Marius van der Wijden <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* eth/fetcher: fix announcement drop logic (#32210)

This PR fixes an issue in the tx_fetcher DoS prevention logic where the
code keeps the overflow amount (`want - maxTxAnnounces`) instead of the
allowed amount (`maxTxAnnounces - used`). The specific changes are:

- Correct slice indexing in the announcement drop logic
- Extend the overflow test case to cover the inversion scenario

* miner: set sidecar version when recomputing proofs (#32199)

- If the block number is `osaka` fork and needs to recompute some `blob
proofs` to `cell proofs`, here also needs to set version to `1`.

* all: fix outdated ethereum wiki json-rpc json-rpc doc links (#32209)

Replace outdated wiki reference with ethereum.org
documentation links

* core/types: fix CellProofsAt method (#32198)

* triedb/pathdb: introduce file-based state journal (#32060)

Introduce file-based state journal in path database, fixing
the Pebble restriction when the journal size exceeds 4GB.

---------

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* core/rawdb: change the mechanism to schedule freezer sync (#32135)

This pull request slightly improves the freezer fsync mechanism by scheduling 
the Sync operation based on the number of uncommitted items and original
time interval.

Originally, freezer.Sync was triggered every 30 seconds, which worked well during
active chain synchronization. However, once the initial state sync is complete, 
the fixed interval causes Sync to be scheduled too frequently.

To address this, the scheduling logic has been improved to consider both the time 
interval and the number of uncommitted items. This additional condition helps 
avoid unnecessary Sync operations when the chain is idle.

* eth/protocols/snap, p2p/discover: improve zero time checks (#32214)

* all: update dead wiki links (#32215)

---


**Description:**  
- Replaced outdated GitHub wiki links with current, official
documentation URLs.
- Removed links that redirect or are no longer relevant.
- Ensured all references point to up-to-date and reliable sources.


---

* core/rawdb: reduce allocations in rawdb.ReadHeaderNumber (#31913)

This is something interesting I came across during my benchmarks, we
spent ~3.8% of all allocations allocating the header number on the heap.

```
(pprof) list GetHeaderByHash
Total: 38197204475
ROUTINE ======================== github.com/ethereum/go-ethereum/core.(*BlockChain).GetHeaderByHash in github.com/ethereum/go-ethereum/core/blockchain_reader.go
         0 5786566117 (flat, cum) 15.15% of Total
         .          .     79:func (bc *BlockChain) GetHeaderByHash(hash common.Hash) *types.Header {
         . 5786566117     80: return bc.hc.GetHeaderByHash(hash)
         .          .     81:}
         .          .     82:
         .          .     83:// GetHeaderByNumber retrieves a block header from the database by number,
         .          .     84:// caching it (associated with its hash) if found.
         .          .     85:func (bc *BlockChain) GetHeaderByNumber(number uint64) *types.Header {
ROUTINE ======================== github.com/ethereum/go-ethereum/core.(*HeaderChain).GetHeaderByHash in github.com/ethereum/go-ethereum/core/headerchain.go
         0 5786566117 (flat, cum) 15.15% of Total
         .          .    404:func (hc *HeaderChain) GetHeaderByHash(hash common.Hash) *types.Header {
         . 1471264309    405: number := hc.GetBlockNumber(hash)
         .          .    406: if number == nil {
         .          .    407:  return nil
         .          .    408: }
         . 4315301808    409: return hc.GetHeader(hash, *number)
         .          .    410:}
         .          .    411:
         .          .    412:// HasHeader checks if a block header is present in the database or not.
         .          .    413:// In theory, if header is present in the database, all relative components
         .          .    414:// like td and hash->number should be present too.
(pprof) list GetBlockNumber
Total: 38197204475
ROUTINE ======================== github.com/ethereum/go-ethereum/core.(*HeaderChain).GetBlockNumber in github.com/ethereum/go-ethereum/core/headerchain.go
  94438817 1471264309 (flat, cum)  3.85% of Total
         .          .    100:func (hc *HeaderChain) GetBlockNumber(hash common.Hash) *uint64 {
  94438817   94438817    101: if cached, ok := hc.numberCache.Get(hash); ok {
         .          .    102:  return &cached
         .          .    103: }
         . 1376270828    104: number := rawdb.ReadHeaderNumber(hc.chainDb, hash)
         .          .    105: if number != nil {
         .     554664    106:  hc.numberCache.Add(hash, *number)
         .          .    107: }
         .          .    108: return number
         .          .    109:}
         .          .    110:
         .          .    111:type headerWriteResult struct {
(pprof) list ReadHeaderNumber
Total: 38197204475
ROUTINE ======================== github.com/ethereum/go-ethereum/core/rawdb.ReadHeaderNumber in github.com/ethereum/go-ethereum/core/rawdb/accessors_chain.go
 204606513 1376270828 (flat, cum)  3.60% of Total
         .          .    146:func ReadHeaderNumber(db ethdb.KeyValueReader, hash common.Hash) *uint64 {
 109577863 1281242178    147: data, _ := db.Get(headerNumberKey(hash))
         .          .    148: if len(data) != 8 {
         .          .    149:  return nil
         .          .    150: }
  95028650   95028650    151: number := binary.BigEndian.Uint64(data)
         .          .    152: return &number
         .          .    153:}
         .          .    154:
         .          .    155:// WriteHeaderNumber stores the hash->number mapping.
         .          .    156:func WriteHeaderNumber(db ethdb.KeyValueWriter, hash common.Hash, number uint64) {
```

Opening this to discuss the idea, I know that rawdb.EmptyNumber is not a
great name for the variable, open to suggestions

* trie: avoid spawning goroutines for empty children (#32220)

* eth/downloader: improve nil pointer protection (#32222)

Fix #32221

---------

Co-authored-by: rjl493456442 <[email protected]>

* account/abi/bind/v2: fix TestDeploymentWithOverrides (#32212)

The root cause of the flaky test was a nonce conflict caused by async
contract deployments.

This solution defines a custom deployer with automatic nonce management.

* eth/tracers: apply block header overrides correctly (#32183)

Fixes #32175.

This fixes the scenario where the blockhash opcode would return 0x0
during RPC simulations when using BlockOverrides with a future block
number. The root cause was that BlockOverrides.Apply() only modified the
vm.BlockContext, but GetHashFn() depends on the actual
types.Header.Number to resolve valid historical block hashes. This
caused a mismatch and resulted in incorrect behavior during trace and
call simulations.

---------

Co-authored-by: shantichanal <[email protected]>
Co-authored-by: lightclient <[email protected]>

* triedb/pathdb: avoid duplicate metadata reads (#32226)

* eth/protocols/snap: fix negative eta in state progress logging (#32225)

* triedb/pathdb: improve the performance of parse index block (#32219)

The implementation of `parseIndexBlock` used a reverse loop with slice
appends to build the restart points, which was less cache-friendly and
involved unnecessary allocations and operations. In this PR we change
the implementation to read and validate the restart points in one single
forward loop.

Here is the benchmark test:

```bash
go test -benchmem -bench=BenchmarkParseIndexBlock ./triedb/pathdb/
```

The result as below:

```
benchmark                      old ns/op     new ns/op     delta
BenchmarkParseIndexBlock-8     52.9          37.5          -29.05%
```

about 29% improvements

---------

Signed-off-by: jsvisa <[email protected]>

* all: define constructor for BlobSidecar (#32213)

The main purpose of this change is to enforce the version setting when
constructing the blobSidecar, avoiding creating sidecar with wrong/default 
version tag.

* params: update tx gas limit cap (#32230)

Updates the tx gas limit cap to the new parameter (2^24)
https://github.com/ethereum/EIPs/pull/9986/files

* core/txpool/blobpool: remove unused `txValidationFn` from BlobPool (#32237)

This PR removes the now‑unused `txValidationFn` field from BlobPool.
It became obsolete after a PR  https://github.com/ethereum/go-ethereum/pull/31202 
was merged.

Resolves https://github.com/ethereum/go-ethereum/issues/32236

* triedb/pathdb: fix incorrect address length in history searching (#32248)

We should use account length to check address, else OOB maybe occured

Signed-off-by: jsvisa <[email protected]>

* core/vm: triple modexp cost post-cancun (#32231)

https://github.com/ethereum/EIPs/pull/9969/files

* core, params: add limit for max blobs in blob transaction (#32246)

[EIP-7594](https://eips.ethereum.org/EIPS/eip-7594) defines a limit of
max 6 blobs per transaction. We need to enforce this limit during block
processing.

> Additionally, a limit of 6 blobs per transaction is introduced.
Clients MUST enforce this limit when validating blob transactions at
submission time, when received from the network, and during block
production and processing.

* superchain: skip celo mainnet genesis processing (#646)

* superchain: skip celo mainnet genesis processing

* superchain: add GetChain tests

* superchain: add clarifying comments for celo exclusion

* build: update tests to fusaka-devnet-3 (#32251)

* core/types: minimize this invalid intermediate state (#32241)

* core/rawdb: downgrade log level in chain freezer (#32253)

* triedb/pathdb:  use binary.append to eliminate the tmp scratch slice (#32250)

`binary.AppendUvarint` offers better performance than using append
directly, because it avoids unnecessary memory allocation and copying.

In our case, it can increase the performance by +35.8% for the
`blockWriter.append` function:

```
benchmark                        old ns/op     new ns/op     delta
BenchmarkBlockWriterAppend-8     5.97          3.83          -35.80%
```

---------

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* p2p/rlpx: optimize XOR operation using bitutil.XORBytes (#32217)

Replace manual byte-by-byte XOR implementation with the optimized
bitutil.XORBytes function. This improves performance by using word-sized
operations on supported architectures while maintaining the same
functionality. The optimized version processes data in bulk rather than
one byte at a time

---------

Co-authored-by: Felix Lange <[email protected]>

* eth/gasestimator: fix potential overflow (#32255)

Improve binary search, preventing the potential overflow in certain L2 cases

* triedb/pathdb: fix an deadlock in history indexer (#32260)

Seems the `signal.result` was not sent back in shorten case, this will
cause a deadlock.

---------

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* eth/protocols/snap: add healing and syncing metrics (#32258)

Adds the heal time and snap sync time to grafana

---------

Co-authored-by: Gary Rong <[email protected]>

* core: replace the empty fmt.Errorf with errors.New (#32274)

The `errors.new` function does not require string formatting, so its
performance is better than that of `fmt.Errorf`.

* eth/catalyst: fix error message in ExecuteStatelessPayloadV4 (#32269)

Correct the error message in the ExecuteStatelessPayloadV4 function to
reference newPayloadV4 and the Prague fork, instead of incorrectly
referencing newPayloadV3 and Cancun. 

This improves clarity during debugging and aligns the error message with 
the actual function and fork being validated. No logic is changed.

---------

Co-authored-by: rjl493456442 <[email protected]>

* cmd, eth, internal: introduce debug_sync (#32177)

Alternative implementation of https://github.com/ethereum/go-ethereum/pull/32159

* all: replace fmt.Errorf with errors.New (#32286)

The errors.new function does not require string formatting, so its
performance is better than that of fmt.Errorf.

* downloader: fix typos, grammar and formatting (#32288)

* ethclient/simulated: Fix flaky rollback test (#32280)

This PR addresses a flakiness in the rollback test discussed in
https://github.com/ethereum/go-ethereum/issues/32252

I found `nonce` collision caused transactions occasionally fail to send.
I tried to change error message in the failed test like:

```
	if err = client.SendTransaction(ctx, signedTx); err != nil {
		t.Fatalf("failed to send transaction: %v, nonce: %d", err, signedTx.Nonce())
	}
```

and I occasionally got test failure with this message:

```
=== CONT  TestFlakyFunction/Run_#100
    rollback_test.go:44: failed to send transaction: already known, nonce: 0
--- FAIL: TestFlakyFunction/Run_#100 (0.07s)
```

Although `nonces` are obtained via `PendingNonceAt`, we observed that,
in rare cases (approximately 1 in 1000), two transactions from the same
sender end up with the same nonce. This likely happens because `tx0` has
not yet propagated to the transaction pool before `tx1` requests its
nonce. When the test succeeds, `tx0` and `tx1` have nonces `0` and `1`,
respectively. However, in rare failures, both transactions end up with
nonce `0`.

We modified the test to explicitly assign nonces to each transaction. By
controlling the nonce values manually, we eliminated the race condition
and ensured consistent behavior. After several thousand runs, the
flakiness was no longer reproducible in my local environment.

Reduced internal polling interval in `pendingStateHasTx()` to speed up
test execution without impacting stability. It reduces test time for
`TestTransactionRollbackBehavior` from about 7 seconds to 2 seconds.

* core/state: preallocate capacity for logs list (#32291)

Improvement: preallocate capacity for `logs` at first to avoid
reallocating multi times.

* core/state: improve PrettyPrint function (#32293)

* core/types: expose sigHash as Hash for SetCodeAuthorization (#32298)

* common/hexutil: replace customized bit sizer with bit.Uintsize (#32304)

* accounts/abi: precompile regex (#32301)

* cmd/devp2p/internal/v4test: add test for ENRRequest (#32303)

This adds a cross-client protocol test for a recently discovered bug in Nethermind.

* trie: reduce the memory allocation in trie hashing (#31902)

This pull request optimizes trie hashing by reducing memory allocation
overhead. Specifically:

- define a fullNodeEncoder pool to reuse encoders and avoid memory
allocations.

- simplify the encoding logic for shortNode and fullNode by getting rid
of the Go interfaces.

* core/vm: add configurable jumpdest analysis cache (#32143)

This adds a method on vm.EVM to set the jumpdest cache implementation.
It can be used to maintain an analysis cache across VM invocations, to improve
performance by skipping the analysis for already known contracts.

---------

Co-authored-by: lmittmann <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* eth: fix typos and outdated comments (#32324)

* eth/filters: fix error when blockHash is used with fromBlock/toBlock (#31877)

This introduces an error when the filter has both `blockHash` and
`fromBlock`/`toBlock`, since these are mutually exclusive. Seems the
tests were actually returning `not found` error, which went undetected
since there was no check on the actual returned error in the test.

* rlp/rlpgen: implement package renaming support (#31148)

This adds support for importing types from multiple identically-named
packages.

---------

Co-authored-by: Felix Lange <[email protected]>

* beacon/params, core/filtermaps: update checkpoints (#32336)

This PR updates checkpoints for blsync and filtermaps.

* version: release v1.16.2 (#32343)

* version: begin v1.16.3 release cycle (#32345)

* core/state: introduce the TransitionState object (verkle transition part 1) (#31634)

This is the first part of #31532 

It maintains a series of conversion maker which are to be updated by the
conversion code (in a follow-up PR, this is a breakdown of a larger PR
to make things easier to review). They can be used in this way:

- During the conversion, by storing the conversion markers when the
block has been processed. This is meant to be written in a function that
isn't currently present, hence [this
TODO](https://github.com/ethereum/go-ethereum/pull/31634/files#diff-89272f61e115723833d498a0acbe59fa2286e3dc7276a676a7f7816f21e248b7R384).

Part of  https://github.com/ethereum/go-ethereum/issues/31583

---------

Signed-off-by: Guillaume Ballet <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* eth/catalyst: avoid load the same blob tx multi times (#32190)

- If all the `vhashes` are in the same `sidecar`, then it will load the
same blob tx many times. This PR aims to upgrade this.

---------

Co-authored-by: Gary Rong <[email protected]>

* eth/gasestimator: check ErrGasLimitTooHigh conditions (#32348)

This PR makes 2 changes to how
[EIP-7825](https://github.com/ethereum/go-ethereum/pull/31824) behaves.

When `eth_estimateGas` or `eth_createAccessList` is called without any
gas limit in the payload, geth will choose the block's gas limit or the
`RPCGasCap`, which can be larger than the `maxTxGas`.

When this happens for `estimateGas`, the gas estimation just errors out
and ends, when it should continue doing binary search to find the lowest
possible gas limit.

This PR will: 
- Add a check to see if `hi` is larger than `maxTxGas` and cap it to
`maxTxGas` if it's larger. And add a special case handling for gas
estimation execute when it errs with `ErrGasLimitTooHigh`

---------

Co-authored-by: Gary Rong <[email protected]>

* core/filtermaps: remove unnecessary nil check and add cv2 lock (#32309)

Co-authored-by: zsfelfoldi <[email protected]>

* go.mod: upgraded github.com/golang-jwt/jwt/v4 v4.5.1 => v4.5.2 (#32356)

https://pkg.go.dev/vuln/GO-2025-3553

* rpc: use reflect.TypeFor (#32316)

* crypto/kzg4844: use reflect.TypeFor (#32319)

* common, common/hexutil: use reflect.TypeFor (#32321)

* beacon/merkle: use reflect.TypeFor (#32322)

* core: use reflect.TypeFor (#32320)

https://github.com/golang/go/issues/60088

* p2p/enode: use atomic.Pointer in LocalNode (#32360)

* signer/core/apitypes: simplify reflect []byte creation (#32315)


Co-authored-by: Felix Lange <[email protected]>

* rlp: use reflect.TypeFor (#32317)


Co-authored-by: Felix Lange <[email protected]>

* eth/downloader: fix incomplete code comment  (#32354)

* metrics: use atomic.Pointer in runtimeHistogram (#32361)

Co-authored-by: Felix Lange <[email protected]>

* core/vm: fold EVMInterpreter into EVM (#32352)

The separation serves no purpose atm, and the circular dependency that
EVM and EVMInterpreter had was begging for them to be merged.

* ethclient: fix flaky pending tx test (#32380)

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

* ethdb/leveldb: check iterator error in Database.DeleteRange (#32384)

Add missing it.Error() check after iteration in Database.DeleteRange to
avoid silently ignoring iterator errors before writing the batch.

Aligns behavior with batch.DeleteRange, which already validates iterator
errors. No other functional changes; existing tests pass (TestLevelDB).

* core/vm: make types consistent in makeDup (#32378)

* miner: remove todo comment (#32389)

see
https://github.com/ethereum/go-ethereum/pull/32372#discussion_r2265885182

* downloader: fix comment (#32382)

The previous comment stated that every 3rd block has a tx and every 5th
has an uncle.
The implementation actually adds one transaction to every second block
and does not add uncles.
Updated the comment to reflect the real behavior to avoid confusion when
reading tests.

* accounts/abi, accounts/keystore: use reflect.TypeFor (#32323)


Co-authored-by: Felix Lange <[email protected]>

* eth/downloader: skip nil peer in GetHeader (#32369)

The GetHeader function was incorrectly returning an error when
encountering nil peers in the peers list, which contradicted the comment 
"keep retrying if none are yet available". 

Changed the logic to skip nil peers with 'continue' instead of returning
an error, allowing the function to properly iterate through all
available peers and attempt to retrieve the target header from each valid peer.

This ensures the function behaves as intended - trying all available
peers before giving up, rather than failing on the first nil peer encountered.

* trie, core: rework tracer and track origin value of dirty nodes (#32306)

These changes made in the PR should be highlighted here

The trie tracer is split into two distinct structs: opTracer and prevalueTracer. 
The former is specific to MPT, while the latter is generic and applicable to all
trie implementations.

The original values of dirty nodes are tracked in a NodeSet. This serves
as the foundation for both full archive node implementations and the state live
tracer.

* consensus: fix ambiguous invalid gas limit error (#32405)

## Description

Correct symmetric tolerance in gas limit validation:
Replace ambiguous "+-=" with standard "+/-" in the error message.
Logic rejects when |header − parent| ≥ limit, so allowed range is |Δ| ≤
limit − 1.

No logic or functionality has been modified.

* metrics: Block Basefee (#658)

* basefee metric

* Handle nil basefee for before london hf

* Update forkdiff

* trie: refactor to use slices.Concat (#32401)

* cmd: fix inconsistent function name in comment (#32411)

fix inconsistent function name in comment

Signed-off-by: youzichuan <[email protected]>

* eth: abort `requiredBlocks` check if peer handler terminated (#32413)

* node: remove unused err var (#32398)

* rlp: optimize intsize (#32421)

goos: darwin
goarch: arm64
pkg: github.com/ethereum/go-ethereum/rlp
cpu: Apple M4
        │   old.txt   │               new.txt               │
        │   sec/op    │   sec/op     vs base                │
Intsize   2.175n ± 5%   1.050n ± 4%  -51.76% (p=0.000 n=10)

* eth/tracers: Adds codeHash to prestateTracer's response (#32391)

**Problem:** Including full account code in prestateTracer response
significantly increases response payload size.

**Solution:** Add codeHash field to the response. This will allow
client-side bytecode caching and is a non-breaking change.

**Note:** codeHash for EoAs is excluded to save space.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* eth/syncer: fix typo (#32427)

avaibale -> available

* p2p: refactor to use time.Now().UnixMilli() in golang std lib (#32402)

* .github: upgrade workflows to Go 1.25 (#32425)

* build: upgrade -dlgo version to Go 1.25.0 (#32412)

* crypto/secp256k1: use ReadBits from common/math (#32430)

* build: remove unused functions (#32393)

* catalyst/api: centralize OPStack validation into helper functions (#592)

* catalyist/api: centralize OPStack validation into helper functions

located in a seperate file for a cleaner diff to upstream

* add test coverage for optimism validation checks

return unadorned errors from helper and allow caller to wrap

* lint

* use engine.InvalidPayloadAttributes.With() for all failed optimism FCU checks

* typos

* fix: only check optimism payload attributes if they are not nil

* combine conditions

* move test

* combine checks

* add check on withdrawals root from canyon to isthmus

* lint

* trie, core/state: add the transition tree (verkle transition part 2) (#32366)

This add some of the changes that were missing from #31634. It
introduces the `TransitionTrie`, which is a façade pattern between the
current MPT trie and the overlay tree.

---------

Signed-off-by: Guillaume Ballet <[email protected]>
Co-authored-by: rjl493456442 <[email protected]>

* cmd/evm: use PathScheme in blockrunner (#32444)

This is a preparatory change for Verkle/binary trees, since they don't
support the hash-based database scheme. This has no impact on the MPT.

* core/vm: refactor to use bitutil.TestBytes (#32434)

* crypto/bn256: refactor to use bitutil.TestBytes (#32435)

* consensus/misc/eip4844: use blob parameters of current header (#32424)

This changes the implementation to resolve the blob parameters according
to the current header timestamp. This matters for EIP-7918, where we
would previously resolve the UpdateFraction according to the parent
header fork, leading to a confusing situation at the fork transition
block.

---------

Co-authored-by: MariusVanDerWijden <[email protected]>

* rlp: remove workaround for Value.Bytes (#32433)

As of Go 1.19, it is permitted to call Bytes() on a reflect.Value
representing an adressable byte array. So we can remove our workaround,
undoing #22924.

https://go.dev/doc/go1.19#reflectpkgreflect

> The method [Value.Bytes](https://go.dev/pkg/reflect/#Value.Bytes) now
accepts addressable arrays in addition to slices.

* core/vm: fix EIP-7823 modexp input length check (#32363)

The order of the checks was wrong which would have allowed a call to
modexp with `baseLen == 0 && modLen == 0` post fusaka.

Also handles an edge case where base/mod/exp length >= 2**64

---------

Co-authored-by: Felix Lange <[email protected]>

* metrics: add tinygo build flag for CPU time (#32454)

* core/rawdb: add non-unix alternative for tablewriter (#32455)

Continuation of https://github.com/ethereum/go-ethereum/issues/32022

tablewriter assumes unix or windows, which may not be the case for
embedded targets.

For v0.0.5 of tablewriter, it is noted in table.go: "The protocols were
written in pure Go and works on windows and unix systems"

---------

Co-authored-by: rjl493456442 <[email protected]>

* eth/syncer: stop ticker to prevent resource leak (#32443)

* core/rawdb: enhance database key construction (#32431)

* rpc: add SetWebsocketReadLimit in Server (#32279)

Exposing the public method to setReadLimits for Websocket RPC to
prevent OOM.

Current, Geth Server is using a default 32MB max read limit (message
size) for websocket, which is prune to being attacked for OOM. Any one
can easily launch a client to send a bunch of concurrent large request
to cause the node to crash for OOM. One example of such script that can
easily crash a Geth node running websocket server is like this:

https://gist.githubusercontent.com/DeltaXV/b64d221e342e9c1ec6c99c1ab8201544/raw/ec830979ac9a707d98f40dfcc0ce918fc8fb9057/poc.go

---------

Co-authored-by: Felix Lange <[email protected]>

* CODEOWNERS: add gballet as the owner of trie package (#32466)

* ethclient/gethclient: use common.Hash to debug_traceTransaction (#32404)

* graphql: add query depth limit to prevent DoS attacks (#32344)

## Summary

This PR addresses a DoS vulnerability in the GraphQL service by
implementing a maximum query depth limit. While #26026 introduced
timeout handling, it didn't fully mitigate the attack vector where
deeply nested queries can still consume excessive CPU and memory
resources before the timeout is reached.

## Changes
- Added `maxQueryDepth` constant (set to 20) to limit the maximum
nesting depth of GraphQL queries
- Applied the depth limit using `graphql.MaxDepth()` option when parsing
the schema
- Added test case `TestGraphQLMaxDepth` to verify that queries exceeding
the depth limit are properly rejected

## Security Impact

Without query depth limits, malicious actors could craft deeply nested
queries that:
  - Consume excessive CPU cycles during query parsing and execution
  - Allocate large amounts of memory for nested result structures
- Potentially cause service degradation or outages even with timeout
protection

This fix complements the existing timeout mechanism by preventing
resource-intensive queries from being executed in the first place.

## Testing

Added `TestGraphQLMaxDepth` which verifies that queries with nesting
depth > 20 are rejected with a `MaxDepthExceeded` error.

## References
  - Original issue: #26026
- Related security best practices:
https://www.howtographql.com/advanced/4-security/

---------

Co-authored-by: Felix Lange <[email protected]>

* p2p: update MaxPeers comment (#32414)

* eth/catalyst: return methods by reflect (#32300)

Return the exposed methods in `ConsensusAPI` by reflection.

* internal/ethapi, miner: fix GetBlockReceipts for pending (#32461)

* trie, core/state: introduce trie Prefetch for optimizing preload (#32134)

This pull introduces a `Prefetch` operation in the trie to prefetch trie
nodes in parallel. It is used by the `triePrefetcher` to accelerate state 
loading and improve overall chain processing performance.

* beacon/engine,eth/catalyst: Fix engine API checks and exec payload creation (#662)

* p2p: using math.MaxInt32 from go std lib (#32357)

Co-authored-by: Felix Lange <[email protected]>

* rlp: refactor to use maths.ReadBits (#32432)

* fixes missing protection of nil pointer dereference in scwallet (#32186)

Fixes #32181

Signed-off-by: kapil <[email protected]>

* accounts/usbwallet: correct version comparison logic (#32417)

## Description

This PR fixes a bug in the Ledger hardware wallet version validation
logic for EIP-155 transaction signing. The original condition
incorrectly allowed older versions that don't support EIP-155 such as
0.9.9 and 0.1.5 to proceed.

* p2p: remove todo comment, as it's unnecessary (#32397)

as metioned in https://github.com/ethereum/go-ethereum/pull/32351, I
think this comment is unnecessary.

* core/types: reduce allocations for transaction comparison (#31912)

This PR should reduce overall allocations of a running node by ~10
percent. Since most allocations are coming from the re-heaping of the
transaction pool.

```
(pprof) list EffectiveGasTipCmp
Total: 38197204475
ROUTINE ======================== github.com/ethereum/go-ethereum/core/types.(*Transaction).EffectiveGasTipCmp in github.com/ethereum/go-ethereum/core/types/transaction.go
         0 3766837369 (flat, cum)  9.86% of Total
         .          .    386:func (tx *Transaction) EffectiveGasTipCmp(other *Transaction, baseFee *big.Int) int {
         .          .    387: if baseFee == nil {
         .          .    388:  return tx.GasTipCapCmp(other)
         .          .    389: }
         .          .    390: // Use more efficient internal method.
         .          .    391: txTip, otherTip := new(big.Int), new(big.Int)
         . 1796172553    392: tx.calcEffectiveGasTip(txTip, baseFee)
         . 1970664816    393: other.calcEffectiveGasTip(otherTip, baseFee)
         .          .    394: return txTip.Cmp(otherTip)
         .          .    395:}
         .          .    396:
         .          .    397:// EffectiveGasTipIntCmp compares the effective gasTipCap of a transaction to the given gasTipCap.
         .          .    398:func (tx *Transaction) EffectiveGasTipIntCmp(other *big.Int, baseFee *big.Int) int {
```

This PR reduces the allocations for comparing two transactions from 2 to
0:
```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: Intel(R) Core(TM) Ultra 7 155U
                               │ /tmp/old.txt │            /tmp/new.txt             │
                               │    sec/op    │   sec/op     vs base                │
EffectiveGasTipCmp/Original-14    64.67n ± 2%   25.13n ± 9%  -61.13% (p=0.000 n=10)

                               │ /tmp/old.txt │            /tmp/new.txt            │
                               │     B/op     │   B/op     vs base                 │
EffectiveGasTipCmp/Original-14     16.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)

                               │ /tmp/old.txt │            /tmp/new.txt             │
                               │  allocs/op   │ allocs/op   vs base                 │
EffectiveGasTipCmp/Original-14     2.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
```

It also speeds up the process by ~60%

There are two minor caveats with this PR:
- We change the API for `EffectiveGasTipCmp` and `EffectiveGasTipIntCmp`
(which are probably not used by much)
- We slightly change the behavior of `tx.EffectiveGasTip` when it
returns an error. It would previously return a negative number on error,
now it does not (since uint256 does not allow for negative numbers)

---------

Signed-off-by: Csaba Kiraly <[email protected]>
Co-authored-by: Csaba Kiraly <[email protected]>

* triedb/pathdb: improve err message in historical state reader (#32477)

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

* core, miner, trie: add metrics tracking state trie depth (#32388)

Co-authored-by: shantichanal <[email protected]>
Co-authored-by: Gary Rong <[email protected]>
Co-authored-by: Guillaume Ballet <[email protected]>

* p2p/discover: add discv5 invalid findnodes result test cases (#32481)

Supersedes #32470.

### What
- snap: shorten stall watchdog in `eth/protocols/snap/sync_test.go` from
1m to 10s.
- discover/v5: consolidate FINDNODE negative tests into a single
table-driven test:
  - `TestUDPv5_findnodeCall_InvalidNodes` covers:
    - invalid IP (unspecified `0.0.0.0`) → ignored
    - low UDP port (`<=1024`) → ignored

### Why
- Addresses TODOs:
  - “Make tests smaller” (reduce long 1m timeout).
- “check invalid IPs”; also cover low port per `verifyResponseNode`
rules (UDP must be >1024).

### How it’s validated
- Test-only changes; no production code touched.
- Local runs:
  - `go test ./p2p/discover -count=1 -timeout=300s` → ok
  - `go test ./eth/protocols/snap -count=1 -timeout=600s` → ok
- Lint:
  - `go run build/ci.go lint` → 0 issues on modified files.

### Notes
- The test harness uses `enode.ValidSchemesForTesting` (which includes
the “null” scheme), so records signed with `enode.SignNull` are
signature-valid; failures here are due to IP/port validation in
`verifyResponseNode` and `netutil.CheckRelayAddr`.
- Tests are written as a single table-driven function for clarity; no
helpers or environment switching.

---------

Co-authored-by: lightclient <[email protected]>

* node: fix vhosts for adminAPI (#32488)

* core,trie: fix typo in TransitionTrie (#32491)

Change `NewTransitionTree` to the correct `NewTransitionTrie`.

Signed-off-by: pxwanglu <[email protected]>

* .github/workflows: naive PR format checker (#32480)

Full disclosure: this has been generated by AI. The goal is to have a
quick check that the PR format is correct, before we merge it. This is
to avoid the periodical case when someone forgets to add a milestone or
check the title matches our preferred format.

* p2p: use slices.Clone (#32428)

Replaces a helper method with slices.Clone

* eth/protocols/eth: Handle DepositTx Receipts

* eth: Catch nil chainViews in backend filter maps update

* params: fix history serve window for verkle test (#32127)

Fixes the history serve window parameter for the
test function `getContractStoredBlockHash`.

Fixes #32458.

* eth/tracers: add missing teardown in TestTraceChain (#32472)

The TestTraceChain function was missing a defer backend.teardown() call,
which is required to properly release blockchain resources after test
completion.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* internal/web3ext: remove deprecated method debug_seedHash (#32495)

The corresponding function was removed in #27178

* triedb/pathdb: rename history to state history (#32498)

This is a internal refactoring PR, renaming the history to stateHistory.

It's a pre-requisite PR for merging trienode history, avoid the name
conflict.

* build: add support for ubuntu 25.04 (#31666)

* cmd: fix typo in comment (#32501)

The function name in the comment should be `writeErrors` instead of
`writeQueries`.

Signed-off-by: tzchenxixi <[email protected]>

* eth/tracers: fix supply tracer uncle accounting (#31882)

Uncle rewards were being omitted in the supply tracer due
to a bug. This PR fixes that.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* triedb/pathdb: refactor state history write (#32497)

This pull request refactors the internal implementation in path database
a bit, specifically:

- purge the state index data in batch
- simplify the logic of state history construction and index, make it more readable

* rpc: refactor read limit test (#32494)

closes #32240 #32232

The main cause for the time out is the slow json encoding of large data.
In #32240 they tried to resolve the issue by reducing the size of the
test. However as Felix pointed out, the test is still kind of confusing.

I've refactored the test so it is more understandable and have reduced
the amount of data needed to be json encoded. I think it is still
important to ensure that the default read limit is not active, so I have
retained one large (~32 MB) test case, but it's at least smaller than
the existing ~64 MB test case.

* eth: replace hardcoded sleep with polling loop in snap sync test (#32499)

Replace hardcoded 5-second sleep with polling loop that actively checks
snap sync state. This approach is already used in other project tests
(like account_cache_test.go) and provides better reliability by:

- Reducing flaky behavior on slower systems
- Finishing early when sync completes quickly
- Using 1-second timeout with 100ms polling intervals

---------

Co-authored-by: lightclient <[email protected]>

* internal/ethapi: fix precompile override for eth_estimateGas (#31795)

Fix and close https://github.com/ethereum/go-ethereum/issues/31719.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* accounts/abi: fix panic when check event with log has empty or nil topics (#32503)

When the log has empty or nil topics, the generated bindings code will
panic when accessing `log.Topics[0]`, add a check to avoid it.

* core, internal, miner, signer: convert legacy sidecar in Osaka fork (#32347)

This pull request implements #32235 , constructing blob sidecar in new
format (cell proof)
if the Osaka has been activated.

Apart from that, it introduces a pre-conversion step in the blob pool
before adding the txs.
This mechanism is essential for handling the remote **legacy** blob txs
from the network.

One thing is still missing and probably is worthy being highlighted
here: the blobpool may
contain several legacy blob txs before the Osaka and these txs should be
converted once
Osaka is activated. While the `GetBlob` API in blobpool is capable for
generating cell proofs
at the runtime, converting legacy txs at one time is much cheaper
overall.

---------

Co-authored-by: MariusVanDerWijden <[email protected]>
Co-authored-by: lightclient <[email protected]>

* eth/tracers: fix testcase 7702_delegate (#32349)

Fixes a prestateTracer test case covering 7702 delegation.

---------

Co-authored-by: Jared Wasinger <[email protected]>
Co-authored-by: Sina Mahmoodi <[email protected]>

* node: fix problematic function name in comment (#32510)

fix problematic function name in comment

Signed-off-by: slicesequal <[email protected]>

* eth: stabilize tx relay peer selection (#31714)

When maxPeers was just above some perfect square, and a few peers
dropped for some reason, we changed the peer selection function.
When new peers were acquired, we changed again.

This PR improves the selection function, in two ways. First, it will always select
sqrt(peers) to broadcast to. Second, the selection now uses siphash with a secret
key, to guard against information leaks about tx source.

---------

Signed-off-by: Csaba Kiraly <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* core: improve error context in state processor for Prague EIPs (#32509)

Add better error context for EIP-6110, EIP-7002, and EIP-7251 processing
in state processor to improve debugging capabilities.

* all: fix problematic function name in comment (#32513)

Fix problematic function name in comment.
Do my best to correct them all with a script to avoid spamming PRs.

* triedb/pathdb, core: keep root->id mappings after truncation (#32502)

This pull request preserves the root->ID mappings in the path database
even after the associated state histories are truncated, regardless of
whether the truncation occurs at the head or the tail.

The motivation is to support an additional history type, trienode history. 
Since the root->ID mappings are shared between two history instances, 
they must not be removed by either one.

As a consequence, the root->ID mappings remain in the database even
after the corresponding histories are pruned. While these mappings may 
become  dangling, it is safe and cheap to keep them.

Additionally, this pull request enhances validation during historical
reader construction, ensuring that only canonical historical state will be
served.

* README: add twitter badge to documentation (#32516)

* core/rawdb: inspect database in parallel (#32506)

`db inspect` on the full database currently takes **30min+**, because
the db iterate was run in one thread, propose to split the key-space to
256 sub range, and assign them to the worker pool to speed up.

After the change, the time of running `db inspect --workers 16` reduced
to **10min**(the keyspace is not evenly distributed).

---------

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* all: improve ETA calculation across all progress indicators (#32521)

### Summary
Fixes long-standing ETA calculation errors in progress indicators that
have been present since February 2021. The current implementation
produces increasingly inaccurate estimates due to integer division
precision loss.

### Problem

https://github.com/ethereum/go-ethereum/blob/3aeccadd04aee2d18bdb77826f86b1ca000d3b67/triedb/pathdb/history_indexer.go#L541-L553
The ETA calculation has two critical issues:
1. **Integer division precision loss**: `speed` is calculated as
`uint64`
2. **Off-by-one**: `speed` uses `+ 1`(2 times) to avoid division by
zero, however it makes mistake in the final calculation

This results in wildly inaccurate time estimates that don't improve as
progress continues.

### Example
Current output during state history indexing:
```
lvl=info msg="Indexing state history" processed=16858580 left=41802252 elapsed=18h22m59.848s eta=11h36m42.252s
```

**Expected calculation:**
- Speed: 16858580 ÷ 66179848ms = 0.255 blocks/ms  
- ETA: 41802252 ÷ 0.255 = ~45.6 hours

**Current buggy calculation:**
- Speed: rounds to 1 block/ms
- ETA: 41802252 ÷ 1 = ~11.6 hours ❌

### Solution
- Created centralized `CalculateETA()` function in common package
- Replaced all 8 duplicate code copies across the codebase

### Testing
Verified accurate ETA calculations during archive node reindexing with
significantly improved time estimates.

* core/stateless: only report leaf depth in witness stats (#32507)

Filtering for leaf nodes was missing from #32388, which means that even
the root done was reported, which made little sense for the bloatnet
data processing we want to do.

* trie/bintrie: add eip7864 binary trees and run its tests (#32365)

Implement the binary tree as specified in [eip-7864](https://eips.ethereum.org/EIPS/eip-7864). 

This will gradually replace verkle trees in the codebase. This is only 
running the tests and will not be executed in production, but will help 
me rebase some of my work, so that it doesn't bitrot as much.

---------

Signed-off-by: Guillaume Ballet
Co-authored-by: Parithosh Jayanthi <[email protected]>
Co-authored-by: rjl493456442 <[email protected]>

* internal/ethapi,params: add `eth_config` (#32239)

~Will probably be mostly supplanted by #32224, but this should do for
now for devnet 3.~

Seems like #32224 is going to take some more time, so I have completed
the implementation of eth_config here. It is quite a bit simpler to
implement now that the config hashing was removed.

---------

Co-authored-by: MariusVanDerWijden <[email protected]>
Co-authored-by: Guillaume Ballet <[email protected]>
Co-authored-by: rjl493456442 <[email protected]>

* version: release v1.16.3

* feat: bump superchain registry (#669)

* ci: Update forkdiff version to v0.1.1 (#670)

* feat: introduce minimum base fee (#666)

* add minBaseFee to superchain/types and Jovian to params/config

* extend extraData header field

* validate/encode eip1559

* spike add jovian 1559 tests

* update calcBaseFee test and fix logic for calcBaseFee

* update comment

* validate params should be 9 not 10

* dont leave out version byte in extraData

* 0 minbasefee is valid

* dont need default minBaseFee

* add test that fails for curr impl

* do one check at the end to enforce minBaseFee

* 9 bytes not 10 in validate err msg

* extend coverage

* nits

* fix test

* use feature naming and assume eip1559params 8bytes still

* best effort decode

* feature flag

* nits

* handle FCU and payload building args properly

* have payload building test support holocene still

* nits + fix api payload fcu

* use option A of feature flag + nits

* Switch from log2 to significand + exponent for min base fee

* Clear out the higher 4 bits of the significand

* Add encode/decode helpers for min base fee factors

* Remove the check for a blank min base fee

* bit manipulation change

* eth/catalyst: fix ExtraData validation for Jovian min base fee; add tests

* use u64 approach

* feedback + add specs link

* use more compact syntax

* move expectation to end of struct

* combine tests

* rename feature flag

* add new optimism-specific file with general validation and decoding functions

* move optimism specific code to new file

* remove validation and add comments

validation is done in catalyst/api

* remove feature flags altogether

* remove validation from decoding fn

* fix and use generic extradata validation fn

* add comments

* finish removing feature flag

* fix tests

* Apply suggestions from code review

* add spec link

* use inline fn to clean up diff to upstream

* add test cases and factor into subtests with require statement

* tidy up jovianConfig() helper and rename a test

* Introduce Holocene/JovianExtraDataVersionByte

* tweak

* consistency

* rename minbasefee to jovian in validation fn error msg

* assert holocene params in payload_building_test.go

* fix regression

* use ptr for MinBaseFee in PayloadAttributes

* eip1559_optimism: have Validate/DecodeOptimismExtraData take a ForkChecker interface and return a *uint64 for MinBaseFee

* introduce EncodeOptimismExtraData

* lint (whitespace only)

* fix pointer comparison in assertion

* add test for determinism of payload id

* dereference pointer when computing ID

This is not strictly necessary, but it is clearer.

* use eip1559.DecodeOptimismExtraData in test

and extend coverage to missing minbasefee

* Update consensus/misc/eip1559/eip1559_optimism.go

Co-authored-by: Sebastian Stammler <[email protected]>

* use isOptimismHolocene in CalcBaseFee and document assumption about extraData validity

* TestBuildPatload: use nil minBaseFee expectation preJovian

* rework closure to reduce diff to upstream

* remove empty line

---------

Co-authored-by: William Law <[email protected]>
Co-authored-by: Niran Babalola <[email protected]>
Co-authored-by: Sebastian Stammler <[email protected]>

* jovian: make isthmus gas params extraction forward-compatible (#671)

* sync-superchain: Handle case where skipped genesis file doesn't exist. (#673)

* feat: bump superchain registry to include are…
ClaytonNorthey92 added a commit to hemilabs/op-geth that referenced this pull request Dec 1, 2025
* cmd/workload: rework tracegen to run tracing at block level (#32092)

This PR changes the trace test to block level, aiming for better
execution performance.

---------

Co-authored-by: zsfelfoldi <[email protected]>

* core/state: add GetStateAndCommittedState (#31585)

Improves the SSTORE gas calculation a bit. Previously we would pull up
the state object twice. This is okay for existing objects, since they
are cached, however non-existing objects are not cached, thus we needed
to go through all 128 diff layers as well as the disk layer twice, just
for the gas calculation

```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/vm
cpu: AMD Ryzen 9 5900X 12-Core Processor            
               │ /tmp/old.txt │            /tmp/new.txt             │
               │    sec/op    │   sec/op     vs base                │
Interpreter-24   1118.0n ± 2%   602.8n ± 1%  -46.09% (p=0.000 n=10)
```

---------

Co-authored-by: Gary Rong <[email protected]>

* cmd/utils, internal/debug: hide the deprecated flags (#32128)

Some of the flags were deprecated, so try to hide them in the help
message. And move the `--vmodule` and `--logjson` flags to the
DeprecatedCategory.

* .gitea: add windows build (experimental)

* cmd/utils: show full deprecated flags (#32141)

This is a follow up PR after #32128 , Seems I've missed to add
--txlookuplimit as hidden. In hte meanwhile, I also add the other 
deprecated flags into the output of `show-deprecated-flags`

* cmd/utils: update flag description of gcmode (#32145)

* .gitea: add workflow_dispatch for release build

* .gitea: update PATH

* .gitea: set PATH

* gitea: try with cmd

* gitea: set PATH in script

* .gitea: fix typo in windows workflow

* core/vm: move nil-check out of the interpreter loop (#32068)

Moves the jumptable nil check our of the interpreter loop.
Benchmarks show a 2-10% improvement.

* core/vm: implement EIP-7939 - CLZ opcode (#31989)

https://eips.ethereum.org/EIPS/eip-7939

---------

Co-authored-by: spencer-tb <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* core/txpool/blobpool: lower log level for warnings (#32142)

- Change the log level to `warning`, during syncing blocks, the `final
== nil` is normal.
- Change to log tx hash.

* .github, internal/flags: improve actions test runs (#32150)

This change enables more tests to run on GitHub actions. First, it
removes the `-short` flag passed to `go test`, unskipping some longer
running tests. We also enable the full consensus tests to run by
enabling submodules during git clone.

The EF now operates org wide runners with the `self-hosted-ghr` label.
These are auto-scaling runners which should ideally allow us to process
any amount of testing load we throw at them. The new runners have `HOME`
configured differently from the actual user home directory, so our
internal test for resolving `~` had to be adapted to work in this scenario.

* consensus/misc/eip4844: implement EIP-7918  (#31965)

https://eips.ethereum.org/EIPS/eip-7918

---------

Co-authored-by: Felix Lange <[email protected]>

* core/vm: implement EIP-7951 - precompile for secp256r1 (#31991)

https://github.com/ethereum/EIPs/pull/9833

Based on #27540, #30043

---------

Co-authored-by: Ulaş Erdoğan <[email protected]>

* cmd, eth/catalyst: exit geth only if exitWhenSynced is specified (#32149)

This pull request modifies the behavior of `--synctarget` to terminate
the node only when `--exitWhenSynced` is explicitly specified.

* eth/catalyst:  abort dev mode block commit if shut down is triggered (#32166)

alternate approach to https://github.com/ethereum/go-ethereum/pull/31328
suggested by @MariusVanDerWijden . This prevents Geth from outputting a
lot of logs when trying to commit on-demand dev mode blocks while the
client is shutting down.

The issue is hard to reproduce, but I've seen it myself and it is
annoying when it happens. I think this is a reasonable simple solution,
and we can revisit if we find that the output is still too large (i.e.
there is a large delay between initiating shut down and the simulated
beacon receiving the signal, while in this loop).

Co-authored-by: Marius van der Wijden <[email protected]>

* miner, core, core/txpool: implement EIP 7825 - TX Gas Limit Cap (#31824)

Implements EIP-7825

---------

Co-authored-by: Gary Rong <[email protected]>
Co-authored-by: lightclient <[email protected]>
Co-authored-by: MariusVanDerWijden <[email protected]>

* core/vm: update gas cost of CLZ to five (#32172)

https://github.com/ethereum/EIPs/commit/a794de3fcf71bb8c71e8bafdba11f63133ce4516

* core,miner: implement EIP-7934 - RLP Execution Block Size Limit (#31990)

This PR adds a block validation check for the maximum block size, as required by
EIP-7934, and also applies a slightly lower size limit during block building.

---------

Co-authored-by: spencer-tb <[email protected]>
Co-authored-by: Felix Lange <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* Remove checkInterop from Block Building Path (#585)

* cmd/utils: add the missing check for the HoodiFlag in blsync (#32179)

Hoodi network flag should be exclusive to other network flags for both blysnc standalone and integrated mode.

* feat: bump scr commit (#640)

* cmd/clef: update Safe API documentation links in changelog (#32136)

This PR updates the outdated documentation URL from docs.gnosis.io to
the new official docs.safe.global domain. The change reflects the
rebranding from Gnosis Safe to Safe and ensures that users are directed
to the current API documentation for transaction service reference.

* txpool: Move Ingress Filter Checks to addTxsLocked (#642)

* txpool: introduce MaxTxGasLimit feature to enforce per-transaction gas limits (#626)

Adds a new flag `--txpool.maxtxgas` which represents the maximum gas limit for individual transactions (0 = no limit) when added to the mempool. Transactions exceeding this limit will be rejected by the transaction pool.

Co-authored-by: Mark Tyneway <[email protected]>

* core/types:  add block-level access list structures with encoding/decoding (#31948)

This adds the SSZ types from the 
[EIP-7928](https://eips.ethereum.org/EIPS/eip-7928) and also adds
encoder/decoder generation using https://github.com/ferranbt/fastssz.

The fastssz dependency is updated because the generation will not work
properly with the master branch version due to a bug in fastssz.

---------

Co-authored-by: Gary Rong <[email protected]>

* eth/downloader: fix ancient limit in snap sync (#32188)

This pull request fixes an issue in disabling direct-ancient mode in
snap sync.

Specifically, if `origin >= frozen && origin != 0`, it implies a part of
chain data has been written into the key-value store, all the following 
writes into ancient store scheduled by downloader will be rejected 
with error 

`ERROR[07-10|03:46:57.924] Error importing chain data to ancients
err="can't add block 1166 hash: the append operation is out-order: have
1166 want 0"`.

This issue is detected by the https://github.com/ethpandaops/kurtosis-sync-test, 
which initiates the first snap sync cycle without the finalized header and
implicitly disables the direct-ancient mode. A few seconds later the second 
snap sync cycle is initiated with the finalized information and direct-ancient mode
is enabled incorrectly.

* .github: remove karalabe from CODEOWNERS

* cmd/geth: update vcheck testdata, add docs on generating signatures (#32121)

Fixed typo in security release URL by replacing:
Old: https://blog.ethereum.org/2020/11/12/geth_security_release/
New: https://blog.ethereum.org/2020/11/12/geth-security-release/

---------

Co-authored-by: lightclient <[email protected]>

* signer/core/apitypes: require blob txs to have tx.to set (#32197)

Check the `to` address before building the blob tx.

---------

Co-authored-by: jwasinger <[email protected]>

* accounts/keystore: update links to documenation (#32194)

---


**Description:**  
- Replaced outdated GitHub wiki links with the official Ethereum
documentation for Web3 Secret Storage.
- Updated references in `keystore.go` and `passphrase.go` for improved
accuracy and reliability.


---

* ethclient/gethclient: remove race condition in tests (#32206)

alternative to https://github.com/ethereum/go-ethereum/pull/32200

The race condition is not happening yet, since there is only a single
call to `newTestBackend`, but there might be more in the future

* tracing: Show OptimismBaseFeeRecipient in prestate (#407)

The OptimismBaseFeeRecipient should show up in prestate tracing results
(both the normal prestate and the diff mode prestate results) if IsOptimism.
I added one prestate diff test with Optimism turned on to show that it
works correctly. This required adding the L1CostFunc to the test block context.

* params: EIP-7892 - Blob Parameter Only Hardforks (#32193)

This is a resubmit of https://github.com/ethereum/go-ethereum/pull/31820
against the `master` branch.

---------

Co-authored-by: Marius van der Wijden <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* eth/fetcher: fix announcement drop logic (#32210)

This PR fixes an issue in the tx_fetcher DoS prevention logic where the
code keeps the overflow amount (`want - maxTxAnnounces`) instead of the
allowed amount (`maxTxAnnounces - used`). The specific changes are:

- Correct slice indexing in the announcement drop logic
- Extend the overflow test case to cover the inversion scenario

* miner: set sidecar version when recomputing proofs (#32199)

- If the block number is `osaka` fork and needs to recompute some `blob
proofs` to `cell proofs`, here also needs to set version to `1`.

* miner, txpool: detect supervisor failsafe and reject interop transactions if enabled (#636)

* miner, txpool: detect supervisor failsafe and reject interop transactions if enabled

Add routine to periodically check for failsafe mode by calling supervisor RPC and checking error for sentinel value
Backend caches result, miner inspects the cache. Txpool checks over RPC on ingress.

Adds comprehensive tests.

* move SupervisorInFailSafe method to BackendWithInterop interface

* rename

* use interoptypes.TxToInteropAccessList in commitTransaction

* use admin_getFailsafeEnabled instead of stubbed CheckAccessList

* fixes

* fixes

* all: fix outdated ethereum wiki json-rpc json-rpc doc links (#32209)

Replace outdated wiki reference with ethereum.org
documentation links

* core/types: fix CellProofsAt method (#32198)

* triedb/pathdb: introduce file-based state journal (#32060)

Introduce file-based state journal in path database, fixing
the Pebble restriction when the journal size exceeds 4GB.

---------

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* core/rawdb: change the mechanism to schedule freezer sync (#32135)

This pull request slightly improves the freezer fsync mechanism by scheduling 
the Sync operation based on the number of uncommitted items and original
time interval.

Originally, freezer.Sync was triggered every 30 seconds, which worked well during
active chain synchronization. However, once the initial state sync is complete, 
the fixed interval causes Sync to be scheduled too frequently.

To address this, the scheduling logic has been improved to consider both the time 
interval and the number of uncommitted items. This additional condition helps 
avoid unnecessary Sync operations when the chain is idle.

* eth/protocols/snap, p2p/discover: improve zero time checks (#32214)

* all: update dead wiki links (#32215)

---


**Description:**  
- Replaced outdated GitHub wiki links with current, official
documentation URLs.
- Removed links that redirect or are no longer relevant.
- Ensured all references point to up-to-date and reliable sources.


---

* core/rawdb: reduce allocations in rawdb.ReadHeaderNumber (#31913)

This is something interesting I came across during my benchmarks, we
spent ~3.8% of all allocations allocating the header number on the heap.

```
(pprof) list GetHeaderByHash
Total: 38197204475
ROUTINE ======================== github.com/ethereum/go-ethereum/core.(*BlockChain).GetHeaderByHash in github.com/ethereum/go-ethereum/core/blockchain_reader.go
         0 5786566117 (flat, cum) 15.15% of Total
         .          .     79:func (bc *BlockChain) GetHeaderByHash(hash common.Hash) *types.Header {
         . 5786566117     80: return bc.hc.GetHeaderByHash(hash)
         .          .     81:}
         .          .     82:
         .          .     83:// GetHeaderByNumber retrieves a block header from the database by number,
         .          .     84:// caching it (associated with its hash) if found.
         .          .     85:func (bc *BlockChain) GetHeaderByNumber(number uint64) *types.Header {
ROUTINE ======================== github.com/ethereum/go-ethereum/core.(*HeaderChain).GetHeaderByHash in github.com/ethereum/go-ethereum/core/headerchain.go
         0 5786566117 (flat, cum) 15.15% of Total
         .          .    404:func (hc *HeaderChain) GetHeaderByHash(hash common.Hash) *types.Header {
         . 1471264309    405: number := hc.GetBlockNumber(hash)
         .          .    406: if number == nil {
         .          .    407:  return nil
         .          .    408: }
         . 4315301808    409: return hc.GetHeader(hash, *number)
         .          .    410:}
         .          .    411:
         .          .    412:// HasHeader checks if a block header is present in the database or not.
         .          .    413:// In theory, if header is present in the database, all relative components
         .          .    414:// like td and hash->number should be present too.
(pprof) list GetBlockNumber
Total: 38197204475
ROUTINE ======================== github.com/ethereum/go-ethereum/core.(*HeaderChain).GetBlockNumber in github.com/ethereum/go-ethereum/core/headerchain.go
  94438817 1471264309 (flat, cum)  3.85% of Total
         .          .    100:func (hc *HeaderChain) GetBlockNumber(hash common.Hash) *uint64 {
  94438817   94438817    101: if cached, ok := hc.numberCache.Get(hash); ok {
         .          .    102:  return &cached
         .          .    103: }
         . 1376270828    104: number := rawdb.ReadHeaderNumber(hc.chainDb, hash)
         .          .    105: if number != nil {
         .     554664    106:  hc.numberCache.Add(hash, *number)
         .          .    107: }
         .          .    108: return number
         .          .    109:}
         .          .    110:
         .          .    111:type headerWriteResult struct {
(pprof) list ReadHeaderNumber
Total: 38197204475
ROUTINE ======================== github.com/ethereum/go-ethereum/core/rawdb.ReadHeaderNumber in github.com/ethereum/go-ethereum/core/rawdb/accessors_chain.go
 204606513 1376270828 (flat, cum)  3.60% of Total
         .          .    146:func ReadHeaderNumber(db ethdb.KeyValueReader, hash common.Hash) *uint64 {
 109577863 1281242178    147: data, _ := db.Get(headerNumberKey(hash))
         .          .    148: if len(data) != 8 {
         .          .    149:  return nil
         .          .    150: }
  95028650   95028650    151: number := binary.BigEndian.Uint64(data)
         .          .    152: return &number
         .          .    153:}
         .          .    154:
         .          .    155:// WriteHeaderNumber stores the hash->number mapping.
         .          .    156:func WriteHeaderNumber(db ethdb.KeyValueWriter, hash common.Hash, number uint64) {
```

Opening this to discuss the idea, I know that rawdb.EmptyNumber is not a
great name for the variable, open to suggestions

* trie: avoid spawning goroutines for empty children (#32220)

* eth/downloader: improve nil pointer protection (#32222)

Fix #32221

---------

Co-authored-by: rjl493456442 <[email protected]>

* account/abi/bind/v2: fix TestDeploymentWithOverrides (#32212)

The root cause of the flaky test was a nonce conflict caused by async
contract deployments.

This solution defines a custom deployer with automatic nonce management.

* eth/tracers: apply block header overrides correctly (#32183)

Fixes #32175.

This fixes the scenario where the blockhash opcode would return 0x0
during RPC simulations when using BlockOverrides with a future block
number. The root cause was that BlockOverrides.Apply() only modified the
vm.BlockContext, but GetHashFn() depends on the actual
types.Header.Number to resolve valid historical block hashes. This
caused a mismatch and resulted in incorrect behavior during trace and
call simulations.

---------

Co-authored-by: shantichanal <[email protected]>
Co-authored-by: lightclient <[email protected]>

* triedb/pathdb: avoid duplicate metadata reads (#32226)

* eth/protocols/snap: fix negative eta in state progress logging (#32225)

* triedb/pathdb: improve the performance of parse index block (#32219)

The implementation of `parseIndexBlock` used a reverse loop with slice
appends to build the restart points, which was less cache-friendly and
involved unnecessary allocations and operations. In this PR we change
the implementation to read and validate the restart points in one single
forward loop.

Here is the benchmark test:

```bash
go test -benchmem -bench=BenchmarkParseIndexBlock ./triedb/pathdb/
```

The result as below:

```
benchmark                      old ns/op     new ns/op     delta
BenchmarkParseIndexBlock-8     52.9          37.5          -29.05%
```

about 29% improvements

---------

Signed-off-by: jsvisa <[email protected]>

* all: define constructor for BlobSidecar (#32213)

The main purpose of this change is to enforce the version setting when
constructing the blobSidecar, avoiding creating sidecar with wrong/default 
version tag.

* params: update tx gas limit cap (#32230)

Updates the tx gas limit cap to the new parameter (2^24)
https://github.com/ethereum/EIPs/pull/9986/files

* core/txpool/blobpool: remove unused `txValidationFn` from BlobPool (#32237)

This PR removes the now‑unused `txValidationFn` field from BlobPool.
It became obsolete after a PR  https://github.com/ethereum/go-ethereum/pull/31202 
was merged.

Resolves https://github.com/ethereum/go-ethereum/issues/32236

* triedb/pathdb: fix incorrect address length in history searching (#32248)

We should use account length to check address, else OOB maybe occured

Signed-off-by: jsvisa <[email protected]>

* core/vm: triple modexp cost post-cancun (#32231)

https://github.com/ethereum/EIPs/pull/9969/files

* core, params: add limit for max blobs in blob transaction (#32246)

[EIP-7594](https://eips.ethereum.org/EIPS/eip-7594) defines a limit of
max 6 blobs per transaction. We need to enforce this limit during block
processing.

> Additionally, a limit of 6 blobs per transaction is introduced.
Clients MUST enforce this limit when validating blob transactions at
submission time, when received from the network, and during block
production and processing.

* superchain: skip celo mainnet genesis processing (#646)

* superchain: skip celo mainnet genesis processing

* superchain: add GetChain tests

* superchain: add clarifying comments for celo exclusion

* build: update tests to fusaka-devnet-3 (#32251)

* core/types: minimize this invalid intermediate state (#32241)

* core/rawdb: downgrade log level in chain freezer (#32253)

* triedb/pathdb:  use binary.append to eliminate the tmp scratch slice (#32250)

`binary.AppendUvarint` offers better performance than using append
directly, because it avoids unnecessary memory allocation and copying.

In our case, it can increase the performance by +35.8% for the
`blockWriter.append` function:

```
benchmark                        old ns/op     new ns/op     delta
BenchmarkBlockWriterAppend-8     5.97          3.83          -35.80%
```

---------

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* p2p/rlpx: optimize XOR operation using bitutil.XORBytes (#32217)

Replace manual byte-by-byte XOR implementation with the optimized
bitutil.XORBytes function. This improves performance by using word-sized
operations on supported architectures while maintaining the same
functionality. The optimized version processes data in bulk rather than
one byte at a time

---------

Co-authored-by: Felix Lange <[email protected]>

* eth/gasestimator: fix potential overflow (#32255)

Improve binary search, preventing the potential overflow in certain L2 cases

* triedb/pathdb: fix an deadlock in history indexer (#32260)

Seems the `signal.result` was not sent back in shorten case, this will
cause a deadlock.

---------

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* eth/protocols/snap: add healing and syncing metrics (#32258)

Adds the heal time and snap sync time to grafana

---------

Co-authored-by: Gary Rong <[email protected]>

* core: replace the empty fmt.Errorf with errors.New (#32274)

The `errors.new` function does not require string formatting, so its
performance is better than that of `fmt.Errorf`.

* eth/catalyst: fix error message in ExecuteStatelessPayloadV4 (#32269)

Correct the error message in the ExecuteStatelessPayloadV4 function to
reference newPayloadV4 and the Prague fork, instead of incorrectly
referencing newPayloadV3 and Cancun. 

This improves clarity during debugging and aligns the error message with 
the actual function and fork being validated. No logic is changed.

---------

Co-authored-by: rjl493456442 <[email protected]>

* cmd, eth, internal: introduce debug_sync (#32177)

Alternative implementation of https://github.com/ethereum/go-ethereum/pull/32159

* all: replace fmt.Errorf with errors.New (#32286)

The errors.new function does not require string formatting, so its
performance is better than that of fmt.Errorf.

* downloader: fix typos, grammar and formatting (#32288)

* ethclient/simulated: Fix flaky rollback test (#32280)

This PR addresses a flakiness in the rollback test discussed in
https://github.com/ethereum/go-ethereum/issues/32252

I found `nonce` collision caused transactions occasionally fail to send.
I tried to change error message in the failed test like:

```
	if err = client.SendTransaction(ctx, signedTx); err != nil {
		t.Fatalf("failed to send transaction: %v, nonce: %d", err, signedTx.Nonce())
	}
```

and I occasionally got test failure with this message:

```
=== CONT  TestFlakyFunction/Run_#100
    rollback_test.go:44: failed to send transaction: already known, nonce: 0
--- FAIL: TestFlakyFunction/Run_#100 (0.07s)
```

Although `nonces` are obtained via `PendingNonceAt`, we observed that,
in rare cases (approximately 1 in 1000), two transactions from the same
sender end up with the same nonce. This likely happens because `tx0` has
not yet propagated to the transaction pool before `tx1` requests its
nonce. When the test succeeds, `tx0` and `tx1` have nonces `0` and `1`,
respectively. However, in rare failures, both transactions end up with
nonce `0`.

We modified the test to explicitly assign nonces to each transaction. By
controlling the nonce values manually, we eliminated the race condition
and ensured consistent behavior. After several thousand runs, the
flakiness was no longer reproducible in my local environment.

Reduced internal polling interval in `pendingStateHasTx()` to speed up
test execution without impacting stability. It reduces test time for
`TestTransactionRollbackBehavior` from about 7 seconds to 2 seconds.

* core/state: preallocate capacity for logs list (#32291)

Improvement: preallocate capacity for `logs` at first to avoid
reallocating multi times.

* core/state: improve PrettyPrint function (#32293)

* core/types: expose sigHash as Hash for SetCodeAuthorization (#32298)

* common/hexutil: replace customized bit sizer with bit.Uintsize (#32304)

* accounts/abi: precompile regex (#32301)

* cmd/devp2p/internal/v4test: add test for ENRRequest (#32303)

This adds a cross-client protocol test for a recently discovered bug in Nethermind.

* trie: reduce the memory allocation in trie hashing (#31902)

This pull request optimizes trie hashing by reducing memory allocation
overhead. Specifically:

- define a fullNodeEncoder pool to reuse encoders and avoid memory
allocations.

- simplify the encoding logic for shortNode and fullNode by getting rid
of the Go interfaces.

* core/vm: add configurable jumpdest analysis cache (#32143)

This adds a method on vm.EVM to set the jumpdest cache implementation.
It can be used to maintain an analysis cache across VM invocations, to improve
performance by skipping the analysis for already known contracts.

---------

Co-authored-by: lmittmann <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* eth: fix typos and outdated comments (#32324)

* eth/filters: fix error when blockHash is used with fromBlock/toBlock (#31877)

This introduces an error when the filter has both `blockHash` and
`fromBlock`/`toBlock`, since these are mutually exclusive. Seems the
tests were actually returning `not found` error, which went undetected
since there was no check on the actual returned error in the test.

* rlp/rlpgen: implement package renaming support (#31148)

This adds support for importing types from multiple identically-named
packages.

---------

Co-authored-by: Felix Lange <[email protected]>

* beacon/params, core/filtermaps: update checkpoints (#32336)

This PR updates checkpoints for blsync and filtermaps.

* version: release v1.16.2 (#32343)

* version: begin v1.16.3 release cycle (#32345)

* core/state: introduce the TransitionState object (verkle transition part 1) (#31634)

This is the first part of #31532 

It maintains a series of conversion maker which are to be updated by the
conversion code (in a follow-up PR, this is a breakdown of a larger PR
to make things easier to review). They can be used in this way:

- During the conversion, by storing the conversion markers when the
block has been processed. This is meant to be written in a function that
isn't currently present, hence [this
TODO](https://github.com/ethereum/go-ethereum/pull/31634/files#diff-89272f61e115723833d498a0acbe59fa2286e3dc7276a676a7f7816f21e248b7R384).

Part of  https://github.com/ethereum/go-ethereum/issues/31583

---------

Signed-off-by: Guillaume Ballet <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* eth/catalyst: avoid load the same blob tx multi times (#32190)

- If all the `vhashes` are in the same `sidecar`, then it will load the
same blob tx many times. This PR aims to upgrade this.

---------

Co-authored-by: Gary Rong <[email protected]>

* eth/gasestimator: check ErrGasLimitTooHigh conditions (#32348)

This PR makes 2 changes to how
[EIP-7825](https://github.com/ethereum/go-ethereum/pull/31824) behaves.

When `eth_estimateGas` or `eth_createAccessList` is called without any
gas limit in the payload, geth will choose the block's gas limit or the
`RPCGasCap`, which can be larger than the `maxTxGas`.

When this happens for `estimateGas`, the gas estimation just errors out
and ends, when it should continue doing binary search to find the lowest
possible gas limit.

This PR will: 
- Add a check to see if `hi` is larger than `maxTxGas` and cap it to
`maxTxGas` if it's larger. And add a special case handling for gas
estimation execute when it errs with `ErrGasLimitTooHigh`

---------

Co-authored-by: Gary Rong <[email protected]>

* core/filtermaps: remove unnecessary nil check and add cv2 lock (#32309)

Co-authored-by: zsfelfoldi <[email protected]>

* go.mod: upgraded github.com/golang-jwt/jwt/v4 v4.5.1 => v4.5.2 (#32356)

https://pkg.go.dev/vuln/GO-2025-3553

* rpc: use reflect.TypeFor (#32316)

* crypto/kzg4844: use reflect.TypeFor (#32319)

* common, common/hexutil: use reflect.TypeFor (#32321)

* beacon/merkle: use reflect.TypeFor (#32322)

* core: use reflect.TypeFor (#32320)

https://github.com/golang/go/issues/60088

* p2p/enode: use atomic.Pointer in LocalNode (#32360)

* signer/core/apitypes: simplify reflect []byte creation (#32315)


Co-authored-by: Felix Lange <[email protected]>

* rlp: use reflect.TypeFor (#32317)


Co-authored-by: Felix Lange <[email protected]>

* eth/downloader: fix incomplete code comment  (#32354)

* metrics: use atomic.Pointer in runtimeHistogram (#32361)

Co-authored-by: Felix Lange <[email protected]>

* core/vm: fold EVMInterpreter into EVM (#32352)

The separation serves no purpose atm, and the circular dependency that
EVM and EVMInterpreter had was begging for them to be merged.

* ethclient: fix flaky pending tx test (#32380)

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

* ethdb/leveldb: check iterator error in Database.DeleteRange (#32384)

Add missing it.Error() check after iteration in Database.DeleteRange to
avoid silently ignoring iterator errors before writing the batch.

Aligns behavior with batch.DeleteRange, which already validates iterator
errors. No other functional changes; existing tests pass (TestLevelDB).

* core/vm: make types consistent in makeDup (#32378)

* miner: remove todo comment (#32389)

see
https://github.com/ethereum/go-ethereum/pull/32372#discussion_r2265885182

* downloader: fix comment (#32382)

The previous comment stated that every 3rd block has a tx and every 5th
has an uncle.
The implementation actually adds one transaction to every second block
and does not add uncles.
Updated the comment to reflect the real behavior to avoid confusion when
reading tests.

* accounts/abi, accounts/keystore: use reflect.TypeFor (#32323)


Co-authored-by: Felix Lange <[email protected]>

* eth/downloader: skip nil peer in GetHeader (#32369)

The GetHeader function was incorrectly returning an error when
encountering nil peers in the peers list, which contradicted the comment 
"keep retrying if none are yet available". 

Changed the logic to skip nil peers with 'continue' instead of returning
an error, allowing the function to properly iterate through all
available peers and attempt to retrieve the target header from each valid peer.

This ensures the function behaves as intended - trying all available
peers before giving up, rather than failing on the first nil peer encountered.

* trie, core: rework tracer and track origin value of dirty nodes (#32306)

These changes made in the PR should be highlighted here

The trie tracer is split into two distinct structs: opTracer and prevalueTracer. 
The former is specific to MPT, while the latter is generic and applicable to all
trie implementations.

The original values of dirty nodes are tracked in a NodeSet. This serves
as the foundation for both full archive node implementations and the state live
tracer.

* consensus: fix ambiguous invalid gas limit error (#32405)

## Description

Correct symmetric tolerance in gas limit validation:
Replace ambiguous "+-=" with standard "+/-" in the error message.
Logic rejects when |header − parent| ≥ limit, so allowed range is |Δ| ≤
limit − 1.

No logic or functionality has been modified.

* metrics: Block Basefee (#658)

* basefee metric

* Handle nil basefee for before london hf

* Update forkdiff

* trie: refactor to use slices.Concat (#32401)

* cmd: fix inconsistent function name in comment (#32411)

fix inconsistent function name in comment

Signed-off-by: youzichuan <[email protected]>

* eth: abort `requiredBlocks` check if peer handler terminated (#32413)

* node: remove unused err var (#32398)

* rlp: optimize intsize (#32421)

goos: darwin
goarch: arm64
pkg: github.com/ethereum/go-ethereum/rlp
cpu: Apple M4
        │   old.txt   │               new.txt               │
        │   sec/op    │   sec/op     vs base                │
Intsize   2.175n ± 5%   1.050n ± 4%  -51.76% (p=0.000 n=10)

* eth/tracers: Adds codeHash to prestateTracer's response (#32391)

**Problem:** Including full account code in prestateTracer response
significantly increases response payload size.

**Solution:** Add codeHash field to the response. This will allow
client-side bytecode caching and is a non-breaking change.

**Note:** codeHash for EoAs is excluded to save space.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* eth/syncer: fix typo (#32427)

avaibale -> available

* p2p: refactor to use time.Now().UnixMilli() in golang std lib (#32402)

* .github: upgrade workflows to Go 1.25 (#32425)

* build: upgrade -dlgo version to Go 1.25.0 (#32412)

* crypto/secp256k1: use ReadBits from common/math (#32430)

* build: remove unused functions (#32393)

* catalyst/api: centralize OPStack validation into helper functions (#592)

* catalyist/api: centralize OPStack validation into helper functions

located in a seperate file for a cleaner diff to upstream

* add test coverage for optimism validation checks

return unadorned errors from helper and allow caller to wrap

* lint

* use engine.InvalidPayloadAttributes.With() for all failed optimism FCU checks

* typos

* fix: only check optimism payload attributes if they are not nil

* combine conditions

* move test

* combine checks

* add check on withdrawals root from canyon to isthmus

* lint

* trie, core/state: add the transition tree (verkle transition part 2) (#32366)

This add some of the changes that were missing from #31634. It
introduces the `TransitionTrie`, which is a façade pattern between the
current MPT trie and the overlay tree.

---------

Signed-off-by: Guillaume Ballet <[email protected]>
Co-authored-by: rjl493456442 <[email protected]>

* cmd/evm: use PathScheme in blockrunner (#32444)

This is a preparatory change for Verkle/binary trees, since they don't
support the hash-based database scheme. This has no impact on the MPT.

* core/vm: refactor to use bitutil.TestBytes (#32434)

* crypto/bn256: refactor to use bitutil.TestBytes (#32435)

* consensus/misc/eip4844: use blob parameters of current header (#32424)

This changes the implementation to resolve the blob parameters according
to the current header timestamp. This matters for EIP-7918, where we
would previously resolve the UpdateFraction according to the parent
header fork, leading to a confusing situation at the fork transition
block.

---------

Co-authored-by: MariusVanDerWijden <[email protected]>

* rlp: remove workaround for Value.Bytes (#32433)

As of Go 1.19, it is permitted to call Bytes() on a reflect.Value
representing an adressable byte array. So we can remove our workaround,
undoing #22924.

https://go.dev/doc/go1.19#reflectpkgreflect

> The method [Value.Bytes](https://go.dev/pkg/reflect/#Value.Bytes) now
accepts addressable arrays in addition to slices.

* core/vm: fix EIP-7823 modexp input length check (#32363)

The order of the checks was wrong which would have allowed a call to
modexp with `baseLen == 0 && modLen == 0` post fusaka.

Also handles an edge case where base/mod/exp length >= 2**64

---------

Co-authored-by: Felix Lange <[email protected]>

* metrics: add tinygo build flag for CPU time (#32454)

* core/rawdb: add non-unix alternative for tablewriter (#32455)

Continuation of https://github.com/ethereum/go-ethereum/issues/32022

tablewriter assumes unix or windows, which may not be the case for
embedded targets.

For v0.0.5 of tablewriter, it is noted in table.go: "The protocols were
written in pure Go and works on windows and unix systems"

---------

Co-authored-by: rjl493456442 <[email protected]>

* eth/syncer: stop ticker to prevent resource leak (#32443)

* core/rawdb: enhance database key construction (#32431)

* rpc: add SetWebsocketReadLimit in Server (#32279)

Exposing the public method to setReadLimits for Websocket RPC to
prevent OOM.

Current, Geth Server is using a default 32MB max read limit (message
size) for websocket, which is prune to being attacked for OOM. Any one
can easily launch a client to send a bunch of concurrent large request
to cause the node to crash for OOM. One example of such script that can
easily crash a Geth node running websocket server is like this:

https://gist.githubusercontent.com/DeltaXV/b64d221e342e9c1ec6c99c1ab8201544/raw/ec830979ac9a707d98f40dfcc0ce918fc8fb9057/poc.go

---------

Co-authored-by: Felix Lange <[email protected]>

* CODEOWNERS: add gballet as the owner of trie package (#32466)

* ethclient/gethclient: use common.Hash to debug_traceTransaction (#32404)

* graphql: add query depth limit to prevent DoS attacks (#32344)

## Summary

This PR addresses a DoS vulnerability in the GraphQL service by
implementing a maximum query depth limit. While #26026 introduced
timeout handling, it didn't fully mitigate the attack vector where
deeply nested queries can still consume excessive CPU and memory
resources before the timeout is reached.

## Changes
- Added `maxQueryDepth` constant (set to 20) to limit the maximum
nesting depth of GraphQL queries
- Applied the depth limit using `graphql.MaxDepth()` option when parsing
the schema
- Added test case `TestGraphQLMaxDepth` to verify that queries exceeding
the depth limit are properly rejected

## Security Impact

Without query depth limits, malicious actors could craft deeply nested
queries that:
  - Consume excessive CPU cycles during query parsing and execution
  - Allocate large amounts of memory for nested result structures
- Potentially cause service degradation or outages even with timeout
protection

This fix complements the existing timeout mechanism by preventing
resource-intensive queries from being executed in the first place.

## Testing

Added `TestGraphQLMaxDepth` which verifies that queries with nesting
depth > 20 are rejected with a `MaxDepthExceeded` error.

## References
  - Original issue: #26026
- Related security best practices:
https://www.howtographql.com/advanced/4-security/

---------

Co-authored-by: Felix Lange <[email protected]>

* p2p: update MaxPeers comment (#32414)

* eth/catalyst: return methods by reflect (#32300)

Return the exposed methods in `ConsensusAPI` by reflection.

* internal/ethapi, miner: fix GetBlockReceipts for pending (#32461)

* trie, core/state: introduce trie Prefetch for optimizing preload (#32134)

This pull introduces a `Prefetch` operation in the trie to prefetch trie
nodes in parallel. It is used by the `triePrefetcher` to accelerate state 
loading and improve overall chain processing performance.

* beacon/engine,eth/catalyst: Fix engine API checks and exec payload creation (#662)

* p2p: using math.MaxInt32 from go std lib (#32357)

Co-authored-by: Felix Lange <[email protected]>

* rlp: refactor to use maths.ReadBits (#32432)

* fixes missing protection of nil pointer dereference in scwallet (#32186)

Fixes #32181

Signed-off-by: kapil <[email protected]>

* accounts/usbwallet: correct version comparison logic (#32417)

## Description

This PR fixes a bug in the Ledger hardware wallet version validation
logic for EIP-155 transaction signing. The original condition
incorrectly allowed older versions that don't support EIP-155 such as
0.9.9 and 0.1.5 to proceed.

* p2p: remove todo comment, as it's unnecessary (#32397)

as metioned in https://github.com/ethereum/go-ethereum/pull/32351, I
think this comment is unnecessary.

* core/types: reduce allocations for transaction comparison (#31912)

This PR should reduce overall allocations of a running node by ~10
percent. Since most allocations are coming from the re-heaping of the
transaction pool.

```
(pprof) list EffectiveGasTipCmp
Total: 38197204475
ROUTINE ======================== github.com/ethereum/go-ethereum/core/types.(*Transaction).EffectiveGasTipCmp in github.com/ethereum/go-ethereum/core/types/transaction.go
         0 3766837369 (flat, cum)  9.86% of Total
         .          .    386:func (tx *Transaction) EffectiveGasTipCmp(other *Transaction, baseFee *big.Int) int {
         .          .    387: if baseFee == nil {
         .          .    388:  return tx.GasTipCapCmp(other)
         .          .    389: }
         .          .    390: // Use more efficient internal method.
         .          .    391: txTip, otherTip := new(big.Int), new(big.Int)
         . 1796172553    392: tx.calcEffectiveGasTip(txTip, baseFee)
         . 1970664816    393: other.calcEffectiveGasTip(otherTip, baseFee)
         .          .    394: return txTip.Cmp(otherTip)
         .          .    395:}
         .          .    396:
         .          .    397:// EffectiveGasTipIntCmp compares the effective gasTipCap of a transaction to the given gasTipCap.
         .          .    398:func (tx *Transaction) EffectiveGasTipIntCmp(other *big.Int, baseFee *big.Int) int {
```

This PR reduces the allocations for comparing two transactions from 2 to
0:
```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: Intel(R) Core(TM) Ultra 7 155U
                               │ /tmp/old.txt │            /tmp/new.txt             │
                               │    sec/op    │   sec/op     vs base                │
EffectiveGasTipCmp/Original-14    64.67n ± 2%   25.13n ± 9%  -61.13% (p=0.000 n=10)

                               │ /tmp/old.txt │            /tmp/new.txt            │
                               │     B/op     │   B/op     vs base                 │
EffectiveGasTipCmp/Original-14     16.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)

                               │ /tmp/old.txt │            /tmp/new.txt             │
                               │  allocs/op   │ allocs/op   vs base                 │
EffectiveGasTipCmp/Original-14     2.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
```

It also speeds up the process by ~60%

There are two minor caveats with this PR:
- We change the API for `EffectiveGasTipCmp` and `EffectiveGasTipIntCmp`
(which are probably not used by much)
- We slightly change the behavior of `tx.EffectiveGasTip` when it
returns an error. It would previously return a negative number on error,
now it does not (since uint256 does not allow for negative numbers)

---------

Signed-off-by: Csaba Kiraly <[email protected]>
Co-authored-by: Csaba Kiraly <[email protected]>

* triedb/pathdb: improve err message in historical state reader (#32477)

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

* core, miner, trie: add metrics tracking state trie depth (#32388)

Co-authored-by: shantichanal <[email protected]>
Co-authored-by: Gary Rong <[email protected]>
Co-authored-by: Guillaume Ballet <[email protected]>

* p2p/discover: add discv5 invalid findnodes result test cases (#32481)

Supersedes #32470.

### What
- snap: shorten stall watchdog in `eth/protocols/snap/sync_test.go` from
1m to 10s.
- discover/v5: consolidate FINDNODE negative tests into a single
table-driven test:
  - `TestUDPv5_findnodeCall_InvalidNodes` covers:
    - invalid IP (unspecified `0.0.0.0`) → ignored
    - low UDP port (`<=1024`) → ignored

### Why
- Addresses TODOs:
  - “Make tests smaller” (reduce long 1m timeout).
- “check invalid IPs”; also cover low port per `verifyResponseNode`
rules (UDP must be >1024).

### How it’s validated
- Test-only changes; no production code touched.
- Local runs:
  - `go test ./p2p/discover -count=1 -timeout=300s` → ok
  - `go test ./eth/protocols/snap -count=1 -timeout=600s` → ok
- Lint:
  - `go run build/ci.go lint` → 0 issues on modified files.

### Notes
- The test harness uses `enode.ValidSchemesForTesting` (which includes
the “null” scheme), so records signed with `enode.SignNull` are
signature-valid; failures here are due to IP/port validation in
`verifyResponseNode` and `netutil.CheckRelayAddr`.
- Tests are written as a single table-driven function for clarity; no
helpers or environment switching.

---------

Co-authored-by: lightclient <[email protected]>

* node: fix vhosts for adminAPI (#32488)

* core,trie: fix typo in TransitionTrie (#32491)

Change `NewTransitionTree` to the correct `NewTransitionTrie`.

Signed-off-by: pxwanglu <[email protected]>

* .github/workflows: naive PR format checker (#32480)

Full disclosure: this has been generated by AI. The goal is to have a
quick check that the PR format is correct, before we merge it. This is
to avoid the periodical case when someone forgets to add a milestone or
check the title matches our preferred format.

* p2p: use slices.Clone (#32428)

Replaces a helper method with slices.Clone

* eth/protocols/eth: Handle DepositTx Receipts

* eth: Catch nil chainViews in backend filter maps update

* params: fix history serve window for verkle test (#32127)

Fixes the history serve window parameter for the
test function `getContractStoredBlockHash`.

Fixes #32458.

* eth/tracers: add missing teardown in TestTraceChain (#32472)

The TestTraceChain function was missing a defer backend.teardown() call,
which is required to properly release blockchain resources after test
completion.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* internal/web3ext: remove deprecated method debug_seedHash (#32495)

The corresponding function was removed in #27178

* triedb/pathdb: rename history to state history (#32498)

This is a internal refactoring PR, renaming the history to stateHistory.

It's a pre-requisite PR for merging trienode history, avoid the name
conflict.

* build: add support for ubuntu 25.04 (#31666)

* cmd: fix typo in comment (#32501)

The function name in the comment should be `writeErrors` instead of
`writeQueries`.

Signed-off-by: tzchenxixi <[email protected]>

* eth/tracers: fix supply tracer uncle accounting (#31882)

Uncle rewards were being omitted in the supply tracer due
to a bug. This PR fixes that.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* triedb/pathdb: refactor state history write (#32497)

This pull request refactors the internal implementation in path database
a bit, specifically:

- purge the state index data in batch
- simplify the logic of state history construction and index, make it more readable

* rpc: refactor read limit test (#32494)

closes #32240 #32232

The main cause for the time out is the slow json encoding of large data.
In #32240 they tried to resolve the issue by reducing the size of the
test. However as Felix pointed out, the test is still kind of confusing.

I've refactored the test so it is more understandable and have reduced
the amount of data needed to be json encoded. I think it is still
important to ensure that the default read limit is not active, so I have
retained one large (~32 MB) test case, but it's at least smaller than
the existing ~64 MB test case.

* eth: replace hardcoded sleep with polling loop in snap sync test (#32499)

Replace hardcoded 5-second sleep with polling loop that actively checks
snap sync state. This approach is already used in other project tests
(like account_cache_test.go) and provides better reliability by:

- Reducing flaky behavior on slower systems
- Finishing early when sync completes quickly
- Using 1-second timeout with 100ms polling intervals

---------

Co-authored-by: lightclient <[email protected]>

* internal/ethapi: fix precompile override for eth_estimateGas (#31795)

Fix and close https://github.com/ethereum/go-ethereum/issues/31719.

---------

Co-authored-by: Sina Mahmoodi <[email protected]>

* accounts/abi: fix panic when check event with log has empty or nil topics (#32503)

When the log has empty or nil topics, the generated bindings code will
panic when accessing `log.Topics[0]`, add a check to avoid it.

* core, internal, miner, signer: convert legacy sidecar in Osaka fork (#32347)

This pull request implements #32235 , constructing blob sidecar in new
format (cell proof)
if the Osaka has been activated.

Apart from that, it introduces a pre-conversion step in the blob pool
before adding the txs.
This mechanism is essential for handling the remote **legacy** blob txs
from the network.

One thing is still missing and probably is worthy being highlighted
here: the blobpool may
contain several legacy blob txs before the Osaka and these txs should be
converted once
Osaka is activated. While the `GetBlob` API in blobpool is capable for
generating cell proofs
at the runtime, converting legacy txs at one time is much cheaper
overall.

---------

Co-authored-by: MariusVanDerWijden <[email protected]>
Co-authored-by: lightclient <[email protected]>

* eth/tracers: fix testcase 7702_delegate (#32349)

Fixes a prestateTracer test case covering 7702 delegation.

---------

Co-authored-by: Jared Wasinger <[email protected]>
Co-authored-by: Sina Mahmoodi <[email protected]>

* node: fix problematic function name in comment (#32510)

fix problematic function name in comment

Signed-off-by: slicesequal <[email protected]>

* eth: stabilize tx relay peer selection (#31714)

When maxPeers was just above some perfect square, and a few peers
dropped for some reason, we changed the peer selection function.
When new peers were acquired, we changed again.

This PR improves the selection function, in two ways. First, it will always select
sqrt(peers) to broadcast to. Second, the selection now uses siphash with a secret
key, to guard against information leaks about tx source.

---------

Signed-off-by: Csaba Kiraly <[email protected]>
Co-authored-by: Felix Lange <[email protected]>

* core: improve error context in state processor for Prague EIPs (#32509)

Add better error context for EIP-6110, EIP-7002, and EIP-7251 processing
in state processor to improve debugging capabilities.

* all: fix problematic function name in comment (#32513)

Fix problematic function name in comment.
Do my best to correct them all with a script to avoid spamming PRs.

* triedb/pathdb, core: keep root->id mappings after truncation (#32502)

This pull request preserves the root->ID mappings in the path database
even after the associated state histories are truncated, regardless of
whether the truncation occurs at the head or the tail.

The motivation is to support an additional history type, trienode history. 
Since the root->ID mappings are shared between two history instances, 
they must not be removed by either one.

As a consequence, the root->ID mappings remain in the database even
after the corresponding histories are pruned. While these mappings may 
become  dangling, it is safe and cheap to keep them.

Additionally, this pull request enhances validation during historical
reader construction, ensuring that only canonical historical state will be
served.

* README: add twitter badge to documentation (#32516)

* core/rawdb: inspect database in parallel (#32506)

`db inspect` on the full database currently takes **30min+**, because
the db iterate was run in one thread, propose to split the key-space to
256 sub range, and assign them to the worker pool to speed up.

After the change, the time of running `db inspect --workers 16` reduced
to **10min**(the keyspace is not evenly distributed).

---------

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* all: improve ETA calculation across all progress indicators (#32521)

### Summary
Fixes long-standing ETA calculation errors in progress indicators that
have been present since February 2021. The current implementation
produces increasingly inaccurate estimates due to integer division
precision loss.

### Problem

https://github.com/ethereum/go-ethereum/blob/3aeccadd04aee2d18bdb77826f86b1ca000d3b67/triedb/pathdb/history_indexer.go#L541-L553
The ETA calculation has two critical issues:
1. **Integer division precision loss**: `speed` is calculated as
`uint64`
2. **Off-by-one**: `speed` uses `+ 1`(2 times) to avoid division by
zero, however it makes mistake in the final calculation

This results in wildly inaccurate time estimates that don't improve as
progress continues.

### Example
Current output during state history indexing:
```
lvl=info msg="Indexing state history" processed=16858580 left=41802252 elapsed=18h22m59.848s eta=11h36m42.252s
```

**Expected calculation:**
- Speed: 16858580 ÷ 66179848ms = 0.255 blocks/ms  
- ETA: 41802252 ÷ 0.255 = ~45.6 hours

**Current buggy calculation:**
- Speed: rounds to 1 block/ms
- ETA: 41802252 ÷ 1 = ~11.6 hours ❌

### Solution
- Created centralized `CalculateETA()` function in common package
- Replaced all 8 duplicate code copies across the codebase

### Testing
Verified accurate ETA calculations during archive node reindexing with
significantly improved time estimates.

* core/stateless: only report leaf depth in witness stats (#32507)

Filtering for leaf nodes was missing from #32388, which means that even
the root done was reported, which made little sense for the bloatnet
data processing we want to do.

* trie/bintrie: add eip7864 binary trees and run its tests (#32365)

Implement the binary tree as specified in [eip-7864](https://eips.ethereum.org/EIPS/eip-7864). 

This will gradually replace verkle trees in the codebase. This is only 
running the tests and will not be executed in production, but will help 
me rebase some of my work, so that it doesn't bitrot as much.

---------

Signed-off-by: Guillaume Ballet
Co-authored-by: Parithosh Jayanthi <[email protected]>
Co-authored-by: rjl493456442 <[email protected]>

* internal/ethapi,params: add `eth_config` (#32239)

~Will probably be mostly supplanted by #32224, but this should do for
now for devnet 3.~

Seems like #32224 is going to take some more time, so I have completed
the implementation of eth_config here. It is quite a bit simpler to
implement now that the config hashing was removed.

---------

Co-authored-by: MariusVanDerWijden <[email protected]>
Co-authored-by: Guillaume Ballet <[email protected]>
Co-authored-by: rjl493456442 <[email protected]>

* version: release v1.16.3

* feat: bump superchain registry (#669)

* ci: Update forkdiff version to v0.1.1 (#670)

* feat: introduce minimum base fee (#666)

* add minBaseFee to superchain/types and Jovian to params/config

* extend extraData header field

* validate/encode eip1559

* spike add jovian 1559 tests

* update calcBaseFee test and fix logic for calcBaseFee

* update comment

* validate params should be 9 not 10

* dont leave out version byte in extraData

* 0 minbasefee is valid

* dont need default minBaseFee

* add test that fails for curr impl

* do one check at the end to enforce minBaseFee

* 9 bytes not 10 in validate err msg

* extend coverage

* nits

* fix test

* use feature naming and assume eip1559params 8bytes still

* best effort decode

* feature flag

* nits

* handle FCU and payload building args properly

* have payload building test support holocene still

* nits + fix api payload fcu

* use option A of feature flag + nits

* Switch from log2 to significand + exponent for min base fee

* Clear out the higher 4 bits of the significand

* Add encode/decode helpers for min base fee factors

* Remove the check for a blank min base fee

* bit manipulation change

* eth/catalyst: fix ExtraData validation for Jovian min base fee; add tests

* use u64 approach

* feedback + add specs link

* use more compact syntax

* move expectation to end of struct

* combine tests

* rename feature flag

* add new optimism-specific file with general validation and decoding functions

* move optimism specific code to new file

* remove validation and add comments

validation is done in catalyst/api

* remove feature flags altogether

* remove validation from decoding fn

* fix and use generic extradata validation fn

* add comments

* finish removing feature flag

* fix tests

* Apply suggestions from code review

* add spec link

* use inline fn to clean up diff to upstream

* add test cases and factor into subtests with require statement

* tidy up jovianConfig() helper and rename a test

* Introduce Holocene/JovianExtraDataVersionByte

* tweak

* consistency

* rename minbasefee to jovian in validation fn error msg

* assert holocene params in payload_building_test.go

* fix regression

* use ptr for MinBaseFee in PayloadAttributes

* eip1559_optimism: have Validate/DecodeOptimismExtraData take a ForkChecker interface and return a *uint64 for MinBaseFee

* introduce EncodeOptimismExtraData

* lint (whitespace only)

* fix pointer comparison in assertion

* add test for determinism of payload id

* dereference pointer when computing ID

This is not strictly necessary, but it is clearer.

* use eip1559.DecodeOptimismExtraData in test

and extend coverage to missing minbasefee

* Update consensus/misc/eip1559/eip1559_optimism.go

Co-authored-by: Sebastian Stammler <[email protected]>

* use isOptimismHolocene in CalcBaseFee and document assumption about extraData validity

* TestBuildPatload: use nil minBaseFee expectation preJovian

* rework closure to reduce diff to upstream

* remove empty line

---------

Co-authored-by: William Law <[email protected]>
Co-authored-by: Niran Babalola <[email protected]>
Co-authored-by: Sebastian Stammler <[email protected]>

* jovian: make isthmus gas params extraction forward-compatible (#671)

* sync-superchain: Handle case where skipped genesis file doesn't exist. (#673)

* feat: bump superchain registry to include arena-z sepolia isthmus hardfork (#678)

* chore(superchain-registry): bump version for addresses cleanup (#672)

* eth/downloader: Fix deposit receipt correction (#680)

* all: Introduce feature toggles for Jovian (#677)

* introduce IsMinBaseFee feature toggle

Allows feature to be easily removed from Jovian hardfork.
When the hardfork scope is locked, this commit can be reverted.

* decouple features

* add isOperatorFeeFix toggle

* Remove approval hold job from release workflow (#683)

Removed approval hold job from release process in CircleCI config.

* params: add bpo forks to eth_config (#32579)

BPO forks should also be included in eth_config response.

* params: schedule Osaka/BPO1/BPO2 for testnets (#32735)

Timestamps taken from:

- Holesky:
https://github.com/eth-clients/holesky/blob/main/metadata/genesis.json
- Sepolia:
https://github.com/eth-clients/sepolia/blob/main/metadata/genesis.json
- Hoodi:
https://github.com/eth-clients/hoodi/blob/main/metadata/genesis.json

* core,miner,parms: DA footprint block limit (constant gas scalar) (#655)

* all: Make DA footprint gas scalar configurable (#675)

Co-authored-by: Sebastian Stammler <[email protected]>

* core/types: implement operator fee fix (Jovian) (#696)

* fix!: multiply operatorFeeScalar by 100 instead of dividing by 1e6

* apply comments

* apply comments

* remove dup IsOperatorFeeFix

---------

Co-authored-by: fakedev9999 <[email protected]>

* consensus/beacon: Fix OP Legacy header verification dispatch (#697)

* all: Store DA footprint in blob gas used header field (#694)

* all: update c-kzg-4844 to 2.1.5 (#702)

* superchain: update scr import to include worldchain-sepolia isthmus time (#704)

* core: add gauge metrics + histograms for block gas used and blob gas used (#705)

* core: add gauge metric for block gas used and blob gas used

This can be used to track the DA footprint per block

* encapsulate OPStack additions into new file and function

* add histogram metrics for (blob)GasUsed

* update fork.yaml

* typos

* superchain: update scr import to include jovian activation timestamp (#707)

* Add new precompile limits for Jovian (#709)

This introduces more realistic limits on accelerated precompiles for the Jovian hard fork.

* superchain: Update for new Jovian timestamps (#712)

* core/types: Populate Jovian receipt fields (#710)

* core/types: Move receipt tests OP diff to separate file

* core/types: Populate Jovian receipt fields

* core/txpool/blobpool: migrate billy to new slot size (#31966)

Implements a migration path for the blobpool slotter

---------

Co-authored-by: lightclient <[email protected]>
Co-authored-by: lightclient <[email protected]>
Co-authored-by: Gary Rong <[email protected]>

* params: set osaka and BPO1 & BPO2 mainnet dates (#33063)

Sets the fusaka, bpo1, bpo2 timestamps for mainnet
see: https://notes.ethereum.org/@bbusa/fusaka-bpo-timeline

* superchain: update for new Jovian timestamps (#716)

* triedb/pathdb: sync ancient store before journal (#32557) (#718)

This pull request addresses the corrupted path database with log
indicating:
`history head truncation out of range, tail: 122557, head: 212208,
target: 212557`

This is a rare edge case where the in-memory layers, including the write
buffer
in the disk layer, are fully persisted (e.g., written to file), but the
state history
freezer is not properly closed (e.g., Geth is terminated after
journaling but
before freezer.Close). In this situation, the recent state history
writes will be
truncated on the next startup, while the in-memory layers resolve
correctly.
As a result, the state history falls behind the disk layer (including
the write buffer).

In this pull request, the state history freezer is always synced before
journal,
ensuring the state history writes are always persisted before the
others.

Edit: 
It's confirmed that devops team has 10s container termination setting.
It
explains why Geth didn't finish the entire termination without state
history
being closed.

https://github.com/ethpandaops/fusaka-devnets/pull/63/files

Co-authored-by: rjl493456442 <[email protected]>

* finalize merge of v1.101603.4

* checkpoint

* fixed tests besides one

* remove pr validation, I don't think it's used by us

* fix test broken with upstream pull merge

* added forgotten options

* Additional Logging

* Additional Logging

* Go generate

* logging around time overrides

* add overrides to new struct

* revert gen receipts go file

* don't modify map

* correct comparison

* Logging

* More logging

* Short-circuit modern signer's tx.From extraction for PoP / BTC Attr Dep

* Short-circuit modern signer's tx.From extraction for PoP / BTC Attr Dep

* Short-circuit modern signer's tx.From extraction for PoP / BTC Attr Dep

* Logging

* Do not pre-populate precompiles for gas calculation, remove some logging

* Remove precompile prepare logging

* Remove gas param logging

---------

Signed-off-by: jsvisa <[email protected]>
Signed-off-by: Guillaume Ballet <[email protected]>
Signed-off-by: youzichuan <[email protected]>
Signed-off-by: kapil <[email protected]>
Signed-off-by: Csaba Kiraly <[email protected]>
Signed-off-by: pxwanglu <[email protected]>
Signed-off-by: tzchenxixi <[email protected]>
Signed-off-by: slicesequal <[email protected]>
Signed-off-by: Guillaume Ballet
Co-authored-by: rjl493456442 <[email protected]>
Co-authored-by: zsfelfoldi <[email protected]>
Co-authored-by: Marius van der Wijden <[email protected]>
Co-authored-by: Zhou <[email protected]>
Co-authored-by: Felix Lange <[email protected]>
Co-authored-by: Ömer Faruk Irmak <[email protected]>
Co-authored-by: Giulio rebuffo <[email protected]>
Co-authored-by: spencer-tb <[email protected]>
Co-authored-by: maskpp <[email protected]>
Co-authored-by: Sina M <[email protected]>
Co-authored-by: Ulaş Erdoğan <[email protected]>
Co-authored-by: jwasinger <[email protected]>
Co-authored-by: lightclient <[email protected]>
Co-authored-by: Axel Kingsley <[email protected]>
Co-authored-by: Jacob Elias <[email protected]>
Co-authored-by: CrazyFrog <[email protected]>
Co-authored-by: Niran Babalola <[email protected]>
Co-authored-by: Mark Tyneway <[email protected]>
Co-authored-by: PixelPilot <[email protected]>
Co-authored-by: kilavvy <[email protected]>
Co-authored-by: Karl Bartel <[email protected]>
Co-authored-by: Bosul Mun <[email protected]>
Co-authored-by: George Knee <[email protected]>
Co-authored-by: FT <[email protected]>
Co-authored-by: Delweng <[email protected]>
Co-authored-by: asamuj <[email protected]>
Co-authored-by: Maxim Evtush <[email protected]>
Co-authored-by: CertiK-Geth <[email protected]>
Co-authored-by: steven <[email protected]>
Co-authored-by: shazam8253 <[email protected]>
Co-authored-by: shantichanal <[email protected]>
Co-authored-by: kourin <[email protected]>
Co-authored-by: Sam Stokes <[email protected]>
Co-authored-by: Micke <[email protected]>
Co-authored-by: gzeon <[email protected]>
Co-authored-by: nthumann <[email protected]>
Co-authored-by: Galoretka <[email protected]>
Co-authored-by: ericxtheodore <[email protected]>
Co-authored-by: Tomás Andróil <[email protected]>
Co-authored-by: kashitaka <[email protected]>
Co-authored-by: Daniel Katzan <[email protected]>
Co-authored-by: cui <[email protected]>
Co-authored-by: lmittmann <[email protected]>
Co-authored-by: lmittmann <lm…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants