Skip to content

Commit 2a21bfa

Browse files
authored
Merge pull request ethereum#92 from etclabscore/fix/aleth-conversion
params/(confp|types): implement Aleth conversion test
2 parents aad60de + fd5ef0a commit 2a21bfa

File tree

305 files changed

+4332
-4213
lines changed

Some content is hidden

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

305 files changed

+4332
-4213
lines changed

.github/CODEOWNERS

Whitespace-only changes.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ build/_vendor/pkg
2424

2525
# used by the Makefile
2626
/build/_workspace/
27+
/build/cache/
2728
/build/bin/
2829
/geth*.zip
2930

.golangci.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
# This file configures github.com/golangci/golangci-lint.
2+
3+
run:
4+
timeout: 2m
5+
tests: true
6+
# default is true. Enables skipping of directories:
7+
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
8+
skip-dirs-use-default: true
9+
10+
linters:
11+
disable-all: true
12+
enable:
13+
- deadcode
14+
- goconst
15+
- goimports
16+
- gosimple
17+
- govet
18+
- ineffassign
19+
- misspell
20+
# - staticcheck
21+
- unconvert
22+
# - unused
23+
- varcheck
24+
125
linters-settings:
26+
gofmt:
27+
simplify: true
228
goconst:
3-
min-occurrences: 6
29+
min-len: 3 # minimum length of string constant
30+
min-occurrences: 6 # minimum number of occurrences
31+
32+
issues:
33+
exclude-rules:
34+
- path: crypto/blake2b/
35+
linters:
36+
- deadcode
37+
- path: crypto/bn256/cloudflare
38+
linters:
39+
- deadcode
40+
- path: p2p/discv5/
41+
linters:
42+
- deadcode
43+
- path: core/vm/instructions_test.go
44+
linters:
45+
- goconst

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ matrix:
1515
deploy:
1616
provider: releases
1717
api_key:
18-
secure: pGlbI2DRfTzdF75hkEwP5vMIpcP1iVEeW3W41DT1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xF1yI42RliE+r7FyX5TtvXvZmSzfrlZcJFn3amC02woe1Fs0GJWvscxdqyftuyIezpaRmkIrL0X+OzYjOLJA2CH6eUdJu0O52zSLg00UeXDd4y9dBgm8AWD1k5tuHQrqq2/tF7abz2XOtmt3cuL9XYOcbXm0lf88AiOEusDaWCoPNNBmvL8mJMCwLWdNsRGQO6NhdkzqH81njP86TCdpFQi7OJDgTobEuy+NXwRkx4B0620JssU=
1919
file: multi-geth*-$TRAVIS_OS_NAME.*
2020
file_glob: true
2121
draft: true
@@ -29,7 +29,7 @@ matrix:
2929
sudo: required
3030
go: 1.13.x
3131
env:
32-
- ARMv5
32+
- ARMv5
3333
git:
3434
submodules: false # avoid cloning ethereum/tests
3535
addons:
@@ -46,7 +46,7 @@ matrix:
4646
deploy:
4747
provider: releases
4848
api_key:
49-
secure: pGlbI2DRfTzdF75hkEwP5vMIpcP1iVEeW3W41DT1X+/GQPlgDN1DB/ocXtMbEId2vJCWgt1HfCSNb9F4NBI94TMamFJQPz4zy/VIXBClG1IGesloe159vU4PixrLBgeTTcuDJRx7X45JeKlHW9LN5ABxeEhYEzPj1De6P5NDePmbFNDvhOkaf5Spk0xGLumRzzf2SHk+w3au9RQM5gVUcgr5U81Qi/ys8aGCLtZ1T+avSoX9rFoB1/YGoHllJfMoNGJr5CLiBwnFGMY8SNfD7XruFptUjTe4D0sMNTgAbT8iDPbw9s5aa2ou2eFWsuGaa8v840kLF+J0dEW0L/y88YzzRbbK3Ve6qNvka8MZ26HLSry7JtAqT6QY0W+h2yMgOmJX6ehlCGg1PoZYVwTp4d0usE88CGa8kTSNlt6/OxVmvNU5E2TPCbiTxF1yI42RliE+r7FyX5TtvXvZmSzfrlZcJFn3amC02woe1Fs0GJWvscxdqyftuyIezpaRmkIrL0X+OzYjOLJA2CH6eUdJu0O52zSLg00UeXDd4y9dBgm8AWD1k5tuHQrqq2/tF7abz2XOtmt3cuL9XYOcbXm0lf88AiOEusDaWCoPNNBmvL8mJMCwLWdNsRGQO6NhdkzqH81njP86TCdpFQi7OJDgTobEuy+NXwRkx4B0620JssU=
49+
secure: pGlbI2DRfTzdF75hkEwP5vMIpcP1iVEeW3W41DT1X+/GQPlgDN1DB/ocXtMbEId2vJCWgt1HfCSNb9F4NBI94TMamFJQPz4zy/VIXBClG1IGesloe159vU4PixrLBgeTTcuDJRx7X45JeKlHW9LN5ABxeEhYEzPj1De6P5NDePmbFNDvhOkaf5Spk0xGLumRzzf2SHk+w3au9RQM5gVUcgr5U81Qi/ys8aGCLtZ1T+avSoX9rFoB1/YGoHllJfMoNGJr5CLiBwnFGMY8SNfD7XruFptUjTe4D0sMNTgAbT8iDPbw9s5aa2ou2eFWsuGaa8v840kLF+J0dEW0L/y88YzzRbbK3Ve6qNvka8MZ26HLSry7JtAqT6QY0W+h2yMgOmJX6ehlCGg1PoZYVwTp4d0usE88CGa8kTSNlt6/OxVmvNU5E2TPCbiTxF1yI42RliE+r7FyX5TtvXvZmSzfrlZcJFn3amC02woe1Fs0GJWvscxdqyftuyIezpaRmkIrL0X+OzYjOLJA2CH6eUdJu0O52zSLg00UeXDd4y9dBgm8AWD1k5tuHQrqq2/tF7abz2XOtmt3cuL9XYOcbXm0lf88AiOEusDaWCoPNNBmvL8mJMCwLWdNsRGQO6NhdkzqH81njP86TCdpFQi7OJDgTobEuy+NXwRkx4B0620JssU=
5050
file: multi-geth*-arm.*
5151
file_glob: true
5252
draft: true

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,19 @@ ios:
3232
test: all
3333
go run build/ci.go test
3434

