Skip to content

Commit 37eb6df

Browse files
authored
Merge pull request #47 from mboben/v1_10_0-upgrade
v1.10.0 upgrade - fixes and features
2 parents 3c23c20 + b56dd84 commit 37eb6df

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

avalanchego/vms/platformvm/service.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"errors"
99
"fmt"
1010
"net/http"
11+
"os"
12+
"strings"
1113
"time"
1214

1315
stdmath "math"
@@ -78,8 +80,16 @@ var (
7880
errMissingPrivateKey = errors.New("argument 'privateKey' not given")
7981
errStartAfterEndTime = errors.New("start time must be before end time")
8082
errStartTimeInThePast = errors.New("start time in the past")
83+
84+
completeGetValidators = false
8185
)
8286

87+
func init() {
88+
// if COMPLETE_GET_VALIDATORS is set to true, the getCurrentValidators API will return delegators
89+
// for every node. Otherwise, it will only return delegators if a single nodeID is provided.
90+
completeGetValidators = strings.ToUpper(os.Getenv("COMPLETE_GET_VALIDATORS")) == "TRUE"
91+
}
92+
8393
// Service defines the API calls that can be made to the platform chain
8494
type Service struct {
8595
vm *VM
@@ -881,8 +891,8 @@ func (s *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidato
881891
case txs.PrimaryNetworkDelegatorCurrentPriority, txs.SubnetPermissionlessDelegatorCurrentPriority:
882892
var rewardOwner *platformapi.Owner
883893
// If we are handling multiple nodeIDs, we don't return the
884-
// delegator information.
885-
if numNodeIDs == 1 {
894+
// delegator information unless completeGetValidators is true.
895+
if numNodeIDs == 1 || completeGetValidators {
886896
attr, err := s.loadStakerTxAttributes(currentStaker.TxID)
887897
if err != nil {
888898
return err
@@ -941,8 +951,8 @@ func (s *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidato
941951
vdr.DelegatorCount = &delegatorCount
942952
vdr.DelegatorWeight = &delegatorWeight
943953

944-
if numNodeIDs == 1 {
945-
// queried a specific validator, load all of its delegators
954+
if numNodeIDs == 1 || completeGetValidators {
955+
// queried a specific validator or completeGetValidators is true, load all of its delegators
946956
vdr.Delegators = &delegators
947957
}
948958
reply.Validators[i] = vdr

avalanchego/vms/platformvm/txs/executor/staker_tx_verification.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,18 @@ func verifyAddPermissionlessValidatorTx(
462462
}
463463

464464
currentTimestamp := chainState.GetTimestamp()
465+
if constants.IsFlareNetworkID(backend.Ctx.NetworkID) || constants.IsSgbNetworkID(backend.Ctx.NetworkID) {
466+
// Flare does not allow permissionless validator tx before Cortina
467+
if currentTimestamp.Before(backend.Config.CortinaTime) {
468+
return errWrongTxType
469+
}
470+
471+
// Flare does not allow creation of subnets
472+
if tx.Subnet != constants.PrimaryNetworkID {
473+
return errWrongTxType
474+
}
475+
}
476+
465477
// Ensure the proposed validator starts after the current time
466478
startTime := tx.StartTime()
467479
if !currentTimestamp.Before(startTime) {
@@ -643,6 +655,11 @@ func verifyAddPermissionlessDelegatorTx(
643655
}
644656

645657
currentTimestamp := chainState.GetTimestamp()
658+
// Flare does not allow permissionless delegator tx before Cortina
659+
if currentTimestamp.Before(backend.Config.CortinaTime) && (constants.IsFlareNetworkID(backend.Ctx.NetworkID) || constants.IsSgbNetworkID(backend.Ctx.NetworkID)) {
660+
return errWrongTxType
661+
}
662+
646663
// Ensure the proposed validator starts after the current timestamp
647664
startTime := tx.StartTime()
648665
if !currentTimestamp.Before(startTime) {

coreth/consensus/dummy/dynamic_fees.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header, timestamp uin
7777
)
7878
if isApricotPhase5 {
7979
baseFeeChangeDenominator = ApricotPhase5BaseFeeChangeDenominator
80-
if config.IsSongbirdCode() {
80+
if config.IsSongbirdCode() && !config.IsCortina(bigTimestamp) {
8181
parentGasTarget = params.SgbApricotPhase5TargetGas
8282
} else {
8383
parentGasTarget = params.ApricotPhase5TargetGas

0 commit comments

Comments
 (0)