Skip to content

Commit 825ac5f

Browse files
authored
Merge branch 'master' into clean/v1.16.3
2 parents bca7c98 + 055b92b commit 825ac5f

File tree

324 files changed

+82620
-2
lines changed

Some content is hidden

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

324 files changed

+82620
-2
lines changed

.travis.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
language: go
2+
go_import_path: github.com/ethereum/go-ethereum
3+
sudo: false
4+
jobs:
5+
allow_failures:
6+
- stage: build
7+
os: osx
8+
env:
9+
- azure-osx
10+
11+
include:
12+
# This builder only tests code linters on latest version of Go
13+
- stage: lint
14+
os: linux
15+
dist: bionic
16+
go: 1.20.x
17+
env:
18+
- lint
19+
git:
20+
submodules: false # avoid cloning ethereum/tests
21+
script:
22+
- go run build/ci.go lint
23+
24+
# These builders create the Docker sub-images for multi-arch push and each
25+
# will attempt to push the multi-arch image if they are the last builder
26+
- stage: build
27+
if: type = push
28+
os: linux
29+
arch: amd64
30+
dist: bionic
31+
go: 1.20.x
32+
env:
33+
- docker
34+
services:
35+
- docker
36+
git:
37+
submodules: false # avoid cloning ethereum/tests
38+
before_install:
39+
- export DOCKER_CLI_EXPERIMENTAL=enabled
40+
script:
41+
- go run build/ci.go docker -image -manifest amd64,arm64 -upload ethereum/client-go
42+
43+
- stage: build
44+
if: type = push
45+
os: linux
46+
arch: arm64
47+
dist: bionic
48+
go: 1.20.x
49+
env:
50+
- docker
51+
services:
52+
- docker
53+
git:
54+
submodules: false # avoid cloning ethereum/tests
55+
before_install:
56+
- export DOCKER_CLI_EXPERIMENTAL=enabled
57+
script:
58+
- go run build/ci.go docker -image -manifest amd64,arm64 -upload ethereum/client-go
59+
60+
# This builder does the Linux Azure uploads
61+
- stage: build
62+
if: type = push
63+
os: linux
64+
dist: bionic
65+
sudo: required
66+
go: 1.20.x
67+
env:
68+
- azure-linux
69+
- GO111MODULE=on
70+
git:
71+
submodules: false # avoid cloning ethereum/tests
72+
addons:
73+
apt:
74+
packages:
75+
- gcc-multilib
76+
script:
77+
# Build for the primary platforms that Trusty can manage
78+
- go run build/ci.go install -dlgo
79+
- go run build/ci.go archive -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
80+
- go run build/ci.go install -dlgo -arch 386
81+
- go run build/ci.go archive -arch 386 -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
82+
83+
# Switch over GCC to cross compilation (breaks 386, hence why do it here only)
84+
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-arm-linux-gnueabihf libc6-dev-armhf-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross
85+
- sudo ln -s /usr/include/asm-generic /usr/include/asm
86+
87+
- GOARM=5 go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc
88+
- GOARM=5 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
89+
- GOARM=6 go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabi-gcc
90+
- GOARM=6 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
91+
- GOARM=7 go run build/ci.go install -dlgo -arch arm -cc arm-linux-gnueabihf-gcc
92+
- GOARM=7 go run build/ci.go archive -arch arm -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
93+
- go run build/ci.go install -dlgo -arch arm64 -cc aarch64-linux-gnu-gcc
94+
- go run build/ci.go archive -arch arm64 -type tar -signer LINUX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
95+
96+
# This builder does the OSX Azure uploads
97+
- stage: build
98+
if: type = push
99+
os: osx
100+
go: 1.20.x
101+
env:
102+
- azure-osx
103+
- GO111MODULE=on
104+
git:
105+
submodules: false # avoid cloning ethereum/tests
106+
script:
107+
- go run build/ci.go install -dlgo
108+
- go run build/ci.go archive -type tar -signer OSX_SIGNING_KEY -signify SIGNIFY_KEY -upload gethstore/builds
109+
110+
# These builders run the tests
111+
- stage: build
112+
os: linux
113+
arch: amd64
114+
dist: bionic
115+
go: 1.20.x
116+
env:
117+
- GO111MODULE=on
118+
script:
119+
- go run build/ci.go test $TEST_PACKAGES
120+
121+
- stage: build
122+
if: type = pull_request
123+
os: linux
124+
arch: arm64
125+
dist: bionic
126+
go: 1.19.x
127+
env:
128+
- GO111MODULE=on
129+
script:
130+
- go run build/ci.go test $TEST_PACKAGES
131+
132+
- stage: build
133+
os: linux
134+
dist: bionic
135+
go: 1.19.x
136+
env:
137+
- GO111MODULE=on
138+
script:
139+
- go run build/ci.go test $TEST_PACKAGES
140+
141+
# This builder does the Ubuntu PPA nightly uploads
142+
- stage: build
143+
if: type = cron || (type = push && tag ~= /^v[0-9]/)
144+
os: linux
145+
dist: bionic
146+
go: 1.20.x
147+
env:
148+
- ubuntu-ppa
149+
- GO111MODULE=on
150+
git:
151+
submodules: false # avoid cloning ethereum/tests
152+
addons:
153+
apt:
154+
packages:
155+
- devscripts
156+
- debhelper
157+
- dput
158+
- fakeroot
159+
- python-bzrlib
160+
- python-paramiko
161+
script:
162+
- echo '|1|7SiYPr9xl3uctzovOTj4gMwAC1M=|t6ReES75Bo/PxlOPJ6/GsGbTrM0= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0aKz5UTUndYgIGG7dQBV+HaeuEZJ2xPHo2DS2iSKvUL4xNMSAY4UguNW+pX56nAQmZKIZZ8MaEvSj6zMEDiq6HFfn5JcTlM80UwlnyKe8B8p7Nk06PPQLrnmQt5fh0HmEcZx+JU9TZsfCHPnX7MNz4ELfZE6cFsclClrKim3BHUIGq//t93DllB+h4O9LHjEUsQ1Sr63irDLSutkLJD6RXchjROXkNirlcNVHH/jwLWR5RcYilNX7S5bIkK8NlWPjsn/8Ua5O7I9/YoE97PpO6i73DTGLh5H9JN/SITwCKBkgSDWUt61uPK3Y11Gty7o2lWsBjhBUm2Y38CBsoGmBw==' >> ~/.ssh/known_hosts
163+
- go run build/ci.go debsrc -upload ethereum/ethereum -sftp-user geth-ci -signer "Go Ethereum Linux Builder <[email protected]>"
164+
165+
# This builder does the Azure archive purges to avoid accumulating junk
166+
- stage: build
167+
if: type = cron
168+
os: linux
169+
dist: bionic
170+
go: 1.20.x
171+
env:
172+
- azure-purge
173+
- GO111MODULE=on
174+
git:
175+
submodules: false # avoid cloning ethereum/tests
176+
script:
177+
- go run build/ci.go purge -store gethstore/builds -days 14
178+
179+
# This builder executes race tests
180+
- stage: build
181+
if: type = cron
182+
os: linux
183+
dist: bionic
184+
go: 1.20.x
185+
env:
186+
- GO111MODULE=on
187+
script:
188+
- go run build/ci.go test -race $TEST_PACKAGES
189+