35+
sync-clients:
36+
./params/parity.json.d/sync-parity-remote.sh
37+
3538
test-multigeth: test-multigeth-features test-multigeth-chainspecs ## Runs all tests specific to multi-geth.
3639

37-
test-multigeth-features: ## Runs tests specific to multi-geth using Fork/Feature configs.
38-
@echo "Testing fork/feature/datatype implementation; equivalence."
40+
test-multigeth-features: test-multigeth-features-parity test-multigeth-features-multigeth ## Runs tests specific to multi-geth using Fork/Feature configs.
41+
42+
test-multigeth-features-multigeth:
43+
@echo "Testing fork/feature/datatype implementation; equivalence - PARITY."
3944
env MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_PARITY=on go test -count=1 ./tests
45+
46+
test-multigeth-features-parity:
47+
@echo "Testing fork/feature/datatype implementation; equivalence - MULTIGETH."
4048
env MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_MULTIGETH=on go test -count=1 ./tests
4149

4250
test-multigeth-chainspecs: ## Run tests specific to multi-geth using chainspec file configs.
@@ -63,6 +71,8 @@ lint: ## Run linters.
6371
clean:
6472
./build/clean_go_build_cache.sh
6573
rm -fr $(GOBIN)/*
74+
go clean -cache
75+
rm -fr build/_workspace/pkg/ $(GOBIN)/*
6676

6777
# The devtools target installs tools required for 'go generate'.
6878
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.

accounts/abi/abi_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ func TestABI_MethodById(t *testing.T) {
927927
}
928928
b := fmt.Sprintf("%v", m2)
929929
if a != b {
930-
t.Errorf("Method %v (id %v) not 'findable' by id in ABI", name, common.ToHex(m.ID()))
930+
t.Errorf("Method %v (id %x) not 'findable' by id in ABI", name, m.ID())
931931
}
932932
}
933933
// Also test empty

accounts/abi/bind/backends/simulated.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ import (
3939
"github.com/ethereum/go-ethereum/ethdb"
4040
"github.com/ethereum/go-ethereum/event"
4141
"github.com/ethereum/go-ethereum/params"
42-
"github.com/ethereum/go-ethereum/params/types"
4342
"github.com/ethereum/go-ethereum/params/types/ctypes"
43+
"github.com/ethereum/go-ethereum/params/types/genesisT"
4444
"github.com/ethereum/go-ethereum/params/vars"
4545
"github.com/ethereum/go-ethereum/rpc"
4646
)
@@ -70,8 +70,8 @@ type SimulatedBackend struct {
7070

7171
// NewSimulatedBackendWithDatabase creates a new binding backend based on the given database
7272
// and uses a simulated blockchain for testing purposes.
73-
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc paramtypes.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
74-
genesis := paramtypes.Genesis{Config: params.AllEthashProtocolChanges, GasLimit: gasLimit, Alloc: alloc}
73+
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc genesisT.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
74+
genesis := genesisT.Genesis{Config: params.AllEthashProtocolChanges, GasLimit: gasLimit, Alloc: alloc}
7575
core.MustCommitGenesis(database, &genesis)
7676
blockchain, _ := core.NewBlockChain(database, nil, genesis.Config, ethash.NewFaker(), vm.Config{}, nil)
7777

@@ -87,7 +87,7 @@ func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc paramtypes.G
8787

8888
// NewSimulatedBackend creates a new binding backend using a simulated blockchain
8989
// for testing purposes.
90-
func NewSimulatedBackend(alloc paramtypes.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
90+
func NewSimulatedBackend(alloc genesisT.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
9191
return NewSimulatedBackendWithDatabase(rawdb.NewMemoryDatabase(), alloc, gasLimit)
9292
}
9393

accounts/abi/bind/backends/simulated_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ import (
2727
"github.com/ethereum/go-ethereum/common"
2828
"github.com/ethereum/go-ethereum/core/types"
2929
"github.com/ethereum/go-ethereum/crypto"
30-
"github.com/ethereum/go-ethereum/params/types"
30+
"github.com/ethereum/go-ethereum/params/types/genesisT"
3131
)
3232

3333
func TestSimulatedBackend(t *testing.T) {
3434
var gasLimit uint64 = 8000029
3535
key, _ := crypto.GenerateKey() // nolint: gosec
3636
auth := bind.NewKeyedTransactor(key)
37-
genAlloc := make(paramtypes.GenesisAlloc)
38-
genAlloc[auth.From] = paramtypes.GenesisAccount{Balance: big.NewInt(9223372036854775807)}
37+
genAlloc := make(genesisT.GenesisAlloc)
38+
genAlloc[auth.From] = genesisT.GenesisAccount{Balance: big.NewInt(9223372036854775807)}
3939

4040
sim := backends.NewSimulatedBackend(genAlloc, gasLimit)
4141
defer sim.Close()
@@ -72,7 +72,7 @@ func TestSimulatedBackend(t *testing.T) {
7272
}
7373

7474
sim.Commit()
75-
tx, isPending, err = sim.TransactionByHash(context.Background(), txHash)
75+
_, isPending, err = sim.TransactionByHash(context.Background(), txHash)
7676
if err != nil {
7777
t.Fatalf("error getting transaction with hash: %v", txHash.String())
7878
}

accounts/abi/bind/base.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]int
287287
return nil
288288
}), nil
289289

290-
return logs, sub, nil
290+
return logs, sub, err
291291
}
292292

293293
// WatchLogs filters subscribes to contract logs for future blocks, returning a

accounts/abi/bind/bind.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ const (
4848
// enforces compile time type safety and naming convention opposed to having to
4949
// manually maintain hard coded strings that break on runtime.
5050
func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]string, pkg string, lang Lang, libs map[string]string, aliases map[string]string) (string, error) {
51-
// Process each individual contract requested binding
52-
contracts := make(map[string]*tmplContract)
51+
var (
52+
// contracts is the map of each individual contract requested binding
53+
contracts = make(map[string]*tmplContract)
5354

54-
// Map used to flag each encountered library as such
55-
isLib := make(map[string]struct{})
55+
// structs is the map of all reclared structs shared by passed contracts.
56+
structs = make(map[string]*tmplStruct)
5657

58+
// isLib is the map used to flag each encountered library as such
59+
isLib = make(map[string]struct{})
60+
)
5761
for i := 0; i < len(types); i++ {
5862
// Parse the actual ABI to generate the binding for
5963
evmABI, err := abi.JSON(strings.NewReader(abis[i]))
@@ -73,7 +77,6 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
7377
calls = make(map[string]*tmplMethod)
7478
transacts = make(map[string]*tmplMethod)
7579
events = make(map[string]*tmplEvent)
76-
structs = make(map[string]*tmplStruct)
7780

7881
// identifiers are used to detect duplicated identifier of function
7982
// and event. For all calls, transacts and events, abigen will generate
@@ -168,7 +171,6 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
168171
Transacts: transacts,
169172
Events: events,
170173
Libraries: make(map[string]string),
171-
Structs: structs,
172174
}
173175
// Function 4-byte signatures are stored in the same sequence
174176
// as types, if available.
@@ -200,6 +202,7 @@ func Bind(types []string, abis []string, bytecodes []string, fsigs []map[string]
200202
Package: pkg,
201203
Contracts: contracts,
202204
Libraries: libs,
205+
Structs: structs,
203206
}
204207
buffer := new(bytes.Buffer)
205208

0 commit comments

Comments
 (0)