Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add hardfork to make testnet external #4640

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions internal/configs/sharding/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const (

func (ts testnetSchedule) InstanceForEpoch(epoch *big.Int) Instance {
switch {
case params.TestnetChainConfig.IsTestnetExternalEpoch(epoch):
return testnetV6
case params.TestnetChainConfig.IsHIP30(epoch):
return testnetV5
case params.TestnetChainConfig.IsFeeCollectEpoch(epoch):
Expand Down Expand Up @@ -169,4 +171,12 @@ var (
hip30CollectionAddressTestnet, testnetReshardingEpoch,
TestnetSchedule.BlocksPerEpoch(),
)
testnetV6 = MustNewInstance(
2, 30, 0, 0,
numeric.MustNewDecFromStr("0.0"), genesis.TNHarmonyAccountsV1,
genesis.TNFoundationalAccounts, emptyAllowlist,
feeCollectorsTestnet, numeric.MustNewDecFromStr("0.25"),
hip30CollectionAddressTestnet, testnetReshardingEpoch,
TestnetSchedule.BlocksPerEpoch(),
)
)
14 changes: 14 additions & 0 deletions internal/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ var (
BlockGas30MEpoch: big.NewInt(1673), // 2023-11-02 17:30:00+00:00
MaxRateEpoch: EpochTBD,
DevnetExternalEpoch: EpochTBD,
TestnetExternalEpoch: EpochTBD,
}

// TestnetChainConfig contains the chain parameters to run a node on the harmony test network.
Expand Down Expand Up @@ -122,6 +123,7 @@ var (
BlockGas30MEpoch: big.NewInt(2176), // 2023-10-12 10:00:00+00:00
MaxRateEpoch: EpochTBD,
DevnetExternalEpoch: EpochTBD,
TestnetExternalEpoch: EpochTBD,
}
// PangaeaChainConfig contains the chain parameters for the Pangaea network.
// All features except for CrossLink are enabled at launch.
Expand Down Expand Up @@ -167,6 +169,7 @@ var (
BlockGas30MEpoch: big.NewInt(0),
MaxRateEpoch: EpochTBD,
DevnetExternalEpoch: EpochTBD,
TestnetExternalEpoch: EpochTBD,
}

// PartnerChainConfig contains the chain parameters for the Partner network.
Expand Down Expand Up @@ -212,6 +215,7 @@ var (
HIP30Epoch: big.NewInt(7),
BlockGas30MEpoch: big.NewInt(7),
MaxRateEpoch: EpochTBD,
TestnetExternalEpoch: EpochTBD,
DevnetExternalEpoch: big.NewInt(144),
}

Expand Down Expand Up @@ -259,6 +263,7 @@ var (
BlockGas30MEpoch: big.NewInt(0),
MaxRateEpoch: EpochTBD,
DevnetExternalEpoch: EpochTBD,
TestnetExternalEpoch: EpochTBD,
}

// LocalnetChainConfig contains the chain parameters to run for local development.
Expand Down Expand Up @@ -304,6 +309,7 @@ var (
BlockGas30MEpoch: big.NewInt(0),
MaxRateEpoch: EpochTBD,
DevnetExternalEpoch: EpochTBD,
TestnetExternalEpoch: EpochTBD,
}

// AllProtocolChanges ...
Expand Down Expand Up @@ -350,6 +356,7 @@ var (
big.NewInt(0), // BlockGas30M
big.NewInt(0), // BlockGas30M
big.NewInt(0), // MaxRateEpoch
big.NewInt(0), // MaxRateEpoch
big.NewInt(0),
}

Expand Down Expand Up @@ -397,6 +404,7 @@ var (
big.NewInt(0), // HIP30Epoch
big.NewInt(0), // BlockGas30M
big.NewInt(0), // MaxRateEpoch
big.NewInt(0), // MaxRateEpoch
big.NewInt(0),
}

Expand Down Expand Up @@ -564,6 +572,8 @@ type ChainConfig struct {

DevnetExternalEpoch *big.Int `json:"devnet-external-epoch,omitempty"`

TestnetExternalEpoch *big.Int `json:"testnet-external-epoch,omitempty"`

BlockGas30MEpoch *big.Int `json:"block-gas-30m-epoch,omitempty"`

// MaxRateEpoch will make sure the validator max-rate is at least equal to the minRate + the validator max-rate-increase
Expand Down Expand Up @@ -831,6 +841,10 @@ func (c *ChainConfig) IsDevnetExternalEpoch(epoch *big.Int) bool {
return isForked(c.DevnetExternalEpoch, epoch)
}

func (c *ChainConfig) IsTestnetExternalEpoch(epoch *big.Int) bool {
return isForked(c.TestnetExternalEpoch, epoch)
}

func (c *ChainConfig) IsMaxRate(epoch *big.Int) bool {
return isForked(c.MaxRateEpoch, epoch)
}
Expand Down