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

[Upgrade] Go-Ethereum release v1.9.14 #1130

Merged
merged 95 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
af4080b
trie: fix concurrent usage of secKeyBuf, ref #20920
holiman Apr 15, 2020
3bf1054
params: begin v1.9.14 release cycle
karalabe Apr 16, 2020
7a63faf
p2p/discover: add helper methods to UDPv5 (#20918)
Apr 16, 2020
ca22d07
event: fix inconsistency in Lock and Unlock (#20933)
BurtonQin Apr 17, 2020
ac9c03f
accounts/abi: Prevent recalculation of internal fields (#20895)
MariusVanDerWijden Apr 20, 2020
648b0cb
cmd, core: remove override muir glacier and override istanbul (#20942)
renaynay Apr 20, 2020
79b68dd
Merge pull request #20923 from holiman/fix_seckeybuf
karalabe Apr 20, 2020
7599999
snapshot: add Unlock before return (#20948)
BurtonQin Apr 21, 2020
c036fe3
core/state/snapshot: make difflayer account iterator seek operation i…
holiman Apr 21, 2020
6c458f3
p2p: defer wait group done in protocol start (#20951)
ucwong Apr 21, 2020
870d4c4
Merge pull request #20953 from holiman/fixdlseek
karalabe Apr 22, 2020
c60c0c9
go.mod : update fastcache to 1.5.7 (#20936)
ucwong Apr 22, 2020
b9df7ec
all: seperate consensus error and evm internal error (#20830)
rjl493456442 Apr 22, 2020
2ec7232
core: mirror full node reorg logic in light client too (#20931)
icodezjb Apr 22, 2020
38aab0a
accounts/keystore: fix double import race (#20915)
MariusVanDerWijden Apr 22, 2020
44ff3f3
trie: initial implementation for range proof (#20908)
rjl493456442 Apr 24, 2020
8a2e8fa
core/state/snapshot: fix binary iterator (#20970)
rjl493456442 Apr 24, 2020
1aa8329
p2p/enode: update code comment (#20972)
tgyKomgo Apr 24, 2020
b0bbd47
eth: fix shutdown regression to abort downloads, not just cancel
karalabe Apr 27, 2020
a070e23
Merge pull request #20988 from karalabe/catchup-shutdown
karalabe Apr 27, 2020
40283d0
node: shut down all node-related HTTP servers gracefully (#20956)
seh Apr 27, 2020
e32ee6a
accounts/abi: added abi test cases, minor bug fixes (#20903)
MariusVanDerWijden Apr 27, 2020
ba068d4
core: add check in AddChildIndexer to avoid double lock (#20982)
BurtonQin Apr 27, 2020
5c39934
rpc: make ExampleClientSubscription work with the geth API (#19483)
jyap808 Apr 27, 2020
92a7538
core: improve TestLogRebirth (#20961)
fjl Apr 28, 2020
1893266
go.mod: upgrade to golang-lru v0.5.4 (#20992)
ucwong Apr 28, 2020
9887edd
rpc: add explicit 200 response for empty HTTP GET (#20952)
seh Apr 28, 2020
0708b57
event, whisper/whisperv6: use defer where possible (#20940)
ucwong Apr 28, 2020
7f95a85
signer, log: properly escape character sequences (#20987)
holiman Apr 28, 2020
1264c19
go.mod : goupnp v1.0.0 upgrade (#20996)
ucwong Apr 28, 2020
26d271d
core/state/snapshot: implement storage iterator (#20971)
rjl493456442 Apr 29, 2020
4b6f6ff
core/state/snapshot: fix journal nil deserialziation
karalabe Apr 29, 2020
3cebfb6
Merge pull request #21003 from karalabe/snapshot-journal-nilfix
karalabe Apr 30, 2020
2337aa6
core/state/snapshot: fix trie generator reporter (#21004)
rjl493456442 Apr 30, 2020
d2d3166
accounts/external: fill account-cache if that hasn't already been don…
holiman Apr 30, 2020
7e4d192
go.sum: run go mod tidy (#21014)
fjl May 1, 2020
c43be6c
les: remove invalid use of t.Fatal in TestHandshake (#21012)
BurtonQin May 1, 2020
510b6f9
accounts/external: convert signature v value to 0/1 (#20997)
holiman May 1, 2020
65cd28a
tests: cleanup snapshot generator goroutine leak
karalabe May 4, 2020
e872083
accounts/abi: removed Kind from Type struct (#21009)
MariusVanDerWijden May 4, 2020
ab72803
accounts/abi: move U256Bytes to common/math (#21020)
MariusVanDerWijden May 4, 2020
5e45db7
Merge pull request #21021 from karalabe/tests-snapshot-gen-cleanup
karalabe May 4, 2020
da59147
core/state/snapshot: release iterator after verification
karalabe May 4, 2020
5876566
Merge pull request #21023 from karalabe/snapshot-verify-iterator-release
karalabe May 4, 2020
c989bca
cmd/utils: renames flags related to http-rpc server (#20935)
renaynay May 5, 2020
4515772
tests: skip consensus test using 1GB RAM
karalabe May 5, 2020
8f8ff8d
cmd/geth: handle memfixes on 32bit arch with large RAM
karalabe May 5, 2020
a52511e
build: raise test timeout back to 10 mins (#21027)
karalabe May 5, 2020
44a3b8c
Merge pull request #21026 from karalabe/disable-highmem-test
karalabe May 5, 2020
933acf3
account/abi: remove superfluous type checking (#21022)
MariusVanDerWijden May 5, 2020
34ed2d8
eth: skip transaction announcer goroutine on eth<65
karalabe May 6, 2020
292570a
Merge pull request #21028 from karalabe/memfix-32bit-arch
karalabe May 6, 2020
b982598
Merge pull request #21032 from karalabe/skip-announce-goroutine-eth64
karalabe May 6, 2020
c2147ee
eth: don't inadvertently enable snapshots in archive nodes (#21025)
ploui May 6, 2020
5cdc2df
trie: fix TestBadRangeProof unit test (#21034)
rjl493456442 May 6, 2020
234cc8e
eth/downloader: minor typo fixes in comments (#21035)
gballet May 6, 2020
39c64d8
core: avoid double-lock in tx_pool_test (#20984)
BurtonQin May 6, 2020
90af6da
core/state/snapshot: don't create storage list for non-existing accounts
karalabe May 6, 2020
87c463c
Merge pull request #21036 from karalabe/snapshot-storage-leak
karalabe May 6, 2020
85944c2
core/state/snapshot: fix typo (#21037)
rjl493456442 May 7, 2020
dd88bd8
accounts/abi/bind: add void if no return args specified (#21002)
MariusVanDerWijden May 7, 2020
1152f45
core/state: include zero-address in state dump if present (#21038)
holiman May 7, 2020
b0b65d0
core/state: abort commit if read errors have occurred (#21039)
holiman May 7, 2020
82f9ed4
core/state: avoid statedb.dbErr due to emptyCode (#21051)
holiman May 8, 2020
e29e4c2
build: fix CLI params for windows LNK files (#21055)
ligi May 11, 2020
0b2edf0
core/state: make GetCodeSize mirror GetCode implementation wise
karalabe May 11, 2020
263622f
accounts/abi/bind/backend, internal/ethapi: recap gas limit with bala…
rjl493456442 May 11, 2020
37877e8
Merge pull request #21056 from karalabe/statedb-simpler-code
karalabe May 11, 2020
930e82d
params, cmd/utils: remove outdated discv5 bootnodes, deprecate flags …
MariusVanDerWijden May 11, 2020
bd60295
console: fix some crashes/errors in the bridge (#21050)
holiman May 11, 2020
069a7e1
core/rawdb: stop freezer process as part of freezer.Close() (#21010)
AusIV May 11, 2020
6f54ae2
p2p: add 0 port check in dialer (#21008)
fjl May 11, 2020
126ac94
params: bump CHTs for the v1.9.14 release
karalabe May 11, 2020
4535230
cmd, core, eth: background transaction indexing (#20302)
holiman May 11, 2020
40859a2
Merge pull request #21061 from karalabe/cht-1.9.14
karalabe May 11, 2020
7ace5a3
core: fixup blockchain tests (#21062)
holiman May 12, 2020
53cac02
les: drop the message if the entire p2p connection is stuck (#21033)
rjl493456442 May 12, 2020
aaede53
core/rawdb : log format fix for Unindexing transaction (#21064)
ucwong May 12, 2020
7540c53
core/rawdb: remove unused math (#21065)
ucwong May 12, 2020
7b7e592
miner: support disabling empty blockprecommits form the Go API (#20736)
rjl493456442 May 12, 2020
b8ea904
accounts/abi: accounts/abi/bind: Move topics to abi package (#21057)
MariusVanDerWijden May 12, 2020
0b63915
accounts/abi: allow overloaded argument names (#21060)
MariusVanDerWijden May 12, 2020
d02301f
core: fix missing receipt on Clique crashes (#21045)
rjl493456442 May 13, 2020
a188a1e
ethstats: stop report ticker in each loop cycle #21070 (#21071)
duanhao0814 May 13, 2020
6d74d1e
params: release go-ethereum v1.9.14
karalabe May 13, 2020
d64159e
Merge branch 'upgrade/go-ethereum/v1.9.13-2021204155332' into upgrade…
ricardolyn Feb 11, 2021
5e46575
fix: change dependencies to use math.U256Bytes()
ricardolyn Feb 12, 2021
83d8bb6
fix: add missing argument on test
ricardolyn Feb 12, 2021
ac7fc19
refactor/fix: with the new struct ExecutionResult returned by state T…
ricardolyn Feb 12, 2021
4b5110a
fix: wrong return of error based on previous logic
ricardolyn Feb 12, 2021
893ae24
lint: fix lint issues
ricardolyn Feb 12, 2021
4f65add
tidy: remove TODO done
ricardolyn Feb 12, 2021
3a73c89
go.mod: tidy up
ricardolyn Feb 12, 2021
5e96455
Merge branch 'master' into upgrade/go-ethereum/v1.9.14-2021211111542
ricardolyn Feb 12, 2021
d0adcfa
fix: imports order and white line
ricardolyn Feb 12, 2021
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
147 changes: 67 additions & 80 deletions accounts/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"io"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)

// The ABI holds information about a contract's context and available
Expand Down Expand Up @@ -76,7 +77,7 @@ func (abi ABI) Pack(name string, args ...interface{}) ([]byte, error) {
return nil, err
}
// Pack up the method ID too if not a constructor and return
return append(method.ID(), arguments...), nil
return append(method.ID, arguments...), nil
}

// Unpack output in v according to the abi specification
Expand Down Expand Up @@ -139,59 +140,17 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
for _, field := range fields {
switch field.Type {
case "constructor":
abi.Constructor = Method{
Inputs: field.Inputs,

// Note for constructor the `StateMutability` can only
// be payable or nonpayable according to the output of
// compiler. So constant is always false.
StateMutability: field.StateMutability,

// Legacy fields, keep them for backward compatibility
Constant: field.Constant,
Payable: field.Payable,
}
abi.Constructor = NewMethod("", "", Constructor, field.StateMutability, field.Constant, field.Payable, field.Inputs, nil)
case "function":
name := field.Name
_, ok := abi.Methods[name]
for idx := 0; ok; idx++ {
name = fmt.Sprintf("%s%d", field.Name, idx)
_, ok = abi.Methods[name]
}
abi.Methods[name] = Method{
Name: name,
RawName: field.Name,
StateMutability: field.StateMutability,
Inputs: field.Inputs,
Outputs: field.Outputs,

// Legacy fields, keep them for backward compatibility
Constant: field.Constant,
Payable: field.Payable,
}
name := abi.overloadedMethodName(field.Name)
abi.Methods[name] = NewMethod(name, field.Name, Function, field.StateMutability, field.Constant, field.Payable, field.Inputs, field.Outputs)
case "fallback":
// New introduced function type in v0.6.0, check more detail
// here https://solidity.readthedocs.io/en/v0.6.0/contracts.html#fallback-function
if abi.HasFallback() {
return errors.New("only single fallback is allowed")
}
abi.Fallback = Method{
Name: "",
RawName: "",

// The `StateMutability` can only be payable or nonpayable,
// so the constant is always false.
StateMutability: field.StateMutability,
IsFallback: true,

// Fallback doesn't have any input or output
Inputs: nil,
Outputs: nil,

// Legacy fields, keep them for backward compatibility
Constant: field.Constant,
Payable: field.Payable,
}
abi.Fallback = NewMethod("", "", Fallback, field.StateMutability, field.Constant, field.Payable, nil, nil)
case "receive":
// New introduced function type in v0.6.0, check more detail
// here https://solidity.readthedocs.io/en/v0.6.0/contracts.html#fallback-function
Expand All @@ -201,49 +160,55 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
if field.StateMutability != "payable" {
return errors.New("the statemutability of receive can only be payable")
}
abi.Receive = Method{
Name: "",
RawName: "",

// The `StateMutability` can only be payable, so constant
// is always true while payable is always false.
StateMutability: field.StateMutability,
IsReceive: true,

// Receive doesn't have any input or output
Inputs: nil,
Outputs: nil,

// Legacy fields, keep them for backward compatibility
Constant: field.Constant,
Payable: field.Payable,
}
abi.Receive = NewMethod("", "", Receive, field.StateMutability, field.Constant, field.Payable, nil, nil)
case "event":
name := field.Name
_, ok := abi.Events[name]
for idx := 0; ok; idx++ {
name = fmt.Sprintf("%s%d", field.Name, idx)
_, ok = abi.Events[name]
}
abi.Events[name] = Event{
Name: name,
RawName: field.Name,
Anonymous: field.Anonymous,
Inputs: field.Inputs,
}
name := abi.overloadedEventName(field.Name)
abi.Events[name] = NewEvent(name, field.Name, field.Anonymous, field.Inputs)
default:
return fmt.Errorf("abi: could not recognize type %v of field %v", field.Type, field.Name)
}
}
return nil
}

// overloadedMethodName returns the next available name for a given function.
// Needed since solidity allows for function overload.
//
// e.g. if the abi contains Methods send, send1
// overloadedMethodName would return send2 for input send.
func (abi *ABI) overloadedMethodName(rawName string) string {
name := rawName
_, ok := abi.Methods[name]
for idx := 0; ok; idx++ {
name = fmt.Sprintf("%s%d", rawName, idx)
_, ok = abi.Methods[name]
}
return name
}

// overloadedEventName returns the next available name for a given event.
// Needed since solidity allows for event overload.
//
// e.g. if the abi contains events received, received1
// overloadedEventName would return received2 for input received.
func (abi *ABI) overloadedEventName(rawName string) string {
name := rawName
_, ok := abi.Events[name]
for idx := 0; ok; idx++ {
name = fmt.Sprintf("%s%d", rawName, idx)
_, ok = abi.Events[name]
}
return name
}

// MethodById looks up a method by the 4-byte id
// returns nil if none found
func (abi *ABI) MethodById(sigdata []byte) (*Method, error) {
if len(sigdata) < 4 {
return nil, fmt.Errorf("data too short (%d bytes) for abi method lookup", len(sigdata))
}
for _, method := range abi.Methods {
if bytes.Equal(method.ID(), sigdata[:4]) {
if bytes.Equal(method.ID, sigdata[:4]) {
return &method, nil
}
}
Expand All @@ -254,7 +219,7 @@ func (abi *ABI) MethodById(sigdata []byte) (*Method, error) {
// ABI and returns nil if none found.
func (abi *ABI) EventByID(topic common.Hash) (*Event, error) {
for _, event := range abi.Events {
if bytes.Equal(event.ID().Bytes(), topic.Bytes()) {
if bytes.Equal(event.ID.Bytes(), topic.Bytes()) {
return &event, nil
}
}
Expand All @@ -263,10 +228,32 @@ func (abi *ABI) EventByID(topic common.Hash) (*Event, error) {

// HasFallback returns an indicator whether a fallback function is included.
func (abi *ABI) HasFallback() bool {
return abi.Fallback.IsFallback
return abi.Fallback.Type == Fallback
}

// HasReceive returns an indicator whether a receive function is included.
func (abi *ABI) HasReceive() bool {
return abi.Receive.IsReceive
return abi.Receive.Type == Receive
}

// revertSelector is a special function selector for revert reason unpacking.
var revertSelector = crypto.Keccak256([]byte("Error(string)"))[:4]

// UnpackRevert resolves the abi-encoded revert reason. According to the solidity
// spec https://solidity.readthedocs.io/en/latest/control-structures.html#revert,
// the provided revert reason is abi-encoded as if it were a call to a function
// `Error(string)`. So it's a special tool for it.
func UnpackRevert(data []byte) (string, error) {
if len(data) < 4 {
return "", errors.New("invalid data for unpacking")
}
if !bytes.Equal(data[:4], revertSelector) {
return "", errors.New("invalid data for unpacking")
}
var reason string
typ, _ := NewType("string", "", nil)
if err := (Arguments{{Type: typ}}).Unpack(&reason, data[4:]); err != nil {
return "", err
}
return reason, nil
}
Loading