Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Commit ce4ab96

Browse files
authored
Merge pull request #30 from makerdao/upgrade/v1.10.15
Upgrade/v1.10.15
2 parents 009d406 + d96b8e0 commit ce4ab96

File tree

185 files changed

+9711
-6479
lines changed

Some content is hidden

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

185 files changed

+9711
-6479
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ on how you can run your own `geth` instance.
6666
By far the most common scenario is people wanting to simply interact with the Ethereum
6767
network: create accounts; transfer funds; deploy and interact with contracts. For this
6868
particular use-case the user doesn't care about years-old historical data, so we can
69-
fast-sync quickly to the current state of the network. To do so:
69+
sync quickly to the current state of the network. To do so:
7070

7171
```shell
7272
$ geth console
@@ -77,7 +77,7 @@ This command will:
7777
causing it to download more data in exchange for avoiding processing the entire history
7878
of the Ethereum network, which is very CPU intensive.
7979
* Start up `geth`'s built-in interactive [JavaScript console](https://geth.ethereum.org/docs/interface/javascript-console),
80-
(via the trailing `console` subcommand) through which you can interact using [`web3` methods](https://web3js.readthedocs.io/)
80+
(via the trailing `console` subcommand) through which you can interact using [`web3` methods](https://github.com/ChainSafe/web3.js/blob/0.20.7/DOCUMENTATION.md)
8181
(note: the `web3` version bundled within `geth` is very old, and not up to date with official docs),
8282
as well as `geth`'s own [management APIs](https://geth.ethereum.org/docs/rpc/server).
8383
This tool is optional and if you leave it out you can always attach to an already running
@@ -168,7 +168,7 @@ docker run -d --name ethereum-node -v /Users/alice/ethereum:/root \
168168
ethereum/client-go
169169
```
170170

171-
This will start `geth` in fast-sync mode with a DB memory allowance of 1GB just as the
171+
This will start `geth` in snap-sync mode with a DB memory allowance of 1GB just as the
172172
above command does. It will also create a persistent volume in your home directory for
173173
saving your blockchain as well as map the default ports. There is also an `alpine` tag
174174
available for a slim version of the image.

SECURITY.md

Lines changed: 142 additions & 87 deletions
Large diffs are not rendered by default.

accounts/abi/bind/backends/simulated_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ func TestEstimateGas(t *testing.T) {
496496
GasPrice: big.NewInt(0),
497497
Value: nil,
498498
Data: common.Hex2Bytes("b9b046f9"),
499-
}, 0, errors.New("invalid opcode: opcode 0xfe not defined"), nil},
499+
}, 0, errors.New("invalid opcode: INVALID"), nil},
500500

