Skip to content

Commit

Permalink
Merge branch 'replace-periodic-gossip-preference' of github.com:ava-l…
Browse files Browse the repository at this point in the history
…abs/avalanchego into replace-periodic-gossip-preference
  • Loading branch information
StephenButtolph committed Nov 29, 2023
2 parents 7ec8852 + b82b8e0 commit 1db911f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ func (n *Node) initVMs() error {
ApricotPhase5Time: version.GetApricotPhase5Time(n.Config.NetworkID),
BanffTime: version.GetBanffTime(n.Config.NetworkID),
CortinaTime: version.GetCortinaTime(n.Config.NetworkID),
DTime: version.GetDTime(n.Config.NetworkID),
DurangoTime: version.GetDurangoTime(n.Config.NetworkID),
UseCurrentHeight: n.Config.UseCurrentHeight,
},
}),
Expand Down
6 changes: 3 additions & 3 deletions version/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var (
CortinaXChainStopVertexID map[uint32]ids.ID

// TODO: update this before release
DTimes = map[uint32]time.Time{
DurangoTimes = map[uint32]time.Time{
constants.MainnetID: time.Date(10000, time.December, 1, 0, 0, 0, 0, time.UTC),
constants.FujiID: time.Date(10000, time.December, 1, 0, 0, 0, 0, time.UTC),
}
Expand Down Expand Up @@ -191,8 +191,8 @@ func GetCortinaTime(networkID uint32) time.Time {
return DefaultUpgradeTime
}

func GetDTime(networkID uint32) time.Time {
if upgradeTime, exists := DTimes[networkID]; exists {
func GetDurangoTime(networkID uint32) time.Time {
if upgradeTime, exists := DurangoTimes[networkID]; exists {
return upgradeTime
}
return DefaultUpgradeTime
Expand Down
9 changes: 4 additions & 5 deletions vms/platformvm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ type Config struct {
// Time of the Cortina network upgrade
CortinaTime time.Time

// Time of the D network upgrade
DTime time.Time
// Time of the Durango network upgrade
DurangoTime time.Time

// UseCurrentHeight forces [GetMinimumHeight] to return the current height
// of the P-Chain instead of the oldest block in the [recentlyAccepted]
Expand Down Expand Up @@ -133,9 +133,8 @@ func (c *Config) IsCortinaActivated(timestamp time.Time) bool {
return !timestamp.Before(c.CortinaTime)
}

// TODO: Rename
func (c *Config) IsDActivated(timestamp time.Time) bool {
return !timestamp.Before(c.DTime)
func (c *Config) IsDurangoActivated(timestamp time.Time) bool {
return !timestamp.Before(c.DurangoTime)
}

func (c *Config) GetCreateBlockchainTxFee(timestamp time.Time) uint64 {
Expand Down
6 changes: 3 additions & 3 deletions vms/platformvm/txs/executor/staker_tx_verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
ErrDuplicateValidator = errors.New("duplicate validator")
ErrDelegateToPermissionedValidator = errors.New("delegation to permissioned validator")
ErrWrongStakedAssetID = errors.New("incorrect staked assetID")
ErrDUpgradeNotActive = errors.New("attempting to use a D-upgrade feature prior to activation")
ErrDurangoUpgradeNotActive = errors.New("attempting to use a Durango-upgrade feature prior to activation")
)

// verifySubnetValidatorPrimaryNetworkRequirements verifies the primary
Expand Down Expand Up @@ -727,8 +727,8 @@ func verifyTransferSubnetOwnershipTx(
sTx *txs.Tx,
tx *txs.TransferSubnetOwnershipTx,
) error {
if !backend.Config.IsDActivated(chainState.GetTimestamp()) {
return ErrDUpgradeNotActive
if !backend.Config.IsDurangoActivated(chainState.GetTimestamp()) {
return ErrDurangoUpgradeNotActive
}

// Verify the tx is well-formed
Expand Down
4 changes: 2 additions & 2 deletions vms/platformvm/txs/executor/standard_tx_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ func (e *StandardTxExecutor) TransferSubnetOwnershipTx(tx *txs.TransferSubnetOwn
}

func (e *StandardTxExecutor) BaseTx(tx *txs.BaseTx) error {
if !e.Backend.Config.IsDActivated(e.State.GetTimestamp()) {
return ErrDUpgradeNotActive
if !e.Backend.Config.IsDurangoActivated(e.State.GetTimestamp()) {
return ErrDurangoUpgradeNotActive
}

// Verify the tx is well-formed
Expand Down

0 comments on commit 1db911f

Please sign in to comment.