Skip to content

Commit

Permalink
Merge pull request ethereum#93 from etclabscore/feat-fix/unmarshal-ch…
Browse files Browse the repository at this point in the history
…ainconfigurator

params/confp/(internal,generic): refactor configurator unmarshaler, w…
  • Loading branch information
meowsbits authored Jan 2, 2020
2 parents 8eec618 + 4a0f790 commit fd5ef0a
Show file tree
Hide file tree
Showing 305 changed files with 4,258 additions and 4,172 deletions.
Empty file added .github/CODEOWNERS
Empty file.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ build/_vendor/pkg

# used by the Makefile
/build/_workspace/
/build/cache/
/build/bin/
/geth*.zip

Expand Down
44 changes: 43 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# This file configures github.com/golangci/golangci-lint.

run:
timeout: 2m
tests: true
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true

linters:
disable-all: true
enable:
- deadcode
- goconst
- goimports
- gosimple
- govet
- ineffassign
- misspell
# - staticcheck
- unconvert
# - unused
- varcheck

linters-settings:
gofmt:
simplify: true
goconst:
min-occurrences: 6
min-len: 3 # minimum length of string constant
min-occurrences: 6 # minimum number of occurrences

issues:
exclude-rules:
- path: crypto/blake2b/
linters:
- deadcode
- path: crypto/bn256/cloudflare
linters:
- deadcode
- path: p2p/discv5/
linters:
- deadcode
- path: core/vm/instructions_test.go
linters:
- goconst
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ matrix:
deploy:
provider: releases
api_key:
secure: pGlbI2DRfTzdF75hkEwP5vMIpcP1iVEeW3W41DT1X+/GQPlgDN1DB/ocXtMbEId2vJCWgt1HfCSNb9F4NBI94TMamFJQPz4zy/VIXBClG1IGesloe159vU4PixrLBgeTTcuDJRx7X45JeKlHW9LN5ABxeEhYEzPj1De6P5NDePmbFNDvhOkaf5Spk0xGLumRzzf2SHk+w3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EusDaWCoPNNBmvL8mJMCwLWdNsRGQO6NhdkzqH81njP86TCdpFQi7OJDgTobEuy+NXwRkx4B0620JssU=
file: multi-geth*-$TRAVIS_OS_NAME.*
file_glob: true
draft: true
Expand All @@ -29,7 +29,7 @@ matrix:
sudo: required
go: 1.13.x
env:
- ARMv5
- ARMv5
git:
submodules: false # avoid cloning ethereum/tests
addons:
Expand All @@ -46,7 +46,7 @@ matrix:
deploy:
provider: releases
api_key:
secure: pGlbI2DRfTzdF75hkEwP5vMIpcP1iVEeW3W41DT1X+/GQPlgDN1DB/ocXtMbEId2vJCWgt1HfCSNb9F4NBI94TMamFJQPz4zy/VIXBClG1IGesloe159vU4PixrLBgeTTcuDJRx7X45JeKlHW9LN5ABxeEhYEzPj1De6P5NDePmbFNDvhOkaf5Spk0xGLumRzzf2SHk+w3au9RQM5gVUcgr5U81Qi/ys8aGCLtZ1T+avSoX9rFoB1/YGoHllJfMoNGJr5CLiBwnFGMY8SNfD7XruFptUjTe4D0sMNTgAbT8iDPbw9s5aa2ou2eFWsuGaa8v840kLF+J0dEW0L/y88YzzRbbK3Ve6qNvka8MZ26HLSry7JtAqT6QY0W+h2yMgOmJX6ehlCGg1PoZYVwTp4d0usE88CGa8kTSNlt6/OxVmvNU5E2TPCbiTxF1yI42RliE+r7FyX5TtvXvZmSzfrlZcJFn3amC02woe1Fs0GJWvscxdqyftuyIezpaRmkIrL0X+OzYjOLJA2CH6eUdJu0O52zSLg00UeXDd4y9dBgm8AWD1k5tuHQrqq2/tF7abz2XOtmt3cuL9XYOcbXm0lf88AiOEusDaWCoPNNBmvL8mJMCwLWdNsRGQO6NhdkzqH81njP86TCdpFQi7OJDgTobEuy+NXwRkx4B0620JssU=
secure: pGlbI2DRfTzdF75hkEwP5vMIpcP1iVEeW3W41DT1X+/GQPlgDN1DB/ocXtMbEId2vJCWgt1HfCSNb9F4NBI94TMamFJQPz4zy/VIXBClG1IGesloe159vU4PixrLBgeTTcuDJRx7X45JeKlHW9LN5ABxeEhYEzPj1De6P5NDePmbFNDvhOkaf5Spk0xGLumRzzf2SHk+w3au9RQM5gVUcgr5U81Qi/ys8aGCLtZ1T+avSoX9rFoB1/YGoHllJfMoNGJr5CLiBwnFGMY8SNfD7XruFptUjTe4D0sMNTgAbT8iDPbw9s5aa2ou2eFWsuGaa8v840kLF+J0dEW0L/y88YzzRbbK3Ve6qNvka8MZ26HLSry7JtAqT6QY0W+h2yMgOmJX6ehlCGg1PoZYVwTp4d0usE88CGa8kTSNlt6/OxVmvNU5E2TPCbiTxF1yI42RliE+r7FyX5TtvXvZmSzfrlZcJFn3amC02woe1Fs0GJWvscxdqyftuyIezpaRmkIrL0X+OzYjOLJA2CH6eUdJu0O52zSLg00UeXDd4y9dBgm8AWD1k5tuHQrqq2/tF7abz2XOtmt3cuL9XYOcbXm0lf88AiOEusDaWCoPNNBmvL8mJMCwLWdNsRGQO6NhdkzqH81njP86TCdpFQi7OJDgTobEuy+NXwRkx4B0620JssU=
file: multi-geth*-arm.*
file_glob: true
draft: true
Expand Down
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ ios:
test: all
go run build/ci.go test

