Cleanup sharding config code and add epoch block change for localnet (#3473)

* Cleanup sharding config and add epoch block change for localnet for better testability

* remove test code
pull/3474/head
Rongjian Lan 4 years ago committed by GitHub
parent 60e42232a9
commit 6782972407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cmd/harmony/main.go
  2. 9
      core/blockchain.go
  3. 5
      internal/configs/sharding/fixedschedule.go
  4. 8
      internal/configs/sharding/instance.go
  5. 66
      internal/configs/sharding/localnet.go
  6. 36
      internal/configs/sharding/mainnet.go
  7. 8
      internal/configs/sharding/pangaea.go
  8. 9
      internal/configs/sharding/partner.go
  9. 5
      internal/configs/sharding/shardingconfig.go
  10. 9
      internal/configs/sharding/stress.go
  11. 13
      internal/configs/sharding/testnet.go
  12. 2
      internal/params/config.go

@ -444,7 +444,7 @@ func nodeconfigSetShardSchedule(config harmonyConfig) {
}
devnetConfig, err := shardingconfig.NewInstance(
uint32(dnConfig.NumShards), dnConfig.ShardSize, dnConfig.HmyNodeSize, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccounts, nil, shardingconfig.VLBPE, shardingconfig.VLBPE)
uint32(dnConfig.NumShards), dnConfig.ShardSize, dnConfig.HmyNodeSize, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccounts, nil, shardingconfig.VLBPE)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "ERROR invalid devnet sharding config: %s",
err)

@ -293,15 +293,6 @@ func IsEpochBlock(block *types.Block) bool {
return shard.Schedule.IsLastBlock(block.NumberU64() - 1)
}
// EpochFirstBlock returns the block number of the first block of an epoch.
// TODO: instead of using fixed epoch schedules, determine the first block by epoch changes.
func EpochFirstBlock(epoch *big.Int) *big.Int {
if epoch.Cmp(big.NewInt(GenesisEpoch)) == 0 {
return big.NewInt(GenesisEpoch)
}
return big.NewInt(int64(shard.Schedule.EpochLastBlock(epoch.Uint64()-1) + 1))
}
func (bc *BlockChain) getProcInterrupt() bool {
return atomic.LoadInt32(&bc.procInterrupt) == 1
}

