Skip to content

Commit

Permalink
cmd/echainspec,integration,params/confp/generic,convert_test,params/c…
Browse files Browse the repository at this point in the history
…onfp/internal,params/confp/tconvert,params/types/parity,params/types/tests,tests: remove openethereum (nee parity) data type

The OpenEthereum (nee Parity) client is
disused and maintenance for it continues to
to outweight the benefits.
It too shall go the way of the dodo.

Date: 2023-04-11 14:32:57-07:00
Signed-off-by: meows <[email protected]>
  • Loading branch information
meowsbits committed Apr 14, 2023
1 parent df7327e commit eb64f19
Show file tree
Hide file tree
Showing 59 changed files with 3 additions and 86,759 deletions.
2 changes: 0 additions & 2 deletions cmd/echainspec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"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 All @@ -28,7 +27,6 @@ var (
"geth": &genesisT.Genesis{
Config: &goethereum.ChainConfig{},
},
"parity": &parity.ParityChainSpec{},
// TODO
// "aleth"
// "retesteth"
Expand Down
3 changes: 0 additions & 3 deletions cmd/echainspec/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

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

Expand Down Expand Up @@ -48,8 +47,6 @@ func unmarshalChainSpec(format string, data []byte) (conf ctypes.Configurator, e
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)
}
Expand Down
146 changes: 1 addition & 145 deletions integration/configurator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,19 @@ package integration
import (
"encoding/json"
"log"
"os"
"path/filepath"
"strings"
"testing"

"github.com/davecgh/go-spew/spew"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params/confp"
"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/parity"
"github.com/ethereum/go-ethereum/params/vars"
"github.com/ethereum/go-ethereum/tests"
"github.com/go-test/deep"
)

func TestConstantinopleEquivalence(t *testing.T) {
conf := tests.Forks["Constantinople"]
pspec := &parity.ParityChainSpec{}
pspec := &coregeth.CoreGethChainConfig{}
err := confp.Crush(pspec, conf, true)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -124,140 +115,5 @@ func TestEquivalent_Features(t *testing.T) {
t.Errorf("Equivalence: %s oconf/mg err: %v", name, err) // With error.
debuglog(oconf, mg)
}

// EIP2929 is unsupported by Parity (https://docs.google.com/spreadsheets/d/1BomvS0hjc88eTfx1b8Ufa6KYS3vMEb2c8TQ5HJWx2lc/edit#gid=408811124),
// which means they cannot support the following forks.
// So skip the Parity equivalence checks for them.
parityUnsupportedForks := []string{
"yolo",
"berlin",
}
paritySupports := func(forkName string) bool {
for _, s := range parityUnsupportedForks {
if strings.Contains(strings.ToLower(forkName), s) {
return false
}
}
return true
}
if !paritySupports(name) {
continue
}

pc := &parity.ParityChainSpec{}
err = confp.Crush(pc, oconf, true)
if err != nil {
t.Fatal(err)
}

mustValidate(pc)

err = confp.Equivalent(oconf, pc)
if err != nil {
t.Errorf("Equivalence: %s oconf/pc err: %v", name, err)
debuglog(oconf, pc)
}
}
}

func TestEquivalent_ReadParity(t *testing.T) {
// These configs are tested by tests/ (ethereum/tests) suite.
// If passing there, the config pairs are equivalent IN THE CONTEXT OF THOSE TESTS,
// which is what the configs are for.
// In order to pass those tests, however, configs do not need to be strictly equivalent.
// For example, one config might specify EIP1234 fork without a prior EIP649 fork, and
// another may specify both (either simulaneously or in succession).
// Both configs in this case yield will equivalent results, but
// are not, strictly speaking, equivalent.
// I've left this test here for debugging, and to demonstrate this case.
t.Skip("(meowsbits): Not required.")
parityP := filepath.Join("..", "params", "parity.json.d")
for k, v := range tests.MapForkNameChainspecFileState {
a := tests.Forks[k]

b := &parity.ParityChainSpec{}
bs, err := os.ReadFile(filepath.Join(parityP, v))
if err != nil {
t.Fatal(err)
}
err = json.Unmarshal(bs, b)
if err != nil {
t.Fatal(err)
}
err = confp.Equivalent(a, b)
if err != nil {
t.Log("-------------------")
t.Log(b.Engine.Ethash.Params.BlockReward)
t.Log(b.Engine.Ethash.Params.DifficultyBombDelays)
t.Errorf("%s:%s err: %v", k, v, err)
}
}
}

