@ -25,89 +25,95 @@ var EpochTBD = big.NewInt(10000000)
var (
var (
// MainnetChainConfig is the chain parameters to run a node on the main network.
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = & ChainConfig {
MainnetChainConfig = & ChainConfig {
ChainID : MainnetChainID ,
ChainID : MainnetChainID ,
CrossTxEpoch : big . NewInt ( 28 ) ,
CrossTxEpoch : big . NewInt ( 28 ) ,
CrossLinkEpoch : big . NewInt ( 186 ) ,
CrossLinkEpoch : big . NewInt ( 186 ) ,
StakingEpoch : big . NewInt ( 186 ) ,
StakingEpoch : big . NewInt ( 186 ) ,
PreStakingEpoch : big . NewInt ( 185 ) ,
PreStakingEpoch : big . NewInt ( 185 ) ,
QuickUnlockEpoch : big . NewInt ( 191 ) ,
QuickUnlockEpoch : big . NewInt ( 191 ) ,
FiveSecondsEpoch : big . NewInt ( 230 ) ,
FiveSecondsEpoch : big . NewInt ( 230 ) ,
EIP155Epoch : big . NewInt ( 28 ) ,
RedelegationEpoch : big . NewInt ( 10000000 ) ,
S3Epoch : big . NewInt ( 28 ) ,
EIP155Epoch : big . NewInt ( 28 ) ,
ReceiptLogEpoch : big . NewInt ( 101 ) ,
S3Epoch : big . NewInt ( 28 ) ,
ReceiptLogEpoch : big . NewInt ( 101 ) ,
}
}
// TestnetChainConfig contains the chain parameters to run a node on the harmony test network.
// TestnetChainConfig contains the chain parameters to run a node on the harmony test network.
TestnetChainConfig = & ChainConfig {
TestnetChainConfig = & ChainConfig {
ChainID : TestnetChainID ,
ChainID : TestnetChainID ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 16500 ) ,
FiveSecondsEpoch : big . NewInt ( 16500 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
RedelegationEpoch : big . NewInt ( 10000000 ) ,
S3Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
}
}
// PangaeaChainConfig contains the chain parameters for the Pangaea network.
// PangaeaChainConfig contains the chain parameters for the Pangaea network.
// All features except for CrossLink are enabled at launch.
// All features except for CrossLink are enabled at launch.
PangaeaChainConfig = & ChainConfig {
PangaeaChainConfig = & ChainConfig {
ChainID : PangaeaChainID ,
ChainID : PangaeaChainID ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
}
}
// PartnerChainConfig contains the chain parameters for the Partner network.
// PartnerChainConfig contains the chain parameters for the Partner network.
// All features except for CrossLink are enabled at launch.
// All features except for CrossLink are enabled at launch.
PartnerChainConfig = & ChainConfig {
PartnerChainConfig = & ChainConfig {
ChainID : PartnerChainID ,
ChainID : PartnerChainID ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
}
}
// StressnetChainConfig contains the chain parameters for the Stress test network.
// StressnetChainConfig contains the chain parameters for the Stress test network.
// All features except for CrossLink are enabled at launch.
// All features except for CrossLink are enabled at launch.
StressnetChainConfig = & ChainConfig {
StressnetChainConfig = & ChainConfig {
ChainID : StressnetChainID ,
ChainID : StressnetChainID ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
}
}
// LocalnetChainConfig contains the chain parameters to run for local development.
// LocalnetChainConfig contains the chain parameters to run for local development.
LocalnetChainConfig = & ChainConfig {
LocalnetChainConfig = & ChainConfig {
ChainID : TestnetChainID ,
ChainID : TestnetChainID ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 0 ) ,
PreStakingEpoch : big . NewInt ( 0 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
}
}
// AllProtocolChanges ...
// AllProtocolChanges ...
@ -121,6 +127,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 ) , // RedelegationEpoch
big . NewInt ( 0 ) , // EIP155Epoch
big . NewInt ( 0 ) , // EIP155Epoch
big . NewInt ( 0 ) , // S3Epoch
big . NewInt ( 0 ) , // S3Epoch
big . NewInt ( 0 ) , // ReceiptLogEpoch
big . NewInt ( 0 ) , // ReceiptLogEpoch
@ -137,6 +144,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 ) , // RedelegationEpoch
big . NewInt ( 0 ) , // EIP155Epoch
big . NewInt ( 0 ) , // EIP155Epoch
big . NewInt ( 0 ) , // S3Epoch
big . NewInt ( 0 ) , // S3Epoch
big . NewInt ( 0 ) , // ReceiptLogEpoch
big . NewInt ( 0 ) , // ReceiptLogEpoch
@ -188,6 +196,10 @@ 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" `
// RedelegationEpoch is the epoch when redelegation is supported and undelegation locking time
// is restored to 7 epoch
RedelegationEpoch * big . Int ` json:"redelegation-epoch,omitempty" `
// EIP155 hard fork epoch (include EIP158 too)
// EIP155 hard fork epoch (include EIP158 too)
EIP155Epoch * big . Int ` json:"eip155-epoch,omitempty" `
EIP155Epoch * big . Int ` json:"eip155-epoch,omitempty" `
@ -245,6 +257,11 @@ func (c *ChainConfig) IsFiveSeconds(epoch *big.Int) bool {
return isForked ( c . FiveSecondsEpoch , epoch )
return isForked ( c . FiveSecondsEpoch , epoch )
}
}
// IsRedelegation determines whether it is the epoch to support redelegation
func ( c * ChainConfig ) IsRedelegation ( epoch * big . Int ) bool {
return isForked ( c . RedelegationEpoch , epoch )
}
// IsPreStaking determines whether staking transactions are allowed
// IsPreStaking determines whether staking transactions are allowed
func ( c * ChainConfig ) IsPreStaking ( epoch * big . Int ) bool {
func ( c * ChainConfig ) IsPreStaking ( epoch * big . Int ) bool {
return isForked ( c . PreStakingEpoch , epoch )
return isForked ( c . PreStakingEpoch , epoch )