Compare commits

...

657 commits

Author SHA1 Message Date
rjl493456442
be92f5487e
trie: error out for unexpected key-value pairs preceding the range (#33898)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-02-26 23:00:02 +08:00
Sina M
8a4345611d
build: update ubuntu distros list (#33864)
The`plucky` and `oracular` have reached end of life. That's why
launchpad isn't building them anymore:
https://launchpad.net/~ethereum/+archive/ubuntu/ethereum/+packages.
2026-02-26 13:55:53 +01:00
Marius van der Wijden
f811bfe4fd
core/vm: implement eip-7843: SLOTNUM (#33589)
Implements the slotnum opcode as specified here:
https://eips.ethereum.org/EIPS/eip-7843
2026-02-26 13:53:46 +01:00
Guillaume Ballet
406a852ec8
AGENTS.md: add AGENTS.md (#33890)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Co-authored-by: tellabg <249254436+tellabg@users.noreply.github.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
2026-02-24 23:08:23 -07:00
ANtutov
2a45272408
eth/protocols/eth: fix handshake timeout metrics classification (#33539)
Previously, handshake timeouts were recorded as generic peer errors
instead of timeout errors. waitForHandshake passed a raw
p2p.DiscReadTimeout into markError, but markError classified errors only
via errors.Unwrap(err), which returns nil for non-wrapped errors. As a
result, the timeoutError meter was never incremented and all such
failures fell into the peerError bucket.

This change makes markError switch on the base error, using
errors.Unwrap(err) when available and falling back to the original error
otherwise. With this adjustment, p2p.DiscReadTimeout is correctly mapped
to timeoutError, while existing behaviour for the other wrapped sentinel
errors remains unchanged

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-02-24 21:50:26 -07:00
Fynn
8450e40798
cmd/geth: add inspect trie tool to analysis trie storage (#28892)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This pr adds a tool names `inpsect-trie`, aimed to analyze the mpt and
its node storage more efficiently.

## Example
 ./geth db inspect-trie --datadir server/data-seed/ latest 4000

## Result

- MPT shape
- Account Trie 
- Top N Storage Trie
```
+-------+-------+--------------+-------------+--------------+
|   -   | LEVEL | SHORTNODECNT | FULLNODECNT | VALUENODECNT |
+-------+-------+--------------+-------------+--------------+
|   -   |   0   |      0       |      1      |      0       |
|   -   |   1   |      0       |     16      |      0       |
|   -   |   2   |      76      |     32      |      74      |
|   -   |   3   |      66      |      1      |      66      |
|   -   |   4   |      2       |      0      |      2       |
| Total |  144  |      50      |     142     |
+-------+-------+--------------+-------------+--------------+
AccountTrie
+-------+-------+--------------+-------------+--------------+
|   -   | LEVEL | SHORTNODECNT | FULLNODECNT | VALUENODECNT |
+-------+-------+--------------+-------------+--------------+
|   -   |   0   |      0       |      1      |      0       |
|   -   |   1   |      0       |     16      |      0       |
|   -   |   2   |     108      |     84      |     104      |
|   -   |   3   |     195      |      5      |     195      |
|   -   |   4   |      10      |      0      |      10      |
| Total |  313  |     106      |     309     |
+-------+-------+--------------+-------------+--------------+
ContractTrie-0xc874e65ccffb133d9db4ff637e62532ef6ecef3223845d02f522c55786782911
+-------+-------+--------------+-------------+--------------+
|   -   | LEVEL | SHORTNODECNT | FULLNODECNT | VALUENODECNT |
+-------+-------+--------------+-------------+--------------+
|   -   |   0   |      0       |      1      |      0       |
|   -   |   1   |      0       |     16      |      0       |
|   -   |   2   |      57      |     14      |      56      |
|   -   |   3   |      33      |      0      |      33      |
| Total |  90   |      31      |     89      |
+-------+-------+--------------+-------------+--------------+
ContractTrie-0x1d7dcb6a0ce5227c5379fc5b0e004561d7833b063355f69bfea3178f08fbaab4
+-------+-------+--------------+-------------+--------------+
|   -   | LEVEL | SHORTNODECNT | FULLNODECNT | VALUENODECNT |
+-------+-------+--------------+-------------+--------------+
|   -   |   0   |      0       |      1      |      0       |
|   -   |   1   |      5       |      8      |      5       |
|   -   |   2   |      16      |      1      |      16      |
|   -   |   3   |      2       |      0      |      2       |
| Total |  23   |      10      |     23      |
+-------+-------+--------------+-------------+--------------+
ContractTrie-0xaa8a4783ebbb3bec45d3e804b3c59bfd486edfa39cbeda1d42bf86c08a0ebc0f
+-------+-------+--------------+-------------+--------------+
|   -   | LEVEL | SHORTNODECNT | FULLNODECNT | VALUENODECNT |
+-------+-------+--------------+-------------+--------------+
|   -   |   0   |      0       |      1      |      0       |
|   -   |   1   |      9       |      3      |      9       |
|   -   |   2   |      7       |      1      |      7       |
|   -   |   3   |      2       |      0      |      2       |
| Total |  18   |      5       |     18      |
+-------+-------+--------------+-------------+--------------+
ContractTrie-0x9d2804d0562391d7cfcfaf0013f0352e176a94403a58577ebf82168a21514441
+-------+-------+--------------+-------------+--------------+
|   -   | LEVEL | SHORTNODECNT | FULLNODECNT | VALUENODECNT |
+-------+-------+--------------+-------------+--------------+
|   -   |   0   |      0       |      1      |      0       |
|   -   |   1   |      6       |      4      |      6       |
|   -   |   2   |      8       |      0      |      8       |
| Total |  14   |      5       |     14      |
+-------+-------+--------------+-------------+--------------+
ContractTrie-0x17e3eb95d0e6e92b42c0b3e95c6e75080c9fcd83e706344712e9587375de96e1
+-------+-------+--------------+-------------+--------------+
|   -   | LEVEL | SHORTNODECNT | FULLNODECNT | VALUENODECNT |
+-------+-------+--------------+-------------+--------------+
|   -   |   0   |      0       |      1      |      0       |
|   -   |   1   |      5       |      3      |      5       |
|   -   |   2   |      7       |      0      |      7       |
| Total |  12   |      4       |     12      |
+-------+-------+--------------+-------------+--------------+
ContractTrie-0xc017ca90c8aa37693c38f80436bb15bde46d7b30a503aa808cb7814127468a44
Contract Trie, total trie num: 142, ShortNodeCnt: 620, FullNodeCnt: 204, ValueNodeCnt: 615
```

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2026-02-24 10:56:00 -07:00
cui
9ecb6c4ae6
core: reduce alloc (#33576)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
inside tx.GasPrice()/GasFeeCap()/GasTipCap() already new a big.Int.  
bench result:  
```
goos: darwin
goarch: arm64
pkg: github.com/ethereum/go-ethereum/core
cpu: Apple M4
                        │   old.txt   │               new.txt               │
                        │   sec/op    │   sec/op     vs base                │
TransactionToMessage-10   240.1n ± 7%   175.1n ± 7%  -27.09% (p=0.000 n=10)

                        │  old.txt   │              new.txt               │
                        │    B/op    │    B/op     vs base                │
TransactionToMessage-10   544.0 ± 0%   424.0 ± 0%  -22.06% (p=0.000 n=10)

                        │  old.txt   │              new.txt               │
                        │ allocs/op  │ allocs/op   vs base                │
TransactionToMessage-10   17.00 ± 0%   11.00 ± 0%  -35.29% (p=0.000 n=10)
```
benchmark code:  

```
// Copyright 2025 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package core

import (
	"math/big"
	"testing"

	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
	"github.com/ethereum/go-ethereum/crypto"
	"github.com/ethereum/go-ethereum/params"
)

// BenchmarkTransactionToMessage benchmarks the TransactionToMessage function.
func BenchmarkTransactionToMessage(b *testing.B) {
	key, _ := crypto.GenerateKey()
	signer := types.LatestSigner(params.TestChainConfig)
	to := common.HexToAddress("0x000000000000000000000000000000000000dead")
	
	// Create a DynamicFeeTx transaction
	txdata := &types.DynamicFeeTx{
		ChainID:   big.NewInt(1),
		Nonce:     42,
		GasTipCap: big.NewInt(1000000000),  // 1 gwei
		GasFeeCap: big.NewInt(2000000000),  // 2 gwei
		Gas:       21000,
		To:        &to,
		Value:     big.NewInt(1000000000000000000), // 1 ether
		Data:      []byte{0x12, 0x34, 0x56, 0x78},
		AccessList: types.AccessList{
			types.AccessTuple{
				Address:     common.HexToAddress("0x0000000000000000000000000000000000000001"),
				StorageKeys: []common.Hash{
					common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"),
				},
			},
		},
	}
	tx, _ := types.SignNewTx(key, signer, txdata)
	baseFee := big.NewInt(1500000000) // 1.5 gwei

	b.ResetTimer()
	b.ReportAllocs()
	for i := 0; i < b.N; i++ {
		_, err := TransactionToMessage(tx, signer, baseFee)
		if err != nil {
			b.Fatal(err)
		}
	}
}
l
```
2026-02-24 07:40:01 -07:00
rjl493456442
e636e4e3c1
core/state: track slot reads for empty storage (#33743)
From the https://eips.ethereum.org/EIPS/eip-7928

> SELFDESTRUCT (in-transaction): Accounts destroyed within a transaction
   MUST be included in AccountChanges without nonce or code changes. 
   However, if the account had a positive balance pre-transaction, the
   balance change to zero MUST be recorded. Storage keys within the self-destructed
   contracts that were modified or read MUST be included as a storage_reads
   entry.

The storage read against the empty contract (zero storage) should also
be recorded in the BAL's readlist.
2026-02-24 21:57:50 +08:00
rjl493456442
cbf3d8fed2
core/vm: touch precompile object with Amsterdam enabled (#33742)
https://eips.ethereum.org/EIPS/eip-7928 spec:

> Precompiled contracts: Precompiles MUST be included when accessed. 
   If a precompile receives value, it is recorded with a balance change.
   Otherwise, it is included with empty change lists.

The precompiled contracts are not explicitly touched when they are
invoked since Amsterdam fork.
2026-02-24 21:55:10 +08:00
rjl493456442
199ac16e07
core/types/bal: change code change type to list (#33774)
To align with the latest spec of EIP-7928:

```
# CodeChange: [block_access_index, new_code]
CodeChange = [BlockAccessIndex, Bytecode]
```
2026-02-24 21:53:20 +08:00
IONode Online
01083736c8
core/txpool/blobpool: remove unused adds slice in Add() (#33887) 2026-02-24 20:24:16 +08:00
Csaba Kiraly
59ad40e562
eth: check for tx on chain as well (#33607)
The fetcher should not fetch transactions that are already on chain.
Until now we were only checking in the txpool, but that does not have
the old transaction. This was leading to extra fetches of transactions
that were announced by a peer but are already on chain.

Here we extend the check to the chain as well.
2026-02-24 11:21:03 +01:00
CPerezz
c2e1785a48
eth/protocols/snap: restore peers to idle pool on request revert (#33790)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
All five `revert*Request` functions (account, bytecode, storage,
trienode heal, bytecode heal) remove the request from the tracked set
but never restore the peer to its corresponding idle pool. When a
request times out and no response arrives, the peer is permanently lost
from the idle pool, preventing new work from being assigned to it.

In normal operation mode (snap-sync full state) this bug is masked by
pivot movement (which resets idle pools via new Sync() cycles every ~15
minutes) and peer churn (reconnections re-add peers via Register()).
However in scenarios like the one I have running my (partial-stateful
node)[https://github.com/ethereum/go-ethereum/pull/33764] with
long-running sync cycles and few peers, all peers can eventually leak
out of the idle pools, stalling sync entirely.

Fix: after deleting from the request map, restore the peer to its idle
pool if it is still registered (guards against the peer-drop path where
Unregister already removed the peer). This mirrors the pattern used in
all five On* response handlers.


This only seems to manifest in peer-thirstly scenarios as where I find
myself when testing snapsync for the partial-statefull node).
Still, thought was at least good to raise this point. Unsure if required
to discuss or not
2026-02-24 09:14:11 +08:00
Nakanishi Hiro
82fad31540
internal/ethapi: add eth_getStorageValues method (#32591)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Implements the new eth_getStorageValues method. It returns storage
values for a list of contracts.

Spec: https://github.com/ethereum/execution-apis/pull/756

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2026-02-23 20:47:30 +01:00
vickkkkkyy
1625064c68
internal/ethapi: include AuthorizationList in gas estimation (#33849)
Fixes an issue where AuthorizationList wasn't copied over when
estimating gas for a user-provided transaction.
2026-02-23 18:07:26 +01:00
Marius van der Wijden
1d1a094d51
beacon/blsync: ignore beacon syncer reorging errors (#33628)
Downgrades beacon syncer reorging from Error to Debug
closes https://github.com/ethereum/go-ethereum/issues/29916
2026-02-23 16:02:23 +01:00
Marius van der Wijden
e40aa46e88
eth/catalyst: implement testing_buildBlockV1 (#33656)
implements
https://github.com/ethereum/execution-apis/pull/710/changes#r2712256529

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2026-02-23 15:56:31 +01:00
Csaba Kiraly
d3dd48e59d
metrics: allow changing influxdb interval (#33767)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The PR exposes the InfuxDB reporting interval as a CLI parameter, which
was previously fixed 10s. Default is still kept at 10s.
Note that decreasing the interval comes with notable extra traffic and
load on InfluxDB.
2026-02-23 14:27:25 +01:00
Felix Lange
00cbd2e6f4
p2p/discover/v5wire: use Whoareyou.ChallengeData instead of storing encoded packet (#31547)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This changes the challenge resend logic again to use the existing
`ChallengeData` field of `v5wire.Whoareyou` instead of storing a second
copy of the packet in `Whoareyou.Encoded`. It's more correct this way
since `ChallengeData` is supposed to be the data that is used by the ID
verification procedure.

Also adapts the cross-client test to verify this behavior.

Follow-up to #31543
2026-02-22 21:58:47 +01:00
Felix Lange
453d0f9299
build: upgrade to golangci-lint v2.10.1 (#33875)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-02-21 20:53:02 +01:00
Felix Lange
6d865ccd30
build: upgrade -dlgo version to 1.25.7 (#33874) 2026-02-21 20:52:43 +01:00
rjl493456442
54f72c796f
core/rawdb: revert "check pruning tail in HasBody and HasReceipts" (#33865)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Reverts ethereum/go-ethereum#33747.

This change suffers an unexpected issue during the sync with
`history.chain=postmerge`.
2026-02-19 11:43:44 +01:00
Sina M
2a62df3815
.github: fix actions 32bit test (#33866)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-02-18 18:28:53 +01:00
rjl493456442
01fe1d716c
core/vm: disable the value transfer in syscall (#33741)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
In src/ethereum/forks/amsterdam/vm/interpreter.py:299-304, the caller
address is
only tracked for block level accessList when there's a value transfer:

```python
if message.should_transfer_value and message.value != 0:  
    # Track value transfer  
    sender_balance = get_account(state, message.caller).balance  
    recipient_balance = get_account(state, message.current_target).balance  

    track_address(message.state_changes, message.caller)  # Line 304
```

Since system transactions have should_transfer_value=False and value=0, 
this condition is never met, so the caller (SYSTEM_ADDRESS) is not
tracked.

This condition is applied for the syscall in the geth implementation,
aligning with the spec of EIP7928.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2026-02-18 08:40:23 +08:00
spencer
3eed0580d4
cmd/evm: add --opcode.count flag to t8n (#33800)
Adds `--opcode.count=<file>` flag to `evm t8n` that writes per-opcode
execution frequency counts to a JSON file (relative to
`--output.basedir`).

---------

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2026-02-17 20:42:53 +01:00
Felix Lange
1054276906 version: begin v1.17.1 release cycle
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-02-17 17:17:00 +01:00
Felix Lange
0cf3d3ba4f version: release go-ethereum v1.17.0 stable 2026-02-17 17:09:41 +01:00
Felix Lange
9b78f45e33 crypto/secp256k1: fix coordinate check 2026-02-17 17:09:18 +01:00
Jonny Rhea
c709c19b40
eth/catalyst: add initial OpenTelemetry tracing for newPayload (#33521)
This PR adds initial OpenTelemetry tracing to the Engine API, focusing
on engine_newPayload*.

```
jsonrpc.engine/newPayloadV4 
|  |- engine.newPayload  [block.number, block.hash, tx.count]
|     |- core.blockchain.InsertBlockWithoutSetHead
|        |- bc.processor.Process
|        |  |- core.ApplyTransactionWithEVM  [tx.hash, tx.index]
|        |  |- core.ApplyTransactionWithEVM  [tx.hash, tx.index]
|        |  |- ...  (one per transaction)
|        |  |- core.postExecution
|        |- bc.validator.ValidateState
```

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2026-02-17 17:08:57 +01:00
Sina M
550ca91b17
consensus/misc: hardening header verification (#33860)
Defensively check parent's base fee before using it for calculations.
2026-02-17 15:42:48 +01:00
Jonny Rhea
a4b3898f90
internal/telemetry: don't create internal spans without parents (#33780)
This prevents orphaned spans from appearing in traces.
2026-02-17 14:12:42 +01:00
Felix Lange
0cba803fba
eth/protocols/eth, eth/protocols/snap: delayed p2p message decoding (#33835)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
This changes the p2p protocol handlers to delay message decoding. It's
the first part of a larger change that will delay decoding all the way
through message processing. For responses, we delay the decoding until
it is confirmed that the response matches an active request and does not
exceed its limits.

In order to make this work, all messages have been changed to use
rlp.RawList instead of a slice of the decoded item type. For block
bodies specifically, the decoding has been delayed all the way until
after verification of the response hash.

The role of p2p/tracker.Tracker changes significantly in this PR. The
Tracker's original purpose was to maintain metrics about requests and
responses in the peer-to-peer protocols. Each protocol maintained a
single global Tracker instance. As of this change, the Tracker is now
always active (regardless of metrics collection), and there is a
separate instance of it for each peer. Whenever a response arrives, it
is first verified that a request exists for it in the tracker. The
tracker is also the place where limits are kept.
2026-02-15 21:21:16 +08:00
Felix Lange
ad88b68a46
internal/download: show progress bar only if server gives length (#33842)
Some checks failed
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Fixes this:
https://ci.appveyor.com/project/ethereum/go-ethereum/builds/53538177/job/ptosr48pvvwkjskb#L43
2026-02-14 00:00:03 -07:00
Jonny Rhea
c50e5edfaf
cmd/geth, internal/telemetry: wire OpenTelemetry tracing via CLI flags (#33484)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR adds OpenTelemetry tracing configuration to geth via
command-line flags. When enabled, geth initializes the global
OpenTelemetry TracerProvider and installs standard trace context
propagation. When disabled (the default), tracing remains a no-op and
behavior is unchanged.

Co-authored-by: Felix Lange <fjl@twurst.com>
2026-02-14 01:02:10 +01:00
Jonny Rhea
d8b92cb9e6
rpc,internal/telemetry: fix deferred spanEnd to capture errors via pointer (#33772)
The endSpan closure accepted error by value, meaning deferred calls like
defer spanEnd(err) captured the error at defer-time (always nil), not at
function-return time. This meant errors were never recorded on spans.

- Changed endSpan to accept *error
- Updated all call sites in rpc/handler.go to pass error pointers, and
adjusted handleCall to avoid propagating child-span errors to the parent
- Added TestTracingHTTPErrorRecording to verify that errors from RPC
methods are properly recorded on the rpc.runMethod span
2026-02-14 01:00:14 +01:00
Felix Lange
ac85a6f254
rlp: add back Iterator.Count, with fixes (#33841)
I removed `Iterator.Count` in #33840, because it appeared to be unused
and did not provide the documented invariant: the returned count should
always be an upper bound on the number of iterations allowed by `Next`.

In order to make `Count` work, the semantics of `CountValues` has to
change to return the number of items up and including the invalid one. I
have reviewed all callsites of `CountValues` to assess if changing this
is safe. There aren't that many, and the only call that doesn't check
the error and return is in the trie node parser,
`trie.decodeNodeUnsafe`. There, we distinguish the node type based on
the number of items, and it previously returned an error for item count
zero. In order to avoid any potential issue that could result from this
change, I'm adding an error check in that function, though it isn't
necessary.
2026-02-13 23:53:42 +01:00
Felix Lange
4f38a76438
rlp: validate and cache element count in RawList (#33840)
This changes `RawList` to ensure the count of items is always valid.
Lists with invalid structure, i.e. ones where an element exceeds the
size of the container, are now detected during decoding of the `RawList`
and thus cannot exist.

Also remove `RawList.Empty` since it is now fully redundant, and
`Iterator.Count` since it returns incorrect results in the presence of
invalid input. There are no callers of these methods (yet).
2026-02-13 21:52:47 +01:00
Felix Lange
ece2b19ac0
rlp: add AppendRaw method to RawList (#33834)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This is helpful when building a list from already-encoded elements.
2026-02-13 20:09:19 +08:00
Sina M
f2869793df
node: http2 for JSON-RPC API (#33812)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The reasoning for using the cleartext format here is that the JSON-RPC
API is internal only. Providers which expose it publicly already put it
behind a proxy which handles also the encryption.
2026-02-12 10:33:12 +01:00
Sina M
9426444825
internal/era: update eraE type IDs to match spec (#33827)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Update to match the spec:
https://github.com/eth-clients/e2store-format-specs/pull/16

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-02-11 14:03:08 -07:00
Sina M
995fa79bf5
eth/tracers: tests for bad block tracing (#33821)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Fixes #30833
2026-02-11 16:25:42 +01:00
sashass1315
919b238c82
triedb/pathdb: return nodeLoc by value to avoid heap allocation (#33819) 2026-02-11 22:14:43 +08:00
Felix Lange
3011d83e6f
cmd/evm/internal/t8ntool, core/rawdb: fix RLP iterator error handling (#33820)
This fixes two cases where `Iterator.Err()` was misused. The method will
only return an error after `Next()` has returned false, so it makes no
sense to check for the error within the loop itself.
2026-02-11 14:50:39 +01:00
Felix Lange
341907cdb8
rlp: return Iterator as non-pointer (#33818)
Most uses of the iterator are like this:

    it, _ := rlp.NewListIterator(data)
    for it.Next() {
        do(it.Value())
    }

This doesn't require the iterator to be a pointer and it's better to
have it stack-allocated. AFAIK the compiler cannot prove it is OK to
stack-allocate when it is returned as a pointer because the methods of
`Iterator` use pointer receiver and also mutate the object.

The iterator type was not exported until very recently, so I think it is
still OK to change this API.
2026-02-11 14:50:24 +01:00
phrwlk
30656d714e
trie/bintrie: use correct key mapping in GetStorage and DeleteStorage (#33807)
GetStorage and DeleteStorage used GetBinaryTreeKey to compute the tree
key, while UpdateStorage used GetBinaryTreeKeyStorageSlot. The latter
applies storage slot remapping (header offset for slots <64, main
storage prefix for the rest), so reads and deletes were targeting
different tree locations than writes.

Replace GetBinaryTreeKey with GetBinaryTreeKeyStorageSlot in both
GetStorage and DeleteStorage to match UpdateStorage. Add a regression
test that verifies the write→read→delete→read round-trip for main
storage slots.
2026-02-11 11:42:17 +01:00
Ragnar
15a9e92bbd
ethclient/gethclient: callTracer methods (#31510)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Added methods `TraceCallWithCallTracer` and `TraceTransactionWithCallTracer`.

Fixes #28182

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2026-02-10 17:54:37 +01:00
sashass1315
4d4883731e
trie: fix embedded node size validation (#33803)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The `decodeRef` function used `size > hashLen` to reject oversized
embedded nodes, but this incorrectly allowed nodes of exactly 32 bytes
through. The encoding side (hasher.go, stacktrie.go) consistently uses
`len(enc) < 32` to decide whether to embed a node inline, meaning nodes
of 32+ bytes are always hash-referenced. The error message itself
already stated `want size < 32`, confirming the intended threshold.
Changed `size > hashLen` to `size >= hashLen` in `decodeRef` to align
the decoding validation with the encoding logic, the Yellow Paper spec,
and the surrounding comments.
2026-02-10 22:05:39 +08:00
vickkkkkyy
e2d21d0e9c
ethdb/pebble: fix CompactionDebtConcurrency comment (#33805) 2026-02-10 21:48:23 +08:00
Felföldi Zsolt
986d115da7
eth: fix targetView==nil case (#33810)
This PR fixes a panic in a corner case situation when a `ChainEvent` is
received by `eth.Ethereum.updateFilterMapsHeads()` but the given chain
section does not exist in `BlockChain` any more. This can happen during
chain rewind because chain events are processed asynchronously. Ignoring
the event in this case is ok, the final event will point to the final
rewound head and the indexer will be updated.
Note that similar issues will not happen once we transition to
https://github.com/ethereum/go-ethereum/pull/32292 and the new indexer
built on top of this. Until then, the current fix should be fine.
2026-02-10 14:15:18 +01:00
Jonny Rhea
bbb1ab8d16
core/vm: 8024 tests should enforce explicit errors (#33787)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR makes `TestEIP8024_Execution` verify explicit error types (e.g.,
`ErrStackUnderflow` vs `ErrInvalidOpCode`) rather than accepting any
error. It also fails fast on unexpected opcodes in the mini-interpreter
to avoid false positives from missing opcode handling.
2026-02-10 10:11:26 +08:00
Galoretka
7faa676b03
core/rawdb: close directory fd on Readdirnames error in cleanup (#33798) 2026-02-10 10:10:56 +08:00
vickkkkkyy
32a35bfcd3
cmd/geth: fix wrong flag names in influxdb metrics error messages (#33804) 2026-02-10 10:01:01 +08:00
shazam8253
c9b7ae422c
internal/era: New EraE implementation (#32157)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Here is a draft for the New EraE implementation. The code follows along
with the spec listed at https://hackmd.io/pIZlxnitSciV5wUgW6W20w.

---------

Co-authored-by: shantichanal <158101918+shantichanal@users.noreply.github.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2026-02-09 08:30:19 -07:00
vickkkkkyy
c12959dc8c
core/rawdb: fix incorrect tail value in unindexTransactions log output (#33796)
Some checks are pending
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-02-09 15:49:53 +08:00
sashass1315
bc0db302ed
core/vm: add missing PUSH0 handler in EIP-8024 test mini-interpreter (#33785) 2026-02-09 15:39:55 +08:00
GarmashAlex
777265620d
core/rawdb: close freezer table in InspectFreezerTable (#33776)
Some checks failed
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
2026-02-06 22:13:37 +08:00
Marius van der Wijden
ad459f4fac
metrics: reduce allocations for metrics (#33699)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-02-06 20:26:31 +08:00
Forostovec
e64c8d8e26
core/rawdb: check pruning tail in HasBody and HasReceipts (#33747)
### Problem

`HasBody` and `HasReceipts` returned `true` for pruned blocks because
they only checked `isCanon()` which verifies the hash table — but
hash/header tables have `prunable: false` while body/receipt tables have
`prunable: true`.

After `TruncateTail()`, hashes still exist but bodies/receipts are gone.
This caused inconsistency: `HasBody()` returns `true`, but `ReadBody()`
returns `nil`.

### Changes

Both functions now check `db.Tail()` when the block is in ancient store.
If `number < tail`, the data has been pruned and the function correctly
returns `false`.

This aligns `HasBody`/`HasReceipts` behavior with
`ReadBody`/`ReadReceipts` and fixes potential issues in
`skeleton.linked()` which relies on these checks during sync.
2026-02-06 20:10:30 +08:00
vickkkkkyy
9967fb7c5c
metrics: add missing ResettingTimer case in GetAll() (#33749)
Follow-up to https://github.com/ethereum/go-ethereum/pull/33748

Same issue - ResettingTimer can be registered via loadOrRegister() but
GetAll() silently drops it during JSON export. The prometheus exporter
handles it fine (collector.go:70), so this is just an oversight in the
JSON path.

Note: ResettingTimer.Snapshot() resets the timer by design, which is
consistent with how the prometheus exporter uses it.
2026-02-06 20:07:55 +08:00
Csaba Kiraly
aa457eda4b
core/txpool/blobpool: reset counters and gapped on Clear (#33775)
Clear was only used in tests, but it was missing some of the cleanup.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2026-02-06 19:48:09 +08:00
Sina M
14c2408957
internal/ethapi: fix error code for revert in eth_simulateV1 (#33007)
The error code for revert should be consistent with eth_call and be 3.
2026-02-06 07:57:41 +01:00
Felix Lange
7b7be249cb
rlp: add RawList for working with un-decoded lists (#33755)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
This adds a new type wrapper that decodes as a list, but does not
actually decode the contents of the list. The type parameter exists as a
marker, and enables decoding the elements lazily. RawList can also be
used for building a list incrementally.
2026-02-04 20:16:24 +01:00
vickkkkkyy
6b82cef68f
metrics: add missing GaugeInfo case in GetAll() (#33748)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
GetAll did not return GaugeInfo metrics, which affects "chain/info" and "geth/info".
2026-02-04 13:19:50 +01:00
Marius van der Wijden
bba41f8072
core/txpool/legacypool: reduce unnecessary allocations during add (#33701)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Not many allocs we save here, but it also cleans up the logic and should
speed up the process a tiny bit
2026-02-04 04:50:19 +01:00
Felix Lange
8e1de223ad
crypto/keccak: vendor in golang.org/x/crypto/sha3 (#33323)
The upstream libray has removed the assembly-based implementation of
keccak. We need to maintain our own library to avoid a peformance
regression.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-02-03 14:55:27 -07:00
Lessa
54a91b3ad8
core/types, internal/ethapi, signer/core/apitypes: avoid copying 128KB blobs in range loops (#33717)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
kzg4844.Blob is 131072 bytes. Using `for _, blob := range` copies the
entire blob on each iteration. With up to 6 blobs per transaction, this
wastes ~768KB of memory copies.

Switch to index-based iteration and pass pointers directly.
2026-02-03 21:36:59 +08:00
mmsqe
b9288765a3
accounts/usbwallet: add support for Ledger Nano Gen5 (#33297)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
adds support for the 0x0008 / 0x8000 product ID (Ledger Apex | Nano
Gen5).
2026-02-03 13:11:47 +01:00
Guillaume Ballet
19f37003fb
trie/bintrie: fix debug_executionWitness for binary tree (#33739)
The `Witness` method was not implemented for the binary tree, which
caused `debug_excutionWitness` to panic. This PR fixes that.

Note that the `TransitionTrie` version isn't implemented, and that's on
purpose: more thought must be given to what should go in the global
witness.
2026-02-03 12:19:40 +01:00
Marius van der Wijden
16a6531ac2
core: miner: reduce allocations in block building (#33375)
I recently went on a longer flight and started profiling the geth block
production pipeline.
This PR contains a bunch of individual fixes split into separate
commits.
I can drop some if necessary.


Benchmarking is not super easy, the benchmark I wrote is a bit
non-deterministic.
I will try to write a better benchmark later
```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/miner
cpu: Intel(R) Core(TM) Ultra 7 155U
                │ /tmp/old.txt │          /tmp/new.txt          │
                │    sec/op    │   sec/op     vs base           │
BuildPayload-14    141.5µ ± 3%   146.0µ ± 6%  ~ (p=0.346 n=200)

                │ /tmp/old.txt │             /tmp/new.txt             │
                │     B/op     │     B/op      vs base                │
BuildPayload-14   188.2Ki ± 4%   177.4Ki ± 4%  -5.71% (p=0.018 n=200)

                │ /tmp/old.txt │            /tmp/new.txt             │
                │  allocs/op   │  allocs/op   vs base                │
BuildPayload-14    2.703k ± 4%   2.453k ± 5%  -9.25% (p=0.000 n=200)
```
2026-02-03 08:19:16 +01:00
shhhh
6530945dcd
internal/ethapi: Add timestamp to eth_getTransactionByHash (#33709)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Implements https://github.com/ethereum/execution-apis/issues/729 and
fixes #33491. It adds blockTimestamp to transaction objects returned
by the RPC.
2026-02-02 12:20:16 +01:00
0xFloki
a951aacb70
triedb/pathdb: preallocate slices in encode methods (#33736)
Preallocates slices with known capacity in `stateSet.encode()` and
`StateSetWithOrigin.encode()` methods to eliminate redundant
reallocations during serialization.
2026-02-02 15:27:37 +08:00
Marius van der Wijden
a5e6a157e5
signer/core/apitypes: add cell proofs (#32910)
Adds support for cell proofs in blob transactions in the signer

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2026-02-02 15:19:13 +08:00
alex017
cb97c48cb6
triedb/pathdb: preallocate slices in decodeRestartTrailer (#33715)
Some checks failed
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Preallocate capacity for `keyOffsets` and `valOffsets` slices in
`decodeRestartTrailer` since the exact size (`nRestarts`) is known
upfront.

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2026-01-30 21:14:15 +08:00
milan-cb
845009f684
ethclient: fix timeout param for eth_sendRawTransactionSync (#33693)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Fix timeout parameter in eth_sendRawTransactionSync
to be an integer instead of hex. The spec has now been
clarified on this point.
2026-01-29 21:41:18 +01:00
Noisy
a179ccf6f0
core/state: add bounds check in heap eviction loop (#33712)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
core/state: add bounds check in heap eviction loop

Add len(h) > 0 check before accessing h[0] to prevent potential panic
and align with existing heap access patterns in txpool, p2p, and mclock
packages.
2026-01-29 21:08:04 +08:00
fengjian
c974722dc0
crypto/ecies: fix ECIES invalid-curve handling (#33669)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
Fix ECIES invalid-curve handling in RLPx handshake (reject invalid
ephemeral pubkeys early)
- Add curve validation in crypto/ecies.GenerateShared to reject invalid
public keys before ECDH.
- Update RLPx PoC test to assert invalid curve points fail with
ErrInvalidPublicKey.
 
Motivation / Context
RLPx handshake uses ECIES decryption on unauthenticated network input.
Prior to this change, an invalid-curve ephemeral public key would
proceed into ECDH and only fail at MAC verification, returning
ErrInvalidMessage. This allows an oracle on decrypt success/failure and
leaves the code path vulnerable to invalid-curve/small-subgroup attacks.
The fix enforces IsOnCurve validation up front.
2026-01-29 10:56:12 +01:00
Csaba Kiraly
9a6905318a
core/txpool/legacypool: clarify and fix non-executable tx heartbeat (#33704)
Heartbeats are used to drop non-executable transactions from the queue.
The timeout mechanism was not clearly documented, and it was updates
also when not necessary.
2026-01-29 10:53:55 +01:00
rjl493456442
628ff79be3
ethdb/pebble: disable seek compaction for Pebble (#33697)
This PR restores the previous Pebble configuration, disabling seek compaction.

This feature is still needed by hash mode archive node, mitigating the
overhead of frequent compaction.
2026-01-29 10:48:34 +01:00
rjl493456442
7046e63244
trie: fix flaky test (#33711) 2026-01-29 17:22:15 +08:00
Lessa
2513feddf8
crypto/kzg4844: preallocate proof slice in ComputeCellProofs (#33703)
Preallocate the proof slice with the known size instead of growing it
via append in a loop. The length is already known from the source slice.
2026-01-29 15:49:10 +08:00
Marius van der Wijden
424bc22ab8
eth/gasprice: reduce allocations (#33698)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Recent pprof from our validator shows ~6% of all allocations because of
the gas price oracle. This PR reduces that.
2026-01-28 20:33:04 +01:00
CPerezz
1e9dfd5bb0
core: standardize slow block JSON output for cross-client metrics (#33655)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
Implement standardized JSON format for slow block logging to enable
cross-client performance analysis and protocol research.

This change is part of the Cross-Client Execution Metrics initiative
proposed by Gary Rong: https://hackmd.io/dg7rizTyTXuCf2LSa2LsyQ

The standardized metrics enabled data-driven analysis like the EIP-7907
research: https://ethresear.ch/t/data-driven-analysis-on-eip-7907/23850

JSON format includes:
- block: number, hash, gas_used, tx_count
- timing: execution_ms, total_ms
- throughput: mgas_per_sec
- state_reads: accounts, storage_slots, bytecodes, code_bytes
- state_writes: accounts, storage_slots, bytecodes
- cache: account/storage/code hits, misses, hit_rate


This should come after merging #33522

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2026-01-28 20:58:41 +08:00
Marius van der Wijden
0a8fd6841c
eth/tracers/native: add index to callTracer log (#33629)
closes https://github.com/ethereum/go-ethereum/issues/33566
2026-01-28 13:32:27 +01:00
Ng Wei Han
3d05284928
trie/bintrie: fix tree key hashing to match spec (#33694)
Based on [EIP-7864](https://eips.ethereum.org/EIPS/eip-7864), the tree
index should be 32 bytes instead of 31 bytes.
```
def get_tree_key(address: Address32, tree_index: int, sub_index: int):
    # Assumes STEM_SUBTREE_WIDTH = 256
    return tree_hash(address + tree_index.to_bytes(32, "little"))[:31] + bytes(
        [sub_index]
    )
```
2026-01-28 11:51:02 +01:00
Lessa
344d01e2be
core/rawdb: preallocate slice in iterateTransactions (#33690)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Preallocate hashes slice with known length instead of using append in a
loop. This avoids multiple reallocations during transaction indexing.
2026-01-28 09:51:15 +08:00
Guillaume Ballet
56be36f672
cmd/keeper: export getInput in wasm builds (#33686)
This is a tweak to the wasm build, that expects the `geth_io` namespace
to expect a `geth_io` module, providing a `len` and `read` methods. This
will be provided by the WASM interface in sp1. This forces an API change
on the OpenVM side, but the interface on their side is still being
designed, so we should proceed with this change, and we'll make a
different tag for OpenVM if this can't work for them.

Co-authored-by: wakabat <wakabat@protonmail.com>
2026-01-28 09:50:15 +08:00
rjl493456442
181a3ae9e0
triedb/pathdb: improve trienode reader for searching (#33681)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
This PR optimizes the historical trie node reader by reworking how data
is accessed and memory is managed, reducing allocation overhead 
significantly.

Specifically:

- Instead of decoding an entire history object to locate a specific trie node, 
   the reader now searches directly within the history.

- Besides, slice pre-allocation can avoid unnecessary deep-copy significantly.
2026-01-27 20:05:35 +08:00
marukai67
e250836973
trie: preallocate slice capacity (#33689)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR optimizes memory allocation in StateTrie.PrefetchAccount() and
StateTrie.PrefetchStorage() by preallocating slice capacity when the
final size is known.
2026-01-27 12:04:12 +08:00
rjl493456442
c2595381bf
core: extend the code reader statistics (#33659)
Some checks are pending
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
This PR extends the statistics of contract code read by adding these
fields:

- **CacheHitBytes**: the total number of bytes served by cache
- **CacheMissBytes**: the total number of bytes read on cache miss
- **CodeReadBytes**: the total number of bytes for contract code read
2026-01-26 11:25:53 +01:00
Csaba Kiraly
9a8e14e77e
core/txpool/legacypool: fix stale counter (#33653)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Calling `pool.priced.Removed` is needed to keep is sync with
`pool.all.Remove`.
It was called in other occurances, but not here.

The counter is used for internal heap management. It was working even without this, just not calling reheap at the intended frequency.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2026-01-23 13:35:14 +01:00
Jonny Rhea
251b863107
core/vm: update EIP-8024 - Missing immediate byte is now treated as 0x00 (#33614)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR updates the EIP-8024 implementation to match the latest spec
clarification.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-01-22 12:16:02 -07:00
rjl493456442
1022c7637d
core, eth, internal, triedb/pathdb: enable eth_getProofs for history (#32727)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR enables the `eth_getProofs ` endpoint against the historical states.
2026-01-22 09:19:27 +08:00
Csaba Kiraly
35922bcd33
core/txpool/legacypool: reset gauges on clear (#33654)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2026-01-21 16:00:57 +08:00
DeFi Junkie
8fad02ac63
core/types: fix panic on invalid signature length (#33647)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Replace panic with error return in decodeSignature to prevent crashes on
invalid inputs, and update callers to propagate the error.
2026-01-21 06:57:02 +01:00
Csaba Kiraly
54ab4e3c7d
core/txpool/legacypool: add metric for accounts in txpool (#33646)
This PR adds metrics that count the number of accounts having transactions 
in the txpool. Together with the transaction count this can be used as a 
simple indicator of the diversity of transactions in the pool.

Note: as an alternative implementation, we could use a periodic or event
driven update of these Gauges using len.

I've preferred this implementation to match what we have for the pool
sizes.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2026-01-21 09:23:03 +08:00
forkfury
2eb1ccc6c4
core/state: ensure deterministic hook emission order in Finalise (#33644)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Fixes #33630

Sort self-destructed addresses before emitting hooks in Finalise() to
ensure deterministic ordering and fix flaky test
TestHooks_OnCodeChangeV2.

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
2026-01-20 20:36:07 +08:00
DeFi Junkie
46d804776b
accounts/scwallet: fix panic in decryptAPDU (#33606)
Validate ciphertext length in decryptAPDU, preventing runtime panics on
invalid input.
2026-01-20 12:04:23 +01:00
Felix Lange
d58f6291a2
internal/debug: add integration with Grafana Pyroscope (#33623)
This adds support for Grafana Pyroscope, a continuous profiling solution. 
The client is configured similarly to metrics, i.e. run 

     geth --pyroscope --pyroscope.server=https://...

This commit is a resubmit of #33261 with some changes.

---------

Co-authored-by: Carlos Bermudez Porto <cbermudez.dev@gmail.com>
2026-01-20 10:33:09 +01:00
cui
d0af257aa2
triedb/pathdb: double check the list availability before regeneration (#33622)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2026-01-19 20:45:31 +08:00
rjl493456442
500931bc82
core/vm: add read only protection for opcodes (#33637)
This PR reverts a part of changes brought by https://github.com/ethereum/go-ethereum/pull/33281/changes

Specifically, read-only protection should always be enforced at the opcode level, 
regardless of whether the check has already been performed during gas metering.

It should act as a gatekeeper, otherwise, it is easy to introduce errors by adding
new gas measurement logic without consistently applying the read-only protection.
2026-01-19 20:43:14 +08:00
maskpp
ef815c59a2
rlp: improve SplitListValues allocation efficiency (#33554)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-01-18 16:07:28 +08:00
lightclient
e78be59dc9
build: remove circleci config (#33616)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This doesn't seem to be used anymore.
2026-01-17 16:22:00 +01:00
Lessa
0495350388
accounts/abi/bind/v2: replace rng in test (#33612)
Replace deprecated rand.Seed() with rand.New(rand.NewSource()) in
dep_tree_test.go.
2026-01-17 16:20:19 +01:00
Mael Regnery
3d78da9171
rpc: add a rpc.rangelimit flag (#33163)
Adding an RPC flag to limit the block range size for eth_getLogs and
eth_newFilter requests.

closing https://github.com/ethereum/go-ethereum/issues/24508

---------

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2026-01-17 14:34:08 +01:00
rjl493456442
add1890a57
triedb/pathdb: enable trienode history (#32621)
It's the part-4 for trienode history. The trienode history persistence
has been enabled with this PR by flag `history.trienode <non-negative-number>`
2026-01-17 21:23:48 +08:00
rjl493456442
588dd94aad
triedb/pathdb: implement trienode history indexing scheme (#33551)
This PR implements the indexing scheme for trie node history. Check
https://github.com/ethereum/go-ethereum/pull/33399 for more details
2026-01-17 20:28:37 +08:00
jwasinger
715bf8e81e
core: invoke selfdestruct tracer hooks during finalisation (#32919)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The core part of this PR that we need to adopt is to move the code and
nonce change hook invocations to occur at tx finalization, instead of
when the selfdestruct opcode is called.

Additionally:
* remove `SelfDestruct6780` now that it is essentially the same as
`SelfDestruct` just gated by `is new contract`
* don't duplicate `BalanceIncreaseSelfdestruct` (transfer to recipient
of selfdestruct) in the hooked statedb and in the opcode handler for the
selfdestruct opcode.
* balance is burned immediately when the beneficiary of the selfdestruct
is the sender, and the contract was created in the same transaction.
Previously we emit two balance increases to the recipient (see above
point), and a balance decrease from the sender.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
2026-01-16 15:10:08 -07:00
jwasinger
b6fb79cdf9
core/vm: in selfdestruct gas calculation, return early if there isn't enough gas to cover cold account access costs (#33450)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
There's no need to perform the subsequent state access on the target if
we already know that we are out of gas.

This aligns the state access behavior of selfdestruct with EIP-7928
2026-01-16 07:37:12 -07:00
jwasinger
23c3498836
core/vm: check if read-only in gas handlers (#33281)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR causes execution to terminate at the gas handler in the case of
sstore/call if they are invoked in a static execution context.

This aligns the behavior with EIP 7928 by ensuring that we don't record
any state reads in the access list from an SSTORE/CALL in this
circumstance.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-01-15 15:55:43 -07:00
Csaba Kiraly
9ba13b6097
eth/fetcher: refactor test code (#33610)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Remove a large amount of duplicate code from the tx_fetcher tests.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
2026-01-15 11:37:34 -07:00
rjl493456442
494908a852
triedb/pathdb: change the bitmap to big endian (#33584)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The bitmap is used in compact-encoded trie nodes to indicate which elements 
have been modified. The bitmap format has been updated to use big-endian
encoding. 

Bit positions are numbered from 0 to 15, where position 0 corresponds to
the most significant bit of b[0], and position 15 corresponds to the least
significant bit of b[1].
2026-01-15 17:28:57 +08:00
Jonny Rhea
e3e556b266
rpc: extract OpenTelemetry trace context from request headers (#33599)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR adds support for the extraction of OpenTelemetry trace context
from incoming JSON-RPC request headers, allowing geth spans to be linked
to upstream traces when present.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-01-14 14:03:48 -07:00
Jonny Rhea
a9acb3ff93
rpc, internal/telemetry: add OpenTelemetry tracing for JSON-RPC calls (#33452)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Add Open Telemetry tracing inside the RPC server to help attribute runtime costs within `handler.handleCall()`. In particular, it allows us to distinguish time spent decoding arguments, invoking methods via reflection, and actually executing the method and constructing/encoding JSON responses.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2026-01-14 10:58:30 -07:00
DeFi Junkie
94710f79a2
accounts/keystore: fix panic in decryptPreSaleKey (#33602)
Validate ciphertext length in decryptPreSaleKey, preventing runtime
panics on invalid input.
2026-01-14 11:51:48 +01:00
lightclient
3b17e78274 crypto/ecies: use aes blocksize
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2026-01-13 17:12:23 +01:00
MariusVanDerWijden
5b99d2bba4 core/txpool: drop peers on invalid KZG proofs
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>:
2026-01-13 17:12:08 +01:00
Felix Lange
ea4935430b version: begin v1.17.0 release cycle 2026-01-13 17:07:44 +01:00
Maxim Evtush
5a1990d1d8
rpc: fix limitedBuffer.Write to properly enforce size limit (#33545)
Updated the `avail` calculation to correctly compute remaining capacity:
`buf.limit - len(buf.output)`, ensuring the buffer never exceeds its
configured limit regardless of how many times `Write()` is called.
2026-01-13 20:25:53 +08:00
bigbear
1278b4891d
tests: repair oss-fuzz coverage command (#33304)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The coverage build path was generating go test commands with a bogus
-tags flag that held the coverpkg value, so the run kept failing. I
switched coverbuild to treat the optional argument as an override for
-coverpkg and stopped passing coverpkg from the caller. Now the script
emits a clean go test invocation that should actually succeed.
2026-01-13 09:24:45 +01:00
0xcharry
31d5d82ce5
internal/ethapi: refactor RPC tx formatter (#33582)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-01-12 14:31:45 +08:00
Jonny Rhea
c890637af9
core/rawdb: skip missing block bodies during tx unindexing (#33573)
This PR fixes an issue where the tx indexer would repeatedly try to
“unindex” a block with a missing body, causing a spike in CPU usage.
This change skips these blocks and advances the index tail. The fix was
verified both manually on a local development chain and with a new test.

resolves #33371
2026-01-12 14:25:22 +08:00
Csaba Kiraly
127d1f42bb
core: remove duplicate chainHeadFeed.Send code (#33563)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
The code was simply duplicate, so we can remove some code lines here.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2026-01-09 14:40:40 +01:00
Xuanyu Hu
7cd400612f
tests: check correct revert on invalid tests (#33543)
This PR fixes an issue where `evm statetest` would not verify the
post-state root hash if the test case expected an exception (e.g.
invalid transaction).

The fix involves:
1.  Modifying `tests/state_test_util.go` in the `Run` method.
2. When an expected error occurs (`err != nil`), we now check if
`post.Root` is defined.
3. If defined, we recalculate the intermediate root from the current
state (which is reverted to the pre-transaction snapshot upon error).
4. We use `GetChainConfig` and `IsEIP158` to ensure the correct state
clearing rules are applied when calculating the root, avoiding
regressions on forks that require EIP-158 state clearing.
5. If the calculated root mismatches the expected root, the test now
fails.

This ensures that state tests are strictly verified against their
expected post-state, even for failure scenarios.

Fixes issue #33527

---------

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2026-01-09 12:53:55 +01:00
maradini77
4eb5b66d9e
ethclient: restore BlockReceipts support for BlockNumberOrHash objects (#33242)
- pass `rpc.BlockNumberOrHash` directly to `eth_getBlockReceipts` so
`requireCanonical` and other fields survive
- aligns `BlockReceipts` with other `ethclient` methods and re-enables
canonical-only receipt queries
2026-01-09 11:25:04 +01:00
Csaba Kiraly
b993cb6f38
core/txpool/blobpool: allow gaps in blobpool (#32717)
Allow the blobpool to accept blobs out of nonce order

Previously, we were dropping blobs that arrived out-of-order. However,
since fetch decisions are done on receiver side,
out-of-order delivery can happen, leading to inefficiencies.

This PR:
- adds an in-memory blob tx storage, similar to the queue in the
legacypool
- a limited number of received txs can be added to this per account
- txs waiting in the gapped queue are not processed further and not
propagated further until they are unblocked by adding the previos nonce
to the blobpool

The size of the in-memory storage is currently limited per account,
following a slow-start logic.
An overall size limit, and a TTL is also enforced for DoS protection.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2026-01-09 10:43:15 +01:00
rjl493456442
f51870e40e
rlp, trie, triedb/pathdb: compress trienode history (#32913)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This pull request introduces a mechanism to compress trienode history by
storing only the node diffs between consecutive versions.

- For full nodes, only the modified children are recorded in the history;
- For short nodes, only the modified value is stored;

If the node type has changed, or if the node is newly created or
deleted, the entire node value is stored instead.

To mitigate the overhead of reassembling nodes from diffs during history
reads, checkpoints are introduced by periodically storing full node values.

The current checkpoint interval is set to every 16 mutations, though
this parameter may be made configurable in the future.
2026-01-08 21:58:02 +08:00
Madison carter
52f998d5ec
ethclient: omit nil address/topics from filter args (#33464)
Fixes #33369

This omits "topics" and "addresses" from the filter when they are unspecified.
It is required for interoperability with some server implementations that cannot
handle `null` for these fields.
2026-01-08 11:09:29 +01:00
rjl493456442
d5efd34010
triedb/pathdb: introduce extension to history index structure (#33399)
It's a PR based on #33303 and introduces an approach for trienode
history indexing.

---

In the current archive node design, resolving a historical trie node at
a specific block
involves the following steps:

- Look up the corresponding trie node index and locate the first entry
whose state ID
   is greater than the target state ID.
- Resolve the trie node from the associated trienode history object.

A naive approach would be to store mutation records for every trie node,
similar to
how flat state mutations are recorded. However, the total number of trie
nodes is
extremely large (approximately 2.4 billion), and the vast majority of
them are rarely
modified. Creating an index entry for each individual trie node would be
very wasteful
in both storage and indexing overhead. To address this, we aggregate
multiple trie
nodes into chunks and index mutations at the chunk level instead. 

---

For a storage trie, the trie is vertically partitioned into multiple sub
tries, each spanning
three consecutive levels. The top three levels (1 + 16 + 256 nodes) form
the first chunk,
and every subsequent three-level segment forms another chunk.

```
Original trie structure

Level 0               [ ROOT ]                               1 node
Level 1        [0] [1] [2] ... [f]                          16 nodes
Level 2     [00] [01] ... [0f] [10] ... [ff]               256 nodes
Level 3   [000] [001] ... [00f] [010] ... [fff]           4096 nodes
Level 4   [0000] ... [000f] [0010] ... [001f] ... [ffff] 65536 nodes

Vertical split into chunks (3 levels per chunk)

Level0             [ ROOT ]                     1 chunk
Level3        [000]   ...     [fff]          4096 chunks
Level6   [000000]    ...    [fffffff]    16777216 chunks  
```

Within each chunk, there are 273 nodes in total, regardless of the
chunk's depth in the trie.

```
Level 0           [ 0 ]                         1 node
Level 1        [ 1 ] … [ 16 ]                  16 nodes
Level 2     [ 17 ] … … [ 272 ]                256 nodes
```

Each chunk is uniquely identified by the path prefix of the root node of
its corresponding
sub-trie. Within a chunk, nodes are identified by a numeric index
ranging from 0 to 272.

For example, suppose that at block 100, the nodes with paths `[]`,
`[0]`, `[f]`, `[00]`, and `[ff]`
are modified. The mutation record for chunk 0 is then appended with the
following entry:

`[100 → [0, 1, 16, 17, 272]]`, `272` is the numeric ID of path `[ff]`.

Furthermore, due to the structural properties of the Merkle Patricia
Trie, if a child node
is modified, all of its ancestors along the same path must also be
updated. As a result,
in the above example, recording mutations for nodes `00` and `ff` alone
is sufficient,
as this implicitly indicates that their ancestor nodes `[]`, `[0]` and
`[f]` were also
modified at block 100.

--- 

Query processing is slightly more complicated. Since trie nodes are
indexed at the chunk
level, each individual trie node lookup requires an additional filtering
step to ensure that
a given mutation record actually corresponds to the target trie node.

As mentioned earlier, mutation records store only the numeric
identifiers of leaf nodes,
while ancestor nodes are omitted for storage efficiency. Consequently,
when querying
an ancestor node, additional checks are required to determine whether
the mutation
record implicitly represents a modification to that ancestor.

Moreover, since trie nodes are indexed at the chunk level, some trie
nodes may be
updated frequently, causing their mutation records to dominate the
index. Queries
targeting rarely modified trie nodes would then scan a large amount of
irrelevant
index data, significantly degrading performance.

To address this issue, a bitmap is introduced for each index block and
stored in the
chunk's metadata. Before loading a specific index block, the bitmap is
checked to
determine whether the block contains mutation records relevant to the
target trie node.
If the bitmap indicates that the block does not contain such records,
the block is skipped entirely.
2026-01-08 09:57:35 +01:00
Mask Weller
a32851fac9
graphql: fix GasPrice for blob and setcode transactions (#33542)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Adds BlobTxType and SetCodeTxType to GasPrice switch case, aligning with
`MaxFeePerGas` and `MaxPriorityFeePerGas` handling.

Co-authored-by: m6xwzzz <maskk.weller@gmail.com>
2026-01-08 14:23:48 +08:00
LittleBingoo
64d22fd7f7
internal/flags: update copyright year to 2026 (#33550) 2026-01-08 11:49:13 +08:00
rjl493456442
9623dcbca2
core/state: add cache statistics of contract code reader (#33532) 2026-01-08 11:48:45 +08:00
Ng Wei Han
01b39c96bf
core/state, core/tracing: new state update hook (#33490)
### Description
Add a new `OnStateUpdate` hook which gets invoked after state is
committed.

### Rationale
For our particular use case, we need to obtain the state size metrics at
every single block when fuly syncing from genesis. With the current
state sizer, whenever the node is stopped, the background process must
be freshly initialized. During this re-initialization, it can skip some
blocks while the node continues executing blocks, causing gaps in the
recorded metrics.

Using this state update hook allows us to customize our own data
persistence logic, and we would never skip blocks upon node restart.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2026-01-08 11:07:19 +08:00
cui
957a3602d9
core/vm: avoid escape to heap (#33537)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2026-01-07 10:02:27 +08:00
Csaba Kiraly
710008450f
eth: txs fetch/send log at trace level only (#33541)
This logging was too intensive at debug level, it is better to have it
at trace level only.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2026-01-07 09:52:50 +08:00
rjl493456442
eaaa5b716d
core: re-organize the stats category (#33525)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Check out https://hackmd.io/dg7rizTyTXuCf2LSa2LsyQ for more details
2026-01-06 15:09:15 +08:00
Andrew Davis
a8a4804895
ethstats: report newPayload processing time to stats server (#33395)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Add NewPayloadEvent to track engine API newPayload block processing
times and report them to ethstats. This enables monitoring of block
processing performance.

https://notes.ethereum.org/@savid/block-observability

related: https://github.com/ethereum/go-ethereum/pull/33231

---------

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2026-01-05 17:49:30 +01:00
Mask Weller
de5ea2ffd8
core/rawdb: add trienode freezer support to InspectFreezerTable (#33515)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Adds missing trienode freezer case to InspectFreezerTable, making it
consistent with InspectFreezer which already supports it.

Co-authored-by: m6xwzzz <maskk.weller@gmail.com>
2026-01-04 14:47:28 +08:00
rjl493456442
b635e0632c
eth/fetcher: improve the condition to stall peer in tx fetcher (#32725)
Some checks failed
/ Keeper Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-12-31 19:52:25 +01:00
shhhh
32fea008d8
core/blockchain.go: cleanup finalized block on rewind in setHeadBeyondRoot (#33486)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Fix #33390 

`setHeadBeyondRoot` was failing to invalidate finalized blocks because
it compared against the original head instead of the rewound root. This
fix updates the comparison to use the post-rewind block number,
preventing the node from reporting a finalized block that no longer
exists. Also added relevant test cases for it.
2025-12-31 14:02:44 +08:00
Marco Munizaga
b2843a11d6
eth/catalyst: implement getBlobsV3 (#33404)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This is used by cell-level dissemination (aka partial messages) to give
the CL all blobs the EL knows about and let CL communicate efficiently
about any other missing blobs. In other words, partial responses from
the EL is useful now.

See the related (closed) PR:
https://github.com/ethereum/execution-apis/pull/674 and the new PR:
https://github.com/ethereum/execution-apis/pull/719
2025-12-31 09:48:50 +08:00
Bashmunta
25439aac04
core/state/snapshot: fix storageList memory accounting (#33505) 2025-12-31 09:40:43 +08:00
Rim Dinov
52ae75afcd
cmd/geth: remove deprecated vulnerability check command (#33498)
This PR removes the version-check command and its associated logic as
discussed in issue #31222.

Removed versionCheckCommand from misccmd.go and main.go.

Deleted version_check.go and its corresponding tests.

Cleaned up testdata/vcheck directory (~800 lines of JSON/signatures
removed).

Verified build with make geth
2025-12-30 21:04:38 +01:00
Fibonacci747
d9aaab13d3
beacon/light/sync: clear reqFinalityEpoch on server unregistration (#33483)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
HeadSync kept reqFinalityEpoch entries for servers after receiving
EvUnregistered, while other per-server maps were cleared. This left
stale request.Server keys reachable from HeadSync, which can lead to a
slow memory leak in setups that dynamically register and unregister
servers.

The fix adds deletion of the reqFinalityEpoch entry in the
EvUnregistered handler. This aligns HeadSync with the cleanup pattern
used by other sync modules and keeps the finality request bookkeeping
strictly limited to currently registered servers.
2025-12-30 18:27:11 +01:00
rjl493456442
b3e7d9ee44
triedb/pathdb: optimize history indexing efficiency (#33303)
This pull request optimizes history indexing by splitting a single large
database
 batch into multiple smaller chunks.

Originally, the indexer will resolve a batch of state histories and
commit all
corresponding index entries atomically together with the indexing
marker.

While indexing more state histories in a single batch improves
efficiency, excessively
large batches can cause significant memory issues.

To mitigate this, the pull request splits the mega-batch into several
smaller batches
and flushes them independently during indexing. However, this introduces
a potential
inconsistency that some index entries may be flushed while the indexing
marker is not,
and an unclean shutdown may leave the database in a partially updated
state.
This can corrupt index data.

To address this, head truncation is introduced. After a restart, any
excessive index
entries beyond the expected indexing marker are removed, ensuring the
index remains
consistent after an unclean shutdown.
2025-12-30 16:05:13 +01:00
Guillaume Ballet
b84097d22e
.github/workflows: preventively close PRs that seem AI-generated (#33414)
This is a new step in my crusade against the braindead fad of starting
PR titles with a word that is completely redundant with github labels,
thus wasting prime first-line real-estate for something that isn't
necessary.

I noticed that every single one of these PRs are low-quality AI-slop, so
I think there is a strong case to be made for these PRs to be
auto-closed. A message is added before closing the PR, redirecting to
our contribution guidelines, so I expect quality first-time contributors
to read them and reopen the PR. In the case of spam PRs, the author is
unlikely to revisit a given PR, and so auto-closing might have a
positive impact. That's an experiment worth trying, imo.
2025-12-30 14:43:45 +01:00
Guillaume Ballet
3f641dba87
trie, go.mod: remove all references to go-verkle and go-ipa (#33461)
In order to reduce the amount of code that is embedded into the keeper
binary, I am removing all the verkle code that uses go-verkle and
go-ipa. This will be followed by further PRs that are more like stubs to
replace code when the keeper build is detected.

I'm keeping the binary tree of course. This means that you will still
see `isVerkle` variables all over the codebase, but they will be renamed
when code is touched (i.e. this is not an invitation for 30+ AI slop
PRs).

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-12-30 20:44:04 +08:00
Archkon
57f84866bc
params: fix wrong comment (#33503)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
It seems that the comment for CopyGas was wrongly associated to
SloadGas.
2025-12-29 13:57:29 +01:00
oooLowNeoNooo
b9702ed27b
console/prompt: use PromptInput in PromptConfirm method (#33445)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-12-29 16:23:51 +08:00
rjl493456442
4531bfebec
eth/downloader: fix stale beacon header deletion (#33481)
In this PR, two things have been fixed:

--- 

(a) truncate the stale beacon headers with latest snap block

Originally, b.filled is used as the indicator for deleting stale beacon headers. 
This field is set only after synchronization has been scheduled, under the 
assumption that the skeleton chain is already linked to the local chain.

However, the local chain can be mutated via `debug_setHead`, which may
cause `b.filled` outdated. For instance, `b.filled` refers to the last head snap block 
in the last sync cycle while after `debug_setHead`, the head snap block has been 
rewounded to 1.

As a result, Geth can enter an unintended loop: it repeatedly downloads
the missing beacon headers for the skeleton chain and attempts to schedule the 
actual synchronization, but in the final step, all recently fetched headers are removed 
by `cleanStales` due to the stale `b.filled` value.

This issue is addressed by always using the latest snap block as the indicator, 
without relying on any cached value. However, note that before the skeleton
chain is linked to the local chain, the latest snap block will always be below
skeleton.tail, and this condition should not be treated as an error.

--- 

(b) merge the subchains once the skeleton chain links to local chain

Once the skeleton chain links with local one, it will try to schedule the 
synchronization by fetching the missing blocks and import them then. 
It's possible the last subchain already overwrites the previous subchain and 
results in having two subchains leftover. As a result, an error log will printed
https://github.com/ethereum/go-ethereum/blob/master/eth/downloader/skeleton.go#L1074
2025-12-29 16:13:30 +08:00
Csaba Kiraly
27b3a6087e
core/txpool/blobpool: fix slotter size limit (#33474)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Blobs are stored per transaction in the pool, so we need billy to handle
up to the per-tx limit, not to the per-block limit.

The per-block limit was larger than the per-tx limit, so it not a bug,
we just created and handled a few billy files for no reason.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-12-24 09:44:17 +08:00
Rizky Ikwan
2e5cd21edf
graphql: add nil check in block resolver (#33225)
Some checks failed
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
Add nil checks for header and block in Block resolver methods to prevent
panic when querying non-existent blocks.
2025-12-19 12:29:41 +01:00
rjl493456442
bf141fbfb1
core, eth: add lock protection in snap sync (#33428)
Fixes #33396, #33397, #33398
2025-12-19 09:36:48 +01:00
Jeevan
dd7daace9d
eth/catalyst: return empty response for GetBlobsV2 before Osaka (#33444)
Fix #33420
2025-12-19 14:42:51 +08:00
0xFloki
5dfcffcf3c
tests/fuzzers: remove unused field from kv struct in rangeproof fuzzer (#33447)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Removes the unused `t bool` field from the `kv` struct in the rangeproof fuzzer.
2025-12-19 09:13:00 +08:00
rjl493456442
bd77b77ede
core/txpool/blobpool: remove legacy sidecar conversion (#33352)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR removes the legacy sidecar conversion logic.

After the Osaka fork, the blobpool will accept only blob sidecar version
1.
Any remaining version 0 blob transactions, if they still exist, will no
longer
be eligible for inclusion.

Note that conversion at the RPC layer is still supported, and version 0
blob
transactions will be automatically converted to version 1 there.
2025-12-18 12:33:07 -07:00
rjl493456442
ffe9dc97e5
core: add code read statistics (#33442)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-12-18 17:24:02 +08:00
Jonny Rhea
7aae33eacf
eth/catalyst: fix invalid timestamp log message (#33440)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Fixes a typo in the NewPayload invalid timestamp warning where the
parent timestamp was incorrectly logged as the block timestamp.
2025-12-17 16:24:10 -07:00
rjl493456442
6978ab48aa
cmd/workload, eth/tracers/native: introduce state proof tests (#32247)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
This pull request introduces a new workload command, providing the
features
for `eth_getProof` endpoint test generation and execution.
2025-12-15 08:35:02 +01:00
Ng Wei Han
15f52a2937
core/state: fix code existence not marked correctly (#33415)
When iterating over a map with value types in Go, the loop variable is a
copy. In `markCodeExistence`, assigning to `code.exists` modified only
the local copy, not the actual map entry, causing the existence flag to
always remain false.

This resulted in overcounting contract codes in state size statistics,
as codes that already existed in the database were incorrectly counted
as new.

Fix by changing `codes` from `map[common.Address]contractCode` to
`map[common.Address]*contractCode`, so mutations apply directly to the
struct.
2025-12-15 13:54:26 +08:00
Galoretka
e20b05ec7f
core/overlay: fix incorrect debug log key/value in LoadTransitionState (#32637)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-12-14 21:51:13 +01:00
David Klank
a9eaf2ffd8
crypto/signify: fix fuzz test compilation (#33402)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
The fuzz test file has been broken for a while - it doesn't compile with
the `gofuzz` build tag.

Two issues:
- Line 59: called `SignifySignFile` which doesn't exist (should be
`SignFile`)
- Line 71: used `:=` instead of `=` for already declared `err` variable
2025-12-13 12:09:07 +08:00
Daniel Liu
3a5560fa98
core/state: make test output message readable (#33400) 2025-12-13 11:27:00 +08:00
Rizky Ikwan
16f50285b7
cmd/utils: fix DeveloperFlag handling when set to false (#33379)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
geth --dev=false now correctly respects the false value, instead of
incorrectly enabling UseLightweightKDF.
2025-12-12 13:46:53 +08:00
yyhrnk
472e3a24ac
core/stateless: cap witness depth metrics buckets (#33389)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-12-11 15:42:32 +08:00
Bosul Mun
56d201b0fe
eth/fetcher: add metadata validation in tx announcement (#33378)
This PR fixes the bug reported in #33365.

The impact of the bug is not catastrophic. After a transaction is
ultimately fetched, validation and propagation will be performed based
on the fetched body, and any response with a mismatched type is treated
as a protocol violation. An attacker could only waste the limited
portion of victim’s bandwidth at most.

However, the reasons for submitting this PR are as follows

1. Fetching a transaction announced with an arbitrary type is a weird
behavior.

2. It aligns with efforts such as EIP-8077 and #33119 to make the
fetcher smarter and reduce bandwidth waste.

Regarding the `FilterType` function, it could potentially be implemented
by modifying the Filter function's parameter itself, but I wasn’t sure
whether changing that function is acceptable, so I left it as is.
2025-12-11 12:11:52 +08:00
Delweng
1b702f71d9
triedb/pathdb: use copy instead of append to reduce memory alloc (#33044)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-12-11 09:37:16 +08:00
Bashmunta
b98b255449
core/rawdb: fix size counting in memory freezer (#33344)
Some checks are pending
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-12-10 16:09:24 +08:00
kurahin
13a8798fa3
p2p/tracker: fix head detection in Fulfil to avoid unnecessary timer reschedules (#33370) 2025-12-10 16:09:07 +08:00
SashaMalysehko
1ce71a1895
eth/tracers/native: include SWAP16 in default ignored opcodes (#33381) 2025-12-10 15:13:47 +08:00
Fibonacci747
215ee6ac18
internal/ethapi: select precompiles using the simulated header (#33363)
The simulator computed active precompiles from the base header, which is
incorrect when simulations cross fork boundaries. This change selects
precompiles using the current simulated header so the precompile set
matches the block’s number/time. It brings simulate in line with doCall,
tracing, and mining, and keeps precompile state overrides applied on the
correct epoch set.
2025-12-10 14:56:56 +08:00
jwasinger
c21fe5475f
tests: integrate BlockTest.run into BlockTest.Run (#33383) 2025-12-10 14:26:27 +08:00
Ng Wei Han
9a346873b8
core/state: fix incorrect contract code state metrics (#33376)
## Description
This PR fixes incorrect contract code state metrics by ensuring
duplicate codes are not counted towards the reported results.

## Rationale
The contract code metrics don't consider database deduplication. The
current implementation assumes that the results are only **slightly
inaccurate**, but this is not true, especially for data collection
efforts that started from the genesis block.
2025-12-10 11:33:59 +08:00
wit liu
e58c785424
build: fix check_generate not printing changed files (#33299)
Some checks failed
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Fixes an issue where HashFolder skipped the root directory upon hitting
the first file in the excludes list. This happened because the walk function
returned SkipDir even for regular files.
2025-12-08 22:58:26 +01:00
rjl493456442
228933a660
eth/downloader: keep current syncmode in downloader only (#33157)
This moves the tracking of the current syncmode into the downloader, fixing an
issue where the syncmode being requested through the engine API could go
out-of-sync with the actual mode being performed by downloader.

Fixes #32629

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-12-08 22:49:57 +01:00
Francisco Giordano
66134b35df
core/vm: fix PC increment for EIP-8024 opcodes (#33361)
The EIP says to increment PC by 2 _instead of_ the standard increment by
1. The opcode handlers added in #33095 result in incrementing PC by 3,
because they ignored the increment already present in `interpreter.go`.

Does this need to be better specified in the EIP? I've added a [new test
case](https://github.com/ethereum/EIPs/pull/10859) for it anyway.

Found by @0xriptide.
2025-12-08 17:45:40 +01:00
cui
31f9c9ff75
common/bitutil: deprecate XORBytes in favor of stdlib crypto/subtle (#33331)
XORBytes was added to package crypto/subtle in Go 1.20, and it's faster 
than our bitutil.XORBytes. There is only one use of this function
across go-ethereum so we can simply deprecate the custom implementation.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-12-08 17:40:59 +01:00
Snezhkko
af47d9b472
p2p/nat: fix err shadowing in UPnP addAnyPortMapping (#33355)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The random-port retry loop in addAnyPortMapping shadowed the err
variable, causing the function to return (0, nil) when all attempts
failed. This change removes the shadowing and preserves the last error
across both the fixed-port and random-port retries, ensuring failures
are reported to callers correctly.
2025-12-08 15:02:24 +01:00
rjl493456442
dbca85869f
ethdb/pebble: change the Pebble database configuration (#33353)
This PR changes the Pebble configurations as below:

- increase the MemTableStopWritesThreshold for handling temporary spike
- decrease the L0CompactionConcurrency and CompactionDebtConcurrency to
scale up compaction readily
2025-12-08 13:53:40 +01:00
David Klank
e63e37be5e
core/filtermaps: fix operator precedence in delete logging condition (#33280)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
The original condition `deleted && !logPrinted || time.Since(...)` was
incorrectly grouping due to operator precedence, causing logs to print
every 10 seconds even when no deletion was happening (deleted=false).

According to SafeDeleteRange documentation, the 'deleted' parameter is
"true if entries have actually been deleted already". The logging should
only happen when deletion is active.

Fixed by adding parentheses: `deleted && (!logPrinted ||
time.Since(...))`Now logs print only when items are being deleted AND
either it's the first log or 10+ seconds have passed since the last one.
2025-12-06 04:21:38 +01:00
Felix Lange
73a2df2b0a
eth/filters: change error code for invalid parameter errors (#33320)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
This improves the error code for cases where invalid query parameters
are submitted to `eth_getLogs`. I also improved the error message that
is emitted when querying into the future.
2025-12-04 11:02:42 +01:00
Felix Lange
657c99f116
beacon/types: update for fulu (#33349)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Should fix decoding JSON blocks in the Fulu fork. This diff was missing
from https://github.com/ethereum/go-ethereum/pull/33349.
2025-12-03 23:17:19 +01:00
Csaba Kiraly
129c562900
eth/catalyst: benchmark GetBlobsV2 at API level (#33196)
This is to benchmark how much the internal parts of GetBlobsV2 take. 
This is not an RPC-level benchmark, so JSON-RPC overhead is not
included.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-12-03 22:35:00 +01:00
rjl493456442
d3679c2f2e
core/state: export statistics to metrics (#33254)
Some checks are pending
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This PR exposes the state size statistics to the metrics, making them
easier to demonstrate.

Note that the contract code included in the metrics is not
de-duplicated, so the reported size
will appear larger than the actual storage footprint.
2025-12-02 16:28:51 +01:00
rjl493456442
212967d0e1
ethdb/pebble: add configuration changes (#33315)
This introduces two main changes to Pebble's configuration:

(a) Remove the Bloom filter at Level 6

The Bloom filter is never used at the bottom-most level, so keeping it
serves no purpose. Removing it saves storage without affecting read
performance.

(b) Re-enable read-sampling compaction

Read-sampling compaction was previously disabled in the hash-based
scheme because all data was identified by hashes and basically no data
overwrite. Read sampling compaction makes no sense.

After switching to the path-based scheme, data overwrites are much more
common, making read-sampling compaction beneficial and reasonable to re-enable.
2025-12-02 16:19:20 +01:00
cui
be94ea1c40
cmd/utils: fix handling of boolean flags when they are set to false (#33338)
geth --nodiscover=false  
may result in ctx.IsSet(NoDiscoverFlag.Name) is true, but cfg.
NoDiscovery should be false, not true.
2025-12-02 07:11:56 -08:00
rjl493456442
042c47ce1a
core: log detailed statistics for slow block (#32812)
This PR introduces a new debug feature, logging the slow blocks with
detailed performance statistics, such as state read, EVM execution and
so on.

Notably, the detailed performance statistics of slow blocks won't be
logged during the sync to not overwhelm users. Specifically, the statistics
are only logged if there is a single block processed.

Example output

```
########## SLOW BLOCK #########
Block: 23537063 (0xa7f878611c2dd27f245fc41107d12ebcf06b4e289f1d6acf44d49a169554ee09) txs: 248, mgasps: 202.99

EVM execution: 63.295ms
Validation: 1.130ms
Account read: 6.634ms(648)
Storage read: 17.391ms(1434)
State hash: 6.722ms
DB commit: 3.260ms
Block write: 1.954ms
Total: 99.094ms

State read cache: account (hit: 622, miss: 26), storage (hit: 1325, miss: 109)
##############################
```
2025-12-02 14:43:51 +01:00
Fallengirl
da3822dcec
internal/debug: fix log memory limit format (#33336)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-12-01 21:50:03 +08:00
Forostovec
6f2cbb7a27
triedb/pathdb: allow single-element history ranges (#33329)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-12-01 10:19:21 +08:00
cui
cd3f9b24e9
cmd/utils: fix disabling cache preimages through config file (#33330) 2025-12-01 10:12:59 +08:00
Sina M
5d51208334
internal/ethapi: change default tx type to 0x2 (#33058)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
We still default to legacy txes for methods like eth_sendTransaction,
eth_signTransaction. We can default to 0x2 and if someone would like to
stay on legacy they can do so by setting the `gasPrice` field.

cc @deffrian
2025-11-28 15:32:40 +01:00
lightclient
f12f0ec0cd
cmd/utils: allow --networkid to override other config options (#32999)
Recently in #31630 we removed support for overriding the network id in
preset networks. While this feature is niche, it is useful for shadow
forks. This PR proposes we add the functionality back, but in a simpler
way.

Instead of checking whether the flag is set in each branch of the
network switch statement, simply apply the network flag after the switch
statement is complete. This retains the following behavior:

1. Auto network id based on chain id still works, because `IsSet` only
returns true if the flag is _actually_ set. Not if it just has a default
set.
2. The preset networks will set their network id directly and only if
the network id flag is set is it overridden. This, combined with the
override genesis flag is what allows the shadow forks.
3. Setting the network id to the same network id that the preset _would
have_ set causes no issues and simply emits the `WARN` that the flag is
being set explicitly. I don't think people explicitly set the network id
flag often.

```
WARN [10-22|09:36:15.052] Setting network id with flag             id=10
```

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-11-28 15:24:21 +01:00
Felix Lange
fbbaa3c849
eth/catalyst: fix tests for getPayload change (#33322)
Fixes a test/lint regression introduced by #32754
2025-11-28 15:06:11 +01:00
lightclient
28376aea78
eth/catalyst: check fork timestamps during engine_getPayload (#32754)
This adds checks into getPayload to ensure the correct version is called
for the fork which applies to the payload.

---------

Co-authored-by: jsvisa <delweng@gmail.com>
2025-11-28 14:02:24 +01:00
Felix Lange
a122dbe459
internal/ethapi: return error code -32602 for invalid storage key (#33282)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
This was found because other clients are failing RPC tests generated by
Geth. Nethermind and Besu return the correct error code, -32602, in this
situation.
2025-11-28 11:28:31 +01:00
Bhargava Shastry
fed8e09ab0
cmd/evm: add stdin support to blocktest command (#32824)
Enable blocktest to read filenames from stdin when no path argument is
provided, matching the existing statetest behavior. This allows
efficient batch processing of blockchain tests.

Usage:
- Single file: evm blocktest <path>
- Batch mode: find tests/ -name "*.json" | evm blocktest

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-11-28 11:22:36 +01:00
cui
f691d661c4
cmd/utils: fix disabling discovery through config file (#33279)
No matter what value of P2P.DiscoveryV4 or DiscoveryV5 is set in config file,
it will be overwritten by the CLI flag, even if the flag is not set. This fixes it
to apply the flag only if set.
2025-11-28 10:52:21 +01:00
cui
f43228152b
cmd/utils: fix dumpconfig (#33302) 2025-11-28 10:13:01 +01:00
Rizky Ikwan
446fdebdc3
consensus/ethash: fix blob gas error message formatting (#33300)
Fixes error messages to print the actual blob gas value instead of the
pointer address by dereferencing `ExcessBlobGas`, `BlobGasUsed` and
`ParentBeaconRoot`.
2025-11-28 12:14:30 +08:00
ANtutov
b3b46ce435
eth/downloader: remove dead proc counter (#33309)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-28 10:42:22 +08:00
Guillaume Ballet
795a7ab58a
go.mod: bump gnark-crypto to 0.18.1 (#33305)
Fix for https://github.com/ethereum/go-ethereum/pull/33060 which I can't
directly fix in the branch.
2025-11-27 20:43:05 +01:00
dependabot[bot]
aa1a8dacae
cmd/keeper/go.mod: bump github.com/consensys/gnark-crypto from 0.18.0 to 0.18.1 in /cmd/keeper (#33256)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
Bumps
[github.com/consensys/gnark-crypto](https://github.com/consensys/gnark-crypto)
from 0.18.0 to 0.18.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/consensys/gnark-crypto/releases">github.com/consensys/gnark-crypto's
releases</a>.</em></p>
<blockquote>
<h2>v0.18.1</h2>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/Consensys/gnark-crypto/compare/v0.18.0...v0.18.1">https://github.com/Consensys/gnark-crypto/compare/v0.18.0...v0.18.1</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/Consensys/gnark-crypto/blob/master/CHANGELOG.md">github.com/consensys/gnark-crypto's
changelog</a>.</em></p>
<blockquote>
<h2>[v0.18.1] - 2025-10-28</h2>
<h3>Docs</h3>
<ul>
<li>add CHANGELOG for 0.18.1</li>
</ul>
<h3>Perf</h3>
<ul>
<li>limit memory allocation during Vector deserialization (<a
href="https://redirect.github.com/Consensys/gnark-crypto/issues/759">#759</a>)</li>
</ul>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fb04e95c3b"><code>fb04e95</code></a>
docs: add CHANGELOG for 0.18.1</li>
<li><a
href="0a4d04ae62"><code>0a4d04a</code></a>
perf: limit memory allocation during Vector deserialization (<a
href="https://redirect.github.com/consensys/gnark-crypto/issues/759">#759</a>)</li>
<li>See full diff in <a
href="https://github.com/consensys/gnark-crypto/compare/v0.18.0...v0.18.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/consensys/gnark-crypto&package-manager=go_modules&previous-version=0.18.0&new-version=0.18.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/ethereum/go-ethereum/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-27 14:27:49 +01:00
radik878
8d1b1c20d0
core/txpool/blobpool: auto-start next conversion batch after completion (#33301)
This change fixes a stall in the legacy blob sidecar conversion pipeline
where tasks that arrived during an active batch could remain unprocessed
indefinitely after that batch completed, unless a new external event
arrived. 

The root cause was that the loop did not restart processing in
the case <-done: branch even when txTasks had accumulated work, relying
instead on a future event to retrigger the scheduler. This behavior is
inconsistent with the billy task pipeline, which immediately chains to
the next task via runNextBillyTask() without requiring an external trigger. 

The fix adds a symmetric restart path in `case <-done`: that checks 
`len(txTasks) > 0`, clones the accumulated tasks, clears the queue, and 
launches a new run with a fresh done and interrupt. 

This preserves batching semantics, prevents indefinite blocking of callers 
of convert(), and remains safe during shutdown since the quit path 
still interrupts and awaits the active batch. No public interfaces or logging 
were changed.
2025-11-27 19:43:37 +08:00
David Klank
6426257c0f
eth/tracers/logger: rename WriteTo to Write (#33227)
Some checks are pending
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
2025-11-27 16:05:24 +08:00
Rizky Ikwan
9bab01bee4
consensus/clique: fix blob gas error message formatting (#33296)
Fixes error messages to print the actual blob gas value instead of the
pointer address by dereferencing `ExcessBlobGas`, `BlobGasUsed` and
`ParentBeaconRoot`.
2025-11-27 16:03:21 +08:00
Justin
6452b7ad05
beacon/light: optimize database key assembling (#33292)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-27 10:35:22 +08:00
Guillaume Ballet
7805e203f0
.github/workflows: validate that the directories exist (#33289)
A new pointless fad appeared recently where people just create a fairly
low information tag at the beginning of their github PR titles.
Something like `feat` or other keywords.

This seems to originate from the angular community and to be used for
automation scripts over there. We do not use any of those scripts and if
we did we would be using the github labels, which offer strictly
equivalent functionalities without wasting useful PR title space.

In order for these keywords to fail the validation, I am adding a check
that these directories listed indeed exist in the repository.
2025-11-26 23:36:35 +01:00
Marius van der Wijden
3bbf5f5b6a
core/vm: improve memory resize (#33056)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Looks like (in some very EVM specific tests) we spent a lot of time
resizing memory. If the underlying array is big enough, we can speed it 
up a bit by simply slicing the memory.

goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/vm
cpu: Intel(R) Core(TM) Ultra 7 155U
           │ /tmp/old.txt │              /tmp/new.txt              │
           │    sec/op    │    sec/op     vs base                  │
Resize-14     6.145n ± 9%   1.854n ± 14%  -69.83% (p=0.000 n=10)

           │ /tmp/old.txt │            /tmp/new.txt             │
           │     B/op     │    B/op     vs base                 │
Resize-14      5.000 ± 0%   5.000 ± 0%       ~ (p=1.000 n=10)

           │ /tmp/old.txt │             /tmp/new.txt              │
           │  allocs/op   │ allocs/op   vs base                   │
Resize-14    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹

From the blocktest benchmark: 

     620ms     10.93s (flat, cum)  9.92% of Total
         .          .     80:func (m *Memory) Resize(size uint64) {
      30ms       60ms     81:	if uint64(m.Len()) < size {
     590ms     10.87s     82:		m.store = append(m.store, make([]byte, size-uint64(m.Len()))...)
         .          .     83:	}
         .          .     84:}

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-11-26 16:50:16 +01:00
Klimov Sergei
c55a12197e
beacon/config: ignore nil values in config file (#33065)
YAML supports leaving out the value, so we should handle this condition
in our limited parser.
2025-11-26 16:19:33 +01:00
Klimov Sergei
3e48e0779c
beacon/config: add ELECTRA, FULU to knownForks (#32674) 2025-11-26 16:15:28 +01:00
Jonny Rhea
689ea10f35
core/vm: implement EIP-8024 (#33095)
EIP-8024: Backward compatible SWAPN, DUPN, EXCHANGE

Introduces additional instructions for manipulating the stack which
allow accessing the stack at higher depths. This is an initial implementation
of the EIP, which is still in Review stage.
2025-11-26 15:58:59 +01:00
Marius van der Wijden
ed4d00fd83
miner: add --miner.maxblobs flag (#33129)
Adds a flag to specify how many blobs a node is willing to include in
their locally build block as specified in
https://eips.ethereum.org/EIPS/eip-7872

I deviated from the EIP in one case, I allowed for specifying 0 as the
minimum blobs/block
2025-11-26 15:53:03 +01:00
oxBoni
1468331f9d
p2p/discover/v5wire: remove redundant bytes clone in WHOAREYOU encoding (#33180)
head.AuthData is assigned later in the function, so the earlier assignment
can safely be removed.
2025-11-26 15:34:11 +01:00
Lucia
3f7cd905b0
accounts/usbwallet: fix double hashing in SignTextWithPassphrase (#33138)
SignTextWithPassphrase calls SignText, which already performs TextHash.
2025-11-26 14:58:15 +01:00
radik878
cf93077fab
rlp: finalize listIterator on parse error to prevent non-advancing loops (#33245)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The list iterator previously returned true on parse errors without
advancing the input, which could lead to non-advancing infinite loops
for callers that do not check Err() inside the loop; to make iteration
safe while preserving error visibility, Next() now marks the iterator as
finished when readKind fails, returning true for the error step so
existing users that check Err() can handle it, and then false on
subsequent calls, and the function comment was updated to document this
behavior and the need to check Err().
2025-11-26 11:30:05 +01:00
Felföldi Zsolt
62334a9d46
beacon: update beacon light client for fusaka (#33272)
This PR adds the "FULU" beacon chain config entries for all networks and
fixes the select statements that choose the appropriate engine API call
versions (no new version there but the "default" was always the first
version; now it's the latest version so no need to change unless there
is actually a new version).
New beacon checkpoints are also added for mainnet, sepolia and hoodi
(not for holesky because it's not finalizing at the moment).
Note that though unrelated to fusaka, the log indexer checkpoints are
also updated for mainnet (not for the other testnets, mainly because I
only have mainnet synced here on my travel SSD; this should be fine
though because the index is also reverse generated for a year by default
so it does not really affect the indexing time)

Links for the new checkpoints:

https://beaconcha.in/slot/13108192
https://light-sepolia.beaconcha.in/slot/9032384
https://hoodi.beaconcha.in/slot/1825728
2025-11-26 11:07:56 +01:00
rjl493456442
960c87a944
triedb/pathdb: implement iterator of history index (#32981)
This change introduces an iterator for the history index in the pathdb.
It provides sequential access to historical entries, enabling efficient 
scanning and future features built on top of historical state traversal.
2025-11-26 16:07:16 +08:00
Rizky Ikwan
ebf93555b1
consensus/misc: fix blob gas error message formatting (#33275)
Dereference the `header.BlobGasUsed` pointer when formatting the error
message in `VerifyEIP4844Header`.
2025-11-26 16:05:30 +08:00
Bashmunta
b04df226fa
cmd/geth: skip resolver for zero-commitment verkle children (#33265)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-25 20:34:58 +08:00
VolodymyrBg
2a4847a7d1
core/rawdb: fix underflow in freezer inspect for empty ancients (#33203)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-25 10:24:17 +08:00
sashass1315
a6191d8272
core/txpool/blobpool: drain and signal pending conversion tasks on shutdown (#33260) 2025-11-25 10:23:30 +08:00
Rizky Ikwan
5748dd18e7
consensus/beacon: fix blob gas error message formatting (#33201)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-24 22:30:44 +08:00
georgehao
b5c3b32eeb
eth/catalyst: remove the outdated comments of ForkchoiceUpdatedV1 (#33251) 2025-11-24 22:02:13 +08:00
Cedrick AH
495a1d2b1a
core, cmd: removed tablewriter from the dependencies (#33218)
Fix #33212. 

This PR remove `github.com/olekukonko/tablewriter` from dependencies and
use a naive stub implementation. 

`github.com/olekukonko/tablewriter` is used to format database inspection 
output neatly. However, it requires custom adjustments for TinyGo and is 
incompatible with the latest version.

---------

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2025-11-24 21:50:48 +08:00
phrwlk
f8e5b53f88
cmd/utils: make datadir.minfreedisk an IntFlag (#33252) 2025-11-24 21:01:00 +08:00
wit liu
f4817b7a53
core: initialize tracer before DAO fork logic (#33214)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
`StateDB` lacks recording functionality, so it has been replaced with
`tractStateDB` and advanced
2025-11-19 19:00:31 +01:00
maradini77
e0d81d1e99
eth: fix panic in randomDuration when min equals max (#33193)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Fixes a potential panic in `randomDuration` when `min == max` by
handling the edge case explicitly.
2025-11-19 01:54:53 +08:00
David Klank
5e6f7374de
ethapi: deref gasUsed pointer in eth_simulate log (#33192)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Show the actual gas used in the block limit error so RPC clients see
useful numbers.
2025-11-15 07:04:21 -07:00
Guillaume Ballet
2a2f106a01
cmd/evm/internal/t8ntool, trie: support for verkle-at-genesis, use UBT, and move the transition tree to its own package (#32445)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
This is broken off of #31730 to only focus on testing networks that
start with verkle at genesis.

The PR has seen a lot of work since its creation, and it now targets
creating and re-executing tests for a binary tree testnet without the
transition (so it starts at genesis). The transition tree has been moved
to its own package. It also replaces verkle with the binary tree for
this specific application.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-11-14 15:25:30 +01:00
Guillaume Ballet
81c5b43029
core/rawdb: delete dead code to avoid more useless AI submissions (#33186)
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-11-14 14:39:36 +01:00
radik878
95273afec4
core/rawdb: return iterator error in findTxInBlockBody (#33188)
The iterator loop in findTxInBlockBody returned the outer-scoped err
when iter.Err() was non-nil, which could incorrectly propagate a nil or
stale error and hide actual RLP decoding issues. This patch returns
iter.Err() as intended by the rlp list iterator API, matching
established patterns elsewhere in the codebase and improving diagnostics
when encountering malformed transaction entries.
2025-11-14 13:55:41 +01:00
oooLowNeoNooo
aa36bcd0aa
graphql: add nil check in Transaction.Type() method (#33184)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Add nil check before calling tx.Type() to prevent panic when transaction
is not found.
2025-11-14 15:16:03 +08:00
phrwlk
488d987fc4
accounts/keystore: clear decrypted key after use (#33090)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-13 16:17:54 +08:00
Bashmunta
fa16c89bfd
core: use scheme-aware empty root in flushAlloc (#33168) 2025-11-13 16:15:44 +08:00
Delweng
f23d506b7d
eth/syncer: advance safe and finalized block (#33038) 2025-11-13 15:06:27 +08:00
Forostovec
eb8f32588b
triedb/pathdb: fix ID assignment in history inspection (#33103) 2025-11-13 14:51:41 +08:00
Marcel
48d708a194
eth/filters: further optimize tx hash map in #32965 (#33108) 2025-11-13 14:48:26 +08:00
Csaba Kiraly
12a389f065
core/txpool/blobpool: fix benchmarkPoolPending (#33161)
Add BlobTxs flag to filter.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-11-13 14:32:01 +08:00
oxBoni
3d2a4cb053
core: remove unused peek function in insertIterator (#33155)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-12 15:30:16 +08:00
Michael Kaplan
d8f9801305
rpc: avoid unnecessary RST_STREAM, PING frames sent by client (#33122)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Context from Cloudflare blog:
https://blog.cloudflare.com/go-and-enhance-your-calm/#reading-bodies-in-go-can-be-unintuitive

We were able to reproduce the same issue discussed by Cloudflare in
their recent blog post above using the `ethclient`.
2025-11-11 15:54:36 +01:00
Lucia
7368b34a4b
core/rawdb: capture open file error and fix resource leak (#33147)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-11 16:01:37 +08:00
Matthieu Vachon
5f4cc3f57d
core/state: fixed hooked StateDB handling of OnCodeChangeV2 (#33148)
While updating to latest Geth, I noticed `OnCodeChangeV2` was not
properly handled in `SelfDestruct/6780`, this PR fixes this and bring a
unit test. Let me know if it's deemed more approriate to merge the tests
with the other one.
2025-11-11 14:57:52 +08:00
Guillaume Ballet
ca91254259
build: add wasm targets for keeper (#33124)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
[powdr](github.com/powdr-labs/powdr) has tested keeper in their womir
system and managed to get it to work. This PR adds wasm as a keeper
target. There's another plan by the zkevm team to support wasm with wasi
as well, so these PR adds both targets.

These currently uses the `example` tag, as there is no precompile
intefrace defined for either target yet. Nonetheless, this is useful for
testing these zkvms so it makes sense to support these experimental
targets already.
2025-11-11 10:07:32 +08:00
sashass1315
fbd89be047
eth/catalyst: always reset timer after sealing error (#33146)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The periodic sealing loop failed to reset its timer when sealBlock
returned an error, causing the timer to never fire again and effectively
halting block production in developer periodic mode after the first
failure. This is a bug because the loop relies on the timer to trigger
subsequent sealing attempts, and transient errors (e.g., pool races or
chain rewinds) should not permanently stop the loop. The change moves
timer.Reset after the sealing attempt unconditionally, ensuring the loop
continues ticking and retrying even when sealing fails, which matches
how other periodic timers in the codebase behave and preserves forward
progress.
2025-11-10 18:44:31 +01:00
Tristan-Wilson
7755ee3e4f
consensus/misc/eip4844: expose TargetBlobsPerBlock (#32991)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Rollups may want to use these to dynamically adjust blobs posted after
BPO forks.
2025-11-10 09:38:28 +01:00
Lucia
ebc7dc9e37
crypto: validate hash length in no cgo Sign (#33104)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
- Replace hardcoded DigestLength 
- Add hash length validation
2025-11-08 11:25:53 +01:00
Delweng
d2a5dba48f
triedb/pathdb: fix 32-bit integer overflow in history trienode decoder (#33098)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
failed in 32bit:

```
--- FAIL: TestDecodeSingleCorruptedData (0.00s)
panic: runtime error: slice bounds out of range [:-1501805520] [recovered, repanicked]

goroutine 38872 [running]:
testing.tRunner.func1.2({0x838db20, 0xa355620})
	/opt/actions-runner/_work/_tool/go/1.25.3/x64/src/testing/testing.go:1872 +0x29b
testing.tRunner.func1()
	/opt/actions-runner/_work/_tool/go/1.25.3/x64/src/testing/testing.go:1875 +0x414
panic({0x838db20, 0xa355620})
	/opt/actions-runner/_work/_tool/go/1.25.3/x64/src/runtime/panic.go:783 +0x103
github.com/ethereum/go-ethereum/triedb/pathdb.decodeSingle({0x9e57500, 0x1432, 0x1432}, 0x0)
	/opt/actions-runner/_work/go-ethereum/go-ethereum/triedb/pathdb/history_trienode.go:399 +0x18d6
github.com/ethereum/go-ethereum/triedb/pathdb.TestDecodeSingleCorruptedData(0xa2db9e8)
	/opt/actions-runner/_work/go-ethereum/go-ethereum/triedb/pathdb/history_trienode_test.go:698 +0x180
testing.tRunner(0xa2db9e8, 0x83c86e8)
	/opt/actions-runner/_work/_tool/go/1.25.3/x64/src/testing/testing.go:1934 +0x114
created by testing.(*T).Run in goroutine 1
	/opt/actions-runner/_work/_tool/go/1.25.3/x64/src/testing/testing.go:1997 +0x4b4
FAIL	github.com/ethereum/go-ethereum/triedb/pathdb	41.453s
?   	github.com/ethereum/go-ethereum/version	[no test files]
FAIL
```

Found in
https://github.com/ethereum/go-ethereum/actions/runs/18912701345/job/53990136071?pr=33052
2025-11-07 23:06:15 +01:00
Marius van der Wijden
982235f5e0
core/vm: remove todo (#33120)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Removes an unnecessary todo. This case is handled, the comment was an
artifact from Kev's refactor
2025-11-07 21:55:58 +08:00
Rizky Ikwan
7f9b06e7aa
accounts/usbwallet: fix version check in SignTypedMessage (#33113)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
The version check incorrectly used `&&` instead of `||`, causing
versions like v1.0.x through v1.4.x to be allowed when they should be
rejected. These versions don't support EIP-712 signing which was
introduced in firmware v1.5.0.
2025-11-07 08:24:11 +01:00
maskpp
6420ee3592
core/state: fix bug about getting stable LogsHash result. (#33082)
Because the map iteration is unstable, we need to order logs by tx index
and keep the same order with receipts and their logs, so we can still
get the same `LogsHash` across runs.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-11-07 11:00:20 +08:00
Rizky Ikwan
15ff378a89
common: fix size comparison in StorageSize (#33105)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-06 09:25:41 +08:00
MozirDmitriy
395425902d
core/rawdb: fix readOnly mode for database (#33025)
Some checks failed
/ Keeper Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
2025-11-04 21:09:57 +08:00
maskpp
19aa8020a9
common: introduce IsHexHash and use it (#32998) 2025-11-04 21:09:36 +08:00
Felix Lange
d39af344dc version: begin v1.16.8 release cycle 2025-11-04 13:28:20 +01:00
Felix Lange
07129d21c0 version: release go-ethereum v1.16.7 stable 2025-11-04 13:16:02 +01:00
Marius van der Wijden
653f8d4994
go.mod: update to c-kzg v2.1.5 (#33093)
We unfortunately missed this update for the Geth v1.16.6 release, but it is critical.
2025-11-04 19:48:13 +08:00
Felix Lange
5b77af394e version: begin v1.16.7 release cycle
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-03 17:47:42 +01:00
Felix Lange
044828e660 version: release go-ethereum v1.16.6 2025-11-03 17:46:19 +01:00
Marius van der Wijden
025072427e
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
2025-11-03 17:41:22 +01:00
rjl493456442
28c59b7a76
core/rawdb: fix db inspector by supporting trienode history (#33087)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-11-03 21:11:14 +08:00
maradini77
18a902799e
common: fix duration comparison in PrettyAge (#33064)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
This pull request updates `PrettyAge.String` so that the age formatter
now treats exact unit boundaries (like a full day or week) as that unit
instead of spilling into smaller components, keeping duration output
aligned with human expectations.
2025-11-01 13:17:45 +08:00
hero5512
e6d34c1fee
eth/tracers: fix prestateTracer for EIP-6780 SELFDESTRUCT (#33050)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
fix https://github.com/ethereum/go-ethereum/issues/33049
2025-10-31 18:14:52 +01:00
wit liu
243407a3aa
eth/downloader: fix incorrect waitgroup in test XTestDelivery (#33047)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
2025-10-30 15:39:02 +08:00
Coder
ccacbd1e37
common: simplify FileExist helper (#32969)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
2025-10-30 09:20:07 +08:00
Delweng
5dd0fe2f53
p2p: cleanup v4 if v5 failed (#33005)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Clean the previous resource (v4) if the latter (v5) failed.
2025-10-29 10:34:19 +01:00
Austin Larson
ae37b4928c
accounts/abi/bind/v2: fix error assertion in test (#33041) 2025-10-29 14:59:45 +08:00
Guillaume Ballet
739f6f46a2
.github: add 32-bit CI targets (#32911)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
This adds two new CI targets. One is for building all supported keeper
executables, the other is for running unit tests on 32-bit Linux.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-10-28 13:56:44 +01:00
anim001k
59d08c66ff
internal/jsre: pass correct args to setTimeout/setInterval callbacks (#32936)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
## Description
- Summary: Correct the JS timer callback argument forwarding to match
standard JS semantics.
- What changed: In `internal/jsre/jsre.go`, the callback is now invoked
with only the arguments after the callback and delay.
- Why: Previously, the callback received the function and delay as
parameters, causing unexpected behavior and logic bugs for consumers.
2025-10-28 12:34:14 +01:00
Delweng
b1db341f7e
core: refine condition for using legacy chain freezer directory (#33032) 2025-10-28 13:53:42 +08:00
cui
33dbd64a23
core/types: optimize modernSigner.Equal (#32971)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
Equal is called every time the transaction sender is accessed,
even when the sender is cached, so it is worth optimizing.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-10-27 16:04:06 +01:00
Delweng
447b5f7e19
core: don't modify the shared chainId between tests (#33020)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
2025-10-27 16:53:26 +08:00
cui
078a5ecb7d
core/state: improve accessList copy (#33024)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
2025-10-26 16:13:59 +08:00
Rizky Ikwan
7fb91f3cd5
rpc: remove unused vars (#33012) 2025-10-26 16:13:04 +08:00
rjl493456442
cfa3b96103
core/rawdb, triedb/pathdb: re-structure the trienode history header (#32907)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
In this PR, several changes have been made:

(a) restructure the trienode history header section

Previously, the offsets of the key and value sections were recorded before 
encoding data into these sections. As a result, these offsets referred to the
start position of each chunk rather than the end position.

This caused an issue where the end position of the last chunk was
unknown, making it incompatible with the freezer partial-read APIs. 
With this update, all offsets now refer to the end position, and the 
start position of the first chunk is always 0.

(b) Enable partial freezer read for trienode data retrieval

The partial freezer read feature is now utilized in trienode data
retrieval, improving efficiency.
2025-10-25 16:16:16 +08:00
Felix Lange
17e5222997
build: fix keeper build (#33018)
Some checks are pending
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
At the time keeper support was added into ci.go, we were using a go.work
file to make ./cmd/keeper accessible from within the main go-ethereum
module. The workspace file has since been removed, so we need to build
keeper from within its own module instead.
2025-10-24 18:25:54 +02:00
Guillaume Ballet
074d7b79c1
.gitea/workflows, build: add release build for keeper (#32632) 2025-10-24 17:19:25 +02:00
hero5512
53c85da796
eth/tracers: fix crasher in TraceCall with BlockOverrides (#33015)
fix https://github.com/ethereum/go-ethereum/issues/33014

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-10-24 17:04:09 +02:00
Delweng
0413af40f6
rpc: fix a flaky test of the websocket (#33002)
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
Found in
https://github.com/ethereum/go-ethereum/actions/runs/17803828253/job/50611300621?pr=32585

```
--- FAIL: TestClientCancelWebsocket (0.33s)
panic: read tcp 127.0.0.1:36048->127.0.0.1:38643: read: connection reset by peer [recovered, repanicked]

goroutine 15 [running]:
testing.tRunner.func1.2({0x98dd20, 0xc0005b0100})
	/opt/actions-runner/_work/_tool/go/1.25.1/x64/src/testing/testing.go:1872 +0x237
testing.tRunner.func1()
	/opt/actions-runner/_work/_tool/go/1.25.1/x64/src/testing/testing.go:1875 +0x35b
panic({0x98dd20?, 0xc0005b0100?})
	/opt/actions-runner/_work/_tool/go/1.25.1/x64/src/runtime/panic.go:783 +0x132
github.com/ethereum/go-ethereum/rpc.httpTestClient(0xc0001dc1c0?, {0x9d5e40, 0x2}, 0xc0002bc1c0)
	/opt/actions-runner/_work/go-ethereum/go-ethereum/rpc/client_test.go:932 +0x2b1
github.com/ethereum/go-ethereum/rpc.testClientCancel({0x9d5e40, 0x2}, 0xc0001dc1c0)
	/opt/actions-runner/_work/go-ethereum/go-ethereum/rpc/client_test.go:356 +0x15f
github.com/ethereum/go-ethereum/rpc.TestClientCancelWebsocket(0xc0001dc1c0?)
	/opt/actions-runner/_work/go-ethereum/go-ethereum/rpc/client_test.go:319 +0x25
testing.tRunner(0xc0001dc1c0, 0xa07370)
	/opt/actions-runner/_work/_tool/go/1.25.1/x64/src/testing/testing.go:1934 +0xea
created by testing.(*T).Run in goroutine 1
	/opt/actions-runner/_work/_tool/go/1.25.1/x64/src/testing/testing.go:1997 +0x465
FAIL	github.com/ethereum/go-ethereum/rpc	0.371s
```

In `testClientCancel` we wrap the server listener in `flakeyListener`,
which schedules an unconditional close of every accepted connection
after a random delay, if the random delay is zero then the timer fires
immediately, and then the http client paniced of connection reset by
peer.

Here we add a minimum 10ms to ensure the timeout won't fire immediately.

Signed-off-by: jsvisa <delweng@gmail.com>
2025-10-23 20:58:33 +08:00
Guillaume Ballet
f1be21501f
crypto: implement ziren keccak state (#32996)
The #32816 was only using the keccak precompile for some minor task.
This PR implements a keccak state, which is what is used for hashing the
tree.
2025-10-23 14:02:13 +02:00
maskpp
030cd2d155
cmd/utils: use IsHexAddress method (#32997)
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
Using the `IsHexAddress` method will result in no gaps in the
verification logic, making it simpler.
2025-10-23 11:56:47 +02:00
Delweng
2bb3d9a330
p2p: silence on listener shutdown (#33001)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-10-23 10:44:54 +02:00
Delweng
116c916753
cmd/devp2p: distinguish the jwt in devp2p and geth (#32972)
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 fixes some docs for the devp2p suite and uses the CLI library's required value instead of manually checking if required flags are passed.
2025-10-22 10:24:40 -06:00
Delweng
3b8075234e
core/state: fix the flaky TestSizeTracker (#32993) 2025-10-22 22:35:26 +08:00
cui
6608a2aafd
core/types: remove unused ErrInvalidTxType var (#32989)
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 var `ErrInvalidTxType` is never used in the code base.
2025-10-21 09:49:43 -06:00
lightclient
407d9faf71
cmd/geth: add flag to set genesis (#32844)
This PR is an alternative to #32556.

Instead of trying to be smart and reuse `geth init`, we can introduce a
new flag `--genesis` that loads the `genesis.json` from file into the
`Genesis` object in the same path that the other network flags currently
work in.

Question: is something like `--genesis` enough to start deprecating
`geth init`?

--

```console
$ geth --datadir data --hoodi
..
INFO [10-06|22:37:11.202]  - BPO2:                        @1762955544
..
$ geth --datadir data --genesis genesis.json
..
INFO [10-06|22:37:27.988]  - BPO2:                       @1862955544
..
```

Pull the genesis [from the
specs](https://raw.githubusercontent.com/eth-clients/hoodi/refs/heads/main/metadata/genesis.json)
and modify one of the BPO timestamps to simulate a shadow fork.

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-10-21 22:10:45 +08:00
rjl493456442
0a8b820725
triedb/pathdb: make batch with pre-allocated size (#32914)
In this PR, the database batch for writing the history index data is
pre-allocated.

It's observed that database batch repeatedly grows the size of the
mega-batch,
causing significant memory allocation pressure. This approach can
effectively
mitigate the overhead.
2025-10-21 13:11:36 +02:00
rjl493456442
79b6a56d3a
core/state: prevent SetCode hook if contract code is not changed (#32980)
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 prevents the SetCode hook from being called when the contract
code
remains unchanged.

This situation can occur in the following cases:
- The deployed runtime code has zero length
- An EIP-7702 authorization attempt tries to unset a non-delegated
account
- An EIP-7702 authorization attempt tries to delegate to the same
account
2025-10-21 16:03:56 +08:00
Kyrin
d73bfeb3d9
core/txpool: Initialize journal writer for tx tracker (#32921)
Previously, the journal writer is nil until the first time rejournal
(default 1h), which means during this period, txs submitted to this node
are not written into journal file (transactions.rlp). If this node is
shutdown before the first time rejournal, then txs in pending or queue
will get lost.

Here, this PR initializes the journal writer soon after launch to solve
this issue.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-10-21 15:41:38 +08:00
Marius van der Wijden
b81f03e8ff
params: enable osaka on dev mode (#32917)
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
enables the osaka fork on dev mode

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-10-20 17:24:07 +02:00
Guillaume Ballet
b1809d13d1
cmd/keeper: use the ziren keccak precompile (#32816)
Uses the go module's `replace` directive to delegate keccak computation
to precompiles.

This is still in draft because it needs more testing. Also, it relies on
a PR that I created, that hasn't been merged yet.

_Note that this PR doesn't implement the stateful keccak state
structure, and it reverts to the current behavior. This is a bit silly
since this is what is used in the tree root computation. The runtime
doesn't currently export the sponge. I will see if I can fix that in a
further PR, but it is going to take more time. In the meantime, this is
a useful first step_
2025-10-20 11:52:02 +02:00
jwasinger
b6a4ac9961
core/vm: don't call SetCode after contract creation if initcode didn't return anything (#32916)
The code change is a noop here, and the tracing hook shouldn't be
invoked if the account code doesn't actually change.
2025-10-20 11:51:29 +02:00
maskpp
cfb311148c
eth/filters: avoid rebuild the hash map multi times (#32965)
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-10-20 16:18:17 +08:00
cui
69df6bb8d5
core/types: prealloc map in HashDifference as in TxDifference (#32946) 2025-10-20 10:35:14 +08:00
hero5512
11c0fb98af
triedb/pathdb: fix index out of range panic in decodeSingle (#32937)
Fixes TestCorruptedKeySection flaky test failure.
https://github.com/ethereum/go-ethereum/actions/runs/18600235182/job/53037084761?pr=32920
2025-10-20 10:29:46 +08:00
Bosul Mun
88576c52e2
eth/fetcher: remove dangling peers from alternates (#32947)
This PR removes dangling peers in `alternates` map

In the current code, a dropped peer is removed from alternates for only
the specific transaction hash it was requesting. If that peer is listed
as an alternate for other transaction hashes, those entries still stick
around in alternates/announced even though that peer already got
dropped.
2025-10-20 10:26:55 +08:00
Bosul Mun
a9e66262af
eth/fetcher: add metrics for tracking slow peers (#32964)
This PR introduces two new metrics to monitor slow peers
- One tracks the number of slow peers.
- The other measures the time it takes for those peers to become
"unfrozen"

These metrics help with monitoring and evaluating the need for future
optimization of the transaction fetcher and peer management, for example i
n peer scoring and prioritization.

Additionally, this PR moves the fetcher metrics into a separate file, 
`eth/fetcher/metrics.go`.
2025-10-20 10:10:58 +08:00
CertiK
0ec63272bf
cmd/utils: use maximum uint64 value for receipt chain insertion (#32934)
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
2025-10-18 19:54:56 +08:00
rjl493456442
342285b139
eth, internal: add blob conversion for SendRawTransactionSync (#32930)
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
2025-10-17 13:34:35 +08:00
ucwong
0a2c21acd5
eth/ethconfig : fix eth generate config (#32929) 2025-10-17 10:35:44 +08:00
Youssef Azzaoui
b373d797d8
core/state: state copy bugfixes with Verkle Trees (#31696)
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 change addresses critical issues in the state object duplication
process specific to Verkle trie implementations. Without these
modifications, updates to state objects fail to propagate correctly
through the trie structure after a statedb copy operation, leading to
inaccuracies in the computation of the state root hash.

---------

Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
2025-10-16 19:19:44 +02:00
aodhgan
ff54ca02de
internal/ethapi: add eth_SendRawTransactionSync (#32830)
New RPC method eth_sendRawTransactionSync(rawTx, timeoutMs?) that
submits a signed tx and blocks until a receipt is available or a timeout
elapses.

Two CLI flags to tune server-side limits:

--rpc.txsync.defaulttimeout (default wait window)

--rpc.txsync.maxtimeout (upper bound; requests are clamped)

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

---------

Co-authored-by: aodhgan <gawnieg@gmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-10-16 17:34:47 +02:00
hero5512
c37bd67019
ethclient: add support for eth_simulateV1 (#32856)
Adds ethclient support for the eth_simulateV1 RPC method, which allows
simulating transactions on top of a base state without making changes to
the blockchain.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-10-16 17:32:55 +02:00
Galoretka
5c535074ac
cmd/geth: log current key in expandVerkle instead of keylist[0] (#32689)
Some checks are pending
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
Fix logging in the verkle dump path to report the actual key being
processed.
Previously, the loop always logged keylist[0], which misled users when
expanding multiple keys and made debugging harder. This change aligns
the
log with the key passed to root.Get, improving traceability and
diagnostics.
2025-10-16 13:49:41 +02:00
Felix Lange
367b5fbe42 version: begin v1.16.6 release cycle 2025-10-16 09:59:52 +02:00
Felix Lange
32ccb548d3 version: release go-ethereum v1.16.5 stable 2025-10-16 09:58:47 +02:00
Felix Lange
7c107c2691
p2p/discover: remove hot-spin in table refresh trigger (#32912)
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 fixes a regression introduced in #32518. In that PR, we removed the
slowdown logic that would throttle lookups when the table runs empty.
Said logic was originally added in #20389.

Usually it's fine, but there exist pathological cases, such as hive
tests, where the node can only discover one other node, so it can only
ever query that node and won't get any results. In cases like these, we
need to throttle the creation of lookups to avoid crazy CPU usage.
2025-10-15 11:51:33 +02:00
Delweng
40505a9bc0
eth/protocols/eth: reject message containing duplicated txs and drop peer (#32728)
Drop peer if sending the same transaction multiple times in a single message.

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


---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-10-15 10:24:48 +02:00
mishraa-G
3cfc33477b
rpc: fix flaky test TestServerWebsocketReadLimit (#32889) 2025-10-15 15:39:00 +08:00
Felix Lange
f6064f32c4
internal/ethapi: convert legacy blobtx proofs in sendRawTransaction (#32849)
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 temporary conversion path for blob transactions with legacy
proof sidecar. This feature will activate after Fusaka. We will phase
this out when the fork has sufficiently settled and client side
libraries have been upgraded to send the new proofs.
2025-10-14 14:40:54 +02:00
cui
55a53208b7
accounts/abi: check presence of payable fallback or receive before proceeding with transfer (#32374)
remove todo
2025-10-14 17:07:48 +08:00
rjl493456442
e03d97a420
core/txpool/legacypool: fix pricedList updates (#32906)
This pr addresses a few issues brought by the #32270 

- Add updates to pricedList after dropping transactions.
- Remove redundant deletions in queue.evictList, since
pool.removeTx(hash, true, true) already performs the removal.
- Prevent duplicate addresses during promotion when Reset is not nil.
2025-10-14 08:40:04 +02:00
Csaba Kiraly
fb8d2298b6
eth: do not warn on switching from snap sync to full sync (#32900)
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 happens normally after a restart, so it is better to use Info level
here.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-10-14 11:03:31 +08:00
Csaba Kiraly
00f6f2b32f
eth/catalyst: remove useless log on enabling Engine API (#32901) 2025-10-14 11:01:43 +08:00
Guillaume Ballet
52c484de86
triedb/pathdb: catch int conversion overflow in 32-bit (#32899)
The limit check for `MaxUint32` is done after the cast to `int`. On 64
bits machines, that will work without a problem. On 32 bits machines,
that will always fail. The compiler catches it and refuses to build.

Note that this only fixes the compiler build. ~~If the limit is above
`MaxInt32` but strictly below `MaxUint32` then this will fail at runtime
and we have another issue.~~ I checked and this should not happen during
regular execution, although it might happen in tests.
2025-10-14 09:23:05 +08:00
Delweng
6337577434
p2p/discover: wait for bootstrap to be done (#32881)
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 ensures the node is ready to accept other nodes into the
table before it is used in a test.

Closes #32863
2025-10-13 19:58:50 +02:00
Felföldi Zsolt
b28241ba85
cmd/workload: filter fuzzer test (#31613)
This PR adds a `filterfuzz` subcommand to the workload tester that
generates requests similarly to `filtergen` (though with a much smaller
block length limit) and also verifies the results by retrieving all
block receipts in the range and locally filtering out relevant results.
Unlike `filtergen` that operates on the finalized chain range only,
`filterfuzz` does check the head region, actually it seeds a new query
at every new chain head.
2025-10-13 19:21:01 +02:00
Marius van der Wijden
7b693ea17c
core/txpool/legacypool: move queue out of main txpool (#32270)
This PR move the queue out of the main transaction pool.
For now there should be no functional changes.
I see this as a first step to refactor the legacypool and make the queue
a fully separate concept from the main pending pool.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-10-13 19:07:36 +02:00
cui
b87581f297
p2p/enode: optimize DistCmp (#32888)
This speeds up DistCmp by 75% through using 64-bit operations instead of
byte-wise XOR.
2025-10-13 16:16:07 +02:00
cui
5c6ba6b400
p2p/enode: optimize LogDist (#32887)
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 speeds up LogDist by 75% using 64-bit operations instead
of byte-wise XOR.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-10-13 14:00:43 +02:00
Delweng
a7359ceb69
triedb, core/rawdb: implement the partial read in freezer (#32132)
This PR implements the partial read functionalities in the freezer, optimizing
the state history reader by resolving less data from freezer.

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-10-13 19:40:03 +08:00
Lewis
bc0a21a1d5
eth/filters: uninstall subscription in filter apis on error (#32894)
Fix https://github.com/ethereum/go-ethereum/issues/32893.

In the previous https://github.com/ethereum/go-ethereum/pull/32794, it
only handles the pending tx filter, while there are also head and log
filters. This PR applies the patch to all filter APIs and uses `defer`
to maintain code consistency.
2025-10-13 13:10:44 +02:00
Delweng
85e9977fae
p2p: rm unused var seedMinTableTime (#32876) 2025-10-13 16:40:08 +08:00
cui
2010781c29
core/types: optimize MergeBloom by using bitutil (#32882)
```
goos: darwin
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: VirtualApple @ 2.50GHz
                                 │   old.txt    │               new.txt               │
                                 │    sec/op    │   sec/op     vs base                │
CreateBloom/small-createbloom-10    1.676µ ± 4%   1.646µ ± 1%   -1.76% (p=0.000 n=10)
CreateBloom/large-createbloom-10    164.8µ ± 3%   164.3µ ± 0%        ~ (p=0.247 n=10)
CreateBloom/small-mergebloom-10    231.60n ± 0%   68.00n ± 0%  -70.64% (p=0.000 n=10)
CreateBloom/large-mergebloom-10    21.803µ ± 3%   5.107µ ± 1%  -76.58% (p=0.000 n=10)
geomean                             6.111µ        3.113µ       -49.06%

                                 │    old.txt     │                new.txt                │
                                 │      B/op      │     B/op      vs base                 │
CreateBloom/small-createbloom-10     112.0 ± 0%       112.0 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/large-createbloom-10   10.94Ki ± 0%     10.94Ki ± 0%       ~ (p=0.474 n=10)
CreateBloom/small-mergebloom-10      0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/large-mergebloom-10      0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                         ²                 +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                 │   old.txt    │               new.txt               │
                                 │  allocs/op   │ allocs/op   vs base                 │
CreateBloom/small-createbloom-10   6.000 ± 0%     6.000 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/large-createbloom-10   600.0 ± 0%     600.0 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/small-mergebloom-10    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
CreateBloom/large-mergebloom-10    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                       ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean
```
2025-10-13 16:39:10 +08:00
Luke Ma
a3aae29845
node: fix error condition in gzipResponseWriter.init() (#32896) 2025-10-13 15:26:35 +08:00
10gic
659342a523
ethclient: add SubscribeTransactionReceipts (#32869)
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
Add `SubscribeTransactionReceipts` for ethclient. This is a complement
to https://github.com/ethereum/go-ethereum/pull/32697.
2025-10-10 11:47:33 +02:00
rjl493456442
de24450dbf
core/rawdb, triedb/pathdb: introduce trienode history (#32596)
It's a pull request based on the #32523 , implementing the structure of
trienode history.
2025-10-10 14:51:27 +08:00
cui
ed264a1f19
eth/protocols/snap: optimize incHash (#32748) 2025-10-10 13:48:25 +08:00
Csaba Kiraly
4d6d5a3abf
core/txpool/legacypool: fix validTxMeter to count transactions (#32845)
invalidTxMeter was counting txs, while validTxMeter was counting
accounts. Better make the two comparable.

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-10-10 13:40:10 +08:00
10gic
11208553dd
eth/filters: add transactionReceipts subscription (#32697)
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
- Introduce a new subscription kind `transactionReceipts` to allow clients to
  receive transaction receipts over WebSocket as soon as they are available.
- Accept optional `transactionHashes` filter to subscribe to receipts for specific
  transactions; an empty or omitted filter subscribes to all receipts.
- Preserve the same receipt format as returned by `eth_getTransactionReceipt`.
- Avoid additional HTTP polling, reducing RPC load and latency.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-10-09 14:14:53 +02:00
CertiK
a1b8e4880d
eth/filters: terminate pending tx subscription on error (#32794)
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 issue #32793. When the pending tx subscription ends, the filter
is removed from `api.filters`, but it is not terminated. There is no other 
way to terminate it, so the subscription will leak, and potentially block
the producer side.
2025-10-09 11:34:30 +02:00
phrwlk
695c1445ab
core/rawdb: correct misleading comments for state history accessors (#32783)
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-10-09 08:59:06 +08:00
Alexey Osipov
e42af536c5
cmd/devp2p/internal/ethtest: accept responses in any order (#32834)
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
In both `TestSimultaneousRequests` and `TestSameRequestID`, we send two
concurrent requests. The client under test is free to respond in either
order, so we need to handle responses both ways.

Also fixes an issue where some generated blob transactions didn't have
any blobs.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-10-08 19:23:44 +02:00
Nicolas Gotchac
064ab701ea
eth/protocols/eth: use BlockChain interface in Handshake (#32847) 2025-10-08 12:50:03 +02:00
sashass1315
168d699fba
core/rawdb: remove duplicated type storedReceiptRLP (#32820)
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
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-10-08 11:29:51 +02:00
Felix Lange
d67037a981
cmd/devp2p/internal/ethtest: update to PoS-only test chain (#32850) 2025-10-08 11:14:27 +02:00
Sina M
ee309827c6
build: faster gh actions workflow, no ubuntu on appveyor (#32829)
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 does a few things:

- Sets the gh actions runner sizes for lint (s) and test (l) workflows
- Runs the tests on gh actions in parallel
- Skips fetching the spec tests when unnecessary (on windows in
appveyor)
- Removes ubuntu appveyor runner since it's essentially duplicate of the
gh action workflow now

The gh test seems to go down from ~35min to ~13min.
2025-10-07 11:24:30 +02:00
Nikita Mescheryakov
477ee5873b
internal/ethapi: add timestamp to logs in eth_simulate (#32831)
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
Adds blockTimestamp to the logs in response of eth_simulateV1.

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-10-06 18:19:25 +02:00
hero5512
1e4b39ed12
trie: cleaner array concatenation (#32756)
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
It uses the slices.Concat and slices.Clone methods available now in Go.
2025-10-02 17:32:20 +02:00
Csaba Kiraly
4927e89647
p2p/enode: fix asyncfilter comment (#32823)
just finisher the sentence

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-10-02 17:27:35 +02:00
hero5512
fc8c8c1314
core: refactor StateProcessor to accept ChainContext interface (#32739)
This pr implements https://github.com/ethereum/go-ethereum/issues/32733
to make StateProcessor more customisable.

## Compatibility notes

This introduces a breaking change to users using geth EVM as a library.
The `NewStateProcessor` function now takes one parameter which has the
chainConfig embedded instead of 2 parameters.
2025-10-02 14:34:06 +02:00
zzzckck
f0dc47aae3
p2p/enode: fix discovery AyncFilter deadlock on shutdown (#32572)
Description:
We found a occasionally node hang issue on BSC, I think Geth may
also have the issue, so pick the fix patch here.
The fix on BSC repo: https://github.com/bnb-chain/bsc/pull/3347

When the hang occurs, there are two routines stuck.
- routine 1: AsyncFilter(...)
On node start, it will run part of the DiscoveryV4 protocol, which could
take considerable time, here is its hang callstack:
```
goroutine 9711 [chan receive]:  // this routine was stuck on read channel: `<-f.slots`
github.com/ethereum/go-ethereum/p2p/enode.AsyncFilter.func1()
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:206 +0x125
created by github.com/ethereum/go-ethereum/p2p/enode.AsyncFilter in goroutine 1
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:192 +0x205

```

- Routine 2: Node Stop
It is the main routine to shutdown the process, but it got stuck when it
tries to shutdown the discovery components, as it tries to drain the
channel of `<-f.slots`, but the extra 1 slot will never have chance to
be resumed.
```
goroutine 11796 [chan receive]: 
github.com/ethereum/go-ethereum/p2p/enode.(*asyncFilterIter).Close.func1()
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:248 +0x5c
sync.(*Once).doSlow(0xc032a97cb8?, 0xc032a97d18?)
	sync/once.go:78 +0xab
sync.(*Once).Do(...)
	sync/once.go:69
github.com/ethereum/go-ethereum/p2p/enode.(*asyncFilterIter).Close(0xc092ff8d00?)
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:244 +0x36
github.com/ethereum/go-ethereum/p2p/enode.(*bufferIter).Close.func1()
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:299 +0x24
sync.(*Once).doSlow(0x11a175f?, 0x2bfe63e?)
	sync/once.go:78 +0xab
sync.(*Once).Do(...)
	sync/once.go:69
github.com/ethereum/go-ethereum/p2p/enode.(*bufferIter).Close(0x30?)
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:298 +0x36
github.com/ethereum/go-ethereum/p2p/enode.(*FairMix).Close(0xc0004bfea0)
	github.com/ethereum/go-ethereum/p2p/enode/iter.go:379 +0xb7
github.com/ethereum/go-ethereum/eth.(*Ethereum).Stop(0xc000997b00)
	github.com/ethereum/go-ethereum/eth/backend.go:960 +0x4a
github.com/ethereum/go-ethereum/node.(*Node).stopServices(0xc0001362a0, {0xc012e16330, 0x1, 0xc000111410?})
	github.com/ethereum/go-ethereum/node/node.go:333 +0xb3
github.com/ethereum/go-ethereum/node.(*Node).Close(0xc0001362a0)
	github.com/ethereum/go-ethereum/node/node.go:263 +0x167
created by github.com/ethereum/go-ethereum/cmd/utils.StartNode.func1.1 in goroutine 9729
	github.com/ethereum/go-ethereum/cmd/utils/cmd.go:101 +0x78
```

The rootcause of the hang is caused by the extra 1 slot, which was
designed to make sure the routines in `AsyncFilter(...)` can be
finished. This PR fixes it by making sure the extra 1 shot can always be
resumed when node shutdown.
2025-10-02 12:43:31 +02:00
Martin HS
057667151b
core/types, trie: reduce allocations in derivesha (#30747)
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 to #30746, potential follow-up to #30743 . This PR makes the
stacktrie always copy incoming value buffers, and reuse them internally.

Improvement in #30743:
```
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)

```
This PR further enhances that: 

```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
                          │ derivesha.2  │          derivesha.3           │
                          │    sec/op    │    sec/op     vs base          │
DeriveSha200/stack_trie-8   430.0µ ± 12%   423.6µ ± 13%  ~ (p=0.739 n=10)

                          │  derivesha.2  │             derivesha.3              │
                          │     B/op      │     B/op      vs base                │
DeriveSha200/stack_trie-8   25.654Ki ± 0%   4.960Ki ± 0%  -80.67% (p=0.000 n=10)

                          │ derivesha.2 │            derivesha.3             │
                          │  allocs/op  │ allocs/op   vs base                │
DeriveSha200/stack_trie-8   232.00 ± 0%   37.00 ± 0%  -84.05% (p=0.000 n=10)
```
So the total derivesha-improvement over *both PRS* is: 
```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/types
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
                          │ derivesha.1 │             derivesha.3              │
                          │   sec/op    │    sec/op     vs base                │
DeriveSha200/stack_trie-8   477.8µ ± 2%   423.6µ ± 13%  -11.33% (p=0.015 n=10)

                          │  derivesha.1  │             derivesha.3              │
                          │     B/op      │     B/op      vs base                │
DeriveSha200/stack_trie-8   45.171Ki ± 0%   4.960Ki ± 0%  -89.02% (p=0.000 n=10)

                          │ derivesha.1  │            derivesha.3             │
                          │  allocs/op   │ allocs/op   vs base                │
DeriveSha200/stack_trie-8   1259.00 ± 0%   37.00 ± 0%  -97.06% (p=0.000 n=10)
```

Since this PR always copies the incoming value, it adds a little bit of
a penalty on the previous insert-benchmark, which copied nothing (always
passed the same empty slice as input) :

```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/trie
cpu: 12th Gen Intel(R) Core(TM) i7-1270P
             │ stacktrie.7  │          stacktrie.10          │
             │    sec/op    │    sec/op     vs base          │
Insert100K-8   88.21m ± 34%   92.37m ± 31%  ~ (p=0.280 n=10)

             │ stacktrie.7  │             stacktrie.10             │
             │     B/op     │     B/op      vs base                │
Insert100K-8   3.424Ki ± 3%   4.581Ki ± 3%  +33.80% (p=0.000 n=10)

             │ stacktrie.7 │            stacktrie.10            │
             │  allocs/op  │ allocs/op   vs base                │
Insert100K-8    22.00 ± 5%   26.00 ± 4%  +18.18% (p=0.000 n=10)
```

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-10-01 10:05:49 +02:00
Zach Brown
1487a8577d
params: fix banner message (#32796)
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-09-30 19:33:36 +08:00
Zach Brown
bb00d26bbe
signer/core: fix error message in test (#32807) 2025-09-30 19:31:42 +08:00
Zach Brown
f9756bb885
p2p: fix error message in test (#32804) 2025-09-30 19:30:47 +08:00
Yuan-Yao Sung
9986270fbf
eth/catalyst: extend payloadVersion support to osaka/post-osaka forks (#32800)
This PR updates the `payloadVersion` function in `simulated_beacon.go`
to handle additional following forks used during development and testing
phases after Osaka.

This change ensures that the simulated beacon correctly resolves the
payload version for these forks, enabling consistent and valid execution
payload handling during local testing or simulation.
2025-09-30 19:30:10 +08:00
Guillaume Ballet
6f8e28b4aa
go.mod, cmd/keeper/go.mod: upgrade victoria metrics dependency (#32720)
This is required for geth to compile to WASM.
2025-09-30 12:50:20 +02:00
Galoretka
2037c53e7a
core/state: correct expected value in TestMessageCallGas (#32780)
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-09-30 10:11:09 +08:00
MozirDmitriy
c1e9d78f1f
core/txpool: remove unused signer field from TxPool (#32787)
The TxPool.signer field was never read and each subpool (legacy/blob)
maintains its own signer instance. This field remained after txpool
refactoring into subpools and is dead code. Removing it reduces
confusion and simplifies the constructor.
2025-09-30 10:07:54 +08:00
rjl493456442
01d0ce0bf1
params: add blob config information in the banner (#32771)
Extend the chain banner with blob config information.

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-30 10:05:43 +08:00
futreall
891bbad9ce
params: implement String() method for ChainConfig (#32766)
Some checks are pending
/ Windows Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Docker Image (push) Waiting to run
Fixes issue #32762 where ChainConfig logging displays pointer addresses
instead of actual timestamp values for fork activation times.

Before: ShanghaiTime:(*uint64)(0xc000373fb0),
CancunTime:(*uint64)(0xc000373fb8)
After: ShanghaiTime: 1681338455, CancunTime: 1710338135, VerkleTime: nil

The String() method properly dereferences timestamp pointers and handles
nil values for unset fork times, making logs more readable and useful
for debugging chain configuration issues.

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-29 21:09:03 +08:00
VolodymyrBg
1cfe624d03
core/rawdb: update comments (#32668)
- Replace outdated NewFreezer doc that referenced map[string]bool/snappy
toggle with accurate description of -map[string]freezerTableConfig
(noSnappy, prunable).
- Fix misleading field comment on freezerTable.config that spoke as if
it were a boolean (“if true”), clarifying it’s a struct and noting
compression is non-retroactive.
2025-09-29 14:45:00 +02:00
lightclient
ea28346f91
params: fix bpo config comments (#32755)
Looks like we forgot to update names when copying.
2025-09-29 13:44:04 +02:00
CPerezz
46b7e78cc0
cmd/evm/internal/t8ntool: panic on database corruption (#32776)
These functions were previously ignoring the error returned by both
`statedb.Commit()` and the subsequent `state.New()`,
which could silently fail and cause panics later when the `statedb` is
used.
This change adds proper error checking and panics with a descriptive
error
message if state creation fails.

While unlikely in normal operation, this can occur if there are database
corruption issues or if invalid root hashes are provided, making
debugging
significantly easier when such issues do occur.

This issue was encountered and fixed in
https://github.com/gballet/go-ethereum/pull/552
where the error handling proved essential for debugging

cc: @gballet as this was discussed in a call already.
2025-09-29 12:51:46 +02:00
GarmashAlex
4b080208ea
internal/ethapi: remove redundant check in test (#32760)
Removes a redundant check in TestCreateAccessListWithStateOverrides
2025-09-29 12:31:00 +02:00
VolodymyrBg
c5a1c35cfb
trie: fix error message in test (#32772)
Fixes an error message in TestReplication
2025-09-29 12:23:43 +02:00
Delweng
265db06242
eth/catalyst: check osaka in engine_getBlobsV1 (#32731)
ref
https://github.com/ethereum/execution-apis/blob/main/src/engine/osaka.md#cancun-api

> Client software MUST return -38005: Unsupported fork error if the
Osaka fork has been activated.

---------

Signed-off-by: Delweng <delweng@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-29 11:56:39 +02:00
cui
943a30d1ee
build: remove duplicated func FileExist (#32768)
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-09-29 10:17:47 +08:00
Marius van der Wijden
b19452dc11
params: add amsterdam fork config (#32687)
Some checks failed
/ Linux Build (arm) (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Adds Amsterdam as fork config option.

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-26 15:39:22 -06:00
Dragan Milic
c984d9086e
eth/tracers/native: add keccak256preimage tracer (#32569)
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
Introduces a new tracer which returns the preimages
of evm KECCAK256 hashes.

See #32570.

---------

Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-09-26 18:05:27 +02:00
MozirDmitriy
8e87b7539b
trie: correct error messages for UpdateStorage operations (#32746)
Fix incorrect error messages in TestVerkleTreeReadWrite and TestVerkleRollBack functions.
2025-09-26 07:47:58 -06:00
VolodymyrBg
16b735fddd
signer/core: fix TestSignTx to decode res2 (#32749)
Decode the modified transaction and verify the value differs from original.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-26 07:26:22 -06:00
Matus Kysel
2e2fece0bb
ethapi: reject oversize storage keys before hex decode (#32750)
Bail out of decodeHash when the raw hex string is longer than 32 byte before actually decoding.
---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-26 07:12:28 -06:00
wit liu
a8f7965d58
internal/ethapi: fix outdated comments (#32751)
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
Fix outdated comments
2025-09-26 06:11:50 -06:00
Felix Lange
b1eb33ce8b version: begin v1.16.5 release cycle 2025-09-26 11:41:02 +02:00
Felix Lange
b964b6574f version: release go-ethereum v1.16.4 stable 2025-09-25 18:19:45 +02:00
Felix Lange
0977a02ec1
params: schedule Osaka/BPO1/BPO2 for testnets (#32735)
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
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
2025-09-25 18:07:33 +02:00
cui
7d8ccddaac
all: refactor to use builtin max/min (#32694)
Replaces the last few instances of `math.Max` and `math.Min` with go builtins.
2025-09-25 07:05:27 -06:00
Delweng
bacc1504ba
core/txpool: add eip2681 check for incoming transactions (#32726)
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-09-25 13:15:12 +02:00
Felix Lange
ad484fcbd0
build: upgrade to execution-spec-tests v5.1.0 (#32742)
https://github.com/ethereum/execution-spec-tests/releases/tag/v5.1.0
2025-09-25 13:14:28 +02:00
Csaba Kiraly
89158aa64e
core/txpool/blobpool: convert and add one-by-one (#32718)
This is a small improvement on #32656 in case Add was called with
multiple type 3 transactions, adding transactions to the pool one-by-one
as they are converted.

Announcement to peers is still done in a batch.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-09-25 10:27:23 +02:00
lightclient
965ffff9ac
all: add bpo1 and bpo2 overrides (#32737)
This adds overrides to the cli for BPO1 and BPO2.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-09-25 10:21:41 +02:00
hero5512
7611f351c1
accounts/abi/bind: fix data race in TestWaitDeployedCornerCases (#32740)
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 race in WaitDeploy test where the backend is closed before goroutine using it wraps up.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-24 20:05:14 -06:00
viktorking7
1c706d1571
accounts/keystore: use ticker to avoid timer allocations (#32732)
Replace time.After with a long‑lived time.Ticker in KeyStore.updater, preventing per‑iteration timer allocations and potential timer buildup.

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-24 19:47:55 -06:00
radik878
7ed17f1933
trie: fix TestOneElementProof expected value message (#32738)
- Correct the error message in TestOneElementProof to expect 'v' instead
of 'k'.
- The trie is updated with key "k" and value "v"; on mismatch the
expected value must be 'v'.
- Aligns the message with the actual test logic and other similar checks
in this file, reducing confusion during test failures. No behavioral
changes.
2025-09-24 18:57:01 -06:00
Felix Lange
ad55a3e07f
core/txpool/blobpool: fork boundary conversion 3 (#32716)
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 implements the conversion of existing blob transactions to the new proof 
version. Conversion is triggered at the Osaka fork boundary. The conversion is 
designed to be idempotent, and may be triggered multiple times in case of a reorg 
around the fork boundary. 

This change is the last missing piece that completes our strategy for the blobpool 
conversion. After the Osaka fork,

- new transactions will be converted on-the-fly upon entry to the pool
- reorged transactions will be converted while being reinjected
- (this change) existing transactions will be converted in the background

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-24 20:03:17 +02:00
Felix Lange
bc451546ae
miner: default gaslimit 60M (#32734) 2025-09-24 19:41:33 +02:00
Felix Lange
15a94b4331
build: module-aware FindMainPackages (#32736)
This fixes `go run build/ci.go install`. It was failing because we
resolved all main packages by parsing sources, which fails when the
source directory contains multiple modules.
2025-09-24 19:40:49 +02:00
VolodymyrBg
48c74f4593
trie: align AllFFPrefix test assertion and message (#32719)
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-09-24 10:36:56 +08:00
Nikita Mescheryakov
4074f745bd
internal/ethapi: fix merge transition in eth_simulate (#32616)
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 fixes the fork detection of `eth_simulateV1`, particularly
for networks that are post-merge since genesis, like Hoodi.
2025-09-23 20:00:16 +02:00
cui
1cd004871b
accounts/keystore: use runtime.AddCleanup (#32610) 2025-09-23 14:49:15 +02:00
rjl493456442
8dfd30fdd1
core/txpool/blobpool: add legacy sidecar conversion in reinject (#32688)
This adds the conversion for the legacy sidecar if these
transactions are reorged out after the osaka.
2025-09-23 14:45:36 +02:00
Bhargava Shastry
2b5718fe92
cmd/evm/internal/t8ntool: fix nil pointer dereference in Osaka blob gas calculation (#32714)
The parent header was missing the BaseFee field when calculating the
reserve price for EIP-7918 in the Osaka fork, causing a nil pointer
dereference. This fix ensures BaseFee is properly set from ParentBaseFee
in the environment.

Added regression test case 34 to verify Osaka fork blob gas calculation
works correctly with parent base fee.
2025-09-23 14:39:44 +02:00
MozirDmitriy
2872242045
cmd/era: fix iterator error source handling in checkAccumulator (#32698)
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 change replaces wrapping a stale outer err with the iterator’s own
error after Next(), and switches the post-BlockAndReceipts() check to
use the returned err. According to internal/era iterator contract,
Error() should be consulted immediately after Next() to surface
iteration errors, while decoding errors from Block/Receipts are returned
directly. The previous code could hide the real failure (using nil or
unrelated err), leading to misleading diagnostics and missed iteration
errors.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-22 14:27:54 -06:00
Felix Lange
1597d58fae
go.work, build: remove workspace file (#32699)
https://go.dev/ref/mod#go-work-file advises against checking `go.work`
files because they can interfere with local development. We added the
workspace file in order to make `go test` and other tools work across
multiple modules. But it seems to cause weird issues with the
`go.work.sum` file being modified, etc.

So with this PR, we instead run all the `ci.go` commands for all modules
in the workspace manually.
2025-09-22 22:20:47 +02:00
rjl493456442
aa37bd063d
cmd, tests: fix snapshot dump and export-preimages (#32650)
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
Address #32646
2025-09-22 14:48:18 +08:00
rjl493456442
ada2db4304
triedb/pathdb: move head truncation log (#32649)
Print the `Truncating from head` log only if head truncation is needed.
2025-09-22 14:45:15 +08:00
GarmashAlex
479b8031dc
core/state: fix committed-state expectations in StateDB tests (#32678)
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-09-22 10:30:29 +08:00
lightclient
4414e2833f
go.work.sum: add to repo (#32677)
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
2025-09-20 09:32:21 +02:00
rjl493456442
684f0db4a2
core/txpool/blobpool: introduce sidecar conversion for legacy blob transactions (#32656)
This pull request introduces a queue for legacy sidecar conversion to
handle transactions that persist after the Osaka fork. Simply dropping 
these transactions would significantly harm the user experience.

To balance usability with system complexity, we have introduced a
conversion time window of two hours post Osaka fork. During this period, 
the system will accept legacy blob transactions and convert them in a 
background process.

After the window, all legacy transactions will be rejected. Notably, all
the blob transactions will be validated statically before the conversion, 
and also all conversion are performed in a single thread, minimize the risk 
of being DoS.

We believe this two hour window provides sufficient time to process
in-flight legacy transactions and allows submitters to migrate to the 
new format.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-20 10:19:55 +08:00
lightclient
fd65f56031
params: update config description links to new format (#32681)
A PR in the specs repo broke our existing links:
https://github.com/ethereum/execution-specs/pull/1416

This PR fixes it and adds the Prague and Osaka specs.
2025-09-20 09:45:11 +08:00
MozirDmitriy
b62e0348e0
core/rawdb: fix bad blocks sorted failure message to map index→number correctly (#32627)
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
Fix the t.Fatalf format arguments in TestBadBlockStorage to match the
intended #index output. Previously, the left number used i+1 and the
right index used the block number, producing misleading diagnostics.
Correct mapping improves test failure clarity and debuggability.
2025-09-19 17:23:50 -06:00
Zach Brown
f770ec1ffc
common, eth: remove duplicate test cases (#32624)
Remove redundant duplicate test vectors. The two entries were identical
and back-to-back, providing no additional coverage while adding noise.
Keeping a single instance maintains test intent and clarity without
altering behavior.
2025-09-19 17:20:44 -06:00
Gengar
c7eb37608b
fix: correct typo in TestMustParseUint64Panic error message (#32648)
Fix typo in test error message where "MustParseBig" was incorrectly 
used instead of "MustParseUint64" in the TestMustParseUint64Panic 
function. 

The test still functions correctly, but now the error message 
accurately reflects the function being tested.
2025-09-19 17:13:58 -06:00
cui
a499a11a16
crypto: using testing.B.Loop (#32645)
before:
go test -run=^$ -bench=. ./crypto/... 94.83s user 2.68s system 138% cpu
1:10.55 tota

after:
go test -run=^$ -bench=. ./crypto/... 75.43s user 2.58s system 123% cpu
1:03.01 total
2025-09-19 17:12:41 -06:00
cui
e35c628656
core/types: using testing.B.Loop (#32643)
before:
go test -run=^$ -bench=. ./core/types 47.80s user 2.18s system 102% cpu
48.936 tota

after:
go test -run=^$ -bench=. ./core/types 42.42s user 2.27s system 112% cpu
39.593 total
2025-09-19 17:11:32 -06:00
cui
79a4f76b03
core/vm: using testing.B.Loop (#32660)
before:
go test -run=^$ -bench=. ./core/vm/... -timeout=1h 1841.87s user 40.96s
system 124% cpu 25:15.76 total
after:
go test -run=^$ -bench=. ./core/vm/... -timeout=1h 1588.65s user 33.79s
system 123% cpu 21:53.25 total

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-19 17:06:55 -06:00
cui
0758a561d6
core: using testing.B.Loop (#32662)
Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-19 17:06:27 -06:00
cui
9b1896bfb5
log: using testing.B.Loop (#32663)
before:
go test -run=^$ -bench=. ./log -timeout=1h 12.19s user 2.19s system 89%
cpu 16.025 total
after:
go test -run=^$ -bench=. ./log -timeout=1h 10.64s user 1.53s system 89%
cpu 13.607 total

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-19 17:05:21 -06:00
cui
3ebb1431d3
eth: using testing.B.Loop (#32657)
before:
go test -run=^$ -bench=. ./eth/... 827.57s user 23.80s system 361% cpu
3:55.49 total

after:
go test -run=^$ -bench=. ./eth/... 281.62s user 13.62s system 245% cpu
2:00.49 total
2025-09-19 17:00:29 -06:00
cui
d41dc92da9
core/state: using testing.B.Loop (#32658)
before:
go test -run=^$ -bench=. ./core/state/... 120.85s user 7.96s system 129%
cpu 1:39.13 tota

after:
go test -run=^$ -bench=. ./core/state/... 21.32s user 2.12s system 97%
cpu 24.006 total
2025-09-19 16:57:43 -06:00
cui
64c6de7747
p2p: using testing.B.Loop (#32664) 2025-09-19 16:38:36 -06:00
Csaba Kiraly
1601f398d4
core/txpool/blobpool: remove conversion in GetBlobs (#32578)
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 disables blob proof conversion in `GetBlobs` by default, making it
conditional.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-19 16:21:15 +02:00
Marius van der Wijden
103b8b2ec5
crypto/bn256: switch to gnark again (#32659)
We recently update our default implementation to gnark in
https://github.com/ethereum/go-ethereum/pull/32024
Then we found a consensus issue and reverted it in
65d77c5129
We fixed the consensus issue and have been fuzzing it more since then in
https://github.com/ethereum/go-ethereum/pull/32055/files
https://github.com/ethereum/go-ethereum/pull/32065
https://github.com/ethereum/go-ethereum/pull/32055/files

So I think now is the time to update it back to gnark
2025-09-19 15:18:42 +02:00
Galoretka
9b730e1997
core/state: add missing address key in state_object log (#32676) 2025-09-19 21:13:32 +08:00
Felföldi Zsolt
b08b629818
beacon/blsync: test validated finality (#32633)
This PR improves `TestBlockSync` so that it also tests the finality
update validation.

Note: to this date four long and complex (at least partly AI generated)
PRs arrived that did something related to testing finality but honestly
we do not need a bloated "comprehensive" test to test a trivial feature
because maintaining these tests can also be a pain over the long term.
This PR adds some sufficient sanity checks to detect if finality ever
gets broken by a future change.
2025-09-19 14:07:10 +02:00
Felix Lange
2b3d617e04
internal/ethapi: skip tx gas limit check for calls (#32641)
This disables the tx gaslimit cap for eth_call and related RPC operations.

I don't like how this fix works. Ideally we'd be checking the tx
gaslimit somewhere else, like in the block validator, or any other place
that considers block transactions. Doing the check in StateTransition
means it affects all possible ways of executing a message.

The challenge is finding a place for this check that also triggers
correctly in tests where it is wanted. So for now, we are just combining
this with the EOA sender check for transactions. Both are disabled for
call-type messages.
2025-09-19 13:29:17 +02:00
Klimov Sergei
b9e2eb5944
beacon/config: fix LoadForks with non-string values (#32609)
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 a crash when loading the beacon chain config if new fields like
`BLOB_SCHEDULE: []` are present.
Previously, the config loader assumed all values were strings, causing
errors such as:

```
Fatal: Could not load beacon chain config '/network-configs/config.yaml': failed to parse beacon chain config file: yaml: unmarshal errors:
line 242: cannot unmarshal !!seq into string
```

This PR updates the parsing logic to handle non-string values correctly
and adds explicit validation for fork fields.
2025-09-19 01:30:00 +02:00
Long Vu
dce511c1e5
eth/filters, cmd: add config of eth_getLogs address limit (#32327)
Add cli configurable limit for the number of addresses allowed in
eth_getLogs filter criteria:
https://github.com/ethereum/go-ethereum/issues/32264
 
 Key changes:
- Added --rpc.getlogmaxaddrs CLI flag (default: 1000) to configure the
maximum number of addresses
- Updated ethconfig.Config with FilterMaxAddresses field for
configuration management
- Modified filter system to use the configurable limit instead of the
hardcoded maxAddresses constant
- Enhanced test coverage with new test cases for address limit
validation
- Removed hardcoded validation from JSON unmarshaling, moving it to
runtime validation

Please notice that I remove the check at FilterCriteria UnmarshalJSON
because the runtime config can not pass into this validation.

Please help review this change!

---------

Co-authored-by: zsfelfoldi <zsfelfoldi@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-19 00:53:40 +02:00
rjl493456442
2a82964727
eth/catalyst, beacon/engine: enable BPO and Osaka on stateless APIs (#32636)
Addresses https://github.com/ethereum/go-ethereum/issues/32630

This pull request enables the stateless engine APIs for Osaka and the
following BPOs. Apart from that, a few more descriptions have been added
in the engine APIs, making it easier to follow the spec change.
2025-09-19 00:16:01 +02:00
Felix Lange
ab95477a65
build: update to execution-spec-tests v5.0.0 (#32592)
https://github.com/ethereum/execution-spec-tests/releases/tag/v5.0.0

As of this release, execution-spec-tests also contains all state tests
that were previously in ethereum/tests. We can probably remove the tests
submodule now. However, this would mean we are missing the pre-cancun
tests. Still need to figure out how to resolve this.

---------

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2025-09-18 22:58:40 +02:00
GarmashAlex
8a171dce1f
core/rawdb: report truncateErr in concurrent truncate failure (#32651)
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-09-18 14:46:51 +08:00
lightclient
339cae81d8
core: fix fork readiness log (#32623)
When I implemented in #31340 I didn't expect multiple forks to be
configured at once, but this is exactly how BPOs are defined. This
updates the method to determine the next scheduled fork rather than the
last fork.
2025-09-18 06:28:03 +02:00
Guillaume Ballet
6492751355
cmd/keeper: disable GC for zkvm execution (#32638)
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
ZKVMs are constrained environments that liberally allocate memory and
never release it. In this context, using the GC is only going to cause
issues down the road, and slow things down in any case.
2025-09-17 16:12:16 +02:00
Samuel Arogbonlo
fda09c7b1b
trie: add sub-trie iterator support (#32520)
- Adds `NodeIteratorWithPrefix()` method to support iterating only nodes
within a specific key prefix
- Adds `NodeIteratorWithRange()` method to support iterating only nodes
within a specific key range

Current `NodeIterator` always traverses the entire remaining trie from a
start position. For non-ethereum applications using the trie implementation, 
there's no way to limit iteration to just a subtree with a specific prefix.

  **Usage:**

  ```go
  // Only iterate nodes with prefix "key1"
  iter, err := trie.NodeIteratorWithPrefix([]byte("key1"))
  ```

Testing: Comprehensive test suite covering edge cases and boundary conditions.

Closes #32484

---------

Co-authored-by: gballet <guillaume.ballet@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-09-17 22:07:02 +08:00
rjl493456442
21769f3474
triedb/pathdb: generalize the history indexer (#32523)
This pull request is based on #32306 , is the second part for shipping
trienode history.

Specifically, this pull request generalize the existing index mechanism,
making is usable
by both state history and trienode history in the near future.
2025-09-17 15:57:16 +02:00
Guillaume Ballet
2d3704c4d8
core/stateless: add vmwitnessstats cli flag to report leaf stats + log to console (#32619)
The format that is currently reported by the chain isn't very useful, as
it gives an average for ALL the nodes, and not only the leaves, which
skews the results.

Also, until now there was no way to activate the reporting of errors.

We also decided that metrics weren't the right tool to report this data,
so we decided to dump it to the console if the flag is enabled. A better
system should be built, but for now, printing to the logs does the job.
2025-09-17 15:06:39 +02:00
Marius van der Wijden
f6ba50bf48
go.mod: update go-eth-kzg (#32640)
Updates go-eth-kzg:
https://github.com/crate-crypto/go-eth-kzg/releases/tag/v1.4.0
2025-09-17 12:33:44 +02:00
Marius van der Wijden
5ae61f9627
go.mod: update c-kzg (#32639)
Updates c-kzg to the latest release:
https://github.com/ethereum/c-kzg-4844/releases/tag/v2.1.3
2025-09-17 11:41:14 +02:00
Csaba Kiraly
a4c9b34730
p2p/discover: add waitForNodes
This improves the latency of lookups in small networks and test setups. When the local node table runs empty, the lookupIterator will trigger refresh to try and fill the table again.

The behaviour of lookup in case of an empty table is changed:
- Previously, lookup waited fixed 1 second before trying to continue the lookup
- Now, lookup on an empty table returns immediately, and a better wait implementation is part of the LookupIterator. It reinitialises the table, and continues the interator as soon as a node becomes available.
2025-09-17 10:27:35 +02:00
Csaba Kiraly
de9fb9722b
revert to using table parameter
using it.lookup.tab inside is unsafe

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-09-17 09:04:41 +02:00
Felix Lange
6a7f64e760
core/vm: use go-bigmodexpfix for modexp (#32576)
Some checks are pending
/ Windows Build (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Docker Image (push) Waiting to run
This changes the modexp precompile to use a fork of math/big with some
patches by @GottfriedHerold to improve worst-case performance.
2025-09-16 17:08:04 +02:00
Guillaume Ballet
03b77d1a49
core/stateless: API methods to get execution witness of block
This PR adds a new RPC call, which re-executes a block with stateless
mode activated, so that the witness data are collected and returned.

They are `debug_executionWitnessByHash` which takes in a block hash
and `debug_executionWitness` which takes in a block number.

---------

Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
2025-09-16 14:46:28 +02:00
VolodymyrBg
110b4e13c5
core/rawdb: fix typo in TestWriteAncientHeaderChain (#32587) 2025-09-16 20:27:20 +08:00
Csaba Kiraly
3589c0d59b
p2p/discover: expose timeout in lookupFailed
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>

# Conflicts:
#	p2p/discover/lookup.go
2025-09-16 14:03:11 +02:00
VolodymyrBg
b340103e9d
core/tracing: remove unnecessary 'copy' field skip in TestAllHooksCalled (#32622)
This test iterated over Hooks fields and skipped a field named copy. The
Hooks struct has no such field, making the condition dead code.
2025-09-16 19:58:37 +08:00
Felix Lange
e48242bb69
cmd/evm/internal/t8ntool: use ApplyTransaction instead of ApplyMessage (#32618)
ApplyTransaction calls the hooks and builds the receipt, so some
duplicated code can be removed from t8ntool. Test cases have been
changed to add the `blockNumber` and `blockHash` in receipts, since
they were previously not filled in.
2025-09-16 10:09:06 +02:00
Guillaume Ballet
b05fe4aa64
cmd/keeper: add the keeper zkvm guest program (#32543)
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
Keeper is a zmvm guest program that runs the block transition.
It relies on the zkvm maker implementing `getInput`. For now, we only
provide a single implementation for the 'ziren' VM.

Why keeper?

In the _Mass Effect_ lore, the keepers are animals (?) who maintain the
citadel. Nothing is known from them, and attempts at tampering with them
have failed, as they self-destruct upon inquiry. They have a secret,
nefarious purpose that is only revealed later in the game series, don't
want any spoilers so I didn't dig deeper. All in all, a good metaphor
for zkvms.

---------

Co-authored-by: weilzkm <140377101+weilzkm@users.noreply.github.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-15 19:47:41 +02:00
Mark
89f364f7ed
go.mod: add tool section in module file (#32598)
This removes the tools.go workaround in favor of the official
tool management infrastructure, which was added in Go 1.24.
2025-09-15 18:46:18 +02:00
Felix Lange
6924eeaee0
eth/catalyst: allow fcuV3 for BPO forks (#32615)
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 fixes an issue with the engine API after BPO forks have passed.
2025-09-15 16:26:09 +02:00
radik878
791e9fb23a
rlp: remove duplicate optionalAndTailField test case (#32614) 2025-09-15 16:16:06 +02:00
Marius van der Wijden
df0bd8960c
core/txpool/blobpool: migrate billy to new slot size (#31966)
Implements a migration path for the blobpool slotter

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-09-15 21:34:57 +08:00
Csaba Kiraly
4824942b97
core/txpool/blobpool: filter blob txs with sidecar version (#32577)
As a consequence of moving blob sidecar version migration code around,
we ended up building blocks with a mix of v0 and v1 blob transactions 
(different proof encoding in the sidecar).

This PR makes sure we are not building illegal blocks after Osaka. Blob 
migration is left for another PR.

Related issues and PRs:
- https://github.com/ethereum/go-ethereum/pull/31791
- https://github.com/ethereum/go-ethereum/pull/32347
- https://github.com/ethereum/go-ethereum/pull/31966
- https://github.com/ethereum/go-ethereum/issues/32235

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-09-15 20:48:59 +08:00
Galoretka
ec99444804
core/overlay: copy BaseRoot in TransitionState.Copy (#32613)
This change ensures TransitionState.Copy preserves BaseRoot. During a
Verkle transition, ts.BaseRoot is required to construct the overlay MPT
when ts.InTransition() is true. Previously, copies dropped BaseRoot,
risking an invalid zero-hash base trie and inconsistent behavior.
2025-09-15 15:26:16 +08:00
radik878
c2fcc27132
core/rawdb: fix misleading comment in HasTrieNode (#32599)
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-09-15 10:45:50 +08:00
hero5512
a3062390f7
core/filtermaps: use slices.Sort to remove duplicated elements (#32602) 2025-09-15 10:42:14 +08:00
Antonio Viggiano
41f580f209
core/vm: fix typo in CLZ doc (#32604)
Some checks failed
/ Windows Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Docker Image (push) Has been cancelled
Fixes typo in CLZ doc.
2025-09-12 11:06:57 -06:00
Felix Lange
0643427965 p2p/discover: continue 2025-09-12 12:50:07 +02:00
Mobin Mohanan
5d09aa316f
accounts/abi/bind/v2: add Address method to BoundContract (#32559)
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-09-12 12:14:47 +02:00
Felix Lange
68c18ede06
Update lookup.go 2025-09-12 11:34:44 +02:00
Csaba Kiraly
97afa2815b
Revert "p2p/discover: add test for lookup returning immediately"
This reverts commit 3eab4616a6.
2025-09-12 11:29:43 +02:00
Guillaume Ballet
25d6596cd5
.github: remove redundant regexp check for heading dot (#32597) 2025-09-12 11:08:47 +02:00
Csaba Kiraly
3eab4616a6
p2p/discover: add test for lookup returning immediately
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-09-12 10:59:29 +02:00
Csaba Kiraly
72d3e881b3
p2p/discover: clarify lookup behavior on empty table
We have changed this behavior, better clarify in comment.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-09-12 10:52:53 +02:00
lightclient
8a19582c8d
eth/catalyst: enable newpayloadV4 on BPOs (#32589)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
Fixes an issue I accidentally introduced in #32579. Essentially, because
we gate the engine methods based on particular forks and I did not add
the BPOs as allowed forks to the method.
2025-09-11 22:09:56 +02:00
Felix Lange
8deb682a35
build: upgrade to go 1.25.1 (#32593) 2025-09-11 20:57:18 +02:00
Felix Lange
1c3703c888
.github: run tests with ci.go (#32590)
`ci.go` is the place to add custom build flags, build tags, etc. for the
test run. So we should use it for CI.
2025-09-11 20:15:51 +02:00
Felix Lange
cbf0b5bc92
go.mod, build: require go 1.24 and upgrade linter (#32584)
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-09-11 13:07:04 +02:00
GarmashAlex
92fbbe63c8
ethdb/pebble: set metric namespace correctly (#32563)
Ensure Database.namespace is initialized in pebble.New(...). Without
this, the write-stall metrics registered in onWriteStallBegin/End are
emitted without the intended namespace prefix, while other Pebble
metrics use the provided constructor parameter. This aligns stall
metrics with the rest of the Pebble metric set and fixes inconsistent
metric naming.

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-11 16:05:17 +08:00
lightclient
046e2cd7a4
params: add bpo forks to eth_config (#32579)
BPO forks should also be included in eth_config response.
2025-09-11 14:18:11 +08:00
Felix Lange
a9f9e0d589 p2p/discover: add imports in test 2025-09-10 20:10:51 +02:00
Felix Lange
3133fd369a p2p/discover: remove print in test 2025-09-10 20:10:51 +02:00
Felix Lange
3946708935 p2p/discover: fix two bugs in lookup iterator
The lookup would add self into the replyBuffer if returned by another node.
Avoid doing that by marking self as seen.

With the changed initialization behavior of lookup, the lookupIterator needs to yield the
buffer right after creation. This fixes the smallNetConvergence test, where all results
are straight out of the local table.
2025-09-10 20:10:51 +02:00
Felix Lange
cf0503da7c p2p/discover: track missing nodes in test 2025-09-10 20:10:51 +02:00
Felix Lange
721c8de738 p2p/discover: trigger refresh in lookupIterator 2025-09-10 20:10:51 +02:00
Felix Lange
e58e7f7927 p2p/discover: fix bug in lookup 2025-09-10 20:10:51 +02:00
Felix Lange
4ed8f5ee2b p2p/discover: improve iterator 2025-09-10 20:10:51 +02:00
Felix Lange
f4046b0cfb p2p/discover: move wait condition to lookupIterator 2025-09-10 20:10:51 +02:00
Felix Lange
f8e0e8dc55 p2p/discover: add context in waitForNodes 2025-09-10 20:10:51 +02:00
Felix Lange
46e4f0b5c1 p2p/discover: add waitForNodes 2025-09-10 20:10:51 +02:00
Csaba Kiraly
1f7f95d718
p2p/discover: remove delay from discv5 RandomNodes (#32517)
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
Refresh is doing some lookups and thus it could block for some time. We
do not want the initializer of an iterator to block. If there is
something blocking, it should happen when calling Next.

Here, next will start a lookup, which will wait if needed (no nodes),
making sure the iterator's Next is not creating a busy loop.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-09-10 19:51:04 +02:00
Zach Brown
b708feb9c3
core/vm: fix comment and remove unused divisor in osakaModexpGas (#32553)
The `divisor` const is not needed in the gas cost calculation in `osakaModexpGas`.
2025-09-10 21:44:18 +08:00
Marius van der Wijden
dd7fe1be4b
core/vm: fix modexp gas calculation (#32568)
fixes a bug in the gas calculation found by oss-fuzz
2025-09-10 21:37:49 +08:00
Marius van der Wijden
d68528cadb
core/txpool: add sanity overflow check (#32544)
Adds a sanity check in the transaction pool

Co-authored-by @rjl493456442
2025-09-10 21:33:15 +08:00
lightclient
586ac9b334
params: use spaces instead of tabs in config description (#32564)
Some checks are pending
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
The tabs aren't consistently spaced with the other items in the
description. This fixes it.
2025-09-10 15:25:25 +08:00
maskpp
5cc443609f
core/txpool/blobpool: disallow legacy sidecar after osaka (#32534)
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 removes the conversion of legacy sidecars after Osaka and instead rejects them to the pool.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-09-09 21:15:47 -06:00
rjl493456442
ca6e2d141b
triedb/pathdb: sync ancient store before journal (#32557)
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 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
2025-09-09 14:39:54 +02:00
VolodymyrBg
5035064421
core/rawdb: improve the test suite for ancient store (#32555)
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-09-09 15:19:50 +08:00
Forostovec
2a3f4cea13
rlp: fix typo in decode test message (#32554)
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-09-09 09:56:53 +08:00
Marius van der Wijden
b381804eb1
core/vm: switch modexp gas computation to uint64 (#32527)
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
supersedes https://github.com/ethereum/go-ethereum/pull/32508/files
and builts on top of https://github.com/ethereum/go-ethereum/pull/32184

looks like a ~60% decrease in allocations / op and ~20% speed increase
(very variable, between 2-200%)

```
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/vm
cpu: Intel(R) Core(TM) Ultra 7 155U
                                                             │ /tmp/old.txt  │             /tmp/new.txt             │
                                                             │    sec/op     │    sec/op     vs base                │
PrecompiledModExp/eip_example1-Gas=13056-14                     23.70µ ±  3%   22.31µ ±  6%   -5.89% (p=0.004 n=10)
PrecompiledModExp/eip_example2-Gas=13056-14                     566.2n ± 12%   267.0n ±  3%  -52.85% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-square-Gas=204-14                 1285.5n ±  3%   995.8n ±  3%  -22.54% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-qube-Gas=204-14                    1.757µ ± 30%   1.410µ ± 16%  -19.75% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-pow0x10001-Gas=3276-14             8.897µ ± 14%   6.664µ ±  2%  -25.10% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-square-Gas=665-14                  2.107µ ±  8%   1.470µ ± 11%  -30.24% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-qube-Gas=665-14                    3.142µ ±  3%   2.289µ ±  7%  -27.16% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-pow0x10001-Gas=10649-14            14.76µ ±  3%   13.59µ ±  4%   -7.94% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-square-Gas=1894-14                 3.984µ ±  3%   3.211µ ±  3%  -19.42% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-qube-Gas=1894-14                   7.572µ ± 12%   6.153µ ±  3%  -18.74% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-pow0x10001-Gas=30310-14            39.07µ ±  7%   37.76µ ±  5%        ~ (p=0.123 n=10)
PrecompiledModExp/nagydani-4-square-Gas=5580-14                 9.613µ ±  2%   9.221µ ±  2%   -4.08% (p=0.003 n=10)
PrecompiledModExp/nagydani-4-qube-Gas=5580-14                   21.66µ ±  5%   21.48µ ± 17%        ~ (p=0.971 n=10)
PrecompiledModExp/nagydani-4-pow0x10001-Gas=89292-14            120.7µ ±  8%   116.0µ ±  3%   -3.93% (p=0.043 n=10)
PrecompiledModExp/nagydani-5-square-Gas=17868-14                23.93µ ±  3%   24.82µ ±  3%   +3.73% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-qube-Gas=17868-14                  54.98µ ±  1%   58.08µ ±  4%   +5.64% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-pow0x10001-Gas=285900-14           340.3µ ±  2%   341.2µ ±  3%        ~ (p=0.529 n=10)
PrecompiledModExpEip2565/eip_example1-Gas=1360-14               21.99µ ±  3%   21.24µ ±  2%   -3.43% (p=0.000 n=10)
PrecompiledModExpEip2565/eip_example2-Gas=1360-14               568.1n ± 12%   221.1n ±  2%  -61.07% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-square-Gas=200-14          1272.0n ±  2%   822.3n ± 13%  -35.35% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-qube-Gas=200-14             1.633µ ±  3%   1.397µ ± 21%  -14.45% (p=0.023 n=10)
PrecompiledModExpEip2565/nagydani-1-pow0x10001-Gas=341-14       7.276µ ±  3%   6.703µ ±  5%   -7.88% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-square-Gas=200-14           1.959µ ±  3%   1.618µ ±  2%  -17.43% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-qube-Gas=200-14             2.959µ ±  6%   2.611µ ±  5%  -11.78% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-pow0x10001-Gas=1365-14      14.99µ ±  5%   13.76µ ±  4%   -8.17% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-square-Gas=341-14           3.870µ ±  4%   3.521µ ±  2%   -9.04% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-qube-Gas=341-14             6.871µ ±  3%   6.454µ ±  3%   -6.07% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-pow0x10001-Gas=5461-14      40.18µ ±  7%   35.55µ ±  3%  -11.52% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-square-Gas=1365-14          9.694µ ±  3%   8.427µ ±  3%  -13.08% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-qube-Gas=1365-14            21.45µ ±  2%   19.48µ ±  7%   -9.18% (p=0.001 n=10)
PrecompiledModExpEip2565/nagydani-4-pow0x10001-Gas=21845-14     118.1µ ±  2%   113.7µ ±  2%   -3.76% (p=0.003 n=10)
PrecompiledModExpEip2565/nagydani-5-square-Gas=5461-14          25.80µ ±  5%   24.05µ ±  3%   -6.76% (p=0.001 n=10)
PrecompiledModExpEip2565/nagydani-5-qube-Gas=5461-14            57.28µ ±  8%   55.76µ ±  6%        ~ (p=0.796 n=10)
PrecompiledModExpEip2565/nagydani-5-pow0x10001-Gas=87381-14     335.2µ ±  2%   346.2µ ±  3%   +3.28% (p=0.000 n=10)
PrecompiledModExpEip2565/marius-1-even-Gas=2057-14              56.24µ ±  3%   55.53µ ±  1%        ~ (p=0.280 n=10)
PrecompiledModExpEip2565/guido-1-even-Gas=2298-14               38.74µ ±  3%   38.63µ ±  6%        ~ (p=0.631 n=10)
PrecompiledModExpEip2565/guido-2-even-Gas=2300-14               61.94µ ±  2%   61.38µ ± 11%        ~ (p=0.529 n=10)
PrecompiledModExpEip2565/guido-3-even-Gas=5400-14               20.27µ ±  2%   20.19µ ±  5%        ~ (p=0.853 n=10)
PrecompiledModExpEip2565/guido-4-even-Gas=1026-14               805.8n ±  3%   359.1n ±  2%  -55.44% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-base-heavy-Gas=200-14         4.717µ ±  5%   3.925µ ±  5%  -16.79% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-exp-heavy-Gas=215-14          15.51µ ±  3%   14.77µ ±  2%   -4.76% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-balanced-Gas=200-14           10.42µ ±  2%   10.01µ ±  5%   -3.94% (p=0.011 n=10)
PrecompiledModExpEip2565/marcin-2-base-heavy-Gas=867-14         15.99µ ±  4%   15.65µ ±  4%        ~ (p=0.190 n=10)
PrecompiledModExpEip2565/marcin-2-exp-heavy-Gas=852-14          24.45µ ±  2%   23.36µ ±  3%   -4.47% (p=0.002 n=10)
PrecompiledModExpEip2565/marcin-2-balanced-Gas=996-14           34.59µ ± 29%   32.90µ ±  1%   -4.90% (p=0.001 n=10)
PrecompiledModExpEip2565/marcin-3-base-heavy-Gas=677-14         12.45µ ±  2%   12.00µ ± 16%        ~ (p=0.105 n=10)
PrecompiledModExpEip2565/marcin-3-exp-heavy-Gas=765-14          16.21µ ±  3%   15.58µ ±  6%        ~ (p=0.063 n=10)
PrecompiledModExpEip2565/marcin-3-balanced-Gas=1360-14          23.03µ ±  3%   21.34µ ±  2%   -7.35% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-8-exp-648-Gas=215-14               17.44µ ±  3%   16.03µ ±  1%   -8.07% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-8-exp-896-Gas=298-14               21.00µ ±  5%   19.52µ ±  2%   -7.04% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-32-Gas=200-14               9.549µ ±  2%   9.322µ ±  2%   -2.38% (p=0.005 n=10)
PrecompiledModExpEip2565/mod-32-exp-36-Gas=200-14               10.74µ ±  1%   10.31µ ±  2%   -4.06% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-40-Gas=208-14               11.95µ ±  2%   11.43µ ±  2%   -4.33% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-64-Gas=336-14               18.77µ ±  3%   18.10µ ±  2%   -3.54% (p=0.002 n=10)
PrecompiledModExpEip2565/mod-32-exp-65-Gas=341-14               13.58µ ±  1%   13.47µ ±  1%        ~ (p=0.280 n=10)
PrecompiledModExpEip2565/mod-32-exp-128-Gas=677-14              13.61µ ±  3%   13.36µ ±  1%   -1.83% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-256-exp-2-Gas=341-14               6.984µ ±  2%   6.053µ ±  3%  -13.33% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-264-exp-2-Gas=363-14               7.126µ ±  5%   6.344µ ±  7%  -10.97% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-1024-exp-2-Gas=5461-14             52.41µ ± 22%   49.85µ ±  4%        ~ (p=0.089 n=10)
PrecompiledModExpEip2565/pawel-1-exp-heavy-Gas=298-14           20.93µ ± 32%   20.15µ ±  2%   -3.69% (p=0.001 n=10)
PrecompiledModExpEip2565/pawel-2-exp-heavy-Gas=425-14           19.32µ ± 17%   14.46µ ±  4%  -25.16% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-3-exp-heavy-Gas=501-14           20.22µ ± 15%   14.30µ ±  3%  -29.27% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-4-exp-heavy-Gas=506-14           14.33µ ±  3%   13.93µ ±  2%   -2.80% (p=0.001 n=10)
PrecompiledModExpEip2565/mod_vul_pawel_3_exp_8-Gas=200-14       24.30µ ± 16%   16.94µ ± 18%  -30.30% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-square-Gas=500-14          1477.5n ±  5%   872.8n ±  9%  -40.93% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-qube-Gas=500-14             2.099µ ±  8%   1.131µ ±  2%  -46.13% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-14      8.920µ ±  4%   6.356µ ±  2%  -28.74% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-square-Gas=512-14           2.227µ ±  4%   1.396µ ±  2%  -37.34% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-qube-Gas=512-14             3.507µ ±  8%   2.421µ ± 13%  -30.97% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-14      17.53µ ±  4%   14.17µ ±  5%  -19.20% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-square-Gas=2048-14          4.801µ ± 12%   3.498µ ±  3%  -27.15% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-14            8.284µ ±  4%   6.536µ ±  2%  -21.10% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-14     44.82µ ±  6%   37.01µ ± 24%  -17.43% (p=0.007 n=10)
PrecompiledModExpEip7883/nagydani-4-square-Gas=8192-14         11.742µ ±  4%   9.000µ ±  4%  -23.35% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-14            27.49µ ± 10%   21.34µ ±  5%  -22.35% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-14    141.4µ ± 11%   113.4µ ±  3%  -19.80% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-square-Gas=32768-14         31.46µ ±  5%   23.53µ ±  1%  -25.21% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-14           78.12µ ± 20%   53.74µ ±  4%  -31.20% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-14    446.3µ ±  6%   338.5µ ±  2%  -24.15% (p=0.000 n=10)
PrecompiledModExpEip7883/marius-1-even-Gas=45296-14             71.25µ ±  4%   55.33µ ±  1%  -22.34% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-1-even-Gas=51136-14              51.06µ ± 14%   38.19µ ±  3%  -25.20% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-2-even-Gas=51152-14              86.12µ ± 20%   60.65µ ±  2%  -29.57% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-3-even-Gas=32400-14              27.53µ ± 32%   20.37µ ±  2%  -26.02% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-4-even-Gas=94448-14              950.4n ±  5%   354.8n ± 28%  -62.67% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-14        5.619µ ±  7%   4.440µ ±  5%  -20.98% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-14        19.03µ ± 19%   15.67µ ± 22%  -17.63% (p=0.003 n=10)
PrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-14          13.83µ ± 19%   10.91µ ± 10%  -21.16% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-14        23.69µ ±  9%   17.79µ ± 13%  -24.91% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-14        38.86µ ± 12%   25.69µ ± 14%  -33.89% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-14          51.47µ ± 28%   33.67µ ± 15%  -34.58% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-14        16.69µ ± 17%   12.08µ ±  2%  -27.60% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-14         19.75µ ±  5%   16.13µ ± 11%  -18.36% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-14          28.66µ ±  9%   22.47µ ±  4%  -21.59% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-14             20.78µ ± 14%   16.38µ ±  2%  -21.17% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-14             24.35µ ± 10%   19.62µ ±  1%  -19.43% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-32-Gas=500-14              10.312µ ±  4%   9.293µ ±  3%   -9.88% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-36-Gas=560-14               11.69µ ± 18%   10.37µ ±  3%  -11.27% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-40-Gas=624-14               14.17µ ± 24%   11.60µ ±  6%  -18.13% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-14              22.03µ ±  8%   18.22µ ±  2%  -17.28% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-14              16.48µ ± 11%   13.34µ ±  1%  -19.04% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-14             17.03µ ±  9%   13.44µ ±  1%  -21.03% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-14              8.123µ ± 14%   5.962µ ±  3%  -26.61% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-14              8.155µ ± 28%   6.799µ ±  4%  -16.64% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-14            62.32µ ±  4%   49.82µ ±  1%  -20.06% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-14         26.90µ ±  7%   20.30µ ±  2%  -24.55% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-14          17.67µ ±  2%   15.61µ ± 11%  -11.66% (p=0.001 n=10)
PrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-14          17.50µ ±  3%   14.88µ ±  8%  -14.98% (p=0.002 n=10)
PrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-14          17.32µ ±  2%   14.14µ ±  5%  -18.39% (p=0.000 n=10)
PrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-14      21.68µ ± 24%   17.07µ ±  3%  -21.25% (p=0.000 n=10)
geomean                                                         14.64µ         12.02µ        -17.89%

                                                             │ /tmp/old.txt │             /tmp/new.txt             │
                                                             │    gas/op    │   gas/op     vs base                 │
PrecompiledModExp/eip_example1-Gas=13056-14                     13.06k ± 0%   13.06k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/eip_example2-Gas=13056-14                     13.06k ± 0%   13.06k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-1-square-Gas=204-14                   204.0 ± 0%    204.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-1-qube-Gas=204-14                     204.0 ± 0%    204.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-1-pow0x10001-Gas=3276-14             3.276k ± 0%   3.276k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-2-square-Gas=665-14                   665.0 ± 0%    665.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-2-qube-Gas=665-14                     665.0 ± 0%    665.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-2-pow0x10001-Gas=10649-14            10.65k ± 0%   10.65k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-3-square-Gas=1894-14                 1.894k ± 0%   1.894k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-3-qube-Gas=1894-14                   1.894k ± 0%   1.894k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-3-pow0x10001-Gas=30310-14            30.31k ± 0%   30.31k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-4-square-Gas=5580-14                 5.580k ± 0%   5.580k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-4-qube-Gas=5580-14                   5.580k ± 0%   5.580k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-4-pow0x10001-Gas=89292-14            89.29k ± 0%   89.29k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-5-square-Gas=17868-14                17.87k ± 0%   17.87k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-5-qube-Gas=17868-14                  17.87k ± 0%   17.87k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExp/nagydani-5-pow0x10001-Gas=285900-14           285.9k ± 0%   285.9k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/eip_example1-Gas=1360-14               1.360k ± 0%   1.360k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/eip_example2-Gas=1360-14               1.360k ± 0%   1.360k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-1-square-Gas=200-14            200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-1-qube-Gas=200-14              200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-1-pow0x10001-Gas=341-14        341.0 ± 0%    341.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-2-square-Gas=200-14            200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-2-qube-Gas=200-14              200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-2-pow0x10001-Gas=1365-14      1.365k ± 0%   1.365k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-3-square-Gas=341-14            341.0 ± 0%    341.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-3-qube-Gas=341-14              341.0 ± 0%    341.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-3-pow0x10001-Gas=5461-14      5.461k ± 0%   5.461k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-4-square-Gas=1365-14          1.365k ± 0%   1.365k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-4-qube-Gas=1365-14            1.365k ± 0%   1.365k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-4-pow0x10001-Gas=21845-14     21.84k ± 0%   21.84k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-5-square-Gas=5461-14          5.461k ± 0%   5.461k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-5-qube-Gas=5461-14            5.461k ± 0%   5.461k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/nagydani-5-pow0x10001-Gas=87381-14     87.38k ± 0%   87.38k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marius-1-even-Gas=2057-14              2.057k ± 0%   2.057k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/guido-1-even-Gas=2298-14               2.298k ± 0%   2.298k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/guido-2-even-Gas=2300-14               2.300k ± 0%   2.300k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/guido-3-even-Gas=5400-14               5.400k ± 0%   5.400k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/guido-4-even-Gas=1026-14               1.026k ± 0%   1.026k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-1-base-heavy-Gas=200-14          200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-1-exp-heavy-Gas=215-14           215.0 ± 0%    215.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-1-balanced-Gas=200-14            200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-2-base-heavy-Gas=867-14          867.0 ± 0%    867.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-2-exp-heavy-Gas=852-14           852.0 ± 0%    852.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-2-balanced-Gas=996-14            996.0 ± 0%    996.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-3-base-heavy-Gas=677-14          677.0 ± 0%    677.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-3-exp-heavy-Gas=765-14           765.0 ± 0%    765.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/marcin-3-balanced-Gas=1360-14          1.360k ± 0%   1.360k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-8-exp-648-Gas=215-14                215.0 ± 0%    215.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-8-exp-896-Gas=298-14                298.0 ± 0%    298.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-32-exp-32-Gas=200-14                200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-32-exp-36-Gas=200-14                200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-32-exp-40-Gas=208-14                208.0 ± 0%    208.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-32-exp-64-Gas=336-14                336.0 ± 0%    336.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-32-exp-65-Gas=341-14                341.0 ± 0%    341.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-32-exp-128-Gas=677-14               677.0 ± 0%    677.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-256-exp-2-Gas=341-14                341.0 ± 0%    341.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-264-exp-2-Gas=363-14                363.0 ± 0%    363.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod-1024-exp-2-Gas=5461-14             5.461k ± 0%   5.461k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/pawel-1-exp-heavy-Gas=298-14            298.0 ± 0%    298.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/pawel-2-exp-heavy-Gas=425-14            425.0 ± 0%    425.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/pawel-3-exp-heavy-Gas=501-14            501.0 ± 0%    501.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/pawel-4-exp-heavy-Gas=506-14            506.0 ± 0%    506.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip2565/mod_vul_pawel_3_exp_8-Gas=200-14        200.0 ± 0%    200.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-1-square-Gas=500-14            500.0 ± 0%    500.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-1-qube-Gas=500-14              500.0 ± 0%    500.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-14      2.048k ± 0%   2.048k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-2-square-Gas=512-14            512.0 ± 0%    512.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-2-qube-Gas=512-14              512.0 ± 0%    512.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-14      8.192k ± 0%   8.192k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-3-square-Gas=2048-14          2.048k ± 0%   2.048k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-14            2.048k ± 0%   2.048k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-14     32.77k ± 0%   32.77k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-4-square-Gas=8192-14          8.192k ± 0%   8.192k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-14            8.192k ± 0%   8.192k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-14    131.1k ± 0%   131.1k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-5-square-Gas=32768-14         32.77k ± 0%   32.77k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-14           32.77k ± 0%   32.77k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-14    524.3k ± 0%   524.3k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marius-1-even-Gas=45296-14             45.30k ± 0%   45.30k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/guido-1-even-Gas=51136-14              51.14k ± 0%   51.14k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/guido-2-even-Gas=51152-14              51.15k ± 0%   51.15k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/guido-3-even-Gas=32400-14              32.40k ± 0%   32.40k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/guido-4-even-Gas=94448-14              94.45k ± 0%   94.45k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-14        1.152k ± 0%   1.152k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-14        16.62k ± 0%   16.62k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-14          1.200k ± 0%   1.200k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-14        5.202k ± 0%   5.202k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-14        16.37k ± 0%   16.37k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-14          5.978k ± 0%   5.978k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-14        2.032k ± 0%   2.032k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-14         4.080k ± 0%   4.080k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-14          4.080k ± 0%   4.080k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-14             16.62k ± 0%   16.62k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-14             24.56k ± 0%   24.56k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-32-exp-32-Gas=500-14                500.0 ± 0%    500.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-32-exp-36-Gas=560-14                560.0 ± 0%    560.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-32-exp-40-Gas=624-14                624.0 ± 0%    624.0 ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-14              1.008k ± 0%   1.008k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-14              1.024k ± 0%   1.024k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-14             2.032k ± 0%   2.032k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-14              2.048k ± 0%   2.048k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-14              2.178k ± 0%   2.178k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-14            32.77k ± 0%   32.77k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-14         24.56k ± 0%   24.56k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-14          6.128k ± 0%   6.128k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-14          2.672k ± 0%   2.672k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-14          1.520k ± 0%   1.520k ± 0%       ~ (p=1.000 n=10) ¹
PrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-14      1.008k ± 0%   1.008k ± 0%       ~ (p=1.000 n=10) ¹
geomean                                                         2.342k        2.342k       +0.00%
¹ all samples are equal

                                                             │ /tmp/old.txt │              /tmp/new.txt              │
                                                             │    mgas/s    │    mgas/s      vs base                 │
PrecompiledModExp/eip_example1-Gas=13056-14                     550.8 ±  4%     585.3 ±  5%    +6.26% (p=0.004 n=10)
PrecompiledModExp/eip_example2-Gas=13056-14                    23.06k ± 11%    48.91k ±  3%  +112.09% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-square-Gas=204-14                  158.7 ±  3%     204.8 ±  3%   +29.08% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-qube-Gas=204-14                    116.3 ± 23%     144.6 ± 14%   +24.33% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-pow0x10001-Gas=3276-14             368.3 ± 16%     491.5 ±  2%   +33.45% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-square-Gas=665-14                  315.7 ±  7%     452.9 ± 10%   +43.47% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-qube-Gas=665-14                    211.6 ±  3%     290.6 ±  7%   +37.28% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-pow0x10001-Gas=10649-14            721.6 ±  3%     783.8 ±  4%    +8.62% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-square-Gas=1894-14                 475.4 ±  3%     590.0 ±  3%   +24.10% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-qube-Gas=1894-14                   250.1 ± 11%     307.8 ±  3%   +23.05% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-pow0x10001-Gas=30310-14            776.1 ±  6%     802.7 ±  5%         ~ (p=0.123 n=10)
PrecompiledModExp/nagydani-4-square-Gas=5580-14                 580.5 ±  2%     605.1 ±  2%    +4.25% (p=0.003 n=10)
PrecompiledModExp/nagydani-4-qube-Gas=5580-14                   257.6 ±  5%     259.8 ± 15%         ~ (p=0.971 n=10)
PrecompiledModExp/nagydani-4-pow0x10001-Gas=89292-14            739.7 ±  9%     770.0 ±  3%    +4.09% (p=0.043 n=10)
PrecompiledModExp/nagydani-5-square-Gas=17868-14                746.6 ±  3%     719.8 ±  3%    -3.60% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-qube-Gas=17868-14                  325.0 ±  1%     307.6 ±  4%    -5.35% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-pow0x10001-Gas=285900-14           840.1 ±  2%     838.0 ±  3%         ~ (p=0.529 n=10)
PrecompiledModExpEip2565/eip_example1-Gas=1360-14               61.84 ±  3%     64.03 ±  2%    +3.56% (p=0.000 n=10)
PrecompiledModExpEip2565/eip_example2-Gas=1360-14              2.394k ± 11%    6.150k ±  2%  +156.89% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-square-Gas=200-14           157.2 ±  2%     243.2 ± 11%   +54.66% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-qube-Gas=200-14             122.4 ±  3%     143.2 ± 17%   +16.90% (p=0.023 n=10)
PrecompiledModExpEip2565/nagydani-1-pow0x10001-Gas=341-14       46.86 ±  3%     50.87 ±  4%    +8.55% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-square-Gas=200-14           102.1 ±  3%     123.7 ±  2%   +21.17% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-qube-Gas=200-14             67.59 ±  5%     76.60 ±  5%   +13.34% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-pow0x10001-Gas=1365-14      91.06 ±  5%     99.16 ±  4%    +8.90% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-square-Gas=341-14           88.09 ±  4%     96.86 ±  2%    +9.96% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-qube-Gas=341-14             49.62 ±  3%     52.84 ±  3%    +6.48% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-pow0x10001-Gas=5461-14      136.0 ±  6%     153.6 ±  3%   +12.94% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-square-Gas=1365-14          140.8 ±  3%     161.9 ±  3%   +15.02% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-qube-Gas=1365-14            63.62 ±  2%     70.05 ±  6%   +10.12% (p=0.001 n=10)
PrecompiledModExpEip2565/nagydani-4-pow0x10001-Gas=21845-14     184.9 ±  2%     192.2 ±  2%    +3.92% (p=0.003 n=10)
PrecompiledModExpEip2565/nagydani-5-square-Gas=5461-14          211.7 ±  5%     227.0 ±  3%    +7.25% (p=0.001 n=10)
PrecompiledModExpEip2565/nagydani-5-qube-Gas=5461-14            95.34 ±  9%     97.93 ±  6%         ~ (p=0.796 n=10)
PrecompiledModExpEip2565/nagydani-5-pow0x10001-Gas=87381-14     260.7 ±  2%     252.4 ±  3%    -3.18% (p=0.000 n=10)
PrecompiledModExpEip2565/marius-1-even-Gas=2057-14              36.57 ±  3%     37.03 ±  1%         ~ (p=0.280 n=10)
PrecompiledModExpEip2565/guido-1-even-Gas=2298-14               59.31 ±  3%     59.48 ±  5%         ~ (p=0.631 n=10)
PrecompiledModExpEip2565/guido-2-even-Gas=2300-14               37.13 ±  2%     37.47 ± 10%         ~ (p=0.529 n=10)
PrecompiledModExpEip2565/guido-3-even-Gas=5400-14               266.4 ±  2%     267.5 ±  5%         ~ (p=0.838 n=10)
PrecompiledModExpEip2565/guido-4-even-Gas=1026-14              1.274k ±  3%    2.857k ±  3%  +124.34% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-base-heavy-Gas=200-14         42.39 ±  5%     50.95 ±  5%   +20.18% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-exp-heavy-Gas=215-14          13.86 ±  3%     14.55 ±  2%    +5.02% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-balanced-Gas=200-14           19.19 ±  2%     19.98 ±  5%    +4.09% (p=0.011 n=10)
PrecompiledModExpEip2565/marcin-2-base-heavy-Gas=867-14         54.23 ±  4%     55.39 ±  4%         ~ (p=0.197 n=10)
PrecompiledModExpEip2565/marcin-2-exp-heavy-Gas=852-14          34.84 ±  2%     36.47 ±  2%    +4.68% (p=0.002 n=10)
PrecompiledModExpEip2565/marcin-2-balanced-Gas=996-14           28.79 ± 23%     30.27 ±  1%    +5.16% (p=0.001 n=10)
PrecompiledModExpEip2565/marcin-3-base-heavy-Gas=677-14         54.37 ±  2%     56.42 ± 14%         ~ (p=0.093 n=10)
PrecompiledModExpEip2565/marcin-3-exp-heavy-Gas=765-14          47.19 ±  3%     49.11 ±  6%         ~ (p=0.063 n=10)
PrecompiledModExpEip2565/marcin-3-balanced-Gas=1360-14          59.05 ±  3%     63.73 ±  2%    +7.94% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-8-exp-648-Gas=215-14               12.32 ±  3%     13.41 ±  1%    +8.81% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-8-exp-896-Gas=298-14               14.19 ±  5%     15.26 ±  2%    +7.58% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-32-Gas=200-14               20.94 ±  2%     21.45 ±  2%    +2.41% (p=0.005 n=10)
PrecompiledModExpEip2565/mod-32-exp-36-Gas=200-14               18.61 ±  1%     19.40 ±  2%    +4.25% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-40-Gas=208-14               17.40 ±  2%     18.19 ±  2%    +4.54% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-64-Gas=336-14               17.90 ±  3%     18.55 ±  2%    +3.66% (p=0.002 n=10)
PrecompiledModExpEip2565/mod-32-exp-65-Gas=341-14               25.10 ±  1%     25.30 ±  1%         ~ (p=0.306 n=10)
PrecompiledModExpEip2565/mod-32-exp-128-Gas=677-14              49.74 ±  3%     50.66 ±  1%    +1.86% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-256-exp-2-Gas=341-14               48.82 ±  2%     56.33 ±  3%   +15.38% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-264-exp-2-Gas=363-14               50.94 ±  5%     57.22 ±  6%   +12.33% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-1024-exp-2-Gas=5461-14             104.2 ± 18%     109.5 ±  4%         ~ (p=0.085 n=10)
PrecompiledModExpEip2565/pawel-1-exp-heavy-Gas=298-14           14.23 ± 24%     14.78 ±  2%    +3.83% (p=0.001 n=10)
PrecompiledModExpEip2565/pawel-2-exp-heavy-Gas=425-14           22.01 ± 20%     29.39 ±  4%   +33.55% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-3-exp-heavy-Gas=501-14           24.78 ± 17%     35.03 ±  3%   +41.38% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-4-exp-heavy-Gas=506-14           35.30 ±  3%     36.31 ±  2%    +2.88% (p=0.001 n=10)
PrecompiledModExpEip2565/mod_vul_pawel_3_exp_8-Gas=200-14       8.250 ± 14%    11.805 ± 15%   +43.09% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-square-Gas=500-14           338.4 ±  5%     574.2 ±  9%   +69.72% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-qube-Gas=500-14             238.3 ±  7%     442.1 ±  2%   +85.54% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-14      229.6 ±  4%     322.2 ±  2%   +40.32% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-square-Gas=512-14           229.9 ±  4%     366.8 ±  2%   +59.55% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-qube-Gas=512-14             146.1 ±  7%     211.8 ± 11%   +44.98% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-14      467.2 ±  4%     578.3 ±  5%   +23.77% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-square-Gas=2048-14          426.6 ± 11%     585.5 ±  3%   +37.26% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-14            247.2 ±  4%     313.4 ±  2%   +26.76% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-14     731.1 ±  5%     885.5 ± 19%   +21.11% (p=0.007 n=10)
PrecompiledModExpEip7883/nagydani-4-square-Gas=8192-14          697.7 ±  4%     910.3 ±  4%   +30.47% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-14            298.0 ±  9%     383.8 ±  5%   +28.75% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-14    926.6 ± 10%    1155.5 ±  3%   +24.70% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-square-Gas=32768-14        1.042k ±  5%    1.393k ±  1%   +33.64% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-14           419.5 ± 16%     609.7 ±  4%   +45.33% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-14   1.175k ±  5%    1.549k ±  2%   +31.89% (p=0.000 n=10)
PrecompiledModExpEip7883/marius-1-even-Gas=45296-14             635.8 ±  4%     818.6 ±  1%   +28.76% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-1-even-Gas=51136-14             1.002k ± 13%    1.339k ±  3%   +33.66% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-2-even-Gas=51152-14              594.0 ± 17%     843.3 ±  2%   +41.97% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-3-even-Gas=32400-14             1.177k ± 24%    1.591k ±  2%   +35.17% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-4-even-Gas=94448-14             99.37k ±  5%   266.13k ± 22%  +167.81% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-14        205.0 ±  7%     259.5 ±  5%   +26.56% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-14        873.8 ± 16%    1061.0 ± 18%   +21.43% (p=0.003 n=10)
PrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-14          86.77 ± 16%    110.00 ±  9%   +26.77% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-14        219.6 ±  8%     293.5 ± 12%   +33.67% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-14        421.2 ± 14%     637.2 ± 13%   +51.28% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-14          116.2 ± 22%     177.6 ± 13%   +52.86% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-14        121.8 ± 14%     168.1 ±  2%   +38.11% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-14         206.6 ±  5%     253.0 ± 10%   +22.49% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-14          142.4 ±  8%     181.6 ±  4%   +27.57% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-14             799.9 ± 12%    1014.5 ±  2%   +26.84% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-14            1.009k ±  9%    1.252k ±  1%   +24.05% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-32-Gas=500-14               48.48 ±  4%     53.80 ±  3%   +10.96% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-36-Gas=560-14               47.91 ± 15%     53.99 ±  3%   +12.70% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-40-Gas=624-14               44.05 ± 19%     53.80 ±  6%   +22.12% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-14              45.75 ±  8%     55.31 ±  2%   +20.90% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-14              62.24 ± 12%     76.77 ±  1%   +23.34% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-14             119.3 ±  8%     151.1 ±  1%   +26.66% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-14              252.2 ± 12%     343.6 ±  3%   +36.25% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-14              267.1 ± 22%     320.4 ±  5%   +19.91% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-14            525.9 ±  3%     657.7 ±  1%   +25.07% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-14         913.0 ±  7%    1210.0 ±  1%   +32.52% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-14          346.8 ±  2%     392.7 ± 10%   +13.24% (p=0.001 n=10)
PrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-14          152.7 ±  3%     179.7 ±  8%   +17.65% (p=0.002 n=10)
PrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-14          87.73 ±  2%    107.55 ±  4%   +22.59% (p=0.000 n=10)
PrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-14      46.50 ± 20%     59.03 ±  3%   +26.97% (p=0.000 n=10)
geomean                                                         159.9           194.8         +21.79%

                                                             │ /tmp/old.txt │             /tmp/new.txt             │
                                                             │     B/op     │     B/op      vs base                │
PrecompiledModExp/eip_example1-Gas=13056-14                    2.595Ki ± 0%   2.282Ki ± 0%  -12.04% (p=0.000 n=10)
PrecompiledModExp/eip_example2-Gas=13056-14                      672.0 ± 0%     352.0 ± 0%  -47.62% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-square-Gas=204-14                  1160.0 ± 0%     888.0 ± 0%  -23.45% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-qube-Gas=204-14                   1.414Ki ± 0%   1.148Ki ± 0%  -18.78% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-pow0x10001-Gas=3276-14            1.898Ki ± 0%   1.633Ki ± 0%  -13.99% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-square-Gas=665-14                 1.789Ki ± 0%   1.383Ki ± 0%  -22.71% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-qube-Gas=665-14                   2.321Ki ± 0%   1.915Ki ± 0%  -17.50% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-pow0x10001-Gas=10649-14           3.196Ki ± 0%   2.790Ki ± 0%  -12.71% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-square-Gas=1894-14                2.821Ki ± 0%   2.415Ki ± 0%  -14.40% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-qube-Gas=1894-14                  4.010Ki ± 0%   3.604Ki ± 0%  -10.13% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-pow0x10001-Gas=30310-14           5.698Ki ± 0%   5.292Ki ± 0%   -7.13% (p=0.000 n=10)
PrecompiledModExp/nagydani-4-square-Gas=5580-14                5.042Ki ± 0%   4.636Ki ± 0%   -8.06% (p=0.000 n=10)
PrecompiledModExp/nagydani-4-qube-Gas=5580-14                  11.93Ki ± 0%   11.52Ki ± 0%   -3.42% (p=0.000 n=10)
PrecompiledModExp/nagydani-4-pow0x10001-Gas=89292-14           15.30Ki ± 0%   14.89Ki ± 0%   -2.66% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-square-Gas=17868-14               9.616Ki ± 0%   9.208Ki ± 0%   -4.24% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-qube-Gas=17868-14                 23.26Ki ± 0%   22.85Ki ± 0%   -1.77% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-pow0x10001-Gas=285900-14          31.90Ki ± 0%   31.49Ki ± 0%   -1.29% (p=0.000 n=10)
PrecompiledModExpEip2565/eip_example1-Gas=1360-14              2.595Ki ± 0%   2.282Ki ± 0%  -12.04% (p=0.000 n=10)
PrecompiledModExpEip2565/eip_example2-Gas=1360-14                672.0 ± 0%     352.0 ± 0%  -47.62% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-square-Gas=200-14           1160.0 ± 0%     888.0 ± 0%  -23.45% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-qube-Gas=200-14            1.414Ki ± 0%   1.148Ki ± 0%  -18.78% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-pow0x10001-Gas=341-14      1.898Ki ± 0%   1.633Ki ± 0%  -13.99% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-square-Gas=200-14          1.648Ki ± 0%   1.383Ki ± 0%  -16.11% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-qube-Gas=200-14            2.181Ki ± 0%   1.914Ki ± 0%  -12.23% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-pow0x10001-Gas=1365-14     3.056Ki ± 0%   2.790Ki ± 0%   -8.69% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-square-Gas=341-14          2.681Ki ± 0%   2.415Ki ± 0%   -9.91% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-qube-Gas=341-14            3.869Ki ± 0%   3.604Ki ± 0%   -6.87% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-pow0x10001-Gas=5461-14     5.558Ki ± 0%   5.292Ki ± 0%   -4.78% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-square-Gas=1365-14         4.901Ki ± 0%   4.636Ki ± 0%   -5.42% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-qube-Gas=1365-14           11.78Ki ± 0%   11.52Ki ± 0%   -2.25% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-pow0x10001-Gas=21845-14    15.16Ki ± 0%   14.89Ki ± 0%   -1.76% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-5-square-Gas=5461-14         9.475Ki ± 0%   9.209Ki ± 0%   -2.80% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-5-qube-Gas=5461-14           23.12Ki ± 0%   22.85Ki ± 0%   -1.15% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-5-pow0x10001-Gas=87381-14    31.75Ki ± 0%   31.49Ki ± 0%   -0.83% (p=0.000 n=10)
PrecompiledModExpEip2565/marius-1-even-Gas=2057-14             2.501Ki ± 0%   2.134Ki ± 0%  -14.68% (p=0.000 n=10)
PrecompiledModExpEip2565/guido-1-even-Gas=2298-14              2.470Ki ± 0%   2.103Ki ± 0%  -14.87% (p=0.000 n=10)
PrecompiledModExpEip2565/guido-2-even-Gas=2300-14              2.587Ki ± 0%   2.228Ki ± 0%  -13.89% (p=0.000 n=10)
PrecompiledModExpEip2565/guido-3-even-Gas=5400-14              8.271Ki ± 0%   8.014Ki ± 0%   -3.12% (p=0.000 n=10)
PrecompiledModExpEip2565/guido-4-even-Gas=1026-14               1056.0 ± 0%     680.0 ± 0%  -35.61% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-base-heavy-Gas=200-14        2.954Ki ± 0%   2.696Ki ± 0%   -8.73% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-exp-heavy-Gas=215-14         1.641Ki ± 0%   1.273Ki ± 0%  -22.38% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-balanced-Gas=200-14          1.266Ki ± 0%   1.008Ki ± 0%  -20.37% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-2-base-heavy-Gas=867-14        9.555Ki ± 0%   9.296Ki ± 0%   -2.71% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-2-exp-heavy-Gas=852-14         2.047Ki ± 0%   1.688Ki ± 0%  -17.56% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-2-balanced-Gas=996-14          1.993Ki ± 0%   1.727Ki ± 0%  -13.38% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-3-base-heavy-Gas=677-14        2.587Ki ± 0%   2.282Ki ± 0%  -11.78% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-3-exp-heavy-Gas=765-14         2.313Ki ± 0%   2.000Ki ± 0%  -13.55% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-3-balanced-Gas=1360-14         2.610Ki ± 0%   2.298Ki ± 0%  -11.97% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-8-exp-648-Gas=215-14              1.860Ki ± 0%   1.492Ki ± 0%  -19.79% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-8-exp-896-Gas=298-14              1.876Ki ± 0%   1.508Ki ± 0%  -19.60% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-32-Gas=200-14               1192.0 ± 0%     920.0 ± 0%  -22.82% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-36-Gas=200-14              1.305Ki ± 0%   1.039Ki ± 0%  -20.36% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-40-Gas=208-14               1184.0 ± 0%     920.0 ± 0%  -22.30% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-64-Gas=336-14               1184.0 ± 0%     920.0 ± 0%  -22.30% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-65-Gas=341-14              3.071Ki ± 0%   2.767Ki ± 0%   -9.92% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-128-Gas=677-14             3.071Ki ± 0%   2.767Ki ± 0%   -9.92% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-256-exp-2-Gas=341-14              3.869Ki ± 0%   3.604Ki ± 0%   -6.87% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-264-exp-2-Gas=363-14              3.986Ki ± 0%   3.729Ki ± 0%   -6.47% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-1024-exp-2-Gas=5461-14            24.12Ki ± 0%   23.85Ki ± 0%   -1.10% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-1-exp-heavy-Gas=298-14          1.931Ki ± 0%   1.563Ki ± 0%  -19.02% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-2-exp-heavy-Gas=425-14          2.438Ki ± 0%   2.071Ki ± 0%  -15.06% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-3-exp-heavy-Gas=501-14          2.798Ki ± 0%   2.485Ki ± 0%  -11.17% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-4-exp-heavy-Gas=506-14          3.080Ki ± 0%   2.774Ki ± 0%   -9.92% (p=0.000 n=10)
PrecompiledModExpEip2565/mod_vul_pawel_3_exp_8-Gas=200-14       1064.0 ± 0%     800.0 ± 0%  -24.81% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-square-Gas=500-14           1152.0 ± 0%     888.0 ± 0%  -22.92% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-qube-Gas=500-14            1.406Ki ± 0%   1.148Ki ± 0%  -18.33% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-14     1.891Ki ± 0%   1.633Ki ± 0%  -13.64% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-square-Gas=512-14          1.641Ki ± 0%   1.383Ki ± 0%  -15.71% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-qube-Gas=512-14            2.173Ki ± 0%   1.915Ki ± 0%  -11.87% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-14     3.048Ki ± 0%   2.790Ki ± 0%   -8.46% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-square-Gas=2048-14         2.673Ki ± 0%   2.415Ki ± 0%   -9.65% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-14           3.861Ki ± 0%   3.604Ki ± 0%   -6.68% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-14    5.550Ki ± 0%   5.292Ki ± 0%   -4.65% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-square-Gas=8192-14         4.894Ki ± 0%   4.636Ki ± 0%   -5.27% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-14           11.78Ki ± 0%   11.52Ki ± 0%   -2.20% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-14   15.15Ki ± 0%   14.89Ki ± 0%   -1.71% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-square-Gas=32768-14        9.468Ki ± 0%   9.208Ki ± 0%   -2.74% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-14          23.11Ki ± 0%   22.85Ki ± 0%   -1.13% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-14   31.75Ki ± 0%   31.49Ki ± 0%   -0.81% (p=0.000 n=10)
PrecompiledModExpEip7883/marius-1-even-Gas=45296-14            2.548Ki ± 0%   2.134Ki ± 0%  -16.25% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-1-even-Gas=51136-14             2.517Ki ± 0%   2.103Ki ± 0%  -16.45% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-2-even-Gas=51152-14             2.642Ki ± 0%   2.228Ki ± 0%  -15.67% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-3-even-Gas=32400-14             8.271Ki ± 0%   8.014Ki ± 0%   -3.12% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-4-even-Gas=94448-14              1104.0 ± 0%     680.0 ± 0%  -38.41% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-14       2.954Ki ± 0%   2.696Ki ± 0%   -8.73% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-14       1.688Ki ± 0%   1.273Ki ± 0%  -24.54% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-14         1.266Ki ± 0%   1.008Ki ± 0%  -20.37% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-14       9.554Ki ± 0%   9.296Ki ± 0%   -2.70% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-14       2.102Ki ± 0%   1.688Ki ± 0%  -19.72% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-14         1.985Ki ± 0%   1.727Ki ± 0%  -13.03% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-14       2.634Ki ± 0%   2.282Ki ± 0%  -13.35% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-14        2.368Ki ± 0%   2.000Ki ± 0%  -15.55% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-14         2.665Ki ± 0%   2.298Ki ± 0%  -13.78% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-14            1.907Ki ± 0%   1.492Ki ± 0%  -21.76% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-14            1.923Ki ± 0%   1.508Ki ± 0%  -21.58% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-32-Gas=500-14               1240.0 ± 0%     920.0 ± 0%  -25.81% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-36-Gas=560-14              1.352Ki ± 0%   1.039Ki ± 0%  -23.12% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-40-Gas=624-14               1240.0 ± 0%     920.0 ± 0%  -25.81% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-14              1240.0 ± 0%     920.0 ± 0%  -25.81% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-14             3.118Ki ± 0%   2.767Ki ± 0%  -11.27% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-14            3.118Ki ± 0%   2.767Ki ± 0%  -11.27% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-14             3.861Ki ± 0%   3.604Ki ± 0%   -6.68% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-14             3.986Ki ± 0%   3.729Ki ± 0%   -6.47% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-14           24.12Ki ± 0%   23.85Ki ± 0%   -1.09% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-14        1.978Ki ± 0%   1.562Ki ± 0%  -20.99% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-14         2.485Ki ± 0%   2.071Ki ± 0%  -16.66% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-14         2.853Ki ± 0%   2.485Ki ± 0%  -12.87% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-14         3.127Ki ± 0%   2.774Ki ± 0%  -11.27% (p=0.000 n=10)
PrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-14      1120.0 ± 0%     800.0 ± 0%  -28.57% (p=0.000 n=10)
geomean                                                        3.164Ki        2.718Ki       -14.08%

                                                             │ /tmp/old.txt │            /tmp/new.txt            │
                                                             │  allocs/op   │ allocs/op   vs base                │
PrecompiledModExp/eip_example1-Gas=13056-14                      37.00 ± 0%   30.00 ± 0%  -18.92% (p=0.000 n=10)
PrecompiledModExp/eip_example2-Gas=13056-14                     13.000 ± 0%   6.000 ± 0%  -53.85% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-square-Gas=204-14                   18.00 ± 0%   10.00 ± 0%  -44.44% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-qube-Gas=204-14                     19.00 ± 0%   11.00 ± 0%  -42.11% (p=0.000 n=10)
PrecompiledModExp/nagydani-1-pow0x10001-Gas=3276-14              22.00 ± 0%   14.00 ± 0%  -36.36% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-square-Gas=665-14                   23.00 ± 0%   10.00 ± 0%  -56.52% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-qube-Gas=665-14                     24.00 ± 0%   11.00 ± 0%  -54.17% (p=0.000 n=10)
PrecompiledModExp/nagydani-2-pow0x10001-Gas=10649-14             27.00 ± 0%   14.00 ± 0%  -48.15% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-square-Gas=1894-14                  23.00 ± 0%   10.00 ± 0%  -56.52% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-qube-Gas=1894-14                    24.00 ± 0%   11.00 ± 0%  -54.17% (p=0.000 n=10)
PrecompiledModExp/nagydani-3-pow0x10001-Gas=30310-14             27.00 ± 0%   14.00 ± 0%  -48.15% (p=0.000 n=10)
PrecompiledModExp/nagydani-4-square-Gas=5580-14                  23.00 ± 0%   10.00 ± 0%  -56.52% (p=0.000 n=10)
PrecompiledModExp/nagydani-4-qube-Gas=5580-14                    25.00 ± 0%   12.00 ± 0%  -52.00% (p=0.000 n=10)
PrecompiledModExp/nagydani-4-pow0x10001-Gas=89292-14             28.00 ± 0%   15.00 ± 0%  -46.43% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-square-Gas=17868-14                 24.00 ± 0%   11.00 ± 0%  -54.17% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-qube-Gas=17868-14                   26.00 ± 0%   13.00 ± 0%  -50.00% (p=0.000 n=10)
PrecompiledModExp/nagydani-5-pow0x10001-Gas=285900-14            44.00 ± 0%   31.00 ± 0%  -29.55% (p=0.000 n=10)
PrecompiledModExpEip2565/eip_example1-Gas=1360-14                37.00 ± 0%   30.00 ± 0%  -18.92% (p=0.000 n=10)
PrecompiledModExpEip2565/eip_example2-Gas=1360-14               13.000 ± 0%   6.000 ± 0%  -53.85% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-square-Gas=200-14            18.00 ± 0%   10.00 ± 0%  -44.44% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-qube-Gas=200-14              19.00 ± 0%   11.00 ± 0%  -42.11% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-1-pow0x10001-Gas=341-14        22.00 ± 0%   14.00 ± 0%  -36.36% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-square-Gas=200-14            18.00 ± 0%   10.00 ± 0%  -44.44% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-qube-Gas=200-14              19.00 ± 0%   11.00 ± 0%  -42.11% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-2-pow0x10001-Gas=1365-14       22.00 ± 0%   14.00 ± 0%  -36.36% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-square-Gas=341-14            18.00 ± 0%   10.00 ± 0%  -44.44% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-qube-Gas=341-14              19.00 ± 0%   11.00 ± 0%  -42.11% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-3-pow0x10001-Gas=5461-14       22.00 ± 0%   14.00 ± 0%  -36.36% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-square-Gas=1365-14           18.00 ± 0%   10.00 ± 0%  -44.44% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-qube-Gas=1365-14             20.00 ± 0%   12.00 ± 0%  -40.00% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-4-pow0x10001-Gas=21845-14      23.00 ± 0%   15.00 ± 0%  -34.78% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-5-square-Gas=5461-14           19.00 ± 0%   11.00 ± 0%  -42.11% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-5-qube-Gas=5461-14             21.00 ± 0%   13.00 ± 0%  -38.10% (p=0.000 n=10)
PrecompiledModExpEip2565/nagydani-5-pow0x10001-Gas=87381-14      39.00 ± 0%   31.00 ± 0%  -20.51% (p=0.000 n=10)
PrecompiledModExpEip2565/marius-1-even-Gas=2057-14               52.00 ± 0%   43.00 ± 0%  -17.31% (p=0.000 n=10)
PrecompiledModExpEip2565/guido-1-even-Gas=2298-14                55.00 ± 0%   46.00 ± 0%  -16.36% (p=0.000 n=10)
PrecompiledModExpEip2565/guido-2-even-Gas=2300-14                52.00 ± 0%   44.00 ± 0%  -15.38% (p=0.000 n=10)
PrecompiledModExpEip2565/guido-3-even-Gas=5400-14                19.00 ± 0%   12.00 ± 0%  -36.84% (p=0.000 n=10)
PrecompiledModExpEip2565/guido-4-even-Gas=1026-14               18.000 ± 0%   9.000 ± 0%  -50.00% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-base-heavy-Gas=200-14          18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-exp-heavy-Gas=215-14           37.00 ± 0%   28.00 ± 0%  -24.32% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-1-balanced-Gas=200-14            19.00 ± 0%   12.00 ± 0%  -36.84% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-2-base-heavy-Gas=867-14          19.00 ± 0%   12.00 ± 0%  -36.84% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-2-exp-heavy-Gas=852-14           36.00 ± 0%   28.00 ± 0%  -22.22% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-2-balanced-Gas=996-14            23.00 ± 0%   15.00 ± 0%  -34.78% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-3-base-heavy-Gas=677-14          36.00 ± 0%   28.00 ± 0%  -22.22% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-3-exp-heavy-Gas=765-14           35.00 ± 0%   28.00 ± 0%  -20.00% (p=0.000 n=10)
PrecompiledModExpEip2565/marcin-3-balanced-Gas=1360-14           35.00 ± 0%   28.00 ± 0%  -20.00% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-8-exp-648-Gas=215-14                50.00 ± 0%   41.00 ± 0%  -18.00% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-8-exp-896-Gas=298-14                50.00 ± 0%   41.00 ± 0%  -18.00% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-32-Gas=200-14                21.00 ± 0%   13.00 ± 0%  -38.10% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-36-Gas=200-14                22.00 ± 0%   14.00 ± 0%  -36.36% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-40-Gas=208-14                20.00 ± 0%   13.00 ± 0%  -35.00% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-64-Gas=336-14                20.00 ± 0%   13.00 ± 0%  -35.00% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-65-Gas=341-14                52.00 ± 0%   44.00 ± 0%  -15.38% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-32-exp-128-Gas=677-14               52.00 ± 0%   44.00 ± 0%  -15.38% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-256-exp-2-Gas=341-14                19.00 ± 0%   11.00 ± 0%  -42.11% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-264-exp-2-Gas=363-14                18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip2565/mod-1024-exp-2-Gas=5461-14              22.00 ± 0%   14.00 ± 0%  -36.36% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-1-exp-heavy-Gas=298-14            52.00 ± 0%   43.00 ± 0%  -17.31% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-2-exp-heavy-Gas=425-14            54.00 ± 0%   45.00 ± 0%  -16.67% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-3-exp-heavy-Gas=501-14            52.00 ± 0%   45.00 ± 0%  -13.46% (p=0.000 n=10)
PrecompiledModExpEip2565/pawel-4-exp-heavy-Gas=506-14            53.00 ± 0%   45.00 ± 0%  -15.09% (p=0.000 n=10)
PrecompiledModExpEip2565/mod_vul_pawel_3_exp_8-Gas=200-14        19.00 ± 0%   12.00 ± 0%  -36.84% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-square-Gas=500-14            17.00 ± 0%   10.00 ± 0%  -41.18% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-qube-Gas=500-14              18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-14       21.00 ± 0%   14.00 ± 0%  -33.33% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-square-Gas=512-14            17.00 ± 0%   10.00 ± 0%  -41.18% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-qube-Gas=512-14              18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-14       21.00 ± 0%   14.00 ± 0%  -33.33% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-square-Gas=2048-14           17.00 ± 0%   10.00 ± 0%  -41.18% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-14             18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-14      21.00 ± 0%   14.00 ± 0%  -33.33% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-square-Gas=8192-14           17.00 ± 0%   10.00 ± 0%  -41.18% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-14             19.00 ± 0%   12.00 ± 0%  -36.84% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-14     22.00 ± 0%   15.00 ± 0%  -31.82% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-square-Gas=32768-14          18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-14            20.00 ± 0%   13.00 ± 0%  -35.00% (p=0.000 n=10)
PrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-14     38.00 ± 0%   31.00 ± 0%  -18.42% (p=0.000 n=10)
PrecompiledModExpEip7883/marius-1-even-Gas=45296-14              53.00 ± 0%   43.00 ± 0%  -18.87% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-1-even-Gas=51136-14               56.00 ± 0%   46.00 ± 0%  -17.86% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-2-even-Gas=51152-14               54.00 ± 0%   44.00 ± 0%  -18.52% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-3-even-Gas=32400-14               19.00 ± 0%   12.00 ± 0%  -36.84% (p=0.000 n=10)
PrecompiledModExpEip7883/guido-4-even-Gas=94448-14              19.000 ± 0%   9.000 ± 0%  -52.63% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-14         18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-14         38.00 ± 0%   28.00 ± 0%  -26.32% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-14           19.00 ± 0%   12.00 ± 0%  -36.84% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-14         19.00 ± 0%   12.00 ± 0%  -36.84% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-14         38.00 ± 0%   28.00 ± 0%  -26.32% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-14           22.00 ± 0%   15.00 ± 0%  -31.82% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-14         37.00 ± 0%   28.00 ± 0%  -24.32% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-14          37.00 ± 0%   28.00 ± 0%  -24.32% (p=0.000 n=10)
PrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-14           37.00 ± 0%   28.00 ± 0%  -24.32% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-14              51.00 ± 0%   41.00 ± 0%  -19.61% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-14              51.00 ± 0%   41.00 ± 0%  -19.61% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-32-Gas=500-14                22.00 ± 0%   13.00 ± 0%  -40.91% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-36-Gas=560-14                23.00 ± 0%   14.00 ± 0%  -39.13% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-40-Gas=624-14                22.00 ± 0%   13.00 ± 0%  -40.91% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-14               22.00 ± 0%   13.00 ± 0%  -40.91% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-14               53.00 ± 0%   44.00 ± 0%  -16.98% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-14              53.00 ± 0%   44.00 ± 0%  -16.98% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-14               18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-14               18.00 ± 0%   11.00 ± 0%  -38.89% (p=0.000 n=10)
PrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-14             21.00 ± 0%   14.00 ± 0%  -33.33% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-14          53.00 ± 0%   43.00 ± 0%  -18.87% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-14           55.00 ± 0%   45.00 ± 0%  -18.18% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-14           54.00 ± 0%   45.00 ± 0%  -16.67% (p=0.000 n=10)
PrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-14           54.00 ± 0%   45.00 ± 0%  -16.67% (p=0.000 n=10)
PrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-14       21.00 ± 0%   12.00 ± 0%  -42.86% (p=0.000 n=10)
geomean                                                          26.59        17.27       -35.03%
```

Co-authored-by: @kevaundray
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-08 13:33:10 +02:00
Csaba Kiraly
d95ca2e056
cmd/devp2p/internal/ethtest: fix possible infinite wait (#32551)
TestBlobTxWithoutSidecar test could run infinitely in case of a client
not requesting the good transaction. This adds a timeout to make the
test fail in this case.

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

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-09-08 12:33:17 +02:00
rjl493456442
bc4ee71a5d
triedb/pathdb: add recovery mechanism in state indexer (#32447)
Alternative of #32335, enhancing the history indexer recovery after
unclean shutdown.
2025-09-08 16:07:00 +08:00
Delweng
c4ec4504bb
core/state: state size tracking (#32362)
Add state size tracking and retrieve api, start geth with `--state.size-tracking`, 
the initial bootstrap is required (around 1h on mainnet), after the bootstrap, 
use `debug_stateSize()` RPC to retrieve the state size:

```
> debug.stateSize()
{
  accountBytes: "0x39681967b",
  accountTrienodeBytes: "0xc57939f0c",
  accountTrienodes: "0x198b36ac",
  accounts: "0x129da14a",
  blockNumber: "0x1635e90",
  contractCodeBytes: "0x2b63ef481",
  contractCodes: "0x1c7b45",
  stateRoot: "0x9c36a3ec3745d72eea8700bd27b90dcaa66de0494b187c5600750044151e620a",
  storageBytes: "0x18a6e7d3f1",
  storageTrienodeBytes: "0x2e7f53fae6",
  storageTrienodes: "0x6e49a234",
  storages: "0x517859c5"
}
```

---------

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-09-08 14:00:23 +08:00
Delweng
8ce2047348
cmd/geth: set trie journal for pathdb (#32531)
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
As in #32060 we introduced the file based journal path, for the other
sub command(eg: snapshot, db), we should also pass the directory to the
triedb, else the subcommand(eg: `geth snapshot`) failed to run:

```bash
geth snapshot verify-state --datadir /geth-data
...
INFO [09-02|02:12:29.493] Allocated cache and file handles         database=/geth-data/geth/chaindata cache=512.00MiB handles=524,288
INFO [09-02|02:12:32.746] Opened ancient database                  database=/geth-data/geth/chaindata/ancient/chain readonly=true
INFO [09-02|02:12:32.746] Opened Era store                         datadir=/geth-data/geth/chaindata/ancient/chain/era
INFO [09-02|02:12:32.758] State scheme set to already existing     scheme=path
INFO [09-02|02:12:32.760] Load database journal from disk
INFO [09-02|02:12:32.764] Failed to load journal, discard it       err="journal not found"
INFO [09-02|02:12:32.789] Opened ancient database                  database=/geth-data/geth/chaindata/ancient/state readonly=true
INFO [09-02|02:12:32.790] Initialized path database                readonly=true triecache=0.00B statecache=0.00B buffer=0.00B history="entire chain"
ERROR[09-02|02:12:32.791] Failed to verify state                   root=c5458d..4cc785 err="unknown layer: c5458d476da0136a67ef24a93b909aa5c29efa5c5b885dbd1fbaed4e784cc785"
```
2025-09-05 10:59:11 +08:00
rjl493456442
902ec5baae
cmd, core, eth, triedb/pathdb: track node origins in the path database (#32418)
This PR is the first step in the trienode history series.

It introduces the `nodeWithOrigin` struct in the path database, which tracks
the original values of dirty nodes to support trienode history construction.

Note, the original value is always empty in this PR, so it won't break the 
existing journal for encoding and decoding. The compatibility of journal 
should be handled in the following PR.
2025-09-05 10:37:05 +08:00
rjl493456442
f5fcfb2fbe
core/rawdb: remove outdated functions (#32542)
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-09-04 17:25:33 +08:00
Csaba Kiraly
70f177a527
core/txpool/blobpool: fix getblobs error handling (#32538)
Another getBlobs PR on top of
https://github.com/ethereum/go-ethereum/pull/32190 to avoid some minor
regressions.

- bring back more log messages from before
- continue processing also on some internal errors
- ensure v2 complies with spec even if there are internal errors

---------

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-04 09:42:03 +02:00
Sina M
e6884ccccf
core/tracing: update changelog (#32535)
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
Update all the accumulated changes
2025-09-03 09:45:58 +02:00
rjl493456442
00516c71fb
core/txpool/blobpool, eth/catalyst: place null for missing blob (#32536)
This pull request fixes a regression, introduced in #32190

Specifically, in GetBlobsV1 engine API, if any blob is missing, the null
should be placed in
response, unfortunately a behavioral change was introduced in #32190,
returning an error
instead.

What's more, a more comprehensive test suite is added to cover both
`GetBlobsV1` and
`GetBlobsV2` endpoints.
2025-09-03 09:44:00 +02:00
keeghcet
0e82b6be63
core/txpool: fix duplicate function comment (#32524)
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-09-02 20:01:33 +08:00
Sina M
328add2a5a
core/tracing: add code change reason (#32525)
Closes #32376
2025-09-02 12:44:47 +02:00
Sina M
6f08b3a725
core/tracing: fix selfdestruct 6780 balance change emit (#32526)
Noticed in #32376
2025-09-02 12:44:09 +02:00
Ömer Faruk Irmak
c36f7bec7f
core/stateless: track number of leaf nodes at each trie depth (#32533)
Switches to using counters so that the gauges don't cause any
information to be lost. Counters can be used to calculate all sorts of
metrics on Grafana. Which is also why min/avg/max logic is removed to
make things simple and small here.
2025-09-02 12:43:26 +02:00
Guillaume Ballet
1263f3dfc1
version: begin v1.16.4 release cycle (#32529)
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-09-01 20:38:37 +02:00
Guillaume Ballet
0978604196
version: release v1.16.3 (#32528)
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-09-01 17:19:26 +02:00
lightclient
ffe758c7a7
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 <m.vanderwijden@live.de>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-01 16:40:41 +02:00
Guillaume Ballet
bd4b17907f
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 <parithosh.jayanthi@ethereum.org>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-01 21:06:51 +08:00
Guillaume Ballet
931befe83d
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.
2025-09-01 17:37:09 +08:00
Mars
0e69530c6e
all: improve ETA calculation across all progress indicators (#32521)
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
### 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

3aeccadd04/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.
2025-09-01 13:47:02 +08:00
Delweng
0cde5278e8
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 <delweng@gmail.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-09-01 13:41:41 +08:00
operagxoksana
3aeccadd04
README: add twitter badge to documentation (#32516)
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
2025-08-29 14:10:38 +02:00
rjl493456442
7f78fa6912
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.
2025-08-29 15:43:58 +08:00
Zach Brown
2a795c14f4
all: fix problematic function name in comment (#32513)
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
Fix problematic function name in comment.
Do my best to correct them all with a script to avoid spamming PRs.
2025-08-29 08:54:23 +08:00
oooLowNeoNooo
0979c6a1fa
core: improve error context in state processor for Prague EIPs (#32509)
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
Add better error context for EIP-6110, EIP-7002, and EIP-7251 processing
in state processor to improve debugging capabilities.
2025-08-28 22:43:45 +08:00
Csaba Kiraly
9af1f71e78
eth: stabilize tx relay peer selection (#31714)
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
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 <csaba.kiraly@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-28 16:05:54 +02:00
slicesequal
3a89051d86
node: fix problematic function name in comment (#32510)
fix problematic function name in comment

Signed-off-by: slicesequal <slicesequal@outlook.com>
2025-08-28 21:15:20 +08:00
formless
e67761ef35
eth/tracers: fix testcase 7702_delegate (#32349)
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 a prestateTracer test case covering 7702 delegation.

---------

Co-authored-by: Jared Wasinger <j-wasinger@hotmail.com>
Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2025-08-27 21:40:55 +02:00
rjl493456442
f90eb3e507
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 <m.vanderwijden@live.de>
Co-authored-by: lightclient <lightclient@protonmail.com>
2025-08-27 11:03:29 -06:00
nthumann
52ec2b5f47
accounts/abi: fix panic when check event with log has empty or nil topics (#32503)
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
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.
2025-08-27 20:36:45 +08:00
Marcel
7db6c91254
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 <itz.s1na@gmail.com>
2025-08-27 11:33:18 +02:00
Avory
6191f31508
eth: replace hardcoded sleep with polling loop in snap sync test (#32499)
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 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 <lightclient@protonmail.com>
2025-08-27 09:49:47 +08:00
lightclient
eab5c929a2
rpc: refactor read limit test (#32494)
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
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.
2025-08-26 23:43:51 +02:00
rjl493456442
95ab643bb8
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
2025-08-26 21:53:55 +08:00
Shane Bammel
f877183cbb
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 <itz.s1na@gmail.com>
2025-08-26 15:44:16 +02:00
tzchenxixi
514322ce0f
cmd: fix typo in comment (#32501)
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 function name in the comment should be `writeErrors` instead of
`writeQueries`.

Signed-off-by: tzchenxixi <tzchenxixi@icloud.com>
2025-08-26 13:50:19 +02:00
ericxtheodore
27d4a10185
build: add support for ubuntu 25.04 (#31666) 2025-08-26 09:29:29 +02:00
rjl493456442
8c58f4920d
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.
2025-08-26 08:52:39 +02:00
Daniel Liu
16bd164f3b
internal/web3ext: remove deprecated method debug_seedHash (#32495)
The corresponding function was removed in #27178
2025-08-26 13:56:03 +08:00
Snezhkko
7a87d8a46d
eth/tracers: add missing teardown in TestTraceChain (#32472)
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 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 <itz.s1na@gmail.com>
2025-08-25 21:02:14 +02:00
Péter Garamvölgyi
42467f1370
params: fix history serve window for verkle test (#32127)
Fixes the history serve window parameter for the
test function `getContractStoredBlockHash`.

Fixes #32458.
2025-08-25 21:00:44 +02:00
cui
9b2e8e7ce3
p2p: use slices.Clone (#32428)
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
Replaces a helper method with slices.Clone
2025-08-25 11:30:51 +02:00
Guillaume Ballet
a9ac275588
.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.
2025-08-25 11:02:33 +02:00
pxwanglu
d0602ba45a
core,trie: fix typo in TransitionTrie (#32491)
Change `NewTransitionTree` to the correct `NewTransitionTrie`.

Signed-off-by: pxwanglu <pxwanglu@icloud.com>
2025-08-25 09:29:58 +02:00
ericxtheodore
f62eec955d
node: fix vhosts for adminAPI (#32488)
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-08-25 09:52:54 +08:00
Ocenka
276ed4848c
p2p/discover: add discv5 invalid findnodes result test cases (#32481)
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
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 <lightclient@protonmail.com>
2025-08-22 11:44:11 -06:00
shazam8253
e9656238a7
core, miner, trie: add metrics tracking state trie depth (#32388)
Co-authored-by: shantichanal <158101918+shantichanal@users.noreply.github.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
2025-08-22 22:09:14 +08:00
rjl493456442
ac1731907d
triedb/pathdb: improve err message in historical state reader (#32477)
Fixes https://github.com/ethereum/go-ethereum/issues/32474
2025-08-22 20:00:18 +08:00
Marius van der Wijden
10421edf3e
core/types: reduce allocations for transaction comparison (#31912)
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 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 <csaba.kiraly@gmail.com>
Co-authored-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2025-08-22 10:09:25 +02:00
cui
f3467d1e63
p2p: remove todo comment, as it's unnecessary (#32397)
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
as metioned in https://github.com/ethereum/go-ethereum/pull/32351, I
think this comment is unnecessary.
2025-08-21 15:48:46 -06:00
Rizky Ikwan
94ecd1db22
accounts/usbwallet: correct version comparison logic (#32417)
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

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.
2025-08-21 16:18:52 +02:00
Kapil Sareen
39ab721992
fixes missing protection of nil pointer dereference in scwallet (#32186)
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 #32181

Signed-off-by: kapil <kapilsareen584@gmail.com>
2025-08-21 09:41:54 +02:00
cui
44fc0c8706
rlp: refactor to use maths.ReadBits (#32432)
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-08-21 09:37:08 +08:00
cui
997dff4fae
p2p: using math.MaxInt32 from go std lib (#32357)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-20 16:22:21 -06:00
rjl493456442
bf8f63dcd2
trie, core/state: introduce trie Prefetch for optimizing preload (#32134)
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 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.
2025-08-20 21:45:27 +08:00
rjl493456442
9ce40d19a8
internal/ethapi, miner: fix GetBlockReceipts for pending (#32461)
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-08-19 19:20:21 -06:00
maskpp
7d4852b9eb
eth/catalyst: return methods by reflect (#32300)
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
Return the exposed methods in `ConsensusAPI` by reflection.
2025-08-19 06:54:19 -06:00
Klimov Sergei
62ac0e05b6
p2p: update MaxPeers comment (#32414) 2025-08-19 20:14:11 +08:00
gohan
1c74f23761
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 <fjl@twurst.com>
2025-08-19 19:47:47 +08:00
Fibonacci747
dffa1f5104
ethclient/gethclient: use common.Hash to debug_traceTransaction (#32404) 2025-08-19 19:37:36 +08:00
Guillaume Ballet
d99143d7f5
CODEOWNERS: add gballet as the owner of trie package (#32466) 2025-08-19 19:21:16 +08:00
Yiming Zang
d93f820358
rpc: add SetWebsocketReadLimit in Server (#32279)
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
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:

ec830979ac/poc.go

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-19 14:32:59 +08:00
cui
42bf4844d8
core/rawdb: enhance database key construction (#32431) 2025-08-19 14:19:01 +08:00
phrwlk
7cc01375ef
eth/syncer: stop ticker to prevent resource leak (#32443)
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-08-19 09:47:48 +08:00
kevaundray
5b2fc67eee
core/rawdb: add non-unix alternative for tablewriter (#32455)
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
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 <garyrong0905@gmail.com>
2025-08-18 20:42:22 +08:00
kevaundray
85077be58e
metrics: add tinygo build flag for CPU time (#32454)
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-08-18 14:15:48 +08:00
jwasinger
a9a19c4202
core/vm: fix EIP-7823 modexp input length check (#32363)
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
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 <fjl@twurst.com>
2025-08-15 15:58:00 +02:00
Felix Lange
1693a48f8c
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.
2025-08-15 14:08:27 +02:00
Felix Lange
1d29e3ec0e
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 <m.vanderwijden@live.de>
2025-08-15 14:07:27 +02:00
cui
88922d2bf5
crypto/bn256: refactor to use bitutil.TestBytes (#32435)
Some checks are pending
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
2025-08-15 15:12:22 +08:00
cui
ccf684f1ba
core/vm: refactor to use bitutil.TestBytes (#32434) 2025-08-15 15:10:44 +08:00
Guillaume Ballet
a002a6c03f
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.
2025-08-15 14:58:24 +08:00
Guillaume Ballet
ea3a71792d
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 <3272758+gballet@users.noreply.github.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-08-15 14:34:32 +08:00
cui
2dbb580f51
build: remove unused functions (#32393)
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-08-14 14:47:43 +02:00
cui
e798e26c69
crypto/secp256k1: use ReadBits from common/math (#32430) 2025-08-14 14:32:45 +02:00
levisyin
25cce4dfe4
build: upgrade -dlgo version to Go 1.25.0 (#32412) 2025-08-14 13:24:47 +02:00
Felix Lange
b00b6fe234
.github: upgrade workflows to Go 1.25 (#32425) 2025-08-14 13:07:20 +02:00
cui
2b38daa48c
p2p: refactor to use time.Now().UnixMilli() in golang std lib (#32402) 2025-08-14 16:28:57 +08:00
Marius van der Wijden
3ff99ae52c
eth/syncer: fix typo (#32427)
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
avaibale -> available
2025-08-13 09:12:08 -06:00
Nebojsa Urosevic
51342136fa
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 <itz.s1na@gmail.com>
2025-08-13 13:51:38 +02:00
cui
f054befc55
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)
2025-08-13 12:00:54 +02:00
cui
a4d3fb9805
node: remove unused err var (#32398)
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-08-13 15:08:23 +08:00
Klimov Sergei
75fc56f27d
eth: abort requiredBlocks check if peer handler terminated (#32413) 2025-08-13 15:02:50 +08:00
youzichuan
56edd21453
cmd: fix inconsistent function name in comment (#32411)
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
fix inconsistent function name in comment

Signed-off-by: youzichuan <youzichuan6@outlook.com>
2025-08-12 11:37:09 -06:00
cui
43b2aac33c
trie: refactor to use slices.Concat (#32401)
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-08-12 21:47:18 +08:00
Rizky Ikwan
2e9c9b5e98
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.
2025-08-12 06:11:18 -06:00
rjl493456442
cbbf686ecc
trie, core: rework tracer and track origin value of dirty nodes (#32306)
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
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.
2025-08-11 21:55:38 +08:00
Forostovec
55a471efaf
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.
2025-08-11 21:34:59 +08:00
cui
92106a6b17
accounts/abi, accounts/keystore: use reflect.TypeFor (#32323)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-11 14:24:55 +02:00
sashass1315
2485d096f3
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.
2025-08-11 12:48:38 +02:00
cui
6238effeff
miner: remove todo comment (#32389)
see
https://github.com/ethereum/go-ethereum/pull/32372#discussion_r2265885182
2025-08-11 12:05:06 +02:00
cui
40072af04a
core/vm: make types consistent in makeDup (#32378) 2025-08-11 15:00:11 +08:00
MozirDmitriy
18b4ee5972
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).
2025-08-11 14:32:27 +08:00
kashitaka
8ba1c791bf
ethclient: fix flaky pending tx test (#32380)
Fixes: https://github.com/ethereum/go-ethereum/issues/32252
2025-08-11 14:29:07 +08:00
Ömer Faruk Irmak
c3ef6c77c2
core/vm: fold EVMInterpreter into EVM (#32352)
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
The separation serves no purpose atm, and the circular dependency that
EVM and EVMInterpreter had was begging for them to be merged.
2025-08-08 00:01:41 +02:00
cui
888b71b3cf
metrics: use atomic.Pointer in runtimeHistogram (#32361)
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
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-07 20:03:30 +02:00
radik878
f86870f5da
eth/downloader: fix incomplete code comment (#32354) 2025-08-07 16:31:02 +02:00
cui
4e7bc2bdc8
rlp: use reflect.TypeFor (#32317)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-07 15:58:27 +02:00
cui
bd6797eafa
signer/core/apitypes: simplify reflect []byte creation (#32315)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-08-07 15:56:25 +02:00
cui
e979438a55
p2p/enode: use atomic.Pointer in LocalNode (#32360) 2025-08-07 15:03:18 +02:00
cui
f9f85d0227
core: use reflect.TypeFor (#32320)
https://github.com/golang/go/issues/60088
2025-08-07 14:53:36 +02:00
cui
2e3971aed1
beacon/merkle: use reflect.TypeFor (#32322) 2025-08-07 14:36:20 +02:00
cui
ec97ac7085
common, common/hexutil: use reflect.TypeFor (#32321) 2025-08-07 14:30:03 +02:00
cui
dfde155541
crypto/kzg4844: use reflect.TypeFor (#32319) 2025-08-07 14:22:11 +02:00
cui
f49f3ec780
rpc: use reflect.TypeFor (#32316)
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-08-07 14:15:54 +02:00
cui
e7189b5987
go.mod: upgraded github.com/golang-jwt/jwt/v4 v4.5.1 => v4.5.2 (#32356)
https://pkg.go.dev/vuln/GO-2025-3553
2025-08-07 17:42:22 +09:00
cui
792de5d2e3
core/filtermaps: remove unnecessary nil check and add cv2 lock (#32309)
Some checks are pending
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run
/ Linux Build (push) Waiting to run
Co-authored-by: zsfelfoldi <zsfelfoldi@gmail.com>
2025-08-06 12:57:43 +02:00
Minhyuk Kim
59405c40d3
eth/gasestimator: check ErrGasLimitTooHigh conditions (#32348)
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 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 <garyrong0905@gmail.com>
2025-08-05 19:51:16 +08:00
maskpp
e9dca3b181
eth/catalyst: avoid load the same blob tx multi times (#32190)
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 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 <garyrong0905@gmail.com>
2025-08-05 13:07:45 +08:00
Guillaume Ballet
cf50026466
core/state: introduce the TransitionState object (verkle transition part 1) (#31634)
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 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 <3272758+gballet@users.noreply.github.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-08-05 09:34:12 +08:00
rjl493456442
073e7ec4b0
version: begin v1.16.3 release cycle (#32345)
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-08-04 16:24:38 +02:00
rjl493456442
dd1ebac117
version: release v1.16.2 (#32343) 2025-08-04 21:59:08 +08:00
Felföldi Zsolt
5ebd8032b9
beacon/params, core/filtermaps: update checkpoints (#32336)
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 updates checkpoints for blsync and filtermaps.
2025-08-04 09:19:33 +08:00
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
maskpp
055e1e6291
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 <j-wasinger@hotmail.com>
2025-07-14 09:07:47 +02:00
PixelPilot
b992b105ef
cmd/geth: update vcheck testdata, add docs on generating signatures (#32121)
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
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 <lightclient@protonmail.com>
2025-07-11 13:55:18 -06:00
Felix Lange
8cf87c65e9 .github: remove karalabe from CODEOWNERS
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-11 14:58:21 +02:00
rjl493456442
071372553e
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.
2025-07-11 19:56:16 +08:00
jwasinger
1ef3bcab8f
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 <garyrong0905@gmail.com>
2025-07-11 19:51:04 +08:00
CrazyFrog
355228b011
cmd/clef: update Safe API documentation links in changelog (#32136)
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 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.
2025-07-09 14:09:11 -06:00
maskpp
bd5b55e6a9
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.
2025-07-09 10:49:06 -06:00
jwasinger
e6b9d0c2b6
core,miner: implement EIP-7934 - RLP Execution Block Size Limit (#31990)
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 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 <spencer@spencertaylorbrown.uk>
Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2025-07-09 11:24:44 +02:00
Felix Lange
efbba965b5
core/vm: update gas cost of CLZ to five (#32172)
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
a794de3fcf
2025-07-09 08:46:59 +08:00
jwasinger
1cbcebcf47
miner, core, core/txpool: implement EIP 7825 - TX Gas Limit Cap (#31824)
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
Implements EIP-7825

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
Co-authored-by: lightclient <lightclient@protonmail.com>
Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
2025-07-08 15:23:22 +02:00
jwasinger
43832e65fd
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 <m.vanderwijden@live.de>
2025-07-08 22:15:53 +09:00
rjl493456442
e71487b033
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.
2025-07-08 15:51:08 +08:00
Felix Lange
b3131f00a3
core/vm: implement EIP-7951 - precompile for secp256r1 (#31991)
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/9833

Based on #27540, #30043

---------

Co-authored-by: Ulaş Erdoğan <uerdogan2001@hotmail.com>
2025-07-07 20:59:45 +02:00
Sina M
ffb4e6fd5d
consensus/misc/eip4844: implement EIP-7918 (#31965)
https://eips.ethereum.org/EIPS/eip-7918

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2025-07-07 16:17:25 +02:00
Felix Lange
84f2932b1e
.github, internal/flags: improve actions test runs (#32150)
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 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.
2025-07-07 13:26:11 +02:00
maskpp
f0741e6dfe
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.
2025-07-07 13:00:34 +02:00
Giulio rebuffo
90c6197d2f
core/vm: implement EIP-7939 - CLZ opcode (#31989)
https://eips.ethereum.org/EIPS/eip-7939

---------

Co-authored-by: spencer-tb <spencer@spencertaylorbrown.uk>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-07-07 11:19:33 +02:00
Ömer Faruk Irmak
bdf47f4557
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.
2025-07-07 10:01:29 +02:00
Felix Lange
063033834b .gitea: fix typo in windows workflow
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
2025-07-04 13:45:29 +02:00
Felix Lange
9efe1c16e2 gitea: set PATH in script 2025-07-04 13:42:55 +02:00
Felix Lange
db1806efa2 gitea: try with cmd 2025-07-04 13:38:26 +02:00
Felix Lange
3f4555abc6 .gitea: set PATH 2025-07-04 13:25:40 +02:00
Felix Lange
e225983a06 .gitea: update PATH 2025-07-04 13:03:58 +02:00
Felix Lange
7088e87dce .gitea: add workflow_dispatch for release build
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-04 13:02:57 +02:00
rjl493456442
dd7d144745
cmd/utils: update flag description of gcmode (#32145) 2025-07-04 12:17:44 +02:00
Zhou
f786b2a767
cmd/utils: show full deprecated flags (#32141)
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 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`
2025-07-04 09:40:16 +08:00
753 changed files with 73324 additions and 23710 deletions

View file

@ -4,6 +4,7 @@ on:
- "master" - "master"
tags: tags:
- "v*" - "v*"
workflow_dispatch:
jobs: jobs:
linux-intel: linux-intel:
@ -121,6 +122,27 @@ jobs:
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }} LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }} AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
keeper:
name: Keeper Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false
- name: Install cross toolchain
run: |
apt-get update
apt-get -yq --no-install-suggests --no-install-recommends install gcc-multilib
- name: Build (amd64)
run: |
go run build/ci.go keeper -dlgo
windows: windows:
name: Windows Build name: Windows Build
runs-on: "win-11" runs-on: "win-11"
@ -137,18 +159,20 @@ jobs:
# contained in PATH. # contained in PATH.
- name: "Build (amd64)" - name: "Build (amd64)"
shell: cmd
run: | run: |
go run build/ci.go install -dlgo -arch amd64 -cc %GETH_CC% set PATH=%GETH_MINGW%\bin;%PATH%
go run build/ci.go install -dlgo -arch amd64 -cc %GETH_MINGW%\bin\gcc.exe
env: env:
PATH: 'C:\msys64\mingw64\bin;C:\Program Files (x86)\NSIS\;%PATH%' GETH_MINGW: 'C:\msys64\mingw64'
GETH_CC: 'C:\msys64\mingw64\bin\gcc.exe'
- name: "Build (386)" - name: "Build (386)"
shell: cmd
run: | run: |
go run build/ci.go install -dlgo -arch 386 -cc %GETH_CC% set PATH=%GETH_MINGW%\bin;%PATH%
go run build/ci.go install -dlgo -arch 386 -cc %GETH_MINGW%\bin\gcc.exe
env: env:
PATH: 'C:\msys64\mingw32\bin;C:\Program Files (x86)\NSIS\;%PATH%' GETH_MINGW: 'C:\msys64\mingw32'
GETH_CC: 'C:\msys64\mingw32\bin\gcc.exe'
docker: docker:
name: Docker Image name: Docker Image

4
.github/CODEOWNERS vendored
View file

@ -19,7 +19,7 @@ eth/tracers/ @s1na
ethclient/ @fjl ethclient/ @fjl
ethdb/ @rjl493456442 ethdb/ @rjl493456442
event/ @fjl event/ @fjl
trie/ @rjl493456442 trie/ @rjl493456442 @gballet
triedb/ @rjl493456442 triedb/ @rjl493456442
core/tracing/ @s1na core/tracing/ @s1na
graphql/ @s1na graphql/ @s1na
@ -29,5 +29,5 @@ miner/ @MariusVanDerWijden @fjl @rjl493456442
node/ @fjl node/ @fjl
p2p/ @fjl @zsfelfoldi p2p/ @fjl @zsfelfoldi
rlp/ @fjl rlp/ @fjl
params/ @fjl @karalabe @gballet @rjl493456442 @zsfelfoldi params/ @fjl @gballet @rjl493456442 @zsfelfoldi
rpc/ @fjl rpc/ @fjl

View file

@ -1,18 +1,20 @@
name: i386 linux tests
on: on:
push: push:
branches: [ master ] branches:
- master
pull_request: pull_request:
branches: [ master ] branches:
- master
workflow_dispatch: workflow_dispatch:
jobs: jobs:
lint: lint:
name: Lint name: Lint
runs-on: self-hosted runs-on: [self-hosted-ghr, size-s-x64]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
submodules: false
# Cache build tools to avoid downloading them each time # Cache build tools to avoid downloading them each time
- uses: actions/cache@v4 - uses: actions/cache@v4
@ -23,7 +25,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: 1.23.0 go-version: 1.25
cache: false cache: false
- name: Run linters - name: Run linters
@ -32,17 +34,66 @@ jobs:
go run build/ci.go check_generate go run build/ci.go check_generate
go run build/ci.go check_baddeps go run build/ci.go check_baddeps
build: keeper:
runs-on: self-hosted name: Keeper Builds
needs: test
runs-on: [self-hosted-ghr, size-l-x64]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
submodules: true
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: 1.24.0 go-version: '1.25'
cache: false cache: false
- name: Build
run: go run build/ci.go keeper
test-32bit:
name: "32bit tests"
needs: test
runs-on: [self-hosted-ghr, size-l-x64]
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: false
- name: Install cross toolchain
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install gcc-multilib
- name: Build
run: go run build/ci.go test -arch 386 -short -p 8
test:
name: Test
needs: lint
runs-on: [self-hosted-ghr, size-l-x64]
strategy:
matrix:
go:
- '1.25'
- '1.24'
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false
- name: Run tests - name: Run tests
run: go test -short ./... run: go run build/ci.go test -p 8
env:
GOOS: linux
GOARCH: 386

83
.github/workflows/validate_pr.yml vendored Normal file
View file

@ -0,0 +1,83 @@
name: PR Format Validation
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
validate-pr:
runs-on: ubuntu-latest
steps:
- name: Check for Spam PR
uses: actions/github-script@v7
with:
script: |
const prTitle = context.payload.pull_request.title;
const spamRegex = /^(feat|chore|fix)(\(.*\))?\s*:/i;
if (spamRegex.test(prTitle)) {
// Leave a comment explaining why
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `## PR Closed as Spam
This PR was automatically closed because the title format \`feat:\`, \`fix:\`, or \`chore:\` is commonly associated with spam contributions.
If this is a legitimate contribution, please:
1. Review our contribution guidelines
2. Use the correct PR title format: \`directory, ...: description\`
3. Open a new PR with the proper title format
Thank you for your understanding.`
});
// Close the PR
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
state: 'closed'
});
core.setFailed('PR closed as spam due to suspicious title format');
return;
}
console.log('✅ PR passed spam check');
- name: Checkout repository
uses: actions/checkout@v4
- name: Check PR Title Format
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const prTitle = context.payload.pull_request.title;
const titleRegex = /^([\w\s,{}/.]+): .+/;
if (!titleRegex.test(prTitle)) {
core.setFailed(`PR title "${prTitle}" does not match required format: directory, ...: description`);
return;
}
const match = prTitle.match(titleRegex);
const dirPart = match[1];
const directories = dirPart.split(',').map(d => d.trim());
const missingDirs = [];
for (const dir of directories) {
const fullPath = path.join(process.env.GITHUB_WORKSPACE, dir);
if (!fs.existsSync(fullPath)) {
missingDirs.push(dir);
}
}
if (missingDirs.length > 0) {
core.setFailed(`The following directories in the PR title do not exist: ${missingDirs.join(', ')}`);
return;
}
console.log('✅ PR title format is valid');

1
.gitignore vendored
View file

@ -56,3 +56,4 @@ cmd/evm/evm
cmd/geth/geth cmd/geth/geth
cmd/rlpdump/rlpdump cmd/rlpdump/rlpdump
cmd/workload/workload cmd/workload/workload
cmd/keeper/keeper

98
AGENTS.md Normal file
View file

@ -0,0 +1,98 @@
# AGENTS
## Guidelines
- **Keep changes minimal and focused.** Only modify code directly related to the task at hand. Do not refactor unrelated code, rename existing variables or functions for style, or bundle unrelated fixes into the same commit or PR.
- **Do not add, remove, or update dependencies** unless the task explicitly requires it.
## Pre-Commit Checklist
Before every commit, run **all** of the following checks and ensure they pass:
### 1. Formatting
Before committing, always run `gofmt` and `goimports` on all modified files:
```sh
gofmt -w <modified files>
goimports -w <modified files>
```
### 2. Build All Commands
Verify that all tools compile successfully:
```sh
make all
```
This builds all executables under `cmd/`, including `keeper` which has special build requirements.
### 3. Tests
While iterating during development, use `-short` for faster feedback:
```sh
go run ./build/ci.go test -short
```
Before committing, run the full test suite **without** `-short` to ensure all tests pass, including the Ethereum execution-spec tests and all state/block test permutations:
```sh
go run ./build/ci.go test
```
### 4. Linting
```sh
go run ./build/ci.go lint
```
This runs additional style checks. Fix any issues before committing.
### 5. Generated Code
```sh
go run ./build/ci.go check_generate
```
Ensures that all generated files (e.g., `gen_*.go`) are up to date. If this fails, first install the required code generators by running `make devtools`, then run the appropriate `go generate` commands and include the updated files in your commit.
### 6. Dependency Hygiene
```sh
go run ./build/ci.go check_baddeps
```
Verifies that no forbidden dependencies have been introduced.
## Commit Message Format
Commit messages must be prefixed with the package(s) they modify, followed by a short lowercase description:
```
<package(s)>: description
```
Examples:
- `core/vm: fix stack overflow in PUSH instruction`
- `eth, rpc: make trace configs optional`
- `cmd/geth: add new flag for sync mode`
Use comma-separated package names when multiple areas are affected. Keep the description concise.
## Pull Request Title Format
PR titles follow the same convention as commit messages:
```
<list of modified paths>: description
```
Examples:
- `core/vm: fix stack overflow in PUSH instruction`
- `core, eth: add arena allocator support`
- `cmd/geth, internal/ethapi: refactor transaction args`
- `trie/archiver: streaming subtree archival to fix OOM`
Use the top-level package paths, comma-separated if multiple areas are affected. Only mention the directories with functional changes, interface changes that trickle all over the codebase should not generate an exhaustive list. The description should be a short, lowercase summary of the change.

View file

@ -8,6 +8,7 @@ https://pkg.go.dev/badge/github.com/ethereum/go-ethereum
[![Go Report Card](https://goreportcard.com/badge/github.com/ethereum/go-ethereum)](https://goreportcard.com/report/github.com/ethereum/go-ethereum) [![Go Report Card](https://goreportcard.com/badge/github.com/ethereum/go-ethereum)](https://goreportcard.com/report/github.com/ethereum/go-ethereum)
[![Travis](https://app.travis-ci.com/ethereum/go-ethereum.svg?branch=master)](https://app.travis-ci.com/github/ethereum/go-ethereum) [![Travis](https://app.travis-ci.com/ethereum/go-ethereum.svg?branch=master)](https://app.travis-ci.com/github/ethereum/go-ethereum)
[![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.gg/nthXNEv) [![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.gg/nthXNEv)
[![Twitter](https://img.shields.io/twitter/follow/go_ethereum)](https://x.com/go_ethereum)
Automated builds are available for stable releases and the unstable master branch. Binary Automated builds are available for stable releases and the unstable master branch. Binary
archives are published at https://geth.ethereum.org/downloads/. archives are published at https://geth.ethereum.org/downloads/.

View file

@ -21,7 +21,6 @@ Audit reports are published in the `docs` folder: https://github.com/ethereum/go
To find out how to disclose a vulnerability in Ethereum visit [https://bounty.ethereum.org](https://bounty.ethereum.org) or email bounty@ethereum.org. Please read the [disclosure page](https://github.com/ethereum/go-ethereum/security/advisories?state=published) for more information about publicly disclosed security vulnerabilities. To find out how to disclose a vulnerability in Ethereum visit [https://bounty.ethereum.org](https://bounty.ethereum.org) or email bounty@ethereum.org. Please read the [disclosure page](https://github.com/ethereum/go-ethereum/security/advisories?state=published) for more information about publicly disclosed security vulnerabilities.
Use the built-in `geth version-check` feature to check whether the software is affected by any known vulnerability. This command will fetch the latest [`vulnerabilities.json`](https://geth.ethereum.org/docs/vulnerabilities/vulnerabilities.json) file which contains known security vulnerabilities concerning `geth`, and cross-check the data against its own version number.
The following key may be used to communicate sensitive information to developers. The following key may be used to communicate sensitive information to developers.

View file

@ -33,6 +33,10 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
) )
var (
intRegex = regexp.MustCompile(`(u)?int([0-9]*)`)
)
func isKeyWord(arg string) bool { func isKeyWord(arg string) bool {
switch arg { switch arg {
case "break": case "break":
@ -299,7 +303,7 @@ func bindBasicType(kind abi.Type) string {
case abi.AddressTy: case abi.AddressTy:
return "common.Address" return "common.Address"
case abi.IntTy, abi.UintTy: case abi.IntTy, abi.UintTy:
parts := regexp.MustCompile(`(u)?int([0-9]*)`).FindStringSubmatch(kind.String()) parts := intRegex.FindStringSubmatch(kind.String())
switch parts[2] { switch parts[2] {
case "8", "16", "32", "64": case "8", "16", "32", "64":
return fmt.Sprintf("%sint%s", parts[1], parts[2]) return fmt.Sprintf("%sint%s", parts[1], parts[2])

View file

@ -485,13 +485,13 @@ var bindTests = []struct {
contract Defaulter { contract Defaulter {
address public caller; address public caller;
function() { fallback() external payable {
caller = msg.sender; caller = msg.sender;
} }
} }
`, `,
[]string{`6060604052606a8060106000396000f360606040523615601d5760e060020a6000350463fc9c8d3981146040575b605e6000805473ffffffffffffffffffffffffffffffffffffffff191633179055565b606060005473ffffffffffffffffffffffffffffffffffffffff1681565b005b6060908152602090f3`}, []string{`608060405234801561000f575f80fd5b5061013d8061001d5f395ff3fe608060405260043610610021575f3560e01c8063fc9c8d391461006257610022565b5b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055005b34801561006d575f80fd5b5061007661008c565b60405161008391906100ee565b60405180910390f35b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100d8826100af565b9050919050565b6100e8816100ce565b82525050565b5f6020820190506101015f8301846100df565b9291505056fea26469706673582212201e9273ecfb1f534644c77f09a25c21baaba81cf1c444ebc071e12a225a23c72964736f6c63430008140033`},
[]string{`[{"constant":true,"inputs":[],"name":"caller","outputs":[{"name":"","type":"address"}],"type":"function"}]`}, []string{`[{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"caller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]`},
` `
"math/big" "math/big"

View file

@ -183,7 +183,7 @@ var (
// Solidity: {{.Original.String}} // Solidity: {{.Original.String}}
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}Event(log *types.Log) (*{{$contract.Type}}{{.Normalized.Name}}, error) { func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}Event(log *types.Log) (*{{$contract.Type}}{{.Normalized.Name}}, error) {
event := "{{.Original.Name}}" event := "{{.Original.Name}}"
if log.Topics[0] != {{ decapitalise $contract.Type}}.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != {{ decapitalise $contract.Type}}.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new({{$contract.Type}}{{.Normalized.Name}}) out := new({{$contract.Type}}{{.Normalized.Name}})

View file

@ -360,7 +360,7 @@ func (CrowdsaleFundTransfer) ContractEventName() string {
// Solidity: event FundTransfer(address backer, uint256 amount, bool isContribution) // Solidity: event FundTransfer(address backer, uint256 amount, bool isContribution)
func (crowdsale *Crowdsale) UnpackFundTransferEvent(log *types.Log) (*CrowdsaleFundTransfer, error) { func (crowdsale *Crowdsale) UnpackFundTransferEvent(log *types.Log) (*CrowdsaleFundTransfer, error) {
event := "FundTransfer" event := "FundTransfer"
if log.Topics[0] != crowdsale.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != crowdsale.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(CrowdsaleFundTransfer) out := new(CrowdsaleFundTransfer)

View file

@ -606,7 +606,7 @@ func (DAOChangeOfRules) ContractEventName() string {
// Solidity: event ChangeOfRules(uint256 minimumQuorum, uint256 debatingPeriodInMinutes, int256 majorityMargin) // Solidity: event ChangeOfRules(uint256 minimumQuorum, uint256 debatingPeriodInMinutes, int256 majorityMargin)
func (dAO *DAO) UnpackChangeOfRulesEvent(log *types.Log) (*DAOChangeOfRules, error) { func (dAO *DAO) UnpackChangeOfRulesEvent(log *types.Log) (*DAOChangeOfRules, error) {
event := "ChangeOfRules" event := "ChangeOfRules"
if log.Topics[0] != dAO.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != dAO.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(DAOChangeOfRules) out := new(DAOChangeOfRules)
@ -648,7 +648,7 @@ func (DAOMembershipChanged) ContractEventName() string {
// Solidity: event MembershipChanged(address member, bool isMember) // Solidity: event MembershipChanged(address member, bool isMember)
func (dAO *DAO) UnpackMembershipChangedEvent(log *types.Log) (*DAOMembershipChanged, error) { func (dAO *DAO) UnpackMembershipChangedEvent(log *types.Log) (*DAOMembershipChanged, error) {
event := "MembershipChanged" event := "MembershipChanged"
if log.Topics[0] != dAO.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != dAO.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(DAOMembershipChanged) out := new(DAOMembershipChanged)
@ -692,7 +692,7 @@ func (DAOProposalAdded) ContractEventName() string {
// Solidity: event ProposalAdded(uint256 proposalID, address recipient, uint256 amount, string description) // Solidity: event ProposalAdded(uint256 proposalID, address recipient, uint256 amount, string description)
func (dAO *DAO) UnpackProposalAddedEvent(log *types.Log) (*DAOProposalAdded, error) { func (dAO *DAO) UnpackProposalAddedEvent(log *types.Log) (*DAOProposalAdded, error) {
event := "ProposalAdded" event := "ProposalAdded"
if log.Topics[0] != dAO.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != dAO.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(DAOProposalAdded) out := new(DAOProposalAdded)
@ -736,7 +736,7 @@ func (DAOProposalTallied) ContractEventName() string {
// Solidity: event ProposalTallied(uint256 proposalID, int256 result, uint256 quorum, bool active) // Solidity: event ProposalTallied(uint256 proposalID, int256 result, uint256 quorum, bool active)
func (dAO *DAO) UnpackProposalTalliedEvent(log *types.Log) (*DAOProposalTallied, error) { func (dAO *DAO) UnpackProposalTalliedEvent(log *types.Log) (*DAOProposalTallied, error) {
event := "ProposalTallied" event := "ProposalTallied"
if log.Topics[0] != dAO.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != dAO.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(DAOProposalTallied) out := new(DAOProposalTallied)
@ -780,7 +780,7 @@ func (DAOVoted) ContractEventName() string {
// Solidity: event Voted(uint256 proposalID, bool position, address voter, string justification) // Solidity: event Voted(uint256 proposalID, bool position, address voter, string justification)
func (dAO *DAO) UnpackVotedEvent(log *types.Log) (*DAOVoted, error) { func (dAO *DAO) UnpackVotedEvent(log *types.Log) (*DAOVoted, error) {
event := "Voted" event := "Voted"
if log.Topics[0] != dAO.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != dAO.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(DAOVoted) out := new(DAOVoted)

View file

@ -72,7 +72,7 @@ func (EventCheckerDynamic) ContractEventName() string {
// Solidity: event dynamic(string indexed idxStr, bytes indexed idxDat, string str, bytes dat) // Solidity: event dynamic(string indexed idxStr, bytes indexed idxDat, string str, bytes dat)
func (eventChecker *EventChecker) UnpackDynamicEvent(log *types.Log) (*EventCheckerDynamic, error) { func (eventChecker *EventChecker) UnpackDynamicEvent(log *types.Log) (*EventCheckerDynamic, error) {
event := "dynamic" event := "dynamic"
if log.Topics[0] != eventChecker.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != eventChecker.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(EventCheckerDynamic) out := new(EventCheckerDynamic)
@ -112,7 +112,7 @@ func (EventCheckerEmpty) ContractEventName() string {
// Solidity: event empty() // Solidity: event empty()
func (eventChecker *EventChecker) UnpackEmptyEvent(log *types.Log) (*EventCheckerEmpty, error) { func (eventChecker *EventChecker) UnpackEmptyEvent(log *types.Log) (*EventCheckerEmpty, error) {
event := "empty" event := "empty"
if log.Topics[0] != eventChecker.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != eventChecker.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(EventCheckerEmpty) out := new(EventCheckerEmpty)
@ -154,7 +154,7 @@ func (EventCheckerIndexed) ContractEventName() string {
// Solidity: event indexed(address indexed addr, int256 indexed num) // Solidity: event indexed(address indexed addr, int256 indexed num)
func (eventChecker *EventChecker) UnpackIndexedEvent(log *types.Log) (*EventCheckerIndexed, error) { func (eventChecker *EventChecker) UnpackIndexedEvent(log *types.Log) (*EventCheckerIndexed, error) {
event := "indexed" event := "indexed"
if log.Topics[0] != eventChecker.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != eventChecker.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(EventCheckerIndexed) out := new(EventCheckerIndexed)
@ -196,7 +196,7 @@ func (EventCheckerMixed) ContractEventName() string {
// Solidity: event mixed(address indexed addr, int256 num) // Solidity: event mixed(address indexed addr, int256 num)
func (eventChecker *EventChecker) UnpackMixedEvent(log *types.Log) (*EventCheckerMixed, error) { func (eventChecker *EventChecker) UnpackMixedEvent(log *types.Log) (*EventCheckerMixed, error) {
event := "mixed" event := "mixed"
if log.Topics[0] != eventChecker.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != eventChecker.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(EventCheckerMixed) out := new(EventCheckerMixed)
@ -238,7 +238,7 @@ func (EventCheckerUnnamed) ContractEventName() string {
// Solidity: event unnamed(uint256 indexed arg0, uint256 indexed arg1) // Solidity: event unnamed(uint256 indexed arg0, uint256 indexed arg1)
func (eventChecker *EventChecker) UnpackUnnamedEvent(log *types.Log) (*EventCheckerUnnamed, error) { func (eventChecker *EventChecker) UnpackUnnamedEvent(log *types.Log) (*EventCheckerUnnamed, error) {
event := "unnamed" event := "unnamed"
if log.Topics[0] != eventChecker.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != eventChecker.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(EventCheckerUnnamed) out := new(EventCheckerUnnamed)

View file

@ -134,7 +134,7 @@ func (NameConflictLog) ContractEventName() string {
// Solidity: event log(int256 msg, int256 _msg) // Solidity: event log(int256 msg, int256 _msg)
func (nameConflict *NameConflict) UnpackLogEvent(log *types.Log) (*NameConflictLog, error) { func (nameConflict *NameConflict) UnpackLogEvent(log *types.Log) (*NameConflictLog, error) {
event := "log" event := "log"
if log.Topics[0] != nameConflict.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != nameConflict.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(NameConflictLog) out := new(NameConflictLog)

View file

@ -136,7 +136,7 @@ func (NumericMethodNameE1TestEvent) ContractEventName() string {
// Solidity: event _1TestEvent(address _param) // Solidity: event _1TestEvent(address _param)
func (numericMethodName *NumericMethodName) UnpackE1TestEventEvent(log *types.Log) (*NumericMethodNameE1TestEvent, error) { func (numericMethodName *NumericMethodName) UnpackE1TestEventEvent(log *types.Log) (*NumericMethodNameE1TestEvent, error) {
event := "_1TestEvent" event := "_1TestEvent"
if log.Topics[0] != numericMethodName.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != numericMethodName.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(NumericMethodNameE1TestEvent) out := new(NumericMethodNameE1TestEvent)

View file

@ -114,7 +114,7 @@ func (OverloadBar) ContractEventName() string {
// Solidity: event bar(uint256 i) // Solidity: event bar(uint256 i)
func (overload *Overload) UnpackBarEvent(log *types.Log) (*OverloadBar, error) { func (overload *Overload) UnpackBarEvent(log *types.Log) (*OverloadBar, error) {
event := "bar" event := "bar"
if log.Topics[0] != overload.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != overload.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(OverloadBar) out := new(OverloadBar)
@ -156,7 +156,7 @@ func (OverloadBar0) ContractEventName() string {
// Solidity: event bar(uint256 i, uint256 j) // Solidity: event bar(uint256 i, uint256 j)
func (overload *Overload) UnpackBar0Event(log *types.Log) (*OverloadBar0, error) { func (overload *Overload) UnpackBar0Event(log *types.Log) (*OverloadBar0, error) {
event := "bar0" event := "bar0"
if log.Topics[0] != overload.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != overload.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(OverloadBar0) out := new(OverloadBar0)

View file

@ -386,7 +386,7 @@ func (TokenTransfer) ContractEventName() string {
// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) // Solidity: event Transfer(address indexed from, address indexed to, uint256 value)
func (token *Token) UnpackTransferEvent(log *types.Log) (*TokenTransfer, error) { func (token *Token) UnpackTransferEvent(log *types.Log) (*TokenTransfer, error) {
event := "Transfer" event := "Transfer"
if log.Topics[0] != token.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != token.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(TokenTransfer) out := new(TokenTransfer)

View file

@ -193,7 +193,7 @@ func (TupleTupleEvent) ContractEventName() string {
// Solidity: event TupleEvent((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) // Solidity: event TupleEvent((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e)
func (tuple *Tuple) UnpackTupleEventEvent(log *types.Log) (*TupleTupleEvent, error) { func (tuple *Tuple) UnpackTupleEventEvent(log *types.Log) (*TupleTupleEvent, error) {
event := "TupleEvent" event := "TupleEvent"
if log.Topics[0] != tuple.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != tuple.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(TupleTupleEvent) out := new(TupleTupleEvent)
@ -234,7 +234,7 @@ func (TupleTupleEvent2) ContractEventName() string {
// Solidity: event TupleEvent2((uint8,uint8)[] arg0) // Solidity: event TupleEvent2((uint8,uint8)[] arg0)
func (tuple *Tuple) UnpackTupleEvent2Event(log *types.Log) (*TupleTupleEvent2, error) { func (tuple *Tuple) UnpackTupleEvent2Event(log *types.Log) (*TupleTupleEvent2, error) {
event := "TupleEvent2" event := "TupleEvent2"
if log.Topics[0] != tuple.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != tuple.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(TupleTupleEvent2) out := new(TupleTupleEvent2)

View file

@ -150,6 +150,11 @@ func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller
} }
} }
// Address returns the deployment address of the contract.
func (c *BoundContract) Address() common.Address {
return c.address
}
// Call invokes the (constant) contract method with params as input values and // Call invokes the (constant) contract method with params as input values and
// sets the output to result. The result type might be a single field for simple // sets the output to result. The result type might be a single field for simple
// returns, a slice of interfaces for anonymous returns and a struct for named // returns, a slice of interfaces for anonymous returns and a struct for named
@ -272,8 +277,10 @@ func (c *BoundContract) RawCreationTransact(opts *TransactOpts, calldata []byte)
// Transfer initiates a plain transaction to move funds to the contract, calling // Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available. // its default method if one is available.
func (c *BoundContract) Transfer(opts *TransactOpts) (*types.Transaction, error) { func (c *BoundContract) Transfer(opts *TransactOpts) (*types.Transaction, error) {
// todo(rjl493456442) check the payable fallback or receive is defined // Check if payable fallback or receive is defined
// or not, reject invalid transaction at the first place if !c.abi.HasReceive() && !(c.abi.HasFallback() && c.abi.Fallback.IsPayable()) {
return nil, fmt.Errorf("contract does not have a payable fallback or receive function")
}
return c.transact(opts, &c.address, nil) return c.transact(opts, &c.address, nil)
} }

View file

@ -158,10 +158,10 @@ func testLinkCase(tcInput linkTestCaseInput) error {
overrideAddrs = make(map[rune]common.Address) overrideAddrs = make(map[rune]common.Address)
) )
// generate deterministic addresses for the override set. // generate deterministic addresses for the override set.
rand.Seed(42) rng := rand.New(rand.NewSource(42))
for contract := range tcInput.overrides { for contract := range tcInput.overrides {
var addr common.Address var addr common.Address
rand.Read(addr[:]) rng.Read(addr[:])
overrideAddrs[contract] = addr overrideAddrs[contract] = addr
overridesAddrs[addr] = struct{}{} overridesAddrs[addr] = struct{}{}
} }

View file

@ -276,7 +276,7 @@ func (DBInsert) ContractEventName() string {
// Solidity: event Insert(uint256 key, uint256 value, uint256 length) // Solidity: event Insert(uint256 key, uint256 value, uint256 length)
func (dB *DB) UnpackInsertEvent(log *types.Log) (*DBInsert, error) { func (dB *DB) UnpackInsertEvent(log *types.Log) (*DBInsert, error) {
event := "Insert" event := "Insert"
if log.Topics[0] != dB.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != dB.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(DBInsert) out := new(DBInsert)
@ -318,7 +318,7 @@ func (DBKeyedInsert) ContractEventName() string {
// Solidity: event KeyedInsert(uint256 indexed key, uint256 value) // Solidity: event KeyedInsert(uint256 indexed key, uint256 value)
func (dB *DB) UnpackKeyedInsertEvent(log *types.Log) (*DBKeyedInsert, error) { func (dB *DB) UnpackKeyedInsertEvent(log *types.Log) (*DBKeyedInsert, error) {
event := "KeyedInsert" event := "KeyedInsert"
if log.Topics[0] != dB.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != dB.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(DBKeyedInsert) out := new(DBKeyedInsert)

View file

@ -115,7 +115,7 @@ func (CBasic1) ContractEventName() string {
// Solidity: event basic1(uint256 indexed id, uint256 data) // Solidity: event basic1(uint256 indexed id, uint256 data)
func (c *C) UnpackBasic1Event(log *types.Log) (*CBasic1, error) { func (c *C) UnpackBasic1Event(log *types.Log) (*CBasic1, error) {
event := "basic1" event := "basic1"
if log.Topics[0] != c.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != c.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(CBasic1) out := new(CBasic1)
@ -157,7 +157,7 @@ func (CBasic2) ContractEventName() string {
// Solidity: event basic2(bool indexed flag, uint256 data) // Solidity: event basic2(bool indexed flag, uint256 data)
func (c *C) UnpackBasic2Event(log *types.Log) (*CBasic2, error) { func (c *C) UnpackBasic2Event(log *types.Log) (*CBasic2, error) {
event := "basic2" event := "basic2"
if log.Topics[0] != c.abi.Events[event].ID { if len(log.Topics) == 0 || log.Topics[0] != c.abi.Events[event].ID {
return nil, errors.New("event signature mismatch") return nil, errors.New("event signature mismatch")
} }
out := new(CBasic2) out := new(CBasic2)

View file

@ -28,6 +28,7 @@ package bind
import ( import (
"errors" "errors"
"math/big"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi"
@ -241,3 +242,27 @@ func DefaultDeployer(opts *TransactOpts, backend ContractBackend) DeployFn {
return addr, tx, nil return addr, tx, nil
} }
} }
// DeployerWithNonceAssignment is basically identical to DefaultDeployer,
// but it additionally tracks the nonce to enable automatic assignment.
//
// This is especially useful when deploying multiple contracts
// from the same address — whether they are independent contracts
// or part of a dependency chain that must be deployed in order.
func DeployerWithNonceAssignment(opts *TransactOpts, backend ContractBackend) DeployFn {
var pendingNonce int64
if opts.Nonce != nil {
pendingNonce = opts.Nonce.Int64()
}
return func(input []byte, deployer []byte) (common.Address, *types.Transaction, error) {
if pendingNonce != 0 {
opts.Nonce = big.NewInt(pendingNonce)
}
addr, tx, err := DeployContract(opts, deployer, backend, input)
if err != nil {
return common.Address{}, nil, err
}
pendingNonce = int64(tx.Nonce() + 1)
return addr, tx, nil
}
}

View file

@ -65,6 +65,14 @@ func makeTestDeployer(backend simulated.Client) func(input, deployer []byte) (co
return bind.DefaultDeployer(bind.NewKeyedTransactor(testKey, chainId), backend) return bind.DefaultDeployer(bind.NewKeyedTransactor(testKey, chainId), backend)
} }
// makeTestDeployerWithNonceAssignment is similar to makeTestDeployer,
// but it returns a deployer that automatically tracks nonce,
// enabling the deployment of multiple contracts from the same account.
func makeTestDeployerWithNonceAssignment(backend simulated.Client) func(input, deployer []byte) (common.Address, *types.Transaction, error) {
chainId, _ := backend.ChainID(context.Background())
return bind.DeployerWithNonceAssignment(bind.NewKeyedTransactor(testKey, chainId), backend)
}
// test that deploying a contract with library dependencies works, // test that deploying a contract with library dependencies works,
// verifying by calling method on the deployed contract. // verifying by calling method on the deployed contract.
func TestDeploymentLibraries(t *testing.T) { func TestDeploymentLibraries(t *testing.T) {
@ -80,7 +88,7 @@ func TestDeploymentLibraries(t *testing.T) {
Contracts: []*bind.MetaData{&nested_libraries.C1MetaData}, Contracts: []*bind.MetaData{&nested_libraries.C1MetaData},
Inputs: map[string][]byte{nested_libraries.C1MetaData.ID: constructorInput}, Inputs: map[string][]byte{nested_libraries.C1MetaData.ID: constructorInput},
} }
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployer(bindBackend.Client)) res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployerWithNonceAssignment(bindBackend.Client))
if err != nil { if err != nil {
t.Fatalf("err: %+v\n", err) t.Fatalf("err: %+v\n", err)
} }
@ -122,7 +130,7 @@ func TestDeploymentWithOverrides(t *testing.T) {
deploymentParams := &bind.DeploymentParams{ deploymentParams := &bind.DeploymentParams{
Contracts: nested_libraries.C1MetaData.Deps, Contracts: nested_libraries.C1MetaData.Deps,
} }
res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployer(bindBackend)) res, err := bind.LinkAndDeploy(deploymentParams, makeTestDeployerWithNonceAssignment(bindBackend))
if err != nil { if err != nil {
t.Fatalf("err: %+v\n", err) t.Fatalf("err: %+v\n", err)
} }
@ -359,3 +367,28 @@ func TestErrors(t *testing.T) {
t.Fatalf("bad unpacked error result: expected Arg4 to be false. got true") t.Fatalf("bad unpacked error result: expected Arg4 to be false. got true")
} }
} }
func TestEventUnpackEmptyTopics(t *testing.T) {
c := events.NewC()
for _, log := range []*types.Log{
{Topics: []common.Hash{}},
{Topics: nil},
} {
_, err := c.UnpackBasic1Event(log)
if err == nil {
t.Fatal("expected error when unpacking event with empty topics, got nil")
}
if err.Error() != "event signature mismatch" {
t.Fatalf("expected 'event signature mismatch' error, got: %v", err)
}
_, err = c.UnpackBasic2Event(log)
if err == nil {
t.Fatal("expected error when unpacking event with empty topics, got nil")
}
if err.Error() != "event signature mismatch" {
t.Fatalf("expected 'event signature mismatch' error, got: %v", err)
}
}
}

View file

@ -100,22 +100,29 @@ func TestWaitDeployed(t *testing.T) {
} }
func TestWaitDeployedCornerCases(t *testing.T) { func TestWaitDeployedCornerCases(t *testing.T) {
backend := simulated.NewBackend( var (
types.GenesisAlloc{ backend = simulated.NewBackend(
crypto.PubkeyToAddress(testKey.PublicKey): {Balance: big.NewInt(10000000000000000)}, types.GenesisAlloc{
}, crypto.PubkeyToAddress(testKey.PublicKey): {Balance: big.NewInt(10000000000000000)},
},
)
head, _ = backend.Client().HeaderByNumber(t.Context(), nil) // Should be child's, good enough
gasPrice = new(big.Int).Add(head.BaseFee, big.NewInt(1))
signer = types.LatestSigner(params.AllDevChainProtocolChanges)
code = common.FromHex("6060604052600a8060106000396000f360606040526008565b00")
ctx, cancel = context.WithCancel(t.Context())
) )
defer backend.Close() defer backend.Close()
head, _ := backend.Client().HeaderByNumber(context.Background(), nil) // Should be child's, good enough // 1. WaitDeploy on a transaction that does not deploy a contract, verify it
gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(1)) // returns an error.
tx := types.MustSignNewTx(testKey, signer, &types.LegacyTx{
// Create a transaction to an account. Nonce: 0,
code := "6060604052600a8060106000396000f360606040526008565b00" To: &common.Address{0x01},
tx := types.NewTransaction(0, common.HexToAddress("0x01"), big.NewInt(0), 3000000, gasPrice, common.FromHex(code)) Gas: 300000,
tx, _ = types.SignTx(tx, types.LatestSigner(params.AllDevChainProtocolChanges), testKey) GasPrice: gasPrice,
ctx, cancel := context.WithCancel(context.Background()) Data: code,
defer cancel() })
if err := backend.Client().SendTransaction(ctx, tx); err != nil { if err := backend.Client().SendTransaction(ctx, tx); err != nil {
t.Errorf("failed to send transaction: %q", err) t.Errorf("failed to send transaction: %q", err)
} }
@ -124,14 +131,22 @@ func TestWaitDeployedCornerCases(t *testing.T) {
t.Errorf("error mismatch: want %q, got %q, ", bind.ErrNoAddressInReceipt, err) t.Errorf("error mismatch: want %q, got %q, ", bind.ErrNoAddressInReceipt, err)
} }
// Create a transaction that is not mined. // 2. Create a contract, but cancel the WaitDeploy before it is mined.
tx = types.NewContractCreation(1, big.NewInt(0), 3000000, gasPrice, common.FromHex(code)) tx = types.MustSignNewTx(testKey, signer, &types.LegacyTx{
tx, _ = types.SignTx(tx, types.LatestSigner(params.AllDevChainProtocolChanges), testKey) Nonce: 1,
Gas: 300000,
GasPrice: gasPrice,
Data: code,
})
// Wait in another thread so that we can quickly cancel it after submitting
// the transaction.
done := make(chan struct{})
go func() { go func() {
contextCanceled := errors.New("context canceled") defer close(done)
if _, err := bind.WaitDeployed(ctx, backend.Client(), tx.Hash()); err.Error() != contextCanceled.Error() { _, err := bind.WaitDeployed(ctx, backend.Client(), tx.Hash())
t.Errorf("error mismatch: want %q, got %q, ", contextCanceled, err) if !errors.Is(err, context.Canceled) {
t.Errorf("error mismatch: want %v, got %v", context.Canceled, err)
} }
}() }()
@ -139,4 +154,11 @@ func TestWaitDeployedCornerCases(t *testing.T) {
t.Errorf("failed to send transaction: %q", err) t.Errorf("failed to send transaction: %q", err)
} }
cancel() cancel()
// Wait for goroutine to exit or for a timeout.
select {
case <-done:
case <-time.After(time.Second * 2):
t.Fatalf("failed to cancel wait deploy")
}
} }

View file

@ -53,7 +53,7 @@ func ConvertType(in interface{}, proto interface{}) interface{} {
// indirect recursively dereferences the value until it either gets the value // indirect recursively dereferences the value until it either gets the value
// or finds a big.Int // or finds a big.Int
func indirect(v reflect.Value) reflect.Value { func indirect(v reflect.Value) reflect.Value {
if v.Kind() == reflect.Ptr && v.Elem().Type() != reflect.TypeOf(big.Int{}) { if v.Kind() == reflect.Ptr && v.Elem().Type() != reflect.TypeFor[big.Int]() {
return indirect(v.Elem()) return indirect(v.Elem())
} }
return v return v
@ -65,32 +65,32 @@ func reflectIntType(unsigned bool, size int) reflect.Type {
if unsigned { if unsigned {
switch size { switch size {
case 8: case 8:
return reflect.TypeOf(uint8(0)) return reflect.TypeFor[uint8]()
case 16: case 16:
return reflect.TypeOf(uint16(0)) return reflect.TypeFor[uint16]()
case 32: case 32:
return reflect.TypeOf(uint32(0)) return reflect.TypeFor[uint32]()
case 64: case 64:
return reflect.TypeOf(uint64(0)) return reflect.TypeFor[uint64]()
} }
} }
switch size { switch size {
case 8: case 8:
return reflect.TypeOf(int8(0)) return reflect.TypeFor[int8]()
case 16: case 16:
return reflect.TypeOf(int16(0)) return reflect.TypeFor[int16]()
case 32: case 32:
return reflect.TypeOf(int32(0)) return reflect.TypeFor[int32]()
case 64: case 64:
return reflect.TypeOf(int64(0)) return reflect.TypeFor[int64]()
} }
return reflect.TypeOf(&big.Int{}) return reflect.TypeFor[*big.Int]()
} }
// mustArrayToByteSlice creates a new byte slice with the exact same size as value // mustArrayToByteSlice creates a new byte slice with the exact same size as value
// and copies the bytes in value to the new slice. // and copies the bytes in value to the new slice.
func mustArrayToByteSlice(value reflect.Value) reflect.Value { func mustArrayToByteSlice(value reflect.Value) reflect.Value {
slice := reflect.MakeSlice(reflect.TypeOf([]byte{}), value.Len(), value.Len()) slice := reflect.ValueOf(make([]byte, value.Len()))
reflect.Copy(slice, value) reflect.Copy(slice, value)
return slice return slice
} }
@ -104,7 +104,7 @@ func set(dst, src reflect.Value) error {
switch { switch {
case dstType.Kind() == reflect.Interface && dst.Elem().IsValid() && (dst.Elem().Type().Kind() == reflect.Ptr || dst.Elem().CanSet()): case dstType.Kind() == reflect.Interface && dst.Elem().IsValid() && (dst.Elem().Type().Kind() == reflect.Ptr || dst.Elem().CanSet()):
return set(dst.Elem(), src) return set(dst.Elem(), src)
case dstType.Kind() == reflect.Ptr && dstType.Elem() != reflect.TypeOf(big.Int{}): case dstType.Kind() == reflect.Ptr && dstType.Elem() != reflect.TypeFor[big.Int]():
return set(dst.Elem(), src) return set(dst.Elem(), src)
case srcType.AssignableTo(dstType) && dst.CanSet(): case srcType.AssignableTo(dstType) && dst.CanSet():
dst.Set(src) dst.Set(src)

View file

@ -204,12 +204,12 @@ func TestConvertType(t *testing.T) {
var fields []reflect.StructField var fields []reflect.StructField
fields = append(fields, reflect.StructField{ fields = append(fields, reflect.StructField{
Name: "X", Name: "X",
Type: reflect.TypeOf(new(big.Int)), Type: reflect.TypeFor[*big.Int](),
Tag: "json:\"" + "x" + "\"", Tag: "json:\"" + "x" + "\"",
}) })
fields = append(fields, reflect.StructField{ fields = append(fields, reflect.StructField{
Name: "Y", Name: "Y",
Type: reflect.TypeOf(new(big.Int)), Type: reflect.TypeFor[*big.Int](),
Tag: "json:\"" + "y" + "\"", Tag: "json:\"" + "y" + "\"",
}) })
val := reflect.New(reflect.StructOf(fields)) val := reflect.New(reflect.StructOf(fields))

View file

@ -238,9 +238,9 @@ func (t Type) GetType() reflect.Type {
case UintTy: case UintTy:
return reflectIntType(true, t.Size) return reflectIntType(true, t.Size)
case BoolTy: case BoolTy:
return reflect.TypeOf(false) return reflect.TypeFor[bool]()
case StringTy: case StringTy:
return reflect.TypeOf("") return reflect.TypeFor[string]()
case SliceTy: case SliceTy:
return reflect.SliceOf(t.Elem.GetType()) return reflect.SliceOf(t.Elem.GetType())
case ArrayTy: case ArrayTy:
@ -248,19 +248,15 @@ func (t Type) GetType() reflect.Type {
case TupleTy: case TupleTy:
return t.TupleType return t.TupleType
case AddressTy: case AddressTy:
return reflect.TypeOf(common.Address{}) return reflect.TypeFor[common.Address]()
case FixedBytesTy: case FixedBytesTy:
return reflect.ArrayOf(t.Size, reflect.TypeOf(byte(0))) return reflect.ArrayOf(t.Size, reflect.TypeFor[byte]())
case BytesTy: case BytesTy:
return reflect.SliceOf(reflect.TypeOf(byte(0))) return reflect.TypeFor[[]byte]()
case HashTy: case HashTy, FixedPointTy: // currently not used
// hashtype currently not used return reflect.TypeFor[[32]byte]()
return reflect.ArrayOf(32, reflect.TypeOf(byte(0)))
case FixedPointTy:
// fixedpoint type currently not used
return reflect.ArrayOf(32, reflect.TypeOf(byte(0)))
case FunctionTy: case FunctionTy:
return reflect.ArrayOf(24, reflect.TypeOf(byte(0))) return reflect.TypeFor[[24]byte]()
default: default:
panic("Invalid type") panic("Invalid type")
} }

View file

@ -24,8 +24,8 @@ import (
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto/keccak"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
"golang.org/x/crypto/sha3"
) )
// Account represents an Ethereum account located at a specific location defined // Account represents an Ethereum account located at a specific location defined
@ -196,7 +196,7 @@ func TextHash(data []byte) []byte {
// This gives context to the signed message and prevents signing of transactions. // This gives context to the signed message and prevents signing of transactions.
func TextAndHash(data []byte) ([]byte, string) { func TextAndHash(data []byte) ([]byte, string) {
msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data) msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data)
hasher := sha3.NewLegacyKeccak256() hasher := keccak.NewLegacyKeccak256()
hasher.Write([]byte(msg)) hasher.Write([]byte(msg))
return hasher.Sum(nil), msg return hasher.Sum(nil), msg
} }

View file

@ -17,7 +17,7 @@
// Package keystore implements encrypted storage of secp256k1 private keys. // Package keystore implements encrypted storage of secp256k1 private keys.
// //
// Keys are stored as encrypted JSON files according to the Web3 Secret Storage specification. // Keys are stored as encrypted JSON files according to the Web3 Secret Storage specification.
// See https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition for more information. // See https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/ for more information.
package keystore package keystore
import ( import (
@ -50,7 +50,7 @@ var (
) )
// KeyStoreType is the reflect type of a keystore backend. // KeyStoreType is the reflect type of a keystore backend.
var KeyStoreType = reflect.TypeOf(&KeyStore{}) var KeyStoreType = reflect.TypeFor[*KeyStore]()
// KeyStoreScheme is the protocol scheme prefixing account and wallet URLs. // KeyStoreScheme is the protocol scheme prefixing account and wallet URLs.
const KeyStoreScheme = "keystore" const KeyStoreScheme = "keystore"
@ -99,9 +99,10 @@ func (ks *KeyStore) init(keydir string) {
// TODO: In order for this finalizer to work, there must be no references // TODO: In order for this finalizer to work, there must be no references
// to ks. addressCache doesn't keep a reference but unlocked keys do, // to ks. addressCache doesn't keep a reference but unlocked keys do,
// so the finalizer will not trigger until all timed unlocks have expired. // so the finalizer will not trigger until all timed unlocks have expired.
runtime.SetFinalizer(ks, func(m *KeyStore) { runtime.AddCleanup(ks, func(c *accountCache) {
m.cache.close() c.close()
}) }, ks.cache)
// Create the initial list of wallets from the cache // Create the initial list of wallets from the cache
accs := ks.cache.accounts() accs := ks.cache.accounts()
ks.wallets = make([]accounts.Wallet, len(accs)) ks.wallets = make([]accounts.Wallet, len(accs))
@ -195,11 +196,14 @@ func (ks *KeyStore) Subscribe(sink chan<- accounts.WalletEvent) event.Subscripti
// forces a manual refresh (only triggers for systems where the filesystem notifier // forces a manual refresh (only triggers for systems where the filesystem notifier
// is not running). // is not running).
func (ks *KeyStore) updater() { func (ks *KeyStore) updater() {
ticker := time.NewTicker(walletRefreshCycle)
defer ticker.Stop()
for { for {
// Wait for an account update or a refresh timeout // Wait for an account update or a refresh timeout
select { select {
case <-ks.changes: case <-ks.changes:
case <-time.After(walletRefreshCycle): case <-ticker.C:
} }
// Run the wallet refresher // Run the wallet refresher
ks.refreshWallets() ks.refreshWallets()
@ -414,6 +418,7 @@ func (ks *KeyStore) Export(a accounts.Account, passphrase, newPassphrase string)
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer zeroKey(key.PrivateKey)
var N, P int var N, P int
if store, ok := ks.storage.(*keyStorePassphrase); ok { if store, ok := ks.storage.(*keyStorePassphrase); ok {
N, P = store.scryptN, store.scryptP N, P = store.scryptN, store.scryptP
@ -473,6 +478,7 @@ func (ks *KeyStore) Update(a accounts.Account, passphrase, newPassphrase string)
if err != nil { if err != nil {
return err return err
} }
defer zeroKey(key.PrivateKey)
return ks.storage.StoreKey(a.URL.Path, key, newPassphrase) return ks.storage.StoreKey(a.URL.Path, key, newPassphrase)
} }

View file

@ -19,7 +19,7 @@
This key store behaves as KeyStorePlain with the difference that This key store behaves as KeyStorePlain with the difference that
the private key is encrypted and on disk uses another JSON encoding. the private key is encrypted and on disk uses another JSON encoding.
The crypto is documented at https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition The crypto is documented at https://ethereum.org/en/developers/docs/data-structures-and-encoding/web3-secret-storage/
*/ */

View file

@ -81,6 +81,9 @@ func decryptPreSaleKey(fileContent []byte, password string) (key *Key, err error
*/ */
passBytes := []byte(password) passBytes := []byte(password)
derivedKey := pbkdf2.Key(passBytes, passBytes, 2000, 16, sha256.New) derivedKey := pbkdf2.Key(passBytes, passBytes, 2000, 16, sha256.New)
if len(cipherText)%aes.BlockSize != 0 {
return nil, errors.New("ciphertext must be a multiple of block size")
}
plainText, err := aesCBCDecrypt(derivedKey, cipherText, iv) plainText, err := aesCBCDecrypt(derivedKey, cipherText, iv)
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -300,6 +300,10 @@ func (s *SecureChannelSession) decryptAPDU(data []byte) ([]byte, error) {
return nil, err return nil, err
} }
if len(data) == 0 || len(data)%aes.BlockSize != 0 {
return nil, fmt.Errorf("invalid ciphertext length: %d", len(data))
}
ret := make([]byte, len(data)) ret := make([]byte, len(data))
crypter := cipher.NewCBCDecrypter(a, s.iv) crypter := cipher.NewCBCDecrypter(a, s.iv)

View file

@ -472,6 +472,11 @@ func (w *Wallet) selfDerive() {
continue continue
} }
pairing := w.Hub.pairing(w) pairing := w.Hub.pairing(w)
if pairing == nil {
w.lock.Unlock()
reqc <- struct{}{}
continue
}
// Device lock obtained, derive the next batch of accounts // Device lock obtained, derive the next batch of accounts
var ( var (
@ -631,13 +636,13 @@ func (w *Wallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Accoun
} }
if pin { if pin {
pairing := w.Hub.pairing(w) if pairing := w.Hub.pairing(w); pairing != nil {
pairing.Accounts[account.Address] = path pairing.Accounts[account.Address] = path
if err := w.Hub.setPairing(w, pairing); err != nil { if err := w.Hub.setPairing(w, pairing); err != nil {
return accounts.Account{}, err return accounts.Account{}, err
}
} }
} }
return account, nil return account, nil
} }
@ -774,11 +779,11 @@ func (w *Wallet) SignTxWithPassphrase(account accounts.Account, passphrase strin
// It first checks for the address in the list of pinned accounts, and if it is // It first checks for the address in the list of pinned accounts, and if it is
// not found, attempts to parse the derivation path from the account's URL. // not found, attempts to parse the derivation path from the account's URL.
func (w *Wallet) findAccountPath(account accounts.Account) (accounts.DerivationPath, error) { func (w *Wallet) findAccountPath(account accounts.Account) (accounts.DerivationPath, error) {
pairing := w.Hub.pairing(w) if pairing := w.Hub.pairing(w); pairing != nil {
if path, ok := pairing.Accounts[account.Address]; ok { if path, ok := pairing.Accounts[account.Address]; ok {
return path, nil return path, nil
}
} }
// Look for the path in the URL // Look for the path in the URL
if account.URL.Scheme != w.Hub.scheme { if account.URL.Scheme != w.Hub.scheme {
return nil, fmt.Errorf("scheme %s does not match wallet scheme %s", account.URL.Scheme, w.Hub.scheme) return nil, fmt.Errorf("scheme %s does not match wallet scheme %s", account.URL.Scheme, w.Hub.scheme)

View file

@ -43,6 +43,14 @@ const refreshCycle = time.Second
// trashing. // trashing.
const refreshThrottling = 500 * time.Millisecond const refreshThrottling = 500 * time.Millisecond
const (
// deviceUsagePage identifies Ledger devices by HID usage page (0xffa0) on Windows and macOS.
// See: https://github.com/LedgerHQ/ledger-live/blob/05a2980e838955a11a1418da638ef8ac3df4fb74/libs/ledgerjs/packages/hw-transport-node-hid-noevents/src/TransportNodeHid.ts
deviceUsagePage = 0xffa0
// deviceInterface identifies Ledger devices by USB interface number (0) on Linux.
deviceInterface = 0
)
// Hub is a accounts.Backend that can find and handle generic USB hardware wallets. // Hub is a accounts.Backend that can find and handle generic USB hardware wallets.
type Hub struct { type Hub struct {
scheme string // Protocol scheme prefixing account and wallet URLs. scheme string // Protocol scheme prefixing account and wallet URLs.
@ -82,6 +90,7 @@ func NewLedgerHub() (*Hub, error) {
0x0005, /* Ledger Nano S Plus */ 0x0005, /* Ledger Nano S Plus */
0x0006, /* Ledger Nano FTS */ 0x0006, /* Ledger Nano FTS */
0x0007, /* Ledger Flex */ 0x0007, /* Ledger Flex */
0x0008, /* Ledger Nano Gen5 */
0x0000, /* WebUSB Ledger Blue */ 0x0000, /* WebUSB Ledger Blue */
0x1000, /* WebUSB Ledger Nano S */ 0x1000, /* WebUSB Ledger Nano S */
@ -89,7 +98,8 @@ func NewLedgerHub() (*Hub, error) {
0x5000, /* WebUSB Ledger Nano S Plus */ 0x5000, /* WebUSB Ledger Nano S Plus */
0x6000, /* WebUSB Ledger Nano FTS */ 0x6000, /* WebUSB Ledger Nano FTS */
0x7000, /* WebUSB Ledger Flex */ 0x7000, /* WebUSB Ledger Flex */
}, 0xffa0, 0, newLedgerDriver) 0x8000, /* WebUSB Ledger Nano Gen5 */
}, deviceUsagePage, deviceInterface, newLedgerDriver)
} }
// NewTrezorHubWithHID creates a new hardware wallet manager for Trezor devices. // NewTrezorHubWithHID creates a new hardware wallet manager for Trezor devices.

View file

@ -166,7 +166,7 @@ func (w *ledgerDriver) SignTx(path accounts.DerivationPath, tx *types.Transactio
return common.Address{}, nil, accounts.ErrWalletClosed return common.Address{}, nil, accounts.ErrWalletClosed
} }
// Ensure the wallet is capable of signing the given transaction // Ensure the wallet is capable of signing the given transaction
if chainID != nil && w.version[0] <= 1 && w.version[1] <= 0 && w.version[2] <= 2 { if chainID != nil && (w.version[0] < 1 || (w.version[0] == 1 && w.version[1] == 0 && w.version[2] < 3)) {
//lint:ignore ST1005 brand name displayed on the console //lint:ignore ST1005 brand name displayed on the console
return common.Address{}, nil, fmt.Errorf("Ledger v%d.%d.%d doesn't support signing this transaction, please update to v1.0.3 at least", w.version[0], w.version[1], w.version[2]) return common.Address{}, nil, fmt.Errorf("Ledger v%d.%d.%d doesn't support signing this transaction, please update to v1.0.3 at least", w.version[0], w.version[1], w.version[2])
} }
@ -184,7 +184,7 @@ func (w *ledgerDriver) SignTypedMessage(path accounts.DerivationPath, domainHash
return nil, accounts.ErrWalletClosed return nil, accounts.ErrWalletClosed
} }
// Ensure the wallet is capable of signing the given transaction // Ensure the wallet is capable of signing the given transaction
if w.version[0] < 1 && w.version[1] < 5 { if w.version[0] < 1 || (w.version[0] == 1 && w.version[1] < 5) {
//lint:ignore ST1005 brand name displayed on the console //lint:ignore ST1005 brand name displayed on the console
return nil, fmt.Errorf("Ledger version >= 1.5.0 required for EIP-712 signing (found version v%d.%d.%d)", w.version[0], w.version[1], w.version[2]) return nil, fmt.Errorf("Ledger version >= 1.5.0 required for EIP-712 signing (found version v%d.%d.%d)", w.version[0], w.version[1], w.version[2])
} }

View file

@ -632,7 +632,7 @@ func (w *wallet) SignTx(account accounts.Account, tx *types.Transaction, chainID
// data is not supported for Ledger wallets, so this method will always return // data is not supported for Ledger wallets, so this method will always return
// an error. // an error.
func (w *wallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) { func (w *wallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
return w.SignText(account, accounts.TextHash(text)) return w.SignText(account, text)
} }
// SignTxWithPassphrase implements accounts.Wallet, attempting to sign the given // SignTxWithPassphrase implements accounts.Wallet, attempting to sign the given

View file

@ -2,7 +2,6 @@ clone_depth: 5
version: "{branch}.{build}" version: "{branch}.{build}"
image: image:
- Ubuntu
- Visual Studio 2019 - Visual Studio 2019
environment: environment:
@ -17,25 +16,6 @@ install:
- go version - go version
for: for:
# Linux has its own script without -arch and -cc.
# The linux builder also runs lint.
- matrix:
only:
- image: Ubuntu
build_script:
- go run build/ci.go lint
- go run build/ci.go check_generate
- go run build/ci.go check_baddeps
- go run build/ci.go install -dlgo
test_script:
- go run build/ci.go test -dlgo -short
# linux/386 is disabled.
- matrix:
exclude:
- image: Ubuntu
GETH_ARCH: 386
# Windows builds for amd64 + 386. # Windows builds for amd64 + 386.
- matrix: - matrix:
only: only:

View file

@ -32,7 +32,7 @@ var (
testServer2 = testServer("testServer2") testServer2 = testServer("testServer2")
testBlock1 = types.NewBeaconBlock(&deneb.BeaconBlock{ testBlock1 = types.NewBeaconBlock(&deneb.BeaconBlock{
Slot: 123, Slot: 127,
Body: deneb.BeaconBlockBody{ Body: deneb.BeaconBlockBody{
ExecutionPayload: deneb.ExecutionPayload{ ExecutionPayload: deneb.ExecutionPayload{
BlockNumber: 456, BlockNumber: 456,
@ -41,7 +41,7 @@ var (
}, },
}) })
testBlock2 = types.NewBeaconBlock(&deneb.BeaconBlock{ testBlock2 = types.NewBeaconBlock(&deneb.BeaconBlock{
Slot: 124, Slot: 128,
Body: deneb.BeaconBlockBody{ Body: deneb.BeaconBlockBody{
ExecutionPayload: deneb.ExecutionPayload{ ExecutionPayload: deneb.ExecutionPayload{
BlockNumber: 457, BlockNumber: 457,
@ -49,6 +49,14 @@ var (
}, },
}, },
}) })
testFinal1 = types.NewExecutionHeader(&deneb.ExecutionPayloadHeader{
BlockNumber: 395,
BlockHash: zrntcommon.Hash32(common.HexToHash("abbe7625624bf8ddd84723709e2758956289465dd23475f02387e0854942666")),
})
testFinal2 = types.NewExecutionHeader(&deneb.ExecutionPayloadHeader{
BlockNumber: 420,
BlockHash: zrntcommon.Hash32(common.HexToHash("9182a6ef8723654de174283750932ccc092378549836bf4873657eeec474598")),
})
) )
type testServer string type testServer string
@ -66,9 +74,10 @@ func TestBlockSync(t *testing.T) {
ts.AddServer(testServer1, 1) ts.AddServer(testServer1, 1)
ts.AddServer(testServer2, 1) ts.AddServer(testServer2, 1)
expHeadBlock := func(expHead *types.BeaconBlock) { expHeadEvent := func(expHead *types.BeaconBlock, expFinal *types.ExecutionHeader) {
t.Helper() t.Helper()
var expNumber, headNumber uint64 var expNumber, headNumber uint64
var expFinalHash, finalHash common.Hash
if expHead != nil { if expHead != nil {
p, err := expHead.ExecutionPayload() p, err := expHead.ExecutionPayload()
if err != nil { if err != nil {
@ -76,19 +85,26 @@ func TestBlockSync(t *testing.T) {
} }
expNumber = p.NumberU64() expNumber = p.NumberU64()
} }
if expFinal != nil {
expFinalHash = expFinal.BlockHash()
}
select { select {
case event := <-headCh: case event := <-headCh:
headNumber = event.Block.NumberU64() headNumber = event.Block.NumberU64()
finalHash = event.Finalized
default: default:
} }
if headNumber != expNumber { if headNumber != expNumber {
t.Errorf("Wrong head block, expected block number %d, got %d)", expNumber, headNumber) t.Errorf("Wrong head block, expected block number %d, got %d)", expNumber, headNumber)
} }
if finalHash != expFinalHash {
t.Errorf("Wrong finalized block, expected block hash %064x, got %064x)", expFinalHash[:], finalHash[:])
}
} }
// no block requests expected until head tracker knows about a head // no block requests expected until head tracker knows about a head
ts.Run(1) ts.Run(1)
expHeadBlock(nil) expHeadEvent(nil, nil)
// set block 1 as prefetch head, announced by server 2 // set block 1 as prefetch head, announced by server 2
head1 := blockHeadInfo(testBlock1) head1 := blockHeadInfo(testBlock1)
@ -103,12 +119,13 @@ func TestBlockSync(t *testing.T) {
ts.AddAllowance(testServer2, 1) ts.AddAllowance(testServer2, 1)
ts.Run(3) ts.Run(3)
// head block still not expected as the fetched block is not the validated head yet // head block still not expected as the fetched block is not the validated head yet
expHeadBlock(nil) expHeadEvent(nil, nil)
// set as validated head, expect no further requests but block 1 set as head block // set as validated head, expect no further requests but block 1 set as head block
ht.validated.Header = testBlock1.Header() ht.validated.Header = testBlock1.Header()
ht.finalized, ht.finalizedPayload = testBlock1.Header(), testFinal1
ts.Run(4) ts.Run(4)
expHeadBlock(testBlock1) expHeadEvent(testBlock1, testFinal1)
// set block 2 as prefetch head, announced by server 1 // set block 2 as prefetch head, announced by server 1
head2 := blockHeadInfo(testBlock2) head2 := blockHeadInfo(testBlock2)
@ -126,17 +143,26 @@ func TestBlockSync(t *testing.T) {
// expect req2 retry to server 2 // expect req2 retry to server 2
ts.Run(7, testServer2, sync.ReqBeaconBlock(head2.BlockRoot)) ts.Run(7, testServer2, sync.ReqBeaconBlock(head2.BlockRoot))
// now head block should be unavailable again // now head block should be unavailable again
expHeadBlock(nil) expHeadEvent(nil, nil)
// valid response, now head block should be block 2 immediately as it is already validated // valid response, now head block should be block 2 immediately as it is already validated
// but head event is still not expected because an epoch boundary was crossed and the
// expected finality update has not arrived yet
ts.RequestEvent(request.EvResponse, ts.Request(7, 1), testBlock2) ts.RequestEvent(request.EvResponse, ts.Request(7, 1), testBlock2)
ts.Run(8) ts.Run(8)
expHeadBlock(testBlock2) expHeadEvent(nil, nil)
// expected finality update arrived, now a head event is expected
ht.finalized, ht.finalizedPayload = testBlock2.Header(), testFinal2
ts.Run(9)
expHeadEvent(testBlock2, testFinal2)
} }
type testHeadTracker struct { type testHeadTracker struct {
prefetch types.HeadInfo prefetch types.HeadInfo
validated types.SignedHeader validated types.SignedHeader
finalized types.Header
finalizedPayload *types.ExecutionHeader
} }
func (h *testHeadTracker) PrefetchHead() types.HeadInfo { func (h *testHeadTracker) PrefetchHead() types.HeadInfo {
@ -151,13 +177,14 @@ func (h *testHeadTracker) ValidatedOptimistic() (types.OptimisticUpdate, bool) {
}, h.validated.Header != (types.Header{}) }, h.validated.Header != (types.Header{})
} }
// TODO add test case for finality
func (h *testHeadTracker) ValidatedFinality() (types.FinalityUpdate, bool) { func (h *testHeadTracker) ValidatedFinality() (types.FinalityUpdate, bool) {
finalized := types.NewExecutionHeader(new(deneb.ExecutionPayloadHeader)) if h.validated.Header == (types.Header{}) || h.finalizedPayload == nil {
return types.FinalityUpdate{}, false
}
return types.FinalityUpdate{ return types.FinalityUpdate{
Attested: types.HeaderWithExecProof{Header: h.validated.Header}, Attested: types.HeaderWithExecProof{Header: h.finalized},
Finalized: types.HeaderWithExecProof{PayloadHeader: finalized}, Finalized: types.HeaderWithExecProof{Header: h.finalized, PayloadHeader: h.finalizedPayload},
Signature: h.validated.Signature, Signature: h.validated.Signature,
SignatureSlot: h.validated.SignatureSlot, SignatureSlot: h.validated.SignatureSlot,
}, h.validated.Header != (types.Header{}) }, true
} }

View file

@ -87,6 +87,10 @@ func (ec *engineClient) updateLoop(headCh <-chan types.ChainHeadEvent) {
if status, err := ec.callForkchoiceUpdated(forkName, event); err == nil { if status, err := ec.callForkchoiceUpdated(forkName, event); err == nil {
log.Info("Successful ForkchoiceUpdated", "head", event.Block.Hash(), "status", status) log.Info("Successful ForkchoiceUpdated", "head", event.Block.Hash(), "status", status)
} else { } else {
if err.Error() == "beacon syncer reorging" {
log.Debug("Failed ForkchoiceUpdated", "head", event.Block.Hash(), "error", err)
continue // ignore beacon syncer reorging errors, this error can occur if the blsync is skipping a block
}
log.Error("Failed ForkchoiceUpdated", "head", event.Block.Hash(), "error", err) log.Error("Failed ForkchoiceUpdated", "head", event.Block.Hash(), "error", err)
} }
} }
@ -101,7 +105,16 @@ func (ec *engineClient) callNewPayload(fork string, event types.ChainHeadEvent)
params = []any{execData} params = []any{execData}
) )
switch fork { switch fork {
case "electra": case "altair", "bellatrix":
method = "engine_newPayloadV1"
case "capella":
method = "engine_newPayloadV2"
case "deneb":
method = "engine_newPayloadV3"
parentBeaconRoot := event.BeaconHead.ParentRoot
blobHashes := collectBlobHashes(event.Block)
params = append(params, blobHashes, parentBeaconRoot)
default: // electra, fulu and above
method = "engine_newPayloadV4" method = "engine_newPayloadV4"
parentBeaconRoot := event.BeaconHead.ParentRoot parentBeaconRoot := event.BeaconHead.ParentRoot
blobHashes := collectBlobHashes(event.Block) blobHashes := collectBlobHashes(event.Block)
@ -110,15 +123,6 @@ func (ec *engineClient) callNewPayload(fork string, event types.ChainHeadEvent)
hexRequests[i] = hexutil.Bytes(event.ExecRequests[i]) hexRequests[i] = hexutil.Bytes(event.ExecRequests[i])
} }
params = append(params, blobHashes, parentBeaconRoot, hexRequests) params = append(params, blobHashes, parentBeaconRoot, hexRequests)
case "deneb":
method = "engine_newPayloadV3"
parentBeaconRoot := event.BeaconHead.ParentRoot
blobHashes := collectBlobHashes(event.Block)
params = append(params, blobHashes, parentBeaconRoot)
case "capella":
method = "engine_newPayloadV2"
default:
method = "engine_newPayloadV1"
} }
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5) ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)
@ -145,12 +149,12 @@ func (ec *engineClient) callForkchoiceUpdated(fork string, event types.ChainHead
var method string var method string
switch fork { switch fork {
case "deneb", "electra": case "altair", "bellatrix":
method = "engine_forkchoiceUpdatedV3" method = "engine_forkchoiceUpdatedV1"
case "capella": case "capella":
method = "engine_forkchoiceUpdatedV2" method = "engine_forkchoiceUpdatedV2"
default: default: // deneb, electra, fulu and above
method = "engine_forkchoiceUpdatedV1" method = "engine_forkchoiceUpdatedV3"
} }
ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5) ctx, cancel := context.WithTimeout(ec.rootCtx, time.Second*5)

View file

@ -21,6 +21,7 @@ func (p PayloadAttributes) MarshalJSON() ([]byte, error) {
SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"` SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
Withdrawals []*types.Withdrawal `json:"withdrawals"` Withdrawals []*types.Withdrawal `json:"withdrawals"`
BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"` BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"`
SlotNumber *hexutil.Uint64 `json:"slotNumber"`
} }
var enc PayloadAttributes var enc PayloadAttributes
enc.Timestamp = hexutil.Uint64(p.Timestamp) enc.Timestamp = hexutil.Uint64(p.Timestamp)
@ -28,6 +29,7 @@ func (p PayloadAttributes) MarshalJSON() ([]byte, error) {
enc.SuggestedFeeRecipient = p.SuggestedFeeRecipient enc.SuggestedFeeRecipient = p.SuggestedFeeRecipient
enc.Withdrawals = p.Withdrawals enc.Withdrawals = p.Withdrawals
enc.BeaconRoot = p.BeaconRoot enc.BeaconRoot = p.BeaconRoot
enc.SlotNumber = (*hexutil.Uint64)(p.SlotNumber)
return json.Marshal(&enc) return json.Marshal(&enc)
} }
@ -39,6 +41,7 @@ func (p *PayloadAttributes) UnmarshalJSON(input []byte) error {
SuggestedFeeRecipient *common.Address `json:"suggestedFeeRecipient" gencodec:"required"` SuggestedFeeRecipient *common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
Withdrawals []*types.Withdrawal `json:"withdrawals"` Withdrawals []*types.Withdrawal `json:"withdrawals"`
BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"` BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"`
SlotNumber *hexutil.Uint64 `json:"slotNumber"`
} }
var dec PayloadAttributes var dec PayloadAttributes
if err := json.Unmarshal(input, &dec); err != nil { if err := json.Unmarshal(input, &dec); err != nil {
@ -62,5 +65,8 @@ func (p *PayloadAttributes) UnmarshalJSON(input []byte) error {
if dec.BeaconRoot != nil { if dec.BeaconRoot != nil {
p.BeaconRoot = dec.BeaconRoot p.BeaconRoot = dec.BeaconRoot
} }
if dec.SlotNumber != nil {
p.SlotNumber = (*uint64)(dec.SlotNumber)
}
return nil return nil
} }

View file

@ -17,24 +17,24 @@ var _ = (*executableDataMarshaling)(nil)
// MarshalJSON marshals as JSON. // MarshalJSON marshals as JSON.
func (e ExecutableData) MarshalJSON() ([]byte, error) { func (e ExecutableData) MarshalJSON() ([]byte, error) {
type ExecutableData struct { type ExecutableData struct {
ParentHash common.Hash `json:"parentHash" gencodec:"required"` ParentHash common.Hash `json:"parentHash" gencodec:"required"`
FeeRecipient common.Address `json:"feeRecipient" gencodec:"required"` FeeRecipient common.Address `json:"feeRecipient" gencodec:"required"`
StateRoot common.Hash `json:"stateRoot" gencodec:"required"` StateRoot common.Hash `json:"stateRoot" gencodec:"required"`
ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"` ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"`
LogsBloom hexutil.Bytes `json:"logsBloom" gencodec:"required"` LogsBloom hexutil.Bytes `json:"logsBloom" gencodec:"required"`
Random common.Hash `json:"prevRandao" gencodec:"required"` Random common.Hash `json:"prevRandao" gencodec:"required"`
Number hexutil.Uint64 `json:"blockNumber" gencodec:"required"` Number hexutil.Uint64 `json:"blockNumber" gencodec:"required"`
GasLimit hexutil.Uint64 `json:"gasLimit" gencodec:"required"` GasLimit hexutil.Uint64 `json:"gasLimit" gencodec:"required"`
GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"` GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
Timestamp hexutil.Uint64 `json:"timestamp" gencodec:"required"` Timestamp hexutil.Uint64 `json:"timestamp" gencodec:"required"`
ExtraData hexutil.Bytes `json:"extraData" gencodec:"required"` ExtraData hexutil.Bytes `json:"extraData" gencodec:"required"`
BaseFeePerGas *hexutil.Big `json:"baseFeePerGas" gencodec:"required"` BaseFeePerGas *hexutil.Big `json:"baseFeePerGas" gencodec:"required"`
BlockHash common.Hash `json:"blockHash" gencodec:"required"` BlockHash common.Hash `json:"blockHash" gencodec:"required"`
Transactions []hexutil.Bytes `json:"transactions" gencodec:"required"` Transactions []hexutil.Bytes `json:"transactions" gencodec:"required"`
Withdrawals []*types.Withdrawal `json:"withdrawals"` Withdrawals []*types.Withdrawal `json:"withdrawals"`
BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"` BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"`
ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"` ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"`
ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"` SlotNumber *hexutil.Uint64 `json:"slotNumber"`
} }
var enc ExecutableData var enc ExecutableData
enc.ParentHash = e.ParentHash enc.ParentHash = e.ParentHash
@ -59,31 +59,31 @@ func (e ExecutableData) MarshalJSON() ([]byte, error) {
enc.Withdrawals = e.Withdrawals enc.Withdrawals = e.Withdrawals
enc.BlobGasUsed = (*hexutil.Uint64)(e.BlobGasUsed) enc.BlobGasUsed = (*hexutil.Uint64)(e.BlobGasUsed)
enc.ExcessBlobGas = (*hexutil.Uint64)(e.ExcessBlobGas) enc.ExcessBlobGas = (*hexutil.Uint64)(e.ExcessBlobGas)
enc.ExecutionWitness = e.ExecutionWitness enc.SlotNumber = (*hexutil.Uint64)(e.SlotNumber)
return json.Marshal(&enc) return json.Marshal(&enc)
} }
// UnmarshalJSON unmarshals from JSON. // UnmarshalJSON unmarshals from JSON.
func (e *ExecutableData) UnmarshalJSON(input []byte) error { func (e *ExecutableData) UnmarshalJSON(input []byte) error {
type ExecutableData struct { type ExecutableData struct {
ParentHash *common.Hash `json:"parentHash" gencodec:"required"` ParentHash *common.Hash `json:"parentHash" gencodec:"required"`
FeeRecipient *common.Address `json:"feeRecipient" gencodec:"required"` FeeRecipient *common.Address `json:"feeRecipient" gencodec:"required"`
StateRoot *common.Hash `json:"stateRoot" gencodec:"required"` StateRoot *common.Hash `json:"stateRoot" gencodec:"required"`
ReceiptsRoot *common.Hash `json:"receiptsRoot" gencodec:"required"` ReceiptsRoot *common.Hash `json:"receiptsRoot" gencodec:"required"`
LogsBloom *hexutil.Bytes `json:"logsBloom" gencodec:"required"` LogsBloom *hexutil.Bytes `json:"logsBloom" gencodec:"required"`
Random *common.Hash `json:"prevRandao" gencodec:"required"` Random *common.Hash `json:"prevRandao" gencodec:"required"`
Number *hexutil.Uint64 `json:"blockNumber" gencodec:"required"` Number *hexutil.Uint64 `json:"blockNumber" gencodec:"required"`
GasLimit *hexutil.Uint64 `json:"gasLimit" gencodec:"required"` GasLimit *hexutil.Uint64 `json:"gasLimit" gencodec:"required"`
GasUsed *hexutil.Uint64 `json:"gasUsed" gencodec:"required"` GasUsed *hexutil.Uint64 `json:"gasUsed" gencodec:"required"`
Timestamp *hexutil.Uint64 `json:"timestamp" gencodec:"required"` Timestamp *hexutil.Uint64 `json:"timestamp" gencodec:"required"`
ExtraData *hexutil.Bytes `json:"extraData" gencodec:"required"` ExtraData *hexutil.Bytes `json:"extraData" gencodec:"required"`
BaseFeePerGas *hexutil.Big `json:"baseFeePerGas" gencodec:"required"` BaseFeePerGas *hexutil.Big `json:"baseFeePerGas" gencodec:"required"`
BlockHash *common.Hash `json:"blockHash" gencodec:"required"` BlockHash *common.Hash `json:"blockHash" gencodec:"required"`
Transactions []hexutil.Bytes `json:"transactions" gencodec:"required"` Transactions []hexutil.Bytes `json:"transactions" gencodec:"required"`
Withdrawals []*types.Withdrawal `json:"withdrawals"` Withdrawals []*types.Withdrawal `json:"withdrawals"`
BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"` BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed"`
ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"` ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas"`
ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"` SlotNumber *hexutil.Uint64 `json:"slotNumber"`
} }
var dec ExecutableData var dec ExecutableData
if err := json.Unmarshal(input, &dec); err != nil { if err := json.Unmarshal(input, &dec); err != nil {
@ -157,8 +157,8 @@ func (e *ExecutableData) UnmarshalJSON(input []byte) error {
if dec.ExcessBlobGas != nil { if dec.ExcessBlobGas != nil {
e.ExcessBlobGas = (*uint64)(dec.ExcessBlobGas) e.ExcessBlobGas = (*uint64)(dec.ExcessBlobGas)
} }
if dec.ExecutionWitness != nil { if dec.SlotNumber != nil {
e.ExecutionWitness = dec.ExecutionWitness e.SlotNumber = (*uint64)(dec.SlotNumber)
} }
return nil return nil
} }

View file

@ -17,7 +17,7 @@ func (e ExecutionPayloadEnvelope) MarshalJSON() ([]byte, error) {
type ExecutionPayloadEnvelope struct { type ExecutionPayloadEnvelope struct {
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"` ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"` BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"`
BlobsBundle *BlobsBundleV1 `json:"blobsBundle"` BlobsBundle *BlobsBundle `json:"blobsBundle"`
Requests []hexutil.Bytes `json:"executionRequests"` Requests []hexutil.Bytes `json:"executionRequests"`
Override bool `json:"shouldOverrideBuilder"` Override bool `json:"shouldOverrideBuilder"`
Witness *hexutil.Bytes `json:"witness,omitempty"` Witness *hexutil.Bytes `json:"witness,omitempty"`
@ -42,7 +42,7 @@ func (e *ExecutionPayloadEnvelope) UnmarshalJSON(input []byte) error {
type ExecutionPayloadEnvelope struct { type ExecutionPayloadEnvelope struct {
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"` ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"` BlockValue *hexutil.Big `json:"blockValue" gencodec:"required"`
BlobsBundle *BlobsBundleV1 `json:"blobsBundle"` BlobsBundle *BlobsBundle `json:"blobsBundle"`
Requests []hexutil.Bytes `json:"executionRequests"` Requests []hexutil.Bytes `json:"executionRequests"`
Override *bool `json:"shouldOverrideBuilder"` Override *bool `json:"shouldOverrideBuilder"`
Witness *hexutil.Bytes `json:"witness,omitempty"` Witness *hexutil.Bytes `json:"witness,omitempty"`

View file

@ -33,9 +33,30 @@ import (
type PayloadVersion byte type PayloadVersion byte
var ( var (
// PayloadV1 is the identifier of ExecutionPayloadV1 introduced in paris fork.
// https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#executionpayloadv1
PayloadV1 PayloadVersion = 0x1 PayloadV1 PayloadVersion = 0x1
// PayloadV2 is the identifier of ExecutionPayloadV2 introduced in shanghai fork.
//
// https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#executionpayloadv2
// ExecutionPayloadV2 has the syntax of ExecutionPayloadV1 and appends a
// single field: withdrawals.
PayloadV2 PayloadVersion = 0x2 PayloadV2 PayloadVersion = 0x2
// PayloadV3 is the identifier of ExecutionPayloadV3 introduced in cancun fork.
//
// https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#executionpayloadv3
// ExecutionPayloadV3 has the syntax of ExecutionPayloadV2 and appends the new
// fields: blobGasUsed and excessBlobGas.
PayloadV3 PayloadVersion = 0x3 PayloadV3 PayloadVersion = 0x3
// PayloadV4 is the identifier of ExecutionPayloadV4 introduced in amsterdam fork.
//
// https://github.com/ethereum/execution-apis/blob/main/src/engine/amsterdam.md#executionpayloadv4
// ExecutionPayloadV4 has the syntax of ExecutionPayloadV3 and appends the new
// field slotNumber.
PayloadV4 PayloadVersion = 0x4
) )
//go:generate go run github.com/fjl/gencodec -type PayloadAttributes -field-override payloadAttributesMarshaling -out gen_blockparams.go //go:generate go run github.com/fjl/gencodec -type PayloadAttributes -field-override payloadAttributesMarshaling -out gen_blockparams.go
@ -48,35 +69,37 @@ type PayloadAttributes struct {
SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"` SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient" gencodec:"required"`
Withdrawals []*types.Withdrawal `json:"withdrawals"` Withdrawals []*types.Withdrawal `json:"withdrawals"`
BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"` BeaconRoot *common.Hash `json:"parentBeaconBlockRoot"`
SlotNumber *uint64 `json:"slotNumber"`
} }
// JSON type overrides for PayloadAttributes. // JSON type overrides for PayloadAttributes.
type payloadAttributesMarshaling struct { type payloadAttributesMarshaling struct {
Timestamp hexutil.Uint64 Timestamp hexutil.Uint64
SlotNumber *hexutil.Uint64
} }
//go:generate go run github.com/fjl/gencodec -type ExecutableData -field-override executableDataMarshaling -out gen_ed.go //go:generate go run github.com/fjl/gencodec -type ExecutableData -field-override executableDataMarshaling -out gen_ed.go
// ExecutableData is the data necessary to execute an EL payload. // ExecutableData is the data necessary to execute an EL payload.
type ExecutableData struct { type ExecutableData struct {
ParentHash common.Hash `json:"parentHash" gencodec:"required"` ParentHash common.Hash `json:"parentHash" gencodec:"required"`
FeeRecipient common.Address `json:"feeRecipient" gencodec:"required"` FeeRecipient common.Address `json:"feeRecipient" gencodec:"required"`
StateRoot common.Hash `json:"stateRoot" gencodec:"required"` StateRoot common.Hash `json:"stateRoot" gencodec:"required"`
ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"` ReceiptsRoot common.Hash `json:"receiptsRoot" gencodec:"required"`
LogsBloom []byte `json:"logsBloom" gencodec:"required"` LogsBloom []byte `json:"logsBloom" gencodec:"required"`
Random common.Hash `json:"prevRandao" gencodec:"required"` Random common.Hash `json:"prevRandao" gencodec:"required"`
Number uint64 `json:"blockNumber" gencodec:"required"` Number uint64 `json:"blockNumber" gencodec:"required"`
GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"`
GasUsed uint64 `json:"gasUsed" gencodec:"required"` GasUsed uint64 `json:"gasUsed" gencodec:"required"`
Timestamp uint64 `json:"timestamp" gencodec:"required"` Timestamp uint64 `json:"timestamp" gencodec:"required"`
ExtraData []byte `json:"extraData" gencodec:"required"` ExtraData []byte `json:"extraData" gencodec:"required"`
BaseFeePerGas *big.Int `json:"baseFeePerGas" gencodec:"required"` BaseFeePerGas *big.Int `json:"baseFeePerGas" gencodec:"required"`
BlockHash common.Hash `json:"blockHash" gencodec:"required"` BlockHash common.Hash `json:"blockHash" gencodec:"required"`
Transactions [][]byte `json:"transactions" gencodec:"required"` Transactions [][]byte `json:"transactions" gencodec:"required"`
Withdrawals []*types.Withdrawal `json:"withdrawals"` Withdrawals []*types.Withdrawal `json:"withdrawals"`
BlobGasUsed *uint64 `json:"blobGasUsed"` BlobGasUsed *uint64 `json:"blobGasUsed"`
ExcessBlobGas *uint64 `json:"excessBlobGas"` ExcessBlobGas *uint64 `json:"excessBlobGas"`
ExecutionWitness *types.ExecutionWitness `json:"executionWitness,omitempty"` SlotNumber *uint64 `json:"slotNumber"`
} }
// JSON type overrides for executableData. // JSON type overrides for executableData.
@ -91,6 +114,7 @@ type executableDataMarshaling struct {
Transactions []hexutil.Bytes Transactions []hexutil.Bytes
BlobGasUsed *hexutil.Uint64 BlobGasUsed *hexutil.Uint64
ExcessBlobGas *hexutil.Uint64 ExcessBlobGas *hexutil.Uint64
SlotNumber *hexutil.Uint64
} }
// StatelessPayloadStatusV1 is the result of a stateless payload execution. // StatelessPayloadStatusV1 is the result of a stateless payload execution.
@ -106,13 +130,18 @@ type StatelessPayloadStatusV1 struct {
type ExecutionPayloadEnvelope struct { type ExecutionPayloadEnvelope struct {
ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"` ExecutionPayload *ExecutableData `json:"executionPayload" gencodec:"required"`
BlockValue *big.Int `json:"blockValue" gencodec:"required"` BlockValue *big.Int `json:"blockValue" gencodec:"required"`
BlobsBundle *BlobsBundleV1 `json:"blobsBundle"` BlobsBundle *BlobsBundle `json:"blobsBundle"`
Requests [][]byte `json:"executionRequests"` Requests [][]byte `json:"executionRequests"`
Override bool `json:"shouldOverrideBuilder"` Override bool `json:"shouldOverrideBuilder"`
Witness *hexutil.Bytes `json:"witness,omitempty"` Witness *hexutil.Bytes `json:"witness,omitempty"`
} }
type BlobsBundleV1 struct { // BlobsBundle includes the marshalled sidecar data. Note this structure is
// shared by BlobsBundleV1 and BlobsBundleV2 for the sake of simplicity.
//
// - BlobsBundleV1: proofs contain exactly len(blobs) kzg proofs.
// - BlobsBundleV2: proofs contain exactly CELLS_PER_EXT_BLOB * len(blobs) cell proofs.
type BlobsBundle struct {
Commitments []hexutil.Bytes `json:"commitments"` Commitments []hexutil.Bytes `json:"commitments"`
Proofs []hexutil.Bytes `json:"proofs"` Proofs []hexutil.Bytes `json:"proofs"`
Blobs []hexutil.Bytes `json:"blobs"` Blobs []hexutil.Bytes `json:"blobs"`
@ -125,7 +154,7 @@ type BlobAndProofV1 struct {
type BlobAndProofV2 struct { type BlobAndProofV2 struct {
Blob hexutil.Bytes `json:"blob"` Blob hexutil.Bytes `json:"blob"`
CellProofs []hexutil.Bytes `json:"proofs"` CellProofs []hexutil.Bytes `json:"proofs"` // proofs MUST contain exactly CELLS_PER_EXT_BLOB cell proofs.
} }
// JSON type overrides for ExecutionPayloadEnvelope. // JSON type overrides for ExecutionPayloadEnvelope.
@ -195,7 +224,7 @@ func encodeTransactions(txs []*types.Transaction) [][]byte {
return enc return enc
} }
func decodeTransactions(enc [][]byte) ([]*types.Transaction, error) { func DecodeTransactions(enc [][]byte) ([]*types.Transaction, error) {
var txs = make([]*types.Transaction, len(enc)) var txs = make([]*types.Transaction, len(enc))
for i, encTx := range enc { for i, encTx := range enc {
var tx types.Transaction var tx types.Transaction
@ -233,7 +262,7 @@ func ExecutableDataToBlock(data ExecutableData, versionedHashes []common.Hash, b
// for stateless execution, so it skips checking if the executable data hashes to // for stateless execution, so it skips checking if the executable data hashes to
// the requested hash (stateless has to *compute* the root hash, it's not given). // the requested hash (stateless has to *compute* the root hash, it's not given).
func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, requests [][]byte) (*types.Block, error) { func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, requests [][]byte) (*types.Block, error) {
txs, err := decodeTransactions(data.Transactions) txs, err := DecodeTransactions(data.Transactions)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -295,10 +324,10 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
BlobGasUsed: data.BlobGasUsed, BlobGasUsed: data.BlobGasUsed,
ParentBeaconRoot: beaconRoot, ParentBeaconRoot: beaconRoot,
RequestsHash: requestsHash, RequestsHash: requestsHash,
SlotNumber: data.SlotNumber,
} }
return types.NewBlockWithHeader(header). return types.NewBlockWithHeader(header).
WithBody(types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals}). WithBody(types.Body{Transactions: txs, Uncles: nil, Withdrawals: data.Withdrawals}),
WithWitness(data.ExecutionWitness),
nil nil
} }
@ -306,39 +335,48 @@ func ExecutableDataToBlockNoHash(data ExecutableData, versionedHashes []common.H
// fields from the given block. It assumes the given block is post-merge block. // fields from the given block. It assumes the given block is post-merge block.
func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars []*types.BlobTxSidecar, requests [][]byte) *ExecutionPayloadEnvelope { func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars []*types.BlobTxSidecar, requests [][]byte) *ExecutionPayloadEnvelope {
data := &ExecutableData{ data := &ExecutableData{
BlockHash: block.Hash(), BlockHash: block.Hash(),
ParentHash: block.ParentHash(), ParentHash: block.ParentHash(),
FeeRecipient: block.Coinbase(), FeeRecipient: block.Coinbase(),
StateRoot: block.Root(), StateRoot: block.Root(),
Number: block.NumberU64(), Number: block.NumberU64(),
GasLimit: block.GasLimit(), GasLimit: block.GasLimit(),
GasUsed: block.GasUsed(), GasUsed: block.GasUsed(),
BaseFeePerGas: block.BaseFee(), BaseFeePerGas: block.BaseFee(),
Timestamp: block.Time(), Timestamp: block.Time(),
ReceiptsRoot: block.ReceiptHash(), ReceiptsRoot: block.ReceiptHash(),
LogsBloom: block.Bloom().Bytes(), LogsBloom: block.Bloom().Bytes(),
Transactions: encodeTransactions(block.Transactions()), Transactions: encodeTransactions(block.Transactions()),
Random: block.MixDigest(), Random: block.MixDigest(),
ExtraData: block.Extra(), ExtraData: block.Extra(),
Withdrawals: block.Withdrawals(), Withdrawals: block.Withdrawals(),
BlobGasUsed: block.BlobGasUsed(), BlobGasUsed: block.BlobGasUsed(),
ExcessBlobGas: block.ExcessBlobGas(), ExcessBlobGas: block.ExcessBlobGas(),
ExecutionWitness: block.ExecutionWitness(), SlotNumber: block.SlotNumber(),
} }
// Add blobs. // Add blobs.
bundle := BlobsBundleV1{ bundle := BlobsBundle{
Commitments: make([]hexutil.Bytes, 0), Commitments: make([]hexutil.Bytes, 0),
Blobs: make([]hexutil.Bytes, 0), Blobs: make([]hexutil.Bytes, 0),
Proofs: make([]hexutil.Bytes, 0), Proofs: make([]hexutil.Bytes, 0),
} }
for _, sidecar := range sidecars { for _, sidecar := range sidecars {
for j := range sidecar.Blobs { for j := range sidecar.Blobs {
bundle.Blobs = append(bundle.Blobs, hexutil.Bytes(sidecar.Blobs[j][:])) bundle.Blobs = append(bundle.Blobs, sidecar.Blobs[j][:])
bundle.Commitments = append(bundle.Commitments, hexutil.Bytes(sidecar.Commitments[j][:])) bundle.Commitments = append(bundle.Commitments, sidecar.Commitments[j][:])
} }
// - Before the Osaka fork, only version-0 blob transactions should be packed,
// with the proof length equal to len(blobs).
//
// - After the Osaka fork, only version-1 blob transactions should be packed,
// with the proof length equal to CELLS_PER_EXT_BLOB * len(blobs).
//
// Ideally, length validation should be performed based on the bundle version.
// In practice, this is unnecessary because blob transaction filtering is
// already done during payload construction.
for _, proof := range sidecar.Proofs { for _, proof := range sidecar.Proofs {
bundle.Proofs = append(bundle.Proofs, hexutil.Bytes(proof[:])) bundle.Proofs = append(bundle.Proofs, proof[:])
} }
} }

View file

@ -34,21 +34,13 @@ func TestBlobs(t *testing.T) {
header := types.Header{} header := types.Header{}
block := types.NewBlock(&header, &types.Body{}, nil, nil) block := types.NewBlock(&header, &types.Body{}, nil, nil)
sidecarWithoutCellProofs := &types.BlobTxSidecar{ sidecarWithoutCellProofs := types.NewBlobTxSidecar(types.BlobSidecarVersion0, []kzg4844.Blob{*emptyBlob}, []kzg4844.Commitment{emptyBlobCommit}, []kzg4844.Proof{emptyBlobProof})
Blobs: []kzg4844.Blob{*emptyBlob},
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: []kzg4844.Proof{emptyBlobProof},
}
env := BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithoutCellProofs}, nil) env := BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithoutCellProofs}, nil)
if len(env.BlobsBundle.Proofs) != 1 { if len(env.BlobsBundle.Proofs) != 1 {
t.Fatalf("Expect 1 proof in blobs bundle, got %v", len(env.BlobsBundle.Proofs)) t.Fatalf("Expect 1 proof in blobs bundle, got %v", len(env.BlobsBundle.Proofs))
} }
sidecarWithCellProofs := &types.BlobTxSidecar{ sidecarWithCellProofs := types.NewBlobTxSidecar(types.BlobSidecarVersion0, []kzg4844.Blob{*emptyBlob}, []kzg4844.Commitment{emptyBlobCommit}, emptyCellProof)
Blobs: []kzg4844.Blob{*emptyBlob},
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: emptyCellProof,
}
env = BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithCellProofs}, nil) env = BlockToExecutableData(block, common.Big0, []*types.BlobTxSidecar{sidecarWithCellProofs}, nil)
if len(env.BlobsBundle.Proofs) != 128 { if len(env.BlobsBundle.Proofs) != 128 {
t.Fatalf("Expect 128 proofs in blobs bundle, got %v", len(env.BlobsBundle.Proofs)) t.Fatalf("Expect 128 proofs in blobs bundle, got %v", len(env.BlobsBundle.Proofs))

View file

@ -69,7 +69,10 @@ func newCanonicalStore[T any](db ethdb.Iteratee, keyPrefix []byte) (*canonicalSt
// databaseKey returns the database key belonging to the given period. // databaseKey returns the database key belonging to the given period.
func (cs *canonicalStore[T]) databaseKey(period uint64) []byte { func (cs *canonicalStore[T]) databaseKey(period uint64) []byte {
return binary.BigEndian.AppendUint64(append([]byte{}, cs.keyPrefix...), period) key := make([]byte, len(cs.keyPrefix)+8)
copy(key, cs.keyPrefix)
binary.BigEndian.PutUint64(key[len(cs.keyPrefix):], period)
return key
} }
// add adds the given item to the database. It also ensures that the range remains // add adds the given item to the database. It also ensures that the range remains

View file

@ -269,7 +269,7 @@ func (s *Scheduler) addEvent(event Event) {
s.Trigger() s.Trigger()
} }
// filterEvent sorts each Event either as a request event or a server event, // filterEvents sorts each Event either as a request event or a server event,
// depending on its type. Request events are also sorted in a map based on the // depending on its type. Request events are also sorted in a map based on the
// module that originally initiated the request. It also ensures that no events // module that originally initiated the request. It also ensures that no events
// related to a server are returned before EvRegistered or after EvUnregistered. // related to a server are returned before EvRegistered or after EvUnregistered.

View file

@ -105,6 +105,7 @@ func (s *HeadSync) Process(requester request.Requester, events []request.Event)
delete(s.serverHeads, event.Server) delete(s.serverHeads, event.Server)
delete(s.unvalidatedOptimistic, event.Server) delete(s.unvalidatedOptimistic, event.Server)
delete(s.unvalidatedFinality, event.Server) delete(s.unvalidatedFinality, event.Server)
delete(s.reqFinalityEpoch, event.Server)
} }
} }
} }

View file

@ -32,7 +32,7 @@ type Value [32]byte
// Values represent a series of merkle tree leaves/nodes. // Values represent a series of merkle tree leaves/nodes.
type Values []Value type Values []Value
var valueT = reflect.TypeOf(Value{}) var valueT = reflect.TypeFor[Value]()
// UnmarshalJSON parses a merkle value in hex syntax. // UnmarshalJSON parses a merkle value in hex syntax.
func (m *Value) UnmarshalJSON(input []byte) error { func (m *Value) UnmarshalJSON(input []byte) error {

View file

@ -1 +1 @@
0xd60e5310c5d52ced44cfb13be4e9f22a1e6a6dc56964c3cccd429182d26d72d0 0x4bae4b97deda095724560012cab1f80a5221ce0a37a4b5236d8ab63f595f29d9

View file

@ -0,0 +1 @@
0xbb7a7f3c40d8ea0b450f91587db65d0f1c079669277e01a0426c8911702a863a

View file

@ -1 +1 @@
0x02f0bb348b0d45f95a9b7e2bb5705768ad06548876cee03d880a2c9dabb1ff88 0x2af778d703186526a1b6304b423f338f11556206f618643c3f7fa0d7b1ef5c9b

View file

@ -1 +1 @@
0xa0dad451a230c01be6f2492980ec5bb412d8cf33351a75e8b172b5b84a5fd03a 0x48a89c9ea7ba19de2931797974cf8722344ab231c0edada278b108ef74125478

View file

@ -20,6 +20,7 @@ import (
"crypto/sha256" "crypto/sha256"
"fmt" "fmt"
"math" "math"
"math/big"
"os" "os"
"slices" "slices"
"sort" "sort"
@ -37,7 +38,7 @@ import (
// across signing different data structures. // across signing different data structures.
const syncCommitteeDomain = 7 const syncCommitteeDomain = 7
var knownForks = []string{"GENESIS", "ALTAIR", "BELLATRIX", "CAPELLA", "DENEB"} var knownForks = []string{"GENESIS", "ALTAIR", "BELLATRIX", "CAPELLA", "DENEB", "ELECTRA", "FULU"}
// ClientConfig contains beacon light client configuration. // ClientConfig contains beacon light client configuration.
type ClientConfig struct { type ClientConfig struct {
@ -90,12 +91,8 @@ func (c *ChainConfig) AddFork(name string, epoch uint64, version []byte) *ChainC
// LoadForks parses the beacon chain configuration file (config.yaml) and extracts // LoadForks parses the beacon chain configuration file (config.yaml) and extracts
// the list of forks. // the list of forks.
func (c *ChainConfig) LoadForks(path string) error { func (c *ChainConfig) LoadForks(file []byte) error {
file, err := os.ReadFile(path) config := make(map[string]any)
if err != nil {
return fmt.Errorf("failed to read beacon chain config file: %v", err)
}
config := make(map[string]string)
if err := yaml.Unmarshal(file, &config); err != nil { if err := yaml.Unmarshal(file, &config); err != nil {
return fmt.Errorf("failed to parse beacon chain config file: %v", err) return fmt.Errorf("failed to parse beacon chain config file: %v", err)
} }
@ -106,20 +103,45 @@ func (c *ChainConfig) LoadForks(path string) error {
epochs["GENESIS"] = 0 epochs["GENESIS"] = 0
for key, value := range config { for key, value := range config {
if value == nil {
continue
}
if strings.HasSuffix(key, "_FORK_VERSION") { if strings.HasSuffix(key, "_FORK_VERSION") {
name := key[:len(key)-len("_FORK_VERSION")] name := key[:len(key)-len("_FORK_VERSION")]
if v, err := hexutil.Decode(value); err == nil { switch version := value.(type) {
case int:
versions[name] = new(big.Int).SetUint64(uint64(version)).FillBytes(make([]byte, 4))
case int64:
versions[name] = new(big.Int).SetUint64(uint64(version)).FillBytes(make([]byte, 4))
case uint64:
versions[name] = new(big.Int).SetUint64(version).FillBytes(make([]byte, 4))
case string:
v, err := hexutil.Decode(version)
if err != nil {
return fmt.Errorf("failed to decode hex fork id %q in beacon chain config file: %v", version, err)
}
versions[name] = v versions[name] = v
} else { default:
return fmt.Errorf("failed to decode hex fork id %q in beacon chain config file: %v", value, err) return fmt.Errorf("invalid fork version %q in beacon chain config file", version)
} }
} }
if strings.HasSuffix(key, "_FORK_EPOCH") { if strings.HasSuffix(key, "_FORK_EPOCH") {
name := key[:len(key)-len("_FORK_EPOCH")] name := key[:len(key)-len("_FORK_EPOCH")]
if v, err := strconv.ParseUint(value, 10, 64); err == nil { switch epoch := value.(type) {
case int:
epochs[name] = uint64(epoch)
case int64:
epochs[name] = uint64(epoch)
case uint64:
epochs[name] = epoch
case string:
v, err := strconv.ParseUint(epoch, 10, 64)
if err != nil {
return fmt.Errorf("failed to parse epoch number %q in beacon chain config file: %v", epoch, err)
}
epochs[name] = v epochs[name] = v
} else { default:
return fmt.Errorf("failed to parse epoch number %q in beacon chain config file: %v", value, err) return fmt.Errorf("invalid fork epoch %q in beacon chain config file", epoch)
} }
} }
} }

View file

@ -0,0 +1,37 @@
package params
import (
"bytes"
"testing"
)
func TestChainConfig_LoadForks(t *testing.T) {
const config = `
GENESIS_FORK_VERSION: 0x00000000
ALTAIR_FORK_VERSION: 0x00000001
ALTAIR_FORK_EPOCH: 1
EIP7928_FORK_VERSION: 0xb0000038
EIP7928_FORK_EPOCH: 18446744073709551615
EIP7XXX_FORK_VERSION:
EIP7XXX_FORK_EPOCH:
BLOB_SCHEDULE: []
`
c := &ChainConfig{}
err := c.LoadForks([]byte(config))
if err != nil {
t.Fatal(err)
}
for _, fork := range c.Forks {
if fork.Name == "GENESIS" && (fork.Epoch != 0) {
t.Errorf("unexpected genesis fork epoch %d", fork.Epoch)
}
if fork.Name == "ALTAIR" && (fork.Epoch != 1 || !bytes.Equal(fork.Version, []byte{0, 0, 0, 1})) {
t.Errorf("unexpected altair fork epoch %d version %x", fork.Epoch, fork.Version)
}
}
}

View file

@ -31,47 +31,53 @@ var checkpointSepolia string
//go:embed checkpoint_holesky.hex //go:embed checkpoint_holesky.hex
var checkpointHolesky string var checkpointHolesky string
//go:embed checkpoint_hoodi.hex
var checkpointHoodi string
var ( var (
MainnetLightConfig = (&ChainConfig{ MainnetLightConfig = (&ChainConfig{
GenesisValidatorsRoot: common.HexToHash("0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"), GenesisValidatorsRoot: common.HexToHash("0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"),
GenesisTime: 1606824023, GenesisTime: 1606824023,
Checkpoint: common.HexToHash(checkpointMainnet), Checkpoint: common.HexToHash(checkpointMainnet),
}). }).
AddFork("GENESIS", 0, []byte{0, 0, 0, 0}). AddFork("GENESIS", 0, common.FromHex("0x00000000")).
AddFork("ALTAIR", 74240, []byte{1, 0, 0, 0}). AddFork("ALTAIR", 74240, common.FromHex("0x01000000")).
AddFork("BELLATRIX", 144896, []byte{2, 0, 0, 0}). AddFork("BELLATRIX", 144896, common.FromHex("0x02000000")).
AddFork("CAPELLA", 194048, []byte{3, 0, 0, 0}). AddFork("CAPELLA", 194048, common.FromHex("0x03000000")).
AddFork("DENEB", 269568, []byte{4, 0, 0, 0}). AddFork("DENEB", 269568, common.FromHex("0x04000000")).
AddFork("ELECTRA", 364032, []byte{5, 0, 0, 0}) AddFork("ELECTRA", 364032, common.FromHex("0x05000000")).
AddFork("FULU", 411392, common.FromHex("0x06000000"))
SepoliaLightConfig = (&ChainConfig{ SepoliaLightConfig = (&ChainConfig{
GenesisValidatorsRoot: common.HexToHash("0xd8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078"), GenesisValidatorsRoot: common.HexToHash("0xd8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078"),
GenesisTime: 1655733600, GenesisTime: 1655733600,
Checkpoint: common.HexToHash(checkpointSepolia), Checkpoint: common.HexToHash(checkpointSepolia),
}). }).
AddFork("GENESIS", 0, []byte{144, 0, 0, 105}). AddFork("GENESIS", 0, common.FromHex("0x90000069")).
AddFork("ALTAIR", 50, []byte{144, 0, 0, 112}). AddFork("ALTAIR", 50, common.FromHex("0x90000070")).
AddFork("BELLATRIX", 100, []byte{144, 0, 0, 113}). AddFork("BELLATRIX", 100, common.FromHex("0x90000071")).
AddFork("CAPELLA", 56832, []byte{144, 0, 0, 114}). AddFork("CAPELLA", 56832, common.FromHex("0x90000072")).
AddFork("DENEB", 132608, []byte{144, 0, 0, 115}). AddFork("DENEB", 132608, common.FromHex("0x90000073")).
AddFork("ELECTRA", 222464, []byte{144, 0, 0, 116}) AddFork("ELECTRA", 222464, common.FromHex("0x90000074")).
AddFork("FULU", 272640, common.FromHex("0x90000075"))
HoleskyLightConfig = (&ChainConfig{ HoleskyLightConfig = (&ChainConfig{
GenesisValidatorsRoot: common.HexToHash("0x9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1"), GenesisValidatorsRoot: common.HexToHash("0x9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1"),
GenesisTime: 1695902400, GenesisTime: 1695902400,
Checkpoint: common.HexToHash(checkpointHolesky), Checkpoint: common.HexToHash(checkpointHolesky),
}). }).
AddFork("GENESIS", 0, []byte{1, 1, 112, 0}). AddFork("GENESIS", 0, common.FromHex("0x01017000")).
AddFork("ALTAIR", 0, []byte{2, 1, 112, 0}). AddFork("ALTAIR", 0, common.FromHex("0x02017000")).
AddFork("BELLATRIX", 0, []byte{3, 1, 112, 0}). AddFork("BELLATRIX", 0, common.FromHex("0x03017000")).
AddFork("CAPELLA", 256, []byte{4, 1, 112, 0}). AddFork("CAPELLA", 256, common.FromHex("0x04017000")).
AddFork("DENEB", 29696, []byte{5, 1, 112, 0}). AddFork("DENEB", 29696, common.FromHex("0x05017000")).
AddFork("ELECTRA", 115968, []byte{6, 1, 112, 0}) AddFork("ELECTRA", 115968, common.FromHex("0x06017000")).
AddFork("FULU", 165120, common.FromHex("0x07017000"))
HoodiLightConfig = (&ChainConfig{ HoodiLightConfig = (&ChainConfig{
GenesisValidatorsRoot: common.HexToHash("0x212f13fc4df078b6cb7db228f1c8307566dcecf900867401a92023d7ba99cb5f"), GenesisValidatorsRoot: common.HexToHash("0x212f13fc4df078b6cb7db228f1c8307566dcecf900867401a92023d7ba99cb5f"),
GenesisTime: 1742212800, GenesisTime: 1742212800,
Checkpoint: common.HexToHash(""), Checkpoint: common.HexToHash(checkpointHoodi),
}). }).
AddFork("GENESIS", 0, common.FromHex("0x10000910")). AddFork("GENESIS", 0, common.FromHex("0x10000910")).
AddFork("ALTAIR", 0, common.FromHex("0x20000910")). AddFork("ALTAIR", 0, common.FromHex("0x20000910")).
@ -79,5 +85,5 @@ var (
AddFork("CAPELLA", 0, common.FromHex("0x40000910")). AddFork("CAPELLA", 0, common.FromHex("0x40000910")).
AddFork("DENEB", 0, common.FromHex("0x50000910")). AddFork("DENEB", 0, common.FromHex("0x50000910")).
AddFork("ELECTRA", 2048, common.FromHex("0x60000910")). AddFork("ELECTRA", 2048, common.FromHex("0x60000910")).
AddFork("FULU", 18446744073709551615, common.FromHex("0x70000910")) AddFork("FULU", 50688, common.FromHex("0x70000910"))
) )

View file

@ -52,7 +52,7 @@ func BlockFromJSON(forkName string, data []byte) (*BeaconBlock, error) {
obj = new(capella.BeaconBlock) obj = new(capella.BeaconBlock)
case "deneb": case "deneb":
obj = new(deneb.BeaconBlock) obj = new(deneb.BeaconBlock)
case "electra": case "electra", "fulu":
obj = new(electra.BeaconBlock) obj = new(electra.BeaconBlock)
default: default:
return nil, fmt.Errorf("unsupported fork: %s", forkName) return nil, fmt.Errorf("unsupported fork: %s", forkName)

View file

@ -45,7 +45,7 @@ func ExecutionHeaderFromJSON(forkName string, data []byte) (*ExecutionHeader, er
switch forkName { switch forkName {
case "capella": case "capella":
obj = new(capella.ExecutionPayloadHeader) obj = new(capella.ExecutionPayloadHeader)
case "deneb", "electra": // note: the payload type was not changed in electra case "deneb", "electra", "fulu": // note: the payload type was not changed in electra/fulu
obj = new(deneb.ExecutionPayloadHeader) obj = new(deneb.ExecutionPayloadHeader)
default: default:
return nil, fmt.Errorf("unsupported fork: %s", forkName) return nil, fmt.Errorf("unsupported fork: %s", forkName)

View file

@ -1,113 +1,106 @@
# This file contains sha256 checksums of optional build dependencies. # This file contains sha256 checksums of optional build dependencies.
# version:spec-tests v4.5.0 # version:spec-tests v5.1.0
# https://github.com/ethereum/execution-spec-tests/releases # https://github.com/ethereum/execution-spec-tests/releases
# https://github.com/ethereum/execution-spec-tests/releases/download/v4.5.0/ # https://github.com/ethereum/execution-spec-tests/releases/download/v5.1.0
58afb92a0075a2cb7c4dec1281f7cb88b21b02afbedad096b580f3f8cc14c54c fixtures_develop.tar.gz a3192784375acec7eaec492799d5c5d0c47a2909a3cc40178898e4ecd20cc416 fixtures_develop.tar.gz
# version:golang 1.24.4 # version:golang 1.25.7
# https://go.dev/dl/ # https://go.dev/dl/
5a86a83a31f9fa81490b8c5420ac384fd3d95a3e71fba665c7b3f95d1dfef2b4 go1.24.4.src.tar.gz 178f2832820274b43e177d32f06a3ebb0129e427dd20a5e4c88df2c1763cf10a go1.25.7.src.tar.gz
0d2af78e3b6e08f8013dbbdb26ae33052697b6b72e03ec17d496739c2a1aed68 go1.24.4.aix-ppc64.tar.gz 81bf2a1f20633f62d55d826d82dde3b0570cf1408a91e15781b266037299285b go1.25.7.aix-ppc64.tar.gz
69bef555e114b4a2252452b6e7049afc31fbdf2d39790b669165e89525cd3f5c go1.24.4.darwin-amd64.tar.gz bf5050a2152f4053837b886e8d9640c829dbacbc3370f913351eb0904cb706f5 go1.25.7.darwin-amd64.tar.gz
c4d74453a26f488bdb4b0294da4840d9020806de4661785334eb6d1803ee5c27 go1.24.4.darwin-amd64.pkg ff18369ffad05c57d5bed888b660b31385f3c913670a83ef557cdfd98ea9ae1b go1.25.7.darwin-arm64.tar.gz
27973684b515eaf461065054e6b572d9390c05e69ba4a423076c160165336470 go1.24.4.darwin-arm64.tar.gz c5dccd7f192dd7b305dc209fb316ac1917776d74bd8e4d532ef2772f305bf42a go1.25.7.dragonfly-amd64.tar.gz
2fe1f8746745c4bfebd494583aaef24cad42594f6d25ed67856879d567ee66e7 go1.24.4.darwin-arm64.pkg a2de97c8ac74bf64b0ae73fe9d379e61af530e061bc7f8f825044172ffe61a8b go1.25.7.freebsd-386.tar.gz
70b2de9c1cafe5af7be3eb8f80753cce0501ef300db3f3bd59be7ccc464234e1 go1.24.4.dragonfly-amd64.tar.gz 055f9e138787dcafa81eb0314c8ff70c6dd0f6dba1e8a6957fef5d5efd1ab8fd go1.25.7.freebsd-amd64.tar.gz
8d529839db29ee171505b89dc9c3de76003a4ab56202d84bddbbecacbfb6d7c9 go1.24.4.freebsd-386.tar.gz 60e7f7a7c990f0b9539ac8ed668155746997d404643a4eecd47b3dee1b7e710b go1.25.7.freebsd-arm.tar.gz
6cbc3ad6cc21bdcc7283824d3ac0e85512c02022f6a35eb2e844882ea6e8448c go1.24.4.freebsd-amd64.tar.gz 631e03d5fd4c526e2f499154d8c6bf4cb081afb2fff171c428722afc9539d53a go1.25.7.freebsd-arm64.tar.gz
d49ae050c20aff646a7641dd903f03eb674570790b90ffb298076c4d41e36655 go1.24.4.freebsd-arm.tar.gz 8a264fd685823808140672812e3ad9c43f6ad59444c0dc14cdd3a1351839ddd5 go1.25.7.freebsd-riscv64.tar.gz
e31924abef2a28456b7103c0a5d333dcc11ecf19e76d5de1a383ad5fe0b42457 go1.24.4.freebsd-arm64.tar.gz 57c672447d906a1bcab98f2b11492d54521a791aacbb4994a25169e59cbe289a go1.25.7.illumos-amd64.tar.gz
b5bca135eae8ebddf22972611ac1c58ae9fbb5979fd953cc5245c5b1b2517546 go1.24.4.freebsd-riscv64.tar.gz 2866517e9ca81e6a2e85a930e9b11bc8a05cfeb2fc6dc6cb2765e7fb3c14b715 go1.25.7.linux-386.tar.gz
7d5efda511ff7e3114b130acee5d0bffbb078fedbfa9b2c1b6a807107e1ca23a go1.24.4.illumos-amd64.tar.gz 12e6d6a191091ae27dc31f6efc630e3a3b8ba409baf3573d955b196fdf086005 go1.25.7.linux-amd64.tar.gz
130c9b061082eca15513e595e9952a2ded32e737e609dd0e49f7dfa74eba026d go1.24.4.linux-386.tar.gz ba611a53534135a81067240eff9508cd7e256c560edd5d8c2fef54f083c07129 go1.25.7.linux-arm64.tar.gz
77e5da33bb72aeaef1ba4418b6fe511bc4d041873cbf82e5aa6318740df98717 go1.24.4.linux-amd64.tar.gz 1ba07e0eb86b839e72467f4b5c7a5597d07f30bcf5563c951410454f7cda5266 go1.25.7.linux-armv6l.tar.gz
d5501ee5aca0f258d5fe9bfaed401958445014495dc115f202d43d5210b45241 go1.24.4.linux-arm64.tar.gz 775753fc5952a334c415f08768df2f0b73a3228a16e8f5f63d545daacb4e3357 go1.25.7.linux-loong64.tar.gz
6a554e32301cecae3162677e66d4264b81b3b1a89592dd1b7b5c552c7a49fe37 go1.24.4.linux-armv6l.tar.gz 1a023bb367c5fbb4c637a2f6dc23ff17c6591ad929ce16ea88c74d857153b307 go1.25.7.linux-mips.tar.gz
b208eb25fe244408cbe269ed426454bc46e59d0e0a749b6240d39e884e969875 go1.24.4.linux-loong64.tar.gz a8e97223d8aa6fdfd45f132a4784d2f536bbac5f3d63a24b63d33b6bfe1549af go1.25.7.linux-mips64.tar.gz
fddfcb28fd36fe63d2ae181026798f86f3bbd3a7bb0f1e1f617dd3d604bf3fe4 go1.24.4.linux-mips.tar.gz eb9edb6223330d5e20275667c65dea076b064c08e595fe4eba5d7d6055cfaccf go1.25.7.linux-mips64le.tar.gz
7934b924d5ab8c8ae3134a09a6ae74d3c39f63f6c4322ec289364dbbf0bac3ca go1.24.4.linux-mips64.tar.gz 9c1e693552a5f9bb9e0012d1c5e01456ecefbc59bef53a77305222ce10aba368 go1.25.7.linux-mipsle.tar.gz
fa763d8673f94d6e534bb72c3cf675d4c2b8da4a6da42a89f08c5586106db39c go1.24.4.linux-mips64le.tar.gz 28a788798e7329acbbc0ac2caa5e4368b1e5ede646cc24429c991214cfb45c63 go1.25.7.linux-ppc64.tar.gz
84363dbfe49b41d43df84420a09bd53a4770053d63bfa509868c46a5f8eb3ff7 go1.24.4.linux-mipsle.tar.gz 42124c0edc92464e2b37b2d7fcd3658f0c47ebd6a098732415a522be8cb88e3f go1.25.7.linux-ppc64le.tar.gz
28fcbd5d3b56493606873c33f2b4bdd84ba93c633f37313613b5a1e6495c6fe5 go1.24.4.linux-ppc64.tar.gz 88d59c6893c8425875d6eef8e3434bc2fa2552e5ad4c058c6cd8cd710a0301c8 go1.25.7.linux-riscv64.tar.gz
9ca4afef813a2578c23843b640ae0290aa54b2e3c950a6cc4c99e16a57dec2ec go1.24.4.linux-ppc64le.tar.gz c6b77facf666dc68195ecab05dbf0ebb4e755b2a8b7734c759880557f1c29b0c go1.25.7.linux-s390x.tar.gz
1d7034f98662d8f2c8abd7c700ada4093acb4f9c00e0e51a30344821d0785c77 go1.24.4.linux-riscv64.tar.gz f14c184d9ade0ee04c7735d4071257b90896ecbde1b32adae84135f055e6399b go1.25.7.netbsd-386.tar.gz
0449f3203c39703ab27684be763e9bb78ca9a051e0e4176727aead9461b6deb5 go1.24.4.linux-s390x.tar.gz 7e7389e404dca1088c31f0fc07f1dd60891d7182bcd621469c14f7e79eceb3ff go1.25.7.netbsd-amd64.tar.gz
954b49ccc2cfcf4b5f7cd33ff662295e0d3b74e7590c8e25fc2abb30bce120ba go1.24.4.netbsd-386.tar.gz 70388bb3ef2f03dbf1357e9056bd09034a67e018262557354f8cf549766b3f9d go1.25.7.netbsd-arm.tar.gz
370fabcdfee7c18857c96fdd5b706e025d4fb86a208da88ba56b1493b35498e9 go1.24.4.netbsd-amd64.tar.gz 8c1cda9d25bfc9b18d24d5f95fc23949dd3ff99fa408a6cfa40e2cf12b07e362 go1.25.7.netbsd-arm64.tar.gz
7935ef95d4d1acc48587b1eb4acab98b0a7d9569736a32398b9c1d2e89026865 go1.24.4.netbsd-arm.tar.gz 42f0d1bfbe39b8401cccb84dd66b30795b97bfc9620dfdc17c5cd4fcf6495cb0 go1.25.7.openbsd-386.tar.gz
ead78fd0fa29fbb176cc83f1caa54032e1a44f842affa56a682c647e0759f237 go1.24.4.netbsd-arm64.tar.gz e514879c0a28bc32123cd52c4c093de912477fe83f36a6d07517d066ef55391a go1.25.7.openbsd-amd64.tar.gz
913e217394b851a636b99de175f0c2f9ab9938b41c557f047168f77ee485d776 go1.24.4.openbsd-386.tar.gz 8cd22530695a0218232bf7efea8f162df1697a3106942ac4129b8c3de39ce4ef go1.25.7.openbsd-arm.tar.gz
24568da3dcbcdb24ec18b631f072faf0f3763e3d04f79032dc56ad9ec35379c4 go1.24.4.openbsd-amd64.tar.gz 938720f6ebc0d1c53d7840321d3a31f29fd02496e84a6538f442a9311dc1cc9a go1.25.7.openbsd-arm64.tar.gz
45abf523f870632417ab007de3841f64dd906bde546ffc8c6380ccbe91c7fb73 go1.24.4.openbsd-arm.tar.gz a4c378b73b98f89a3596c2ef51aabbb28783d9ca29f7e317d8ca07939660ce6f go1.25.7.openbsd-ppc64.tar.gz
7c57c69b5dd1e946b28a3034c285240a48e2861bdcb50b7d9c0ed61bcf89c879 go1.24.4.openbsd-arm64.tar.gz 937b58734fbeaa8c7941a0e4285e7e84b7885396e8d11c23f9ab1a8ff10ff20e go1.25.7.openbsd-riscv64.tar.gz
91ed711f704829372d6931e1897631ef40288b8f9e3cd6ef4a24df7126d1066a go1.24.4.openbsd-ppc64.tar.gz 61a093c8c5244916f25740316386bb9f141545dcf01b06a79d1c78ece488403e go1.25.7.plan9-386.tar.gz
de5e270d971c8790e8880168d56a2ea103979927c10ded136d792bbdf9bce3d3 go1.24.4.openbsd-riscv64.tar.gz 7fc8f6689c9de8ccb7689d2278035fa83c2d601409101840df6ddfe09ba58699 go1.25.7.plan9-amd64.tar.gz
ff429d03f00bcd32a50f445320b8329d0fadb2a2fff899c11e95e0922a82c543 go1.24.4.plan9-386.tar.gz 9661dff8eaeeb62f1c3aadbc5ff189a2e6744e1ec885e32dbcb438f58a34def5 go1.25.7.plan9-arm.tar.gz
39d6363a43fd16b60ae9ad7346a264e982e4fa653dee3b45f83e03cd2f7a6647 go1.24.4.plan9-amd64.tar.gz 28ecba0e1d7950c8b29a4a04962dd49c3bf5221f55a44f17d98f369f82859cf4 go1.25.7.solaris-amd64.tar.gz
1964ae2571259de77b930e97f2891aa92706ff81aac9909d45bb107b0fab16c8 go1.24.4.plan9-arm.tar.gz baa6b488291801642fa620026169e38bec2da2ac187cd3ae2145721cf826bbc3 go1.25.7.windows-386.zip
a7f9af424e8fb87886664754badca459513f64f6a321d17f1d219b8edf519821 go1.24.4.solaris-amd64.tar.gz c75e5f4ff62d085cc0017be3ad19d5536f46825fa05db06ec468941f847e3228 go1.25.7.windows-amd64.zip
d454d3cb144432f1726bf00e28c6017e78ccb256a8d01b8e3fb1b2e6b5650f28 go1.24.4.windows-386.zip 807033f85931bc4a589ca8497535dcbeb1f30d506e47fa200f5f04c4a71c3d9f go1.25.7.windows-arm64.zip
966ecace1cdbb3497a2b930bdb0f90c3ad32922fa1a7c655b2d4bbeb7e4ac308 go1.24.4.windows-386.msi
b751a1136cb9d8a2e7ebb22c538c4f02c09b98138c7c8bfb78a54a4566c013b1 go1.24.4.windows-amd64.zip
0cbb6e83865747dbe69b3d4155f92e88fcf336ff5d70182dba145e9d7bd3d8f6 go1.24.4.windows-amd64.msi
d17da51bc85bd010754a4063215d15d2c033cc289d67ca9201a03c9041b2969d go1.24.4.windows-arm64.zip
47dbe734b6a829de45654648a7abcf05bdceef5c80e03ea0b208eeebef75a852 go1.24.4.windows-arm64.msi
# version:golangci 2.0.2 # version:golangci 2.10.1
# https://github.com/golangci/golangci-lint/releases/ # https://github.com/golangci/golangci-lint/releases/
# https://github.com/golangci/golangci-lint/releases/download/v2.0.2/ # https://github.com/golangci/golangci-lint/releases/download/v2.10.1
a88cbdc86b483fe44e90bf2dcc3fec2af8c754116e6edf0aa6592cac5baa7a0e golangci-lint-2.0.2-darwin-amd64.tar.gz 66fb0da81b8033b477f97eea420d4b46b230ca172b8bb87c6610109f3772b6b6 golangci-lint-2.10.1-darwin-amd64.tar.gz
664550e7954f5f4451aae99b4f7382c1a47039c66f39ca605f5d9af1a0d32b49 golangci-lint-2.0.2-darwin-arm64.tar.gz 03bfadf67e52b441b7ec21305e501c717df93c959836d66c7f97312654acb297 golangci-lint-2.10.1-darwin-arm64.tar.gz
bda0f0f27d300502faceda8428834a76ca25986f6d9fc2bd41d201c3ed73f08e golangci-lint-2.0.2-freebsd-386.tar.gz c9a44658ccc8f7b8dbbd4ae6020ba91c1a5d3987f4d91ced0f7d2bea013e57ca golangci-lint-2.10.1-freebsd-386.tar.gz
1cbd0c7ade3fb027d61d38a646ec1b51be5846952b4b04a5330e7f4687f2270c golangci-lint-2.0.2-freebsd-amd64.tar.gz a513c5cb4e0f5bd5767001af9d5e97e7868cfc2d9c46739a4df93e713cfb24af golangci-lint-2.10.1-freebsd-amd64.tar.gz
1e828a597726198b2e35acdbcc5f3aad85244d79846d2d2bdb05241c5a535f9e golangci-lint-2.0.2-freebsd-armv6.tar.gz 2ef38eefc4b5cee2febacb75a30579526e5656c16338a921d80e59a8e87d4425 golangci-lint-2.10.1-freebsd-arm64.tar.gz
848b49315dc5cddd0c9ce35e96ab33d584db0ea8fb57bcbf9784f1622bec0269 golangci-lint-2.0.2-freebsd-armv7.tar.gz 8fea6766318b4829e766bbe325f10191d75297dcc44ae35bf374816037878e38 golangci-lint-2.10.1-freebsd-armv6.tar.gz
cabf9a6beab574c7f98581eb237919e580024759e3cdc05c4d516b044dce6770 golangci-lint-2.0.2-illumos-amd64.tar.gz 30b629870574d6254f3e8804e5a74b34f98e1263c9d55465830d739c88b862ed golangci-lint-2.10.1-freebsd-armv7.tar.gz
2fde80d15ed6527791f106d606120620e913c3a663c90a8596861d0a4461169e golangci-lint-2.0.2-linux-386.deb c0db839f866ce80b1b6c96167aa101cfe50d9c936f42d942a3c1cbdc1801af68 golangci-lint-2.10.1-illumos-amd64.tar.gz
804bc6e350a8c613aaa0a33d8d45414a80157b0ba1b2c2335ac859f85ad98ebd golangci-lint-2.0.2-linux-386.rpm 280eb56636e9175f671cd7b755d7d67f628ae2ed00a164d1e443c43c112034e5 golangci-lint-2.10.1-linux-386.deb
e64beb72fecf581e57d88ae3adb1c9d4bf022694b6bd92e3c8e460910bbdc37d golangci-lint-2.0.2-linux-386.tar.gz 065a7d99da61dc7dfbfef2e2d7053dd3fa6672598f2747117aa4bb5f45e7df7f golangci-lint-2.10.1-linux-386.rpm
9c55aed174d7a52bb1d4006b36e7edee9023631f6b814a80cb39c9860d6f75c3 golangci-lint-2.0.2-linux-amd64.deb a55918c03bb413b2662287653ab2ae2fef4e37428b247dad6348724adde9d770 golangci-lint-2.10.1-linux-386.tar.gz
c55a2ef741a687b4c679696931f7fd4a467babd64c9457cf17bb9632fd1cecd1 golangci-lint-2.0.2-linux-amd64.rpm 8aa9b3aa14f39745eeb7fc7ff50bcac683e785397d1e4bc9afd2184b12c4ce86 golangci-lint-2.10.1-linux-amd64.deb
89cc8a7810dc63b9a37900da03e37c3601caf46d42265d774e0f1a5d883d53e2 golangci-lint-2.0.2-linux-amd64.tar.gz 62a111688e9e305032334a2cbc84f4d971b64bb3bffc99d3f80081d57fb25e32 golangci-lint-2.10.1-linux-amd64.rpm
a3e78583c4e7ea1b63e82559f126bb3a5b12788676f158526752d53e67824b99 golangci-lint-2.0.2-linux-arm64.deb dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99 golangci-lint-2.10.1-linux-amd64.tar.gz
bd5dd52b5c9f18aa7a2904eda9a9f91c628e98623fe70b7afcbb847e2de84422 golangci-lint-2.0.2-linux-arm64.rpm b3f36937e8ea1660739dc0f5c892ea59c9c21ed4e75a91a25957c561f7f79a55 golangci-lint-2.10.1-linux-arm64.deb
789d5b91219ac68c2336f77d41cd7e33a910420594780f455893f8453d09595b golangci-lint-2.0.2-linux-arm64.tar.gz 36d50314d53683b1f1a2a6cedfb5a9468451b481c64ab9e97a8e843ea088074d golangci-lint-2.10.1-linux-arm64.rpm
534cd4c464a66178714ed68152c1ed7aa73e5700bf409e4ed1a8363adf96afca golangci-lint-2.0.2-linux-armv6.deb 6652b42ae02915eb2f9cb2a2e0cac99514c8eded8388d88ae3e06e1a52c00de8 golangci-lint-2.10.1-linux-arm64.tar.gz
cf7d02905a5fc80b96c9a64621693b4cc7337b1ce29986c19fd72608dafe66c5 golangci-lint-2.0.2-linux-armv6.rpm a32d8d318e803496812dd3461f250e52ccc7f53c47b95ce404a9cf55778ceb6a golangci-lint-2.10.1-linux-armv6.deb
a0d81cb527d8fe878377f2356b5773e219b0b91832a6b59e7b9bcf9a90fe0b0e golangci-lint-2.0.2-linux-armv6.tar.gz 41d065f4c8ea165a1531abea644988ee2e973e4f0b49f9725ed3b979dac45112 golangci-lint-2.10.1-linux-armv6.rpm
dedd5be7fff8cba8fe15b658a59347ea90d7d02a9fff87f09c7687e6da05a8b6 golangci-lint-2.0.2-linux-armv7.deb 59159a4df03aabbde69d15c7b7b3df143363cbb41f4bd4b200caffb8e34fb734 golangci-lint-2.10.1-linux-armv6.tar.gz
85521b6f3ad2f5a2bc9bfe14b9b08623f764964048f75ed6dfcfaf8eb7d57cc1 golangci-lint-2.0.2-linux-armv7.rpm b2e8ec0e050a1e2251dfe1561434999d202f5a3f9fa47ce94378b0fd1662ea5a golangci-lint-2.10.1-linux-armv7.deb
96471046c7780dda4ea680f65e92c2ef56ff58d40bcffaf6cfe9d6d48e3c27aa golangci-lint-2.0.2-linux-armv7.tar.gz 28c9331429a497da27e9c77846063bd0e8275e878ffedb4eb9e9f21d24771cc0 golangci-lint-2.10.1-linux-armv7.rpm
815d914a7738e4362466b2d11004e8618b696b49e8ace13df2c2b25f28fb1e17 golangci-lint-2.0.2-linux-loong64.deb 818f33e95b273e3769284b25563b51ef6a294e9e25acf140fda5830c075a1a59 golangci-lint-2.10.1-linux-armv7.tar.gz
f16381e3d8a0f011b95e086d83d620248432b915d01f4beab4d29cfe4dc388b0 golangci-lint-2.0.2-linux-loong64.rpm 6b6b85ed4b7c27f51097dd681523000409dde835e86e6e314e87be4bb013e2ab golangci-lint-2.10.1-linux-loong64.deb
1bd8d7714f9c92db6a0f23bae89f39c85ba047bec8eeb42b8748d30ae3228d18 golangci-lint-2.0.2-linux-loong64.tar.gz 94050a0cf06169e2ae44afb307dcaafa7d7c3b38c0c23b5652cf9cb60f0c337f golangci-lint-2.10.1-linux-loong64.rpm
ea6e9d4aabb526aa298e47e8b026d8893d918c5eb919ba0ab403e315def74cc5 golangci-lint-2.0.2-linux-mips64.deb 25820300fccb8c961c1cdcb1f77928040c079e04c43a3a5ceb34b1cb4a1c5c8d golangci-lint-2.10.1-linux-loong64.tar.gz
519d8d53af83fdc9c25cc3fba8b663331ac22ef68131d4b0084cb6f425b6f79a golangci-lint-2.0.2-linux-mips64.rpm 98bf39d10139fdcaa37f94950e9bbb8888660ae468847ae0bf1cb5bf67c1f68b golangci-lint-2.10.1-linux-mips64.deb
80d655a0a1ac1b19dcef4b58fa2a7dadb646cc50ad08d460b5c53cdb421165e4 golangci-lint-2.0.2-linux-mips64.tar.gz df3ce5f03808dcceaa8b683d1d06e95c885f09b59dc8e15deb840fbe2b3e3299 golangci-lint-2.10.1-linux-mips64.rpm
aa0e75384bb482c865d4dfc95d23ceb25666bf20461b67a832f0eea6670312ec golangci-lint-2.0.2-linux-mips64le.deb 972508dda523067e6e6a1c8e6609d63bc7c4153819c11b947d439235cf17bac2 golangci-lint-2.10.1-linux-mips64.tar.gz
f2a8b500fb69bdea1b01df6267aaa5218fa4a58aeb781c1a20d0d802fe465a52 golangci-lint-2.0.2-linux-mips64le.rpm 1d37f2919e183b5bf8b1777ed8c4b163d3b491d0158355a7999d647655cbbeb6 golangci-lint-2.10.1-linux-mips64le.deb
e66a0c0c9a275f02d27a7caa9576112622306f001d73dfc082cf1ae446fc1242 golangci-lint-2.0.2-linux-mips64le.tar.gz e341d031002cd09a416329ed40f674231051a38544b8f94deb2d1708ce1f4a6f golangci-lint-2.10.1-linux-mips64le.rpm
e85ad51aac6428be2d8a37000d053697371a538a5bcbc1644caa7c5e77f6d0af golangci-lint-2.0.2-linux-ppc64le.deb 393560122b9cb5538df0c357d30eb27b6ee563533fbb9b138c8db4fd264002af golangci-lint-2.10.1-linux-mips64le.tar.gz
906798365eac1944af2a9b9a303e6fd49ec9043307bc681b7a96277f7f8beea5 golangci-lint-2.0.2-linux-ppc64le.rpm 21ca46b6a96442e8957677a3ca059c6b93674a68a01b1c71f4e5df0ea2e96d19 golangci-lint-2.10.1-linux-ppc64le.deb
f7f1a271b0af274d6c9ce000f5dc6e1fb194350c67bcc62494f96f791882ba92 golangci-lint-2.0.2-linux-ppc64le.tar.gz 57fe0cbca0a9bbdf1547c5e8aa7d278e6896b438d72a541bae6bc62c38b43d1e golangci-lint-2.10.1-linux-ppc64le.rpm
eea8bf643a42bf05de9780530db22923e5ab0d588f0e173594dc6518f2a25d2a golangci-lint-2.0.2-linux-riscv64.deb e2883db9fa51584e5e203c64456f29993550a7faadc84e3faccdb48f0669992e golangci-lint-2.10.1-linux-ppc64le.tar.gz
4ff40f9fe2954400836e2a011ba4744d00ffab5068a51368552dfce6aba3b81b golangci-lint-2.0.2-linux-riscv64.rpm aa6da0e98ab0ba3bb7582e112174c349907d5edfeff90a551dca3c6eecf92fc0 golangci-lint-2.10.1-linux-riscv64.deb
531d8f225866674977d630afbf0533eb02f9bec607fb13895f7a2cd7b2e0a648 golangci-lint-2.0.2-linux-riscv64.tar.gz 3c68d76cd884a7aad206223a980b9c20bb9ea74b560fa27ed02baf2389189234 golangci-lint-2.10.1-linux-riscv64.rpm
6f827647046c603f40d97ea5aadc6f48cd0bb5d19f7a3d56500c3b833d2a0342 golangci-lint-2.0.2-linux-s390x.deb 3bca11bfac4197205639cbd4676a5415054e629ac6c12ea10fcbe33ef852d9c3 golangci-lint-2.10.1-linux-riscv64.tar.gz
387a090e9576d19ca86aac738172e58e07c19f2784a13bb387f4f0d75fb9c8d3 golangci-lint-2.0.2-linux-s390x.rpm 0c6aed2ce49db2586adbac72c80d871f06feb1caf4c0763a5ca98fec809a8f0b golangci-lint-2.10.1-linux-s390x.deb
57de1fb7722a9feb2d11ed0a007a93959d05b9db5929a392abc222e30012467e golangci-lint-2.0.2-linux-s390x.tar.gz 16c285adfe1061d69dd8e503be69f87c7202857c6f4add74ac02e3571158fbec golangci-lint-2.10.1-linux-s390x.rpm
ed95e0492ea86bf79eb661f0334474b2a4255093685ff587eccd797c5a54db7e golangci-lint-2.0.2-netbsd-386.tar.gz 21011ad368eb04f024201b832095c6b5f96d0888de194cca5bfe4d9307d6364b golangci-lint-2.10.1-linux-s390x.tar.gz
eab81d729778166415d349a80e568b2f2b3a781745a9be3212a92abb1e732daf golangci-lint-2.0.2-netbsd-amd64.tar.gz 7b5191e77a70485918712e31ed55159956323e4911bab1b67569c9d86e1b75eb golangci-lint-2.10.1-netbsd-386.tar.gz
d20add73f7c2de2c3b01ed4fd7b63ffcf0a6597d5ea228d1699e92339a3cd047 golangci-lint-2.0.2-netbsd-arm64.tar.gz 07801fd38d293ebad10826f8285525a39ea91ce5ddad77d05bfa90bda9c884a9 golangci-lint-2.10.1-netbsd-amd64.tar.gz
4e4f44e6057879cd62424ff1800a767d25a595c0e91d6d48809eea9186b4c739 golangci-lint-2.0.2-netbsd-armv6.tar.gz 7e7219d71c1bf33b98c328c93dc0560706dd896a1c43c44696e5222fc9d7446e golangci-lint-2.10.1-netbsd-arm64.tar.gz
51ec17b16d8743ae4098a0171f04f0ed4d64561e3051b982778b0e6c306a1b03 golangci-lint-2.0.2-netbsd-armv7.tar.gz 92fbc90b9eec0e572269b0f5492a2895c426b086a68372fde49b7e4d4020863e golangci-lint-2.10.1-netbsd-armv6.tar.gz
5482cf27b93fae1765c70ee2a95d4074d038e9dee61bdd61d017ce8893d3a4a8 golangci-lint-2.0.2-source.tar.gz f67b3ae1f47caeefa507a4ebb0c8336958a19011fe48766443212030f75d004b golangci-lint-2.10.1-netbsd-armv7.tar.gz
a35d8fdf3e14079a10880dbbb7586b46faec89be96f086b244b3e565aac80313 golangci-lint-2.0.2-windows-386.zip a40bc091c10cea84eaee1a90b84b65f5e8652113b0a600bb099e4e4d9d7caddb golangci-lint-2.10.1-windows-386.zip
fe4b946cc01366b989001215687003a9c4a7098589921f75e6228d6d8cffc15c golangci-lint-2.0.2-windows-amd64.zip c60c87695e79db8e320f0e5be885059859de52bb5ee5f11be5577828570bc2a3 golangci-lint-2.10.1-windows-amd64.zip
646bd9250ef8c771d85cd22fe8e6f2397ae39599179755e3bbfa9ef97ad44090 golangci-lint-2.0.2-windows-arm64.zip 636ab790c8dcea8034aa34aba6031ca3893d68f7eda000460ab534341fadbab1 golangci-lint-2.10.1-windows-arm64.zip
ce1dc0bad6f8a61d64e6b3779eeb773479c175125d6f686b0e67ef9c8432d16e golangci-lint-2.0.2-windows-armv6.zip
92684a48faabe792b11ac27ca8b25551eff940b0a1e84ad7244e98b4994962db golangci-lint-2.0.2-windows-armv7.zip
# This is the builder on PPA that will build Go itself (inception-y), don't modify! # This is the builder on PPA that will build Go itself (inception-y), don't modify!
# #

View file

@ -31,6 +31,9 @@ Available commands are:
install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables install [ -arch architecture ] [ -cc compiler ] [ packages... ] -- builds packages and executables
test [ -coverage ] [ packages... ] -- runs the tests test [ -coverage ] [ packages... ] -- runs the tests
keeper [ -dlgo ]
keeper-archive [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ]
archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts archive [ -arch architecture ] [ -type zip|tar ] [ -signer key-envvar ] [ -signify key-envvar ] [ -upload dest ] -- archives build artifacts
importkeys -- imports signing keys from env importkeys -- imports signing keys from env
debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package debsrc [ -signer key-id ] [ -upload dest ] -- creates a debian source package
@ -57,6 +60,7 @@ import (
"time" "time"
"github.com/cespare/cp" "github.com/cespare/cp"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/signify" "github.com/ethereum/go-ethereum/crypto/signify"
"github.com/ethereum/go-ethereum/internal/build" "github.com/ethereum/go-ethereum/internal/build"
"github.com/ethereum/go-ethereum/internal/download" "github.com/ethereum/go-ethereum/internal/download"
@ -64,6 +68,11 @@ import (
) )
var ( var (
goModules = []string{
".",
"./cmd/keeper",
}
// Files that end up in the geth*.zip archive. // Files that end up in the geth*.zip archive.
gethArchiveFiles = []string{ gethArchiveFiles = []string{
"COPYING", "COPYING",
@ -80,6 +89,42 @@ var (
executablePath("clef"), executablePath("clef"),
} }
// Keeper build targets with their configurations
keeperTargets = []struct {
Name string
GOOS string
GOARCH string
CC string
Tags string
Env map[string]string
}{
{
Name: "ziren",
GOOS: "linux",
GOARCH: "mipsle",
// enable when cgo works
// CC: "mipsel-linux-gnu-gcc",
Tags: "ziren",
Env: map[string]string{"GOMIPS": "softfloat", "CGO_ENABLED": "0"},
},
{
Name: "wasm-js",
GOOS: "js",
GOARCH: "wasm",
Tags: "example",
},
{
Name: "wasm-wasi",
GOOS: "wasip1",
GOARCH: "wasm",
Tags: "example",
},
{
Name: "example",
Tags: "example",
},
}
// A debian package is created for all executables listed here. // A debian package is created for all executables listed here.
debExecutables = []debExecutable{ debExecutables = []debExecutable{
{ {
@ -123,7 +168,6 @@ var (
"focal", // 20.04, EOL: 04/2030 "focal", // 20.04, EOL: 04/2030
"jammy", // 22.04, EOL: 04/2032 "jammy", // 22.04, EOL: 04/2032
"noble", // 24.04, EOL: 04/2034 "noble", // 24.04, EOL: 04/2034
"oracular", // 24.10, EOL: 07/2025
} }
// This is where the tests should be unpacked. // This is where the tests should be unpacked.
@ -142,7 +186,7 @@ func executablePath(name string) string {
func main() { func main() {
log.SetFlags(log.Lshortfile) log.SetFlags(log.Lshortfile)
if !build.FileExist(filepath.Join("build", "ci.go")) { if !common.FileExist(filepath.Join("build", "ci.go")) {
log.Fatal("this script must be run from the root of the repository") log.Fatal("this script must be run from the root of the repository")
} }
if len(os.Args) < 2 { if len(os.Args) < 2 {
@ -171,6 +215,10 @@ func main() {
doPurge(os.Args[2:]) doPurge(os.Args[2:])
case "sanitycheck": case "sanitycheck":
doSanityCheck() doSanityCheck()
case "keeper":
doInstallKeeper(os.Args[2:])
case "keeper-archive":
doKeeperArchive(os.Args[2:])
default: default:
log.Fatal("unknown command ", os.Args[1]) log.Fatal("unknown command ", os.Args[1])
} }
@ -205,9 +253,6 @@ func doInstall(cmdline []string) {
// Configure the build. // Configure the build.
gobuild := tc.Go("build", buildFlags(env, *staticlink, buildTags)...) gobuild := tc.Go("build", buildFlags(env, *staticlink, buildTags)...)
// We use -trimpath to avoid leaking local paths into the built executables.
gobuild.Args = append(gobuild.Args, "-trimpath")
// Show packages during build. // Show packages during build.
gobuild.Args = append(gobuild.Args, "-v") gobuild.Args = append(gobuild.Args, "-v")
@ -215,7 +260,7 @@ func doInstall(cmdline []string) {
// Default: collect all 'main' packages in cmd/ and build those. // Default: collect all 'main' packages in cmd/ and build those.
packages := flag.Args() packages := flag.Args()
if len(packages) == 0 { if len(packages) == 0 {
packages = build.FindMainPackages("./cmd") packages = build.FindMainPackages(&tc, "./cmd/...")
} }
// Do the build! // Do the build!
@ -227,6 +272,43 @@ func doInstall(cmdline []string) {
} }
} }
// doInstallKeeper builds keeper binaries for all supported targets.
func doInstallKeeper(cmdline []string) {
var dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
flag.CommandLine.Parse(cmdline)
env := build.Env()
// Configure the toolchain.
tc := build.GoToolchain{}
if *dlgo {
csdb := download.MustLoadChecksums("build/checksums.txt")
tc.Root = build.DownloadGo(csdb)
}
for _, target := range keeperTargets {
log.Printf("Building keeper-%s", target.Name)
// Configure the build.
tc.GOARCH = target.GOARCH
tc.GOOS = target.GOOS
tc.CC = target.CC
gobuild := tc.Go("build", buildFlags(env, true, []string{target.Tags})...)
gobuild.Dir = "./cmd/keeper"
gobuild.Args = append(gobuild.Args, "-v")
for key, value := range target.Env {
gobuild.Env = append(gobuild.Env, key+"="+value)
}
outputName := fmt.Sprintf("keeper-%s", target.Name)
args := slices.Clone(gobuild.Args)
args = append(args, "-o", executablePath(outputName))
args = append(args, ".")
build.MustRun(&exec.Cmd{Path: gobuild.Path, Args: args, Env: gobuild.Env})
}
}
// buildFlags returns the go tool flags for building. // buildFlags returns the go tool flags for building.
func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (flags []string) { func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (flags []string) {
var ld []string var ld []string
@ -259,12 +341,18 @@ func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (
} }
ld = append(ld, "-extldflags", "'"+strings.Join(extld, " ")+"'") ld = append(ld, "-extldflags", "'"+strings.Join(extld, " ")+"'")
} }
// TODO(gballet): revisit after the input api has been defined
if runtime.GOARCH == "wasm" {
ld = append(ld, "-gcflags=all=-d=softfloat")
}
if len(ld) > 0 { if len(ld) > 0 {
flags = append(flags, "-ldflags", strings.Join(ld, " ")) flags = append(flags, "-ldflags", strings.Join(ld, " "))
} }
if len(buildTags) > 0 { if len(buildTags) > 0 {
flags = append(flags, "-tags", strings.Join(buildTags, ",")) flags = append(flags, "-tags", strings.Join(buildTags, ","))
} }
// We use -trimpath to avoid leaking local paths into the built executables.
flags = append(flags, "-trimpath")
return flags return flags
} }
@ -282,18 +370,24 @@ func doTest(cmdline []string) {
race = flag.Bool("race", false, "Execute the race detector") race = flag.Bool("race", false, "Execute the race detector")
short = flag.Bool("short", false, "Pass the 'short'-flag to go test") short = flag.Bool("short", false, "Pass the 'short'-flag to go test")
cachedir = flag.String("cachedir", "./build/cache", "directory for caching downloads") cachedir = flag.String("cachedir", "./build/cache", "directory for caching downloads")
threads = flag.Int("p", 1, "Number of CPU threads to use for testing")
) )
flag.CommandLine.Parse(cmdline) flag.CommandLine.Parse(cmdline)
// Get test fixtures. // Load checksums file (needed for both spec tests and dlgo)
csdb := download.MustLoadChecksums("build/checksums.txt") csdb := download.MustLoadChecksums("build/checksums.txt")
downloadSpecTestFixtures(csdb, *cachedir)
// Get test fixtures.
if !*short {
downloadSpecTestFixtures(csdb, *cachedir)
}
// Configure the toolchain. // Configure the toolchain.
tc := build.GoToolchain{GOARCH: *arch, CC: *cc} tc := build.GoToolchain{GOARCH: *arch, CC: *cc}
if *dlgo { if *dlgo {
tc.Root = build.DownloadGo(csdb) tc.Root = build.DownloadGo(csdb)
} }
gotest := tc.Go("test") gotest := tc.Go("test")
// CI needs a bit more time for the statetests (default 45m). // CI needs a bit more time for the statetests (default 45m).
@ -307,7 +401,7 @@ func doTest(cmdline []string) {
// Test a single package at a time. CI builders are slow // Test a single package at a time. CI builders are slow
// and some tests run into timeouts under load. // and some tests run into timeouts under load.
gotest.Args = append(gotest.Args, "-p", "1") gotest.Args = append(gotest.Args, "-p", fmt.Sprintf("%d", *threads))
if *coverage { if *coverage {
gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover") gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover")
} }
@ -321,12 +415,20 @@ func doTest(cmdline []string) {
gotest.Args = append(gotest.Args, "-short") gotest.Args = append(gotest.Args, "-short")
} }
packages := []string{"./..."} packages := flag.CommandLine.Args()
if len(flag.CommandLine.Args()) > 0 { if len(packages) > 0 {
packages = flag.CommandLine.Args() gotest.Args = append(gotest.Args, packages...)
build.MustRun(gotest)
return
}
// No packages specified, run all tests for all modules.
gotest.Args = append(gotest.Args, "./...")
for _, mod := range goModules {
test := *gotest
test.Dir = mod
build.MustRun(&test)
} }
gotest.Args = append(gotest.Args, packages...)
build.MustRun(gotest)
} }
// downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures. // downloadSpecTestFixtures downloads and extracts the execution-spec-tests fixtures.
@ -343,10 +445,6 @@ func downloadSpecTestFixtures(csdb *download.ChecksumDB, cachedir string) string
return filepath.Join(cachedir, base) return filepath.Join(cachedir, base)
} }
// doCheckTidy assets that the Go modules files are tidied already.
func doCheckTidy() {
}
// doCheckGenerate ensures that re-generating generated files does not cause // doCheckGenerate ensures that re-generating generated files does not cause
// any mutations in the source file tree. // any mutations in the source file tree.
func doCheckGenerate() { func doCheckGenerate() {
@ -354,40 +452,51 @@ func doCheckGenerate() {
cachedir = flag.String("cachedir", "./build/cache", "directory for caching binaries.") cachedir = flag.String("cachedir", "./build/cache", "directory for caching binaries.")
tc = new(build.GoToolchain) tc = new(build.GoToolchain)
) )
// Compute the origin hashes of all the files
var hashes map[string][32]byte
var err error
hashes, err = build.HashFolder(".", []string{"tests/testdata", "build/cache", ".git"})
if err != nil {
log.Fatal("Error computing hashes", "err", err)
}
// Run any go generate steps we might be missing // Run any go generate steps we might be missing
var ( var (
protocPath = downloadProtoc(*cachedir) protocPath = downloadProtoc(*cachedir)
protocGenGoPath = downloadProtocGenGo(*cachedir) protocGenGoPath = downloadProtocGenGo(*cachedir)
) )
c := tc.Go("generate", "./...")
pathList := []string{filepath.Join(protocPath, "bin"), protocGenGoPath, os.Getenv("PATH")} pathList := []string{filepath.Join(protocPath, "bin"), protocGenGoPath, os.Getenv("PATH")}
c.Env = append(c.Env, "PATH="+strings.Join(pathList, string(os.PathListSeparator)))
build.MustRun(c)
// Check if generate file hashes have changed excludes := []string{"tests/testdata", "build/cache", ".git"}
generated, err := build.HashFolder(".", []string{"tests/testdata", "build/cache", ".git"}) for i := range excludes {
if err != nil { excludes[i] = filepath.FromSlash(excludes[i])
log.Fatalf("Error re-computing hashes: %v", err)
} }
updates := build.DiffHashes(hashes, generated)
for _, file := range updates { for _, mod := range goModules {
log.Printf("File changed: %s", file) // Compute the origin hashes of all the files
} hashes, err := build.HashFolder(mod, excludes)
if len(updates) != 0 { if err != nil {
log.Fatal("One or more generated files were updated by running 'go generate ./...'") log.Fatal("Error computing hashes", "err", err)
}
c := tc.Go("generate", "./...")
c.Env = append(c.Env, "PATH="+strings.Join(pathList, string(os.PathListSeparator)))
c.Dir = mod
build.MustRun(c)
// Check if generate file hashes have changed
generated, err := build.HashFolder(mod, excludes)
if err != nil {
log.Fatalf("Error re-computing hashes: %v", err)
}
updates := build.DiffHashes(hashes, generated)
for _, file := range updates {
log.Printf("File changed: %s", file)
}
if len(updates) != 0 {
log.Fatal("One or more generated files were updated by running 'go generate ./...'")
}
} }
fmt.Println("No stale files detected.") fmt.Println("No stale files detected.")
// Run go mod tidy check. // Run go mod tidy check.
build.MustRun(tc.Go("mod", "tidy", "-diff")) for _, mod := range goModules {
tidy := tc.Go("mod", "tidy", "-diff")
tidy.Dir = mod
build.MustRun(tidy)
}
fmt.Println("No untidy module files detected.") fmt.Println("No untidy module files detected.")
} }
@ -427,14 +536,30 @@ func doLint(cmdline []string) {
cachedir = flag.String("cachedir", "./build/cache", "directory for caching golangci-lint binary.") cachedir = flag.String("cachedir", "./build/cache", "directory for caching golangci-lint binary.")
) )
flag.CommandLine.Parse(cmdline) flag.CommandLine.Parse(cmdline)
packages := []string{"./..."}
if len(flag.CommandLine.Args()) > 0 {
packages = flag.CommandLine.Args()
}
linter := downloadLinter(*cachedir) linter := downloadLinter(*cachedir)
lflags := []string{"run", "--config", ".golangci.yml"} linter, err := filepath.Abs(linter)
build.MustRunCommandWithOutput(linter, append(lflags, packages...)...) if err != nil {
log.Fatal(err)
}
config, err := filepath.Abs(".golangci.yml")
if err != nil {
log.Fatal(err)
}
lflags := []string{"run", "--config", config}
packages := flag.CommandLine.Args()
if len(packages) > 0 {
build.MustRunCommandWithOutput(linter, append(lflags, packages...)...)
} else {
// Run for all modules in workspace.
for _, mod := range goModules {
args := append(lflags, "./...")
lintcmd := exec.Command(linter, args...)
lintcmd.Dir = mod
build.MustRunWithOutput(lintcmd)
}
}
fmt.Println("You have achieved perfection.") fmt.Println("You have achieved perfection.")
} }
@ -590,6 +715,32 @@ func doArchive(cmdline []string) {
} }
} }
func doKeeperArchive(cmdline []string) {
var (
signer = flag.String("signer", "", `Environment variable holding the signing key (e.g. LINUX_SIGNING_KEY)`)
signify = flag.String("signify", "", `Environment variable holding the signify key (e.g. LINUX_SIGNIFY_KEY)`)
upload = flag.String("upload", "", `Destination to upload the archives (usually "gethstore/builds")`)
)
flag.CommandLine.Parse(cmdline)
var (
env = build.Env()
vsn = version.Archive(env.Commit)
keeper = "keeper-" + vsn + ".tar.gz"
)
maybeSkipArchive(env)
files := []string{"COPYING"}
for _, target := range keeperTargets {
files = append(files, executablePath(fmt.Sprintf("keeper-%s", target.Name)))
}
if err := build.WriteArchive(keeper, files); err != nil {
log.Fatal(err)
}
if err := archiveUpload(keeper, *upload, *signer, *signify); err != nil {
log.Fatal(err)
}
}
func archiveBasename(arch string, archiveVersion string) string { func archiveBasename(arch string, archiveVersion string) string {
platform := runtime.GOOS + "-" + arch platform := runtime.GOOS + "-" + arch
if arch == "arm" { if arch == "arm" {
@ -862,7 +1013,7 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) {
var idfile string var idfile string
if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 { if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 {
idfile = filepath.Join(workdir, "sshkey") idfile = filepath.Join(workdir, "sshkey")
if !build.FileExist(idfile) { if !common.FileExist(idfile) {
os.WriteFile(idfile, sshkey, 0600) os.WriteFile(idfile, sshkey, 0600)
} }
} }

View file

@ -1,32 +0,0 @@
machine:
services:
- docker
dependencies:
cache_directories:
- "~/.ethash" # Cache the ethash DAG generated by hive for consecutive builds
- "~/.docker" # Cache all docker images manually to avoid lengthy rebuilds
override:
# Restore all previously cached docker images
- mkdir -p ~/.docker
- for img in `ls ~/.docker`; do docker load -i ~/.docker/$img; done
# Pull in and hive, restore cached ethash DAGs and do a dry run
- go get -u github.com/karalabe/hive
- (cd ~/.go_workspace/src/github.com/karalabe/hive && mkdir -p workspace/ethash/ ~/.ethash)
- (cd ~/.go_workspace/src/github.com/karalabe/hive && cp -r ~/.ethash/. workspace/ethash/)
- (cd ~/.go_workspace/src/github.com/karalabe/hive && hive --docker-noshell --client=NONE --test=. --sim=. --loglevel=6)
# Cache all the docker images and the ethash DAGs
- for img in `docker images | grep -v "^<none>" | tail -n +2 | awk '{print $1}'`; do docker save $img > ~/.docker/`echo $img | tr '/' ':'`.tar; done
- cp -r ~/.go_workspace/src/github.com/karalabe/hive/workspace/ethash/. ~/.ethash
test:
override:
# Build Geth and move into a known folder
- make geth
- cp ./build/bin/geth $HOME/geth
# Run hive and move all generated logs into the public artifacts folder
- (cd ~/.go_workspace/src/github.com/karalabe/hive && hive --docker-noshell --client=go-ethereum:local --override=$HOME/geth --test=. --sim=.)
- cp -r ~/.go_workspace/src/github.com/karalabe/hive/workspace/logs/* $CIRCLE_ARTIFACTS

View file

@ -65,7 +65,7 @@ The API-method `account_signGnosisSafeTx` was added. This method takes two param
``` ```
Not all fields are required, though. This method is really just a UX helper, which massages the Not all fields are required, though. This method is really just a UX helper, which massages the
input to conform to the `EIP-712` [specification](https://docs.gnosis.io/safe/docs/contracts_tx_execution/#transaction-hash) input to conform to the `EIP-712` [specification](https://docs.safe.global/core-api/transaction-service-reference/gnosis)
for the Gnosis Safe, and making the output be directly importable to by a relay service. for the Gnosis Safe, and making the output be directly importable to by a relay service.

View file

@ -121,7 +121,7 @@ with our test chain. The chain files are located in `./cmd/devp2p/internal/ethte
--nat=none \ --nat=none \
--networkid 3503995874084926 \ --networkid 3503995874084926 \
--verbosity 5 \ --verbosity 5 \
--authrpc.jwtsecret 0x7365637265747365637265747365637265747365637265747365637265747365 --authrpc.jwtsecret jwt.secret
Note that the tests also require access to the engine API. Note that the tests also require access to the engine API.
The test suite can now be executed using the devp2p tool. The test suite can now be executed using the devp2p tool.
@ -130,7 +130,7 @@ The test suite can now be executed using the devp2p tool.
--chain internal/ethtest/testdata \ --chain internal/ethtest/testdata \
--node enode://.... \ --node enode://.... \
--engineapi http://127.0.0.1:8551 \ --engineapi http://127.0.0.1:8551 \
--jwtsecret 0x7365637265747365637265747365637265747365637265747365637265747365 --jwtsecret $(cat jwt.secret)
Repeat the above process (re-initialising the node) in order to run the Eth Protocol test suite again. Repeat the above process (re-initialising the node) in order to run the Eth Protocol test suite again.

View file

@ -129,7 +129,7 @@ func (c *Conn) Write(proto Proto, code uint64, msg any) error {
return err return err
} }
var errDisc error = fmt.Errorf("disconnect") var errDisc error = errors.New("disconnect")
// ReadEth reads an Eth sub-protocol wire message. // ReadEth reads an Eth sub-protocol wire message.
func (c *Conn) ReadEth() (any, error) { func (c *Conn) ReadEth() (any, error) {

View file

@ -1,9 +1,10 @@
#!/bin/sh #!/bin/sh
hivechain generate \ hivechain generate \
--pos \
--fork-interval 6 \ --fork-interval 6 \
--tx-interval 1 \ --tx-interval 1 \
--length 500 \ --length 600 \
--outdir testdata \ --outdir testdata \
--lastfork cancun \ --lastfork prague \
--outputs accounts,genesis,chain,headstate,txinfo,headblock,headfcu,newpayload,forkenv --outputs accounts,genesis,chain,headstate,txinfo,headblock,headfcu,newpayload,forkenv

View file

@ -30,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/protocols/snap" "github.com/ethereum/go-ethereum/eth/protocols/snap"
"github.com/ethereum/go-ethereum/internal/utesting" "github.com/ethereum/go-ethereum/internal/utesting"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie/trienode" "github.com/ethereum/go-ethereum/trie/trienode"
) )
@ -86,9 +87,9 @@ func (s *Suite) TestSnapGetAccountRange(t *utesting.T) {
root: root, root: root,
startingHash: zero, startingHash: zero,
limitHash: ffHash, limitHash: ffHash,
expAccounts: 86, expAccounts: 67,
expFirst: firstKey, expFirst: firstKey,
expLast: common.HexToHash("0x445cb5c1278fdce2f9cbdb681bdd76c52f8e50e41dbd9e220242a69ba99ac099"), expLast: common.HexToHash("0x622e662246601dd04f996289ce8b85e86db7bb15bb17f86487ec9d543ddb6f9a"),
desc: "In this test, we request the entire state range, but limit the response to 4000 bytes.", desc: "In this test, we request the entire state range, but limit the response to 4000 bytes.",
}, },
{ {
@ -96,9 +97,9 @@ func (s *Suite) TestSnapGetAccountRange(t *utesting.T) {
root: root, root: root,
startingHash: zero, startingHash: zero,
limitHash: ffHash, limitHash: ffHash,
expAccounts: 65, expAccounts: 49,
expFirst: firstKey, expFirst: firstKey,
expLast: common.HexToHash("0x2e6fe1362b3e388184fd7bf08e99e74170b26361624ffd1c5f646da7067b58b6"), expLast: common.HexToHash("0x445cb5c1278fdce2f9cbdb681bdd76c52f8e50e41dbd9e220242a69ba99ac099"),
desc: "In this test, we request the entire state range, but limit the response to 3000 bytes.", desc: "In this test, we request the entire state range, but limit the response to 3000 bytes.",
}, },
{ {
@ -106,9 +107,9 @@ func (s *Suite) TestSnapGetAccountRange(t *utesting.T) {
root: root, root: root,
startingHash: zero, startingHash: zero,
limitHash: ffHash, limitHash: ffHash,
expAccounts: 44, expAccounts: 34,
expFirst: firstKey, expFirst: firstKey,
expLast: common.HexToHash("0x1c3f74249a4892081ba0634a819aec9ed25f34c7653f5719b9098487e65ab595"), expLast: common.HexToHash("0x2ef46ebd2073cecde499c2e8df028ad79a26d57bfaa812c4c6f7eb4c9617b913"),
desc: "In this test, we request the entire state range, but limit the response to 2000 bytes.", desc: "In this test, we request the entire state range, but limit the response to 2000 bytes.",
}, },
{ {
@ -177,9 +178,9 @@ The server should return the first available account.`,
root: root, root: root,
startingHash: firstKey, startingHash: firstKey,
limitHash: ffHash, limitHash: ffHash,
expAccounts: 86, expAccounts: 67,
expFirst: firstKey, expFirst: firstKey,
expLast: common.HexToHash("0x445cb5c1278fdce2f9cbdb681bdd76c52f8e50e41dbd9e220242a69ba99ac099"), expLast: common.HexToHash("0x622e662246601dd04f996289ce8b85e86db7bb15bb17f86487ec9d543ddb6f9a"),
desc: `In this test, startingHash is exactly the first available account key. desc: `In this test, startingHash is exactly the first available account key.
The server should return the first available account of the state as the first item.`, The server should return the first available account of the state as the first item.`,
}, },
@ -188,9 +189,9 @@ The server should return the first available account of the state as the first i
root: root, root: root,
startingHash: hashAdd(firstKey, 1), startingHash: hashAdd(firstKey, 1),
limitHash: ffHash, limitHash: ffHash,
expAccounts: 86, expAccounts: 67,
expFirst: secondKey, expFirst: secondKey,
expLast: common.HexToHash("0x4615e5f5df5b25349a00ad313c6cd0436b6c08ee5826e33a018661997f85ebaa"), expLast: common.HexToHash("0x66192e4c757fba1cdc776e6737008f42d50370d3cd801db3624274283bf7cd63"),
desc: `In this test, startingHash is after the first available key. desc: `In this test, startingHash is after the first available key.
The server should return the second account of the state as the first item.`, The server should return the second account of the state as the first item.`,
}, },
@ -226,9 +227,9 @@ server to return no data because genesis is older than 127 blocks.`,
root: s.chain.RootAt(int(s.chain.Head().Number().Uint64()) - 127), root: s.chain.RootAt(int(s.chain.Head().Number().Uint64()) - 127),
startingHash: zero, startingHash: zero,
limitHash: ffHash, limitHash: ffHash,
expAccounts: 84, expAccounts: 66,
expFirst: firstKey, expFirst: firstKey,
expLast: common.HexToHash("0x580aa878e2f92d113a12c0a3ce3c21972b03dbe80786858d49a72097e2c491a3"), expLast: common.HexToHash("0x729953a43ed6c913df957172680a17e5735143ad767bda8f58ac84ec62fbec5e"),
desc: `This test requests data at a state root that is 127 blocks old. desc: `This test requests data at a state root that is 127 blocks old.
We expect the server to have this state available.`, We expect the server to have this state available.`,
}, },
@ -657,8 +658,8 @@ The server should reject the request.`,
// It's a bit unfortunate these are hard-coded, but the result depends on // It's a bit unfortunate these are hard-coded, but the result depends on
// a lot of aspects of the state trie and can't be guessed in a simple // a lot of aspects of the state trie and can't be guessed in a simple
// way. So you'll have to update this when the test chain is changed. // way. So you'll have to update this when the test chain is changed.
common.HexToHash("0x3e963a69401a70224cbfb8c0cc2249b019041a538675d71ccf80c9328d114e2e"), common.HexToHash("0x5bdc0d6057b35642a16d27223ea5454e5a17a400e28f7328971a5f2a87773b76"),
common.HexToHash("0xd0670d09cdfbf3c6320eb3e92c47c57baa6c226551a2d488c05581091e6b1689"), common.HexToHash("0x0a76c9812ca90ffed8ee4d191e683f93386b6e50cfe3679c0760d27510aa7fc5"),
empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty,
empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty,
empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty,
@ -678,8 +679,8 @@ The server should reject the request.`,
// be updated when the test chain is changed. // be updated when the test chain is changed.
expHashes: []common.Hash{ expHashes: []common.Hash{
empty, empty,
common.HexToHash("0xd0670d09cdfbf3c6320eb3e92c47c57baa6c226551a2d488c05581091e6b1689"), common.HexToHash("0x0a76c9812ca90ffed8ee4d191e683f93386b6e50cfe3679c0760d27510aa7fc5"),
common.HexToHash("0x3e963a69401a70224cbfb8c0cc2249b019041a538675d71ccf80c9328d114e2e"), common.HexToHash("0x5bdc0d6057b35642a16d27223ea5454e5a17a400e28f7328971a5f2a87773b76"),
}, },
}, },
@ -937,10 +938,14 @@ func (s *Suite) snapGetTrieNodes(t *utesting.T, tc *trieNodesTest) error {
} }
// write0 request // write0 request
paths, err := rlp.EncodeToRawList(tc.paths)
if err != nil {
panic(err)
}
req := &snap.GetTrieNodesPacket{ req := &snap.GetTrieNodesPacket{
ID: uint64(rand.Int63()), ID: uint64(rand.Int63()),
Root: tc.root, Root: tc.root,
Paths: tc.paths, Paths: paths,
Bytes: tc.nBytes, Bytes: tc.nBytes,
} }
msg, err := conn.snapRequest(snap.GetTrieNodesMsg, req) msg, err := conn.snapRequest(snap.GetTrieNodesMsg, req)

View file

@ -19,6 +19,7 @@ package ethtest
import ( import (
"context" "context"
"crypto/rand" "crypto/rand"
"errors"
"fmt" "fmt"
"reflect" "reflect"
"sync" "sync"
@ -33,6 +34,7 @@ import (
"github.com/ethereum/go-ethereum/internal/utesting" "github.com/ethereum/go-ethereum/internal/utesting"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/rlp"
"github.com/holiman/uint256" "github.com/holiman/uint256"
) )
@ -150,7 +152,11 @@ func (s *Suite) TestGetBlockHeaders(t *utesting.T) {
if err != nil { if err != nil {
t.Fatalf("failed to get headers for given request: %v", err) t.Fatalf("failed to get headers for given request: %v", err)
} }
if !headersMatch(expected, headers.BlockHeadersRequest) { received, err := headers.List.Items()
if err != nil {
t.Fatalf("invalid headers received: %v", err)
}
if !headersMatch(expected, received) {
t.Fatalf("header mismatch: \nexpected %v \ngot %v", expected, headers) t.Fatalf("header mismatch: \nexpected %v \ngot %v", expected, headers)
} }
} }
@ -195,6 +201,7 @@ to check if the node disconnects after receiving multiple invalid requests.`)
func (s *Suite) TestSimultaneousRequests(t *utesting.T) { func (s *Suite) TestSimultaneousRequests(t *utesting.T) {
t.Log(`This test requests blocks headers from the node, performing two requests t.Log(`This test requests blocks headers from the node, performing two requests
concurrently, with different request IDs.`) concurrently, with different request IDs.`)
conn, err := s.dialAndPeer(nil) conn, err := s.dialAndPeer(nil)
if err != nil { if err != nil {
t.Fatalf("peering failed: %v", err) t.Fatalf("peering failed: %v", err)
@ -234,37 +241,30 @@ concurrently, with different request IDs.`)
} }
// Wait for responses. // Wait for responses.
headers1 := new(eth.BlockHeadersPacket) // Note they can arrive in either order.
if err := conn.ReadMsg(ethProto, eth.BlockHeadersMsg, &headers1); err != nil { resp, err := collectHeaderResponses(conn, 2, func(msg *eth.BlockHeadersPacket) uint64 {
t.Fatalf("error reading block headers msg: %v", err) if msg.RequestId != 111 && msg.RequestId != 222 {
} t.Fatalf("response with unknown request ID: %v", msg.RequestId)
if got, want := headers1.RequestId, req1.RequestId; got != want { }
t.Fatalf("unexpected request id in response: got %d, want %d", got, want) return msg.RequestId
} })
headers2 := new(eth.BlockHeadersPacket) if err != nil {
if err := conn.ReadMsg(ethProto, eth.BlockHeadersMsg, &headers2); err != nil { t.Fatal(err)
t.Fatalf("error reading block headers msg: %v", err)
}
if got, want := headers2.RequestId, req2.RequestId; got != want {
t.Fatalf("unexpected request id in response: got %d, want %d", got, want)
} }
// Check received headers for accuracy. // Check if headers match.
if expected, err := s.chain.GetHeaders(req1); err != nil { if err := s.checkHeadersAgainstChain(req1, resp[111]); err != nil {
t.Fatalf("failed to get expected headers for request 1: %v", err) t.Fatal(err)
} else if !headersMatch(expected, headers1.BlockHeadersRequest) {
t.Fatalf("header mismatch: \nexpected %v \ngot %v", expected, headers1)
} }
if expected, err := s.chain.GetHeaders(req2); err != nil { if err := s.checkHeadersAgainstChain(req2, resp[222]); err != nil {
t.Fatalf("failed to get expected headers for request 2: %v", err) t.Fatal(err)
} else if !headersMatch(expected, headers2.BlockHeadersRequest) {
t.Fatalf("header mismatch: \nexpected %v \ngot %v", expected, headers2)
} }
} }
func (s *Suite) TestSameRequestID(t *utesting.T) { func (s *Suite) TestSameRequestID(t *utesting.T) {
t.Log(`This test requests block headers, performing two concurrent requests with the t.Log(`This test requests block headers, performing two concurrent requests with the
same request ID. The node should handle the request by responding to both requests.`) same request ID. The node should handle the request by responding to both requests.`)
conn, err := s.dialAndPeer(nil) conn, err := s.dialAndPeer(nil)
if err != nil { if err != nil {
t.Fatalf("peering failed: %v", err) t.Fatalf("peering failed: %v", err)
@ -288,7 +288,7 @@ same request ID. The node should handle the request by responding to both reques
Origin: eth.HashOrNumber{ Origin: eth.HashOrNumber{
Number: 33, Number: 33,
}, },
Amount: 2, Amount: 3,
}, },
} }
@ -300,35 +300,61 @@ same request ID. The node should handle the request by responding to both reques
t.Fatalf("failed to write to connection: %v", err) t.Fatalf("failed to write to connection: %v", err)
} }
// Wait for the responses. // Wait for the responses. They can arrive in either order, and we can't tell them
headers1 := new(eth.BlockHeadersPacket) // apart by their request ID, so use the number of headers instead.
if err := conn.ReadMsg(ethProto, eth.BlockHeadersMsg, &headers1); err != nil { resp, err := collectHeaderResponses(conn, 2, func(msg *eth.BlockHeadersPacket) uint64 {
t.Fatalf("error reading from connection: %v", err) id := uint64(msg.List.Len())
} if id != 2 && id != 3 {
if got, want := headers1.RequestId, request1.RequestId; got != want { t.Fatalf("invalid number of headers in response: %d", id)
t.Fatalf("unexpected request id: got %d, want %d", got, want) }
} return id
headers2 := new(eth.BlockHeadersPacket) })
if err := conn.ReadMsg(ethProto, eth.BlockHeadersMsg, &headers2); err != nil { if err != nil {
t.Fatalf("error reading from connection: %v", err) t.Fatal(err)
}
if got, want := headers2.RequestId, request2.RequestId; got != want {
t.Fatalf("unexpected request id: got %d, want %d", got, want)
} }
// Check if headers match. // Check if headers match.
if expected, err := s.chain.GetHeaders(request1); err != nil { if err := s.checkHeadersAgainstChain(request1, resp[2]); err != nil {
t.Fatalf("failed to get expected block headers: %v", err) t.Fatal(err)
} else if !headersMatch(expected, headers1.BlockHeadersRequest) {
t.Fatalf("header mismatch: \nexpected %v \ngot %v", expected, headers1)
} }
if expected, err := s.chain.GetHeaders(request2); err != nil { if err := s.checkHeadersAgainstChain(request2, resp[3]); err != nil {
t.Fatalf("failed to get expected block headers: %v", err) t.Fatal(err)
} else if !headersMatch(expected, headers2.BlockHeadersRequest) {
t.Fatalf("header mismatch: \nexpected %v \ngot %v", expected, headers2)
} }
} }
func (s *Suite) checkHeadersAgainstChain(req *eth.GetBlockHeadersPacket, resp *eth.BlockHeadersPacket) error {
received2, err := resp.List.Items()
if err != nil {
return fmt.Errorf("invalid headers in response with request ID %v (%d items): %v", resp.RequestId, resp.List.Len(), err)
}
if expected, err := s.chain.GetHeaders(req); err != nil {
return fmt.Errorf("test chain failed to get expected headers for request: %v", err)
} else if !headersMatch(expected, received2) {
return fmt.Errorf("header mismatch for request ID %v (%d items): \nexpected %v \ngot %v", resp.RequestId, resp.List.Len(), expected, resp)
}
return nil
}
// collectResponses waits for n messages of type T on the given connection.
// The messsages are collected according to the 'identity' function.
//
// This function is written in a generic way to handle
func collectHeaderResponses(conn *Conn, n int, identity func(*eth.BlockHeadersPacket) uint64) (map[uint64]*eth.BlockHeadersPacket, error) {
resp := make(map[uint64]*eth.BlockHeadersPacket, n)
for range n {
r := new(eth.BlockHeadersPacket)
if err := conn.ReadMsg(ethProto, eth.BlockHeadersMsg, r); err != nil {
return resp, fmt.Errorf("read error: %v", err)
}
id := identity(r)
if resp[id] != nil {
return resp, fmt.Errorf("duplicate response %v", r)
}
resp[id] = r
}
return resp, nil
}
func (s *Suite) TestZeroRequestID(t *utesting.T) { func (s *Suite) TestZeroRequestID(t *utesting.T) {
t.Log(`This test sends a GetBlockHeaders message with a request-id of zero, t.Log(`This test sends a GetBlockHeaders message with a request-id of zero,
and expects a response.`) and expects a response.`)
@ -355,10 +381,8 @@ and expects a response.`)
if got, want := headers.RequestId, req.RequestId; got != want { if got, want := headers.RequestId, req.RequestId; got != want {
t.Fatalf("unexpected request id") t.Fatalf("unexpected request id")
} }
if expected, err := s.chain.GetHeaders(req); err != nil { if err := s.checkHeadersAgainstChain(req, headers); err != nil {
t.Fatalf("failed to get expected block headers: %v", err) t.Fatal(err)
} else if !headersMatch(expected, headers.BlockHeadersRequest) {
t.Fatalf("header mismatch: \nexpected %v \ngot %v", expected, headers)
} }
} }
@ -389,9 +413,8 @@ func (s *Suite) TestGetBlockBodies(t *utesting.T) {
if got, want := resp.RequestId, req.RequestId; got != want { if got, want := resp.RequestId, req.RequestId; got != want {
t.Fatalf("unexpected request id in respond", got, want) t.Fatalf("unexpected request id in respond", got, want)
} }
bodies := resp.BlockBodiesResponse if resp.List.Len() != len(req.GetBlockBodiesRequest) {
if len(bodies) != len(req.GetBlockBodiesRequest) { t.Fatalf("wrong bodies in response: expected %d bodies, got %d", len(req.GetBlockBodiesRequest), resp.List.Len())
t.Fatalf("wrong bodies in response: expected %d bodies, got %d", len(req.GetBlockBodiesRequest), len(bodies))
} }
} }
@ -415,7 +438,7 @@ func (s *Suite) TestGetReceipts(t *utesting.T) {
} }
} }
// Create block bodies request. // Create receipts request.
req := &eth.GetReceiptsPacket{ req := &eth.GetReceiptsPacket{
RequestId: 66, RequestId: 66,
GetReceiptsRequest: (eth.GetReceiptsRequest)(hashes), GetReceiptsRequest: (eth.GetReceiptsRequest)(hashes),
@ -431,8 +454,8 @@ func (s *Suite) TestGetReceipts(t *utesting.T) {
if got, want := resp.RequestId, req.RequestId; got != want { if got, want := resp.RequestId, req.RequestId; got != want {
t.Fatalf("unexpected request id in respond", got, want) t.Fatalf("unexpected request id in respond", got, want)
} }
if len(resp.List) != len(req.GetReceiptsRequest) { if resp.List.Len() != len(req.GetReceiptsRequest) {
t.Fatalf("wrong bodies in response: expected %d bodies, got %d", len(req.GetReceiptsRequest), len(resp.List)) t.Fatalf("wrong receipts in response: expected %d receipts, got %d", len(req.GetReceiptsRequest), resp.List.Len())
} }
} }
@ -786,7 +809,11 @@ on another peer connection using GetPooledTransactions.`)
if got, want := msg.RequestId, req.RequestId; got != want { if got, want := msg.RequestId, req.RequestId; got != want {
t.Fatalf("unexpected request id in response: got %d, want %d", got, want) t.Fatalf("unexpected request id in response: got %d, want %d", got, want)
} }
for _, got := range msg.PooledTransactionsResponse { responseTxs, err := msg.List.Items()
if err != nil {
t.Fatalf("invalid transactions in response: %v", err)
}
for _, got := range responseTxs {
if _, exists := set[got.Hash()]; !exists { if _, exists := set[got.Hash()]; !exists {
t.Fatalf("unexpected tx received: %v", got.Hash()) t.Fatalf("unexpected tx received: %v", got.Hash())
} }
@ -879,18 +906,14 @@ func makeSidecar(data ...byte) *types.BlobTxSidecar {
commitments = append(commitments, c) commitments = append(commitments, c)
proofs = append(proofs, p) proofs = append(proofs, p)
} }
return &types.BlobTxSidecar{ return types.NewBlobTxSidecar(types.BlobSidecarVersion0, blobs, commitments, proofs)
Blobs: blobs,
Commitments: commitments,
Proofs: proofs,
}
} }
func (s *Suite) makeBlobTxs(count, blobs int, discriminator byte) (txs types.Transactions) { func (s *Suite) makeBlobTxs(count, blobs int, discriminator byte) (txs types.Transactions) {
from, nonce := s.chain.GetSender(5) from, nonce := s.chain.GetSender(5)
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
// Make blob data, max of 2 blobs per tx. // Make blob data, max of 2 blobs per tx.
blobdata := make([]byte, blobs%3) blobdata := make([]byte, min(blobs, 2))
for i := range blobdata { for i := range blobdata {
blobdata[i] = discriminator blobdata[i] = discriminator
blobs -= 1 blobs -= 1
@ -962,7 +985,9 @@ func (s *Suite) TestBlobViolations(t *utesting.T) {
if err := conn.ReadMsg(ethProto, eth.GetPooledTransactionsMsg, req); err != nil { if err := conn.ReadMsg(ethProto, eth.GetPooledTransactionsMsg, req); err != nil {
t.Fatalf("reading pooled tx request failed: %v", err) t.Fatalf("reading pooled tx request failed: %v", err)
} }
resp := eth.PooledTransactionsPacket{RequestId: req.RequestId, PooledTransactionsResponse: test.resp}
encTxs, _ := rlp.EncodeToRawList(test.resp)
resp := eth.PooledTransactionsPacket{RequestId: req.RequestId, List: encTxs}
if err := conn.Write(ethProto, eth.PooledTransactionsMsg, resp); err != nil { if err := conn.Write(ethProto, eth.PooledTransactionsMsg, resp); err != nil {
t.Fatalf("writing pooled tx response failed: %v", err) t.Fatalf("writing pooled tx response failed: %v", err)
} }
@ -988,14 +1013,10 @@ func (s *Suite) TestBlobViolations(t *utesting.T) {
// data has been modified to produce a different commitment hash. // data has been modified to produce a different commitment hash.
func mangleSidecar(tx *types.Transaction) *types.Transaction { func mangleSidecar(tx *types.Transaction) *types.Transaction {
sidecar := tx.BlobTxSidecar() sidecar := tx.BlobTxSidecar()
copy := types.BlobTxSidecar{ cpy := sidecar.Copy()
Blobs: append([]kzg4844.Blob{}, sidecar.Blobs...),
Commitments: append([]kzg4844.Commitment{}, sidecar.Commitments...),
Proofs: append([]kzg4844.Proof{}, sidecar.Proofs...),
}
// zero the first commitment to alter the sidecar hash // zero the first commitment to alter the sidecar hash
copy.Commitments[0] = kzg4844.Commitment{} cpy.Commitments[0] = kzg4844.Commitment{}
return tx.WithBlobTxSidecar(&copy) return tx.WithBlobTxSidecar(cpy)
} }
func (s *Suite) TestBlobTxWithoutSidecar(t *utesting.T) { func (s *Suite) TestBlobTxWithoutSidecar(t *utesting.T) {
@ -1094,13 +1115,14 @@ func (s *Suite) testBadBlobTx(t *utesting.T, tx *types.Transaction, badTx *types
// the good peer is connected, and has announced the tx. // the good peer is connected, and has announced the tx.
// proceed to send the incorrect one from the bad peer. // proceed to send the incorrect one from the bad peer.
resp := eth.PooledTransactionsPacket{RequestId: req.RequestId, PooledTransactionsResponse: eth.PooledTransactionsResponse(types.Transactions{badTx})} encTxs, _ := rlp.EncodeToRawList([]*types.Transaction{badTx})
resp := eth.PooledTransactionsPacket{RequestId: req.RequestId, List: encTxs}
if err := conn.Write(ethProto, eth.PooledTransactionsMsg, resp); err != nil { if err := conn.Write(ethProto, eth.PooledTransactionsMsg, resp); err != nil {
errc <- fmt.Errorf("writing pooled tx response failed: %v", err) errc <- fmt.Errorf("writing pooled tx response failed: %v", err)
return return
} }
if !readUntilDisconnect(conn) { if !readUntilDisconnect(conn) {
errc <- fmt.Errorf("expected bad peer to be disconnected") errc <- errors.New("expected bad peer to be disconnected")
return return
} }
stage3.Done() stage3.Done()
@ -1140,24 +1162,28 @@ func (s *Suite) testBadBlobTx(t *utesting.T, tx *types.Transaction, badTx *types
// transmit the same tx but with correct sidecar from the good peer. // transmit the same tx but with correct sidecar from the good peer.
var req *eth.GetPooledTransactionsPacket var req *eth.GetPooledTransactionsPacket
req, err = readUntil[eth.GetPooledTransactionsPacket](context.Background(), conn) ctx, cancel := context.WithTimeout(context.Background(), 12*time.Second)
defer cancel()
req, err = readUntil[eth.GetPooledTransactionsPacket](ctx, conn)
if err != nil { if err != nil {
errc <- fmt.Errorf("reading pooled tx request failed: %v", err) errc <- fmt.Errorf("reading pooled tx request failed: %v", err)
return return
} }
if req.GetPooledTransactionsRequest[0] != tx.Hash() { if req.GetPooledTransactionsRequest[0] != tx.Hash() {
errc <- fmt.Errorf("requested unknown tx hash") errc <- errors.New("requested unknown tx hash")
return return
} }
resp := eth.PooledTransactionsPacket{RequestId: req.RequestId, PooledTransactionsResponse: eth.PooledTransactionsResponse(types.Transactions{tx})} encTxs, _ := rlp.EncodeToRawList([]*types.Transaction{tx})
resp := eth.PooledTransactionsPacket{RequestId: req.RequestId, List: encTxs}
if err := conn.Write(ethProto, eth.PooledTransactionsMsg, resp); err != nil { if err := conn.Write(ethProto, eth.PooledTransactionsMsg, resp); err != nil {
errc <- fmt.Errorf("writing pooled tx response failed: %v", err) errc <- fmt.Errorf("writing pooled tx response failed: %v", err)
return return
} }
if readUntilDisconnect(conn) { if readUntilDisconnect(conn) {
errc <- fmt.Errorf("unexpected disconnect") errc <- errors.New("unexpected disconnect")
return return
} }
close(errc) close(errc)

Binary file not shown.

View file

@ -1,20 +1,27 @@
{ {
"HIVE_CANCUN_TIMESTAMP": "840", "HIVE_CANCUN_BLOB_BASE_FEE_UPDATE_FRACTION": "3338477",
"HIVE_CANCUN_BLOB_MAX": "6",
"HIVE_CANCUN_BLOB_TARGET": "3",
"HIVE_CANCUN_TIMESTAMP": "60",
"HIVE_CHAIN_ID": "3503995874084926", "HIVE_CHAIN_ID": "3503995874084926",
"HIVE_FORK_ARROW_GLACIER": "60", "HIVE_FORK_ARROW_GLACIER": "0",
"HIVE_FORK_BERLIN": "48", "HIVE_FORK_BERLIN": "0",
"HIVE_FORK_BYZANTIUM": "18", "HIVE_FORK_BYZANTIUM": "0",
"HIVE_FORK_CONSTANTINOPLE": "24", "HIVE_FORK_CONSTANTINOPLE": "0",
"HIVE_FORK_GRAY_GLACIER": "66", "HIVE_FORK_GRAY_GLACIER": "0",
"HIVE_FORK_HOMESTEAD": "0", "HIVE_FORK_HOMESTEAD": "0",
"HIVE_FORK_ISTANBUL": "36", "HIVE_FORK_ISTANBUL": "0",
"HIVE_FORK_LONDON": "54", "HIVE_FORK_LONDON": "0",
"HIVE_FORK_MUIR_GLACIER": "42", "HIVE_FORK_MUIR_GLACIER": "0",
"HIVE_FORK_PETERSBURG": "30", "HIVE_FORK_PETERSBURG": "0",
"HIVE_FORK_SPURIOUS": "12", "HIVE_FORK_SPURIOUS": "0",
"HIVE_FORK_TANGERINE": "6", "HIVE_FORK_TANGERINE": "0",
"HIVE_MERGE_BLOCK_ID": "72", "HIVE_MERGE_BLOCK_ID": "0",
"HIVE_NETWORK_ID": "3503995874084926", "HIVE_NETWORK_ID": "3503995874084926",
"HIVE_SHANGHAI_TIMESTAMP": "780", "HIVE_PRAGUE_BLOB_BASE_FEE_UPDATE_FRACTION": "5007716",
"HIVE_TERMINAL_TOTAL_DIFFICULTY": "9454784" "HIVE_PRAGUE_BLOB_MAX": "9",
"HIVE_PRAGUE_BLOB_TARGET": "6",
"HIVE_PRAGUE_TIMESTAMP": "120",
"HIVE_SHANGHAI_TIMESTAMP": "0",
"HIVE_TERMINAL_TOTAL_DIFFICULTY": "131072"
} }

View file

@ -2,28 +2,35 @@
"config": { "config": {
"chainId": 3503995874084926, "chainId": 3503995874084926,
"homesteadBlock": 0, "homesteadBlock": 0,
"eip150Block": 6, "eip150Block": 0,
"eip155Block": 12, "eip155Block": 0,
"eip158Block": 12, "eip158Block": 0,
"byzantiumBlock": 18, "byzantiumBlock": 0,
"constantinopleBlock": 24, "constantinopleBlock": 0,
"petersburgBlock": 30, "petersburgBlock": 0,
"istanbulBlock": 36, "istanbulBlock": 0,
"muirGlacierBlock": 42, "muirGlacierBlock": 0,
"berlinBlock": 48, "berlinBlock": 0,
"londonBlock": 54, "londonBlock": 0,
"arrowGlacierBlock": 60, "arrowGlacierBlock": 0,
"grayGlacierBlock": 66, "grayGlacierBlock": 0,
"mergeNetsplitBlock": 72, "mergeNetsplitBlock": 0,
"shanghaiTime": 780, "shanghaiTime": 0,
"cancunTime": 840, "cancunTime": 60,
"terminalTotalDifficulty": 9454784, "pragueTime": 120,
"terminalTotalDifficulty": 131072,
"depositContractAddress": "0x0000000000000000000000000000000000000000",
"ethash": {}, "ethash": {},
"blobSchedule": { "blobSchedule": {
"cancun": { "cancun": {
"target": 3, "target": 3,
"max": 6, "max": 6,
"baseFeeUpdateFraction": 3338477 "baseFeeUpdateFraction": 3338477
},
"prague": {
"target": 6,
"max": 9,
"baseFeeUpdateFraction": 5007716
} }
} }
}, },
@ -35,6 +42,18 @@
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000", "coinbase": "0x0000000000000000000000000000000000000000",
"alloc": { "alloc": {
"00000961ef480eb55e80d19ad83579a64c007002": {
"code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd",
"balance": "0x1"
},
"0000bbddc7ce488642fb579f8b00f3a590007251": {
"code": "0x3373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd",
"balance": "0x1"
},
"0000f90827f1c53a10cb7a02335b175320002935": {
"code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500",
"balance": "0x1"
},
"000f3df6d732807ef1319fb7b8bb8522d0beac02": { "000f3df6d732807ef1319fb7b8bb8522d0beac02": {
"code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500", "code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500",
"balance": "0x2a" "balance": "0x2a"
@ -81,6 +100,10 @@
"7435ed30a8b4aeb0877cef0c6e8cffe834eb865f": { "7435ed30a8b4aeb0877cef0c6e8cffe834eb865f": {
"balance": "0xc097ce7bc90715b34b9f1000000000" "balance": "0xc097ce7bc90715b34b9f1000000000"
}, },
"7dcd17433742f4c0ca53122ab541d0ba67fc27df": {
"code": "0x3680600080376000206000548082558060010160005560005263656d697460206000a2",
"balance": "0x0"
},
"83c7e323d189f18725ac510004fdc2941f8c4a78": { "83c7e323d189f18725ac510004fdc2941f8c4a78": {
"balance": "0xc097ce7bc90715b34b9f1000000000" "balance": "0xc097ce7bc90715b34b9f1000000000"
}, },
@ -112,7 +135,7 @@
"number": "0x0", "number": "0x0",
"gasUsed": "0x0", "gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas": null, "baseFeePerGas": "0x3b9aca00",
"excessBlobGas": null, "excessBlobGas": null,
"blobGasUsed": null "blobGasUsed": null
} }

View file

@ -1,16 +1,16 @@
{ {
"parentHash": "0x96a73007443980c5e0985dfbb45279aa496dadea16918ad42c65c0bf8122ec39", "parentHash": "0x65151b101682b54cd08ba226f640c14c86176865ff9bfc57e0147dadaeac34bb",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"miner": "0x0000000000000000000000000000000000000000", "miner": "0x0000000000000000000000000000000000000000",
"stateRoot": "0xea4c1f4d9fa8664c22574c5b2f948a78c4b1a753cebc1861e7fb5b1aa21c5a94", "stateRoot": "0xce423ebc60fc7764a43f09f1fe3ae61eef25e3eb8d09b1108f7e7eb77dfff5e6",
"transactionsRoot": "0xecda39025fc4c609ce778d75eed0aa53b65ce1e3d1373b34bad8578cc31e5b48", "transactionsRoot": "0x7ec1ae3989efa75d7bcc766e5e2443afa8a89a5fda42ebba90050e7e702980f7",
"receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2", "receiptsRoot": "0xfe160832b1ca85f38c6674cb0aae3a24693bc49be56e2ecdf3698b71a794de86",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x0", "difficulty": "0x0",
"number": "0x1f4", "number": "0x258",
"gasLimit": "0x47e7c40", "gasLimit": "0x23f3e20",
"gasUsed": "0x5208", "gasUsed": "0x19d36",
"timestamp": "0x1388", "timestamp": "0x1770",
"extraData": "0x", "extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000", "nonce": "0x0000000000000000",
@ -18,6 +18,7 @@
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"blobGasUsed": "0x0", "blobGasUsed": "0x0",
"excessBlobGas": "0x0", "excessBlobGas": "0x0",
"parentBeaconBlockRoot": "0xf653da50cdff4733f13f7a5e338290e883bdf04adf3f112709728063ea965d6c", "parentBeaconBlockRoot": "0xf5003fc8f92358e790a114bce93ce1d9c283c85e1787f8d7d56714d3489b49e6",
"hash": "0x36a166f0dcd160fc5e5c61c9a7c2d7f236d9175bf27f43aaa2150e291f092ef7" "requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"hash": "0xce8d86ba17a2ec303155f0e264c58a4b8f94ce3436274cf1924f91acdb7502d0"
} }

View file

@ -1,12 +1,12 @@
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"id": "fcu500", "id": "fcu600",
"method": "engine_forkchoiceUpdatedV3", "method": "engine_forkchoiceUpdatedV3",
"params": [ "params": [
{ {
"headBlockHash": "0x36a166f0dcd160fc5e5c61c9a7c2d7f236d9175bf27f43aaa2150e291f092ef7", "headBlockHash": "0xce8d86ba17a2ec303155f0e264c58a4b8f94ce3436274cf1924f91acdb7502d0",
"safeBlockHash": "0x36a166f0dcd160fc5e5c61c9a7c2d7f236d9175bf27f43aaa2150e291f092ef7", "safeBlockHash": "0xce8d86ba17a2ec303155f0e264c58a4b8f94ce3436274cf1924f91acdb7502d0",
"finalizedBlockHash": "0x36a166f0dcd160fc5e5c61c9a7c2d7f236d9175bf27f43aaa2150e291f092ef7" "finalizedBlockHash": "0xce8d86ba17a2ec303155f0e264c58a4b8f94ce3436274cf1924f91acdb7502d0"
}, },
null null
] ]

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/protocols/eth" "github.com/ethereum/go-ethereum/eth/protocols/eth"
"github.com/ethereum/go-ethereum/internal/utesting" "github.com/ethereum/go-ethereum/internal/utesting"
"github.com/ethereum/go-ethereum/rlp"
) )
// sendTxs sends the given transactions to the node and // sendTxs sends the given transactions to the node and
@ -51,7 +52,8 @@ func (s *Suite) sendTxs(t *utesting.T, txs []*types.Transaction) error {
return fmt.Errorf("peering failed: %v", err) return fmt.Errorf("peering failed: %v", err)
} }
if err = sendConn.Write(ethProto, eth.TransactionsMsg, eth.TransactionsPacket(txs)); err != nil { encTxs, _ := rlp.EncodeToRawList(txs)
if err = sendConn.Write(ethProto, eth.TransactionsMsg, eth.TransactionsPacket{RawList: encTxs}); err != nil {
return fmt.Errorf("failed to write message to connection: %v", err) return fmt.Errorf("failed to write message to connection: %v", err)
} }
@ -68,7 +70,8 @@ func (s *Suite) sendTxs(t *utesting.T, txs []*types.Transaction) error {
} }
switch msg := msg.(type) { switch msg := msg.(type) {
case *eth.TransactionsPacket: case *eth.TransactionsPacket:
for _, tx := range *msg { txs, _ := msg.Items()
for _, tx := range txs {
got[tx.Hash()] = true got[tx.Hash()] = true
} }
case *eth.NewPooledTransactionHashesPacket: case *eth.NewPooledTransactionHashesPacket:
@ -80,9 +83,10 @@ func (s *Suite) sendTxs(t *utesting.T, txs []*types.Transaction) error {
if err != nil { if err != nil {
t.Logf("invalid GetBlockHeaders request: %v", err) t.Logf("invalid GetBlockHeaders request: %v", err)
} }
encHeaders, _ := rlp.EncodeToRawList(headers)
recvConn.Write(ethProto, eth.BlockHeadersMsg, &eth.BlockHeadersPacket{ recvConn.Write(ethProto, eth.BlockHeadersMsg, &eth.BlockHeadersPacket{
RequestId: msg.RequestId, RequestId: msg.RequestId,
BlockHeadersRequest: headers, List: encHeaders,
}) })
default: default:
return fmt.Errorf("unexpected eth wire msg: %s", pretty.Sdump(msg)) return fmt.Errorf("unexpected eth wire msg: %s", pretty.Sdump(msg))
@ -167,9 +171,10 @@ func (s *Suite) sendInvalidTxs(t *utesting.T, txs []*types.Transaction) error {
if err != nil { if err != nil {
t.Logf("invalid GetBlockHeaders request: %v", err) t.Logf("invalid GetBlockHeaders request: %v", err)
} }
encHeaders, _ := rlp.EncodeToRawList(headers)
recvConn.Write(ethProto, eth.BlockHeadersMsg, &eth.BlockHeadersPacket{ recvConn.Write(ethProto, eth.BlockHeadersMsg, &eth.BlockHeadersPacket{
RequestId: msg.RequestId, RequestId: msg.RequestId,
BlockHeadersRequest: headers, List: encHeaders,
}) })
default: default:
return fmt.Errorf("unexpected eth message: %v", pretty.Sdump(msg)) return fmt.Errorf("unexpected eth message: %v", pretty.Sdump(msg))

View file

@ -27,6 +27,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/internal/utesting" "github.com/ethereum/go-ethereum/internal/utesting"
"github.com/ethereum/go-ethereum/p2p/discover/v4wire" "github.com/ethereum/go-ethereum/p2p/discover/v4wire"
"github.com/ethereum/go-ethereum/p2p/enode"
) )
const ( const (
@ -501,6 +502,36 @@ func FindnodeAmplificationWrongIP(t *utesting.T) {
} }
} }
func ENRRequest(t *utesting.T) {
t.Log(`This test sends an ENRRequest packet and expects a response containing a valid ENR.`)
te := newTestEnv(Remote, Listen1, Listen2)
defer te.close()
bond(t, te)
req := &v4wire.ENRRequest{Expiration: futureExpiration()}
hash := te.send(te.l1, req)
response, _, err := te.read(te.l1)
if err != nil {
t.Fatal("read error:", err)
}
enrResp, ok := response.(*v4wire.ENRResponse)
if !ok {
t.Fatalf("expected ENRResponse packet, got %T", response)
}
if !bytes.Equal(enrResp.ReplyTok, hash) {
t.Errorf("wrong hash in response packet: got %x, want %x", enrResp.ReplyTok, hash)
}
node, err := enode.New(enode.ValidSchemes, &enrResp.Record)
if err != nil {
t.Errorf("invalid record in response: %v", err)
}
if node.ID() != te.remote.ID() {
t.Errorf("wrong node ID in response: got %v, want %v", node.ID(), te.remote.ID())
}
}
var AllTests = []utesting.Test{ var AllTests = []utesting.Test{
{Name: "Ping/Basic", Fn: BasicPing}, {Name: "Ping/Basic", Fn: BasicPing},
{Name: "Ping/WrongTo", Fn: PingWrongTo}, {Name: "Ping/WrongTo", Fn: PingWrongTo},
@ -510,6 +541,7 @@ var AllTests = []utesting.Test{
{Name: "Ping/PastExpiration", Fn: PingPastExpiration}, {Name: "Ping/PastExpiration", Fn: PingPastExpiration},
{Name: "Ping/WrongPacketType", Fn: WrongPacketType}, {Name: "Ping/WrongPacketType", Fn: WrongPacketType},
{Name: "Ping/BondThenPingWithWrongFrom", Fn: BondThenPingWithWrongFrom}, {Name: "Ping/BondThenPingWithWrongFrom", Fn: BondThenPingWithWrongFrom},
{Name: "ENRRequest", Fn: ENRRequest},
{Name: "Findnode/WithoutEndpointProof", Fn: FindnodeWithoutEndpointProof}, {Name: "Findnode/WithoutEndpointProof", Fn: FindnodeWithoutEndpointProof},
{Name: "Findnode/BasicFindnode", Fn: BasicFindnode}, {Name: "Findnode/BasicFindnode", Fn: BasicFindnode},
{Name: "Findnode/UnsolicitedNeighbors", Fn: UnsolicitedNeighbors}, {Name: "Findnode/UnsolicitedNeighbors", Fn: UnsolicitedNeighbors},

View file

@ -52,7 +52,7 @@ func (s *Suite) AllTests() []utesting.Test {
{Name: "Ping", Fn: s.TestPing}, {Name: "Ping", Fn: s.TestPing},
{Name: "PingLargeRequestID", Fn: s.TestPingLargeRequestID}, {Name: "PingLargeRequestID", Fn: s.TestPingLargeRequestID},
{Name: "PingMultiIP", Fn: s.TestPingMultiIP}, {Name: "PingMultiIP", Fn: s.TestPingMultiIP},
{Name: "PingHandshakeInterrupted", Fn: s.TestPingHandshakeInterrupted}, {Name: "HandshakeResend", Fn: s.TestHandshakeResend},
{Name: "TalkRequest", Fn: s.TestTalkRequest}, {Name: "TalkRequest", Fn: s.TestTalkRequest},
{Name: "FindnodeZeroDistance", Fn: s.TestFindnodeZeroDistance}, {Name: "FindnodeZeroDistance", Fn: s.TestFindnodeZeroDistance},
{Name: "FindnodeResults", Fn: s.TestFindnodeResults}, {Name: "FindnodeResults", Fn: s.TestFindnodeResults},
@ -158,22 +158,20 @@ the attempt from a different IP.`)
} }
} }
// TestPingHandshakeInterrupted starts a handshake, but doesn't finish it and sends a second ordinary message // TestHandshakeResend starts a handshake, but doesn't finish it and sends a second ordinary message
// packet instead of a handshake message packet. The remote node should respond with // packet instead of a handshake message packet. The remote node should repeat the previous WHOAREYOU
// another WHOAREYOU challenge for the second packet. // challenge for the first PING.
func (s *Suite) TestPingHandshakeInterrupted(t *utesting.T) { func (s *Suite) TestHandshakeResend(t *utesting.T) {
t.Log(`TestPingHandshakeInterrupted starts a handshake, but doesn't finish it and sends a second ordinary message
packet instead of a handshake message packet. The remote node should respond with
another WHOAREYOU challenge for the second packet.`)
conn, l1 := s.listen1(t) conn, l1 := s.listen1(t)
defer conn.close() defer conn.close()
// First PING triggers challenge. // First PING triggers challenge.
ping := &v5wire.Ping{ReqID: conn.nextReqID()} ping := &v5wire.Ping{ReqID: conn.nextReqID()}
conn.write(l1, ping, nil) conn.write(l1, ping, nil)
var challenge1 *v5wire.Whoareyou
switch resp := conn.read(l1).(type) { switch resp := conn.read(l1).(type) {
case *v5wire.Whoareyou: case *v5wire.Whoareyou:
challenge1 = resp
t.Logf("got WHOAREYOU for PING") t.Logf("got WHOAREYOU for PING")
default: default:
t.Fatal("expected WHOAREYOU, got", resp) t.Fatal("expected WHOAREYOU, got", resp)
@ -181,9 +179,16 @@ another WHOAREYOU challenge for the second packet.`)
// Send second PING. // Send second PING.
ping2 := &v5wire.Ping{ReqID: conn.nextReqID()} ping2 := &v5wire.Ping{ReqID: conn.nextReqID()}
switch resp := conn.reqresp(l1, ping2).(type) { conn.write(l1, ping2, nil)
case *v5wire.Pong: switch resp := conn.read(l1).(type) {
checkPong(t, resp, ping2, l1) case *v5wire.Whoareyou:
if resp.Nonce != challenge1.Nonce {
t.Fatalf("wrong nonce %x in WHOAREYOU (want %x)", resp.Nonce[:], challenge1.Nonce[:])
}
if !bytes.Equal(resp.ChallengeData, challenge1.ChallengeData) {
t.Fatalf("wrong ChallengeData in resent WHOAREYOU (want %x)", resp.ChallengeData, challenge1.ChallengeData)
}
resp.Node = conn.remote
default: default:
t.Fatal("expected WHOAREYOU, got", resp) t.Fatal("expected WHOAREYOU, got", resp)
} }

View file

@ -143,9 +143,6 @@ type testParams struct {
func cliTestParams(ctx *cli.Context) *testParams { func cliTestParams(ctx *cli.Context) *testParams {
nodeStr := ctx.String(testNodeFlag.Name) nodeStr := ctx.String(testNodeFlag.Name)
if nodeStr == "" {
exit(fmt.Errorf("missing -%s", testNodeFlag.Name))
}
node, err := parseNode(nodeStr) node, err := parseNode(nodeStr)
if err != nil { if err != nil {
exit(err) exit(err)
@ -156,14 +153,5 @@ func cliTestParams(ctx *cli.Context) *testParams {
jwt: ctx.String(testNodeJWTFlag.Name), jwt: ctx.String(testNodeJWTFlag.Name),
chainDir: ctx.String(testChainDirFlag.Name), chainDir: ctx.String(testChainDirFlag.Name),
} }
if p.engineAPI == "" {
exit(fmt.Errorf("missing -%s", testNodeEngineFlag.Name))
}
if p.jwt == "" {
exit(fmt.Errorf("missing -%s", testNodeJWTFlag.Name))
}
if p.chainDir == "" {
exit(fmt.Errorf("missing -%s", testChainDirFlag.Name))
}
return &p return &p
} }

View file

@ -39,26 +39,29 @@ var (
} }
// for eth/snap tests // for eth/snap tests
testChainDirFlag = &cli.StringFlag{ testChainDirFlag = &cli.PathFlag{
Name: "chain", Name: "chain",
Usage: "Test chain directory (required)", Usage: "Test chain directory (required)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
Required: true,
} }
testNodeFlag = &cli.StringFlag{ testNodeFlag = &cli.StringFlag{
Name: "node", Name: "node",
Usage: "Peer-to-Peer endpoint (ENR) of the test node (required)", Usage: "Peer-to-Peer endpoint (ENR) of the test node (required)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
Required: true,
} }
testNodeJWTFlag = &cli.StringFlag{ testNodeJWTFlag = &cli.StringFlag{
Name: "jwtsecret", Name: "jwtsecret",
Usage: "JWT secret for the engine API of the test node (required)", Usage: "JWT secret for the engine API of the test node (required)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
Value: "0x7365637265747365637265747365637265747365637265747365637265747365", Required: true,
} }
testNodeEngineFlag = &cli.StringFlag{ testNodeEngineFlag = &cli.StringFlag{
Name: "engineapi", Name: "engineapi",
Usage: "Engine API endpoint of the test node (required)", Usage: "Engine API endpoint of the test node (required)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
Required: true,
} }
// These two are specific to the discovery tests. // These two are specific to the discovery tests.

View file

@ -30,6 +30,8 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/internal/era" "github.com/ethereum/go-ethereum/internal/era"
"github.com/ethereum/go-ethereum/internal/era/execdb"
"github.com/ethereum/go-ethereum/internal/era/onedb"
"github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/internal/flags" "github.com/ethereum/go-ethereum/internal/flags"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
@ -53,7 +55,7 @@ var (
eraSizeFlag = &cli.IntFlag{ eraSizeFlag = &cli.IntFlag{
Name: "size", Name: "size",
Usage: "number of blocks per era", Usage: "number of blocks per era",
Value: era.MaxEra1Size, Value: era.MaxSize,
} }
txsFlag = &cli.BoolFlag{ txsFlag = &cli.BoolFlag{
Name: "txs", Name: "txs",
@ -131,7 +133,7 @@ func block(ctx *cli.Context) error {
return nil return nil
} }
// info prints some high-level information about the era1 file. // info prints some high-level information about the era file.
func info(ctx *cli.Context) error { func info(ctx *cli.Context) error {
epoch, err := strconv.ParseUint(ctx.Args().First(), 10, 64) epoch, err := strconv.ParseUint(ctx.Args().First(), 10, 64)
if err != nil { if err != nil {
@ -142,33 +144,34 @@ func info(ctx *cli.Context) error {
return err return err
} }
defer e.Close() defer e.Close()
acc, err := e.Accumulator() var (
if err != nil { accHex string
return fmt.Errorf("error reading accumulator: %w", err) tdStr string
)
if acc, err := e.Accumulator(); err == nil {
accHex = acc.Hex()
} }
td, err := e.InitialTD() if td, err := e.InitialTD(); err == nil {
if err != nil { tdStr = td.String()
return fmt.Errorf("error reading total difficulty: %w", err)
} }
info := struct { info := struct {
Accumulator common.Hash `json:"accumulator"` Accumulator string `json:"accumulator,omitempty"`
TotalDifficulty *big.Int `json:"totalDifficulty"` TotalDifficulty string `json:"totalDifficulty,omitempty"`
StartBlock uint64 `json:"startBlock"` StartBlock uint64 `json:"startBlock"`
Count uint64 `json:"count"` Count uint64 `json:"count"`
}{ }{
acc, td, e.Start(), e.Count(), accHex, tdStr, e.Start(), e.Count(),
} }
b, _ := json.MarshalIndent(info, "", " ") b, _ := json.MarshalIndent(info, "", " ")
fmt.Println(string(b)) fmt.Println(string(b))
return nil return nil
} }
// open opens an era1 file at a certain epoch. // open opens an era file at a certain epoch.
func open(ctx *cli.Context, epoch uint64) (*era.Era, error) { func open(ctx *cli.Context, epoch uint64) (era.Era, error) {
var ( dir := ctx.String(dirFlag.Name)
dir = ctx.String(dirFlag.Name) network := ctx.String(networkFlag.Name)
network = ctx.String(networkFlag.Name)
)
entries, err := era.ReadDir(dir, network) entries, err := era.ReadDir(dir, network)
if err != nil { if err != nil {
return nil, fmt.Errorf("error reading era dir: %w", err) return nil, fmt.Errorf("error reading era dir: %w", err)
@ -176,7 +179,28 @@ func open(ctx *cli.Context, epoch uint64) (*era.Era, error) {
if epoch >= uint64(len(entries)) { if epoch >= uint64(len(entries)) {
return nil, fmt.Errorf("epoch out-of-bounds: last %d, want %d", len(entries)-1, epoch) return nil, fmt.Errorf("epoch out-of-bounds: last %d, want %d", len(entries)-1, epoch)
} }
return era.Open(filepath.Join(dir, entries[epoch])) path := filepath.Join(dir, entries[epoch])
return openByPath(path)
}
// openByPath tries to open a single file as either eraE or era1 based on extension,
// falling back to the other reader if needed.
func openByPath(path string) (era.Era, error) {
switch strings.ToLower(filepath.Ext(path)) {
case ".erae":
if e, err := execdb.Open(path); err != nil {
return nil, err
} else {
return e, nil
}
case ".era1":
if e, err := onedb.Open(path); err != nil {
return nil, err
} else {
return e, nil
}
}
return nil, fmt.Errorf("unsupported or unreadable era file: %s", path)
} }
// verify checks each era1 file in a directory to ensure it is well-formed and // verify checks each era1 file in a directory to ensure it is well-formed and
@ -203,18 +227,58 @@ func verify(ctx *cli.Context) error {
return fmt.Errorf("error reading %s: %w", dir, err) return fmt.Errorf("error reading %s: %w", dir, err)
} }
if len(entries) != len(roots) { // Build the verification list respecting the rule:
return errors.New("number of era1 files should match the number of accumulator hashes") // era1: must have accumulator, always verify
// erae: verify only if accumulator exists (pre-merge)
// Build list of files to verify.
verify := make([]string, 0, len(entries))
for _, name := range entries {
path := filepath.Join(dir, name)
ext := strings.ToLower(filepath.Ext(name))
switch ext {
case ".era1":
e, err := onedb.Open(path)
if err != nil {
return fmt.Errorf("error opening era1 file %s: %w", name, err)
}
_, accErr := e.Accumulator()
e.Close()
if accErr != nil {
return fmt.Errorf("era1 file %s missing accumulator: %w", name, accErr)
}
verify = append(verify, path)
case ".erae":
e, err := execdb.Open(path)
if err != nil {
return fmt.Errorf("error opening erae file %s: %w", name, err)
}
_, accErr := e.Accumulator()
e.Close()
if accErr == nil {
verify = append(verify, path) // pre-merge only
}
default:
return fmt.Errorf("unsupported era file: %s", name)
}
}
if len(verify) != len(roots) {
return fmt.Errorf("mismatch between eras to verify (%d) and provided roots (%d)", len(verify), len(roots))
} }
// Verify each epoch matches the expected root. // Verify each epoch matches the expected root.
for i, want := range roots { for i, want := range roots {
// Wrap in function so defers don't stack. // Wrap in function so defers don't stack.
err := func() error { err := func() error {
name := entries[i] path := verify[i]
e, err := era.Open(filepath.Join(dir, name)) name := filepath.Base(path)
e, err := openByPath(path)
if err != nil { if err != nil {
return fmt.Errorf("error opening era1 file %s: %w", name, err) return fmt.Errorf("error opening era file %s: %w", name, err)
} }
defer e.Close() defer e.Close()
// Read accumulator and check against expected. // Read accumulator and check against expected.
@ -243,7 +307,7 @@ func verify(ctx *cli.Context) error {
} }
// checkAccumulator verifies the accumulator matches the data in the Era. // checkAccumulator verifies the accumulator matches the data in the Era.
func checkAccumulator(e *era.Era) error { func checkAccumulator(e era.Era) error {
var ( var (
err error err error
want common.Hash want common.Hash
@ -257,7 +321,7 @@ func checkAccumulator(e *era.Era) error {
if td, err = e.InitialTD(); err != nil { if td, err = e.InitialTD(); err != nil {
return fmt.Errorf("error reading total difficulty: %w", err) return fmt.Errorf("error reading total difficulty: %w", err)
} }
it, err := era.NewIterator(e) it, err := e.Iterator()
if err != nil { if err != nil {
return fmt.Errorf("error making era iterator: %w", err) return fmt.Errorf("error making era iterator: %w", err)
} }
@ -274,10 +338,10 @@ func checkAccumulator(e *era.Era) error {
for it.Next() { for it.Next() {
// 1) next() walks the block index, so we're able to implicitly verify it. // 1) next() walks the block index, so we're able to implicitly verify it.
if it.Error() != nil { if it.Error() != nil {
return fmt.Errorf("error reading block %d: %w", it.Number(), err) return fmt.Errorf("error reading block %d: %w", it.Number(), it.Error())
} }
block, receipts, err := it.BlockAndReceipts() block, receipts, err := it.BlockAndReceipts()
if it.Error() != nil { if err != nil {
return fmt.Errorf("error reading block %d: %w", it.Number(), err) return fmt.Errorf("error reading block %d: %w", it.Number(), err)
} }
// 2) recompute tx root and verify against header. // 2) recompute tx root and verify against header.
@ -290,9 +354,16 @@ func checkAccumulator(e *era.Era) error {
if rr != block.ReceiptHash() { if rr != block.ReceiptHash() {
return fmt.Errorf("receipt root in block %d mismatch: want %s, got %s", block.NumberU64(), block.ReceiptHash(), rr) return fmt.Errorf("receipt root in block %d mismatch: want %s, got %s", block.NumberU64(), block.ReceiptHash(), rr)
} }
hashes = append(hashes, block.Hash()) // Only include pre-merge blocks in accumulator calculation.
td.Add(td, block.Difficulty()) // Post-merge blocks have difficulty == 0.
tds = append(tds, new(big.Int).Set(td)) if block.Difficulty().Sign() > 0 {
hashes = append(hashes, block.Hash())
td.Add(td, block.Difficulty())
tds = append(tds, new(big.Int).Set(td))
}
}
if it.Error() != nil {
return fmt.Errorf("error reading block %d: %w", it.Number(), it.Error())
} }
// 4+5) Verify accumulator and total difficulty. // 4+5) Verify accumulator and total difficulty.
got, err := era.ComputeAccumulator(hashes, tds) got, err := era.ComputeAccumulator(hashes, tds)

View file

@ -17,16 +17,18 @@
package main package main
import ( import (
"bufio"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"maps" "maps"
"os" "os"
"regexp" "regexp"
"slices" "slices"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/tests" "github.com/ethereum/go-ethereum/tests"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@ -34,33 +36,52 @@ import (
var blockTestCommand = &cli.Command{ var blockTestCommand = &cli.Command{
Action: blockTestCmd, Action: blockTestCmd,
Name: "blocktest", Name: "blocktest",
Usage: "Executes the given blockchain tests", Usage: "Executes the given blockchain tests. Filenames can be fed via standard input (batch mode) or as an argument (one-off execution).",
ArgsUsage: "<path>", ArgsUsage: "<path>",
Flags: slices.Concat([]cli.Flag{ Flags: slices.Concat([]cli.Flag{
DumpFlag, DumpFlag,
HumanReadableFlag, HumanReadableFlag,
RunFlag, RunFlag,
WitnessCrossCheckFlag, WitnessCrossCheckFlag,
FuzzFlag,
}, traceFlags), }, traceFlags),
} }
func blockTestCmd(ctx *cli.Context) error { func blockTestCmd(ctx *cli.Context) error {
path := ctx.Args().First() path := ctx.Args().First()
if len(path) == 0 {
return errors.New("path argument required") // If path is provided, run the tests at that path.
if len(path) != 0 {
var (
collected = collectFiles(path)
results []testResult
)
for _, fname := range collected {
r, err := runBlockTest(ctx, fname)
if err != nil {
return err
}
results = append(results, r...)
}
report(ctx, results)
return nil
} }
var ( // Otherwise, read filenames from stdin and execute back-to-back.
collected = collectFiles(path) scanner := bufio.NewScanner(os.Stdin)
results []testResult for scanner.Scan() {
) fname := scanner.Text()
for _, fname := range collected { if len(fname) == 0 {
r, err := runBlockTest(ctx, fname) return nil
}
results, err := runBlockTest(ctx, fname)
if err != nil { if err != nil {
return err return err
} }
results = append(results, r...) // During fuzzing, we report the result after every block
if !ctx.IsSet(FuzzFlag.Name) {
report(ctx, results)
}
} }
report(ctx, results)
return nil return nil
} }
@ -79,6 +100,11 @@ func runBlockTest(ctx *cli.Context, fname string) ([]testResult, error) {
} }
tracer := tracerFromFlags(ctx) tracer := tracerFromFlags(ctx)
// Suppress INFO logs during fuzzing
if ctx.IsSet(FuzzFlag.Name) {
log.SetDefault(log.NewLogger(log.DiscardHandler()))
}
// Pull out keys to sort and ensure tests are run in order. // Pull out keys to sort and ensure tests are run in order.
keys := slices.Sorted(maps.Keys(tests)) keys := slices.Sorted(maps.Keys(tests))
@ -88,16 +114,35 @@ func runBlockTest(ctx *cli.Context, fname string) ([]testResult, error) {
if !re.MatchString(name) { if !re.MatchString(name) {
continue continue
} }
test := tests[name]
result := &testResult{Name: name, Pass: true} result := &testResult{Name: name, Pass: true}
if err := tests[name].Run(false, rawdb.HashScheme, ctx.Bool(WitnessCrossCheckFlag.Name), tracer, func(res error, chain *core.BlockChain) { var finalRoot *common.Hash
if err := test.Run(false, rawdb.PathScheme, ctx.Bool(WitnessCrossCheckFlag.Name), tracer, func(res error, chain *core.BlockChain) {
if ctx.Bool(DumpFlag.Name) { if ctx.Bool(DumpFlag.Name) {
if s, _ := chain.State(); s != nil { if s, _ := chain.State(); s != nil {
result.State = dump(s) result.State = dump(s)
} }
} }
// Capture final state root for end marker
if chain != nil {
root := chain.CurrentBlock().Root
finalRoot = &root
}
}); err != nil { }); err != nil {
result.Pass, result.Error = false, err.Error() result.Pass, result.Error = false, err.Error()
} }
// Always assign fork (regardless of pass/fail or tracer)
result.Fork = test.Network()
// Assign root if test succeeded
if result.Pass && finalRoot != nil {
result.Root = finalRoot
}
// When fuzzing, write results after every block
if ctx.IsSet(FuzzFlag.Name) {
report(ctx, []testResult{*result})
}
results = append(results, *result) results = append(results, *result)
} }
return results, nil return results, nil

View file

@ -56,6 +56,7 @@ type header struct {
BlobGasUsed *uint64 `json:"blobGasUsed" rlp:"optional"` BlobGasUsed *uint64 `json:"blobGasUsed" rlp:"optional"`
ExcessBlobGas *uint64 `json:"excessBlobGas" rlp:"optional"` ExcessBlobGas *uint64 `json:"excessBlobGas" rlp:"optional"`
ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"`
SlotNumber *uint64 `json:"slotNumber" rlp:"optional"`
} }
type headerMarshaling struct { type headerMarshaling struct {
@ -68,6 +69,7 @@ type headerMarshaling struct {
BaseFee *math.HexOrDecimal256 BaseFee *math.HexOrDecimal256
BlobGasUsed *math.HexOrDecimal64 BlobGasUsed *math.HexOrDecimal64
ExcessBlobGas *math.HexOrDecimal64 ExcessBlobGas *math.HexOrDecimal64
SlotNumber *math.HexOrDecimal64
} }
type bbInput struct { type bbInput struct {
@ -136,6 +138,7 @@ func (i *bbInput) ToBlock() *types.Block {
BlobGasUsed: i.Header.BlobGasUsed, BlobGasUsed: i.Header.BlobGasUsed,
ExcessBlobGas: i.Header.ExcessBlobGas, ExcessBlobGas: i.Header.ExcessBlobGas,
ParentBeaconRoot: i.Header.ParentBeaconBlockRoot, ParentBeaconRoot: i.Header.ParentBeaconBlockRoot,
SlotNumber: i.Header.SlotNumber,
} }
// Fill optional values. // Fill optional values.

View file

@ -18,6 +18,7 @@ package t8ntool
import ( import (
"fmt" "fmt"
stdmath "math"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -32,7 +33,7 @@ import (
"github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/keccak"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
@ -40,12 +41,12 @@ import (
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/triedb" "github.com/ethereum/go-ethereum/triedb"
"github.com/holiman/uint256" "github.com/holiman/uint256"
"golang.org/x/crypto/sha3"
) )
type Prestate struct { type Prestate struct {
Env stEnv `json:"env"` Env stEnv `json:"env"`
Pre types.GenesisAlloc `json:"pre"` Pre types.GenesisAlloc `json:"pre"`
TreeLeaves map[common.Hash]hexutil.Bytes `json:"vkt,omitempty"`
} }
//go:generate go run github.com/fjl/gencodec -type ExecutionResult -field-override executionResultMarshaling -out gen_execresult.go //go:generate go run github.com/fjl/gencodec -type ExecutionResult -field-override executionResultMarshaling -out gen_execresult.go
@ -101,6 +102,7 @@ type stEnv struct {
ParentExcessBlobGas *uint64 `json:"parentExcessBlobGas,omitempty"` ParentExcessBlobGas *uint64 `json:"parentExcessBlobGas,omitempty"`
ParentBlobGasUsed *uint64 `json:"parentBlobGasUsed,omitempty"` ParentBlobGasUsed *uint64 `json:"parentBlobGasUsed,omitempty"`
ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"`
SlotNumber *uint64 `json:"slotNumber"`
} }
type stEnvMarshaling struct { type stEnvMarshaling struct {
@ -119,6 +121,7 @@ type stEnvMarshaling struct {
ExcessBlobGas *math.HexOrDecimal64 ExcessBlobGas *math.HexOrDecimal64
ParentExcessBlobGas *math.HexOrDecimal64 ParentExcessBlobGas *math.HexOrDecimal64
ParentBlobGasUsed *math.HexOrDecimal64 ParentBlobGasUsed *math.HexOrDecimal64
SlotNumber *math.HexOrDecimal64
} }
type rejectedTx struct { type rejectedTx struct {
@ -143,7 +146,8 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
return h return h
} }
var ( var (
statedb = MakePreState(rawdb.NewMemoryDatabase(), pre.Pre) isEIP4762 = chainConfig.IsVerkle(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp)
statedb = MakePreState(rawdb.NewMemoryDatabase(), pre.Pre, isEIP4762)
signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp) signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp)
gaspool = new(core.GasPool) gaspool = new(core.GasPool)
blockHash = common.Hash{0x13, 0x37} blockHash = common.Hash{0x13, 0x37}
@ -152,7 +156,6 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
gasUsed = uint64(0) gasUsed = uint64(0)
blobGasUsed = uint64(0) blobGasUsed = uint64(0)
receipts = make(types.Receipts, 0) receipts = make(types.Receipts, 0)
txIndex = 0
) )
gaspool.AddGas(pre.Env.GasLimit) gaspool.AddGas(pre.Env.GasLimit)
vmContext := vm.BlockContext{ vmContext := vm.BlockContext{
@ -193,6 +196,8 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
Time: pre.Env.ParentTimestamp, Time: pre.Env.ParentTimestamp,
ExcessBlobGas: pre.Env.ParentExcessBlobGas, ExcessBlobGas: pre.Env.ParentExcessBlobGas,
BlobGasUsed: pre.Env.ParentBlobGasUsed, BlobGasUsed: pre.Env.ParentBlobGasUsed,
BaseFee: pre.Env.ParentBaseFee,
SlotNumber: pre.Env.SlotNumber,
} }
header := &types.Header{ header := &types.Header{
Time: pre.Env.Timestamp, Time: pre.Env.Timestamp,
@ -250,75 +255,32 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
continue continue
} }
} }
statedb.SetTxContext(tx.Hash(), txIndex) statedb.SetTxContext(tx.Hash(), len(receipts))
var ( var (
snapshot = statedb.Snapshot() snapshot = statedb.Snapshot()
prevGas = gaspool.Gas() prevGas = gaspool.Gas()
) )
if evm.Config.Tracer != nil && evm.Config.Tracer.OnTxStart != nil { receipt, err := core.ApplyTransactionWithEVM(msg, gaspool, statedb, vmContext.BlockNumber, blockHash, pre.Env.Timestamp, tx, &gasUsed, evm)
evm.Config.Tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
}
// (ret []byte, usedGas uint64, failed bool, err error)
msgResult, err := core.ApplyMessage(evm, msg, gaspool)
if err != nil { if err != nil {
statedb.RevertToSnapshot(snapshot) statedb.RevertToSnapshot(snapshot)
log.Info("rejected tx", "index", i, "hash", tx.Hash(), "from", msg.From, "error", err) log.Info("rejected tx", "index", i, "hash", tx.Hash(), "from", msg.From, "error", err)
rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()}) rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()})
gaspool.SetGas(prevGas) gaspool.SetGas(prevGas)
if evm.Config.Tracer != nil && evm.Config.Tracer.OnTxEnd != nil {
evm.Config.Tracer.OnTxEnd(nil, err)
}
continue continue
} }
if receipt.Logs == nil {
receipt.Logs = []*types.Log{}
}
includedTxs = append(includedTxs, tx) includedTxs = append(includedTxs, tx)
if hashError != nil { if hashError != nil {
return nil, nil, nil, NewError(ErrorMissingBlockhash, hashError) return nil, nil, nil, NewError(ErrorMissingBlockhash, hashError)
} }
blobGasUsed += txBlobGas blobGasUsed += txBlobGas
gasUsed += msgResult.UsedGas receipts = append(receipts, receipt)
// Receipt:
{
var root []byte
if chainConfig.IsByzantium(vmContext.BlockNumber) {
statedb.Finalise(true)
} else {
root = statedb.IntermediateRoot(chainConfig.IsEIP158(vmContext.BlockNumber)).Bytes()
}
// Create a new receipt for the transaction, storing the intermediate root and
// gas used by the tx.
receipt := &types.Receipt{Type: tx.Type(), PostState: root, CumulativeGasUsed: gasUsed}
if msgResult.Failed() {
receipt.Status = types.ReceiptStatusFailed
} else {
receipt.Status = types.ReceiptStatusSuccessful
}
receipt.TxHash = tx.Hash()
receipt.GasUsed = msgResult.UsedGas
// If the transaction created a contract, store the creation address in the receipt.
if msg.To == nil {
receipt.ContractAddress = crypto.CreateAddress(evm.TxContext.Origin, tx.Nonce())
}
// Set the receipt logs and create the bloom filter.
receipt.Logs = statedb.GetLogs(tx.Hash(), vmContext.BlockNumber.Uint64(), blockHash, vmContext.Time)
receipt.Bloom = types.CreateBloom(receipt)
// These three are non-consensus fields:
//receipt.BlockHash
//receipt.BlockNumber
receipt.TransactionIndex = uint(txIndex)
receipts = append(receipts, receipt)
if evm.Config.Tracer != nil && evm.Config.Tracer.OnTxEnd != nil {
evm.Config.Tracer.OnTxEnd(receipt, nil)
}
}
txIndex++
} }
statedb.IntermediateRoot(chainConfig.IsEIP158(vmContext.BlockNumber)) statedb.IntermediateRoot(chainConfig.IsEIP158(vmContext.BlockNumber))
// Add mining reward? (-1 means rewards are disabled) // Add mining reward? (-1 means rewards are disabled)
if miningReward >= 0 { if miningReward >= 0 {
// Add mining reward. The mining reward may be `0`, which only makes a difference in the cases // Add mining reward. The mining reward may be `0`, which only makes a difference in the cases
@ -348,6 +310,10 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
// Amount is in gwei, turn into wei // Amount is in gwei, turn into wei
amount := new(big.Int).Mul(new(big.Int).SetUint64(w.Amount), big.NewInt(params.GWei)) amount := new(big.Int).Mul(new(big.Int).SetUint64(w.Amount), big.NewInt(params.GWei))
statedb.AddBalance(w.Address, uint256.MustFromBig(amount), tracing.BalanceIncreaseWithdrawal) statedb.AddBalance(w.Address, uint256.MustFromBig(amount), tracing.BalanceIncreaseWithdrawal)
if isEIP4762 {
statedb.AccessEvents().AddAccount(w.Address, true, stdmath.MaxUint64)
}
} }
// Gather the execution-layer triggered requests. // Gather the execution-layer triggered requests.
@ -408,8 +374,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
execRs.Requests = requests execRs.Requests = requests
} }
// Re-create statedb instance with new root upon the updated database // Re-create statedb instance with new root for MPT mode
// for accessing latest states.
statedb, err = state.New(root, statedb.Database()) statedb, err = state.New(root, statedb.Database())
if err != nil { if err != nil {
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not reopen state: %v", err)) return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not reopen state: %v", err))
@ -418,12 +383,20 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
return statedb, execRs, body, nil return statedb, execRs, body, nil
} }
func MakePreState(db ethdb.Database, accounts types.GenesisAlloc) *state.StateDB { func MakePreState(db ethdb.Database, accounts types.GenesisAlloc, isBintrie bool) *state.StateDB {
tdb := triedb.NewDatabase(db, &triedb.Config{Preimages: true}) tdb := triedb.NewDatabase(db, &triedb.Config{Preimages: true, IsVerkle: isBintrie})
sdb := state.NewDatabase(tdb, nil) sdb := state.NewDatabase(tdb, nil)
statedb, _ := state.New(types.EmptyRootHash, sdb)
root := types.EmptyRootHash
if isBintrie {
root = types.EmptyBinaryHash
}
statedb, err := state.New(root, sdb)
if err != nil {
panic(fmt.Errorf("failed to create initial statedb: %v", err))
}
for addr, a := range accounts { for addr, a := range accounts {
statedb.SetCode(addr, a.Code) statedb.SetCode(addr, a.Code, tracing.CodeChangeUnspecified)
statedb.SetNonce(addr, a.Nonce, tracing.NonceChangeGenesis) statedb.SetNonce(addr, a.Nonce, tracing.NonceChangeGenesis)
statedb.SetBalance(addr, uint256.MustFromBig(a.Balance), tracing.BalanceIncreaseGenesisBalance) statedb.SetBalance(addr, uint256.MustFromBig(a.Balance), tracing.BalanceIncreaseGenesisBalance)
for k, v := range a.Storage { for k, v := range a.Storage {
@ -431,13 +404,24 @@ func MakePreState(db ethdb.Database, accounts types.GenesisAlloc) *state.StateDB
} }
} }
// Commit and re-open to start with a clean state. // Commit and re-open to start with a clean state.
root, _ := statedb.Commit(0, false, false) root, err = statedb.Commit(0, false, false)
statedb, _ = state.New(root, sdb) if err != nil {
panic(fmt.Errorf("failed to commit initial state: %v", err))
}
// If bintrie mode started, check if conversion happened
if isBintrie {
return statedb
}
// For MPT mode, reopen the state with the committed root
statedb, err = state.New(root, sdb)
if err != nil {
panic(fmt.Errorf("failed to reopen state after commit: %v", err))
}
return statedb return statedb
} }
func rlpHash(x interface{}) (h common.Hash) { func rlpHash(x any) (h common.Hash) {
hw := sha3.NewLegacyKeccak256() hw := keccak.NewLegacyKeccak256()
rlp.Encode(hw, x) rlp.Encode(hw, x)
hw.Sum(h[:0]) hw.Sum(h[:0])
return h return h

View file

@ -56,27 +56,35 @@ func (l *fileWritingTracer) Write(p []byte) (n int, err error) {
return n, nil return n, nil
} }
// newFileWriter creates a set of hooks which wraps inner hooks (typically a logger), // newFileWriter creates a tracer which wraps inner hooks (typically a logger),
// and writes the output to a file, one file per transaction. // and writes the output to a file, one file per transaction.
func newFileWriter(baseDir string, innerFn func(out io.Writer) *tracing.Hooks) *tracing.Hooks { func newFileWriter(baseDir string, innerFn func(out io.Writer) *tracing.Hooks) *tracers.Tracer {
t := &fileWritingTracer{ t := &fileWritingTracer{
baseDir: baseDir, baseDir: baseDir,
suffix: "jsonl", suffix: "jsonl",
} }
t.inner = innerFn(t) // instantiate the inner tracer t.inner = innerFn(t) // instantiate the inner tracer
return t.hooks() return &tracers.Tracer{
Hooks: t.hooks(),
GetResult: func() (json.RawMessage, error) { return json.RawMessage("{}"), nil },
Stop: func(err error) {},
}
} }
// newResultWriter creates a set of hooks wraps and invokes an underlying tracer, // newResultWriter creates a tracer that wraps and invokes an underlying tracer,
// and writes the result (getResult-output) to file, one per transaction. // and writes the result (getResult-output) to file, one per transaction.
func newResultWriter(baseDir string, tracer *tracers.Tracer) *tracing.Hooks { func newResultWriter(baseDir string, tracer *tracers.Tracer) *tracers.Tracer {
t := &fileWritingTracer{ t := &fileWritingTracer{
baseDir: baseDir, baseDir: baseDir,
getResult: tracer.GetResult, getResult: tracer.GetResult,
inner: tracer.Hooks, inner: tracer.Hooks,
suffix: "json", suffix: "json",
} }
return t.hooks() return &tracers.Tracer{
Hooks: t.hooks(),
GetResult: func() (json.RawMessage, error) { return json.RawMessage("{}"), nil },
Stop: func(err error) {},
}
} }
// OnTxStart creates a new output-file specific for this transaction, and invokes // OnTxStart creates a new output-file specific for this transaction, and invokes

View file

@ -88,6 +88,14 @@ var (
"\t<file> - into the file <file> ", "\t<file> - into the file <file> ",
Value: "block.json", Value: "block.json",
} }
OutputBTFlag = &cli.StringFlag{
Name: "output.vkt",
Usage: "Determines where to put the `BT` of the post-state.\n" +
"\t`stdout` - into the stdout output\n" +
"\t`stderr` - into the stderr output\n" +
"\t<file> - into the file <file> ",
Value: "vkt.json",
}
InputAllocFlag = &cli.StringFlag{ InputAllocFlag = &cli.StringFlag{
Name: "input.alloc", Name: "input.alloc",
Usage: "`stdin` or file name of where to find the prestate alloc to use.", Usage: "`stdin` or file name of where to find the prestate alloc to use.",
@ -123,6 +131,11 @@ var (
Usage: "`stdin` or file name of where to find the transactions list in RLP form.", Usage: "`stdin` or file name of where to find the transactions list in RLP form.",
Value: "txs.rlp", Value: "txs.rlp",
} }
// TODO(@CPerezz): rename `Name` of the file in a follow-up PR (relays on EEST -> https://github.com/ethereum/execution-spec-tests/tree/verkle/main)
InputBTFlag = &cli.StringFlag{
Name: "input.vkt",
Usage: "`stdin` or file name of where to find the prestate BT.",
}
SealCliqueFlag = &cli.StringFlag{ SealCliqueFlag = &cli.StringFlag{
Name: "seal.clique", Name: "seal.clique",
Usage: "Seal block with Clique. `stdin` or file name of where to find the Clique sealing data.", Usage: "Seal block with Clique. `stdin` or file name of where to find the Clique sealing data.",
@ -149,6 +162,11 @@ var (
strings.Join(vm.ActivateableEips(), ", ")), strings.Join(vm.ActivateableEips(), ", ")),
Value: "GrayGlacier", Value: "GrayGlacier",
} }
OpcodeCountFlag = &cli.StringFlag{
Name: "opcode.count",
Usage: "If set, opcode execution counts will be written to this file (relative to output.basedir).",
Value: "",
}
VerbosityFlag = &cli.IntFlag{ VerbosityFlag = &cli.IntFlag{
Name: "verbosity", Name: "verbosity",
Usage: "sets the verbosity level", Usage: "sets the verbosity level",

View file

@ -38,6 +38,7 @@ func (h header) MarshalJSON() ([]byte, error) {
BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed" rlp:"optional"` BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed" rlp:"optional"`
ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas" rlp:"optional"` ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas" rlp:"optional"`
ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"`
SlotNumber *math.HexOrDecimal64 `json:"slotNumber" rlp:"optional"`
} }
var enc header var enc header
enc.ParentHash = h.ParentHash enc.ParentHash = h.ParentHash
@ -60,6 +61,7 @@ func (h header) MarshalJSON() ([]byte, error) {
enc.BlobGasUsed = (*math.HexOrDecimal64)(h.BlobGasUsed) enc.BlobGasUsed = (*math.HexOrDecimal64)(h.BlobGasUsed)
enc.ExcessBlobGas = (*math.HexOrDecimal64)(h.ExcessBlobGas) enc.ExcessBlobGas = (*math.HexOrDecimal64)(h.ExcessBlobGas)
enc.ParentBeaconBlockRoot = h.ParentBeaconBlockRoot enc.ParentBeaconBlockRoot = h.ParentBeaconBlockRoot
enc.SlotNumber = (*math.HexOrDecimal64)(h.SlotNumber)
return json.Marshal(&enc) return json.Marshal(&enc)
} }
@ -86,6 +88,7 @@ func (h *header) UnmarshalJSON(input []byte) error {
BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed" rlp:"optional"` BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed" rlp:"optional"`
ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas" rlp:"optional"` ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas" rlp:"optional"`
ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"`
SlotNumber *math.HexOrDecimal64 `json:"slotNumber" rlp:"optional"`
} }
var dec header var dec header
if err := json.Unmarshal(input, &dec); err != nil { if err := json.Unmarshal(input, &dec); err != nil {
@ -155,5 +158,8 @@ func (h *header) UnmarshalJSON(input []byte) error {
if dec.ParentBeaconBlockRoot != nil { if dec.ParentBeaconBlockRoot != nil {
h.ParentBeaconBlockRoot = dec.ParentBeaconBlockRoot h.ParentBeaconBlockRoot = dec.ParentBeaconBlockRoot
} }
if dec.SlotNumber != nil {
h.SlotNumber = (*uint64)(dec.SlotNumber)
}
return nil return nil
} }

View file

@ -37,6 +37,7 @@ func (s stEnv) MarshalJSON() ([]byte, error) {
ParentExcessBlobGas *math.HexOrDecimal64 `json:"parentExcessBlobGas,omitempty"` ParentExcessBlobGas *math.HexOrDecimal64 `json:"parentExcessBlobGas,omitempty"`
ParentBlobGasUsed *math.HexOrDecimal64 `json:"parentBlobGasUsed,omitempty"` ParentBlobGasUsed *math.HexOrDecimal64 `json:"parentBlobGasUsed,omitempty"`
ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"`
SlotNumber *math.HexOrDecimal64 `json:"slotNumber"`
} }
var enc stEnv var enc stEnv
enc.Coinbase = common.UnprefixedAddress(s.Coinbase) enc.Coinbase = common.UnprefixedAddress(s.Coinbase)
@ -59,6 +60,7 @@ func (s stEnv) MarshalJSON() ([]byte, error) {
enc.ParentExcessBlobGas = (*math.HexOrDecimal64)(s.ParentExcessBlobGas) enc.ParentExcessBlobGas = (*math.HexOrDecimal64)(s.ParentExcessBlobGas)
enc.ParentBlobGasUsed = (*math.HexOrDecimal64)(s.ParentBlobGasUsed) enc.ParentBlobGasUsed = (*math.HexOrDecimal64)(s.ParentBlobGasUsed)
enc.ParentBeaconBlockRoot = s.ParentBeaconBlockRoot enc.ParentBeaconBlockRoot = s.ParentBeaconBlockRoot
enc.SlotNumber = (*math.HexOrDecimal64)(s.SlotNumber)
return json.Marshal(&enc) return json.Marshal(&enc)
} }
@ -85,6 +87,7 @@ func (s *stEnv) UnmarshalJSON(input []byte) error {
ParentExcessBlobGas *math.HexOrDecimal64 `json:"parentExcessBlobGas,omitempty"` ParentExcessBlobGas *math.HexOrDecimal64 `json:"parentExcessBlobGas,omitempty"`
ParentBlobGasUsed *math.HexOrDecimal64 `json:"parentBlobGasUsed,omitempty"` ParentBlobGasUsed *math.HexOrDecimal64 `json:"parentBlobGasUsed,omitempty"`
ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"` ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot"`
SlotNumber *math.HexOrDecimal64 `json:"slotNumber"`
} }
var dec stEnv var dec stEnv
if err := json.Unmarshal(input, &dec); err != nil { if err := json.Unmarshal(input, &dec); err != nil {
@ -154,5 +157,8 @@ func (s *stEnv) UnmarshalJSON(input []byte) error {
if dec.ParentBeaconBlockRoot != nil { if dec.ParentBeaconBlockRoot != nil {
s.ParentBeaconBlockRoot = dec.ParentBeaconBlockRoot s.ParentBeaconBlockRoot = dec.ParentBeaconBlockRoot
} }
if dec.SlotNumber != nil {
s.SlotNumber = (*uint64)(dec.SlotNumber)
}
return nil return nil
} }

View file

@ -115,9 +115,6 @@ func Transaction(ctx *cli.Context) error {
} }
var results []result var results []result
for it.Next() { for it.Next() {
if err := it.Err(); err != nil {
return NewError(ErrorIO, err)
}
var tx types.Transaction var tx types.Transaction
err := rlp.DecodeBytes(it.Value(), &tx) err := rlp.DecodeBytes(it.Value(), &tx)
if err != nil { if err != nil {
@ -183,8 +180,15 @@ func Transaction(ctx *cli.Context) error {
if chainConfig.IsShanghai(new(big.Int), 0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize { if chainConfig.IsShanghai(new(big.Int), 0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
r.Error = errors.New("max initcode size exceeded") r.Error = errors.New("max initcode size exceeded")
} }
if chainConfig.IsOsaka(new(big.Int), 0) && tx.Gas() > params.MaxTxGas {
r.Error = errors.New("gas limit exceeds maximum")
}
results = append(results, r) results = append(results, r)
} }
if err := it.Err(); err != nil {
return NewError(ErrorIO, err)
}
out, err := json.MarshalIndent(results, "", " ") out, err := json.MarshalIndent(results, "", " ")
fmt.Println(string(out)) fmt.Println(string(out))
return err return err

View file

@ -28,15 +28,23 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/consensus/misc/eip1559" "github.com/ethereum/go-ethereum/consensus/misc/eip1559"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/tracers" "github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/eth/tracers/logger" "github.com/ethereum/go-ethereum/eth/tracers/logger"
"github.com/ethereum/go-ethereum/eth/tracers/native"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/tests" "github.com/ethereum/go-ethereum/tests"
"github.com/ethereum/go-ethereum/trie/bintrie"
"github.com/ethereum/go-ethereum/triedb"
"github.com/ethereum/go-ethereum/triedb/database"
"github.com/holiman/uint256"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@ -75,10 +83,11 @@ var (
) )
type input struct { type input struct {
Alloc types.GenesisAlloc `json:"alloc,omitempty"` Alloc types.GenesisAlloc `json:"alloc,omitempty"`
Env *stEnv `json:"env,omitempty"` Env *stEnv `json:"env,omitempty"`
Txs []*txWithKey `json:"txs,omitempty"` BT map[common.Hash]hexutil.Bytes `json:"vkt,omitempty"`
TxRlp string `json:"txsRlp,omitempty"` Txs []*txWithKey `json:"txs,omitempty"`
TxRlp string `json:"txsRlp,omitempty"`
} }
func Transition(ctx *cli.Context) error { func Transition(ctx *cli.Context) error {
@ -90,16 +99,16 @@ func Transition(ctx *cli.Context) error {
// stdin input or in files. // stdin input or in files.
// Check if anything needs to be read from stdin // Check if anything needs to be read from stdin
var ( var (
prestate Prestate prestate Prestate
txIt txIterator // txs to apply txIt txIterator // txs to apply
allocStr = ctx.String(InputAllocFlag.Name) allocStr = ctx.String(InputAllocFlag.Name)
btStr = ctx.String(InputBTFlag.Name)
envStr = ctx.String(InputEnvFlag.Name) envStr = ctx.String(InputEnvFlag.Name)
txStr = ctx.String(InputTxsFlag.Name) txStr = ctx.String(InputTxsFlag.Name)
inputData = &input{} inputData = &input{}
) )
// Figure out the prestate alloc // Figure out the prestate alloc
if allocStr == stdinSelector || envStr == stdinSelector || txStr == stdinSelector { if allocStr == stdinSelector || btStr == stdinSelector || envStr == stdinSelector || txStr == stdinSelector {
decoder := json.NewDecoder(os.Stdin) decoder := json.NewDecoder(os.Stdin)
if err := decoder.Decode(inputData); err != nil { if err := decoder.Decode(inputData); err != nil {
return NewError(ErrorJson, fmt.Errorf("failed unmarshalling stdin: %v", err)) return NewError(ErrorJson, fmt.Errorf("failed unmarshalling stdin: %v", err))
@ -112,6 +121,13 @@ func Transition(ctx *cli.Context) error {
} }
prestate.Pre = inputData.Alloc prestate.Pre = inputData.Alloc
if btStr != stdinSelector && btStr != "" {
if err := readFile(btStr, "BT", &inputData.BT); err != nil {
return err
}
}
prestate.TreeLeaves = inputData.BT
// Set the block environment // Set the block environment
if envStr != stdinSelector { if envStr != stdinSelector {
var env stEnv var env stEnv
@ -152,14 +168,15 @@ func Transition(ctx *cli.Context) error {
} }
// Configure tracer // Configure tracer
var tracer *tracers.Tracer
if ctx.IsSet(TraceTracerFlag.Name) { // Custom tracing if ctx.IsSet(TraceTracerFlag.Name) { // Custom tracing
config := json.RawMessage(ctx.String(TraceTracerConfigFlag.Name)) config := json.RawMessage(ctx.String(TraceTracerConfigFlag.Name))
tracer, err := tracers.DefaultDirectory.New(ctx.String(TraceTracerFlag.Name), innerTracer, err := tracers.DefaultDirectory.New(ctx.String(TraceTracerFlag.Name),
nil, config, chainConfig) nil, config, chainConfig)
if err != nil { if err != nil {
return NewError(ErrorConfig, fmt.Errorf("failed instantiating tracer: %v", err)) return NewError(ErrorConfig, fmt.Errorf("failed instantiating tracer: %v", err))
} }
vmConfig.Tracer = newResultWriter(baseDir, tracer) tracer = newResultWriter(baseDir, innerTracer)
} else if ctx.Bool(TraceFlag.Name) { // JSON opcode tracing } else if ctx.Bool(TraceFlag.Name) { // JSON opcode tracing
logConfig := &logger.Config{ logConfig := &logger.Config{
DisableStack: ctx.Bool(TraceDisableStackFlag.Name), DisableStack: ctx.Bool(TraceDisableStackFlag.Name),
@ -167,24 +184,61 @@ func Transition(ctx *cli.Context) error {
EnableReturnData: ctx.Bool(TraceEnableReturnDataFlag.Name), EnableReturnData: ctx.Bool(TraceEnableReturnDataFlag.Name),
} }
if ctx.Bool(TraceEnableCallFramesFlag.Name) { if ctx.Bool(TraceEnableCallFramesFlag.Name) {
vmConfig.Tracer = newFileWriter(baseDir, func(out io.Writer) *tracing.Hooks { tracer = newFileWriter(baseDir, func(out io.Writer) *tracing.Hooks {
return logger.NewJSONLoggerWithCallFrames(logConfig, out) return logger.NewJSONLoggerWithCallFrames(logConfig, out)
}) })
} else { } else {
vmConfig.Tracer = newFileWriter(baseDir, func(out io.Writer) *tracing.Hooks { tracer = newFileWriter(baseDir, func(out io.Writer) *tracing.Hooks {
return logger.NewJSONLogger(logConfig, out) return logger.NewJSONLogger(logConfig, out)
}) })
} }
} }
// Configure opcode counter
var opcodeTracer *tracers.Tracer
if ctx.IsSet(OpcodeCountFlag.Name) && ctx.String(OpcodeCountFlag.Name) != "" {
opcodeTracer = native.NewOpcodeCounter()
if tracer != nil {
// If we have an existing tracer, multiplex with the opcode tracer
mux, _ := native.NewMuxTracer([]string{"trace", "opcode"}, []*tracers.Tracer{tracer, opcodeTracer})
vmConfig.Tracer = mux.Hooks
} else {
vmConfig.Tracer = opcodeTracer.Hooks
}
} else if tracer != nil {
vmConfig.Tracer = tracer.Hooks
}
// Run the test and aggregate the result // Run the test and aggregate the result
s, result, body, err := prestate.Apply(vmConfig, chainConfig, txIt, ctx.Int64(RewardFlag.Name)) s, result, body, err := prestate.Apply(vmConfig, chainConfig, txIt, ctx.Int64(RewardFlag.Name))
if err != nil { if err != nil {
return err return err
} }
// Write opcode counts if enabled
if opcodeTracer != nil {
fname := ctx.String(OpcodeCountFlag.Name)
result, err := opcodeTracer.GetResult()
if err != nil {
return NewError(ErrorJson, fmt.Errorf("failed getting opcode counts: %v", err))
}
if err := saveFile(baseDir, fname, result); err != nil {
return err
}
}
// Dump the execution result // Dump the execution result
collector := make(Alloc) var (
s.DumpToCollector(collector, nil) collector = make(Alloc)
return dispatchOutput(ctx, baseDir, result, collector, body) btleaves map[common.Hash]hexutil.Bytes
)
isBinary := chainConfig.IsVerkle(big.NewInt(int64(prestate.Env.Number)), prestate.Env.Timestamp)
if !isBinary {
s.DumpToCollector(collector, nil)
} else {
btleaves = make(map[common.Hash]hexutil.Bytes)
if err := s.DumpBinTrieLeaves(btleaves); err != nil {
return err
}
}
return dispatchOutput(ctx, baseDir, result, collector, body, btleaves)
} }
func applyLondonChecks(env *stEnv, chainConfig *params.ChainConfig) error { func applyLondonChecks(env *stEnv, chainConfig *params.ChainConfig) error {
@ -306,7 +360,7 @@ func saveFile(baseDir, filename string, data interface{}) error {
// dispatchOutput writes the output data to either stderr or stdout, or to the specified // dispatchOutput writes the output data to either stderr or stdout, or to the specified
// files // files
func dispatchOutput(ctx *cli.Context, baseDir string, result *ExecutionResult, alloc Alloc, body hexutil.Bytes) error { func dispatchOutput(ctx *cli.Context, baseDir string, result *ExecutionResult, alloc Alloc, body hexutil.Bytes, bt map[common.Hash]hexutil.Bytes) error {
stdOutObject := make(map[string]interface{}) stdOutObject := make(map[string]interface{})
stdErrObject := make(map[string]interface{}) stdErrObject := make(map[string]interface{})
dispatch := func(baseDir, fName, name string, obj interface{}) error { dispatch := func(baseDir, fName, name string, obj interface{}) error {
@ -333,6 +387,13 @@ func dispatchOutput(ctx *cli.Context, baseDir string, result *ExecutionResult, a
if err := dispatch(baseDir, ctx.String(OutputBodyFlag.Name), "body", body); err != nil { if err := dispatch(baseDir, ctx.String(OutputBodyFlag.Name), "body", body); err != nil {
return err return err
} }
// Only write bt output if we actually have binary trie leaves
if bt != nil {
if err := dispatch(baseDir, ctx.String(OutputBTFlag.Name), "vkt", bt); err != nil {
return err
}
}
if len(stdOutObject) > 0 { if len(stdOutObject) > 0 {
b, err := json.MarshalIndent(stdOutObject, "", " ") b, err := json.MarshalIndent(stdOutObject, "", " ")
if err != nil { if err != nil {
@ -351,3 +412,168 @@ func dispatchOutput(ctx *cli.Context, baseDir string, result *ExecutionResult, a
} }
return nil return nil
} }
// BinKey computes the tree key given an address and an optional slot number.
func BinKey(ctx *cli.Context) error {
if ctx.Args().Len() == 0 || ctx.Args().Len() > 2 {
return errors.New("invalid number of arguments: expecting an address and an optional slot number")
}
addr, err := hexutil.Decode(ctx.Args().Get(0))
if err != nil {
return fmt.Errorf("error decoding address: %w", err)
}
if ctx.Args().Len() == 2 {
slot, err := hexutil.Decode(ctx.Args().Get(1))
if err != nil {
return fmt.Errorf("error decoding slot: %w", err)
}
fmt.Printf("%#x\n", bintrie.GetBinaryTreeKeyStorageSlot(common.BytesToAddress(addr), slot))
} else {
fmt.Printf("%#x\n", bintrie.GetBinaryTreeKeyBasicData(common.BytesToAddress(addr)))
}
return nil
}
// BinKeys computes a set of tree keys given a genesis alloc.
func BinKeys(ctx *cli.Context) error {
var allocStr = ctx.String(InputAllocFlag.Name)
var alloc core.GenesisAlloc
// Figure out the prestate alloc
if allocStr == stdinSelector {
decoder := json.NewDecoder(os.Stdin)
if err := decoder.Decode(&alloc); err != nil {
return NewError(ErrorJson, fmt.Errorf("failed unmarshaling stdin: %v", err))
}
}
if allocStr != stdinSelector {
if err := readFile(allocStr, "alloc", &alloc); err != nil {
return err
}
}
db := triedb.NewDatabase(rawdb.NewMemoryDatabase(), triedb.VerkleDefaults)
defer db.Close()
bt, err := genBinTrieFromAlloc(alloc, db)
if err != nil {
return fmt.Errorf("error generating bt: %w", err)
}
collector := make(map[common.Hash]hexutil.Bytes)
it, err := bt.NodeIterator(nil)
if err != nil {
panic(err)
}
for it.Next(true) {
if it.Leaf() {
collector[common.BytesToHash(it.LeafKey())] = it.LeafBlob()
}
}
output, err := json.MarshalIndent(collector, "", "")
if err != nil {
return fmt.Errorf("error outputting tree: %w", err)
}
fmt.Println(string(output))
return nil
}
// BinTrieRoot computes the root of a Binary Trie from a genesis alloc.
func BinTrieRoot(ctx *cli.Context) error {
var allocStr = ctx.String(InputAllocFlag.Name)
var alloc core.GenesisAlloc
if allocStr == stdinSelector {
decoder := json.NewDecoder(os.Stdin)
if err := decoder.Decode(&alloc); err != nil {
return NewError(ErrorJson, fmt.Errorf("failed unmarshaling stdin: %v", err))
}
}
if allocStr != stdinSelector {
if err := readFile(allocStr, "alloc", &alloc); err != nil {
return err
}
}
db := triedb.NewDatabase(rawdb.NewMemoryDatabase(), triedb.VerkleDefaults)
defer db.Close()
bt, err := genBinTrieFromAlloc(alloc, db)
if err != nil {
return fmt.Errorf("error generating bt: %w", err)
}
fmt.Println(bt.Hash().Hex())
return nil
}
// TODO(@CPerezz): Should this go to `bintrie` module?
func genBinTrieFromAlloc(alloc core.GenesisAlloc, db database.NodeDatabase) (*bintrie.BinaryTrie, error) {
bt, err := bintrie.NewBinaryTrie(types.EmptyBinaryHash, db)
if err != nil {
return nil, err
}
for addr, acc := range alloc {
for slot, value := range acc.Storage {
err := bt.UpdateStorage(addr, slot.Bytes(), value.Big().Bytes())
if err != nil {
return nil, fmt.Errorf("error inserting storage: %w", err)
}
}
account := &types.StateAccount{
Balance: uint256.MustFromBig(acc.Balance),
Nonce: acc.Nonce,
CodeHash: crypto.Keccak256Hash(acc.Code).Bytes(),
Root: common.Hash{},
}
err := bt.UpdateAccount(addr, account, len(acc.Code))
if err != nil {
return nil, fmt.Errorf("error inserting account: %w", err)
}
err = bt.UpdateContractCode(addr, common.BytesToHash(account.CodeHash), acc.Code)
if err != nil {
return nil, fmt.Errorf("error inserting code: %w", err)
}
}
return bt, nil
}
// BinaryCodeChunkKey computes the tree key of a code-chunk for a given address.
func BinaryCodeChunkKey(ctx *cli.Context) error {
if ctx.Args().Len() == 0 || ctx.Args().Len() > 2 {
return errors.New("invalid number of arguments: expecting an address and an code-chunk number")
}
addr, err := hexutil.Decode(ctx.Args().Get(0))
if err != nil {
return fmt.Errorf("error decoding address: %w", err)
}
chunkNumberBytes, err := hexutil.Decode(ctx.Args().Get(1))
if err != nil {
return fmt.Errorf("error decoding chunk number: %w", err)
}
var chunkNumber uint256.Int
chunkNumber.SetBytes(chunkNumberBytes)
fmt.Printf("%#x\n", bintrie.GetBinaryTreeKeyCodeChunk(common.BytesToAddress(addr), &chunkNumber))
return nil
}
// BinaryCodeChunkCode returns the code chunkification for a given code.
func BinaryCodeChunkCode(ctx *cli.Context) error {
if ctx.Args().Len() == 0 || ctx.Args().Len() > 1 {
return errors.New("invalid number of arguments: expecting a bytecode")
}
bytecode, err := hexutil.Decode(ctx.Args().Get(0))
if err != nil {
return fmt.Errorf("error decoding address: %w", err)
}
chunkedCode := bintrie.ChunkifyCode(bytecode)
fmt.Printf("%#x\n", chunkedCode)
return nil
}

View file

@ -55,6 +55,11 @@ var (
Usage: "benchmark the execution", Usage: "benchmark the execution",
Category: flags.VMCategory, Category: flags.VMCategory,
} }
FuzzFlag = &cli.BoolFlag{
Name: "fuzz",
Usage: "adapts output format for fuzzing",
Category: flags.VMCategory,
}
WitnessCrossCheckFlag = &cli.BoolFlag{ WitnessCrossCheckFlag = &cli.BoolFlag{
Name: "cross-check", Name: "cross-check",
Aliases: []string{"xc"}, Aliases: []string{"xc"},
@ -146,16 +151,64 @@ var (
t8ntool.TraceEnableCallFramesFlag, t8ntool.TraceEnableCallFramesFlag,
t8ntool.OutputBasedir, t8ntool.OutputBasedir,
t8ntool.OutputAllocFlag, t8ntool.OutputAllocFlag,
t8ntool.OutputBTFlag,
t8ntool.OutputResultFlag, t8ntool.OutputResultFlag,
t8ntool.OutputBodyFlag, t8ntool.OutputBodyFlag,
t8ntool.InputAllocFlag, t8ntool.InputAllocFlag,
t8ntool.InputEnvFlag, t8ntool.InputEnvFlag,
t8ntool.InputBTFlag,
t8ntool.InputTxsFlag, t8ntool.InputTxsFlag,
t8ntool.ForknameFlag, t8ntool.ForknameFlag,
t8ntool.ChainIDFlag, t8ntool.ChainIDFlag,
t8ntool.RewardFlag, t8ntool.RewardFlag,
t8ntool.OpcodeCountFlag,
}, },
} }
verkleCommand = &cli.Command{
Name: "verkle",
Aliases: []string{"vkt"},
Usage: "Binary Trie helpers",
Subcommands: []*cli.Command{
{
Name: "tree-keys",
Aliases: []string{"v"},
Usage: "compute a set of binary trie keys, given their source addresses and optional slot numbers",
Action: t8ntool.BinKeys,
Flags: []cli.Flag{
t8ntool.InputAllocFlag,
},
},
{
Name: "single-key",
Aliases: []string{"vk"},
Usage: "compute the binary trie key given an address and optional slot number",
Action: t8ntool.BinKey,
},
{
Name: "code-chunk-key",
Aliases: []string{"vck"},
Usage: "compute the binary trie key given an address and chunk number",
Action: t8ntool.BinaryCodeChunkKey,
},
{
Name: "chunkify-code",
Aliases: []string{"vcc"},
Usage: "chunkify a given bytecode for a binary trie",
Action: t8ntool.BinaryCodeChunkCode,
},
{
Name: "state-root",
Aliases: []string{"vsr"},
Usage: "compute the state-root of a binary trie for the given alloc",
Action: t8ntool.BinTrieRoot,
Flags: []cli.Flag{
t8ntool.InputAllocFlag,
},
},
},
}
transactionCommand = &cli.Command{ transactionCommand = &cli.Command{
Name: "transaction", Name: "transaction",
Aliases: []string{"t9n"}, Aliases: []string{"t9n"},
@ -210,6 +263,7 @@ func init() {
stateTransitionCommand, stateTransitionCommand,
transactionCommand, transactionCommand,
blockBuilderCommand, blockBuilderCommand,
verkleCommand,
} }
app.Before = func(ctx *cli.Context) error { app.Before = func(ctx *cli.Context) error {
flags.MigrateGlobalFlags(ctx) flags.MigrateGlobalFlags(ctx)

View file

@ -322,7 +322,7 @@ func runCmd(ctx *cli.Context) error {
} }
} else { } else {
if len(code) > 0 { if len(code) > 0 {
prestate.SetCode(receiver, code) prestate.SetCode(receiver, code, tracing.CodeChangeUnspecified)
} }
execFunc = func() ([]byte, uint64, error) { execFunc = func() ([]byte, uint64, error) {
// don't mutate the state! // don't mutate the state!

View file

@ -296,6 +296,14 @@ func TestT8n(t *testing.T) {
output: t8nOutput{alloc: true, result: true}, output: t8nOutput{alloc: true, result: true},
expOut: "exp.json", expOut: "exp.json",
}, },
{ // Osaka test, EIP-7918 blob gas with parent base fee
base: "./testdata/34",
input: t8nInput{
"alloc.json", "txs.json", "env.json", "Osaka", "",
},
output: t8nOutput{alloc: true, result: true},
expOut: "exp.json",
},
} { } {
args := []string{"t8n"} args := []string{"t8n"}
args = append(args, tc.output.get()...) args = append(args, tc.output.get()...)

View file

@ -24,12 +24,13 @@
"status": "0x1", "status": "0x1",
"cumulativeGasUsed": "0x5208", "cumulativeGasUsed": "0x5208",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null, "logs": [],
"transactionHash": "0x0557bacce3375c98d806609b8d5043072f0b6a8bae45ae5a67a00d3a1a18d673", "transactionHash": "0x0557bacce3375c98d806609b8d5043072f0b6a8bae45ae5a67a00d3a1a18d673",
"contractAddress": "0x0000000000000000000000000000000000000000", "contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x5208", "gasUsed": "0x5208",
"effectiveGasPrice": null, "effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x1337000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x1",
"transactionIndex": "0x0" "transactionIndex": "0x0"
} }
], ],

View file

@ -12,12 +12,13 @@
"status": "0x0", "status": "0x0",
"cumulativeGasUsed": "0x84d0", "cumulativeGasUsed": "0x84d0",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null, "logs": [],
"transactionHash": "0xa98a24882ea90916c6a86da650fbc6b14238e46f0af04a131ce92be897507476", "transactionHash": "0xa98a24882ea90916c6a86da650fbc6b14238e46f0af04a131ce92be897507476",
"contractAddress": "0x0000000000000000000000000000000000000000", "contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x84d0", "gasUsed": "0x84d0",
"effectiveGasPrice": null, "effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x1337000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x1",
"transactionIndex": "0x0" "transactionIndex": "0x0"
}, },
{ {
@ -26,12 +27,13 @@
"status": "0x0", "status": "0x0",
"cumulativeGasUsed": "0x109a0", "cumulativeGasUsed": "0x109a0",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null, "logs": [],
"transactionHash": "0x36bad80acce7040c45fd32764b5c2b2d2e6f778669fb41791f73f546d56e739a", "transactionHash": "0x36bad80acce7040c45fd32764b5c2b2d2e6f778669fb41791f73f546d56e739a",
"contractAddress": "0x0000000000000000000000000000000000000000", "contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x84d0", "gasUsed": "0x84d0",
"effectiveGasPrice": null, "effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x1337000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x1",
"transactionIndex": "0x1" "transactionIndex": "0x1"
} }
], ],

View file

@ -11,12 +11,13 @@
"status": "0x1", "status": "0x1",
"cumulativeGasUsed": "0x520b", "cumulativeGasUsed": "0x520b",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null, "logs": [],
"transactionHash": "0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81", "transactionHash": "0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81",
"contractAddress": "0x0000000000000000000000000000000000000000", "contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x520b", "gasUsed": "0x520b",
"effectiveGasPrice": null, "effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x1337000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x5",
"transactionIndex": "0x0" "transactionIndex": "0x0"
} }
], ],

View file

@ -27,12 +27,13 @@
"status": "0x1", "status": "0x1",
"cumulativeGasUsed": "0xa861", "cumulativeGasUsed": "0xa861",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null, "logs": [],
"transactionHash": "0x92ea4a28224d033afb20e0cc2b290d4c7c2d61f6a4800a680e4e19ac962ee941", "transactionHash": "0x92ea4a28224d033afb20e0cc2b290d4c7c2d61f6a4800a680e4e19ac962ee941",
"contractAddress": "0x0000000000000000000000000000000000000000", "contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0xa861", "gasUsed": "0xa861",
"effectiveGasPrice": null, "effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x1337000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x1",
"transactionIndex": "0x0" "transactionIndex": "0x0"
}, },
{ {
@ -40,12 +41,13 @@
"status": "0x1", "status": "0x1",
"cumulativeGasUsed": "0x10306", "cumulativeGasUsed": "0x10306",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null, "logs": [],
"transactionHash": "0x16b1d912f1d664f3f60f4e1b5f296f3c82a64a1a253117b4851d18bc03c4f1da", "transactionHash": "0x16b1d912f1d664f3f60f4e1b5f296f3c82a64a1a253117b4851d18bc03c4f1da",
"contractAddress": "0x0000000000000000000000000000000000000000", "contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x5aa5", "gasUsed": "0x5aa5",
"effectiveGasPrice": null, "effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x1337000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x1",
"transactionIndex": "0x1" "transactionIndex": "0x1"
} }
], ],

View file

@ -23,12 +23,13 @@
"status": "0x1", "status": "0x1",
"cumulativeGasUsed": "0x5208", "cumulativeGasUsed": "0x5208",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null, "logs": [],
"transactionHash": "0x92ea4a28224d033afb20e0cc2b290d4c7c2d61f6a4800a680e4e19ac962ee941", "transactionHash": "0x92ea4a28224d033afb20e0cc2b290d4c7c2d61f6a4800a680e4e19ac962ee941",
"contractAddress": "0x0000000000000000000000000000000000000000", "contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x5208", "gasUsed": "0x5208",
"effectiveGasPrice": null, "effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x1337000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x1",
"transactionIndex": "0x0" "transactionIndex": "0x0"
} }
], ],

View file

@ -28,12 +28,15 @@
"status": "0x1", "status": "0x1",
"cumulativeGasUsed": "0xa865", "cumulativeGasUsed": "0xa865",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"logs": null, "logs": [],
"transactionHash": "0x7508d7139d002a4b3a26a4f12dec0d87cb46075c78bf77a38b569a133b509262", "transactionHash": "0x7508d7139d002a4b3a26a4f12dec0d87cb46075c78bf77a38b569a133b509262",
"contractAddress": "0x0000000000000000000000000000000000000000", "contractAddress": "0x0000000000000000000000000000000000000000",
"gasUsed": "0xa865", "gasUsed": "0xa865",
"effectiveGasPrice": null, "effectiveGasPrice": null,
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "blobGasUsed": "0x20000",
"blobGasPrice": "0x1",
"blockHash": "0x1337000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x1",
"transactionIndex": "0x0" "transactionIndex": "0x0"
} }
], ],

Some files were not shown because too many files have changed in this diff Show more