diff --git a/api/info/service.go b/api/info/service.go index 86ed20bccaaa..4958e3cf9b48 100644 --- a/api/info/service.go +++ b/api/info/service.go @@ -314,15 +314,23 @@ type UptimeResponse struct { } type UptimeRequest struct { - // if omitted, defaults to primary network + // Deprecated: SubnetID in UptimeRequest is deprecated. + // Uptime API will be available only for Primary Network Validators. SubnetID ids.ID `json:"subnetID"` } func (i *Info) Uptime(_ *http.Request, args *UptimeRequest, reply *UptimeResponse) error { - i.log.Debug("API called", - zap.String("service", "info"), - zap.String("method", "uptime"), - ) + if args.SubnetID != constants.PrimaryNetworkID { + i.log.Warn("Deprecated API called", + zap.String("service", "info"), + zap.String("method", "uptime"), + ) + } else { + i.log.Debug("API called", + zap.String("service", "info"), + zap.String("method", "uptime"), + ) + } result, err := i.networking.NodeUptime(args.SubnetID) if err != nil { diff --git a/api/info/service.md b/api/info/service.md index d7e70e269dff..49479802430b 100644 --- a/api/info/service.md +++ b/api/info/service.md @@ -542,7 +542,7 @@ info.peers({ - `lastReceived` is the timestamp of last message received from the peer. - `benched` shows chain IDs that the peer is being benched. - `observedUptime` is this node's primary network uptime, observed by the peer. -- `observedSubnetUptime` is a map of Subnet IDs to this node's Subnet uptimes, observed by the peer. +- `observedSubnetUptime` (Deprecated) is a map of Subnet IDs to this node's Subnet uptimes, observed by the peer. **Example Call:** @@ -632,7 +632,7 @@ info.uptime({ } ``` -- `subnetID` is the Subnet to get the uptime of. If not provided, returns the uptime of the node on +- `subnetID` (Deprecated) is the Subnet to get the uptime of. If not provided, returns the uptime of the node on the primary network. - `rewardingStakePercentage` is the percent of stake which thinks this node is above the uptime diff --git a/network/metrics.go b/network/metrics.go index 9702e821b246..a4b333e6daea 100644 --- a/network/metrics.go +++ b/network/metrics.go @@ -34,13 +34,12 @@ type metrics struct { numUselessPeerListBytes prometheus.Counter nodeUptimeWeightedAverage prometheus.Gauge nodeUptimeRewardingStake prometheus.Gauge - nodeSubnetUptimeWeightedAverage *prometheus.GaugeVec - nodeSubnetUptimeRewardingStake *prometheus.GaugeVec + nodeSubnetUptimeWeightedAverage *prometheus.GaugeVec // Deprecated + nodeSubnetUptimeRewardingStake *prometheus.GaugeVec // Deprecated peerConnectedLifetimeAverage prometheus.Gauge - - lock sync.RWMutex - peerConnectedStartTimes map[ids.NodeID]float64 - peerConnectedStartTimesSum float64 + lock sync.RWMutex + peerConnectedStartTimes map[ids.NodeID]float64 + peerConnectedStartTimesSum float64 } func newMetrics( diff --git a/network/peer/info.go b/network/peer/info.go index 928c47ff26ee..843abc4c96fe 100644 --- a/network/peer/info.go +++ b/network/peer/info.go @@ -20,7 +20,7 @@ type Info struct { LastSent time.Time `json:"lastSent"` LastReceived time.Time `json:"lastReceived"` ObservedUptime json.Uint32 `json:"observedUptime"` - ObservedSubnetUptimes map[ids.ID]json.Uint32 `json:"observedSubnetUptimes"` + ObservedSubnetUptimes map[ids.ID]json.Uint32 `json:"observedSubnetUptimes"` // Deprecated TrackedSubnets set.Set[ids.ID] `json:"trackedSubnets"` SupportedACPs set.Set[uint32] `json:"supportedACPs"` ObjectedACPs set.Set[uint32] `json:"objectedACPs"` diff --git a/proto/p2p/p2p.proto b/proto/p2p/p2p.proto index 221a037f524f..7935ef6e44a5 100644 --- a/proto/p2p/p2p.proto +++ b/proto/p2p/p2p.proto @@ -64,7 +64,7 @@ message Message { message Ping { // Uptime percentage on the primary network [0, 100] uint32 uptime = 1; - // Uptime percentage on subnets + // Deprecated repeated SubnetUptime subnet_uptimes = 2; } diff --git a/proto/pb/p2p/p2p.pb.go b/proto/pb/p2p/p2p.pb.go index 5ca017be18bf..df754b0e2d74 100644 --- a/proto/pb/p2p/p2p.pb.go +++ b/proto/pb/p2p/p2p.pb.go @@ -498,7 +498,7 @@ type Ping struct { // Uptime percentage on the primary network [0, 100] Uptime uint32 `protobuf:"varint,1,opt,name=uptime,proto3" json:"uptime,omitempty"` - // Uptime percentage on subnets + // Deprecated SubnetUptimes []*SubnetUptime `protobuf:"bytes,2,rep,name=subnet_uptimes,json=subnetUptimes,proto3" json:"subnet_uptimes,omitempty"` } diff --git a/vms/platformvm/api/static_service.go b/vms/platformvm/api/static_service.go index 418b447114c7..46f02bd46ba9 100644 --- a/vms/platformvm/api/static_service.go +++ b/vms/platformvm/api/static_service.go @@ -115,15 +115,19 @@ type PermissionlessValidator struct { ValidationRewardOwner *Owner `json:"validationRewardOwner,omitempty"` // The owner of the rewards from delegations during the validation period, // if applicable. - DelegationRewardOwner *Owner `json:"delegationRewardOwner,omitempty"` - PotentialReward *json.Uint64 `json:"potentialReward,omitempty"` - AccruedDelegateeReward *json.Uint64 `json:"accruedDelegateeReward,omitempty"` - DelegationFee json.Float32 `json:"delegationFee"` - ExactDelegationFee *json.Uint32 `json:"exactDelegationFee,omitempty"` - Uptime *json.Float32 `json:"uptime,omitempty"` - Connected bool `json:"connected"` - Staked []UTXO `json:"staked,omitempty"` - Signer *signer.ProofOfPossession `json:"signer,omitempty"` + DelegationRewardOwner *Owner `json:"delegationRewardOwner,omitempty"` + PotentialReward *json.Uint64 `json:"potentialReward,omitempty"` + AccruedDelegateeReward *json.Uint64 `json:"accruedDelegateeReward,omitempty"` + DelegationFee json.Float32 `json:"delegationFee"` + ExactDelegationFee *json.Uint32 `json:"exactDelegationFee,omitempty"` + // Uptime is deprecated for Subnet Validators. + // It will be available only for Primary Network Validators. + Uptime *json.Float32 `json:"uptime,omitempty"` + // Connected is deprecated for Subnet Validators. + // It will be available only for Primary Network Validators. + Connected bool `json:"connected"` + Staked []UTXO `json:"staked,omitempty"` + Signer *signer.ProofOfPossession `json:"signer,omitempty"` // The delegators delegating to this validator DelegatorCount *json.Uint64 `json:"delegatorCount,omitempty"` diff --git a/vms/platformvm/client_permissionless_validator.go b/vms/platformvm/client_permissionless_validator.go index 3974f770658d..b2e48b0cce2a 100644 --- a/vms/platformvm/client_permissionless_validator.go +++ b/vms/platformvm/client_permissionless_validator.go @@ -44,9 +44,13 @@ type ClientPermissionlessValidator struct { PotentialReward *uint64 AccruedDelegateeReward *uint64 DelegationFee float32 - Uptime *float32 - Connected *bool - Signer *signer.ProofOfPossession + // Uptime is deprecated for Subnet Validators. + // It will be available only for Primary Network Validators. + Uptime *float32 + // Connected is deprecated for Subnet Validators. + // It will be available only for Primary Network Validators. + Connected *bool + Signer *signer.ProofOfPossession // The delegators delegating to this validator DelegatorCount *uint64 DelegatorWeight *uint64 diff --git a/vms/platformvm/service.md b/vms/platformvm/service.md index caa040103533..f4cd28cd35f1 100644 --- a/vms/platformvm/service.md +++ b/vms/platformvm/service.md @@ -696,8 +696,8 @@ platform.getCurrentValidators({ - `delegationFeeRate` is the percent fee this validator charges when others delegate stake to them. Omitted if `subnetID` is not a PoS Subnet. - `uptime` is the % of time the queried node has reported the peer as online and validating the - Subnet. Omitted if `subnetID` is not a PoS Subnet. - - `connected` is if the node is connected and tracks the Subnet. + Subnet. Omitted if `subnetID` is not a PoS Subnet. (Deprecated: uptime is deprecated for Subnet Validators. It will be available only for Primary Network Validators.) + - `connected` is if the node is connected and tracks the Subnet. (Deprecated: connected is deprecated for Subnet Validators. It will be available only for Primary Network Validators.) - `signer` is the node's BLS public key and proof of possession. Omitted if the validator doesn't have a BLS public key. - `delegatorCount` is the number of delegators on this validator. @@ -1222,11 +1222,11 @@ platform.getSubnet({ ``` - `subnetID` is the ID of the Subnet to get information about. If omitted, fails. -- `threshold` signatures from addresses in `controlKeys` are needed to make changes to +- `threshold` signatures from addresses in `controlKeys` are needed to make changes to a permissioned subnet. If the Subnet is a PoS Subnet, then `threshold` will be `0` and `controlKeys` will be empty. - changes can not be made into the subnet until `locktime` is in the past. -- `subnetTransformationTxID` is the ID of the transaction that changed the subnet into a elastic one, +- `subnetTransformationTxID` is the ID of the transaction that changed the subnet into a elastic one, for when this change was performed. **Example Call:**