Skip to content

Commit 01b2876

Browse files
authored
Merge pull request #2791 from bnb-chain/merge_geth_v1.14.12
upstream: merge geth v1.14.12
2 parents f485aff + 7a85fa1 commit 01b2876

File tree

395 files changed

+25190
-6137
lines changed

Some content is hidden

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

395 files changed

+25190
-6137
lines changed

.github/workflows/lint.yml

+7-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
golang-lint:
1616
strategy:
1717
matrix:
18-
go-version: [1.21.x]
18+
go-version: [1.23.x]
1919
os: [ubuntu-latest]
2020
runs-on: ${{ matrix.os }}
2121
steps:
@@ -47,12 +47,9 @@ jobs:
4747
go mod tidy
4848
4949
- name: golangci-lint
50-
uses: golangci/golangci-lint-action@v3
51-
with:
52-
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
53-
version: v1.55.2
54-
working-directory: ./
55-
skip-pkg-cache: true
56-
skip-cache: true
57-
skip-build-cache: true
58-
args: --timeout=99m --config ./.golangci.yml
50+
env:
51+
CGO_CFLAGS: "-O -D__BLST_PORTABLE__"
52+
CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__"
53+
ANDROID_HOME: "" # Skip android test
54+
run: |
55+
make lint

.gitignore

-15
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@
44
# or operating system, you probably want to add a global ignore instead:
55
# git config --global core.excludesfile ~/.gitignore_global
66

7-
/tmp
87
*/**/*un~
98
*/**/*.test
109
*un~
1110
.DS_Store
1211
*/**/.DS_Store
13-
.ethtest
14-
*/**/*tx_database*
15-
*/**/*dapps*
16-
build/_vendor/pkg
1712

1813
#*
1914
.#*
@@ -46,19 +41,9 @@ profile.cov
4641
# VS Code
4742
.vscode
4843

49-
# dashboard
50-
/dashboard/assets/flow-typed
51-
/dashboard/assets/node_modules
52-
/dashboard/assets/stats.json
53-
/dashboard/assets/bundle.js
54-
/dashboard/assets/bundle.js.map
55-
/dashboard/assets/package-lock.json
56-
57-
**/yarn-error.log
5844
cmd/geth/node/
5945
cmd/geth/__debug_bin
6046
cmd/bootnode/bootnode
6147
graphql/__debug_bin
62-
logs/
6348

6449
tests/spec-tests/

.golangci.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ linters:
2424
- staticcheck
2525
- bidichk
2626
- durationcheck
27-
- exportloopref
27+
- copyloopvar
2828
- whitespace
2929
- revive # only certain checks enabled
30-
30+
- durationcheck
31+
- gocheckcompilerdirectives
32+
- reassign
33+
- mirror
34+
- tenv
3135
### linters we tried and will not be using:
3236
###
3337
# - structcheck # lots of false positives

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
before_install:
2626
- export DOCKER_CLI_EXPERIMENTAL=enabled
2727
script:
28-
- go run build/ci.go dockerx -platform "linux/amd64,linux/arm64" -upload ethereum/client-go
28+
- go run build/ci.go dockerx -platform "linux/amd64,linux/arm64,linux/riscv64" -upload ethereum/client-go
2929

3030
# This builder does the Linux Azure uploads
3131
- stage: build

