From b8a847f825d65e0ad85e58fe9feaae8cf9a80584 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 29 Jan 2020 13:11:30 -0600 Subject: [PATCH 01/17] params: implement ECIP-1078/1079 feature activation > - https://github.com/ethereumclassic/ECIPs/pull/263/files?short_path=d39459a#diff-d39459a451d1f1cf1bb1d6b1fddcb4f0 > - https://github.com/ethereumclassic/ECIPs/pull/261/files#diff-f331ca50d292642838a6be87214ac1e7 Implements 'Phoenix' aka 'Aztlan Fix' fork specification which is described as a 'simultaneous' fork adjacent to the fork specified in ECIP-1061 and ECIP-1072. The intention is to sidestep potential vulnerabilities related to gas costs. Signed-off-by: meows --- params/config_classic.go | 9 ++++++--- params/config_kotti.go | 9 +++++++-- params/config_mordor.go | 8 ++++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/params/config_classic.go b/params/config_classic.go index b12a6a71baf8..a5888793304a 100644 --- a/params/config_classic.go +++ b/params/config_classic.go @@ -60,14 +60,17 @@ var ( EIP1052FBlock: big.NewInt(9573000), // Istanbul eq + // ECIP-1061, ECIP-1072 EIP152FBlock: big.NewInt(10500839), EIP1108FBlock: big.NewInt(10500839), EIP1344FBlock: big.NewInt(10500839), - EIP1884FBlock: nil, EIP2028FBlock: big.NewInt(10500839), - EIP2200FBlock: big.NewInt(10500839), // RePetersburg (=~ re-1283) + // ECIP-1078, ECIP-1079 + //EIP2200FBlock: big.NewInt(10500839), // RePetersburg (=~ re-1283) + EIP1283FBlock: big.NewInt(10500839), + EIP1706FBlock: big.NewInt(10500839), + ECIP1080FBlock: big.NewInt(10500839), - EIP1283FBlock: nil, PetersburgBlock: nil, // Un1283 DisposalBlock: big.NewInt(5900000), diff --git a/params/config_kotti.go b/params/config_kotti.go index 0cb182b90c95..3cc4f4c6fc17 100644 --- a/params/config_kotti.go +++ b/params/config_kotti.go @@ -63,12 +63,17 @@ var ( EIP1052FBlock: big.NewInt(1705549), // Istanbul eq + // ECIP-1061, ECIP-1072 EIP152FBlock: big.NewInt(2058191), EIP1108FBlock: big.NewInt(2058191), EIP1344FBlock: big.NewInt(2058191), - EIP1884FBlock: nil, EIP2028FBlock: big.NewInt(2058191), - EIP2200FBlock: big.NewInt(2058191), // RePetersburg (== re-1283) + // ECIP-1078, ECIP-1079 + //EIP2200FBlock: big.NewInt(2058191), // RePetersburg (== re-1283) + EIP1283FBlock: big.NewInt(2058191), + EIP1706FBlock: big.NewInt(2058191), + ECIP1080FBlock: big.NewInt(2058191), + ECIP1017FBlock: big.NewInt(5000000), ECIP1017EraRounds: big.NewInt(5000000), diff --git a/params/config_mordor.go b/params/config_mordor.go index d54e7eb7d55f..672e9302c5a7 100644 --- a/params/config_mordor.go +++ b/params/config_mordor.go @@ -57,12 +57,16 @@ var ( EIP1052FBlock: big.NewInt(301243), // Istanbul eq + // ECIP-1061, ECIP-1072 EIP152FBlock: big.NewInt(778507), EIP1108FBlock: big.NewInt(778507), EIP1344FBlock: big.NewInt(778507), - EIP1884FBlock: nil, EIP2028FBlock: big.NewInt(778507), - EIP2200FBlock: big.NewInt(778507), // RePetersburg (== re-1283) + // ECIP-1078, ECIP-1079 + //EIP2200FBlock: big.NewInt(778507), // RePetersburg (== re-1283) + EIP1283FBlock: big.NewInt(778507), + EIP1706FBlock: big.NewInt(778507), + ECIP1080FBlock: big.NewInt(778507), DisposalBlock: big.NewInt(0), ECIP1017FBlock: big.NewInt(0), From 3bbcf561cc3b8dfbfca745775535ca1113603d6f Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 29 Jan 2020 13:44:38 -0600 Subject: [PATCH 02/17] params: (lint) goimports Signed-off-by: meows --- params/config_classic.go | 4 ++-- params/config_kotti.go | 5 ++--- params/config_mordor.go | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/params/config_classic.go b/params/config_classic.go index a5888793304a..19fdd0a641d4 100644 --- a/params/config_classic.go +++ b/params/config_classic.go @@ -67,8 +67,8 @@ var ( EIP2028FBlock: big.NewInt(10500839), // ECIP-1078, ECIP-1079 //EIP2200FBlock: big.NewInt(10500839), // RePetersburg (=~ re-1283) - EIP1283FBlock: big.NewInt(10500839), - EIP1706FBlock: big.NewInt(10500839), + EIP1283FBlock: big.NewInt(10500839), + EIP1706FBlock: big.NewInt(10500839), ECIP1080FBlock: big.NewInt(10500839), PetersburgBlock: nil, // Un1283 diff --git a/params/config_kotti.go b/params/config_kotti.go index 3cc4f4c6fc17..4b0291b55d5c 100644 --- a/params/config_kotti.go +++ b/params/config_kotti.go @@ -70,11 +70,10 @@ var ( EIP2028FBlock: big.NewInt(2058191), // ECIP-1078, ECIP-1079 //EIP2200FBlock: big.NewInt(2058191), // RePetersburg (== re-1283) - EIP1283FBlock: big.NewInt(2058191), - EIP1706FBlock: big.NewInt(2058191), + EIP1283FBlock: big.NewInt(2058191), + EIP1706FBlock: big.NewInt(2058191), ECIP1080FBlock: big.NewInt(2058191), - ECIP1017FBlock: big.NewInt(5000000), ECIP1017EraRounds: big.NewInt(5000000), diff --git a/params/config_mordor.go b/params/config_mordor.go index 672e9302c5a7..6426bc82af51 100644 --- a/params/config_mordor.go +++ b/params/config_mordor.go @@ -64,8 +64,8 @@ var ( EIP2028FBlock: big.NewInt(778507), // ECIP-1078, ECIP-1079 //EIP2200FBlock: big.NewInt(778507), // RePetersburg (== re-1283) - EIP1283FBlock: big.NewInt(778507), - EIP1706FBlock: big.NewInt(778507), + EIP1283FBlock: big.NewInt(778507), + EIP1706FBlock: big.NewInt(778507), ECIP1080FBlock: big.NewInt(778507), DisposalBlock: big.NewInt(0), From dfbb3a459defb6566c709812cc95f44df51cdc83 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 3 Feb 2020 13:52:45 -0600 Subject: [PATCH 03/17] params: (revertme) note about 2200 disable --- params/config_kotti.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/params/config_kotti.go b/params/config_kotti.go index 4b0291b55d5c..d6822caeb818 100644 --- a/params/config_kotti.go +++ b/params/config_kotti.go @@ -68,8 +68,10 @@ var ( EIP1108FBlock: big.NewInt(2058191), EIP1344FBlock: big.NewInt(2058191), EIP2028FBlock: big.NewInt(2058191), + EIP2200FBlock: big.NewInt(2058191), // RePetersburg (== re-1283) + // ECIP-1078, ECIP-1079 - //EIP2200FBlock: big.NewInt(2058191), // RePetersburg (== re-1283) + // TODO: +disable 2200 EIP1283FBlock: big.NewInt(2058191), EIP1706FBlock: big.NewInt(2058191), ECIP1080FBlock: big.NewInt(2058191), From 57b7305e7a6fc483e49a231a7b00e251a6cf0dca Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 3 Feb 2020 13:54:33 -0600 Subject: [PATCH 04/17] core,params: rename pkg oldmultigeth->multigethv0 Signed-off-by: meows --- core/genesis_test.go | 6 +++--- params/config_test.go | 6 +++--- params/confp/generic/generic.go | 6 +++--- params/confp/generic/generic_test.go | 12 ++++++------ params/types/genesisT/gen_genesis.go | 6 +++--- .../oldmultigeth_chain_config.go | 2 +- .../oldmultigeth_chain_config_configurator.go | 2 +- .../oldmultigeth_chain_config_test.go | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) rename params/types/{oldmultigeth => multigethv0}/oldmultigeth_chain_config.go (99%) rename params/types/{oldmultigeth => multigethv0}/oldmultigeth_chain_config_configurator.go (99%) rename params/types/{oldmultigeth => multigethv0}/oldmultigeth_chain_config_test.go (98%) diff --git a/core/genesis_test.go b/core/genesis_test.go index beee403e1c74..5b6075dfae52 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/params/confp" "github.com/ethereum/go-ethereum/params/types/ctypes" "github.com/ethereum/go-ethereum/params/types/multigeth" - "github.com/ethereum/go-ethereum/params/types/oldmultigeth" + "github.com/ethereum/go-ethereum/params/types/multigethv0" ) func TestSetupGenesisBlock(t *testing.T) { @@ -71,7 +71,7 @@ func TestSetupGenesisBlockOldVsNewMultigeth(t *testing.T) { // Setup a genesis mocking <=v1.9.6, aka "old". genA := params.DefaultGenesisBlock() - genA.Config = &oldmultigeth.ChainConfig{ + genA.Config = &multigethv0.ChainConfig{ ChainID: big.NewInt(61), HomesteadBlock: big.NewInt(1150000), DAOForkBlock: big.NewInt(1920000), @@ -256,7 +256,7 @@ func TestSetupGenesisBlock2(t *testing.T) { if storedConf == nil { t.Fatal("nil stored conf") } - wantType := reflect.TypeOf(&oldmultigeth.ChainConfig{}) + wantType := reflect.TypeOf(&multigethv0.ChainConfig{}) if reflect.TypeOf(storedConf) != wantType { t.Fatalf("mismatch, want: %v, got: %v", wantType, reflect.TypeOf(storedConf)) } diff --git a/params/config_test.go b/params/config_test.go index 386d1240ebe2..75a6a85967cc 100644 --- a/params/config_test.go +++ b/params/config_test.go @@ -25,7 +25,7 @@ import ( "github.com/ethereum/go-ethereum/params/types/ctypes" "github.com/ethereum/go-ethereum/params/types/goethereum" "github.com/ethereum/go-ethereum/params/types/multigeth" - "github.com/ethereum/go-ethereum/params/types/oldmultigeth" + "github.com/ethereum/go-ethereum/params/types/multigethv0" ) func uint64P(n uint64) *uint64 { @@ -219,7 +219,7 @@ func TestCheckCompatible(t *testing.T) { { stored: func() ctypes.ChainConfigurator { // ClassicChainConfig is the chain parameters to run a node on the Classic main network. - c := &oldmultigeth.ChainConfig{ + c := &multigethv0.ChainConfig{ ChainID: big.NewInt(61), HomesteadBlock: big.NewInt(1150000), DAOForkBlock: big.NewInt(1920000), @@ -252,7 +252,7 @@ func TestCheckCompatible(t *testing.T) { { stored: func() ctypes.ChainConfigurator { // ClassicChainConfig is the chain parameters to run a node on the Classic main network. - c := &oldmultigeth.ChainConfig{ + c := &multigethv0.ChainConfig{ ChainID: big.NewInt(61), HomesteadBlock: big.NewInt(1150000), DAOForkBlock: big.NewInt(1920000), diff --git a/params/confp/generic/generic.go b/params/confp/generic/generic.go index 3efd4c36cdd3..88b3ed2e6f84 100644 --- a/params/confp/generic/generic.go +++ b/params/confp/generic/generic.go @@ -24,7 +24,7 @@ import ( "github.com/ethereum/go-ethereum/params/types/ctypes" "github.com/ethereum/go-ethereum/params/types/goethereum" "github.com/ethereum/go-ethereum/params/types/multigeth" - "github.com/ethereum/go-ethereum/params/types/oldmultigeth" + "github.com/ethereum/go-ethereum/params/types/multigethv0" "github.com/ethereum/go-ethereum/params/types/parity" "github.com/ethereum/go-ethereum/params/vars" "github.com/tidwall/gjson" @@ -47,7 +47,7 @@ func (c GenericCC) DAOSupport() bool { if gc, ok := c.ChainConfigurator.(*goethereum.ChainConfig); ok { return gc.DAOForkSupport } - if omg, ok := c.ChainConfigurator.(*oldmultigeth.ChainConfig); ok { + if omg, ok := c.ChainConfigurator.(*multigethv0.ChainConfig); ok { return omg.DAOForkSupport } if mg, ok := c.ChainConfigurator.(*multigeth.MultiGethChainConfig); ok { @@ -114,7 +114,7 @@ func UnmarshalChainConfigurator(input []byte) (ctypes.ChainConfigurator, error) }{ {&parity.ParityChainSpec{}, paritySchemaKeysSuffice, paritySchemaKeysMustNot}, {&multigeth.MultiGethChainConfig{}, multigethSchemaSuffice, multigethSchemaMustNot}, - {&oldmultigeth.ChainConfig{}, oldmultigethSchemaSuffice, oldmultigethSchemaMustNot}, + {&multigethv0.ChainConfig{}, oldmultigethSchemaSuffice, oldmultigethSchemaMustNot}, {&goethereum.ChainConfig{}, goethereumSchemaSuffice, goethereumSchemaMustNot}, } for _, c := range cases { diff --git a/params/confp/generic/generic_test.go b/params/confp/generic/generic_test.go index 10054e53feee..01028cc44e31 100644 --- a/params/confp/generic/generic_test.go +++ b/params/confp/generic/generic_test.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum/go-ethereum/params/types/ctypes" "github.com/ethereum/go-ethereum/params/types/goethereum" "github.com/ethereum/go-ethereum/params/types/multigeth" - "github.com/ethereum/go-ethereum/params/types/oldmultigeth" + "github.com/ethereum/go-ethereum/params/types/multigethv0" "github.com/ethereum/go-ethereum/params/types/parity" ) @@ -68,7 +68,7 @@ result: } } - om := &oldmultigeth.ChainConfig{ + om := &multigethv0.ChainConfig{ ChainID: big.NewInt(61), HomesteadBlock: big.NewInt(1150000), DAOForkBlock: big.NewInt(1920000), @@ -101,8 +101,8 @@ result: if err != nil { t.Fatal(err) } - if reflect.TypeOf(got) != reflect.TypeOf(&oldmultigeth.ChainConfig{}) { - t.Fatalf("mismatch, want: %v, got: %v", reflect.TypeOf(&oldmultigeth.ChainConfig{}), reflect.TypeOf(got)) + if reflect.TypeOf(got) != reflect.TypeOf(&multigethv0.ChainConfig{}) { + t.Fatalf("mismatch, want: %v, got: %v", reflect.TypeOf(&multigethv0.ChainConfig{}), reflect.TypeOf(got)) } if tr := got.GetEIP7Transition(); tr == nil || *tr != 1150000 { @@ -233,12 +233,12 @@ func TestUnmarshalChainConfigurator2(t *testing.T) { { versionid: "v196", raw: cc_v196_a, - wantType: reflect.TypeOf(&oldmultigeth.ChainConfig{}), + wantType: reflect.TypeOf(&multigethv0.ChainConfig{}), }, { versionid: "v197", raw: cc_v197_a, - wantType: reflect.TypeOf(&oldmultigeth.ChainConfig{}), + wantType: reflect.TypeOf(&multigethv0.ChainConfig{}), }, { versionid: "v198", diff --git a/params/types/genesisT/gen_genesis.go b/params/types/genesisT/gen_genesis.go index add8e450e914..fc35d8c3a29f 100644 --- a/params/types/genesisT/gen_genesis.go +++ b/params/types/genesisT/gen_genesis.go @@ -31,7 +31,7 @@ import ( common0 "github.com/ethereum/go-ethereum/params/types/ctypes" "github.com/ethereum/go-ethereum/params/types/goethereum" "github.com/ethereum/go-ethereum/params/types/multigeth" - "github.com/ethereum/go-ethereum/params/types/oldmultigeth" + "github.com/ethereum/go-ethereum/params/types/multigethv0" ) var _ = (*genesisSpecMarshaling)(nil) @@ -101,8 +101,8 @@ func (g *Genesis) UnmarshalJSON(input []byte) error { switch conf.(type) { case *multigeth.MultiGethChainConfig: dec.Config = &multigeth.MultiGethChainConfig{} - case *oldmultigeth.ChainConfig: - dec.Config = &oldmultigeth.ChainConfig{} + case *multigethv0.ChainConfig: + dec.Config = &multigethv0.ChainConfig{} case *goethereum.ChainConfig: dec.Config = &goethereum.ChainConfig{} default: diff --git a/params/types/oldmultigeth/oldmultigeth_chain_config.go b/params/types/multigethv0/oldmultigeth_chain_config.go similarity index 99% rename from params/types/oldmultigeth/oldmultigeth_chain_config.go rename to params/types/multigethv0/oldmultigeth_chain_config.go index f307b617a76f..63d5fe1e3f09 100644 --- a/params/types/oldmultigeth/oldmultigeth_chain_config.go +++ b/params/types/multigethv0/oldmultigeth_chain_config.go @@ -1,4 +1,4 @@ -package oldmultigeth +package multigethv0 import ( "math/big" diff --git a/params/types/oldmultigeth/oldmultigeth_chain_config_configurator.go b/params/types/multigethv0/oldmultigeth_chain_config_configurator.go similarity index 99% rename from params/types/oldmultigeth/oldmultigeth_chain_config_configurator.go rename to params/types/multigethv0/oldmultigeth_chain_config_configurator.go index d5e7916691f1..052ef176ee34 100644 --- a/params/types/oldmultigeth/oldmultigeth_chain_config_configurator.go +++ b/params/types/multigethv0/oldmultigeth_chain_config_configurator.go @@ -1,4 +1,4 @@ -package oldmultigeth +package multigethv0 import ( "math/big" diff --git a/params/types/oldmultigeth/oldmultigeth_chain_config_test.go b/params/types/multigethv0/oldmultigeth_chain_config_test.go similarity index 98% rename from params/types/oldmultigeth/oldmultigeth_chain_config_test.go rename to params/types/multigethv0/oldmultigeth_chain_config_test.go index 0897f27e4341..1245e032d74b 100644 --- a/params/types/oldmultigeth/oldmultigeth_chain_config_test.go +++ b/params/types/multigethv0/oldmultigeth_chain_config_test.go @@ -1,4 +1,4 @@ -package oldmultigeth +package multigethv0 import ( "math/big" From 831419be751a5a6b3c1060dc07501c85043e6cb6 Mon Sep 17 00:00:00 2001 From: meows Date: Mon, 3 Feb 2020 13:56:07 -0600 Subject: [PATCH 05/17] params/types/multigethv0: rename file oldmulgeth->multigethv0 Signed-off-by: meows --- .../{oldmultigeth_chain_config.go => multigethv0_chain_config.go} | 0 ...g_configurator.go => multigethv0_chain_config_configurator.go} | 0 ...geth_chain_config_test.go => multigethv0_chain_config_test.go} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename params/types/multigethv0/{oldmultigeth_chain_config.go => multigethv0_chain_config.go} (100%) rename params/types/multigethv0/{oldmultigeth_chain_config_configurator.go => multigethv0_chain_config_configurator.go} (100%) rename params/types/multigethv0/{oldmultigeth_chain_config_test.go => multigethv0_chain_config_test.go} (100%) diff --git a/params/types/multigethv0/oldmultigeth_chain_config.go b/params/types/multigethv0/multigethv0_chain_config.go similarity index 100% rename from params/types/multigethv0/oldmultigeth_chain_config.go rename to params/types/multigethv0/multigethv0_chain_config.go diff --git a/params/types/multigethv0/oldmultigeth_chain_config_configurator.go b/params/types/multigethv0/multigethv0_chain_config_configurator.go similarity index 100% rename from params/types/multigethv0/oldmultigeth_chain_config_configurator.go rename to params/types/multigethv0/multigethv0_chain_config_configurator.go diff --git a/params/types/multigethv0/oldmultigeth_chain_config_test.go b/params/types/multigethv0/multigethv0_chain_config_test.go similarity index 100% rename from params/types/multigethv0/oldmultigeth_chain_config_test.go rename to params/types/multigethv0/multigethv0_chain_config_test.go From 794964d99da2160b4581b922a39003ec4b981399 Mon Sep 17 00:00:00 2001 From: meows Date: Tue, 4 Feb 2020 09:25:54 -0600 Subject: [PATCH 06/17] core/vm,params/types: implement EIP2200Disable iface method Signed-off-by: meows --- core/vm/jump_table.go | 2 +- params/types/ctypes/configurator_iface.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index 4ee7cfabf66a..a5655bc9c3e5 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -189,7 +189,7 @@ func instructionSetForConfig(config ctypes.ChainConfigurator, bn *big.Int) JumpT if config.IsForked(config.GetECIP1080Transition, bn) { enableSelfBalance(&instructionSet) } - if config.IsForked(config.GetEIP2200Transition, bn) { + if config.IsForked(config.GetEIP2200Transition, bn) && !config.IsForked(config.GetEIP2200DisableTransition, bn) { enable2200(&instructionSet) // Net metered SSTORE - https://eips.ethereum.org/EIPS/eip-2200 } return instructionSet diff --git a/params/types/ctypes/configurator_iface.go b/params/types/ctypes/configurator_iface.go index e5a5389b7e8f..3e9293dc0f2d 100644 --- a/params/types/ctypes/configurator_iface.go +++ b/params/types/ctypes/configurator_iface.go @@ -108,6 +108,8 @@ type CatHerder interface { SetEIP1108Transition(n *uint64) error GetEIP2200Transition() *uint64 SetEIP2200Transition(n *uint64) error + GetEIP2200DisableTransition() *uint64 + SetEIP2200DisableTransition(n *uint64) error GetEIP1344Transition() *uint64 SetEIP1344Transition(n *uint64) error GetEIP1884Transition() *uint64 From 87eb1c65abfb1427513ee873071c43e20d5ba8dc Mon Sep 17 00:00:00 2001 From: meows Date: Tue, 4 Feb 2020 09:29:22 -0600 Subject: [PATCH 07/17] params/types: implement EIP2200Disable iface method for implmnting types Implements method for data types implementing ChainConfigurator/ CatHerder interface. Currently Parity, multigethv0, and go-ethereum implementations are bare, and will error if attempted to use. These data types, afaik, do not currently support this configuration. Signed-off-by: meows --- params/types/genesisT/genesis.go | 8 ++++++++ params/types/goethereum/goethereum_configurator.go | 11 +++++++++++ params/types/multigeth/chain_config.go | 3 ++- params/types/multigeth/chain_config_configurator.go | 9 +++++++++ .../oldmultigeth_chain_config_configurator.go | 11 +++++++++++ params/types/parity/parity_configurator.go | 11 +++++++++++ 6 files changed, 52 insertions(+), 1 deletion(-) diff --git a/params/types/genesisT/genesis.go b/params/types/genesisT/genesis.go index 396f8a4cbfbb..c7890289343c 100644 --- a/params/types/genesisT/genesis.go +++ b/params/types/genesisT/genesis.go @@ -488,6 +488,14 @@ func (g *Genesis) SetEIP2200Transition(n *uint64) error { return g.Config.SetEIP2200Transition(n) } +func (g *Genesis) GetEIP2200DisableTransition() *uint64 { + return g.Config.GetEIP2200DisableTransition() +} + +func (g *Genesis) SetEIP2200DisableTransition(n *uint64) error { + return g.Config.SetEIP2200DisableTransition(n) +} + func (g *Genesis) GetEIP1344Transition() *uint64 { return g.Config.GetEIP1344Transition() } diff --git a/params/types/goethereum/goethereum_configurator.go b/params/types/goethereum/goethereum_configurator.go index e943cebf3de2..bfd773dfab16 100644 --- a/params/types/goethereum/goethereum_configurator.go +++ b/params/types/goethereum/goethereum_configurator.go @@ -326,6 +326,17 @@ func (c *ChainConfig) SetEIP2200Transition(n *uint64) error { return nil } +func (c *ChainConfig) GetEIP2200DisableTransition() *uint64 { + return nil +} + +func (c *ChainConfig) SetEIP2200DisableTransition(n *uint64) error { + if n == nil { + return nil + } + return ctypes.ErrUnsupportedConfigFatal +} + func (c *ChainConfig) GetEIP1344Transition() *uint64 { return bigNewU64(c.IstanbulBlock) } diff --git a/params/types/multigeth/chain_config.go b/params/types/multigeth/chain_config.go index f81b518c27b9..f18821af4b0d 100644 --- a/params/types/multigeth/chain_config.go +++ b/params/types/multigeth/chain_config.go @@ -151,7 +151,8 @@ type MultiGethChainConfig struct { // EIP-2200: Rebalance net-metered SSTORE gas cost with consideration of SLOAD gas cost change // It's a combined version of EIP-1283 + EIP-1706, with a structured definition so as to make it // interoperable with other gas changes such as EIP-1884. - EIP2200FBlock *big.Int `json:"eip2200FBlock,omitempty"` + EIP2200FBlock *big.Int `json:"eip2200FBlock,omitempty"` + EIP2200DisableFBlock *big.Int `json:"eip2200DisableFBlock,omitempty"` // EIP-2384: Difficulty Bomb Delay (Muir Glacier) eip2384Inferred bool diff --git a/params/types/multigeth/chain_config_configurator.go b/params/types/multigeth/chain_config_configurator.go index 039ce8274a9a..c2d3d5d5b796 100644 --- a/params/types/multigeth/chain_config_configurator.go +++ b/params/types/multigeth/chain_config_configurator.go @@ -318,6 +318,15 @@ func (c *MultiGethChainConfig) SetEIP2200Transition(n *uint64) error { return nil } +func (c *MultiGethChainConfig) GetEIP2200DisableTransition() *uint64 { + return bigNewU64(c.EIP2200DisableFBlock) +} + +func (c *MultiGethChainConfig) SetEIP2200DisableTransition(n *uint64) error { + c.EIP2200DisableFBlock = setBig(c.EIP2200DisableFBlock, n) + return nil +} + func (c *MultiGethChainConfig) GetEIP1344Transition() *uint64 { return bigNewU64(c.EIP1344FBlock) } diff --git a/params/types/oldmultigeth/oldmultigeth_chain_config_configurator.go b/params/types/oldmultigeth/oldmultigeth_chain_config_configurator.go index d5e7916691f1..bbab2b7570ef 100644 --- a/params/types/oldmultigeth/oldmultigeth_chain_config_configurator.go +++ b/params/types/oldmultigeth/oldmultigeth_chain_config_configurator.go @@ -314,6 +314,17 @@ func (c *ChainConfig) SetEIP2200Transition(n *uint64) error { return nil } +func (c *ChainConfig) GetEIP2200DisableTransition() *uint64 { + return nil +} + +func (c *ChainConfig) SetEIP2200DisableTransition(n *uint64) error { + if n == nil { + return nil + } + return ctypes.ErrUnsupportedConfigFatal +} + func (c *ChainConfig) GetEIP1344Transition() *uint64 { return bigNewU64(c.IstanbulBlock) } diff --git a/params/types/parity/parity_configurator.go b/params/types/parity/parity_configurator.go index f999bdb240a2..6a3bdb123f5f 100644 --- a/params/types/parity/parity_configurator.go +++ b/params/types/parity/parity_configurator.go @@ -250,6 +250,17 @@ func (spec *ParityChainSpec) SetEIP2200Transition(i *uint64) error { return nil } +func (spec *ParityChainSpec) GetEIP2200DisableTransition() *uint64 { + return nil +} + +func (spec *ParityChainSpec) SetEIP2200DisableTransition(n *uint64) error { + if n == nil { + return nil + } + return ctypes.ErrUnsupportedConfigFatal +} + func (spec *ParityChainSpec) GetEIP1344Transition() *uint64 { return spec.Params.EIP1344Transition.Uint64P() } From f2bcf0c006d92747a631ebb777a65cac761432a3 Mon Sep 17 00:00:00 2001 From: meows Date: Tue, 4 Feb 2020 09:36:20 -0600 Subject: [PATCH 08/17] params: finish implement ECIP1078/+ECIP1079 for ETC networks - Disable EIP2200 on mordor and kotti - Updates block activation numbers respectively Signed-off-by: meows --- params/config_classic.go | 17 +++++++++-------- params/config_kotti.go | 8 ++++---- params/config_mordor.go | 10 ++++++---- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/params/config_classic.go b/params/config_classic.go index 19fdd0a641d4..c0353ed1b09f 100644 --- a/params/config_classic.go +++ b/params/config_classic.go @@ -61,15 +61,16 @@ var ( // Istanbul eq // ECIP-1061, ECIP-1072 - EIP152FBlock: big.NewInt(10500839), - EIP1108FBlock: big.NewInt(10500839), - EIP1344FBlock: big.NewInt(10500839), - EIP2028FBlock: big.NewInt(10500839), - // ECIP-1078, ECIP-1079 + EIP152FBlock: big.NewInt(10_500_839), + EIP1108FBlock: big.NewInt(10_500_839), + EIP1344FBlock: big.NewInt(10_500_839), + EIP2028FBlock: big.NewInt(10_500_839), //EIP2200FBlock: big.NewInt(10500839), // RePetersburg (=~ re-1283) - EIP1283FBlock: big.NewInt(10500839), - EIP1706FBlock: big.NewInt(10500839), - ECIP1080FBlock: big.NewInt(10500839), + + // ECIP-1078, ECIP-1079 + EIP1283FBlock: big.NewInt(10_500_839), + EIP1706FBlock: big.NewInt(10_500_839), + ECIP1080FBlock: big.NewInt(10_500_839), PetersburgBlock: nil, // Un1283 diff --git a/params/config_kotti.go b/params/config_kotti.go index d6822caeb818..a315506e90c0 100644 --- a/params/config_kotti.go +++ b/params/config_kotti.go @@ -71,10 +71,10 @@ var ( EIP2200FBlock: big.NewInt(2058191), // RePetersburg (== re-1283) // ECIP-1078, ECIP-1079 - // TODO: +disable 2200 - EIP1283FBlock: big.NewInt(2058191), - EIP1706FBlock: big.NewInt(2058191), - ECIP1080FBlock: big.NewInt(2058191), + EIP2200DisableFBlock: big.NewInt(2_208_203), + EIP1283FBlock: big.NewInt(2_208_203), + EIP1706FBlock: big.NewInt(2_208_203), + ECIP1080FBlock: big.NewInt(2_208_203), ECIP1017FBlock: big.NewInt(5000000), ECIP1017EraRounds: big.NewInt(5000000), diff --git a/params/config_mordor.go b/params/config_mordor.go index 6426bc82af51..afcd68717ed0 100644 --- a/params/config_mordor.go +++ b/params/config_mordor.go @@ -62,11 +62,13 @@ var ( EIP1108FBlock: big.NewInt(778507), EIP1344FBlock: big.NewInt(778507), EIP2028FBlock: big.NewInt(778507), + EIP2200FBlock: big.NewInt(778507), // RePetersburg (== re-1283) + // ECIP-1078, ECIP-1079 - //EIP2200FBlock: big.NewInt(778507), // RePetersburg (== re-1283) - EIP1283FBlock: big.NewInt(778507), - EIP1706FBlock: big.NewInt(778507), - ECIP1080FBlock: big.NewInt(778507), + EIP2200DisableFBlock: big.NewInt(976_231), + EIP1283FBlock: big.NewInt(976_231), + EIP1706FBlock: big.NewInt(976_231), + ECIP1080FBlock: big.NewInt(976_231), DisposalBlock: big.NewInt(0), ECIP1017FBlock: big.NewInt(0), From 26b180edc4edb435ee8f68c08b118329dcdf87e9 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 07:23:31 -0500 Subject: [PATCH 09/17] params: (readability) improve feature line completeness - Add nil-valued eip1884 field - Add EIP2200 enable/+disable for Classic mainnet reflecting ECIP1061/1078 - Adds nicknames for 3 latest ETC forks Signed-off-by: meows --- params/config_classic.go | 20 ++++++++++---------- params/config_kotti.go | 9 +++++---- params/config_mordor.go | 9 +++++---- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/params/config_classic.go b/params/config_classic.go index c0353ed1b09f..57df984295f7 100644 --- a/params/config_classic.go +++ b/params/config_classic.go @@ -54,25 +54,25 @@ var ( EIP214FBlock: big.NewInt(8772000), EIP658FBlock: big.NewInt(8772000), - // Constantinople eq + // Constantinople eq, aka Agharta EIP145FBlock: big.NewInt(9573000), EIP1014FBlock: big.NewInt(9573000), EIP1052FBlock: big.NewInt(9573000), - // Istanbul eq - // ECIP-1061, ECIP-1072 + // Istanbul eq, aka Aztlan + // ECIP-1061 EIP152FBlock: big.NewInt(10_500_839), EIP1108FBlock: big.NewInt(10_500_839), EIP1344FBlock: big.NewInt(10_500_839), + EIP1884FBlock: nil, EIP2028FBlock: big.NewInt(10_500_839), - //EIP2200FBlock: big.NewInt(10500839), // RePetersburg (=~ re-1283) + EIP2200FBlock: big.NewInt(10_500_839), // RePetersburg (=~ re-1283) - // ECIP-1078, ECIP-1079 - EIP1283FBlock: big.NewInt(10_500_839), - EIP1706FBlock: big.NewInt(10_500_839), - ECIP1080FBlock: big.NewInt(10_500_839), - - PetersburgBlock: nil, // Un1283 + // ECIP-1078, aka Phoenix Fix + EIP2200DisableFBlock: big.NewInt(10_500_839), + EIP1283FBlock: big.NewInt(10_500_839), + EIP1706FBlock: big.NewInt(10_500_839), + ECIP1080FBlock: big.NewInt(10_500_839), DisposalBlock: big.NewInt(5900000), ECIP1017FBlock: big.NewInt(5000000), diff --git a/params/config_kotti.go b/params/config_kotti.go index a315506e90c0..35a9abc12119 100644 --- a/params/config_kotti.go +++ b/params/config_kotti.go @@ -57,20 +57,21 @@ var ( EIP214FBlock: big.NewInt(716617), EIP658FBlock: big.NewInt(716617), - // Constantinople eq + // Constantinople eq, aka Agharta EIP145FBlock: big.NewInt(1705549), EIP1014FBlock: big.NewInt(1705549), EIP1052FBlock: big.NewInt(1705549), - // Istanbul eq - // ECIP-1061, ECIP-1072 + // Istanbul eq, aka Aztlan + // ECIP-1061 EIP152FBlock: big.NewInt(2058191), EIP1108FBlock: big.NewInt(2058191), EIP1344FBlock: big.NewInt(2058191), + EIP1884FBlock: nil, EIP2028FBlock: big.NewInt(2058191), EIP2200FBlock: big.NewInt(2058191), // RePetersburg (== re-1283) - // ECIP-1078, ECIP-1079 + // ECIP-1078, aka Phoenix Fix EIP2200DisableFBlock: big.NewInt(2_208_203), EIP1283FBlock: big.NewInt(2_208_203), EIP1706FBlock: big.NewInt(2_208_203), diff --git a/params/config_mordor.go b/params/config_mordor.go index afcd68717ed0..a1104d6ae570 100644 --- a/params/config_mordor.go +++ b/params/config_mordor.go @@ -51,20 +51,21 @@ var ( EIP214FBlock: big.NewInt(0), EIP658FBlock: big.NewInt(0), - // Constantinople eq + // Constantinople eq, aka Agharta EIP145FBlock: big.NewInt(301243), EIP1014FBlock: big.NewInt(301243), EIP1052FBlock: big.NewInt(301243), - // Istanbul eq - // ECIP-1061, ECIP-1072 + // Istanbul eq, aka Aztlan + // ECIP-1061 EIP152FBlock: big.NewInt(778507), EIP1108FBlock: big.NewInt(778507), EIP1344FBlock: big.NewInt(778507), + EIP1884FBlock: nil, EIP2028FBlock: big.NewInt(778507), EIP2200FBlock: big.NewInt(778507), // RePetersburg (== re-1283) - // ECIP-1078, ECIP-1079 + // ECIP-1078, aka Phoenix Fix EIP2200DisableFBlock: big.NewInt(976_231), EIP1283FBlock: big.NewInt(976_231), EIP1706FBlock: big.NewInt(976_231), From 6997681776b0c9fcad52ce8c8fa8e24cf7ce107d Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 08:30:00 -0500 Subject: [PATCH 10/17] Makefile,params/types,tests: install multigethv0 feature eq tests - Adds multigethv0 feature equivalence test config and Makefile target. - Fixes Makefile target naming (Parity and Multigeth were backwards) Signed-off-by: meows --- Makefile | 10 +++++++--- params/types/multigethv0/doc.go | 11 +++++++++++ tests/init_mgen.go | 1 + tests/params.go | 20 ++++++++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 params/types/multigethv0/doc.go diff --git a/Makefile b/Makefile index 09f9953f501e..97a573d834ab 100644 --- a/Makefile +++ b/Makefile @@ -37,16 +37,20 @@ sync-clients: test-multigeth: test-multigeth-features test-multigeth-chainspecs ## Runs all tests specific to multi-geth. -test-multigeth-features: test-multigeth-features-parity test-multigeth-features-multigeth ## Runs tests specific to multi-geth using Fork/Feature configs. +test-multigeth-features: test-multigeth-features-parity test-multigeth-features-multigeth test-multigeth-features-multigethv0 ## Runs tests specific to multi-geth using Fork/Feature configs. -test-multigeth-features-multigeth: +test-multigeth-features-parity: @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: +test-multigeth-features-multigeth: @echo "Testing fork/feature/datatype implementation; equivalence - MULTIGETH." env MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_MULTIGETH=on go test -count=1 ./tests +test-multigeth-features-multigethv0: + @echo "Testing fork/feature/datatype implementation; equivalence - MULTIGETHv0." + env MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALANCE_MULTIGETHV0=on go test -count=1 ./tests + test-multigeth-chainspecs: ## Run tests specific to multi-geth using chainspec file configs. @echo "Testing Parity JSON chainspec equivalence." env MULTIGETH_TESTS_CHAINCONFIG_PARITY_SPECS=on go test -count=1 ./tests diff --git a/params/types/multigethv0/doc.go b/params/types/multigethv0/doc.go new file mode 100644 index 000000000000..62323ae575e4 --- /dev/null +++ b/params/types/multigethv0/doc.go @@ -0,0 +1,11 @@ +/* +Package multigethv0 implements the data type fitting +the original iteration of the multigeth client configuration structure. + +It is mostly used for managing upgrades between client versions, +and is not encouraged for real use. + */ + +package multigethv0 + + diff --git a/tests/init_mgen.go b/tests/init_mgen.go index 92b38888752b..2c51c913dabd 100644 --- a/tests/init_mgen.go +++ b/tests/init_mgen.go @@ -35,6 +35,7 @@ var ( // Feature Equivalence tests use convert.Convert to // run tests using alternating ChainConfig data type implementations. MG_CHAINCONFIG_FEATURE_EQ_MULTIGETH_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_MULTIGETH" + MG_CHAINCONFIG_FEATURE_EQ_MULTIGETHV0_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALANCE_MULTIGETHV0" MG_CHAINCONFIG_FEATURE_EQ_PARITY_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_PARITY" // Parity specs tests use Parity JSON config data (in params/parity.json.d/) diff --git a/tests/params.go b/tests/params.go index 4058383325d1..40ca3c64ff0f 100644 --- a/tests/params.go +++ b/tests/params.go @@ -28,6 +28,7 @@ import ( "github.com/ethereum/go-ethereum/params/confp" "github.com/ethereum/go-ethereum/params/types/ctypes" "github.com/ethereum/go-ethereum/params/types/multigeth" + "github.com/ethereum/go-ethereum/params/types/multigethv0" "github.com/ethereum/go-ethereum/params/types/parity" ) @@ -130,6 +131,25 @@ func init() { difficultyChainConfigurations[k] = mgc } + } else if os.Getenv(MG_CHAINCONFIG_FEATURE_EQ_MULTIGETHV0_KEY) != "" { + log.Println("converting to MultiGethV0 data type.") + + for i, config := range Forks { + pspec := &multigethv0.ChainConfig{} + if err := confp.Convert(config, pspec); ctypes.IsFatalUnsupportedErr(err) { + panic(err) + } + Forks[i] = pspec + } + + for k, v := range difficultyChainConfigurations { + pspec := &multigethv0.ChainConfig{} + if err := confp.Convert(v, pspec); ctypes.IsFatalUnsupportedErr(err) { + panic(err) + } + difficultyChainConfigurations[k] = pspec + } + } else if os.Getenv(MG_CHAINCONFIG_FEATURE_EQ_PARITY_KEY) != "" { log.Println("converting to Parity data type.") From a1e0a2ac15bd549a67c24e47534dfd712d188145 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 08:31:02 -0500 Subject: [PATCH 11/17] Makefile,params/types,tests: (lint) fix misspell, goimports Signed-off-by: meows --- Makefile | 2 +- params/types/multigethv0/doc.go | 4 +--- tests/init_mgen.go | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 97a573d834ab..762366542a92 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ test-multigeth-features-multigeth: test-multigeth-features-multigethv0: @echo "Testing fork/feature/datatype implementation; equivalence - MULTIGETHv0." - env MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALANCE_MULTIGETHV0=on go test -count=1 ./tests + env MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_MULTIGETHV0=on go test -count=1 ./tests test-multigeth-chainspecs: ## Run tests specific to multi-geth using chainspec file configs. @echo "Testing Parity JSON chainspec equivalence." diff --git a/params/types/multigethv0/doc.go b/params/types/multigethv0/doc.go index 62323ae575e4..8145deaf7d9b 100644 --- a/params/types/multigethv0/doc.go +++ b/params/types/multigethv0/doc.go @@ -4,8 +4,6 @@ the original iteration of the multigeth client configuration structure. It is mostly used for managing upgrades between client versions, and is not encouraged for real use. - */ +*/ package multigethv0 - - diff --git a/tests/init_mgen.go b/tests/init_mgen.go index 2c51c913dabd..8c431f78a09e 100644 --- a/tests/init_mgen.go +++ b/tests/init_mgen.go @@ -34,9 +34,9 @@ var ( // Feature Equivalence tests use convert.Convert to // run tests using alternating ChainConfig data type implementations. - MG_CHAINCONFIG_FEATURE_EQ_MULTIGETH_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_MULTIGETH" - MG_CHAINCONFIG_FEATURE_EQ_MULTIGETHV0_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALANCE_MULTIGETHV0" - MG_CHAINCONFIG_FEATURE_EQ_PARITY_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_PARITY" + MG_CHAINCONFIG_FEATURE_EQ_MULTIGETH_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_MULTIGETH" + MG_CHAINCONFIG_FEATURE_EQ_MULTIGETHV0_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_MULTIGETHV0" + MG_CHAINCONFIG_FEATURE_EQ_PARITY_KEY = "MULTIGETH_TESTS_CHAINCONFIG_FEATURE_EQUIVALENCE_PARITY" // Parity specs tests use Parity JSON config data (in params/parity.json.d/) // when applicable as equivalent config implementations for the default Go data type From c0da4fa97ef1aea47e7e99162eb9d48c1bcc9f67 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 08:32:28 -0500 Subject: [PATCH 12/17] tests: fix skip missing tests -- should fatal If a project hasn't cloned the submodule and runs the tests/ (without having any tests to run) then the tests will seem to PASS. This is bad. Tests should run tests, and if there are no tests, the tests should FAIL. Signed-off-by: meows --- tests/init_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/init_test.go b/tests/init_test.go index fe6171e77174..d7e393be46a7 100644 --- a/tests/init_test.go +++ b/tests/init_test.go @@ -210,7 +210,7 @@ func (tm *testMatcher) walk(t *testing.T, dir string, runTest interface{}) { dirinfo, err := os.Stat(dir) if os.IsNotExist(err) || !dirinfo.IsDir() { fmt.Fprintf(os.Stderr, "can't find test files in %s, did you clone the tests submodule?\n", dir) - t.Skip("missing test files") + t.Fatal("missing test files") } err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { name := filepath.ToSlash(strings.TrimPrefix(path, dir+string(filepath.Separator))) From b928e55f8fcba383ff2db22f716d22d8d7555314 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 09:31:50 -0500 Subject: [PATCH 13/17] consensus/ethash: fix comment for EIP2384 Signed-off-by: meows --- consensus/ethash/consensus.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 212bfd0d0937..683b66a9ee2e 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -384,14 +384,8 @@ func CalcDifficulty(config ctypes.ChainConfigurator, time uint64, parent *types. exPeriodRef.Set(fakeBlockNumber) } else if config.IsForked(config.GetEthashEIP2384Transition, next) { - // calcDifficultyEIP1234 is the difficulty adjustment algorithm for Constantinople. - // The calculation uses the Byzantium rules, but with bomb offset 5M. - // Specification EIP-1234: https://eips.ethereum.org/EIPS/eip-1234 - // Note, the calculations below looks at the parent number, which is 1 below - // the block number. Thus we remove one from the delay given - - // calculate a fake block number for the ice-age delay - // Specification: https://eips.ethereum.org/EIPS/eip-1234 + // calcDifficultyEIP2384 is the difficulty adjustment algorithm for Muir Glacier. + // The calculation uses the Byzantium rules, but with bomb offset 9M. fakeBlockNumber := new(big.Int) delayWithOffset := new(big.Int).Sub(vars.EIP2384DifficultyBombDelay, common.Big1) if parent.Number.Cmp(delayWithOffset) >= 0 { From 618fc763fe1ebf40653be69510e1fac57ad0b1a0 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 09:35:29 -0500 Subject: [PATCH 14/17] params/types/multigethv0: fix failing tests by setting set eip2384 -> noop The difficulty test suite Ropsten config has EIP2384 (Muir Glacier) set. multigethv0 doesn't support this configuration, which adjusts difficulty, and when SetEIP2384 was called on the converted-to multigethv0 config, a Fatal error was thrown and the resulting config was invalid. This fix simply has the config return a Noop error instead of a Fatal one. The tests DO NOT COVER the Muir Glacier cases, though. Resolves https://github.com/etclabscore/multi-geth/issues/139 Signed-off-by: meows --- .../multigethv0/multigethv0_chain_config_configurator.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/params/types/multigethv0/multigethv0_chain_config_configurator.go b/params/types/multigethv0/multigethv0_chain_config_configurator.go index b9e865fab096..6314adb97da8 100644 --- a/params/types/multigethv0/multigethv0_chain_config_configurator.go +++ b/params/types/multigethv0/multigethv0_chain_config_configurator.go @@ -537,6 +537,7 @@ func (c *ChainConfig) SetEthashEIP1234Transition(n *uint64) error { return nil } +// Muir Glacier difficulty bomb delay func (c *ChainConfig) GetEthashEIP2384Transition() *uint64 { return nil } @@ -545,7 +546,7 @@ func (c *ChainConfig) SetEthashEIP2384Transition(n *uint64) error { if n == nil { return nil } - return ctypes.ErrUnsupportedConfigFatal + return ctypes.ErrUnsupportedConfigNoop } func (c *ChainConfig) GetEthashECIP1010PauseTransition() *uint64 { @@ -611,9 +612,11 @@ func (c *ChainConfig) SetEthashECIP1017EraRounds(n *uint64) error { } func (c *ChainConfig) GetEthashEIP100BTransition() *uint64 { - x := bigNewU64(bigMax(c.EIP100FBlock, c.ByzantiumBlock)) + // Because the Ethereum Foundation network (and client... and tests) assume that if Constantinople + // is activated, then Byzantium must be (have been) as well. + x := bigMax(c.EIP100FBlock, c.ByzantiumBlock) if x != nil { - return x + return bigNewU64(x) } return bigNewU64(bigMax(c.EIP100FBlock, c.ConstantinopleBlock)) } From ddcb1685a1b996e47bf7c327e3fc0e48714c8ccf Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 09:38:35 -0500 Subject: [PATCH 15/17] params/types/multigethv0: install MuirGlacierBlock w/ EIP2384 iface Implements block activation field per upstream ethereum/go-ethereum config (as expect multigethv0) would, and installs use of this field in the EIP2384 interface methods. Signed-off-by: meows --- params/types/multigethv0/multigethv0_chain_config.go | 5 +++-- .../multigethv0/multigethv0_chain_config_configurator.go | 8 +++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/params/types/multigethv0/multigethv0_chain_config.go b/params/types/multigethv0/multigethv0_chain_config.go index 63d5fe1e3f09..e4ec86b5dd02 100644 --- a/params/types/multigethv0/multigethv0_chain_config.go +++ b/params/types/multigethv0/multigethv0_chain_config.go @@ -112,8 +112,9 @@ type ChainConfig struct { PetersburgBlock *big.Int `json:"petersburgBlock,omitempty"` // Petersburg switch block (nil = same as Constantinople) - IstanbulBlock *big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul) - EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated) + IstanbulBlock *big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul) + MuirGlacierBlock *big.Int `json:"muirGlacierBlock,omitempty"` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated) + EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated) ECIP1010PauseBlock *big.Int `json:"ecip1010PauseBlock,omitempty"` // ECIP1010 pause HF block ECIP1010Length *big.Int `json:"ecip1010Length,omitempty"` // ECIP1010 length diff --git a/params/types/multigethv0/multigethv0_chain_config_configurator.go b/params/types/multigethv0/multigethv0_chain_config_configurator.go index 6314adb97da8..846bc83316a1 100644 --- a/params/types/multigethv0/multigethv0_chain_config_configurator.go +++ b/params/types/multigethv0/multigethv0_chain_config_configurator.go @@ -539,14 +539,12 @@ func (c *ChainConfig) SetEthashEIP1234Transition(n *uint64) error { // Muir Glacier difficulty bomb delay func (c *ChainConfig) GetEthashEIP2384Transition() *uint64 { - return nil + return bigNewU64(c.MuirGlacierBlock) } func (c *ChainConfig) SetEthashEIP2384Transition(n *uint64) error { - if n == nil { - return nil - } - return ctypes.ErrUnsupportedConfigNoop + c.MuirGlacierBlock = setBig(c.MuirGlacierBlock, n) + return nil } func (c *ChainConfig) GetEthashECIP1010PauseTransition() *uint64 { From f9c254e4e6abc91f963ee39a626ca6caafeacc82 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 09:42:03 -0500 Subject: [PATCH 16/17] params: revert ETC networks configs to pre-ECIP1078 This ECIP hasn't been accepted yet, and this changeset should have nothing to do with it anyways. Signed-off-by: meows --- params/config_classic.go | 22 +++++++++------------- params/config_kotti.go | 11 ++--------- params/config_mordor.go | 11 ++--------- 3 files changed, 13 insertions(+), 31 deletions(-) diff --git a/params/config_classic.go b/params/config_classic.go index 57df984295f7..b12a6a71baf8 100644 --- a/params/config_classic.go +++ b/params/config_classic.go @@ -54,25 +54,21 @@ var ( EIP214FBlock: big.NewInt(8772000), EIP658FBlock: big.NewInt(8772000), - // Constantinople eq, aka Agharta + // Constantinople eq EIP145FBlock: big.NewInt(9573000), EIP1014FBlock: big.NewInt(9573000), EIP1052FBlock: big.NewInt(9573000), - // Istanbul eq, aka Aztlan - // ECIP-1061 - EIP152FBlock: big.NewInt(10_500_839), - EIP1108FBlock: big.NewInt(10_500_839), - EIP1344FBlock: big.NewInt(10_500_839), + // Istanbul eq + EIP152FBlock: big.NewInt(10500839), + EIP1108FBlock: big.NewInt(10500839), + EIP1344FBlock: big.NewInt(10500839), EIP1884FBlock: nil, - EIP2028FBlock: big.NewInt(10_500_839), - EIP2200FBlock: big.NewInt(10_500_839), // RePetersburg (=~ re-1283) + EIP2028FBlock: big.NewInt(10500839), + EIP2200FBlock: big.NewInt(10500839), // RePetersburg (=~ re-1283) - // ECIP-1078, aka Phoenix Fix - EIP2200DisableFBlock: big.NewInt(10_500_839), - EIP1283FBlock: big.NewInt(10_500_839), - EIP1706FBlock: big.NewInt(10_500_839), - ECIP1080FBlock: big.NewInt(10_500_839), + EIP1283FBlock: nil, + PetersburgBlock: nil, // Un1283 DisposalBlock: big.NewInt(5900000), ECIP1017FBlock: big.NewInt(5000000), diff --git a/params/config_kotti.go b/params/config_kotti.go index 35a9abc12119..0cb182b90c95 100644 --- a/params/config_kotti.go +++ b/params/config_kotti.go @@ -57,13 +57,12 @@ var ( EIP214FBlock: big.NewInt(716617), EIP658FBlock: big.NewInt(716617), - // Constantinople eq, aka Agharta + // Constantinople eq EIP145FBlock: big.NewInt(1705549), EIP1014FBlock: big.NewInt(1705549), EIP1052FBlock: big.NewInt(1705549), - // Istanbul eq, aka Aztlan - // ECIP-1061 + // Istanbul eq EIP152FBlock: big.NewInt(2058191), EIP1108FBlock: big.NewInt(2058191), EIP1344FBlock: big.NewInt(2058191), @@ -71,12 +70,6 @@ var ( EIP2028FBlock: big.NewInt(2058191), EIP2200FBlock: big.NewInt(2058191), // RePetersburg (== re-1283) - // ECIP-1078, aka Phoenix Fix - EIP2200DisableFBlock: big.NewInt(2_208_203), - EIP1283FBlock: big.NewInt(2_208_203), - EIP1706FBlock: big.NewInt(2_208_203), - ECIP1080FBlock: big.NewInt(2_208_203), - ECIP1017FBlock: big.NewInt(5000000), ECIP1017EraRounds: big.NewInt(5000000), diff --git a/params/config_mordor.go b/params/config_mordor.go index a1104d6ae570..d54e7eb7d55f 100644 --- a/params/config_mordor.go +++ b/params/config_mordor.go @@ -51,13 +51,12 @@ var ( EIP214FBlock: big.NewInt(0), EIP658FBlock: big.NewInt(0), - // Constantinople eq, aka Agharta + // Constantinople eq EIP145FBlock: big.NewInt(301243), EIP1014FBlock: big.NewInt(301243), EIP1052FBlock: big.NewInt(301243), - // Istanbul eq, aka Aztlan - // ECIP-1061 + // Istanbul eq EIP152FBlock: big.NewInt(778507), EIP1108FBlock: big.NewInt(778507), EIP1344FBlock: big.NewInt(778507), @@ -65,12 +64,6 @@ var ( EIP2028FBlock: big.NewInt(778507), EIP2200FBlock: big.NewInt(778507), // RePetersburg (== re-1283) - // ECIP-1078, aka Phoenix Fix - EIP2200DisableFBlock: big.NewInt(976_231), - EIP1283FBlock: big.NewInt(976_231), - EIP1706FBlock: big.NewInt(976_231), - ECIP1080FBlock: big.NewInt(976_231), - DisposalBlock: big.NewInt(0), ECIP1017FBlock: big.NewInt(0), ECIP1017EraRounds: big.NewInt(2000000), From ba5afc97def6ef0e96d251abc9dff0ce31db0e86 Mon Sep 17 00:00:00 2001 From: meows Date: Wed, 5 Feb 2020 10:44:43 -0500 Subject: [PATCH 17/17] tests: improve debugging config for test failure logs Chain config implementations are not required to satisfy Stringer iface, which can result in illegible logs. Signed-off-by: meows --- tests/difficulty_test_util.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/difficulty_test_util.go b/tests/difficulty_test_util.go index 9091aa80c5cd..99e477b3d489 100644 --- a/tests/difficulty_test_util.go +++ b/tests/difficulty_test_util.go @@ -139,10 +139,11 @@ func (test *DifficultyTest) Run(config ctypes.ChainConfigurator) error { actual := ethash.CalcDifficulty(config, test.CurrentTimestamp, parent) exp := test.CurrentDifficulty + b, _ := json.Marshal(config) if actual.Cmp(exp) != 0 { return fmt.Errorf(`%s got: %v, want: %v test: %v -config: %s`, test.Name, actual, exp, test, config) +config: %s`, test.Name, actual, exp, test, string(b)) } return nil