Skip to content

Commit 737ffd1

Browse files
committed
Merge branch 'master' into release/1.16
2 parents 41714b4 + 32ccb54 commit 737ffd1

File tree

111 files changed

+21446
-11931
lines changed

Some content is hidden

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

111 files changed

+21446
-11931
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
lint:
1212
name: Lint
13-
runs-on: self-hosted-ghr
13+
runs-on: [self-hosted-ghr, size-s-x64]
1414
steps:
1515
- uses: actions/checkout@v4
1616
with:
@@ -37,7 +37,7 @@ jobs:
3737
test:
3838
name: Test
3939
needs: lint
40-
runs-on: self-hosted-ghr
40+
runs-on: [self-hosted-ghr, size-l-x64]
4141
strategy:
4242
matrix:
4343
go:
@@ -55,4 +55,4 @@ jobs:
5555
cache: false
5656

5757
- name: Run tests
58-
run: go run build/ci.go test
58+
run: go run build/ci.go test -p 8

accounts/abi/abigen/bind_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,13 +485,13 @@ var bindTests = []struct {
485485
contract Defaulter {
486486
address public caller;
487487
488-
function() {
488+
fallback() external payable {
489489
caller = msg.sender;
490490
}
491491
}
492492
`,
493-
[]string{`6060604052606a8060106000396000f360606040523615601d5760e060020a6000350463fc9c8d3981146040575b605e6000805473ffffffffffffffffffffffffffffffffffffffff191633179055565b606060005473ffffffffffffffffffffffffffffffffffffffff1681565b005b6060908152602090f3`},
494-
[]string{`[{"constant":true,"inputs":[],"name":"caller","outputs":[{"name":"","type":"address"}],"type":"function"}]`},
493+
[]string{`608060405234801561000f575f80fd5b5061013d8061001d5f395ff3fe608060405260043610610021575f3560e01c8063fc9c8d391461006257610022565b5b335f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055005b34801561006d575f80fd5b5061007661008c565b60405161008391906100ee565b60405180910390f35b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100d8826100af565b9050919050565b6100e8816100ce565b82525050565b5f6020820190506101015f8301846100df565b9291505056fea26469706673582212201e9273ecfb1f534644c77f09a25c21baaba81cf1c444ebc071e12a225a23c72964736f6c63430008140033`},
494+
[]string{`[{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"caller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]`},
495495
`
496496
"math/big"
497497

accounts/abi/bind/v2/base.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,10 @@ func (c *BoundContract) RawCreationTransact(opts *TransactOpts, calldata []byte)
277277
// Transfer initiates a plain transaction to move funds to the contract, calling
278278
// its default method if one is available.
279279
func (c *BoundContract) Transfer(opts *TransactOpts) (*types.Transaction, error) {
280-
// todo(rjl493456442) check the payable fallback or receive is defined
281-
// or not, reject invalid transaction at the first place
280+
// Check if payable fallback or receive is defined
281+
if !c.abi.HasReceive() && !(c.abi.HasFallback() && c.abi.Fallback.IsPayable()) {
282+
return nil, fmt.Errorf("contract does not have a payable fallback or receive function")
283+
}
282284
return c.transact(opts, &c.address, nil)
283285
}
284286

appveyor.yml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ clone_depth: 5
22
version: "{branch}.{build}"
33

44
image:
5-
- Ubuntu
65
- Visual Studio 2019
76

87
environment:
@@ -17,25 +16,6 @@ install:
1716
- go version
1817

1918
for:
20-
# Linux has its own script without -arch and -cc.
21-
# The linux builder also runs lint.
22-
- matrix:
23-
only:
24-
- image: Ubuntu
25-
build_script:
26-
- go run build/ci.go lint
27-
- go run build/ci.go check_generate
28-
- go run build/ci.go check_baddeps
29-
- go run build/ci.go install -dlgo
30-
test_script:
31-
- go run build/ci.go test -dlgo -short
32-
33-
# linux/386 is disabled.
34-
- matrix:
35-
exclude:
36-
- image: Ubuntu
37-
GETH_ARCH: 386
38-
3919
# Windows builds for amd64 + 386.
4020
- matrix:
4121
only:
@@ -56,4 +36,4 @@ for:
5636
- go run build/ci.go archive -arch %GETH_ARCH% -type zip -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
5737
- go run build/ci.go nsis -arch %GETH_ARCH% -signer WINDOWS_SIGNING_KEY -upload gethstore/builds
5838
test_script:
59-
- go run build/ci.go test -dlgo -arch %GETH_ARCH% -cc %GETH_CC% -short
39+
- go run build/ci.go test -dlgo -arch %GETH_ARCH% -cc %GETH_CC% -short -skip-spectests

build/ci.go

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import (
5757
"time"
5858

5959
"github.com/cespare/cp"
60+
"github.com/ethereum/go-ethereum/common"
6061
"github.com/ethereum/go-ethereum/crypto/signify"
6162
"github.com/ethereum/go-ethereum/internal/build"
6263
"github.com/ethereum/go-ethereum/internal/download"
@@ -148,7 +149,7 @@ func executablePath(name string) string {
148149
func main() {
149150
log.SetFlags(log.Lshortfile)
150151

151-
if !build.FileExist(filepath.Join("build", "ci.go")) {
152+
if !common.FileExist(filepath.Join("build", "ci.go")) {
152153
log.Fatal("this script must be run from the root of the repository")
153154
}
154155
if len(os.Args) < 2 {
@@ -280,20 +281,26 @@ func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (
280281

281282
func doTest(cmdline []string) {
282283
var (
283-
dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
284-
arch = flag.String("arch", "", "Run tests for given architecture")
285-
cc = flag.String("cc", "", "Sets C compiler binary")
286-
coverage = flag.Bool("coverage", false, "Whether to record code coverage")
287-
verbose = flag.Bool("v", false, "Whether to log verbosely")
288-
race = flag.Bool("race", false, "Execute the race detector")
289-
short = flag.Bool("short", false, "Pass the 'short'-flag to go test")
290-
cachedir = flag.String("cachedir", "./build/cache", "directory for caching downloads")
284+
dlgo = flag.Bool("dlgo", false, "Download Go and build with it")
285+
arch = flag.String("arch", "", "Run tests for given architecture")
286+
cc = flag.String("cc", "", "Sets C compiler binary")
287+
coverage = flag.Bool("coverage", false, "Whether to record code coverage")
288+
verbose = flag.Bool("v", false, "Whether to log verbosely")
289+
race = flag.Bool("race", false, "Execute the race detector")
290+
short = flag.Bool("short", false, "Pass the 'short'-flag to go test")
291+
cachedir = flag.String("cachedir", "./build/cache", "directory for caching downloads")
292+
skipspectests = flag.Bool("skip-spectests", false, "Skip downloading execution-spec-tests fixtures")
293+
threads = flag.Int("p", 1, "Number of CPU threads to use for testing")
291294
)
292295
flag.CommandLine.Parse(cmdline)
293296

294-
// Get test fixtures.
297+
// Load checksums file (needed for both spec tests and dlgo)
295298
csdb := download.MustLoadChecksums("build/checksums.txt")
296-
downloadSpecTestFixtures(csdb, *cachedir)
299+
300+
// Get test fixtures.
301+
if !*skipspectests {
302+
downloadSpecTestFixtures(csdb, *cachedir)
303+
}
297304

298305
// Configure the toolchain.
299306
tc := build.GoToolchain{GOARCH: *arch, CC: *cc}
@@ -314,7 +321,7 @@ func doTest(cmdline []string) {
314321

315322
// Test a single package at a time. CI builders are slow
316323
// and some tests run into timeouts under load.
317-
gotest.Args = append(gotest.Args, "-p", "1")
324+
gotest.Args = append(gotest.Args, "-p", fmt.Sprintf("%d", *threads))
318325
if *coverage {
319326
gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover")
320327
}
@@ -895,7 +902,7 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) {
895902
var idfile string
896903
if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 {
897904
idfile = filepath.Join(workdir, "sshkey")
898-
if !build.FileExist(idfile) {
905+
if !common.FileExist(idfile) {
899906
os.WriteFile(idfile, sshkey, 0600)
900907
}
901908
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/sh
22

33
hivechain generate \
4+
--pos \
45
--fork-interval 6 \
56
--tx-interval 1 \
6-
--length 500 \
7+
--length 600 \
78
--outdir testdata \
8-
--lastfork cancun \
9+
--lastfork prague \
910
--outputs accounts,genesis,chain,headstate,txinfo,headblock,headfcu,newpayload,forkenv

cmd/devp2p/internal/ethtest/protocol.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,9 @@ func protoOffset(proto Proto) uint64 {
8686
panic("unhandled protocol")
8787
}
8888
}
89+
90+
// msgTypePtr is the constraint for protocol message types.
91+
type msgTypePtr[U any] interface {
92+
*U
93+
Kind() byte
94+
}

cmd/devp2p/internal/ethtest/snap.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,29 @@ func (s *Suite) TestSnapGetAccountRange(t *utesting.T) {
8686
root: root,
8787
startingHash: zero,
8888
limitHash: ffHash,
89-
expAccounts: 86,
89+
expAccounts: 67,
9090
expFirst: firstKey,
91-
expLast: common.HexToHash("0x445cb5c1278fdce2f9cbdb681bdd76c52f8e50e41dbd9e220242a69ba99ac099"),
91+
expLast: common.HexToHash("0x622e662246601dd04f996289ce8b85e86db7bb15bb17f86487ec9d543ddb6f9a"),
9292
desc: "In this test, we request the entire state range, but limit the response to 4000 bytes.",
9393
},
9494
{
9595
nBytes: 3000,
9696
root: root,
9797
startingHash: zero,
9898
limitHash: ffHash,
99-
expAccounts: 65,
99+
expAccounts: 49,
100100
expFirst: firstKey,
101-
expLast: common.HexToHash("0x2e6fe1362b3e388184fd7bf08e99e74170b26361624ffd1c5f646da7067b58b6"),
101+
expLast: common.HexToHash("0x445cb5c1278fdce2f9cbdb681bdd76c52f8e50e41dbd9e220242a69ba99ac099"),
102102
desc: "In this test, we request the entire state range, but limit the response to 3000 bytes.",
103103
},
104104
{
105105
nBytes: 2000,
106106
root: root,
107107
startingHash: zero,
108108
limitHash: ffHash,
109-
expAccounts: 44,
109+
expAccounts: 34,
110110
expFirst: firstKey,
111-
expLast: common.HexToHash("0x1c3f74249a4892081ba0634a819aec9ed25f34c7653f5719b9098487e65ab595"),
111+
expLast: common.HexToHash("0x2ef46ebd2073cecde499c2e8df028ad79a26d57bfaa812c4c6f7eb4c9617b913"),
112112
desc: "In this test, we request the entire state range, but limit the response to 2000 bytes.",
113113
},
114114
{
@@ -177,9 +177,9 @@ The server should return the first available account.`,
177177
root: root,
178178
startingHash: firstKey,
179179
limitHash: ffHash,
180-
expAccounts: 86,
180+
expAccounts: 67,
181181
expFirst: firstKey,
182-
expLast: common.HexToHash("0x445cb5c1278fdce2f9cbdb681bdd76c52f8e50e41dbd9e220242a69ba99ac099"),
182+
expLast: common.HexToHash("0x622e662246601dd04f996289ce8b85e86db7bb15bb17f86487ec9d543ddb6f9a"),
183183
desc: `In this test, startingHash is exactly the first available account key.
184184
The server should return the first available account of the state as the first item.`,
185185
},
@@ -188,9 +188,9 @@ The server should return the first available account of the state as the first i
188188
root: root,
189189
startingHash: hashAdd(firstKey, 1),
190190
limitHash: ffHash,
191-
expAccounts: 86,
191+
expAccounts: 67,
192192
expFirst: secondKey,
193-
expLast: common.HexToHash("0x4615e5f5df5b25349a00ad313c6cd0436b6c08ee5826e33a018661997f85ebaa"),
193+
expLast: common.HexToHash("0x66192e4c757fba1cdc776e6737008f42d50370d3cd801db3624274283bf7cd63"),
194194
desc: `In this test, startingHash is after the first available key.
195195
The server should return the second account of the state as the first item.`,
196196
},
@@ -226,9 +226,9 @@ server to return no data because genesis is older than 127 blocks.`,
226226
root: s.chain.RootAt(int(s.chain.Head().Number().Uint64()) - 127),
227227
startingHash: zero,
228228
limitHash: ffHash,
229-
expAccounts: 84,
229+
expAccounts: 66,
230230
expFirst: firstKey,
231-
expLast: common.HexToHash("0x580aa878e2f92d113a12c0a3ce3c21972b03dbe80786858d49a72097e2c491a3"),
231+
expLast: common.HexToHash("0x729953a43ed6c913df957172680a17e5735143ad767bda8f58ac84ec62fbec5e"),
232232
desc: `This test requests data at a state root that is 127 blocks old.
233233
We expect the server to have this state available.`,
234234
},
@@ -657,8 +657,8 @@ The server should reject the request.`,
657657
// It's a bit unfortunate these are hard-coded, but the result depends on
658658
// a lot of aspects of the state trie and can't be guessed in a simple
659659
// way. So you'll have to update this when the test chain is changed.
660-
common.HexToHash("0x3e963a69401a70224cbfb8c0cc2249b019041a538675d71ccf80c9328d114e2e"),
661-
common.HexToHash("0xd0670d09cdfbf3c6320eb3e92c47c57baa6c226551a2d488c05581091e6b1689"),
660+
common.HexToHash("0x5bdc0d6057b35642a16d27223ea5454e5a17a400e28f7328971a5f2a87773b76"),
661+
common.HexToHash("0x0a76c9812ca90ffed8ee4d191e683f93386b6e50cfe3679c0760d27510aa7fc5"),
662662
empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty,
663663
empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty,
664664
empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty, empty,
@@ -678,8 +678,8 @@ The server should reject the request.`,
678678
// be updated when the test chain is changed.
679679
expHashes: []common.Hash{
680680
empty,
681-
common.HexToHash("0xd0670d09cdfbf3c6320eb3e92c47c57baa6c226551a2d488c05581091e6b1689"),
682-
common.HexToHash("0x3e963a69401a70224cbfb8c0cc2249b019041a538675d71ccf80c9328d114e2e"),
681+
common.HexToHash("0x0a76c9812ca90ffed8ee4d191e683f93386b6e50cfe3679c0760d27510aa7fc5"),
682+
common.HexToHash("0x5bdc0d6057b35642a16d27223ea5454e5a17a400e28f7328971a5f2a87773b76"),
683683
},
684684
},
685685

0 commit comments

Comments
 (0)