@ -41,11 +41,6 @@ func (s fixedSchedule) VdfDifficulty() int {
return mainnetVdfDifficulty
}
// ConsensusRatio ratio of new nodes vs consensus total nodes
func (s fixedSchedule) ConsensusRatio() float64 {
return mainnetConsensusRatio
}
// TODO: remove it after randomness feature turned on mainnet
//RandonnessStartingEpoch returns starting epoch of randonness generation
func (s fixedSchedule) RandomnessStartingEpoch() uint64 {

@ -31,7 +31,6 @@ type instance struct {
hmyAccounts []genesis.DeployAccount
fnAccounts []genesis.DeployAccount
reshardingEpoch []*big.Int
blocksPerEpochOld uint64
blocksPerEpoch uint64
}
@ -41,7 +40,7 @@ func NewInstance(
numShards uint32, numNodesPerShard, numHarmonyOperatedNodesPerShard int, harmonyVotePercent numeric.Dec,
hmyAccounts []genesis.DeployAccount,
fnAccounts []genesis.DeployAccount,
reshardingEpoch []*big.Int, blocksEOld uint64, blocksE uint64,
reshardingEpoch []*big.Int, blocksE uint64,
) (Instance, error) {
if numShards < 1 {
return nil, errors.Errorf(
@ -82,7 +81,6 @@ func NewInstance(
hmyAccounts: hmyAccounts,
fnAccounts: fnAccounts,
reshardingEpoch: reshardingEpoch,
blocksPerEpochOld: blocksEOld,
blocksPerEpoch: blocksE,
}, nil
}
@ -96,11 +94,11 @@ func MustNewInstance(
harmonyVotePercent numeric.Dec,
hmyAccounts []genesis.DeployAccount,
fnAccounts []genesis.DeployAccount,
reshardingEpoch []*big.Int, blocksPerEpochOld uint64, blocksPerEpoch uint64,
reshardingEpoch []*big.Int, blocksPerEpoch uint64,
) Instance {
sc, err := NewInstance(
numShards, numNodesPerShard, numHarmonyOperatedNodesPerShard, harmonyVotePercent,
hmyAccounts, fnAccounts, reshardingEpoch, blocksPerEpochOld, blocksPerEpoch,
hmyAccounts, fnAccounts, reshardingEpoch, blocksPerEpoch,
)
if err != nil {
panic(err)

@ -19,18 +19,20 @@ type localnetSchedule struct{}
const (
localnetV1Epoch = 1
localnetEpochBlock1 = 10
localnetBlocksPerEpoch = 5
localnetEpochBlock1 = 10
localnetBlocksPerEpoch = 5
localnetBlocksPerEpochV2 = 10
localnetVdfDifficulty = 5000 // This takes about 10s to finish the vdf
localnetConsensusRatio = float64(0.1)
localnetVdfDifficulty = 5000 // This takes about 10s to finish the vdf
localnetRandomnessStartingEpoch = 0
)
func (ls localnetSchedule) InstanceForEpoch(epoch *big.Int) Instance {
switch {
case epoch.Cmp(params.LocalnetChainConfig.StakingEpoch) >= 0:
case params.LocalnetChainConfig.IsTwoSeconds(epoch):
return localnetV3
case params.LocalnetChainConfig.IsStaking(epoch):
return localnetV2
case epoch.Cmp(big.NewInt(localnetV1Epoch)) >= 0:
return localnetV1
@ -39,39 +41,63 @@ func (ls localnetSchedule) InstanceForEpoch(epoch *big.Int) Instance {
}
}
func (ls localnetSchedule) BlocksPerEpoch() uint64 {
func (ls localnetSchedule) BlocksPerEpochOld() uint64 {
return localnetBlocksPerEpoch
}
func (ls localnetSchedule) BlocksPerEpoch() uint64 {
return localnetBlocksPerEpochV2
}
func (ls localnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int {
blocks := ls.BlocksPerEpoch()
blocks := ls.BlocksPerEpochOld()
var oldEpochNumber uint64
switch {
case blockNum >= localnetEpochBlock1:
return big.NewInt(int64((blockNum-localnetEpochBlock1)/blocks) + 1)
oldEpochNumber = uint64((blockNum-localnetEpochBlock1)/blocks) + 1
default:
return big.NewInt(0)
oldEpochNumber = 0
}
firstBlock2s := params.LocalnetChainConfig.TwoSecondsEpoch.Uint64()*ls.BlocksPerEpochOld() + 5
switch {
case oldEpochNumber >= params.LocalnetChainConfig.TwoSecondsEpoch.Uint64():
return big.NewInt(int64((blockNum-firstBlock2s)/ls.BlocksPerEpoch() + params.LocalnetChainConfig.TwoSecondsEpoch.Uint64()))
default: // genesis
return big.NewInt(int64(oldEpochNumber))
}
}
func (ls localnetSchedule) IsLastBlock(blockNum uint64) bool {
blocks := ls.BlocksPerEpoch()
blocks := ls.BlocksPerEpochOld()
switch {
case blockNum < localnetEpochBlock1-1:
return false
case blockNum == localnetEpochBlock1-1:
return true
default:
return ((blockNum-localnetEpochBlock1)%blocks == blocks-1)
firstBlock2s := params.LocalnetChainConfig.TwoSecondsEpoch.Uint64()*ls.BlocksPerEpochOld() + 5
switch {
case blockNum >= firstBlock2s:
return ((blockNum-firstBlock2s)%ls.BlocksPerEpoch() == ls.BlocksPerEpoch()-1)
default: // genesis
return ((blockNum-localnetEpochBlock1)%blocks == blocks-1)
}
}
}
func (ls localnetSchedule) EpochLastBlock(epochNum uint64) uint64 {
blocks := ls.BlocksPerEpoch()
blocks := ls.BlocksPerEpochOld()
switch {
case epochNum == 0:
return localnetEpochBlock1 - 1
default:
return localnetEpochBlock1 - 1 + blocks*epochNum
firstBlock2s := params.LocalnetChainConfig.TwoSecondsEpoch.Uint64()*ls.BlocksPerEpochOld() + 5
switch {
case params.LocalnetChainConfig.IsTwoSeconds(big.NewInt(int64(epochNum))):
return firstBlock2s - 1 + ls.BlocksPerEpoch()*(epochNum-params.LocalnetChainConfig.TwoSecondsEpoch.Uint64()+1)
default: // genesis
return localnetEpochBlock1 - 1 + blocks*epochNum
}
}
}
@ -79,11 +105,6 @@ func (ls localnetSchedule) VdfDifficulty() int {
return localnetVdfDifficulty
}
// ConsensusRatio ratio of new nodes vs consensus total nodes
func (ls localnetSchedule) ConsensusRatio() float64 {
return localnetConsensusRatio
}
// TODO: remove it after randomness feature turned on mainnet
//RandonnessStartingEpoch returns starting epoch of randonness generation
func (ls localnetSchedule) RandomnessStartingEpoch() uint64 {
@ -115,10 +136,11 @@ func (ls localnetSchedule) IsSkippedEpoch(shardID uint32, epoch *big.Int) bool {
var (
localnetReshardingEpoch = []*big.Int{
big.NewInt(0), big.NewInt(localnetV1Epoch), params.LocalnetChainConfig.StakingEpoch,
big.NewInt(0), big.NewInt(localnetV1Epoch), params.LocalnetChainConfig.StakingEpoch, params.LocalnetChainConfig.TwoSecondsEpoch,
}
// Number of shards, how many slots on each , how many slots owned by Harmony
localnetV0 = MustNewInstance(2, 7, 5, numeric.OneDec(), genesis.LocalHarmonyAccounts, genesis.LocalFnAccounts, localnetReshardingEpoch, LocalnetSchedule.BlocksPerEpoch(), LocalnetSchedule.BlocksPerEpoch())
localnetV1 = MustNewInstance(2, 8, 5, numeric.OneDec(), genesis.LocalHarmonyAccountsV1, genesis.LocalFnAccountsV1, localnetReshardingEpoch, LocalnetSchedule.BlocksPerEpoch(), LocalnetSchedule.BlocksPerEpoch())
localnetV2 = MustNewInstance(2, 9, 6, numeric.MustNewDecFromStr("0.68"), genesis.LocalHarmonyAccountsV2, genesis.LocalFnAccountsV2, localnetReshardingEpoch, LocalnetSchedule.BlocksPerEpoch(), LocalnetSchedule.BlocksPerEpoch())
localnetV0 = MustNewInstance(2, 7, 5, numeric.OneDec(), genesis.LocalHarmonyAccounts, genesis.LocalFnAccounts, localnetReshardingEpoch, LocalnetSchedule.BlocksPerEpochOld())
localnetV1 = MustNewInstance(2, 8, 5, numeric.OneDec(), genesis.LocalHarmonyAccountsV1, genesis.LocalFnAccountsV1, localnetReshardingEpoch, LocalnetSchedule.BlocksPerEpochOld())
localnetV2 = MustNewInstance(2, 9, 6, numeric.MustNewDecFromStr("0.68"), genesis.LocalHarmonyAccountsV2, genesis.LocalFnAccountsV2, localnetReshardingEpoch, LocalnetSchedule.BlocksPerEpochOld())
localnetV3 = MustNewInstance(2, 9, 6, numeric.MustNewDecFromStr("0.68"), genesis.LocalHarmonyAccountsV2, genesis.LocalFnAccountsV2, localnetReshardingEpoch, LocalnetSchedule.BlocksPerEpoch())
)

@ -12,8 +12,7 @@ const (
mainnetEpochBlock1 = 344064 // 21 * 2^14
blocksPerEpoch = 16384 // 2^14
mainnetVdfDifficulty = 50000 // This takes about 100s to finish the vdf
mainnetConsensusRatio = float64(0.1)
mainnetVdfDifficulty = 50000 // This takes about 100s to finish the vdf
// TODO: remove it after randomness feature turned on mainnet
mainnetRandomnessStartingEpoch = 100000
@ -136,11 +135,6 @@ func (ms mainnetSchedule) VdfDifficulty() int {
return mainnetVdfDifficulty
}
// ConsensusRatio ratio of new nodes vs consensus total nodes
func (ms mainnetSchedule) ConsensusRatio() float64 {
return mainnetConsensusRatio
}
// TODO: remove it after randomness feature turned on mainnet
//RandonnessStartingEpoch returns starting epoch of randonness generation
func (ms mainnetSchedule) RandomnessStartingEpoch() uint64 {
@ -171,18 +165,18 @@ func (ms mainnetSchedule) IsSkippedEpoch(shardID uint32, epoch *big.Int) bool {
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(), MainnetSchedule.BlocksPerEpoch())
mainnetV0_1 = MustNewInstance(4, 152, 112, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV0_1, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV0_2 = MustNewInstance(4, 200, 148, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV0_2, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV0_3 = MustNewInstance(4, 210, 148, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV0_3, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV0_4 = MustNewInstance(4, 216, 148, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV0_4, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV1 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV1_1 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_1, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV1_2 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_2, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV1_3 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_3, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV1_4 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_4, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV1_5 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_5, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV2_0 = MustNewInstance(4, 250, 170, numeric.MustNewDecFromStr("0.68"), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_5, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV2_1 = MustNewInstance(4, 250, 130, numeric.MustNewDecFromStr("0.68"), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_5, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV2_2 = MustNewInstance(4, 250, 90, numeric.MustNewDecFromStr("0.68"), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_5, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch(), MainnetSchedule.BlocksPerEpoch())
mainnetV0 = MustNewInstance(4, 150, 112, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccounts, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
mainnetV0_1 = MustNewInstance(4, 152, 112, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV0_1, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
mainnetV0_2 = MustNewInstance(4, 200, 148, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV0_2, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
mainnetV0_3 = MustNewInstance(4, 210, 148, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV0_3, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
mainnetV0_4 = MustNewInstance(4, 216, 148, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV0_4, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
mainnetV1 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
mainnetV1_1 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_1, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
mainnetV1_2 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_2, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
mainnetV1_3 = MustNewInstance(4, 250, 170, numeric.OneDec(), genesis.HarmonyAccounts, genesis.FoundationalNodeAccountsV1_3, mainnetReshardingEpoch, MainnetSchedule.BlocksPerEpoch())
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())
)

@ -56,10 +56,6 @@ func (ps pangaeaSchedule) VdfDifficulty() int {
return pangaeaVdfDifficulty
}
func (ps pangaeaSchedule) ConsensusRatio() float64 {
return mainnetConsensusRatio
}
// TODO: remove it after randomness feature turned on mainnet
//RandonnessStartingEpoch returns starting epoch of randonness generation
func (ps pangaeaSchedule) RandomnessStartingEpoch() uint64 {
@ -85,5 +81,5 @@ var pangaeaReshardingEpoch = []*big.Int{
params.PangaeaChainConfig.StakingEpoch,
}
var pangaeaV0 = MustNewInstance(4, 30, 30, numeric.OneDec(), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, pangaeaReshardingEpoch, PangaeaSchedule.BlocksPerEpoch(), PangaeaSchedule.BlocksPerEpoch())
var pangaeaV1 = MustNewInstance(4, 110, 30, numeric.MustNewDecFromStr("0.68"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, pangaeaReshardingEpoch, PangaeaSchedule.BlocksPerEpoch(), PangaeaSchedule.BlocksPerEpoch())
var pangaeaV0 = MustNewInstance(4, 30, 30, numeric.OneDec(), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, pangaeaReshardingEpoch, PangaeaSchedule.BlocksPerEpoch())
var pangaeaV1 = MustNewInstance(4, 110, 30, numeric.MustNewDecFromStr("0.68"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, pangaeaReshardingEpoch, PangaeaSchedule.BlocksPerEpoch())

@ -57,11 +57,6 @@ func (ps partnerSchedule) VdfDifficulty() int {
return partnerVdfDifficulty
}
// ConsensusRatio ratio of new nodes vs consensus total nodes
func (ps partnerSchedule) ConsensusRatio() float64 {
return mainnetConsensusRatio
}
// TODO: remove it after randomness feature turned on mainnet
//RandonnessStartingEpoch returns starting epoch of randonness generation
func (ps partnerSchedule) RandomnessStartingEpoch() uint64 {
@ -87,5 +82,5 @@ var partnerReshardingEpoch = []*big.Int{
params.TestnetChainConfig.StakingEpoch,
}
var partnerV0 = MustNewInstance(2, 15, 15, numeric.OneDec(), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, partnerReshardingEpoch, PartnerSchedule.BlocksPerEpoch(), PartnerSchedule.BlocksPerEpoch())
var partnerV1 = MustNewInstance(2, 30, 15, numeric.MustNewDecFromStr("0.68"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, partnerReshardingEpoch, PartnerSchedule.BlocksPerEpoch(), PartnerSchedule.BlocksPerEpoch())
var partnerV0 = MustNewInstance(2, 15, 15, numeric.OneDec(), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, partnerReshardingEpoch, PartnerSchedule.BlocksPerEpoch())
var partnerV1 = MustNewInstance(2, 30, 15, numeric.MustNewDecFromStr("0.68"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, partnerReshardingEpoch, PartnerSchedule.BlocksPerEpoch())

@ -20,17 +20,16 @@ type Schedule interface {
CalcEpochNumber(blockNum uint64) *big.Int
// IsLastBlock check if the block is the last block in the epoch
// NOTE: This method is very critical for the epoch transition logic and other checks.
IsLastBlock(blockNum uint64) bool
// EpochLastBlock returns the last block number of an epoch
// NOTE: This method id important for a few rpcs and validator APR calculation
EpochLastBlock(epochNum uint64) uint64
// VDFDifficulty returns number of iterations for VDF calculation
VdfDifficulty() int
// ConsensusRatio ratio of new nodes vs consensus total nodes
ConsensusRatio() float64
// TODO: remove it after randomness feature turned on mainnet
//RandomnessStartingEpoch returns starting epoch of randonness generation
RandomnessStartingEpoch() uint64

@ -57,11 +57,6 @@ func (ss stressnetSchedule) VdfDifficulty() int {
return stressnetVdfDifficulty
}
// ConsensusRatio ratio of new nodes vs consensus total nodes
func (ss stressnetSchedule) ConsensusRatio() float64 {
return mainnetConsensusRatio
}
// TODO: remove it after randomness feature turned on mainnet
//RandonnessStartingEpoch returns starting epoch of randonness generation
func (ss stressnetSchedule) RandomnessStartingEpoch() uint64 {
@ -87,5 +82,5 @@ var stressnetReshardingEpoch = []*big.Int{
params.StressnetChainConfig.StakingEpoch,
}
var stressnetV0 = MustNewInstance(2, 10, 10, numeric.OneDec(), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, stressnetReshardingEpoch, StressNetSchedule.BlocksPerEpoch(), StressNetSchedule.BlocksPerEpoch())
var stressnetV1 = MustNewInstance(2, 30, 10, numeric.MustNewDecFromStr("0.9"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, stressnetReshardingEpoch, StressNetSchedule.BlocksPerEpoch(), StressNetSchedule.BlocksPerEpoch())
var stressnetV0 = MustNewInstance(2, 10, 10, numeric.OneDec(), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, stressnetReshardingEpoch, StressNetSchedule.BlocksPerEpoch())
var stressnetV1 = MustNewInstance(2, 30, 10, numeric.MustNewDecFromStr("0.9"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, stressnetReshardingEpoch, StressNetSchedule.BlocksPerEpoch())

@ -92,11 +92,6 @@ func (ts testnetSchedule) VdfDifficulty() int {
return testnetVdfDifficulty
}
// ConsensusRatio ratio of new nodes vs consensus total nodes
func (ts testnetSchedule) ConsensusRatio() float64 {
return mainnetConsensusRatio
}
// TODO: remove it after randomness feature turned on mainnet
//RandonnessStartingEpoch returns starting epoch of randonness generation
func (ts testnetSchedule) RandomnessStartingEpoch() uint64 {
@ -123,7 +118,7 @@ var testnetReshardingEpoch = []*big.Int{
params.TestnetChainConfig.TwoSecondsEpoch,
}
var testnetV0 = MustNewInstance(4, 16, 15, numeric.OneDec(), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, testnetReshardingEpoch, TestnetSchedule.BlocksPerEpochOld(), TestnetSchedule.BlocksPerEpoch())
var testnetV1 = MustNewInstance(4, 20, 15, numeric.MustNewDecFromStr("0.90"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, testnetReshardingEpoch, TestnetSchedule.BlocksPerEpochOld(), TestnetSchedule.BlocksPerEpoch())
var testnetV2 = MustNewInstance(4, 30, 8, numeric.MustNewDecFromStr("0.90"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, testnetReshardingEpoch, TestnetSchedule.BlocksPerEpochOld(), TestnetSchedule.BlocksPerEpoch())
var testnetV3 = MustNewInstance(4, 30, 8, numeric.MustNewDecFromStr("0.90"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, testnetReshardingEpoch, TestnetSchedule.BlocksPerEpochOld(), TestnetSchedule.BlocksPerEpoch())
var testnetV0 = MustNewInstance(4, 16, 15, numeric.OneDec(), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, testnetReshardingEpoch, TestnetSchedule.BlocksPerEpochOld())
var testnetV1 = MustNewInstance(4, 20, 15, numeric.MustNewDecFromStr("0.90"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, testnetReshardingEpoch, TestnetSchedule.BlocksPerEpochOld())
var testnetV2 = MustNewInstance(4, 30, 8, numeric.MustNewDecFromStr("0.90"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, testnetReshardingEpoch, TestnetSchedule.BlocksPerEpochOld())
var testnetV3 = MustNewInstance(4, 30, 8, numeric.MustNewDecFromStr("0.90"), genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, testnetReshardingEpoch, TestnetSchedule.BlocksPerEpoch())

@ -120,7 +120,7 @@ var (
PreStakingEpoch: big.NewInt(0),
QuickUnlockEpoch: big.NewInt(0),
FiveSecondsEpoch: big.NewInt(0),
TwoSecondsEpoch: big.NewInt(0),
TwoSecondsEpoch: big.NewInt(3),
RedelegationEpoch: big.NewInt(0),
EIP155Epoch: big.NewInt(0),
S3Epoch: big.NewInt(0),

Loading…
Cancel
Save