@ -36,209 +36,215 @@ var once sync.Once
var (
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = & ChainConfig {
ChainID : MainnetChainID ,
EthCompatibleChainID : EthMainnetShard0ChainID ,
EthCompatibleShard0ChainID : EthMainnetShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 442 ) , // Around Thursday Feb 4th 2020, 10AM PST
CrossTxEpoch : big . NewInt ( 28 ) ,
CrossLinkEpoch : big . NewInt ( 186 ) ,
AggregatedRewardEpoch : big . NewInt ( 689 ) , // Around Wed Sept 15th 2021 with 3.5s block time
StakingEpoch : big . NewInt ( 186 ) ,
PreStakingEpoch : big . NewInt ( 185 ) ,
QuickUnlockEpoch : big . NewInt ( 191 ) ,
FiveSecondsEpoch : big . NewInt ( 230 ) ,
TwoSecondsEpoch : big . NewInt ( 366 ) , // Around Tuesday Dec 8th 2020, 8AM PST
SixtyPercentEpoch : big . NewInt ( 530 ) , // Around Monday Apr 12th 2021, 22:30 UTC
RedelegationEpoch : big . NewInt ( 290 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 530 ) , // Around Monday Apr 12th 2021, 22:30 UTC
VRFEpoch : big . NewInt ( 631 ) , // Around Wed July 7th 2021
PrevVRFEpoch : big . NewInt ( 689 ) , // Around Wed Sept 15th 2021 with 3.5s block time
MinDelegation100Epoch : big . NewInt ( 631 ) , // Around Wed July 7th 2021
MinCommissionRateEpoch : big . NewInt ( 631 ) , // Around Wed July 7th 2021
MinCommissionPromoPeriod : big . NewInt ( 100 ) ,
EPoSBound35Epoch : big . NewInt ( 631 ) , // Around Wed July 7th 2021
EIP155Epoch : big . NewInt ( 28 ) ,
S3Epoch : big . NewInt ( 28 ) ,
DataCopyFixEpoch : big . NewInt ( 689 ) , // Around Wed Sept 15th 2021 with 3.5s block time
IstanbulEpoch : big . NewInt ( 314 ) ,
ReceiptLogEpoch : big . NewInt ( 101 ) ,
SHA3Epoch : big . NewInt ( 725 ) , // Around Mon Oct 11 2021, 19:00 UTC
HIP6And8Epoch : big . NewInt ( 725 ) , // Around Mon Oct 11 2021, 19:00 UTC
StakingPrecompileEpoch : big . NewInt ( 871 ) , // Around Tue Feb 11 2022
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
ChainID : MainnetChainID ,
EthCompatibleChainID : EthMainnetShard0ChainID ,
EthCompatibleShard0ChainID : EthMainnetShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 442 ) , // Around Thursday Feb 4th 2020, 10AM PST
CrossTxEpoch : big . NewInt ( 28 ) ,
CrossLinkEpoch : big . NewInt ( 186 ) ,
AggregatedRewardEpoch : big . NewInt ( 689 ) , // Around Wed Sept 15th 2021 with 3.5s block time
StakingEpoch : big . NewInt ( 186 ) ,
PreStakingEpoch : big . NewInt ( 185 ) ,
QuickUnlockEpoch : big . NewInt ( 191 ) ,
FiveSecondsEpoch : big . NewInt ( 230 ) ,
TwoSecondsEpoch : big . NewInt ( 366 ) , // Around Tuesday Dec 8th 2020, 8AM PST
SixtyPercentEpoch : big . NewInt ( 530 ) , // Around Monday Apr 12th 2021, 22:30 UTC
RedelegationEpoch : big . NewInt ( 290 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 530 ) , // Around Monday Apr 12th 2021, 22:30 UTC
VRFEpoch : big . NewInt ( 631 ) , // Around Wed July 7th 2021
PrevVRFEpoch : big . NewInt ( 689 ) , // Around Wed Sept 15th 2021 with 3.5s block time
MinDelegation100Epoch : big . NewInt ( 631 ) , // Around Wed July 7th 2021
MinCommissionRateEpoch : big . NewInt ( 631 ) , // Around Wed July 7th 2021
MinCommissionPromoPeriod : big . NewInt ( 100 ) ,
EPoSBound35Epoch : big . NewInt ( 631 ) , // Around Wed July 7th 2021
EIP155Epoch : big . NewInt ( 28 ) ,
S3Epoch : big . NewInt ( 28 ) ,
DataCopyFixEpoch : big . NewInt ( 689 ) , // Around Wed Sept 15th 2021 with 3.5s block time
IstanbulEpoch : big . NewInt ( 314 ) ,
ReceiptLogEpoch : big . NewInt ( 101 ) ,
SHA3Epoch : big . NewInt ( 725 ) , // Around Mon Oct 11 2021, 19:00 UTC
HIP6And8Epoch : big . NewInt ( 725 ) , // Around Mon Oct 11 2021, 19:00 UTC
StakingPrecompileEpoch : big . NewInt ( 871 ) , // Around Tue Feb 11 2022
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
CrossShardXferPrecompileEpoch : EpochTBD ,
}
// TestnetChainConfig contains the chain parameters to run a node on the harmony test network.
TestnetChainConfig = & ChainConfig {
ChainID : TestnetChainID ,
EthCompatibleChainID : EthTestnetShard0ChainID ,
EthCompatibleShard0ChainID : EthTestnetShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 73290 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 74275 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 16500 ) ,
TwoSecondsEpoch : big . NewInt ( 73000 ) ,
SixtyPercentEpoch : big . NewInt ( 73282 ) ,
RedelegationEpoch : big . NewInt ( 36500 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 73580 ) ,
VRFEpoch : big . NewInt ( 73880 ) ,
PrevVRFEpoch : big . NewInt ( 74384 ) ,
MinDelegation100Epoch : big . NewInt ( 73880 ) ,
MinCommissionRateEpoch : big . NewInt ( 73880 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 73880 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 74412 ) ,
IstanbulEpoch : big . NewInt ( 43800 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 74570 ) ,
HIP6And8Epoch : big . NewInt ( 74570 ) ,
StakingPrecompileEpoch : big . NewInt ( 75175 ) ,
SlotsLimitedEpoch : big . NewInt ( 75684 ) , // epoch to enable HIP-16, around Mon, 02 May 2022 08:18:45 UTC with 2s block time
ChainID : TestnetChainID ,
EthCompatibleChainID : EthTestnetShard0ChainID ,
EthCompatibleShard0ChainID : EthTestnetShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 73290 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 74275 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 16500 ) ,
TwoSecondsEpoch : big . NewInt ( 73000 ) ,
SixtyPercentEpoch : big . NewInt ( 73282 ) ,
RedelegationEpoch : big . NewInt ( 36500 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 73580 ) ,
VRFEpoch : big . NewInt ( 73880 ) ,
PrevVRFEpoch : big . NewInt ( 74384 ) ,
MinDelegation100Epoch : big . NewInt ( 73880 ) ,
MinCommissionRateEpoch : big . NewInt ( 73880 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 73880 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 74412 ) ,
IstanbulEpoch : big . NewInt ( 43800 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 74570 ) ,
HIP6And8Epoch : big . NewInt ( 74570 ) ,
StakingPrecompileEpoch : big . NewInt ( 75175 ) ,
SlotsLimitedEpoch : big . NewInt ( 75684 ) , // epoch to enable HIP-16, around Mon, 02 May 2022 08:18:45 UTC with 2s block time
CrossShardXferPrecompileEpoch : EpochTBD ,
}
// PangaeaChainConfig contains the chain parameters for the Pangaea network.
// All features except for CrossLink are enabled at launch.
PangaeaChainConfig = & ChainConfig {
ChainID : PangaeaChainID ,
EthCompatibleChainID : EthPangaeaShard0ChainID ,
EthCompatibleShard0ChainID : EthPangaeaShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 3 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
TwoSecondsEpoch : big . NewInt ( 0 ) ,
SixtyPercentEpoch : big . NewInt ( 0 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 0 ) ,
VRFEpoch : big . NewInt ( 0 ) ,
PrevVRFEpoch : big . NewInt ( 0 ) ,
MinDelegation100Epoch : big . NewInt ( 0 ) ,
MinCommissionRateEpoch : big . NewInt ( 0 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 0 ) ,
IstanbulEpoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 0 ) ,
HIP6And8Epoch : big . NewInt ( 0 ) ,
StakingPrecompileEpoch : big . NewInt ( 2 ) , // same as staking
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
ChainID : PangaeaChainID ,
EthCompatibleChainID : EthPangaeaShard0ChainID ,
EthCompatibleShard0ChainID : EthPangaeaShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 3 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
TwoSecondsEpoch : big . NewInt ( 0 ) ,
SixtyPercentEpoch : big . NewInt ( 0 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 0 ) ,
VRFEpoch : big . NewInt ( 0 ) ,
PrevVRFEpoch : big . NewInt ( 0 ) ,
MinDelegation100Epoch : big . NewInt ( 0 ) ,
MinCommissionRateEpoch : big . NewInt ( 0 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 0 ) ,
IstanbulEpoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 0 ) ,
HIP6And8Epoch : big . NewInt ( 0 ) ,
StakingPrecompileEpoch : big . NewInt ( 2 ) , // same as staking
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
CrossShardXferPrecompileEpoch : big . NewInt ( 1 ) , // cross tx + 1
}
// PartnerChainConfig contains the chain parameters for the Partner network.
// All features except for CrossLink are enabled at launch.
PartnerChainConfig = & ChainConfig {
ChainID : PartnerChainID ,
EthCompatibleChainID : EthPartnerShard0ChainID ,
EthCompatibleShard0ChainID : EthPartnerShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 3 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
TwoSecondsEpoch : big . NewInt ( 0 ) ,
SixtyPercentEpoch : big . NewInt ( 4 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 0 ) ,
VRFEpoch : big . NewInt ( 0 ) ,
PrevVRFEpoch : big . NewInt ( 0 ) ,
MinDelegation100Epoch : big . NewInt ( 0 ) ,
MinCommissionRateEpoch : big . NewInt ( 0 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 0 ) ,
IstanbulEpoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 0 ) ,
HIP6And8Epoch : big . NewInt ( 0 ) ,
StakingPrecompileEpoch : big . NewInt ( 2 ) ,
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
ChainID : PartnerChainID ,
EthCompatibleChainID : EthPartnerShard0ChainID ,
EthCompatibleShard0ChainID : EthPartnerShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 3 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
TwoSecondsEpoch : big . NewInt ( 0 ) ,
SixtyPercentEpoch : big . NewInt ( 4 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 0 ) ,
VRFEpoch : big . NewInt ( 0 ) ,
PrevVRFEpoch : big . NewInt ( 0 ) ,
MinDelegation100Epoch : big . NewInt ( 0 ) ,
MinCommissionRateEpoch : big . NewInt ( 0 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 0 ) ,
IstanbulEpoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 0 ) ,
HIP6And8Epoch : big . NewInt ( 0 ) ,
StakingPrecompileEpoch : big . NewInt ( 2 ) ,
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
CrossShardXferPrecompileEpoch : big . NewInt ( 1 ) , // cross tx + 1
}
// StressnetChainConfig contains the chain parameters for the Stress test network.
// All features except for CrossLink are enabled at launch.
StressnetChainConfig = & ChainConfig {
ChainID : StressnetChainID ,
EthCompatibleChainID : EthStressnetShard0ChainID ,
EthCompatibleShard0ChainID : EthStressnetShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 3 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
TwoSecondsEpoch : big . NewInt ( 0 ) ,
SixtyPercentEpoch : big . NewInt ( 10 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 0 ) ,
VRFEpoch : big . NewInt ( 0 ) ,
PrevVRFEpoch : big . NewInt ( 0 ) ,
MinDelegation100Epoch : big . NewInt ( 0 ) ,
MinCommissionRateEpoch : big . NewInt ( 0 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 0 ) ,
IstanbulEpoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 0 ) ,
HIP6And8Epoch : big . NewInt ( 0 ) ,
StakingPrecompileEpoch : big . NewInt ( 2 ) ,
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
ChainID : StressnetChainID ,
EthCompatibleChainID : EthStressnetShard0ChainID ,
EthCompatibleShard0ChainID : EthStressnetShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 3 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 1 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
TwoSecondsEpoch : big . NewInt ( 0 ) ,
SixtyPercentEpoch : big . NewInt ( 10 ) ,
RedelegationEpoch : big . NewInt ( 0 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 0 ) ,
VRFEpoch : big . NewInt ( 0 ) ,
PrevVRFEpoch : big . NewInt ( 0 ) ,
MinDelegation100Epoch : big . NewInt ( 0 ) ,
MinCommissionRateEpoch : big . NewInt ( 0 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 0 ) ,
IstanbulEpoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 0 ) ,
HIP6And8Epoch : big . NewInt ( 0 ) ,
StakingPrecompileEpoch : big . NewInt ( 2 ) ,
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
CrossShardXferPrecompileEpoch : big . NewInt ( 1 ) , // cross tx + 1
}
// LocalnetChainConfig contains the chain parameters to run for local development.
LocalnetChainConfig = & ChainConfig {
ChainID : TestnetChainID ,
EthCompatibleChainID : EthTestnetShard0ChainID ,
EthCompatibleShard0ChainID : EthTestnetShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 3 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 0 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
TwoSecondsEpoch : big . NewInt ( 3 ) ,
SixtyPercentEpoch : EpochTBD , // Never enable it for localnet as localnet has no external validator setup
RedelegationEpoch : big . NewInt ( 0 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 0 ) ,
VRFEpoch : big . NewInt ( 0 ) ,
PrevVRFEpoch : big . NewInt ( 0 ) ,
MinDelegation100Epoch : big . NewInt ( 0 ) ,
MinCommissionRateEpoch : big . NewInt ( 0 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 0 ) ,
IstanbulEpoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 0 ) ,
HIP6And8Epoch : EpochTBD , // Never enable it for localnet as localnet has no external validator setup
StakingPrecompileEpoch : big . NewInt ( 2 ) ,
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
ChainID : TestnetChainID ,
EthCompatibleChainID : EthTestnetShard0ChainID ,
EthCompatibleShard0ChainID : EthTestnetShard0ChainID ,
EthCompatibleEpoch : big . NewInt ( 0 ) ,
CrossTxEpoch : big . NewInt ( 0 ) ,
CrossLinkEpoch : big . NewInt ( 2 ) ,
AggregatedRewardEpoch : big . NewInt ( 3 ) ,
StakingEpoch : big . NewInt ( 2 ) ,
PreStakingEpoch : big . NewInt ( 0 ) ,
QuickUnlockEpoch : big . NewInt ( 0 ) ,
FiveSecondsEpoch : big . NewInt ( 0 ) ,
TwoSecondsEpoch : big . NewInt ( 3 ) ,
SixtyPercentEpoch : EpochTBD , // Never enable it for localnet as localnet has no external validator setup
RedelegationEpoch : big . NewInt ( 0 ) ,
NoEarlyUnlockEpoch : big . NewInt ( 0 ) ,
VRFEpoch : big . NewInt ( 0 ) ,
PrevVRFEpoch : big . NewInt ( 0 ) ,
MinDelegation100Epoch : big . NewInt ( 0 ) ,
MinCommissionRateEpoch : big . NewInt ( 0 ) ,
MinCommissionPromoPeriod : big . NewInt ( 10 ) ,
EPoSBound35Epoch : big . NewInt ( 0 ) ,
EIP155Epoch : big . NewInt ( 0 ) ,
S3Epoch : big . NewInt ( 0 ) ,
DataCopyFixEpoch : big . NewInt ( 0 ) ,
IstanbulEpoch : big . NewInt ( 0 ) ,
ReceiptLogEpoch : big . NewInt ( 0 ) ,
SHA3Epoch : big . NewInt ( 0 ) ,
HIP6And8Epoch : EpochTBD , // Never enable it for localnet as localnet has no external validator setup
StakingPrecompileEpoch : big . NewInt ( 2 ) ,
SlotsLimitedEpoch : EpochTBD , // epoch to enable HIP-16
CrossShardXferPrecompileEpoch : big . NewInt ( 1 ) , // cross tx + 1
}
// AllProtocolChanges ...
@ -275,6 +281,7 @@ var (
big . NewInt ( 0 ) , // HIP6And8Epoch
big . NewInt ( 0 ) , // StakingPrecompileEpoch
big . NewInt ( 0 ) , // SlotsLimitedEpoch
big . NewInt ( 1 ) , // CrossShardXferPrecompileEpoch
}
// TestChainConfig ...
@ -311,6 +318,7 @@ var (
big . NewInt ( 0 ) , // HIP6And8Epoch
big . NewInt ( 0 ) , // StakingPrecompileEpoch
big . NewInt ( 0 ) , // SlotsLimitedEpoch
big . NewInt ( 1 ) , // CrossShardXferPrecompileEpoch
}
// TestRules ...
@ -431,11 +439,14 @@ type ChainConfig struct {
// SlotsLimitedEpoch is the first epoch to enable HIP-16.
SlotsLimitedEpoch * big . Int ` json:"slots-limit-epoch,omitempty" `
// CrossShardXferPrecompileEpoch is the first epoch to feature cross shard transfer precompile
CrossShardXferPrecompileEpoch * big . Int ` json:"cross-shard-xfer-precompile-epoch,omitempty" `
}
// String implements the fmt.Stringer interface.
func ( c * ChainConfig ) String ( ) string {
return fmt . Sprintf ( "{ChainID: %v EthCompatibleChainID: %v EIP155: %v CrossTx: %v Staking: %v CrossLink: %v ReceiptLog: %v SHA3Epoch: %v StakingPrecompileEpoch: %v}" ,
return fmt . Sprintf ( "{ChainID: %v EthCompatibleChainID: %v EIP155: %v CrossTx: %v Staking: %v CrossLink: %v ReceiptLog: %v SHA3Epoch: %v StakingPrecompileEpoch: %v CrossShardXferPrecompileEpoch: %v }" ,
c . ChainID ,
c . EthCompatibleChainID ,
c . EIP155Epoch ,
@ -445,6 +456,7 @@ func (c *ChainConfig) String() string {
c . ReceiptLogEpoch ,
c . SHA3Epoch ,
c . StakingPrecompileEpoch ,
c . CrossShardXferPrecompileEpoch ,
)
}
@ -596,6 +608,12 @@ func (c *ChainConfig) IsStakingPrecompile(epoch *big.Int) bool {
return isForked ( c . StakingPrecompileEpoch , epoch )
}
// IsCrossShardXferPrecompile determines whether the
// Cross Shard Transfer Precompile is available in the EVM
func ( c * ChainConfig ) IsCrossShardXferPrecompile ( epoch * big . Int ) bool {
return isForked ( c . CrossShardXferPrecompileEpoch , epoch )
}
// UpdateEthChainIDByShard update the ethChainID based on shard ID.
func UpdateEthChainIDByShard ( shardID uint32 ) {
once . Do ( func ( ) {
@ -644,16 +662,22 @@ func isForked(s, epoch *big.Int) bool {
// Rules is a one time interface meaning that it shouldn't be used in between transition
// phases.
type Rules struct {
ChainID * big . Int
EthChainID * big . Int
IsCrossLink , IsEIP155 , IsS3 , IsReceiptLog , IsIstanbul , IsVRF , IsPrevVRF , IsSHA3 , IsStakingPrecompile bool
ChainID * big . Int
EthChainID * big . Int
IsCrossLink , IsEIP155 , IsS3 , IsReceiptLog , IsIstanbul , IsVRF , IsPrevVRF , IsSHA3 ,
IsStakingPrecompile , IsCrossShardXferPrecompile bool
}
// Rules ensures c's ChainID is not nil.
func ( c * ChainConfig ) Rules ( epoch * big . Int ) Rules {
if c . IsStakingPrecompile ( epoch ) {
if ! c . IsPreStaking ( epoch ) {
panic ( "Cannot have staking precompile epoch if not prestaking epoch" )
panic ( "cannot have staking precompile epoch if not prestaking epoch" )
}
}
if c . IsCrossShardXferPrecompile ( epoch ) {
if ! c . AcceptsCrossTx ( epoch ) {
panic ( "cannot have cross shard xfer precompile epoch if not accepting cross tx" )
}
}
chainID := c . ChainID
@ -665,16 +689,17 @@ func (c *ChainConfig) Rules(epoch *big.Int) Rules {
ethChainID = new ( big . Int )
}
return Rules {
ChainID : new ( big . Int ) . Set ( chainID ) ,
EthChainID : new ( big . Int ) . Set ( ethChainID ) ,
IsCrossLink : c . IsCrossLink ( epoch ) ,
IsEIP155 : c . IsEIP155 ( epoch ) ,
IsS3 : c . IsS3 ( epoch ) ,
IsReceiptLog : c . IsReceiptLog ( epoch ) ,
IsIstanbul : c . IsIstanbul ( epoch ) ,
IsVRF : c . IsVRF ( epoch ) ,
IsPrevVRF : c . IsPrevVRF ( epoch ) ,
IsSHA3 : c . IsSHA3 ( epoch ) ,
IsStakingPrecompile : c . IsStakingPrecompile ( epoch ) ,
ChainID : new ( big . Int ) . Set ( chainID ) ,
EthChainID : new ( big . Int ) . Set ( ethChainID ) ,
IsCrossLink : c . IsCrossLink ( epoch ) ,
IsEIP155 : c . IsEIP155 ( epoch ) ,
IsS3 : c . IsS3 ( epoch ) ,
IsReceiptLog : c . IsReceiptLog ( epoch ) ,
IsIstanbul : c . IsIstanbul ( epoch ) ,
IsVRF : c . IsVRF ( epoch ) ,
IsPrevVRF : c . IsPrevVRF ( epoch ) ,
IsSHA3 : c . IsSHA3 ( epoch ) ,
IsStakingPrecompile : c . IsStakingPrecompile ( epoch ) ,
IsCrossShardXferPrecompile : c . IsCrossShardXferPrecompile ( epoch ) ,
}
}