sync-clients:
./params/parity.json.d/sync-parity-remote.sh

test-multigeth: test-multigeth-features test-multigeth-chainspecs ## Runs all tests specific to multi-geth.

test-multigeth-features: ## Runs tests specific to multi-geth using Fork/Feature configs.
@echo "Testing fork/feature/datatype implementation; equivalence."
test-multigeth-features: test-multigeth-features-parity test-multigeth-features-multigeth ## Runs tests specific to multi-geth using Fork/Feature configs.

test-multigeth-features-multigeth:
@echo "Testing fork/feature/datatype implementation; equivalence - PARITY."
env MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_PARITY=on go test -count=1 ./tests

test-multigeth-features-parity:
@echo "Testing fork/feature/datatype implementation; equivalence - MULTIGETH."
env MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_MULTIGETH=on go test -count=1 ./tests

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

# The devtools target installs tools required for 'go generate'.
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/abi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ func TestABI_MethodById(t *testing.T) {
}
b := fmt.Sprintf("%v", m2)
if a != b {
t.Errorf("Method %v (id %v) not 'findable' by id in ABI", name, common.ToHex(m.ID()))
t.Errorf("Method %v (id %x) not 'findable' by id in ABI", name, m.ID())
}
}
// Also test empty
Expand Down
8 changes: 4 additions & 4 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params/types"
"github.com/ethereum/go-ethereum/params/types/ctypes"
"github.com/ethereum/go-ethereum/params/types/genesisT"
"github.com/ethereum/go-ethereum/params/vars"
"github.com/ethereum/go-ethereum/rpc"
)
Expand Down Expand Up @@ -70,8 +70,8 @@ type SimulatedBackend struct {

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

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

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

Expand Down
8 changes: 4 additions & 4 deletions accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params/types"
"github.com/ethereum/go-ethereum/params/types/genesisT"
)

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

sim := backends.NewSimulatedBackend(genAlloc, gasLimit)
defer sim.Close()
Expand Down Expand Up @@ -72,7 +72,7 @@ func TestSimulatedBackend(t *testing.T) {
}

sim.Commit()
tx, isPending, err = sim.TransactionByHash(context.Background(), txHash)
_, isPending, err = sim.TransactionByHash(context.Background(), txHash)
if err != nil {
t.Fatalf("error getting transaction with hash: %v", txHash.String())
}
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]int
return nil
}), nil

return logs, sub, nil
return logs, sub, err
}

// WatchLogs filters subscribes to contract logs for future blocks, returning a
Expand Down
15 changes: 9 additions & 6 deletions accounts/abi/bind/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ const (
// enforces compile time type safety and naming convention opposed to having to
// manually maintain hard coded strings that break on runtime.
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) {
// Process each individual contract requested binding
contracts := make(map[string]*tmplContract)
var (
// contracts is the map of each individual contract requested binding
contracts = make(map[string]*tmplContract)

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

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

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

Expand Down
Loading

0 comments on commit fd5ef0a

Please sign in to comment.