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

Feat/gardening 20200727 #156

Merged
merged 4 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ sync-parity-chainspecs:
./params/parity.json.d/sync-parity-remote.sh

test-coregeth: \
test-coregeth-regression-condensed \
test-coregeth-features \
test-coregeth-chainspecs \
test-coregeth-consensus ## Runs all tests specific to core-geth.
test-coregeth-consensus \
test-coregeth-regression-condensed ## Runs all tests specific to core-geth.

# Generate the necessary shared object for EVMC unit tests.
evmc/bindings/go/evmc/example_vm.so:
Expand Down
21 changes: 13 additions & 8 deletions cmd/echainspec/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package main

import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"

"github.com/ethereum/go-ethereum/params/types/coregeth"
"github.com/ethereum/go-ethereum/params/types/ctypes"
"github.com/ethereum/go-ethereum/params/types/genesisT"
"github.com/ethereum/go-ethereum/params/types/goethereum"
"github.com/ethereum/go-ethereum/params/types/parity"
"gopkg.in/urfave/cli.v1"
)

Expand Down Expand Up @@ -41,12 +41,17 @@ func unmarshalChainSpec(format string, data []byte) (conf ctypes.Configurator, e
Config ctypes.ChainConfigurator `json:"config"`
}
var d dec
if format == "geth" {
d.Config = &goethereum.ChainConfig{}
} else if format == "multigeth" {
d.Config = &coregeth.CoreGethChainConfig{}
} else {
panic("impossible")
configurator, ok := chainspecFormatTypes[format]
if !ok {
return nil, fmt.Errorf("unknown chainspec format type: %v", format)
}
switch t := configurator.(type) {
case *genesisT.Genesis:
d.Config = t.Config
case *parity.ParityChainSpec:
// Don't need to do anything here; the Parity type already conforms to ChainConfigurator.
default:
return nil, fmt.Errorf("unhandled chainspec type: %v %v", format, t)
}
t := chainspecFormatTypes[format].(*genesisT.Genesis)
err = json.Unmarshal(data, &d)
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func TestConsoleCmdNetworkIdentities(t *testing.T) {

// All other possible --<chain> values.
{[]string{"--testnet"}, 3, 3, params.RopstenGenesisHash.Hex()},
{[]string{"--ropsten"}, 3, 3, params.RopstenGenesisHash.Hex()},
{[]string{"--rinkeby"}, 4, 4, params.RinkebyGenesisHash.Hex()},
{[]string{"--goerli"}, 5, 5, params.GoerliGenesisHash.Hex()},
{[]string{"--kotti"}, 6, 6, params.KottiGenesisHash.Hex()},
Expand Down
4 changes: 2 additions & 2 deletions params/confp/configurator.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func IsEmpty(anything interface{}) bool {
func IsValid(conf ctypes.ChainConfigurator, head *uint64) *ConfigValidError {

// head-agnostic logic
if conf.GetNetworkID() == nil || *conf.GetNetworkID() == 0 {
return NewValidErr("NetworkID cannot be empty nor zero", ">=0", conf.GetNetworkID())
if conf.GetNetworkID() == nil {
return NewValidErr("NetworkID cannot be nil", "!=nil", conf.GetNetworkID())
}
if head == nil {
return nil
Expand Down