|
|
@ -25,77 +25,83 @@ 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), |
|
|
|
EIP155Epoch: big.NewInt(28), |
|
|
|
QuickUnlockEpoch: big.NewInt(191), |
|
|
|
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), |
|
|
|
EIP155Epoch: big.NewInt(0), |
|
|
|
QuickUnlockEpoch: big.NewInt(0), |
|
|
|
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), |
|
|
|
EIP155Epoch: big.NewInt(0), |
|
|
|
QuickUnlockEpoch: 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), |
|
|
|
EIP155Epoch: big.NewInt(0), |
|
|
|
QuickUnlockEpoch: 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), |
|
|
|
EIP155Epoch: big.NewInt(0), |
|
|
|
QuickUnlockEpoch: 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), |
|
|
|
EIP155Epoch: big.NewInt(0), |
|
|
|
QuickUnlockEpoch: 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 ...
|
|
|
@ -107,6 +113,7 @@ var ( |
|
|
|
big.NewInt(0), // CrossLinkEpoch
|
|
|
|
big.NewInt(0), // CrossLinkEpoch
|
|
|
|
big.NewInt(0), // StakingEpoch
|
|
|
|
big.NewInt(0), // StakingEpoch
|
|
|
|
big.NewInt(0), // PreStakingEpoch
|
|
|
|
big.NewInt(0), // PreStakingEpoch
|
|
|
|
|
|
|
|
big.NewInt(0), // QuickUnlockEpoch
|
|
|
|
big.NewInt(0), // EIP155Epoch
|
|
|
|
big.NewInt(0), // EIP155Epoch
|
|
|
|
big.NewInt(0), // S3Epoch
|
|
|
|
big.NewInt(0), // S3Epoch
|
|
|
|
big.NewInt(0), // ReceiptLogEpoch
|
|
|
|
big.NewInt(0), // ReceiptLogEpoch
|
|
|
@ -121,6 +128,7 @@ var ( |
|
|
|
big.NewInt(0), // CrossLinkEpoch
|
|
|
|
big.NewInt(0), // CrossLinkEpoch
|
|
|
|
big.NewInt(0), // StakingEpoch
|
|
|
|
big.NewInt(0), // StakingEpoch
|
|
|
|
big.NewInt(0), // PreStakingEpoch
|
|
|
|
big.NewInt(0), // PreStakingEpoch
|
|
|
|
|
|
|
|
big.NewInt(0), // QuickUnlockEpoch
|
|
|
|
big.NewInt(0), // EIP155Epoch
|
|
|
|
big.NewInt(0), // EIP155Epoch
|
|
|
|
big.NewInt(0), // S3Epoch
|
|
|
|
big.NewInt(0), // S3Epoch
|
|
|
|
big.NewInt(0), // ReceiptLogEpoch
|
|
|
|
big.NewInt(0), // ReceiptLogEpoch
|
|
|
@ -165,6 +173,9 @@ type ChainConfig struct { |
|
|
|
// PreStakingEpoch is the epoch we allow staking transactions
|
|
|
|
// PreStakingEpoch is the epoch we allow staking transactions
|
|
|
|
PreStakingEpoch *big.Int `json:"prestaking-epoch,omitempty"` |
|
|
|
PreStakingEpoch *big.Int `json:"prestaking-epoch,omitempty"` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// QuickUnlockEpoch is the epoch when undelegation will be unlocked at the current epoch
|
|
|
|
|
|
|
|
QuickUnlockEpoch *big.Int `json:"quick-unlock-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"` |
|
|
|
|
|
|
|
|
|
|
@ -222,6 +233,11 @@ func (c *ChainConfig) IsPreStaking(epoch *big.Int) bool { |
|
|
|
return isForked(c.PreStakingEpoch, epoch) |
|
|
|
return isForked(c.PreStakingEpoch, epoch) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// IsQuickUnlock determines whether it's the epoch when the undelegation should be unlocked at end of current epoch
|
|
|
|
|
|
|
|
func (c *ChainConfig) IsQuickUnlock(epoch *big.Int) bool { |
|
|
|
|
|
|
|
return isForked(c.QuickUnlockEpoch, epoch) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// IsCrossLink returns whether epoch is either equal to the CrossLink fork epoch or greater.
|
|
|
|
// IsCrossLink returns whether epoch is either equal to the CrossLink fork epoch or greater.
|
|
|
|
func (c *ChainConfig) IsCrossLink(epoch *big.Int) bool { |
|
|
|
func (c *ChainConfig) IsCrossLink(epoch *big.Int) bool { |
|
|
|
return isForked(c.CrossLinkEpoch, epoch) |
|
|
|
return isForked(c.CrossLinkEpoch, epoch) |
|
|
|