Skip to content

Commit bc03b71

Browse files
authored
Merge pull request #161 from blocknative/merge/v1.13.14
Merge/v1.13.14
2 parents 847382e + ca918be commit bc03b71

File tree

165 files changed

+1912
-1237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+1912
-1237
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ jobs:
77
- uses: actions/checkout@v3
88
- uses: actions/setup-go@v3
99
with:
10-
go-version: 1.21.x
10+
go-version: 1.22.x
1111
- name: Test tracers
1212
run: go test -v ./eth/tracers/...

accounts/abi/bind/backends/simulated.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121

2222
"github.com/ethereum/go-ethereum/common"
23-
"github.com/ethereum/go-ethereum/core"
23+
"github.com/ethereum/go-ethereum/core/types"
2424
"github.com/ethereum/go-ethereum/ethclient/simulated"
2525
)
2626

@@ -43,7 +43,7 @@ func (b *SimulatedBackend) Fork(ctx context.Context, parentHash common.Hash) err
4343
//
4444
// Deprecated: please use simulated.Backend from package
4545
// github.com/ethereum/go-ethereum/ethclient/simulated instead.
46-
func NewSimulatedBackend(alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
46+
func NewSimulatedBackend(alloc types.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
4747
b := simulated.NewBackend(alloc, simulated.WithBlockGasLimit(gasLimit))
4848
return &SimulatedBackend{
4949
Backend: b,

accounts/abi/bind/bind_test.go

+50-50
Large diffs are not rendered by default.

accounts/abi/bind/util_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525

2626
"github.com/ethereum/go-ethereum/accounts/abi/bind"
2727
"github.com/ethereum/go-ethereum/common"
28-
"github.com/ethereum/go-ethereum/core"
2928
"github.com/ethereum/go-ethereum/core/types"
3029
"github.com/ethereum/go-ethereum/crypto"
3130
"github.com/ethereum/go-ethereum/ethclient/simulated"
@@ -57,7 +56,7 @@ func TestWaitDeployed(t *testing.T) {
5756
t.Parallel()
5857
for name, test := range waitDeployedTests {
5958
backend := simulated.NewBackend(
60-
core.GenesisAlloc{
59+
types.GenesisAlloc{
6160
crypto.PubkeyToAddress(testKey.PublicKey): {Balance: big.NewInt(10000000000000000)},
6261
},
6362
)
@@ -102,7 +101,7 @@ func TestWaitDeployed(t *testing.T) {
102101

103102
func TestWaitDeployedCornerCases(t *testing.T) {
104103
backend := simulated.NewBackend(
105-
core.GenesisAlloc{
104+
types.GenesisAlloc{
106105
crypto.PubkeyToAddress(testKey.PublicKey): {Balance: big.NewInt(10000000000000000)},
107106
},
108107
)

accounts/usbwallet/trezor/trezor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// This file contains the implementation for interacting with the Trezor hardware
1818
// wallets. The wire protocol spec can be found on the SatoshiLabs website:
19-
// https://wiki.trezor.io/Developers_guide-Message_Workflows
19+
// https://docs.trezor.io/trezor-firmware/common/message-workflows.html
2020

2121
// !!! STAHP !!!
2222
//

beacon/engine/types.go

+18
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,21 @@ type ExecutionPayloadBodyV1 struct {
303303
TransactionData []hexutil.Bytes `json:"transactions"`
304304
Withdrawals []*types.Withdrawal `json:"withdrawals"`
305305
}
306+
307+
// Client identifiers to support ClientVersionV1.
308+
const (
309+
ClientCode = "GE"
310+
ClientName = "go-ethereum"
311+
)
312+
313+
// ClientVersionV1 contains information which identifies a client implementation.
314+
type ClientVersionV1 struct {
315+
Code string `json:"code"`
316+
Name string `json:"clientName"`
317+
Version string `json:"version"`
318+
Commit string `json:"commit"`
319+
}
320+
321+
func (v *ClientVersionV1) String() string {
322+
return fmt.Sprintf("%s-%s-%s-%s", v.Code, v.Name, v.Version, v.Commit)
323+
}

build/checksums.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# This file contains sha256 checksums of optional build dependencies.
22

3-
# version:spec-tests 1.0.6
3+
# version:spec-tests 2.1.0
44
# https://github.com/ethereum/execution-spec-tests/releases
5-
# https://github.com/ethereum/execution-spec-tests/releases/download/v1.0.6/
6-
485af7b66cf41eb3a8c1bd46632913b8eb95995df867cf665617bbc9b4beedd1 fixtures_develop.tar.gz
5+
# https://github.com/ethereum/execution-spec-tests/releases/download/v2.1.0/
6+
ca89c76851b0900bfcc3cbb9a26cbece1f3d7c64a3bed38723e914713290df6c fixtures_develop.tar.gz
77

88
# version:golang 1.21.6
99
# https://go.dev/dl/

build/ci.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,13 @@ var (
121121
// Note: vivid is unsupported because there is no golang-1.6 package for it.
122122
// Note: the following Ubuntu releases have been officially deprecated on Launchpad:
123123
// wily, yakkety, zesty, artful, cosmic, disco, eoan, groovy, hirsuite, impish,
124-
// kinetic
124+
// kinetic, lunar
125125
debDistroGoBoots = map[string]string{
126126
"trusty": "golang-1.11", // 14.04, EOL: 04/2024
127127
"xenial": "golang-go", // 16.04, EOL: 04/2026
128128
"bionic": "golang-go", // 18.04, EOL: 04/2028
129129
"focal": "golang-go", // 20.04, EOL: 04/2030
130130
"jammy": "golang-go", // 22.04, EOL: 04/2032
131-
"lunar": "golang-go", // 23.04, EOL: 01/2024
132131
"mantic": "golang-go", // 23.10, EOL: 07/2024
133132
}
134133

cmd/clef/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ There are a couple of implementation for a UI. We'll try to keep this list up to
916916

917917
| Name | Repo | UI type| No external resources| Blocky support| Verifies permissions | Hash information | No secondary storage | Statically linked| Can modify parameters|
918918
| ---- | ---- | -------| ---- | ---- | ---- |---- | ---- | ---- | ---- |
919-
| QtSigner| https://github.com/holiman/qtsigner/| Python3/QT-based| :+1:| :+1:| :+1:| :+1:| :+1:| :x: | :+1: (partially)|
920-
| GtkSigner| https://github.com/holiman/gtksigner| Python3/GTK-based| :+1:| :x:| :x:| :+1:| :+1:| :x: | :x: |
921-
| Frame | https://github.com/floating/frame/commits/go-signer| Electron-based| :x:| :x:| :x:| :x:| ?| :x: | :x: |
922-
| Clef UI| https://github.com/ethereum/clef-ui| Golang/QT-based| :+1:| :+1:| :x:| :+1:| :+1:| :x: | :+1: (approve tx only)|
919+
| QtSigner| https://github.com/holiman/qtsigner/ | Python3/QT-based| :+1:| :+1:| :+1:| :+1:| :+1:| :x: | :+1: (partially)|
920+
| GtkSigner| https://github.com/holiman/gtksigner | Python3/GTK-based| :+1:| :x:| :x:| :+1:| :+1:| :x: | :x: |
921+
| Frame | https://github.com/floating/frame/commits/go-signer | Electron-based| :x:| :x:| :x:| :x:| ?| :x: | :x: |
922+
| Clef UI| https://github.com/ethereum/clef-ui | Golang/QT-based| :+1:| :+1:| :x:| :+1:| :+1:| :x: | :+1: (approve tx only)|

cmd/devp2p/internal/ethtest/suite.go

+52-42
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ func NewSuite(dest *enode.Node, chainDir, engineURL, jwt string) (*Suite, error)
6464
func (s *Suite) EthTests() []utesting.Test {
6565
return []utesting.Test{
6666
// status
67-
{Name: "TestStatus", Fn: s.TestStatus},
67+
{Name: "Status", Fn: s.TestStatus},
6868
// get block headers
69-
{Name: "TestGetBlockHeaders", Fn: s.TestGetBlockHeaders},
70-
{Name: "TestSimultaneousRequests", Fn: s.TestSimultaneousRequests},
71-
{Name: "TestSameRequestID", Fn: s.TestSameRequestID},
72-
{Name: "TestZeroRequestID", Fn: s.TestZeroRequestID},
69+
{Name: "GetBlockHeaders", Fn: s.TestGetBlockHeaders},
70+
{Name: "SimultaneousRequests", Fn: s.TestSimultaneousRequests},
71+
{Name: "SameRequestID", Fn: s.TestSameRequestID},
72+
{Name: "ZeroRequestID", Fn: s.TestZeroRequestID},
7373
// get block bodies
74-
{Name: "TestGetBlockBodies", Fn: s.TestGetBlockBodies},
74+
{Name: "GetBlockBodies", Fn: s.TestGetBlockBodies},
7575
// // malicious handshakes + status
76-
{Name: "TestMaliciousHandshake", Fn: s.TestMaliciousHandshake},
77-
{Name: "TestMaliciousStatus", Fn: s.TestMaliciousStatus},
76+
{Name: "MaliciousHandshake", Fn: s.TestMaliciousHandshake},
77+
{Name: "MaliciousStatus", Fn: s.TestMaliciousStatus},
7878
// test transactions
79-
{Name: "TestLargeTxRequest", Fn: s.TestLargeTxRequest, Slow: true},
80-
{Name: "TestTransaction", Fn: s.TestTransaction},
81-
{Name: "TestInvalidTxs", Fn: s.TestInvalidTxs},
82-
{Name: "TestNewPooledTxs", Fn: s.TestNewPooledTxs},
83-
{Name: "TestBlobViolations", Fn: s.TestBlobViolations},
79+
{Name: "LargeTxRequest", Fn: s.TestLargeTxRequest, Slow: true},
80+
{Name: "Transaction", Fn: s.TestTransaction},
81+
{Name: "InvalidTxs", Fn: s.TestInvalidTxs},
82+
{Name: "NewPooledTxs", Fn: s.TestNewPooledTxs},
83+
{Name: "BlobViolations", Fn: s.TestBlobViolations},
8484
}
8585
}
8686

@@ -94,9 +94,9 @@ func (s *Suite) SnapTests() []utesting.Test {
9494
}
9595
}
9696

97-
// TestStatus attempts to connect to the given node and exchange a status
98-
// message with it on the eth protocol.
9997
func (s *Suite) TestStatus(t *utesting.T) {
98+
t.Log(`This test is just a sanity check. It performs an eth protocol handshake.`)
99+
100100
conn, err := s.dial()
101101
if err != nil {
102102
t.Fatalf("dial failed: %v", err)
@@ -112,9 +112,9 @@ func headersMatch(expected []*types.Header, headers []*types.Header) bool {
112112
return reflect.DeepEqual(expected, headers)
113113
}
114114

115-
// TestGetBlockHeaders tests whether the given node can respond to an eth
116-
// `GetBlockHeaders` request and that the response is accurate.
117115
func (s *Suite) TestGetBlockHeaders(t *utesting.T) {
116+
t.Log(`This test requests block headers from the node.`)
117+
118118
conn, err := s.dial()
119119
if err != nil {
120120
t.Fatalf("dial failed: %v", err)
@@ -154,10 +154,10 @@ func (s *Suite) TestGetBlockHeaders(t *utesting.T) {
154154
}
155155
}
156156

157-
// TestSimultaneousRequests sends two simultaneous `GetBlockHeader` requests
158-
// from the same connection with different request IDs and checks to make sure
159-
// the node responds with the correct headers per request.
160157
func (s *Suite) TestSimultaneousRequests(t *utesting.T) {
158+
t.Log(`This test requests blocks headers from the node, performing two requests
159+
concurrently, with different request IDs.`)
160+
161161
conn, err := s.dial()
162162
if err != nil {
163163
t.Fatalf("dial failed: %v", err)
@@ -228,9 +228,10 @@ func (s *Suite) TestSimultaneousRequests(t *utesting.T) {
228228
}
229229
}
230230

231-
// TestSameRequestID sends two requests with the same request ID to a single
232-
// node.
233231
func (s *Suite) TestSameRequestID(t *utesting.T) {
232+
t.Log(`This test requests block headers, performing two concurrent requests with the
233+
same request ID. The node should handle the request by responding to both requests.`)
234+
234235
conn, err := s.dial()
235236
if err != nil {
236237
t.Fatalf("dial failed: %v", err)
@@ -298,9 +299,10 @@ func (s *Suite) TestSameRequestID(t *utesting.T) {
298299
}
299300
}
300301

301-
// TestZeroRequestID checks that a message with a request ID of zero is still handled
302-
// by the node.
303302
func (s *Suite) TestZeroRequestID(t *utesting.T) {
303+
t.Log(`This test sends a GetBlockHeaders message with a request-id of zero,
304+
and expects a response.`)
305+
304306
conn, err := s.dial()
305307
if err != nil {
306308
t.Fatalf("dial failed: %v", err)
@@ -333,9 +335,9 @@ func (s *Suite) TestZeroRequestID(t *utesting.T) {
333335
}
334336
}
335337

336-
// TestGetBlockBodies tests whether the given node can respond to a
337-
// `GetBlockBodies` request and that the response is accurate.
338338
func (s *Suite) TestGetBlockBodies(t *utesting.T) {
339+
t.Log(`This test sends GetBlockBodies requests to the node for known blocks in the test chain.`)
340+
339341
conn, err := s.dial()
340342
if err != nil {
341343
t.Fatalf("dial failed: %v", err)
@@ -376,12 +378,12 @@ func randBuf(size int) []byte {
376378
return buf
377379
}
378380

379-
// TestMaliciousHandshake tries to send malicious data during the handshake.
380381
func (s *Suite) TestMaliciousHandshake(t *utesting.T) {
381-
key, _ := crypto.GenerateKey()
382+
t.Log(`This test tries to send malicious data during the devp2p handshake, in various ways.`)
382383

383384
// Write hello to client.
384385
var (
386+
key, _ = crypto.GenerateKey()
385387
pub0 = crypto.FromECDSAPub(&key.PublicKey)[1:]
386388
version = eth.ProtocolVersions[0]
387389
)
@@ -451,8 +453,9 @@ func (s *Suite) TestMaliciousHandshake(t *utesting.T) {
451453
}
452454
}
453455

454-
// TestMaliciousStatus sends a status package with a large total difficulty.
455456
func (s *Suite) TestMaliciousStatus(t *utesting.T) {
457+
t.Log(`This test sends a malicious eth Status message to the node and expects a disconnect.`)
458+
456459
conn, err := s.dial()
457460
if err != nil {
458461
t.Fatalf("dial failed: %v", err)
@@ -486,9 +489,10 @@ func (s *Suite) TestMaliciousStatus(t *utesting.T) {
486489
}
487490
}
488491

489-
// TestTransaction sends a valid transaction to the node and checks if the
490-
// transaction gets propagated.
491492
func (s *Suite) TestTransaction(t *utesting.T) {
493+
t.Log(`This test sends a valid transaction to the node and checks if the
494+
transaction gets propagated.`)
495+
492496
// Nudge client out of syncing mode to accept pending txs.
493497
if err := s.engine.sendForkchoiceUpdated(); err != nil {
494498
t.Fatalf("failed to send next block: %v", err)
@@ -507,15 +511,16 @@ func (s *Suite) TestTransaction(t *utesting.T) {
507511
if err != nil {
508512
t.Fatalf("failed to sign tx: %v", err)
509513
}
510-
if err := s.sendTxs([]*types.Transaction{tx}); err != nil {
514+
if err := s.sendTxs(t, []*types.Transaction{tx}); err != nil {
511515
t.Fatal(err)
512516
}
513517
s.chain.IncNonce(from, 1)
514518
}
515519

516-
// TestInvalidTxs sends several invalid transactions and tests whether
517-
// the node will propagate them.
518520
func (s *Suite) TestInvalidTxs(t *utesting.T) {
521+
t.Log(`This test sends several kinds of invalid transactions and checks that the node
522+
does not propagate them.`)
523+
519524
// Nudge client out of syncing mode to accept pending txs.
520525
if err := s.engine.sendForkchoiceUpdated(); err != nil {
521526
t.Fatalf("failed to send next block: %v", err)
@@ -534,7 +539,7 @@ func (s *Suite) TestInvalidTxs(t *utesting.T) {
534539
if err != nil {
535540
t.Fatalf("failed to sign tx: %v", err)
536541
}
537-
if err := s.sendTxs([]*types.Transaction{tx}); err != nil {
542+
if err := s.sendTxs(t, []*types.Transaction{tx}); err != nil {
538543
t.Fatalf("failed to send txs: %v", err)
539544
}
540545
s.chain.IncNonce(from, 1)
@@ -590,14 +595,15 @@ func (s *Suite) TestInvalidTxs(t *utesting.T) {
590595
}
591596
txs = append(txs, tx)
592597
}
593-
if err := s.sendInvalidTxs(txs); err != nil {
598+
if err := s.sendInvalidTxs(t, txs); err != nil {
594599
t.Fatalf("failed to send invalid txs: %v", err)
595600
}
596601
}
597602

598-
// TestLargeTxRequest tests whether a node can fulfill a large GetPooledTransactions
599-
// request.
600603
func (s *Suite) TestLargeTxRequest(t *utesting.T) {
604+
t.Log(`This test first send ~2000 transactions to the node, then requests them
605+
on another peer connection using GetPooledTransactions.`)
606+
601607
// Nudge client out of syncing mode to accept pending txs.
602608
if err := s.engine.sendForkchoiceUpdated(); err != nil {
603609
t.Fatalf("failed to send next block: %v", err)
@@ -630,7 +636,7 @@ func (s *Suite) TestLargeTxRequest(t *utesting.T) {
630636
s.chain.IncNonce(from, uint64(count))
631637

632638
// Send txs.
633-
if err := s.sendTxs(txs); err != nil {
639+
if err := s.sendTxs(t, txs); err != nil {
634640
t.Fatalf("failed to send txs: %v", err)
635641
}
636642

@@ -667,13 +673,15 @@ func (s *Suite) TestLargeTxRequest(t *utesting.T) {
667673
}
668674
}
669675

670-
// TestNewPooledTxs tests whether a node will do a GetPooledTransactions request
671-
// upon receiving a NewPooledTransactionHashes announcement.
672676
func (s *Suite) TestNewPooledTxs(t *utesting.T) {
677+
t.Log(`This test announces transaction hashes to the node and expects it to fetch
678+
the transactions using a GetPooledTransactions request.`)
679+
673680
// Nudge client out of syncing mode to accept pending txs.
674681
if err := s.engine.sendForkchoiceUpdated(); err != nil {
675682
t.Fatalf("failed to send next block: %v", err)
676683
}
684+
677685
var (
678686
count = 50
679687
from, nonce = s.chain.GetSender(1)
@@ -762,7 +770,7 @@ func (s *Suite) makeBlobTxs(count, blobs int, discriminator byte) (txs types.Tra
762770
from, nonce := s.chain.GetSender(5)
763771
for i := 0; i < count; i++ {
764772
// Make blob data, max of 2 blobs per tx.
765-
blobdata := make([]byte, blobs%2)
773+
blobdata := make([]byte, blobs%3)
766774
for i := range blobdata {
767775
blobdata[i] = discriminator
768776
blobs -= 1
@@ -787,6 +795,8 @@ func (s *Suite) makeBlobTxs(count, blobs int, discriminator byte) (txs types.Tra
787795
}
788796

789797
func (s *Suite) TestBlobViolations(t *utesting.T) {
798+
t.Log(`This test sends some invalid blob tx announcements and expects the node to disconnect.`)
799+
790800
if err := s.engine.sendForkchoiceUpdated(); err != nil {
791801
t.Fatalf("send fcu failed: %v", err)
792802
}

0 commit comments

Comments
 (0)