accounts/abi/abi_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,6 @@ func TestUnpackRevert(t *testing.T) {
11991199
{"4e487b7100000000000000000000000000000000000000000000000000000000000000ff", "unknown panic code: 0xff", nil},
12001200
}
12011201
for index, c := range cases {
1202-
index, c := index, c
12031202
t.Run(fmt.Sprintf("case %d", index), func(t *testing.T) {
12041203
t.Parallel()
12051204
got, err := UnpackRevert(common.Hex2Bytes(c.input))

accounts/abi/bind/bind.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
252252
}
253253
// Parse library references.
254254
for pattern, name := range libs {
255-
matched, err := regexp.Match("__\\$"+pattern+"\\$__", []byte(contracts[types[i]].InputBin))
255+
matched, err := regexp.MatchString("__\\$"+pattern+"\\$__", contracts[types[i]].InputBin)
256256
if err != nil {
257257
log.Error("Could not search for pattern", "pattern", pattern, "contract", contracts[types[i]], "err", err)
258258
}

accounts/abi/event_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ func TestEventTupleUnpack(t *testing.T) {
331331

332332
for _, tc := range testCases {
333333
assert := assert.New(t)
334-
tc := tc
335334
t.Run(tc.name, func(t *testing.T) {
336335
err := unpackTestEventData(tc.dest, tc.data, tc.jsonLog, assert)
337336
if tc.error == "" {

accounts/abi/pack_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
func TestPack(t *testing.T) {
3535
t.Parallel()
3636
for i, test := range packUnpackTests {
37-
i, test := i, test
3837
t.Run(strconv.Itoa(i), func(t *testing.T) {
3938
t.Parallel()
4039
encb, err := hex.DecodeString(test.packed)

accounts/abi/reflect_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ var reflectTests = []reflectTest{
172172
func TestReflectNameToStruct(t *testing.T) {
173173
t.Parallel()
174174
for _, test := range reflectTests {
175-
test := test
176175
t.Run(test.name, func(t *testing.T) {
177176
t.Parallel()
178177
m, err := mapArgNamesToStructFields(test.args, reflect.ValueOf(test.struc))

accounts/abi/topics_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ func TestMakeTopics(t *testing.T) {
137137
},
138138
}
139139
for _, tt := range tests {
140-
tt := tt
141140
t.Run(tt.name, func(t *testing.T) {
142141
t.Parallel()
143142
got, err := MakeTopics(tt.args.query...)
@@ -373,7 +372,6 @@ func TestParseTopics(t *testing.T) {
373372
tests := setupTopicsTests()
374373

375374
for _, tt := range tests {
376-
tt := tt
377375
t.Run(tt.name, func(t *testing.T) {
378376
t.Parallel()
379377
createObj := tt.args.createObj()
@@ -393,7 +391,6 @@ func TestParseTopicsIntoMap(t *testing.T) {
393391
tests := setupTopicsTests()
394392

395393
for _, tt := range tests {
396-
tt := tt
397394
t.Run(tt.name, func(t *testing.T) {
398395
t.Parallel()
399396
outMap := make(map[string]interface{})

accounts/abi/unpack_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ func TestMethodMultiReturn(t *testing.T) {
389389
"Can not unpack into a slice with wrong types",
390390
}}
391391
for _, tc := range testCases {
392-
tc := tc
393392
t.Run(tc.name, func(t *testing.T) {
394393
require := require.New(t)
395394
err := abi.UnpackIntoInterface(tc.dest, "multi", data)
@@ -947,7 +946,7 @@ func TestOOMMaliciousInput(t *testing.T) {
947946
}
948947
encb, err := hex.DecodeString(test.enc)
949948
if err != nil {
950-
t.Fatalf("invalid hex: %s" + test.enc)
949+
t.Fatalf("invalid hex: %s", test.enc)
951950
}
952951
_, err = abi.Methods["method"].Outputs.UnpackValues(encb)
953952
if err == nil {

accounts/usbwallet/ledger.go

+24-5
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,22 @@ func (w *ledgerDriver) ledgerSign(derivationPath []uint32, tx *types.Transaction
338338
return common.Address{}, nil, err
339339
}
340340
} else {
341-
if txrlp, err = rlp.EncodeToBytes([]interface{}{tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), chainID, big.NewInt(0), big.NewInt(0)}); err != nil {
342-
return common.Address{}, nil, err
341+
if tx.Type() == types.DynamicFeeTxType {
342+
if txrlp, err = rlp.EncodeToBytes([]interface{}{chainID, tx.Nonce(), tx.GasTipCap(), tx.GasFeeCap(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList()}); err != nil {
343+
return common.Address{}, nil, err
344+
}
345+
// append type to transaction
346+
txrlp = append([]byte{tx.Type()}, txrlp...)
347+
} else if tx.Type() == types.AccessListTxType {
348+
if txrlp, err = rlp.EncodeToBytes([]interface{}{chainID, tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList()}); err != nil {
349+
return common.Address{}, nil, err
350+
}
351+
// append type to transaction
352+
txrlp = append([]byte{tx.Type()}, txrlp...)
353+
} else if tx.Type() == types.LegacyTxType {
354+
if txrlp, err = rlp.EncodeToBytes([]interface{}{tx.Nonce(), tx.GasPrice(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), chainID, big.NewInt(0), big.NewInt(0)}); err != nil {
355+
return common.Address{}, nil, err
356+
}
343357
}
344358
}
345359
payload := append(path, txrlp...)
@@ -353,7 +367,9 @@ func (w *ledgerDriver) ledgerSign(derivationPath []uint32, tx *types.Transaction
353367
// Chunk size selection to mitigate an underlying RLP deserialization issue on the ledger app.
354368
// https://github.com/LedgerHQ/app-ethereum/issues/409
355369
chunk := 255
356-
for ; len(payload)%chunk <= ledgerEip155Size; chunk-- {
370+
if tx.Type() == types.LegacyTxType {
371+
for ; len(payload)%chunk <= ledgerEip155Size; chunk-- {
372+
}
357373
}
358374

359375
for len(payload) > 0 {
@@ -381,8 +397,11 @@ func (w *ledgerDriver) ledgerSign(derivationPath []uint32, tx *types.Transaction
381397
if chainID == nil {
382398
signer = new(types.HomesteadSigner)
383399
} else {
384-
signer = types.NewEIP155Signer(chainID)
385-
signature[64] -= byte(chainID.Uint64()*2 + 35)
400+
signer = types.LatestSignerForChainID(chainID)
401+
// For non-legacy transactions, V is 0 or 1, no need to subtract here.
402+
if tx.Type() == types.LegacyTxType {
403+
signature[64] -= byte(chainID.Uint64()*2 + 35)
404+
}
386405
}
387406
signed, err := tx.WithSignature(signer, signature)
388407
if err != nil {

appveyor.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ for:
2424
- image: Ubuntu
2525
build_script:
2626
- go run build/ci.go lint
27-
- go run build/ci.go generate -verify
27+
- go run build/ci.go check_tidy
28+
- go run build/ci.go check_generate
29+
- go run build/ci.go check_baddeps
2830
- go run build/ci.go install -dlgo
2931
test_script:
3032
- go run build/ci.go test -dlgo -short

beacon/engine/gen_ed.go

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

beacon/engine/gen_epe.go

+16-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)