diff --git a/common/constants.go b/common/constants.go index ad2828aeec..cde3ac972b 100644 --- a/common/constants.go +++ b/common/constants.go @@ -36,6 +36,8 @@ var TIP2019Block = big.NewInt(1) var TIPSigning = big.NewInt(3000000) var TIPRandomize = big.NewInt(3464000) +var TIPV2SwitchBlock = big.NewInt(99999999999) + var TIPIncreaseMasternodes = big.NewInt(5000000) // Upgrade MN Count at Block. var TIPNoHalvingMNReward = big.NewInt(38383838) // hardfork no halving masternodes reward var BlackListHFNumber = uint64(38383838) diff --git a/common/constants/constants.go.devnet b/common/constants/constants.go.devnet index dbf9808342..1bcdf676ca 100644 --- a/common/constants/constants.go.devnet +++ b/common/constants/constants.go.devnet @@ -36,6 +36,8 @@ var TIP2019Block = big.NewInt(1) var TIPSigning = big.NewInt(225000) var TIPRandomize = big.NewInt(225000) +var TIPV2SwitchBlock = big.NewInt(7074000) + var TIPIncreaseMasternodes = big.NewInt(225000) // Upgrade MN Count at Block. var TIPNoHalvingMNReward = big.NewInt(429987) // hardfork no halving masternodes reward var BlackListHFNumber = uint64(225000) diff --git a/params/config.go b/params/config.go index c722eb1bfc..c987c406c1 100644 --- a/params/config.go +++ b/params/config.go @@ -57,7 +57,17 @@ var ( MinePeriod: 10, }, } - TestV2Configs = map[uint64]*V2Config{ + TestnetV2Configs = map[uint64]*V2Config{ + Default: { + SwitchRound: 0, + CertThreshold: 3, + TimeoutSyncThreshold: 2, + TimeoutPeriod: 4, + WaitPeriod: 1, + MinePeriod: 2, + }, + } + UnitTestV2Configs = map[uint64]*V2Config{ Default: { SwitchRound: 0, CertThreshold: 3, @@ -152,7 +162,7 @@ var ( Gap: 450, FoudationWalletAddr: common.HexToAddress("xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"), V2: &V2{ - SwitchBlock: big.NewInt(9999999999), + SwitchBlock: common.TIPV2SwitchBlock, CurrentConfig: MainnetV2Configs[0], AllConfigs: MainnetV2Configs, }, @@ -194,9 +204,9 @@ var ( Gap: 450, FoudationWalletAddr: common.HexToAddress("xdc746249c61f5832c5eed53172776b460491bdcd5c"), V2: &V2{ - SwitchBlock: big.NewInt(900), - CurrentConfig: TestV2Configs[0], - AllConfigs: TestV2Configs, + SwitchBlock: common.TIPV2SwitchBlock, + CurrentConfig: TestnetV2Configs[0], + AllConfigs: TestnetV2Configs, SkipV2Validation: true, }, }, @@ -219,7 +229,7 @@ var ( Gap: 450, FoudationWalletAddr: common.HexToAddress("0x746249c61f5832c5eed53172776b460491bdcd5c"), V2: &V2{ - SwitchBlock: big.NewInt(7074000), + SwitchBlock: common.TIPV2SwitchBlock, CurrentConfig: DevnetV2Configs[0], AllConfigs: DevnetV2Configs, }, @@ -286,8 +296,8 @@ var ( Reward: 250, V2: &V2{ SwitchBlock: big.NewInt(900), - CurrentConfig: TestV2Configs[0], - AllConfigs: TestV2Configs, + CurrentConfig: UnitTestV2Configs[0], + AllConfigs: UnitTestV2Configs, }, }, } diff --git a/params/config_test.go b/params/config_test.go index 8992e15b4f..7d31c57337 100644 --- a/params/config_test.go +++ b/params/config_test.go @@ -83,37 +83,37 @@ func TestCheckCompatible(t *testing.T) { } func TestUpdateV2Config(t *testing.T) { - TestnetChainConfig.XDPoS.V2.BuildConfigIndex() - c := TestnetChainConfig.XDPoS.V2.CurrentConfig + TestXDPoSMockChainConfig.XDPoS.V2.BuildConfigIndex() + c := TestXDPoSMockChainConfig.XDPoS.V2.CurrentConfig assert.Equal(t, 3, c.CertThreshold) - TestnetChainConfig.XDPoS.V2.UpdateConfig(10) - c = TestnetChainConfig.XDPoS.V2.CurrentConfig + TestXDPoSMockChainConfig.XDPoS.V2.UpdateConfig(10) + c = TestXDPoSMockChainConfig.XDPoS.V2.CurrentConfig assert.Equal(t, 5, c.CertThreshold) - TestnetChainConfig.XDPoS.V2.UpdateConfig(899) - c = TestnetChainConfig.XDPoS.V2.CurrentConfig + TestXDPoSMockChainConfig.XDPoS.V2.UpdateConfig(899) + c = TestXDPoSMockChainConfig.XDPoS.V2.CurrentConfig assert.Equal(t, 4, c.TimeoutSyncThreshold) } func TestV2Config(t *testing.T) { - TestnetChainConfig.XDPoS.V2.BuildConfigIndex() - c := TestnetChainConfig.XDPoS.V2.Config(1) + TestXDPoSMockChainConfig.XDPoS.V2.BuildConfigIndex() + c := TestXDPoSMockChainConfig.XDPoS.V2.Config(1) assert.Equal(t, 3, c.CertThreshold) - c = TestnetChainConfig.XDPoS.V2.Config(5) + c = TestXDPoSMockChainConfig.XDPoS.V2.Config(5) assert.Equal(t, 3, c.CertThreshold) - c = TestnetChainConfig.XDPoS.V2.Config(10) + c = TestXDPoSMockChainConfig.XDPoS.V2.Config(10) assert.Equal(t, 3, c.CertThreshold) - c = TestnetChainConfig.XDPoS.V2.Config(11) + c = TestXDPoSMockChainConfig.XDPoS.V2.Config(11) assert.Equal(t, 5, c.CertThreshold) } func TestBuildConfigIndex(t *testing.T) { - TestnetChainConfig.XDPoS.V2.BuildConfigIndex() - index := TestnetChainConfig.XDPoS.V2.ConfigIndex() + TestXDPoSMockChainConfig.XDPoS.V2.BuildConfigIndex() + index := TestXDPoSMockChainConfig.XDPoS.V2.ConfigIndex() expected := []uint64{899, 10, 0} assert.Equal(t, expected, index) }