From 3706b59008a8c19f622fa249b9a4aae1fd9e1d92 Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Mon, 1 Jun 2020 14:32:53 -0700 Subject: [PATCH] Add epoch transition to increase open slots (#3122) --- internal/configs/sharding/mainnet.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/configs/sharding/mainnet.go b/internal/configs/sharding/mainnet.go index db5923ede..0179e0fcb 100644 --- a/internal/configs/sharding/mainnet.go +++ b/internal/configs/sharding/mainnet.go @@ -29,6 +29,8 @@ const ( mainnetV1_4Epoch = 46 mainnetV1_5Epoch = 54 mainnetV2_0Epoch = 185 // prestaking epoch + mainnetV2_1Epoch = 300 // open slots increase from 320 - 480 (TODO): update the epoch + mainnetV2_2Epoch = 300 // open slots increase from 480 - 640 (TODO): update the epoch // MainNetHTTPPattern is the http pattern for mainnet. MainNetHTTPPattern = "https://api.s%d.t.hmny.io" @@ -43,6 +45,10 @@ type mainnetSchedule struct{} func (mainnetSchedule) InstanceForEpoch(epoch *big.Int) Instance { switch { + case epoch.Cmp(big.NewInt(mainnetV2_2Epoch)) >= 0: + return mainnetV2_2 + case epoch.Cmp(big.NewInt(mainnetV2_1Epoch)) >= 0: + return mainnetV2_1 case epoch.Cmp(big.NewInt(mainnetV2_0Epoch)) >= 0: // 185 resharding epoch (for shard 0) around 14/05/2020 ~15:00 PDT return mainnetV2_0 @@ -141,7 +147,7 @@ func (ms mainnetSchedule) GetShardingStructure(numShard, shardID int) []map[stri return genShardingStructure(numShard, shardID, MainNetHTTPPattern, MainNetWSPattern) } -var mainnetReshardingEpoch = []*big.Int{big.NewInt(0), big.NewInt(mainnetV0_1Epoch), big.NewInt(mainnetV0_2Epoch), big.NewInt(mainnetV0_3Epoch), big.NewInt(mainnetV0_4Epoch), big.NewInt(mainnetV1Epoch), big.NewInt(mainnetV1_1Epoch), big.NewInt(mainnetV1_2Epoch), big.NewInt(mainnetV1_3Epoch), big.NewInt(mainnetV1_4Epoch), big.NewInt(mainnetV1_5Epoch), big.NewInt(mainnetV2_0Epoch)} +var mainnetReshardingEpoch = []*big.Int{big.NewInt(0), big.NewInt(mainnetV0_1Epoch), big.NewInt(mainnetV0_2Epoch), big.NewInt(mainnetV0_3Epoch), big.NewInt(mainnetV0_4Epoch), big.NewInt(mainnetV1Epoch), big.NewInt(mainnetV1_1Epoch), big.NewInt(mainnetV1_2Epoch), big.NewInt(mainnetV1_3Epoch), big.NewInt(mainnetV1_4Epoch), big.NewInt(mainnetV1_5Epoch), big.NewInt(mainnetV2_0Epoch), big.NewInt(mainnetV2_1Epoch), big.NewInt(mainnetV2_2Epoch)} var ( mainnetV0 = MustNewInstance(4, 150, 112, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccounts, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch()) @@ -156,4 +162,6 @@ var ( mainnetV1_4 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_4, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch()) mainnetV1_5 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_5, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch()) mainnetV2_0 = MustNewInstance(4, 250, 170, numeric.MustNewDecFromStr("0.68"), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_5, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch()) + mainnetV2_1 = MustNewInstance(4, 250, 130, numeric.MustNewDecFromStr("0.68"), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_5, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch()) + mainnetV2_2 = MustNewInstance(4, 250, 90, numeric.MustNewDecFromStr("0.68"), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_5, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch()) )