accounts/abi/argument.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func (arguments Arguments) UnpackValues(data []byte) ([]any, error) {
241241
return retval, nil
242242
}
243243

244-
// UnpackValues can be used to unpack ABI-encoded hexdata according to the ABI-specification,
244+
// UnpackValuesAsStrings can be used to unpack ABI-encoded hexdata according to the ABI-specification,
245245
// without supplying a struct to unpack into. Instead, this method returns a list containing the
246246
// values converted to strings. An atomic argument will be a list with one element.
247247
func (arguments Arguments) UnpackValuesAsStrings(data []byte) ([]interface{}, error) {

accounts/abi/bind/auth.go

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
// Copyright 2016 The go-ethereum Authors
2+
// This file is part of the go-ethereum library.
3+
//
4+
// The go-ethereum library is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Lesser General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// The go-ethereum library is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Lesser General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Lesser General Public License
15+
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
16+
17+
package bind
18+
19+
import (
20+
"context"
21+
"crypto/ecdsa"
22+
"errors"
23+
"io"
24+
"math/big"
25+
26+
"github.com/ethereum/go-ethereum/accounts"
27+
"github.com/ethereum/go-ethereum/accounts/external"
28+
"github.com/ethereum/go-ethereum/accounts/keystore"
29+
"github.com/ethereum/go-ethereum/common"
30+
"github.com/ethereum/go-ethereum/core/types"
31+
"github.com/ethereum/go-ethereum/crypto"
32+
"github.com/ethereum/go-ethereum/log"
33+
)
34+
35+
// ErrNoChainID is returned whenever the user failed to specify a chain id.
36+
var ErrNoChainID = errors.New("no chain id specified")
37+
38+
// ErrNotAuthorized is returned when an account is not properly unlocked.
39+
var ErrNotAuthorized = errors.New("not authorized to sign this account")
40+
41+
// NewTransactor is a utility method to easily create a transaction signer from
42+
// an encrypted json key stream and the associated passphrase.
43+
//
44+
// Deprecated: Use NewTransactorWithChainID instead.
45+
func NewTransactor(keyin io.Reader, passphrase string) (*TransactOpts, error) {
46+
log.Warn("WARNING: NewTransactor has been deprecated in favour of NewTransactorWithChainID")
47+
json, err := io.ReadAll(keyin)
48+
if err != nil {
49+
return nil, err
50+
}
51+
key, err := keystore.DecryptKey(json, passphrase)
52+
if err != nil {
53+
return nil, err
54+
}
55+
return NewKeyedTransactor(key.PrivateKey), nil
56+
}
57+
58+
// NewKeyStoreTransactor is a utility method to easily create a transaction signer from
59+
// an decrypted key from a keystore.
60+
//
61+
// Deprecated: Use NewKeyStoreTransactorWithChainID instead.
62+
func NewKeyStoreTransactor(keystore *keystore.KeyStore, account accounts.Account) (*TransactOpts, error) {
63+
log.Warn("WARNING: NewKeyStoreTransactor has been deprecated in favour of NewTransactorWithChainID")
64+
signer := types.HomesteadSigner{}
65+
return &TransactOpts{
66+
From: account.Address,
67+
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
68+
if address != account.Address {
69+
return nil, ErrNotAuthorized
70+
}
71+
signature, err := keystore.SignHash(account, signer.Hash(tx).Bytes())
72+
if err != nil {
73+
return nil, err
74+
}
75+
return tx.WithSignature(signer, signature)
76+
},
77+
Context: context.Background(),
78+
}, nil
79+
}
80+
81+
// NewKeyedTransactor is a utility method to easily create a transaction signer
82+
// from a single private key.
83+
//
84+
// Deprecated: Use NewKeyedTransactorWithChainID instead.
85+
func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts {
86+
log.Warn("WARNING: NewKeyedTransactor has been deprecated in favour of NewKeyedTransactorWithChainID")
87+
keyAddr := crypto.PubkeyToAddress(key.PublicKey)
88+
signer := types.HomesteadSigner{}
89+
return &TransactOpts{
90+
From: keyAddr,
91+
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
92+
if address != keyAddr {
93+
return nil, ErrNotAuthorized
94+
}
95+
signature, err := crypto.Sign(signer.Hash(tx).Bytes(), key)
96+
if err != nil {
97+
return nil, err
98+
}
99+
return tx.WithSignature(signer, signature)
100+
},
101+
Context: context.Background(),
102+
}
103+
}
104+
105+
// NewTransactorWithChainID is a utility method to easily create a transaction signer from
106+
// an encrypted json key stream and the associated passphrase.
107+
func NewTransactorWithChainID(keyin io.Reader, passphrase string, chainID *big.Int) (*TransactOpts, error) {
108+
json, err := io.ReadAll(keyin)
109+
if err != nil {
110+
return nil, err
111+
}
112+
key, err := keystore.DecryptKey(json, passphrase)
113+
if err != nil {
114+
return nil, err
115+
}
116+
return NewKeyedTransactorWithChainID(key.PrivateKey, chainID)
117+
}
118+
119+
// NewKeyStoreTransactorWithChainID is a utility method to easily create a transaction signer from
120+
// an decrypted key from a keystore.
121+
func NewKeyStoreTransactorWithChainID(keystore *keystore.KeyStore, account accounts.Account, chainID *big.Int) (*TransactOpts, error) {
122+
if chainID == nil {
123+
return nil, ErrNoChainID
124+
}
125+
signer := types.LatestSignerForChainID(chainID)
126+
return &TransactOpts{
127+
From: account.Address,
128+
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
129+
if address != account.Address {
130+
return nil, ErrNotAuthorized
131+
}
132+
signature, err := keystore.SignHash(account, signer.Hash(tx).Bytes())
133+
if err != nil {
134+
return nil, err
135+
}
136+
return tx.WithSignature(signer, signature)
137+
},
138+
Context: context.Background(),
139+
}, nil
140+
}
141+
142+
// NewKeyedTransactorWithChainID is a utility method to easily create a transaction signer
143+
// from a single private key.
144+
func NewKeyedTransactorWithChainID(key *ecdsa.PrivateKey, chainID *big.Int) (*TransactOpts, error) {
145+
keyAddr := crypto.PubkeyToAddress(key.PublicKey)
146+
if chainID == nil {
147+
return nil, ErrNoChainID
148+
}
149+
signer := types.LatestSignerForChainID(chainID)
150+
return &TransactOpts{
151+
From: keyAddr,
152+
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
153+
if address != keyAddr {
154+
return nil, ErrNotAuthorized
155+
}
156+
signature, err := crypto.Sign(signer.Hash(tx).Bytes(), key)
157+
if err != nil {
158+
return nil, err
159+
}
160+
return tx.WithSignature(signer, signature)
161+
},
162+
Context: context.Background(),
163+
}, nil
164+
}
165+
166+
// NewClefTransactor is a utility method to easily create a transaction signer
167+
// with a clef backend.
168+
func NewClefTransactor(clef *external.ExternalSigner, account accounts.Account) *TransactOpts {
169+
return &TransactOpts{
170+
From: account.Address,
171+
Signer: func(address common.Address, transaction *types.Transaction) (*types.Transaction, error) {
172+
if address != account.Address {
173+
return nil, ErrNotAuthorized
174+
}
175+
return clef.SignTx(account, transaction, nil) // Clef enforces its own chain id
176+
},
177+
Context: context.Background(),
178+
}
179+
}

0 commit comments

Comments
 (0)