Compare commits

...

1 Commits

Author SHA1 Message Date
Casey Gardiner 3b5aefd775 initial commit of 1 second finality 11 months ago
  1. 6
      consensus/consensus_service.go
  2. 4
      internal/chain/reward.go
  3. 14
      internal/configs/sharding/localnet.go
  4. 18
      internal/configs/sharding/localnet_test.go
  5. 18
      internal/configs/sharding/mainnet.go
  6. 14
      internal/configs/sharding/testnet.go
  7. 26
      internal/params/config.go

@ -326,9 +326,9 @@ func (consensus *Consensus) updateConsensusInformation() Mode {
consensus.BlockPeriod = 5 * time.Second consensus.BlockPeriod = 5 * time.Second
// Enable 2s block time at the twoSecondsEpoch // Enable 1s block time at the oneSecondsEpoch
if consensus.Blockchain().Config().IsTwoSeconds(nextEpoch) { if consensus.Blockchain().Config().IsOneSecond(nextEpoch) {
consensus.BlockPeriod = 2 * time.Second consensus.BlockPeriod = 1 * time.Second
} }
isFirstTimeStaking := consensus.Blockchain().Config().IsStaking(nextEpoch) && isFirstTimeStaking := consensus.Blockchain().Config().IsStaking(nextEpoch) &&

@ -219,14 +219,14 @@ func getDefaultStakingReward(bc engine.ChainReader, epoch *big.Int, blockNum uin
} }
} }
} }
if bc.Config().IsTwoSeconds(epoch) { if bc.Config().IsOneSecond(epoch) {
defaultReward = stakingReward.TwoSecStakedBlocks defaultReward = stakingReward.TwoSecStakedBlocks
} }
} else { } else {
// Mainnet (other nets): // Mainnet (other nets):
if bc.Config().IsHIP30(epoch) { if bc.Config().IsHIP30(epoch) {
defaultReward = stakingReward.HIP30StakedBlocks defaultReward = stakingReward.HIP30StakedBlocks
} else if bc.Config().IsTwoSeconds(epoch) { } else if bc.Config().IsOneSecond(epoch) {
defaultReward = stakingReward.TwoSecStakedBlocks defaultReward = stakingReward.TwoSecStakedBlocks
} else if bc.Config().IsFiveSeconds(epoch) { } else if bc.Config().IsFiveSeconds(epoch) {
defaultReward = stakingReward.FiveSecStakedBlocks defaultReward = stakingReward.FiveSecStakedBlocks

@ -45,7 +45,7 @@ func (ls localnetSchedule) InstanceForEpoch(epoch *big.Int) Instance {
return localnetV3_2 return localnetV3_2
case params.LocalnetChainConfig.IsSixtyPercent(epoch): case params.LocalnetChainConfig.IsSixtyPercent(epoch):
return localnetV3_1 return localnetV3_1
case params.LocalnetChainConfig.IsTwoSeconds(epoch): case params.LocalnetChainConfig.IsOneSecond(epoch):
return localnetV3 return localnetV3
case params.LocalnetChainConfig.IsStaking(epoch): case params.LocalnetChainConfig.IsStaking(epoch):
return localnetV2 return localnetV2
@ -65,10 +65,10 @@ func (ls localnetSchedule) BlocksPerEpoch() uint64 {
} }
func (ls localnetSchedule) twoSecondsFirstBlock() uint64 { func (ls localnetSchedule) twoSecondsFirstBlock() uint64 {
if params.LocalnetChainConfig.TwoSecondsEpoch.Uint64() == 0 { if params.LocalnetChainConfig.oneSecondsEpoch.Uint64() == 0 {
return 0 return 0
} }
return (params.LocalnetChainConfig.TwoSecondsEpoch.Uint64()-1)*ls.BlocksPerEpochOld() + localnetEpochBlock1 return (params.LocalnetChainConfig.oneSecondsEpoch.Uint64()-1)*ls.BlocksPerEpochOld() + localnetEpochBlock1
} }
func (ls localnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int { func (ls localnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int {
@ -84,7 +84,7 @@ func (ls localnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int {
blockNum -= localnetEpochBlock1 blockNum -= localnetEpochBlock1
extra = 1 extra = 1
} }
return big.NewInt(int64(extra + (blockNum-firstBlock2s)/ls.BlocksPerEpoch() + params.LocalnetChainConfig.TwoSecondsEpoch.Uint64())) return big.NewInt(int64(extra + (blockNum-firstBlock2s)/ls.BlocksPerEpoch() + params.LocalnetChainConfig.oneSecondsEpoch.Uint64()))
} }
} }
@ -115,10 +115,10 @@ func (ls localnetSchedule) EpochLastBlock(epochNum uint64) uint64 {
return localnetEpochBlock1 - 1 return localnetEpochBlock1 - 1
default: default:
switch { switch {
case params.LocalnetChainConfig.IsTwoSeconds(big.NewInt(int64(epochNum))): case params.LocalnetChainConfig.IsOneSecond(big.NewInt(int64(epochNum))):
blocks := ls.BlocksPerEpoch() blocks := ls.BlocksPerEpoch()
firstBlock2s := ls.twoSecondsFirstBlock() firstBlock2s := ls.twoSecondsFirstBlock()
block2s := (1 + epochNum - params.LocalnetChainConfig.TwoSecondsEpoch.Uint64()) * blocks block2s := (1 + epochNum - params.LocalnetChainConfig.oneSecondsEpoch.Uint64()) * blocks
if firstBlock2s == 0 { if firstBlock2s == 0 {
return block2s - blocks + localnetEpochBlock1 - 1 return block2s - blocks + localnetEpochBlock1 - 1
} }
@ -159,7 +159,7 @@ func (ls localnetSchedule) IsSkippedEpoch(shardID uint32, epoch *big.Int) bool {
var ( var (
localnetReshardingEpoch = []*big.Int{ localnetReshardingEpoch = []*big.Int{
big.NewInt(0), big.NewInt(localnetV1Epoch), params.LocalnetChainConfig.StakingEpoch, params.LocalnetChainConfig.TwoSecondsEpoch, big.NewInt(0), big.NewInt(localnetV1Epoch), params.LocalnetChainConfig.StakingEpoch, params.LocalnetChainConfig.oneSecondsEpoch,
} }
// Number of shards, how many slots on each , how many slots owned by Harmony // Number of shards, how many slots on each , how many slots owned by Harmony
localnetV0 = MustNewInstance( localnetV0 = MustNewInstance(

@ -10,10 +10,10 @@ import (
func TestLocalnetEpochCalculation(t *testing.T) { func TestLocalnetEpochCalculation(t *testing.T) {
check := func(epoch, expected uint64) { check := func(epoch, expected uint64) {
if got := LocalnetSchedule.EpochLastBlock(epoch); got != expected { if got := LocalnetSchedule.EpochLastBlock(epoch); got != expected {
t.Fatalf("wrong EpochLastBlock at epoch %d. TwoSecondsEpoch: %s. expected: %d got: %d.", epoch, params.LocalnetChainConfig.TwoSecondsEpoch.String(), expected, got) t.Fatalf("wrong EpochLastBlock at epoch %d. oneSecondsEpoch: %s. expected: %d got: %d.", epoch, params.LocalnetChainConfig.oneSecondsEpoch.String(), expected, got)
} }
if !LocalnetSchedule.IsLastBlock(expected) { if !LocalnetSchedule.IsLastBlock(expected) {
t.Fatalf("%d is not LastBlock. TwoSecondsEpoch: %s", expected, params.LocalnetChainConfig.TwoSecondsEpoch.String()) t.Fatalf("%d is not LastBlock. oneSecondsEpoch: %s", expected, params.LocalnetChainConfig.oneSecondsEpoch.String())
} }
epochStart := uint64(0) epochStart := uint64(0)
if epoch > 0 { if epoch > 0 {
@ -21,30 +21,30 @@ func TestLocalnetEpochCalculation(t *testing.T) {
} }
for blockNo := epochStart; blockNo <= expected; blockNo++ { for blockNo := epochStart; blockNo <= expected; blockNo++ {
if isLastBlock := LocalnetSchedule.IsLastBlock(blockNo); isLastBlock != (blockNo == expected) { if isLastBlock := LocalnetSchedule.IsLastBlock(blockNo); isLastBlock != (blockNo == expected) {
t.Fatalf("IsLastBlock for %d is wrong. TwoSecondsEpoch: %s. expected %v got %v", blockNo, params.LocalnetChainConfig.TwoSecondsEpoch.String(), blockNo == expected, isLastBlock) t.Fatalf("IsLastBlock for %d is wrong. oneSecondsEpoch: %s. expected %v got %v", blockNo, params.LocalnetChainConfig.oneSecondsEpoch.String(), blockNo == expected, isLastBlock)
} }
got := LocalnetSchedule.CalcEpochNumber(blockNo).Uint64() got := LocalnetSchedule.CalcEpochNumber(blockNo).Uint64()
if got != epoch { if got != epoch {
t.Fatalf("CalcEpochNumber for %d is wrong. TwoSecondsEpoch: %s. expected %d got %d", blockNo, params.LocalnetChainConfig.TwoSecondsEpoch.String(), epoch, got) t.Fatalf("CalcEpochNumber for %d is wrong. oneSecondsEpoch: %s. expected %d got %d", blockNo, params.LocalnetChainConfig.oneSecondsEpoch.String(), epoch, got)
} }
} }
} }
backup := params.LocalnetChainConfig.TwoSecondsEpoch backup := params.LocalnetChainConfig.oneSecondsEpoch
params.LocalnetChainConfig.TwoSecondsEpoch = big.NewInt(0) params.LocalnetChainConfig.oneSecondsEpoch = big.NewInt(0)
check(0, localnetEpochBlock1-1) check(0, localnetEpochBlock1-1)
check(1, localnetEpochBlock1+localnetBlocksPerEpochV2-1) check(1, localnetEpochBlock1+localnetBlocksPerEpochV2-1)
check(2, localnetEpochBlock1+localnetBlocksPerEpochV2*2-1) check(2, localnetEpochBlock1+localnetBlocksPerEpochV2*2-1)
params.LocalnetChainConfig.TwoSecondsEpoch = big.NewInt(1) params.LocalnetChainConfig.oneSecondsEpoch = big.NewInt(1)
check(0, localnetEpochBlock1-1) check(0, localnetEpochBlock1-1)
check(1, localnetEpochBlock1+localnetBlocksPerEpochV2-1) check(1, localnetEpochBlock1+localnetBlocksPerEpochV2-1)
check(2, localnetEpochBlock1+localnetBlocksPerEpochV2*2-1) check(2, localnetEpochBlock1+localnetBlocksPerEpochV2*2-1)
params.LocalnetChainConfig.TwoSecondsEpoch = big.NewInt(2) params.LocalnetChainConfig.oneSecondsEpoch = big.NewInt(2)
check(0, localnetEpochBlock1-1) check(0, localnetEpochBlock1-1)
check(1, localnetEpochBlock1+localnetBlocksPerEpoch-1) check(1, localnetEpochBlock1+localnetBlocksPerEpoch-1)
check(2, localnetEpochBlock1+localnetBlocksPerEpoch+localnetBlocksPerEpochV2-1) check(2, localnetEpochBlock1+localnetBlocksPerEpoch+localnetBlocksPerEpochV2-1)
check(3, localnetEpochBlock1+localnetBlocksPerEpoch+localnetBlocksPerEpochV2*2-1) check(3, localnetEpochBlock1+localnetBlocksPerEpoch+localnetBlocksPerEpochV2*2-1)
params.LocalnetChainConfig.TwoSecondsEpoch = backup params.LocalnetChainConfig.oneSecondsEpoch = backup
} }

@ -88,8 +88,8 @@ func (ms mainnetSchedule) InstanceForEpoch(epoch *big.Int) Instance {
// Decrease internal voting power from 68% to 60% // Decrease internal voting power from 68% to 60%
// which happens around 1/27/2021 22:00 PDT // which happens around 1/27/2021 22:00 PDT
return mainnetV3_1 return mainnetV3_1
case params.MainnetChainConfig.IsTwoSeconds(epoch): case params.MainnetChainConfig.IsOneSecond(epoch):
// Enable 2s block time and change blocks/epoch to 32768 // Enable 1s block time and change blocks/epoch to 32768
// which happens around 12/08/2020 08:00 PDT // which happens around 12/08/2020 08:00 PDT
return mainnetV3 return mainnetV3
case epoch.Cmp(big.NewInt(mainnetV2_2Epoch)) >= 0: case epoch.Cmp(big.NewInt(mainnetV2_2Epoch)) >= 0:
@ -143,10 +143,10 @@ func (ms mainnetSchedule) BlocksPerEpoch() uint64 {
} }
func (ms mainnetSchedule) twoSecondsFirstBlock() uint64 { func (ms mainnetSchedule) twoSecondsFirstBlock() uint64 {
if params.MainnetChainConfig.TwoSecondsEpoch.Uint64() == 0 { if params.MainnetChainConfig.oneSecondsEpoch.Uint64() == 0 {
return 0 return 0
} }
return (params.MainnetChainConfig.TwoSecondsEpoch.Uint64()-1)*ms.BlocksPerEpochOld() + mainnetEpochBlock1 return (params.MainnetChainConfig.oneSecondsEpoch.Uint64()-1)*ms.BlocksPerEpochOld() + mainnetEpochBlock1
} }
func (ms mainnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int { func (ms mainnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int {
@ -161,8 +161,8 @@ func (ms mainnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int {
firstBlock2s := ms.twoSecondsFirstBlock() firstBlock2s := ms.twoSecondsFirstBlock()
switch { switch {
case params.MainnetChainConfig.IsTwoSeconds(big.NewInt(oldEpochNumber)): case params.MainnetChainConfig.IsOneSecond(big.NewInt(oldEpochNumber)):
return big.NewInt(int64((blockNum-firstBlock2s)/ms.BlocksPerEpoch() + params.MainnetChainConfig.TwoSecondsEpoch.Uint64())) return big.NewInt(int64((blockNum-firstBlock2s)/ms.BlocksPerEpoch() + params.MainnetChainConfig.oneSecondsEpoch.Uint64()))
default: // genesis default: // genesis
return big.NewInt(int64(oldEpochNumber)) return big.NewInt(int64(oldEpochNumber))
} }
@ -192,8 +192,8 @@ func (ms mainnetSchedule) EpochLastBlock(epochNum uint64) uint64 {
default: default:
firstBlock2s := ms.twoSecondsFirstBlock() firstBlock2s := ms.twoSecondsFirstBlock()
switch { switch {
case params.MainnetChainConfig.IsTwoSeconds(big.NewInt(int64(epochNum))): case params.MainnetChainConfig.IsOneSecond(big.NewInt(int64(epochNum))):
return firstBlock2s - 1 + ms.BlocksPerEpoch()*(epochNum-params.MainnetChainConfig.TwoSecondsEpoch.Uint64()+1) return firstBlock2s - 1 + ms.BlocksPerEpoch()*(epochNum-params.MainnetChainConfig.oneSecondsEpoch.Uint64()+1)
default: // genesis default: // genesis
return mainnetEpochBlock1 - 1 + ms.BlocksPerEpochOld()*epochNum return mainnetEpochBlock1 - 1 + ms.BlocksPerEpochOld()*epochNum
} }
@ -225,7 +225,7 @@ func (ms mainnetSchedule) IsSkippedEpoch(shardID uint32, epoch *big.Int) bool {
return false return false
} }
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), params.MainnetChainConfig.TwoSecondsEpoch, params.MainnetChainConfig.SixtyPercentEpoch, params.MainnetChainConfig.HIP6And8Epoch} 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), params.MainnetChainConfig.oneSecondsEpoch, params.MainnetChainConfig.SixtyPercentEpoch, params.MainnetChainConfig.HIP6And8Epoch}
var ( var (
mainnetV0 = MustNewInstance( mainnetV0 = MustNewInstance(

@ -67,10 +67,10 @@ func (ts testnetSchedule) BlocksPerEpoch() uint64 {
func (ts testnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int { func (ts testnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int {
firstBlock2s := params.TestnetChainConfig.TwoSecondsEpoch.Uint64() * ts.BlocksPerEpochOld() firstBlock2s := params.TestnetChainConfig.oneSecondsEpoch.Uint64() * ts.BlocksPerEpochOld()
switch { switch {
case blockNum >= firstBlock2s: case blockNum >= firstBlock2s:
return big.NewInt(int64((blockNum-firstBlock2s)/ts.BlocksPerEpoch() + params.TestnetChainConfig.TwoSecondsEpoch.Uint64())) return big.NewInt(int64((blockNum-firstBlock2s)/ts.BlocksPerEpoch() + params.TestnetChainConfig.oneSecondsEpoch.Uint64()))
default: // genesis default: // genesis
oldEpoch := blockNum / ts.BlocksPerEpochOld() oldEpoch := blockNum / ts.BlocksPerEpochOld()
return big.NewInt(int64(oldEpoch)) return big.NewInt(int64(oldEpoch))
@ -79,7 +79,7 @@ func (ts testnetSchedule) CalcEpochNumber(blockNum uint64) *big.Int {
} }
func (ts testnetSchedule) IsLastBlock(blockNum uint64) bool { func (ts testnetSchedule) IsLastBlock(blockNum uint64) bool {
firstBlock2s := params.TestnetChainConfig.TwoSecondsEpoch.Uint64() * ts.BlocksPerEpochOld() firstBlock2s := params.TestnetChainConfig.oneSecondsEpoch.Uint64() * ts.BlocksPerEpochOld()
switch { switch {
case blockNum >= firstBlock2s: case blockNum >= firstBlock2s:
@ -90,11 +90,11 @@ func (ts testnetSchedule) IsLastBlock(blockNum uint64) bool {
} }
func (ts testnetSchedule) EpochLastBlock(epochNum uint64) uint64 { func (ts testnetSchedule) EpochLastBlock(epochNum uint64) uint64 {
firstBlock2s := params.TestnetChainConfig.TwoSecondsEpoch.Uint64() * ts.BlocksPerEpochOld() firstBlock2s := params.TestnetChainConfig.oneSecondsEpoch.Uint64() * ts.BlocksPerEpochOld()
switch { switch {
case params.TestnetChainConfig.IsTwoSeconds(big.NewInt(int64(epochNum))): case params.TestnetChainConfig.IsOneSecond(big.NewInt(int64(epochNum))):
return firstBlock2s - 1 + ts.BlocksPerEpoch()*(epochNum-params.TestnetChainConfig.TwoSecondsEpoch.Uint64()+1) return firstBlock2s - 1 + ts.BlocksPerEpoch()*(epochNum-params.TestnetChainConfig.oneSecondsEpoch.Uint64()+1)
default: // genesis default: // genesis
return ts.BlocksPerEpochOld()*(epochNum+1) - 1 return ts.BlocksPerEpochOld()*(epochNum+1) - 1
} }
@ -122,7 +122,7 @@ func (ts testnetSchedule) IsSkippedEpoch(shardID uint32, epoch *big.Int) bool {
var testnetReshardingEpoch = []*big.Int{ var testnetReshardingEpoch = []*big.Int{
big.NewInt(0), big.NewInt(0),
params.TestnetChainConfig.StakingEpoch, params.TestnetChainConfig.StakingEpoch,
params.TestnetChainConfig.TwoSecondsEpoch, params.TestnetChainConfig.oneSecondsEpoch,
} }
var ( var (

@ -47,7 +47,7 @@ var (
PreStakingEpoch: big.NewInt(185), PreStakingEpoch: big.NewInt(185),
QuickUnlockEpoch: big.NewInt(191), QuickUnlockEpoch: big.NewInt(191),
FiveSecondsEpoch: big.NewInt(230), FiveSecondsEpoch: big.NewInt(230),
TwoSecondsEpoch: big.NewInt(366), // Around Tuesday Dec 8th 2020, 8AM PST oneSecondsEpoch: big.NewInt(366), // Around Tuesday Dec 8th 2020, 8AM PST
SixtyPercentEpoch: big.NewInt(530), // Around Monday Apr 12th 2021, 22:30 UTC SixtyPercentEpoch: big.NewInt(530), // Around Monday Apr 12th 2021, 22:30 UTC
RedelegationEpoch: big.NewInt(290), RedelegationEpoch: big.NewInt(290),
NoEarlyUnlockEpoch: big.NewInt(530), // Around Monday Apr 12th 2021, 22:30 UTC NoEarlyUnlockEpoch: big.NewInt(530), // Around Monday Apr 12th 2021, 22:30 UTC
@ -90,7 +90,7 @@ var (
PreStakingEpoch: big.NewInt(1), PreStakingEpoch: big.NewInt(1),
QuickUnlockEpoch: big.NewInt(0), QuickUnlockEpoch: big.NewInt(0),
FiveSecondsEpoch: big.NewInt(0), FiveSecondsEpoch: big.NewInt(0),
TwoSecondsEpoch: big.NewInt(2), oneSecondsEpoch: big.NewInt(2),
SixtyPercentEpoch: big.NewInt(2), SixtyPercentEpoch: big.NewInt(2),
RedelegationEpoch: big.NewInt(2), RedelegationEpoch: big.NewInt(2),
NoEarlyUnlockEpoch: big.NewInt(2), NoEarlyUnlockEpoch: big.NewInt(2),
@ -133,7 +133,7 @@ var (
PreStakingEpoch: big.NewInt(1), PreStakingEpoch: big.NewInt(1),
QuickUnlockEpoch: big.NewInt(0), QuickUnlockEpoch: big.NewInt(0),
FiveSecondsEpoch: big.NewInt(0), FiveSecondsEpoch: big.NewInt(0),
TwoSecondsEpoch: big.NewInt(0), oneSecondsEpoch: big.NewInt(0),
SixtyPercentEpoch: big.NewInt(0), SixtyPercentEpoch: big.NewInt(0),
RedelegationEpoch: big.NewInt(0), RedelegationEpoch: big.NewInt(0),
NoEarlyUnlockEpoch: big.NewInt(0), NoEarlyUnlockEpoch: big.NewInt(0),
@ -177,7 +177,7 @@ var (
PreStakingEpoch: big.NewInt(1), PreStakingEpoch: big.NewInt(1),
QuickUnlockEpoch: big.NewInt(0), QuickUnlockEpoch: big.NewInt(0),
FiveSecondsEpoch: big.NewInt(0), FiveSecondsEpoch: big.NewInt(0),
TwoSecondsEpoch: big.NewInt(0), oneSecondsEpoch: big.NewInt(0),
SixtyPercentEpoch: EpochTBD, SixtyPercentEpoch: EpochTBD,
RedelegationEpoch: big.NewInt(0), RedelegationEpoch: big.NewInt(0),
NoEarlyUnlockEpoch: big.NewInt(0), NoEarlyUnlockEpoch: big.NewInt(0),
@ -221,7 +221,7 @@ var (
PreStakingEpoch: big.NewInt(1), PreStakingEpoch: big.NewInt(1),
QuickUnlockEpoch: big.NewInt(0), QuickUnlockEpoch: big.NewInt(0),
FiveSecondsEpoch: big.NewInt(0), FiveSecondsEpoch: big.NewInt(0),
TwoSecondsEpoch: big.NewInt(0), oneSecondsEpoch: big.NewInt(0),
SixtyPercentEpoch: big.NewInt(10), SixtyPercentEpoch: big.NewInt(10),
RedelegationEpoch: big.NewInt(0), RedelegationEpoch: big.NewInt(0),
NoEarlyUnlockEpoch: big.NewInt(0), NoEarlyUnlockEpoch: big.NewInt(0),
@ -264,7 +264,7 @@ var (
PreStakingEpoch: big.NewInt(0), PreStakingEpoch: big.NewInt(0),
QuickUnlockEpoch: big.NewInt(0), QuickUnlockEpoch: big.NewInt(0),
FiveSecondsEpoch: big.NewInt(0), FiveSecondsEpoch: big.NewInt(0),
TwoSecondsEpoch: big.NewInt(0), oneSecondsEpoch: big.NewInt(0),
SixtyPercentEpoch: EpochTBD, // Never enable it for localnet as localnet has no external validator setup SixtyPercentEpoch: EpochTBD, // Never enable it for localnet as localnet has no external validator setup
RedelegationEpoch: big.NewInt(0), RedelegationEpoch: big.NewInt(0),
NoEarlyUnlockEpoch: big.NewInt(0), NoEarlyUnlockEpoch: big.NewInt(0),
@ -309,7 +309,7 @@ var (
big.NewInt(0), // PreStakingEpoch big.NewInt(0), // PreStakingEpoch
big.NewInt(0), // QuickUnlockEpoch big.NewInt(0), // QuickUnlockEpoch
big.NewInt(0), // FiveSecondsEpoch big.NewInt(0), // FiveSecondsEpoch
big.NewInt(0), // TwoSecondsEpoch big.NewInt(0), // oneSecondsEpoch
big.NewInt(0), // SixtyPercentEpoch big.NewInt(0), // SixtyPercentEpoch
big.NewInt(0), // RedelegationEpoch big.NewInt(0), // RedelegationEpoch
big.NewInt(0), // NoEarlyUnlockEpoch big.NewInt(0), // NoEarlyUnlockEpoch
@ -354,7 +354,7 @@ var (
big.NewInt(0), // PreStakingEpoch big.NewInt(0), // PreStakingEpoch
big.NewInt(0), // QuickUnlockEpoch big.NewInt(0), // QuickUnlockEpoch
big.NewInt(0), // FiveSecondsEpoch big.NewInt(0), // FiveSecondsEpoch
big.NewInt(0), // TwoSecondsEpoch big.NewInt(0), // oneSecondsEpoch
big.NewInt(0), // SixtyPercentEpoch big.NewInt(0), // SixtyPercentEpoch
big.NewInt(0), // RedelegationEpoch big.NewInt(0), // RedelegationEpoch
big.NewInt(0), // NoEarlyUnlockEpoch big.NewInt(0), // NoEarlyUnlockEpoch
@ -452,9 +452,9 @@ type ChainConfig struct {
// and block rewards adjusted to 17.5 ONE/block // and block rewards adjusted to 17.5 ONE/block
FiveSecondsEpoch *big.Int `json:"five-seconds-epoch,omitempty"` FiveSecondsEpoch *big.Int `json:"five-seconds-epoch,omitempty"`
// TwoSecondsEpoch is the epoch when block time is reduced to 2 seconds // oneSecondsEpoch is the epoch when block time is reduced to 2 seconds
// and block rewards adjusted to 7 ONE/block // and block rewards adjusted to 7 ONE/block
TwoSecondsEpoch *big.Int `json:"two-seconds-epoch,omitempty"` oneSecondsEpoch *big.Int `json:"two-seconds-epoch,omitempty"`
// SixtyPercentEpoch is the epoch when internal voting power reduced from 68% to 60% // SixtyPercentEpoch is the epoch when internal voting power reduced from 68% to 60%
SixtyPercentEpoch *big.Int `json:"sixty-percent-epoch,omitempty"` SixtyPercentEpoch *big.Int `json:"sixty-percent-epoch,omitempty"`
@ -664,9 +664,9 @@ func (c *ChainConfig) IsFiveSeconds(epoch *big.Int) bool {
return isForked(c.FiveSecondsEpoch, epoch) return isForked(c.FiveSecondsEpoch, epoch)
} }
// IsTwoSeconds determines whether it is the epoch to change to 3 seconds block time // IsOneSecond determines whether it is the epoch to change to 3 seconds block time
func (c *ChainConfig) IsTwoSeconds(epoch *big.Int) bool { func (c *ChainConfig) IsOneSecond(epoch *big.Int) bool {
return isForked(c.TwoSecondsEpoch, epoch) return isForked(c.oneSecondsEpoch, epoch)
} }
// IsSixtyPercent determines whether it is the epoch to reduce internal voting power to 60% // IsSixtyPercent determines whether it is the epoch to reduce internal voting power to 60%

Loading…
Cancel
Save