@ -27,40 +27,11 @@ const (
TestNetHTTPPattern = "https://api.s%d.b.hmny.io"
// TestNetWSPattern is the websocket pattern for testnet.
TestNetWSPattern = "wss://ws.s%d.b.hmny.io"
testnetV2Epoch = 6050 // per shard, reduce internal node from 15 to 8, and external nodes from 5 to 22
)
var (
harmonyVotePercentFix = numeric . MustNewDecFromStr ( "0.70" )
// testnet failed to propose the last block of epoch 75893.
// it stopped at 26481646, and last block of epoch 75893 is 26481647.
harmonyVotePercentFixEpoch = big . NewInt ( 75894 )
)
// isForked returns whether a fork scheduled at epoch s is active at the given head epoch.
func isForked ( s , epoch * big . Int ) bool {
if s == nil || epoch == nil {
return false
}
return s . Cmp ( epoch ) <= 0
}
func ( ts testnetSchedule ) InstanceForEpoch ( epoch * big . Int ) Instance {
switch {
case isForked ( harmonyVotePercentFixEpoch , epoch ) :
return testnetV3_4
case params . TestnetChainConfig . IsAllowlistEpoch ( epoch ) :
return testnetV3_3
case params . TestnetChainConfig . IsSlotsLimited ( epoch ) :
return testnetV3_2
case params . TestnetChainConfig . IsSixtyPercent ( epoch ) :
return testnetV3_1
case params . TestnetChainConfig . IsTwoSeconds ( epoch ) :
return testnetV3
case epoch . Cmp ( big . NewInt ( testnetV2Epoch ) ) >= 0 :
return testnetV2
case epoch . Cmp ( params . TestnetChainConfig . StakingEpoch ) >= 0 :
case params . TestnetChainConfig . IsStaking ( epoch ) :
return testnetV1
default : // genesis
return testnetV0
@ -135,11 +106,7 @@ var testnetReshardingEpoch = []*big.Int{
params . TestnetChainConfig . TwoSecondsEpoch ,
}
var testnetV0 = MustNewInstance ( 4 , 16 , 15 , 0 , numeric . OneDec ( ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , emptyAllowlist , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpochOld ( ) )
var testnetV1 = MustNewInstance ( 4 , 20 , 15 , 0 , numeric . MustNewDecFromStr ( "0.90" ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , emptyAllowlist , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpochOld ( ) )
var testnetV2 = MustNewInstance ( 4 , 30 , 8 , 0 , numeric . MustNewDecFromStr ( "0.90" ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , emptyAllowlist , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpochOld ( ) )
var testnetV3 = MustNewInstance ( 4 , 30 , 8 , 0 , numeric . MustNewDecFromStr ( "0.90" ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , emptyAllowlist , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpoch ( ) )
var testnetV3_1 = MustNewInstance ( 4 , 30 , 8 , 0 , numeric . MustNewDecFromStr ( "0.60" ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , emptyAllowlist , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpoch ( ) )
var testnetV3_2 = MustNewInstance ( 4 , 30 , 8 , 0.15 , numeric . MustNewDecFromStr ( "0.60" ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , emptyAllowlist , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpoch ( ) )
var testnetV3_3 = MustNewInstance ( 4 , 30 , 8 , 0.15 , numeric . MustNewDecFromStr ( "0.60" ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , testnetAllowlistV3_3 , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpoch ( ) )
var testnetV3_4 = MustNewInstance ( 4 , 30 , 8 , 0.15 , harmonyVotePercentFix , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , testnetAllowlistV3_3 , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpoch ( ) )
var (
testnetV0 = MustNewInstance ( 4 , 8 , 8 , 0 , numeric . OneDec ( ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , emptyAllowlist , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpoch ( ) )
testnetV1 = MustNewInstance ( 4 , 30 , 8 , 0.15 , numeric . MustNewDecFromStr ( "0.70" ) , genesis . TNHarmonyAccounts , genesis . TNFoundationalAccounts , emptyAllowlist , testnetReshardingEpoch , TestnetSchedule . BlocksPerEpoch ( ) )
)