1
0
Fork 0
forked from forks/go-ethereum
Commit graph

15963 commits

Author SHA1 Message Date
rjl493456442
892a661ee2
core, triedb/pathdb: final integration (snapshot integration pt 5) (#30661)
In this pull request, snapshot generation in pathdb has been ported from 
the legacy state snapshot implementation. Additionally, when running in 
path mode, legacy state snapshot data is now managed by the pathdb
based snapshot logic.

Note: Existing snapshot data will be re-generated, regardless of whether 
it was previously fully constructed.
2025-05-16 18:29:38 +08:00
Sina M
57e985ecab
cmd/utils: remove deprecated LES flags (#31838)
They were not widely used in users setups.
2025-05-16 10:20:36 +02:00
Marius Kjærstad
1f175347c4
build: upgrade -dlgo version to Go 1.24.3 (#31774)
New security fix: https://groups.google.com/g/golang-announce/c/UZoIkUT367A
2025-05-15 22:54:18 +02:00
Felix Lange
3ceec0ea9b
cmd/geth, internal/era/eradl: add era1 downloader tool (#31823)
This adds a geth subcommand for downloading era1 files and placing them into
the correct location. The tool can be used even while geth is already running
on the datadir. Downloads are checked against a hard-coded list of checksums
for mainnet and sepolia.

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

The implementation reuses the file downloader we already had for
fetching build tools. I've done some refactoring on it to make sure it
can support the new use case, and there are some changes to the build
here as well.
2025-05-15 22:53:26 +02:00
Charlotte
85b26f3d68
AUTHORS, .mailmap: update name and email attribution (#31624) 2025-05-15 21:55:38 +02:00
Guillaume Ballet
af9a3a1a03
core/state, core/vm: update stateless gas costs to follow the verkle-gen-7 testnet (#31014)
Adding values to the witness introduces a new class of issues for
computing gas: if there is not enough gas to cover adding an item to the
witness, then the item should not be added to the witness.

The problem happens when several items are added together, and that
process runs out of gas. The witness gas computation needs a way to
signal that not enough gas was provided. These values can not be
hardcoded, however, as they are context dependent, i.e. two calls to the
same function with the same parameters can give two different results.

The approach is to return both the gas that was actually consumed, and
the gas that was necessary. If the values don't match, then a witness
update OOG'd. The caller should then charge the `consumed` value
(remaining gas will be 0) and error out.

Why not return a boolean instead of the wanted value? Because when
several items are touched, we want to distinguish which item lacked gas.

---------

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
2025-05-15 20:43:52 +08:00
Felix Lange
228803c1a2
p2p/enode: add support for naming iterator sources (#31779)
This adds support for naming the source iterators of FairMix, like so:

  mix.AddSource(enode.WithSourceName("mySource", iter))

The source that produced the latest node is returned by the new NodeSource method.
2025-05-15 14:17:58 +02:00
maskpp
52dbd206bb
cmd/utils: always record preimages in dev mode (#31821)
Fix a todo: force-enable this in --dev mode

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
2025-05-15 15:32:20 +08:00
Marius van der Wijden
16b0d9e982
eth/catalyst: refactor engine api checks (#31182)
This PR contains three refactors:
- refactor the latest fork check that we use quite extensively 
- refactor the nil checks in NewPayloads

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-05-14 08:50:02 -06:00
Delweng
88a7ef233a
core: use unix time to check fork readiness (#31800) 2025-05-14 09:26:08 +08:00
maskpp
c53db5e1f6
eth: fix returned blockContext for empty blocks in stateAtTransaction (#31768)
Co-authored-by: lightclient <lightclient@protonmail.com>
2025-05-13 15:28:16 +02:00
wellna
2cd5f22037
crypto/kzg4844: use package github.com/crate-crypto/go-eth-kzg (#31806)
I saw in https://github.com/ethereum/go-ethereum/pull/31378 introduced
github.com/crate-crypto/go-eth-kzg to calculate the kzg hash, and
github.com/crate-crypto/go-kzg-4844 was only used in the test files, so
propose to drop it with go-eth-kzg instead
2025-05-13 14:11:27 +02:00
SHADOW
c7bdf6b2fe
accounts/abi/abigen: remove unnecessary test files (#31804)
fix #31793: resolve conflict markers in structs-abi.go.txt
2025-05-12 11:31:48 +02:00
Klimov Sergey
d121c27ace
core/state: fix incorrect description of function behavior (#31809) 2025-05-12 15:41:24 +08:00
rjl493456442
098cc7e878
ethdb/pebble: expose stall counter of pebble (#31782)
This pull request adds a more Pebble metrics, tracking the amount of
write stalls with specific reasons
2025-05-12 14:37:01 +08:00
Marcel
fa86416ce9
metrics: add chain/mgasps to track gas usage rate (#31753)
This adds a metric called `chain/mgasps`, which records how many million
gas per second are being used during block insertion.

The value is calculated as `usedGas * 1000 / elapsed`, and it's updated
in the `insertStats.report` method. Also cleaned up the log output to
reuse the same value instead of recalculating it.

Useful for monitoring block processing throughput.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-05-10 08:27:27 +08:00
Satoshi Is Here
0db99f4e40
core/types: reduce allocations in tx.EffectiveGasTip (#31598)
This PR introduces an allocation-free version of the
Transaction.EffectiveGasTip method to improve performance by reducing
memory allocations.

## Changes
- Added a new `EffectiveGasTipInto` method that accepts a destination
parameter to avoid memory allocations
- Refactored the existing `EffectiveGasTip` method to use the new
allocation-free implementation
- Updated related methods (`EffectiveGasTipValue`, `EffectiveGasTipCmp`,
`EffectiveGasTipIntCmp`) to use the allocation-free approach
- Added tests and benchmarks to verify correctness and measure
performance improvements

## Motivation
In high-transaction-volume environments, the `EffectiveGasTip` method is
called frequently. Reducing memory allocations in this method decreases
garbage collection pressure and improves overall system performance.

## Benchmark Results

As-Is
BenchmarkEffectiveGasTip/Original-10 42089140 27.45 ns/op 8 B/op 1
allocs/op

To-Be
BenchmarkEffectiveGasTip/IntoMethod-10 72353263 16.73 ns/op 0 B/op 0
allocs/op


## Summary of Improvements
- **Performance**: ~39% faster execution (27.45 ns/op → 16.73 ns/op)
- **Memory**: Eliminated all allocations (8 B/op → 0 B/op)
- **Allocation count**: Reduced from 1 to 0 allocations per operation

This optimization follows the same pattern successfully applied to other
methods in the codebase, maintaining API compatibility while improving
performance.

## Safety & Compatibility
This optimization has no side effects or adverse impacts because:
- It maintains functional equivalence as confirmed by comprehensive
tests
- It preserves API compatibility with existing callers
- It follows clear memory ownership patterns with the destination
parameter
- It maintains thread safety by only modifying the caller-provided
destination parameter

This optimization follows the same pattern successfully applied to other
methods in the codebase, providing better performance without
compromising stability or correctness.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-05-09 12:56:00 +02:00
Marius van der Wijden
0eb2eeea90
all: create global hasher pool (#31769)
This PR creates a global hasher pool that can be used by all packages.
It also removes a bunch of the package local pools.

It also updates a few locations to use available hashers or the global
hashing pool to reduce allocations all over the codebase.
This change should reduce global allocation count by ~1%

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-05-09 13:52:40 +08:00
rjl493456442
485ff4bbff
core: implement in-block prefetcher (#31557)
This pull request enhances the block prefetcher by executing transactions 
in parallel to warm the cache alongside the main block processor.

Unlike the original prefetcher, which only executes the next block and
is limited to chain syncing, the new implementation can be applied to any 
block. This makes it useful not only during chain sync but also for regular 
block insertion after the initial sync.


---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2025-05-08 22:28:16 +08:00
rjl493456442
0f48cbf017
core, triedb/pathdb: bail out error if write state history fails (#31781)
This PR fixes an issue that could lead to data corruption.

Writing the state history may fail due to insufficient disk space or
other potential errors. With this change, the entire state insertion 
will be aborted instead of silently ignoring the error.

Without this fix, state transitions would continue while the associated
state history is lost. After a restart, the resulting gap would be detected, 
making recovery impossible.
2025-05-08 22:27:01 +08:00
maskpp
6bc57579d1
core/types: delete unused test variable (#31776)
Delete the unused `Account.PrivateKey` variable.
2025-05-08 15:21:48 +02:00
rjl493456442
181dd2e660
cmd/geth, internal: fix flaky console tests (#31784)
This pull request bumps the timeout for flaky console tests on appveyor.
2025-05-08 15:15:36 +02:00
rjl493456442
10519768a2
core, ethdb: introduce database sync function (#31703)
This pull request introduces a SyncKeyValue function to the
ethdb.KeyValueStore
interface, providing the ability to forcibly flush all previous writes
to disk.

This functionality is critical for go-ethereum, which internally uses
two independent
database engines: a key-value store (such as Pebble, LevelDB, or
memoryDB for
testing) and a flat-file–based freezer. To ensure write-order
consistency between
these engines, the key-value store must be explicitly synced before
writing to the
freezer and vice versa.

Fixes 
- https://github.com/ethereum/go-ethereum/issues/31405
- https://github.com/ethereum/go-ethereum/issues/29819
2025-05-08 19:10:26 +08:00
JukLee0ira
07d073bc5a
internal/web3ext: remove the legacy backtraceAt method (#31783)
The function `BacktraceAt` has been removed in #28187 . But the API
end-point `debug_backtraceAt` is not removed from the file
`internal/web3ext/web3ext.go`.
2025-05-08 14:57:17 +08:00
Csaba Kiraly
0d5de826da
p2p: add metrics for inbound connection errors (#31652)
Add metics detailing reasons we reject inbound connections for, and
reasons these connections fail during the handshake.
2025-05-07 15:34:52 +02:00
Felix Lange
3e356d69ef
beacon/blsync: fix requests encoding in engine_newPayloadV4 (#31775)
This fixes an issue where blocks containing CL requests triggered an
error in the engine API. The encoding of requests used base64 instead of
hex.
2025-05-07 18:53:45 +08:00
jwasinger
51b34efebc
cmd/utils: don't allow network ID override if a preset network is specified (#31630) 2025-05-06 12:40:03 +08:00
Alex Zaytsev
79e8870e34
go.mod: update pebble to v1.1.5 to reduce clutter in go.sum (#31541)
```
go get github.com/cockroachdb/pebble@v1.1.5
go mod tidy
```

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-05-06 11:30:19 +08:00
Felix Lange
d6655cb450 version: begin v1.15.12 release cycle 2025-05-05 16:20:38 +02:00
Felix Lange
36b2371c59 version: release go-ethereum v1.15.11 stable 2025-05-05 16:19:58 +02:00
jwasinger
7705d13ed4
eth/tracers: fix standardTraceBlockToFile (#31763)
Fixes methods debug_standardTraceBlockToFile
and debug_standardTraceBadBlockToFile which were
outputting empty files.

---------

Co-authored-by: maskpp <maskpp266@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-05-05 16:15:59 +02:00
Matus Kysel
b135da2eac
rpc: add method name length limit (#31711)
This change adds a limit for RPC method names to prevent potential abuse
where large method names could lead to large response sizes.

The limit is enforced in:
- handleCall for regular RPC method calls
- handleSubscribe for subscription method calls

Added tests in websocket_test.go to verify the length limit
functionality for both regular method calls and subscriptions.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-05-05 14:43:47 +02:00
Sina M
bca0646ede
internal/ethapi: fix tx.from in eth_simulateV1 (#31480)
Issue statement: when user requests eth_simulateV1 to return full
transaction objects, these objects always had an empty `from` field. The
reason is we lose the sender when translation the message into a
types.Transaction which is then later on serialized.

I did think of an alternative but opted to keep with this approach as it
keeps complexity at the edge. The alternative would be to pass down a
signer object to RPCMarshal* methods and define a custom signer which
keeps the senders in its state and doesn't attempt the signature
recovery.
2025-05-05 12:42:19 +02:00
GarmashAlex
fc2ba1fb2e
triedb: add test suite for preimage store (#31574) 2025-05-05 14:01:53 +08:00
Marcel
1b18ba2423
logs(indexer)Clean up log format in head index progress messages (#31761)
updates the log entries in `core/filtermaps/indexer.go` to remove double
quotes around keys like "first block" and "last block", changing them to
`firstblock` and `lastblock`. This brings them in line with the general
logging style used across the codebase, where log keys are unquoted
single words.

For example, the log:
`  INFO [...] "first block"=..., "last block"=...`

Is now rendered as:
`  INFO [...] firstblock=..., lastblock=...`

This change improves readability and maintains consistency with logs
such as:
`  INFO [...] number=2 sealhash=... uncles=0 txs=0 ...`

No functional behavior is changed — this is purely a formatting cleanup
for better developer experience.
2025-05-05 10:09:58 +08:00
Sina M
615d29f7c2
core: reduce load on txindexer from API (#31752)
Fixes https://github.com/ethereum/go-ethereum/issues/31732.

This logic was removed in the recent refactoring in the txindexer to
handle history cutoff (#31393). It was first introduced in this PR:
https://github.com/ethereum/go-ethereum/pull/28908.

I have tested it and it works as an alternative to #31745.

This PR packs 3 changes to the flow of fetching txs from the API:

- It caches the indexer tail after each run is over to avoid hitting the
db all the time as was done originally in #28908.

- Changes `backend.GetTransaction`. It doesn't return an error anymore
when tx indexer is in progress. It shifts the responsibility to the
caller to check the progress. The reason is that in most cases we anyway
check the txpool for the tx. If it was indeed a pending tx we can avoid
the indexer progress check.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-05-05 10:07:55 +08:00
zhiqiangxu
516451dc3a
params: fix comment for DefaultBlobSchedule (#31760)
`DefaultBlobSchedule` is actually used downstream to calculate blob fees
(e.g.,
[src](601a380e47/op-service/eth/blob.go (L301))),
this PR makes it explicit that these params are for `Ethereum prod`
instead of `test chains`.
2025-05-04 06:40:31 -06:00
Miro
2d86a54000
core/txpool/legacypool: fix data race of pricedList access (#31758) 2025-05-04 10:16:33 +08:00
Felföldi Zsolt
8868ad6d6e
core/filtermaps: fix log index initialization (#31750)
This PR fixes an initialization bug that in some cases caused the map
renderer to leave the last, partially rendered map as is and resume
rendering from the next map. At initialization we check whether the
existing rendered maps are consistent with the current chain view and
revert them if necessary. Until now this happened through an ugly hacky
solution, a "limited" chain view that was supposed to trigger a rollback
of some maps in the renderer logic if necessary. This whole setup worked
under assumptions that just weren't true any more. As a result it always
tried to revert the last map but also it did not shorten the indexed
range, only set `headIndexed` to false which indicated to the renderer
logic that the last map is fully populated (which it wasn't).
Now an explicit rollback of any unusable (reorged) maps happens at
startup, which also means that no hacky chain view is necessary, as soon
as the new `FilterMaps` is returned, the indexed range and view are
consistent with each other.

In the first commit an extra check is also added to `writeFinishedMaps`
so that if there is ever again a bug that would result in a gapped index
then it will not break the db with writing the incomplete data. Instead
it will return an indexing error which causes the indexer to revert to
unindexed mode and print an error log instantly. Hopefully this will not
ever happen in the future, but in order to test this safeguard check I
manually triggered the bug with only the first commit enabled, which
caused an indexing error as expected. With the second commit added (the
actual fix) the same operation succeeded without any issues.

Note that the database version is also bumped in this PR in order to
enforce a full reindexing as any existing database might be potentially
broken.

Fixes https://github.com/ethereum/go-ethereum/issues/31729
2025-05-03 18:40:24 +02:00
Felföldi Zsolt
341929ab96
core/filtermaps: fix log value search range (#31734)
This PR fixes the out-of-range block number logic of `getBlockLvPointer`
which sometimes caused searches to fail if the head was updated in the
wrong moment. This logic ensures that querying the pointer of a future
block returns the pointer after the last fully indexed block (instead of
failing) and therefore an async range update will not cause the search
to fail. Earier this behaviour only worked when `headIndexed` was true
and `headDelimiter` pointed to the end of the indexed range. Now it also
works for an unfinished index.

This logic is also moved from `FilterMaps.getBlockLvPointer` to
`FilterMapsMatcherBackend.GetBlockLvPointer` because it is only required
by the search anyways. `FilterMaps.getBlockLvPointer` now only returns a
pointer for existing blocks, consistently with how it is used in the
indexer/renderer.

Note that this unhandled case has been present in the code for a long
time but went unnoticed because either one of two previously fixed bugs
did prevent it from being triggered; the incorrectly positive
`tempRange.headIndexed` (fixed in
https://github.com/ethereum/go-ethereum/pull/31680), though caused other
problems, prevented this one from being triggered as with a positive
`headIndexed` no database read was triggered in `getBlockLvPointer`.
Also, the unnecessary `indexLock` in `synced()` (fixed in
https://github.com/ethereum/go-ethereum/pull/31708) usually did prevent
the search seeing the temp range and therefore avoided noticeable
issues.
2025-05-02 17:50:22 +02:00
rjl493456442
79807bc3b1
core, eth/gasestimator: introduce MaxGasUsed for estimation (#31735)
This PR improves gas estimation for data-heavy transactions which hit the floor data gas cost.
2025-05-02 17:43:06 +02:00
Daniel Liu
86a492471a
node: avoid double close resp.Body (#31710)
The functions `rpcRequest` and `batchRpcRequest` call `baseRpcRequest`.
And `resp.Body` will be closed in the function `baseRpcRequest` later by
`t.Cleanup`:

```go
func baseRpcRequest(t *testing.T, url, bodyStr string, extraHeaders ...string) *http.Response {
        // ......
	t.Cleanup(func() { resp.Body.Close() })
	return resp
}
```
2025-05-02 09:21:17 -06:00
Abel
ed93a5ac04
cmd/devp2p: test for non-existent block request (#31506)
Add tests for GetBlockHeaders that verify client does not disconnect when unlikely block numbers are requested, e.g. max uint64.
---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-05-02 08:31:50 -06:00
Shude Li
af9673b143
ethclient: fix retrieval of pending block (#31504)
Since the block hash is not returned for pending blocks, ethclient cannot unmarshal into RPC block. This makes hash optional on rpc block and compute the hash locally for pending blocks to correctly key the tx sender cache.


a82303f4e3/internal/ethapi/api.go (L500-L504)

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-05-02 07:19:54 -06:00
ericxtheodore
701df4baad
cmd/geth: fix compatErr in initGenesis (#31746) 2025-04-30 18:37:48 +08:00
Marius van der Wijden
7612872761
core/filtermaps: do not derive full receipts during rendering (#31716)
This changes the filtermaps to only pull up the raw receipts, not the
derived receipts which saves a lot of allocations.

During normal execution this will reduce the allocations of the whole
geth node by ~15%.
2025-04-30 15:23:08 +08:00
Csaba Kiraly
21341f6c0b
eth/fetcher: define BatchSize as a constant (#31742) 2025-04-30 11:02:11 +08:00
zhiqiangxu
ba0a61bc28
cmd/geth: print crit log if chain config is not compatible (#31743) 2025-04-30 11:00:17 +08:00
Marius van der Wijden
947fd3a834
crypto/kzg4844: add ComputeCells functionality (#31378)
For PeerDAS, we need to compute cell proofs. Both ckzg and gokzg support
computing these cell proofs.
This PR does the following:

- Update the go-kzg library from "github.com/crate-crypto/go-kzg-4844"
to "github.com/crate-crypto/go-eth-kzg" which will be the new upstream
for go-kzg moving forward
- Update ckzg from v1.0.0 to v2.0.1 and switch to /v2
- Updates the trusted setup to contain the g1 points both in lagrange
and monomial form
- Expose `ComputeCells` to compute the cell proofs
2025-04-29 14:42:17 +02:00
rjl493456442
0ac4a84a1f
beacon/engine: omit empty witness in payload response (#31739)
Fixes https://github.com/ethereum/go-ethereum/issues/31737
2025-04-29 13:21:18 +02:00