Commit graph

16179 commits

Author SHA1 Message Date
VolodymyrBg
5572f2ed22
rlp/rlpgen: implement package renaming support (#31148)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
This adds support for importing types from multiple identically-named
packages.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-01 18:30:48 +02:00
Ceyhun Onur
038ff766ff
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.
2025-08-01 17:14:30 +02:00
Tomás Andróil
9c58810e71
eth: fix typos and outdated comments (#32324) 2025-08-01 20:00:00 +08:00
lmittmann
17d65e9451
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 <lmittmann@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-01 13:57:38 +02:00
rjl493456442
23da91f73b
trie: reduce the memory allocation in trie hashing (#31902)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
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.
2025-08-01 10:23:23 +08:00
Felix Lange
d4a3bf1b23
cmd/devp2p/internal/v4test: add test for ENRRequest (#32303)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This adds a cross-client protocol test for a recently discovered bug in Nethermind.
2025-07-31 12:13:36 +02:00
cui
4d9d72806c
accounts/abi: precompile regex (#32301)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-07-31 09:53:31 +08:00
cui
0814d991ab
common/hexutil: replace customized bit sizer with bit.Uintsize (#32304) 2025-07-31 09:48:31 +08:00
Daniel Katzan
2d95ba7d15
core/types: expose sigHash as Hash for SetCodeAuthorization (#32298) 2025-07-31 09:34:17 +08:00
ericxtheodore
d14d4d2af0
core/state: improve PrettyPrint function (#32293)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-07-30 10:39:03 +08:00
maskpp
a56558d092
core/state: preallocate capacity for logs list (#32291)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Improvement: preallocate capacity for `logs` at first to avoid
reallocating multi times.
2025-07-29 13:36:30 +08:00
kashitaka
eb7aef45a7
ethclient/simulated: Fix flaky rollback test (#32280)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
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.
2025-07-28 22:17:36 +08:00
Tomás Andróil
b64a500163
downloader: fix typos, grammar and formatting (#32288) 2025-07-28 20:56:29 +08:00
ericxtheodore
32d537cd58
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.
2025-07-28 10:13:18 +02:00
rjl493456442
a7aed7bd6f
cmd, eth, internal: introduce debug_sync (#32177)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Alternative implementation of https://github.com/ethereum/go-ethereum/pull/32159
2025-07-28 14:57:45 +08:00
Galoretka
0fe1bc0717
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 <garyrong0905@gmail.com>
2025-07-28 09:16:47 +08:00
nthumann
29eebb5eac
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`.
2025-07-28 09:13:50 +08:00
Marius van der Wijden
b369a855fb
eth/protocols/snap: add healing and syncing metrics (#32258)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Adds the heal time and snap sync time to grafana

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-07-24 16:43:04 +08:00
Delweng
16117eb7cd
triedb/pathdb: fix an deadlock in history indexer (#32260)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Seems the `signal.result` was not sent back in shorten case, this will
cause a deadlock.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-07-23 15:12:55 +08:00
gzeon
3b67602c4c
eth/gasestimator: fix potential overflow (#32255)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Improve binary search, preventing the potential overflow in certain L2 cases
2025-07-23 11:41:37 +08:00
Micke
a7efdcbf09
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 <fjl@twurst.com>
2025-07-22 23:06:48 +02:00
Delweng
264c06a72c
triedb/pathdb: use binary.append to eliminate the tmp scratch slice (#32250)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
`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 <delweng@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-07-22 20:03:22 +08:00
maskpp
83aa643621
core/rawdb: downgrade log level in chain freezer (#32253) 2025-07-22 15:18:23 +08:00
maskpp
b2a0e08808
core/types: minimize this invalid intermediate state (#32241) 2025-07-22 15:03:48 +08:00
Felix Lange
36c87a220e
build: update tests to fusaka-devnet-3 (#32251)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-07-21 23:20:36 +02:00
Felix Lange
f96f82bd6b
core, params: add limit for max blobs in blob transaction (#32246)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
[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.
2025-07-21 16:26:24 +02:00
Marius van der Wijden
d80094f788
core/vm: triple modexp cost post-cancun (#32231)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
https://github.com/ethereum/EIPs/pull/9969/files
2025-07-21 12:29:55 +02:00
Delweng
f37fe6750f
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 <delweng@gmail.com>
2025-07-21 16:30:43 +08:00
kourin
f17df6db91
core/txpool/blobpool: remove unused txValidationFn from BlobPool (#32237)
Some checks failed
/ Linux Build (arm) (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
/ Linux Build (push) Has been cancelled
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
2025-07-18 18:36:10 +08:00
Marius van der Wijden
b4b4068fe7
params: update tx gas limit cap (#32230)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Updates the tx gas limit cap to the new parameter (2^24)
https://github.com/ethereum/EIPs/pull/9986/files
2025-07-18 13:22:59 +08:00
rjl493456442
0dacfef8ac
all: define constructor for BlobSidecar (#32213)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The main purpose of this change is to enforce the version setting when
constructing the blobSidecar, avoiding creating sidecar with wrong/default 
version tag.
2025-07-17 11:19:20 +08:00
Delweng
a487729d83
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 <delweng@gmail.com>
2025-07-17 11:07:22 +08:00
Zhou
becca46010
eth/protocols/snap: fix negative eta in state progress logging (#32225) 2025-07-17 10:59:47 +08:00
Delweng
f36d349918
triedb/pathdb: avoid duplicate metadata reads (#32226) 2025-07-17 10:44:35 +08:00
shazam8253
30e3a49180
eth/tracers: apply block header overrides correctly (#32183)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
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 <158101918+shantichanal@users.noreply.github.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
2025-07-16 15:26:33 -06:00
steven
66df1f26b8
account/abi/bind/v2: fix TestDeploymentWithOverrides (#32212)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
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.
2025-07-16 21:36:44 +08:00
CertiK-Geth
532a1c2ca4
eth/downloader: improve nil pointer protection (#32222)
Fix #32221

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-07-16 21:11:10 +08:00
Ömer Faruk Irmak
61d7279e1f
trie: avoid spawning goroutines for empty children (#32220) 2025-07-16 21:00:39 +08:00
Marius van der Wijden
e94123acc2
core/rawdb: reduce allocations in rawdb.ReadHeaderNumber (#31913)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
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
2025-07-15 15:48:36 +02:00
Maxim Evtush
7fcb796f64
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.


---
2025-07-15 06:24:17 -06:00
asamuj
d7db10ddbd
eth/protocols/snap, p2p/discover: improve zero time checks (#32214)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-07-15 14:20:45 +08:00
rjl493456442
7364e63ef9
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.
2025-07-15 13:50:52 +08:00
Delweng
17903fedf0
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 <delweng@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-07-15 11:45:20 +08:00
maskpp
fe0ae06c77
core/types: fix CellProofsAt method (#32198) 2025-07-15 09:07:23 +08:00
FT
5bce990891
all: fix outdated ethereum wiki json-rpc json-rpc doc links (#32209)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Replace outdated wiki reference with ethereum.org
documentation links
2025-07-14 16:08:06 -06:00
maskpp
1a5f399e30
miner: set sidecar version when recomputing proofs (#32199)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
- 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`.
2025-07-14 22:06:57 +08:00
Bosul Mun
e9e12a97d2
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
2025-07-14 21:33:24 +08:00
Felix Lange
a327ffe9b3
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 <m.vanderwijden@live.de>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-07-14 14:07:43 +02:00
Marius van der Wijden
90a098904f
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
2025-07-14 18:27:42 +09:00
kilavvy
a9061cfd77
accounts/keystore: update links to documenation (#32194)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
---


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


---
2025-07-14 09:15:18 +02:00