Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream v1.10.8 #58

Merged
merged 69 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d3f018f
eth: drop eth/65, the last non-reqid protocol version
karalabe Jun 28, 2021
a1f16bc
params: begin v1.10.7 release cycle
fjl Jul 22, 2021
bbfa648
Use `hexutil.Uint` for `blockCount` parameter in `feeHistory` method …
lightclient Jul 27, 2021
5c89ec9
cmd/geth: update vulnerability testdata (#23252)
holiman Jul 27, 2021
b20bc5c
accounts/abi/bind: parse ABI only once, create metadata struct (#22583)
MariusVanDerWijden Jul 27, 2021
3aea432
accounts/abi/bind: set Context in TransactOpts (#23188)
MariusVanDerWijden Jul 27, 2021
2faf796
internal/ethapi: fix panic in accesslist creation (#23225)
MariusVanDerWijden Jul 28, 2021
0730acc
consensus/ethash: less allocation during mining (#23199)
fxfactorial Jul 28, 2021
56e9001
README: fix default sync mode (#23282)
ligi Jul 28, 2021
523866c
all: change blacklist terms
baptiste-b-pegasys Jul 29, 2021
5c13012
accounts/external, internal/ethapi: fixes for London tx signing (#23…
holiman Jul 29, 2021
fb8ea59
tests: update tests/testdata to v9.0.4 (london) (#23279)
MariusVanDerWijden Jul 29, 2021
64a5e12
go.mod: upgrade to goupnp v1.0.2 (#23197)
ucwong Jul 29, 2021
b157bae
go.mod: bump golang.org/x/text to v0.3.6 (#23291)
s1na Jul 29, 2021
8f11d27
p2p/simulations: fix unlikely crash in probabilistic connect (#23200)
Evolution404 Jul 29, 2021
295bc35
signer/core: move API JSON types to separate package (#23275)
holiman Jul 29, 2021
3526f69
all: remove term "whitelist" in comments and log messages (#23294)
baptiste-b-pegasys Jul 29, 2021
860184d
p2p: remove term "whitelist" (#23295)
baptiste-b-pegasys Jul 29, 2021
85afdee
tests: remove whitelist feature (#23297)
baptiste-b-pegasys Jul 29, 2021
95bbd46
node, cmd/clef: remove term "whitelist" (#23296)
baptiste-b-pegasys Aug 2, 2021
82c5085
cre/state: fix outdated statedb Prepare comment (#23320)
aaronbuchwald Aug 3, 2021
4cd6a14
cmd/devp2p: fix ping/pong race in discv4 tests (#23306)
holiman Aug 3, 2021
c38fab9
core: get header from block cache (#23299)
s1na Aug 3, 2021
f311488
internal/ethapi: fix trace log marshalling (#23292)
rjl493456442 Aug 3, 2021
28ba686
core/state: add trie prefetcher tests (#23216)
MariusVanDerWijden Aug 3, 2021
d3e3a46
core/rawdb: fix logs to print block number, not address (#23328)
patrick-ogrady Aug 4, 2021
0658712
core: check if sender is EOA (#23303)
holiman Aug 7, 2021
8a24b56
cmd/evm: implement input txs via rlp in t8n tool (#23138)
holiman Aug 7, 2021
9e59474
core/rawdb: close database in test to avoid goroutine leak (#23287)
charlesxsh Aug 8, 2021
d60cfd2
core: fix london-check to avoid duplication (#23333)
lxex Aug 9, 2021
97bd6cd
internal/ethapi: accept both hex and decimal for blockCount (#23363)
zsfelfoldi Aug 10, 2021
3b38a83
core/state/pruner: fix state bloom sync permission in Windows
karalabe Aug 10, 2021
520f256
Merge pull request #23370 from karalabe/windows-pruning-fix-b
karalabe Aug 10, 2021
6d17546
cmd, core, eth, miner: deprecate miner.gastarget flag (#23213)
rjl493456442 Aug 10, 2021
e4b687c
mobile: remove deprecated code (#23357)
n1charlie Aug 10, 2021
57d9e0a
core/state/snapshot: fix typo in comment (#23219)
zzyalbert Aug 10, 2021
6694831
core/state/snapshot: clarify comment about snapshot repair (#23305)
tylerchambers Aug 10, 2021
39fe7ec
internal/ethapi: return maxFeePerGas for gasPrice for EIP-1559 txs (#…
lightclient Aug 10, 2021
a879c42
internal/ethapi, accounts/abi/bind: cap highest gas limit by account …
lightclient Aug 10, 2021
9d6480c
core/state/snapshot: gofmt
karalabe Aug 10, 2021
5d0ab07
Merge pull request #23371 from karalabe/gofmt
karalabe Aug 10, 2021
9097d0a
travis: transition from docker auto builds to manual pushes
karalabe Aug 10, 2021
0fbc94e
Merge pull request #23373 from karalabe/docker-flip
karalabe Aug 10, 2021
c27bd34
build: fix docker tag to include `v` prefix in version string
karalabe Aug 10, 2021
deff505
Merge pull request #23374 from karalabe/fix-docker-tag
karalabe Aug 10, 2021
278ec71
internal/ethapi: add back missing check for maxfee < maxPriorityFee
holiman Aug 12, 2021
2a451f9
Merge pull request #23384 from holiman/fix_gasfoo
karalabe Aug 12, 2021
f4ad493
params: update CHTs for the 1.10.7 release
karalabe Aug 12, 2021
971df49
Merge pull request #23385 from karalabe/cht-1.10.7
karalabe Aug 12, 2021
12f0ff4
params: release Geth v1.10.7
karalabe Aug 12, 2021
a580f7d
params: begin v1.10.8 release cycle
karalabe Aug 12, 2021
5f98020
core/rawdb: implement sequential reads in freezer_table (#23117)
holiman Aug 13, 2021
fd604be
Merge pull request #23120 from karalabe/drop-eth-65
karalabe Aug 13, 2021
0a68558
accounts/external: handle 0 chainid as not-set for the Clef API (#23394)
karalabe Aug 13, 2021
fb4007b
tests: update, enable legacy tests, remove vm tests (#23350)
holiman Aug 17, 2021
6902485
cmd, metrics: add support for influxdb-v2 (cherry-picking from italoa…
jwasinger Aug 17, 2021
85b9bdd
cmd, core: remove calaveras testnet (#23366)
n1charlie Aug 17, 2021
16ecdd5
cmd/utils: add --nousb to the list of deprecated flags (#23388)
n1charlie Aug 17, 2021
57feabe
eth, internal/ethapi: make RPC block miner field show block sealer co…
chenjia404 Aug 17, 2021
5566e5d
eth/downloader: fix typo in comment (#23413)
chuwt Aug 18, 2021
c368f72
Revert "eth: drop eth/65, the last non-reqid protocol version" (#23426)
karalabe Aug 20, 2021
d02c605
core: only check sendernoeoa in non fake mode (#23424)
MariusVanDerWijden Aug 23, 2021
bb1f7eb
signer/core/apitypes: remove dependency on internal/ethapi (#23362)
fjl Aug 23, 2021
dfeb2f7
go.mod: upgrade golang.org/x/sys for go1.17 support (#23406)
ucwong Aug 23, 2021
f38abc5
eth/gasprice: feeHistory improvements (#23422)
zsfelfoldi Aug 23, 2021
1d99573
core/vm: faster code analysis (#23381)
holiman Aug 24, 2021
2667545
params: release Geth v1.10.8
karalabe Aug 24, 2021
7a5ca37
Merge upstream 'v1.10.7' into 32c0e7080ad01b6dd7798d2d333728573999a441
junnmm Feb 1, 2023
4a9b33a
Merge upstream 'v1.10.8' into 7a5ca3719095f073677f8d01c28c0f116d1e2c14
junnmm Feb 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
before_install:
- export DOCKER_CLI_EXPERIMENTAL=enabled
script:
- go run build/ci.go docker -image -manifest amd64,arm64 -upload karalabe/geth-docker-test
- go run build/ci.go docker -image -manifest amd64,arm64 -upload ethereum/client-go

- stage: build
if: type = push
Expand All @@ -58,7 +58,7 @@ jobs:
before_install:
- export DOCKER_CLI_EXPERIMENTAL=enabled
script:
- go run build/ci.go docker -image -manifest amd64,arm64 -upload karalabe/geth-docker-test
- go run build/ci.go docker -image -manifest amd64,arm64 -upload ethereum/client-go

# This builder does the Ubuntu PPA upload
- stage: build
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $ geth console
```

This command will:
* Start `geth` in fast sync mode (default, can be changed with the `--syncmode` flag),
* Start `geth` in snap sync mode (default, can be changed with the `--syncmode` flag),
causing it to download more data in exchange for avoiding processing the entire history
of the KCC network, which is very CPU intensive.
* Start up `geth`'s built-in interactive [JavaScript console](https://geth.ethereum.org/docs/interface/javascript-console),
Expand Down
6 changes: 6 additions & 0 deletions accounts/abi/bind/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package bind

import (
"context"
"crypto/ecdsa"
"errors"
"io"
Expand Down Expand Up @@ -74,6 +75,7 @@ func NewKeyStoreTransactor(keystore *keystore.KeyStore, account accounts.Account
}
return tx.WithSignature(signer, signature)
},
Context: context.Background(),
}, nil
}

Expand All @@ -97,6 +99,7 @@ func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts {
}
return tx.WithSignature(signer, signature)
},
Context: context.Background(),
}
}

Expand Down Expand Up @@ -133,6 +136,7 @@ func NewKeyStoreTransactorWithChainID(keystore *keystore.KeyStore, account accou
}
return tx.WithSignature(signer, signature)
},
Context: context.Background(),
}, nil
}

Expand All @@ -156,6 +160,7 @@ func NewKeyedTransactorWithChainID(key *ecdsa.PrivateKey, chainID *big.Int) (*Tr
}
return tx.WithSignature(signer, signature)
},
Context: context.Background(),
}, nil
}

Expand All @@ -170,5 +175,6 @@ func NewClefTransactor(clef *external.ExternalSigner, account accounts.Account)
}
return clef.SignTx(account, transaction, nil) // Clef enforces its own chain id
},
Context: context.Background(),
}
}
19 changes: 15 additions & 4 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,19 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
} else {
hi = b.pendingBlock.GasLimit()
}
// Normalize the max fee per gas the call is willing to spend.
var feeCap *big.Int
if call.GasPrice != nil && (call.GasFeeCap != nil || call.GasTipCap != nil) {
return 0, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
} else if call.GasPrice != nil {
feeCap = call.GasPrice
} else if call.GasFeeCap != nil {
feeCap = call.GasFeeCap
} else {
feeCap = common.Big0
}
// Recap the highest gas allowance with account's balance.
if call.GasPrice != nil && call.GasPrice.BitLen() != 0 {
if feeCap.BitLen() != 0 {
balance := b.pendingState.GetBalance(call.From) // from can't be nil
available := new(big.Int).Set(balance)
if call.Value != nil {
Expand All @@ -498,14 +509,14 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
}
available.Sub(available, call.Value)
}
allowance := new(big.Int).Div(available, call.GasPrice)
allowance := new(big.Int).Div(available, feeCap)
if allowance.IsUint64() && hi > allowance.Uint64() {
transfer := call.Value
if transfer == nil {
transfer = new(big.Int)
}
log.Warn("Gas estimation capped by limited funds", "original", hi, "balance", balance,
"sent", transfer, "gasprice", call.GasPrice, "fundable", allowance)
"sent", transfer, "feecap", feeCap, "fundable", allowance)
hi = allowance.Uint64()
}
}
Expand Down Expand Up @@ -784,7 +795,7 @@ type callMsg struct {

func (m callMsg) From() common.Address { return m.CallMsg.From }
func (m callMsg) Nonce() uint64 { return 0 }
func (m callMsg) CheckNonce() bool { return false }
func (m callMsg) IsFake() bool { return true }
func (m callMsg) To() *common.Address { return m.CallMsg.To }
func (m callMsg) GasPrice() *big.Int { return m.CallMsg.GasPrice }
func (m callMsg) GasFeeCap() *big.Int { return m.CallMsg.GasFeeCap }
Expand Down
23 changes: 23 additions & 0 deletions accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,26 @@ func TestEstimateGasWithPrice(t *testing.T) {
Value: big.NewInt(100000000000),
Data: nil,
}, 21000, errors.New("gas required exceeds allowance (10999)")}, // 10999=(2.2ether-1000wei)/(2e14)

{"EstimateEIP1559WithHighFees", ethereum.CallMsg{
From: addr,
To: &addr,
Gas: 0,
GasFeeCap: big.NewInt(1e14), // maxgascost = 2.1ether
GasTipCap: big.NewInt(1),
Value: big.NewInt(1e17), // the remaining balance for fee is 2.1ether
Data: nil,
}, params.TxGas, nil},

{"EstimateEIP1559WithSuperHighFees", ethereum.CallMsg{
From: addr,
To: &addr,
Gas: 0,
GasFeeCap: big.NewInt(1e14), // maxgascost = 2.1ether
GasTipCap: big.NewInt(1),
Value: big.NewInt(1e17 + 1), // the remaining balance for fee is 2.1ether
Data: nil,
}, params.TxGas, errors.New("gas required exceeds allowance (20999)")}, // 20999=(2.2ether-0.1ether-1wei)/(1e14)
}
for i, c := range cases {
got, err := sim.EstimateGas(context.Background(), c.message)
Expand All @@ -592,6 +612,9 @@ func TestEstimateGasWithPrice(t *testing.T) {
}
continue
}
if c.expectError == nil && err != nil {
t.Fatalf("test %d: didn't expect error, got %v", i, err)
}
if got != c.expect {
t.Fatalf("test %d: gas estimation mismatch, want %d, got %d", i, c.expect, got)
}
Expand Down
25 changes: 25 additions & 0 deletions accounts/abi/bind/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"errors"
"fmt"
"math/big"
"strings"
"sync"

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
Expand Down Expand Up @@ -76,6 +78,29 @@ type WatchOpts struct {
Context context.Context // Network context to support cancellation and timeouts (nil = no timeout)
}

// MetaData collects all metadata for a bound contract.
type MetaData struct {
mu sync.Mutex
Sigs map[string]string
Bin string
ABI string
ab *abi.ABI
}

func (m *MetaData) GetAbi() (*abi.ABI, error) {
m.mu.Lock()
defer m.mu.Unlock()
if m.ab != nil {
return m.ab, nil
}
if parsed, err := abi.JSON(strings.NewReader(m.ABI)); err != nil {
return nil, err
} else {
m.ab = &parsed
}
return m.ab, nil
}

// BoundContract is the base wrapper object that reflects a contract on the
// Ethereum network. It contains a collection of methods that are used by the
// higher level contract bindings to operate.
Expand Down
34 changes: 26 additions & 8 deletions accounts/abi/bind/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ package {{.Package}}
import (
"math/big"
"strings"
"errors"

ethereum "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
Expand All @@ -101,6 +102,7 @@ import (

// Reference imports to suppress errors if they are not otherwise used.
var (
_ = errors.New
_ = big.NewInt
_ = strings.NewReader
_ = ethereum.NotFound
Expand All @@ -120,32 +122,48 @@ var (
{{end}}

{{range $contract := .Contracts}}
// {{.Type}}MetaData contains all meta data concerning the {{.Type}} contract.
var {{.Type}}MetaData = &bind.MetaData{
ABI: "{{.InputABI}}",
{{if $contract.FuncSigs -}}
Sigs: map[string]string{
{{range $strsig, $binsig := .FuncSigs}}"{{$binsig}}": "{{$strsig}}",
{{end}}
},
{{end -}}
{{if .InputBin -}}
Bin: "0x{{.InputBin}}",
{{end}}
}
// {{.Type}}ABI is the input ABI used to generate the binding from.
const {{.Type}}ABI = "{{.InputABI}}"
// Deprecated: Use {{.Type}}MetaData.ABI instead.
var {{.Type}}ABI = {{.Type}}MetaData.ABI

{{if $contract.FuncSigs}}
// Deprecated: Use {{.Type}}MetaData.Sigs instead.
// {{.Type}}FuncSigs maps the 4-byte function signature to its string representation.
var {{.Type}}FuncSigs = map[string]string{
{{range $strsig, $binsig := .FuncSigs}}"{{$binsig}}": "{{$strsig}}",
{{end}}
}
var {{.Type}}FuncSigs = {{.Type}}MetaData.Sigs
{{end}}

{{if .InputBin}}
// {{.Type}}Bin is the compiled bytecode used for deploying new contracts.
var {{.Type}}Bin = "0x{{.InputBin}}"
// Deprecated: Use {{.Type}}MetaData.Bin instead.
var {{.Type}}Bin = {{.Type}}MetaData.Bin

// Deploy{{.Type}} deploys a new Ethereum contract, binding an instance of {{.Type}} to it.
func Deploy{{.Type}}(auth *bind.TransactOpts, backend bind.ContractBackend {{range .Constructor.Inputs}}, {{.Name}} {{bindtype .Type $structs}}{{end}}) (common.Address, *types.Transaction, *{{.Type}}, error) {
parsed, err := abi.JSON(strings.NewReader({{.Type}}ABI))
parsed, err := {{.Type}}MetaData.GetAbi()
if err != nil {
return common.Address{}, nil, nil, err
}
if parsed == nil {
return common.Address{}, nil, nil, errors.New("GetABI returned nil")
}
{{range $pattern, $name := .Libraries}}
{{decapitalise $name}}Addr, _, _, _ := Deploy{{capitalise $name}}(auth, backend)
{{$contract.Type}}Bin = strings.Replace({{$contract.Type}}Bin, "__${{$pattern}}$__", {{decapitalise $name}}Addr.String()[2:], -1)
{{end}}
address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex({{.Type}}Bin), backend {{range .Constructor.Inputs}}, {{.Name}}{{end}})
address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex({{.Type}}Bin), backend {{range .Constructor.Inputs}}, {{.Name}}{{end}})
if err != nil {
return common.Address{}, nil, nil, err
}
Expand Down
21 changes: 14 additions & 7 deletions accounts/external/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/signer/core"
"github.com/ethereum/go-ethereum/signer/core/apitypes"
)

type ExternalBackend struct {
Expand Down Expand Up @@ -196,36 +196,43 @@ type signTransactionResult struct {
Tx *types.Transaction `json:"tx"`
}

// SignTx sends the transaction to the external signer.
// If chainID is nil, or tx.ChainID is zero, the chain ID will be assigned
// by the external signer. For non-legacy transactions, the chain ID of the
// transaction overrides the chainID parameter.
func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
data := hexutil.Bytes(tx.Data())
var to *common.MixedcaseAddress
if tx.To() != nil {
t := common.NewMixedcaseAddress(*tx.To())
to = &t
}
args := &core.SendTxArgs{
args := &apitypes.SendTxArgs{
Data: &data,
Nonce: hexutil.Uint64(tx.Nonce()),
Value: hexutil.Big(*tx.Value()),
Gas: hexutil.Uint64(tx.Gas()),
To: to,
From: common.NewMixedcaseAddress(account.Address),
}
if tx.GasFeeCap() != nil {
switch tx.Type() {
case types.LegacyTxType, types.AccessListTxType:
args.GasPrice = (*hexutil.Big)(tx.GasPrice())
case types.DynamicFeeTxType:
args.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap())
args.MaxPriorityFeePerGas = (*hexutil.Big)(tx.GasTipCap())
} else {
args.GasPrice = (*hexutil.Big)(tx.GasPrice())
default:
return nil, fmt.Errorf("unsupported tx type %d", tx.Type())
}
// We should request the default chain id that we're operating with
// (the chain we're executing on)
if chainID != nil {
if chainID != nil && chainID.Sign() != 0 {
args.ChainID = (*hexutil.Big)(chainID)
}
if tx.Type() != types.LegacyTxType {
// However, if the user asked for a particular chain id, then we should
// use that instead.
if tx.ChainId() != nil {
if tx.ChainId().Sign() != 0 {
args.ChainID = (*hexutil.Big)(tx.ChainId())
}
accessList := tx.AccessList()
Expand Down
4 changes: 2 additions & 2 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func maybeSkipArchive(env build.Environment) {
os.Exit(0)
}
if env.Branch != "master" && !strings.HasPrefix(env.Tag, "v1.") {
log.Printf("skipping archive creation because branch %q, tag %q is not on the whitelist", env.Branch, env.Tag)
log.Printf("skipping archive creation because branch %q, tag %q is not on the inclusion list", env.Branch, env.Tag)
os.Exit(0)
}
}
Expand Down Expand Up @@ -492,7 +492,7 @@ func doDocker(cmdline []string) {
case env.Branch == "master":
tags = []string{"latest"}
case strings.HasPrefix(env.Tag, "v1."):
tags = []string{"stable", fmt.Sprintf("release-1.%d", params.VersionMinor), params.Version}
tags = []string{"stable", fmt.Sprintf("release-1.%d", params.VersionMinor), "v" + params.Version}
}
// If architecture specific image builds are requested, build and push them
if *image {
Expand Down
4 changes: 2 additions & 2 deletions cmd/abidump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"strings"

"github.com/ethereum/go-ethereum/signer/core"
"github.com/ethereum/go-ethereum/signer/core/apitypes"
"github.com/ethereum/go-ethereum/signer/fourbyte"
)

Expand All @@ -41,7 +41,7 @@ func parse(data []byte) {
if err != nil {
die(err)
}
messages := core.ValidationMessages{}
messages := apitypes.ValidationMessages{}
db.ValidateCallData(nil, data, &messages)
for _, m := range messages.Messages {
fmt.Printf("%v: %v\n", m.Typ, m.Message)
Expand Down
Loading