501501
{"Valid", ethereum.CallMsg{
502502
From: addr,

accounts/abi/bind/bind.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
8888
transactIdentifiers = make(map[string]bool)
8989
eventIdentifiers = make(map[string]bool)
9090
)
91+
92+
for _, input := range evmABI.Constructor.Inputs {
93+
if hasStruct(input.Type) {
94+
bindStructType[lang](input.Type, structs)
95+
}
96+
}
97+
9198
for _, original := range evmABI.Methods {
9299
// Normalize the method for capital cases and non-anonymous inputs/outputs
93100
normalized := original

accounts/abi/bind/bind_test.go

Lines changed: 65 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,50 @@ var bindTests = []struct {
19111911
nil,
19121912
nil,
19131913
},
1914+
{
1915+
name: `ConstructorWithStructParam`,
1916+
contract: `
1917+
pragma solidity >=0.8.0 <0.9.0;
1918+
1919+
contract ConstructorWithStructParam {
1920+
struct StructType {
1921+
uint256 field;
1922+
}
1923+
1924+
constructor(StructType memory st) {}
1925+
}
1926+
`,
1927+
bytecode: []string{`0x608060405234801561001057600080fd5b506040516101c43803806101c48339818101604052810190610032919061014a565b50610177565b6000604051905090565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6100958261004c565b810181811067ffffffffffffffff821117156100b4576100b361005d565b5b80604052505050565b60006100c7610038565b90506100d3828261008c565b919050565b6000819050919050565b6100eb816100d8565b81146100f657600080fd5b50565b600081519050610108816100e2565b92915050565b60006020828403121561012457610123610047565b5b61012e60206100bd565b9050600061013e848285016100f9565b60008301525092915050565b6000602082840312156101605761015f610042565b5b600061016e8482850161010e565b91505092915050565b603f806101856000396000f3fe6080604052600080fdfea2646970667358221220cdffa667affecefac5561f65f4a4ba914204a8d4eb859d8cd426fb306e5c12a364736f6c634300080a0033`},
1928+
abi: []string{`[{"inputs":[{"components":[{"internalType":"uint256","name":"field","type":"uint256"}],"internalType":"struct ConstructorWithStructParam.StructType","name":"st","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"}]`},
1929+
imports: `
1930+
"math/big"
1931+
1932+
"github.com/ethereum/go-ethereum/accounts/abi/bind"
1933+
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
1934+
"github.com/ethereum/go-ethereum/core"
1935+
"github.com/ethereum/go-ethereum/crypto"
1936+
"github.com/ethereum/go-ethereum/eth/ethconfig"
1937+
`,
1938+
tester: `
1939+
var (
1940+
key, _ = crypto.GenerateKey()
1941+
user, _ = bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337))
1942+
sim = backends.NewSimulatedBackend(core.GenesisAlloc{user.From: {Balance: big.NewInt(1000000000000000000)}}, ethconfig.Defaults.Miner.GasCeil)
1943+
)
1944+
defer sim.Close()
1945+
1946+
_, tx, _, err := DeployConstructorWithStructParam(user, sim, ConstructorWithStructParamStructType{Field: big.NewInt(42)})
1947+
if err != nil {
1948+
t.Fatalf("DeployConstructorWithStructParam() got err %v; want nil err", err)
1949+
}
1950+
sim.Commit()
1951+
1952+
if _, err = bind.WaitDeployed(nil, sim, tx); err != nil {
1953+
t.Logf("Deployment tx: %+v", tx)
1954+
t.Errorf("bind.WaitDeployed(nil, %T, <deployment tx>) got err %v; want nil err", sim, err)
1955+
}
1956+
`,
1957+
},
19141958
}
19151959

19161960
// Tests that packages generated by the binder can be successfully compiled and
@@ -1934,22 +1978,23 @@ func TestGolangBindings(t *testing.T) {
19341978
}
19351979
// Generate the test suite for all the contracts
19361980
for i, tt := range bindTests {
1937-
var types []string
1938-
if tt.types != nil {
1939-
types = tt.types
1940-
} else {
1941-
types = []string{tt.name}
1942-
}
1943-
// Generate the binding and create a Go source file in the workspace
1944-
bind, err := Bind(types, tt.abi, tt.bytecode, tt.fsigs, "bindtest", LangGo, tt.libs, tt.aliases)
1945-
if err != nil {
1946-
t.Fatalf("test %d: failed to generate binding: %v", i, err)
1947-
}
1948-
if err = ioutil.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+".go"), []byte(bind), 0600); err != nil {
1949-
t.Fatalf("test %d: failed to write binding: %v", i, err)
1950-
}
1951-
// Generate the test file with the injected test code
1952-
code := fmt.Sprintf(`
1981+
t.Run(tt.name, func(t *testing.T) {
1982+
var types []string
1983+
if tt.types != nil {
1984+
types = tt.types
1985+
} else {
1986+
types = []string{tt.name}
1987+
}
1988+
// Generate the binding and create a Go source file in the workspace
1989+
bind, err := Bind(types, tt.abi, tt.bytecode, tt.fsigs, "bindtest", LangGo, tt.libs, tt.aliases)
1990+
if err != nil {
1991+
t.Fatalf("test %d: failed to generate binding: %v", i, err)
1992+
}
1993+
if err = ioutil.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+".go"), []byte(bind), 0600); err != nil {
1994+
t.Fatalf("test %d: failed to write binding: %v", i, err)
1995+
}
1996+
// Generate the test file with the injected test code
1997+
code := fmt.Sprintf(`
19531998
package bindtest
19541999
19552000
import (
@@ -1961,9 +2006,10 @@ func TestGolangBindings(t *testing.T) {
19612006
%s
19622007
}
19632008
`, tt.imports, tt.name, tt.tester)
1964-
if err := ioutil.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+"_test.go"), []byte(code), 0600); err != nil {
1965-
t.Fatalf("test %d: failed to write tests: %v", i, err)
1966-
}
2009+
if err := ioutil.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+"_test.go"), []byte(code), 0600); err != nil {
2010+
t.Fatalf("test %d: failed to write tests: %v", i, err)
2011+
}
2012+
})
19672013
}
19682014
// Convert the package to go modules and use the current source for go-ethereum
19692015
moder := exec.Command(gocmd, "mod", "init", "bindtest")

accounts/abi/unpack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func tuplePointsTo(index int, output []byte) (start int, err error) {
290290
offset := big.NewInt(0).SetBytes(output[index : index+32])
291291
outputLen := big.NewInt(int64(len(output)))
292292

293-
if offset.Cmp(big.NewInt(int64(len(output)))) > 0 {
293+
if offset.Cmp(outputLen) > 0 {
294294
return 0, fmt.Errorf("abi: cannot marshal in to go slice: offset %v would go over slice boundary (len=%v)", offset, outputLen)
295295
}
296296
if offset.BitLen() > 63 {

accounts/accounts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ type Backend interface {
176176
// TextHash is a helper function that calculates a hash for the given message that can be
177177
// safely used to calculate a signature from.
178178
//
179-
// The hash is calulcated as
179+
// The hash is calculated as
180180
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
181181
//
182182
// This gives context to the signed message and prevents signing of transactions.
@@ -188,7 +188,7 @@ func TextHash(data []byte) []byte {
188188
// TextAndHash is a helper function that calculates a hash for the given message that can be
189189
// safely used to calculate a signature from.
190190
//
191-
// The hash is calulcated as
191+
// The hash is calculated as
192192
// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
193193
//
194194
// This gives context to the signed message and prevents signing of transactions.

build/checksums.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# This file contains sha256 checksums of optional build dependencies.
22

3-
2255eb3e4e824dd7d5fcdc2e7f84534371c186312e546fb1086a34c17752f431 go1.17.2.src.tar.gz
4-
7914497a302a132a465d33f5ee044ce05568bacdb390ab805cb75a3435a23f94 go1.17.2.darwin-amd64.tar.gz
5-
ce8771bd3edfb5b28104084b56bbb532eeb47fbb7769c3e664c6223712c30904 go1.17.2.darwin-arm64.tar.gz
6-
8cea5b8d1f8e8cbb58069bfed58954c71c5b1aca2f3c857765dae83bf724d0d7 go1.17.2.freebsd-386.tar.gz
7-
c96e57218fb03e74d683ad63b1684d44c89d5e5b994f36102b33dce21b58499a go1.17.2.freebsd-amd64.tar.gz
8-
8617f2e40d51076983502894181ae639d1d8101bfbc4d7463a2b442f239f5596 go1.17.2.linux-386.tar.gz
9-
f242a9db6a0ad1846de7b6d94d507915d14062660616a61ef7c808a76e4f1676 go1.17.2.linux-amd64.tar.gz
10-
a5a43c9cdabdb9f371d56951b14290eba8ce2f9b0db48fb5fc657943984fd4fc go1.17.2.linux-arm64.tar.gz
11-
04d16105008230a9763005be05606f7eb1c683a3dbf0fbfed4034b23889cb7f2 go1.17.2.linux-armv6l.tar.gz
12-
12e2dc7e0ffeebe77083f267ef6705fec1621cdf2ed6489b3af04a13597ed68d go1.17.2.linux-ppc64le.tar.gz
13-
c4b2349a8d11350ca038b8c57f3cc58dc0b31284bcbed4f7fca39aeed28b4a51 go1.17.2.linux-s390x.tar.gz
14-
8a85257a351996fdf045fe95ed5fdd6917dd48636d562dd11dedf193005a53e0 go1.17.2.windows-386.zip
15-
fa6da0b829a66f5fab7e4e312fd6aa1b2d8f045c7ecee83b3d00f6fe5306759a go1.17.2.windows-amd64.zip
16-
00575c85dc7a129ba892685a456b27a3f3670f71c8bfde1c5ad151f771d55df7 go1.17.2.windows-arm64.zip
3+
3defb9a09bed042403195e872dcbc8c6fae1485963332279668ec52e80a95a2d go1.17.5.src.tar.gz
4+
2db6a5d25815b56072465a2cacc8ed426c18f1d5fc26c1fc8c4f5a7188658264 go1.17.5.darwin-amd64.tar.gz
5+
111f71166de0cb8089bb3e8f9f5b02d76e1bf1309256824d4062a47b0e5f98e0 go1.17.5.darwin-arm64.tar.gz
6+
443c1cd9768df02085014f1eb034ebc7dbe032ffc8a9bb9f2e6617d037eee23c go1.17.5.freebsd-386.tar.gz
7+
17180bdc4126acffd0ebf86d66ef5cbc3488b6734e93374fb00eb09494e006d3 go1.17.5.freebsd-amd64.tar.gz
8+
4f4914303bc18f24fd137a97e595735308f5ce81323c7224c12466fd763fc59f go1.17.5.linux-386.tar.gz
9+
bd78114b0d441b029c8fe0341f4910370925a4d270a6a590668840675b0c653e go1.17.5.linux-amd64.tar.gz
10+
6f95ce3da40d9ce1355e48f31f4eb6508382415ca4d7413b1e7a3314e6430e7e go1.17.5.linux-arm64.tar.gz
11+
aa1fb6c53b4fe72f159333362a10aca37ae938bde8adc9c6eaf2a8e87d1e47de go1.17.5.linux-armv6l.tar.gz
12+
3d4be616e568f0a02cb7f7769bcaafda4b0969ed0f9bb4277619930b96847e70 go1.17.5.linux-ppc64le.tar.gz
13+
8087d4fe991e82804e6485c26568c2e0ee0bfde00ceb9015dc86cb6bf84ef40b go1.17.5.linux-s390x.tar.gz
14+
6d7b9948ee14a906b14f5cbebdfab63cd6828b0b618160847ecd3cc3470a26fe go1.17.5.windows-386.zip
15+
671faf99cd5d81cd7e40936c0a94363c64d654faa0148d2af4bbc262555620b9 go1.17.5.windows-amd64.zip
16+
45e88676b68e9cf364be469b5a27965397f4e339aa622c2f52c10433c56e5030 go1.17.5.windows-arm64.zip
1717

1818
d4bd25b9814eeaa2134197dd2c7671bb791eae786d42010d9d788af20dee4bfa golangci-lint-1.42.0-darwin-amd64.tar.gz
1919
e56859c04a2ad5390c6a497b1acb1cc9329ecb1010260c6faae9b5a4c35b35ea golangci-lint-1.42.0-darwin-arm64.tar.gz

build/ci.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ var (
147147
// This is the version of go that will be downloaded by
148148
//
149149
// go run ci.go install -dlgo
150-
dlgoVersion = "1.17.2"
150+
dlgoVersion = "1.17.5"
151151
)
152152

153153
var GOBIN, _ = filepath.Abs(filepath.Join("build", "bin"))

cmd/clef/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ func testExternalUI(api *core.SignerAPI) {
898898
addr, _ := common.NewMixedcaseAddressFromString("0x0011223344556677889900112233445566778899")
899899
data := `{"types":{"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"address"}],"Person":[{"name":"name","type":"string"},{"name":"test","type":"uint8"},{"name":"wallet","type":"address"}],"Mail":[{"name":"from","type":"Person"},{"name":"to","type":"Person"},{"name":"contents","type":"string"}]},"primaryType":"Mail","domain":{"name":"Ether Mail","version":"1","chainId":"1","verifyingContract":"0xCCCcccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},"message":{"from":{"name":"Cow","test":"3","wallet":"0xcD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},"to":{"name":"Bob","wallet":"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB","test":"2"},"contents":"Hello, Bob!"}}`
900900
//_, err := api.SignData(ctx, accounts.MimetypeTypedData, *addr, hexutil.Encode([]byte(data)))
901-
var typedData core.TypedData
901+
var typedData apitypes.TypedData
902902
json.Unmarshal([]byte(data), &typedData)
903903
_, err := api.SignTypedData(ctx, *addr, typedData)
904904
expectApprove("sign 712 typed data", err)
@@ -1025,7 +1025,7 @@ func GenDoc(ctx *cli.Context) {
10251025
"of the work in canonicalizing and making sense of the data, and it's up to the UI to present" +
10261026
"the user with the contents of the `message`"
10271027
sighash, msg := accounts.TextAndHash([]byte("hello world"))
1028-
messages := []*core.NameValueType{{Name: "message", Value: msg, Typ: accounts.MimetypeTextPlain}}
1028+
messages := []*apitypes.NameValueType{{Name: "message", Value: msg, Typ: accounts.MimetypeTextPlain}}
10291029

10301030
add("SignDataRequest", desc, &core.SignDataRequest{
10311031
Address: common.NewMixedcaseAddress(a),

0 commit comments

Comments
 (0)