// TestParityGenesis shows that for select configs, the read and converted parity specs
// are equivalent to the default Go coded specs for the scope of the respective genesis blocks.
func TestParityGeneses(t *testing.T) {
testes := []struct {
filename string
defaultGenesis *genesisT.Genesis
}{
{
"foundation.json",
params.DefaultGenesisBlock(),
},
{
"classic.json",
params.DefaultClassicGenesisBlock(),
},
{
"mordor.json",
params.DefaultMordorGenesisBlock(),
},
{
"kotti.json",
params.DefaultKottiGenesisBlock(),
},
}
for _, tt := range testes {
p := filepath.Join("..", "params", "parity.json.d", tt.filename)
pspec := &parity.ParityChainSpec{}
b, err := os.ReadFile(p)
if err != nil {
t.Fatal(err)
}
err = json.Unmarshal(b, pspec)
if err != nil {
t.Fatal(err)
}
genc := &genesisT.Genesis{
Config: &coregeth.CoreGethChainConfig{},
}
err = confp.Crush(genc, pspec, true)
if err != nil {
t.Fatal(err)
}

wantBlock := core.GenesisToBlock(tt.defaultGenesis, nil)
gotBlock := core.GenesisToBlock(genc, nil)

if wantBlock.Hash() != gotBlock.Hash() {
t.Errorf("%s: mismatch gen hash, want(default): %s, got: %s", tt.filename, wantBlock.Hash().Hex(), gotBlock.Hash().Hex())

// state roots
t.Logf("stateroots, want(default): %s, got: %s", wantBlock.Root().Hex(), gotBlock.Root().Hex())

// extradata
t.Logf("extras: %x, %x", wantBlock.Extra(), gotBlock.Extra())
t.Logf("extras_orig: %x, %s", pspec.GetGenesisExtraData(), genc.GetGenesisExtraData())

diffs := deep.Equal(wantBlock, gotBlock)
t.Log("genesis block diffs len", len(diffs))
for _, d := range diffs {
t.Log(d)
}

t.Log("want(default)", spew.Sdump(wantBlock))
t.Log("got", spew.Sdump(gotBlock))
}
}
}
9 changes: 0 additions & 9 deletions params/confp/generic/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (
"github.com/ethereum/go-ethereum/params/types/coregeth"
"github.com/ethereum/go-ethereum/params/types/ctypes"
"github.com/ethereum/go-ethereum/params/types/goethereum"
"github.com/ethereum/go-ethereum/params/types/parity"
"github.com/ethereum/go-ethereum/params/vars"
"github.com/tidwall/gjson"
)

Expand All @@ -49,13 +47,6 @@ func (c GenericCC) DAOSupport() bool {
if mg, ok := c.ChainConfigurator.(*coregeth.CoreGethChainConfig); ok {
return mg.GetEthashEIP779Transition() != nil
}
// Parity: Deprecated.
if pc, ok := c.ChainConfigurator.(*parity.ParityChainSpec); ok {
return pc.Engine.Ethash.Params.DaoHardforkTransition != nil &&
pc.Engine.Ethash.Params.DaoHardforkBeneficiary != nil &&
*pc.Engine.Ethash.Params.DaoHardforkBeneficiary == vars.DAORefundContract &&
len(pc.Engine.Ethash.Params.DaoHardforkAccounts) == len(vars.DAODrainList())
}
panic(fmt.Sprintf("uimplemented DAO logic, config: %v", c.ChainConfigurator))
}

Expand Down
10 changes: 1 addition & 9 deletions params/confp/internal/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"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"
)

func mustReadTestdataTo(t *testing.T, fabbrev string, into interface{}) {
Expand Down Expand Up @@ -165,7 +164,6 @@ func TestIdentical(t *testing.T) {
configs := []ctypes.ChainConfigurator{
&coregeth.CoreGethChainConfig{},
&goethereum.ChainConfig{},
&parity.ParityChainSpec{},
&coregeth.CoreGethChainConfig{}, // Complete combination test set.
}
for i := range configs {
Expand All @@ -191,12 +189,6 @@ func TestIdentical(t *testing.T) {
// TestConfiguratorImplementationsSatisfied tests that data types expected
// to fulfil certain interfaces do fill them.
func TestConfiguratorImplementationsSatisfied(t *testing.T) {
for _, ty := range []interface{}{
&parity.ParityChainSpec{},
} {
_ = ty.(ctypes.Configurator)
}

for _, ty := range []interface{}{
&goethereum.ChainConfig{},
&coregeth.CoreGethChainConfig{},
Expand All @@ -212,7 +204,7 @@ func TestConfiguratorImplementationsSatisfied(t *testing.T) {
}

func TestCompatible(t *testing.T) {
spec := &parity.ParityChainSpec{}
spec := &goethereum.ChainConfig{}
fns, names := confp.Transitions(spec)
for i, fn := range fns {
t.Log(names[i], fn())
Expand Down
44 changes: 0 additions & 44 deletions params/confp/internal/parity_test.go

This file was deleted.

59 changes: 0 additions & 59 deletions params/confp/tconvert/parity.go

This file was deleted.

Loading

0 comments on commit eb64f19

Please sign in to comment.