Skip to content

Commit

Permalink
Merge pull request #156 from etclabscore/feat/gardening-20200727
Browse files Browse the repository at this point in the history
Feat/gardening 20200727
  • Loading branch information
meowsbits authored Jul 27, 2020
2 parents 04c5320 + 603763d commit cbb3569
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
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

0 comments on commit cbb3569

Please sign in to comment.