diff --git a/api/info/client.go b/api/info/client.go index 5054b0910c1..4f198d0c0e7 100644 --- a/api/info/client.go +++ b/api/info/client.go @@ -29,7 +29,7 @@ type Client interface { IsBootstrapped(context.Context, string, ...rpc.Option) (bool, error) GetTxFee(context.Context, ...rpc.Option) (*GetTxFeeResponse, error) Upgrades(context.Context, ...rpc.Option) (*upgrade.Config, error) - Uptime(context.Context, ids.ID, ...rpc.Option) (*UptimeResponse, error) + Uptime(context.Context, ...rpc.Option) (*UptimeResponse, error) GetVMs(context.Context, ...rpc.Option) (map[ids.ID][]string, error) } @@ -109,11 +109,9 @@ func (c *client) Upgrades(ctx context.Context, options ...rpc.Option) (*upgrade. return res, err } -func (c *client) Uptime(ctx context.Context, subnetID ids.ID, options ...rpc.Option) (*UptimeResponse, error) { +func (c *client) Uptime(ctx context.Context, options ...rpc.Option) (*UptimeResponse, error) { res := &UptimeResponse{} - err := c.requester.SendRequest(ctx, "info.uptime", &UptimeRequest{ - SubnetID: subnetID, - }, res, options...) + err := c.requester.SendRequest(ctx, "info.uptime", struct{}{}, res, options...) return res, err } diff --git a/api/info/service.go b/api/info/service.go index 4958e3cf9b4..383e00bef66 100644 --- a/api/info/service.go +++ b/api/info/service.go @@ -313,26 +313,13 @@ type UptimeResponse struct { WeightedAveragePercentage json.Float64 `json:"weightedAveragePercentage"` } -type UptimeRequest struct { - // 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 { - 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"), - ) - } +func (i *Info) Uptime(_ *http.Request, _ *struct{}, reply *UptimeResponse) error { + i.log.Debug("API called", + zap.String("service", "info"), + zap.String("method", "uptime"), + ) - result, err := i.networking.NodeUptime(args.SubnetID) + result, err := i.networking.NodeUptime() if err != nil { return fmt.Errorf("couldn't get node uptime: %w", err) } diff --git a/api/info/service.md b/api/info/service.md index 49479802430..f3d56bdf106 100644 --- a/api/info/service.md +++ b/api/info/service.md @@ -526,7 +526,6 @@ info.peers({ lastReceived: string, benched: string[], observedUptime: int, - observedSubnetUptime: map[string]int, } } ``` @@ -542,7 +541,6 @@ 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` (Deprecated) is a map of Subnet IDs to this node's Subnet uptimes, observed by the peer. **Example Call:** @@ -575,7 +573,6 @@ curl -X POST --data '{ "lastReceived": "2020-06-01T15:22:57Z", "benched": [], "observedUptime": "99", - "observedSubnetUptimes": {}, "trackedSubnets": [], "benched": [] }, @@ -588,9 +585,6 @@ curl -X POST --data '{ "lastReceived": "2020-06-01T15:22:34Z", "benched": [], "observedUptime": "75", - "observedSubnetUptimes": { - "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL": "100" - }, "trackedSubnets": [ "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL" ], @@ -605,7 +599,6 @@ curl -X POST --data '{ "lastReceived": "2020-06-01T15:22:55Z", "benched": [], "observedUptime": "95", - "observedSubnetUptimes": {}, "trackedSubnets": [], "benched": [] } @@ -623,18 +616,13 @@ Other sources may be using data gathered with incomplete (limited) information. **Signature:** ```sh -info.uptime({ - subnetID: string // optional -}) -> +info.uptime() -> { rewardingStakePercentage: float64, weightedAveragePercentage: float64 } ``` -- `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 requirement. - `weightedAveragePercentage` is the stake-weighted average of all observed uptimes for this node. diff --git a/chains/manager.go b/chains/manager.go index 2fdd3c0b73f..a5375d6aacb 100644 --- a/chains/manager.go +++ b/chains/manager.go @@ -896,7 +896,6 @@ func (m *manager) createAvalancheChain( m.FrontierPollFrequency, m.ConsensusAppConcurrency, m.ResourceTracker, - validators.UnhandledSubnetConnector, // avalanche chains don't use subnet connector sb, connectedValidators, peerTracker, @@ -1107,10 +1106,7 @@ func (m *manager) createSnowmanChain( messageSender = sender.Trace(messageSender, m.Tracer) } - var ( - bootstrapFunc func() - subnetConnector = validators.UnhandledSubnetConnector - ) + var bootstrapFunc func() // If [m.validatorState] is nil then we are creating the P-Chain. Since the // P-Chain is the first chain to be created, we can use it to initialize // required interfaces for the other chains @@ -1147,12 +1143,6 @@ func (m *manager) createSnowmanChain( bootstrapFunc = func() { close(m.unblockChainCreatorCh) } - - // Set up the subnet connector for the P-Chain - subnetConnector, ok = vm.(validators.SubnetConnector) - if !ok { - return nil, fmt.Errorf("expected validators.SubnetConnector but got %T", vm) - } } // Initialize the ProposerVM and the vm wrapped inside it @@ -1295,7 +1285,6 @@ func (m *manager) createSnowmanChain( m.FrontierPollFrequency, m.ConsensusAppConcurrency, m.ResourceTracker, - subnetConnector, sb, connectedValidators, peerTracker, diff --git a/message/internal_msg_builder.go b/message/internal_msg_builder.go index 9de6dabbd44..2fabb2ae00c 100644 --- a/message/internal_msg_builder.go +++ b/message/internal_msg_builder.go @@ -335,32 +335,6 @@ func InternalConnected(nodeID ids.NodeID, nodeVersion *version.Application) Inbo } } -// ConnectedSubnet contains the subnet ID of the subnet that the node is -// connected to. -type ConnectedSubnet struct { - SubnetID ids.ID `json:"subnet_id,omitempty"` -} - -func (m *ConnectedSubnet) String() string { - return fmt.Sprintf( - "SubnetID: %s", - m.SubnetID, - ) -} - -// InternalConnectedSubnet returns a message that indicates the node with [nodeID] is -// connected to the subnet with the given [subnetID]. -func InternalConnectedSubnet(nodeID ids.NodeID, subnetID ids.ID) InboundMessage { - return &inboundMessage{ - nodeID: nodeID, - op: ConnectedSubnetOp, - message: &ConnectedSubnet{ - SubnetID: subnetID, - }, - expiration: mockable.MaxTime, - } -} - type Disconnected struct{} func (Disconnected) String() string { diff --git a/message/messagemock/outbound_message_builder.go b/message/messagemock/outbound_message_builder.go index b9261ca3301..0ba02d0b9a5 100644 --- a/message/messagemock/outbound_message_builder.go +++ b/message/messagemock/outbound_message_builder.go @@ -315,18 +315,18 @@ func (mr *OutboundMsgBuilderMockRecorder) PeerList(arg0, arg1 any) *gomock.Call } // Ping mocks base method. -func (m *OutboundMsgBuilder) Ping(arg0 uint32, arg1 []*p2p.SubnetUptime) (message.OutboundMessage, error) { +func (m *OutboundMsgBuilder) Ping(arg0 uint32) (message.OutboundMessage, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Ping", arg0, arg1) + ret := m.ctrl.Call(m, "Ping", arg0) ret0, _ := ret[0].(message.OutboundMessage) ret1, _ := ret[1].(error) return ret0, ret1 } // Ping indicates an expected call of Ping. -func (mr *OutboundMsgBuilderMockRecorder) Ping(arg0, arg1 any) *gomock.Call { +func (mr *OutboundMsgBuilderMockRecorder) Ping(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ping", reflect.TypeOf((*OutboundMsgBuilder)(nil).Ping), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ping", reflect.TypeOf((*OutboundMsgBuilder)(nil).Ping), arg0) } // Pong mocks base method. diff --git a/message/messages_test.go b/message/messages_test.go index 8314fa805e3..7d4ace78b5b 100644 --- a/message/messages_test.go +++ b/message/messages_test.go @@ -54,7 +54,7 @@ func TestMessage(t *testing.T) { bytesSaved bool // if true, outbound message saved bytes must be non-zero }{ { - desc: "ping message with no compression no subnet uptimes", + desc: "ping message with no compression no uptime", op: PingOp, msg: &p2p.Message{ Message: &p2p.Message_Ping{ @@ -78,17 +78,12 @@ func TestMessage(t *testing.T) { bytesSaved: false, }, { - desc: "ping message with no compression and subnet uptimes", + desc: "ping message with no compression and uptime", op: PingOp, msg: &p2p.Message{ Message: &p2p.Message_Ping{ Ping: &p2p.Ping{ - SubnetUptimes: []*p2p.SubnetUptime{ - { - SubnetId: testID[:], - Uptime: 100, - }, - }, + Uptime: 100, }, }, }, diff --git a/message/ops.go b/message/ops.go index 92c4697949b..6ac8a6aff9c 100644 --- a/message/ops.go +++ b/message/ops.go @@ -56,7 +56,6 @@ const ( AppGossipOp // Internal: ConnectedOp - ConnectedSubnetOp DisconnectedOp NotifyOp GossipRequestOp @@ -113,7 +112,6 @@ var ( GetFailedOp, QueryFailedOp, ConnectedOp, - ConnectedSubnetOp, DisconnectedOp, NotifyOp, GossipRequestOp, @@ -151,7 +149,6 @@ var ( ChitsOp, // Internal ConnectedOp, - ConnectedSubnetOp, DisconnectedOp, } @@ -261,8 +258,6 @@ func (op Op) String() string { // Internal case ConnectedOp: return "connected" - case ConnectedSubnetOp: - return "connected_subnet" case DisconnectedOp: return "disconnected" case NotifyOp: diff --git a/message/outbound_msg_builder.go b/message/outbound_msg_builder.go index 296e7744615..00314ad9108 100644 --- a/message/outbound_msg_builder.go +++ b/message/outbound_msg_builder.go @@ -51,7 +51,6 @@ type OutboundMsgBuilder interface { Ping( primaryUptime uint32, - subnetUptimes []*p2p.SubnetUptime, ) (OutboundMessage, error) Pong() (OutboundMessage, error) @@ -200,14 +199,12 @@ func newOutboundBuilder(compressionType compression.Type, builder *msgBuilder) O func (b *outMsgBuilder) Ping( primaryUptime uint32, - subnetUptimes []*p2p.SubnetUptime, ) (OutboundMessage, error) { return b.builder.createOutbound( &p2p.Message{ Message: &p2p.Message_Ping{ Ping: &p2p.Ping{ - Uptime: primaryUptime, - SubnetUptimes: subnetUptimes, + Uptime: primaryUptime, }, }, }, diff --git a/network/metrics.go b/network/metrics.go index a4b333e6dae..fbbd416825d 100644 --- a/network/metrics.go +++ b/network/metrics.go @@ -19,27 +19,25 @@ type metrics struct { // trackedSubnets does not include the primary network ID trackedSubnets set.Set[ids.ID] - numTracked prometheus.Gauge - numPeers prometheus.Gauge - numSubnetPeers *prometheus.GaugeVec - timeSinceLastMsgSent prometheus.Gauge - timeSinceLastMsgReceived prometheus.Gauge - sendFailRate prometheus.Gauge - connected prometheus.Counter - disconnected prometheus.Counter - acceptFailed prometheus.Counter - inboundConnRateLimited prometheus.Counter - inboundConnAllowed prometheus.Counter - tlsConnRejected prometheus.Counter - numUselessPeerListBytes prometheus.Counter - nodeUptimeWeightedAverage prometheus.Gauge - nodeUptimeRewardingStake prometheus.Gauge - nodeSubnetUptimeWeightedAverage *prometheus.GaugeVec // Deprecated - nodeSubnetUptimeRewardingStake *prometheus.GaugeVec // Deprecated - peerConnectedLifetimeAverage prometheus.Gauge - lock sync.RWMutex - peerConnectedStartTimes map[ids.NodeID]float64 - peerConnectedStartTimesSum float64 + numTracked prometheus.Gauge + numPeers prometheus.Gauge + numSubnetPeers *prometheus.GaugeVec + timeSinceLastMsgSent prometheus.Gauge + timeSinceLastMsgReceived prometheus.Gauge + sendFailRate prometheus.Gauge + connected prometheus.Counter + disconnected prometheus.Counter + acceptFailed prometheus.Counter + inboundConnRateLimited prometheus.Counter + inboundConnAllowed prometheus.Counter + tlsConnRejected prometheus.Counter + numUselessPeerListBytes prometheus.Counter + nodeUptimeWeightedAverage prometheus.Gauge + nodeUptimeRewardingStake prometheus.Gauge + peerConnectedLifetimeAverage prometheus.Gauge + lock sync.RWMutex + peerConnectedStartTimes map[ids.NodeID]float64 + peerConnectedStartTimesSum float64 } func newMetrics( @@ -111,20 +109,6 @@ func newMetrics( Name: "node_uptime_rewarding_stake", Help: "The percentage of total stake which thinks this node is eligible for rewards", }), - nodeSubnetUptimeWeightedAverage: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: "node_subnet_uptime_weighted_average", - Help: "This node's subnet uptime averages weighted by observing subnet peer stakes", - }, - []string{"subnetID"}, - ), - nodeSubnetUptimeRewardingStake: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: "node_subnet_uptime_rewarding_stake", - Help: "The percentage of subnet's total stake which thinks this node is eligible for subnet's rewards", - }, - []string{"subnetID"}, - ), peerConnectedLifetimeAverage: prometheus.NewGauge( prometheus.GaugeOpts{ Name: "peer_connected_duration_average", @@ -150,8 +134,6 @@ func newMetrics( registerer.Register(m.inboundConnRateLimited), registerer.Register(m.nodeUptimeWeightedAverage), registerer.Register(m.nodeUptimeRewardingStake), - registerer.Register(m.nodeSubnetUptimeWeightedAverage), - registerer.Register(m.nodeSubnetUptimeRewardingStake), registerer.Register(m.peerConnectedLifetimeAverage), ) @@ -160,8 +142,6 @@ func newMetrics( // initialize to 0 subnetIDStr := subnetID.String() m.numSubnetPeers.WithLabelValues(subnetIDStr).Set(0) - m.nodeSubnetUptimeWeightedAverage.WithLabelValues(subnetIDStr).Set(0) - m.nodeSubnetUptimeRewardingStake.WithLabelValues(subnetIDStr).Set(0) } return m, err diff --git a/network/network.go b/network/network.go index a7a1a0d0306..eab4ecca085 100644 --- a/network/network.go +++ b/network/network.go @@ -52,7 +52,6 @@ var ( _ Network = (*network)(nil) errNotValidator = errors.New("node is not a validator") - errNotTracked = errors.New("subnet is not tracked") errExpectedProxy = errors.New("expected proxy") errExpectedTCPProtocol = errors.New("expected TCP protocol") errTrackingPrimaryNetwork = errors.New("cannot track primary network") @@ -86,9 +85,9 @@ type Network interface { // info about the peers in [nodeIDs] that have finished the handshake. PeerInfo(nodeIDs []ids.NodeID) []peer.Info - // NodeUptime returns given node's [subnetID] UptimeResults in the view of + // NodeUptime returns given node's primary network UptimeResults in the view of // this node's peer validators. - NodeUptime(subnetID ids.ID) (UptimeResult, error) + NodeUptime() (UptimeResult, error) } type UptimeResult struct { @@ -1153,19 +1152,15 @@ func (n *network) StartClose() { }) } -func (n *network) NodeUptime(subnetID ids.ID) (UptimeResult, error) { - if subnetID != constants.PrimaryNetworkID && !n.config.TrackedSubnets.Contains(subnetID) { - return UptimeResult{}, errNotTracked - } - - myStake := n.config.Validators.GetWeight(subnetID, n.config.MyNodeID) +func (n *network) NodeUptime() (UptimeResult, error) { + myStake := n.config.Validators.GetWeight(constants.PrimaryNetworkID, n.config.MyNodeID) if myStake == 0 { return UptimeResult{}, errNotValidator } - totalWeightInt, err := n.config.Validators.TotalWeight(subnetID) + totalWeightInt, err := n.config.Validators.TotalWeight(constants.PrimaryNetworkID) if err != nil { - return UptimeResult{}, fmt.Errorf("error while fetching weight for subnet %s: %w", subnetID, err) + return UptimeResult{}, fmt.Errorf("error while fetching weight for primary network %w", err) } var ( @@ -1181,22 +1176,18 @@ func (n *network) NodeUptime(subnetID ids.ID) (UptimeResult, error) { peer, _ := n.connectedPeers.GetByIndex(i) nodeID := peer.ID() - weight := n.config.Validators.GetWeight(subnetID, nodeID) + weight := n.config.Validators.GetWeight(constants.PrimaryNetworkID, nodeID) if weight == 0 { // this is not a validator skip it. continue } - observedUptime, exist := peer.ObservedUptime(subnetID) - if !exist { - observedUptime = 0 - } + observedUptime := peer.ObservedUptime() percent := float64(observedUptime) weightFloat := float64(weight) totalWeightedPercent += percent * weightFloat // if this peer thinks we're above requirement add the weight - // TODO: use subnet-specific uptime requirements if percent/100 >= n.config.UptimeRequirement { rewardingStake += weightFloat } @@ -1232,7 +1223,7 @@ func (n *network) runTimers() { n.peerConfig.Log.Debug("reset ip tracker bloom filter") } case <-updateUptimes.C: - primaryUptime, err := n.NodeUptime(constants.PrimaryNetworkID) + primaryUptime, err := n.NodeUptime() if err != nil { n.peerConfig.Log.Debug("failed to get primary network uptime", zap.Error(err), @@ -1240,19 +1231,6 @@ func (n *network) runTimers() { } n.metrics.nodeUptimeWeightedAverage.Set(primaryUptime.WeightedAveragePercentage) n.metrics.nodeUptimeRewardingStake.Set(primaryUptime.RewardingStakePercentage) - - for subnetID := range n.config.TrackedSubnets { - result, err := n.NodeUptime(subnetID) - if err != nil { - n.peerConfig.Log.Debug("failed to get subnet uptime", - zap.Stringer("subnetID", subnetID), - zap.Error(err), - ) - } - subnetIDStr := subnetID.String() - n.metrics.nodeSubnetUptimeWeightedAverage.WithLabelValues(subnetIDStr).Set(result.WeightedAveragePercentage) - n.metrics.nodeSubnetUptimeRewardingStake.WithLabelValues(subnetIDStr).Set(result.RewardingStakePercentage) - } } } } diff --git a/network/peer/info.go b/network/peer/info.go index 843abc4c96f..71d2c78420f 100644 --- a/network/peer/info.go +++ b/network/peer/info.go @@ -13,15 +13,14 @@ import ( ) type Info struct { - IP netip.AddrPort `json:"ip"` - PublicIP netip.AddrPort `json:"publicIP,omitempty"` - ID ids.NodeID `json:"nodeID"` - Version string `json:"version"` - LastSent time.Time `json:"lastSent"` - LastReceived time.Time `json:"lastReceived"` - ObservedUptime json.Uint32 `json:"observedUptime"` - 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"` + IP netip.AddrPort `json:"ip"` + PublicIP netip.AddrPort `json:"publicIP,omitempty"` + ID ids.NodeID `json:"nodeID"` + Version string `json:"version"` + LastSent time.Time `json:"lastSent"` + LastReceived time.Time `json:"lastReceived"` + ObservedUptime json.Uint32 `json:"observedUptime"` + TrackedSubnets set.Set[ids.ID] `json:"trackedSubnets"` + SupportedACPs set.Set[uint32] `json:"supportedACPs"` + ObjectedACPs set.Set[uint32] `json:"objectedACPs"` } diff --git a/network/peer/message_queue_test.go b/network/peer/message_queue_test.go index 4b9b63f4c44..a4cce461aba 100644 --- a/network/peer/message_queue_test.go +++ b/network/peer/message_queue_test.go @@ -9,9 +9,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/message" - "github.com/ava-labs/avalanchego/proto/pb/p2p" "github.com/ava-labs/avalanchego/utils/logging" ) @@ -33,14 +31,7 @@ func TestMessageQueue(t *testing.T) { // Assert that the messages are popped in the same order they were pushed for i := 0; i < numToSend; i++ { - testID := ids.GenerateTestID() - testID2 := ids.GenerateTestID() - m, err := mc.Ping( - uint32(i), - []*p2p.SubnetUptime{ - {SubnetId: testID[:], Uptime: uint32(i)}, - {SubnetId: testID2[:], Uptime: uint32(i)}, - }) + m, err := mc.Ping(uint32(i)) require.NoError(err) msgs = append(msgs, m) } diff --git a/network/peer/peer.go b/network/peer/peer.go index fb4b3904167..68a38fd3631 100644 --- a/network/peer/peer.go +++ b/network/peer/peer.go @@ -94,10 +94,10 @@ type Peer interface { // be called after [Ready] returns true. TrackedSubnets() set.Set[ids.ID] - // ObservedUptime returns the local node's subnet uptime according to the + // ObservedUptime returns the local node's primary network uptime according to the // peer. The value ranges from [0, 100]. It should only be called after // [Ready] returns true. - ObservedUptime(subnetID ids.ID) (uint32, bool) + ObservedUptime() uint32 // Send attempts to send [msg] to the peer. The peer takes ownership of // [msg] for reference counting. This returns false if the message is @@ -158,10 +158,8 @@ type peer struct { // this can only be accessed by the message sender goroutine. txIDOfVerifiedBLSKey ids.ID - observedUptimesLock sync.RWMutex - // [observedUptimesLock] must be held while accessing [observedUptime] - // Subnet ID --> Our uptime for the given subnet as perceived by the peer - observedUptimes map[ids.ID]uint32 + // Our primary network uptime perceived by the peer + observedUptime utils.Atomic[uint32] // True if this peer has sent us a valid Handshake message and // is running a compatible version. @@ -221,7 +219,6 @@ func Start( onClosingCtx: onClosingCtx, onClosingCtxCancel: onClosingCtxCancel, onClosed: make(chan struct{}), - observedUptimes: make(map[ids.ID]uint32), getPeerListChan: make(chan struct{}, 1), } @@ -270,33 +267,20 @@ func (p *peer) AwaitReady(ctx context.Context) error { } func (p *peer) Info() Info { - uptimes := make(map[ids.ID]json.Uint32, p.MySubnets.Len()) - for subnetID := range p.MySubnets { - uptime, exist := p.ObservedUptime(subnetID) - if !exist { - continue - } - uptimes[subnetID] = json.Uint32(uptime) - } - - primaryUptime, exist := p.ObservedUptime(constants.PrimaryNetworkID) - if !exist { - primaryUptime = 0 - } + primaryUptime := p.ObservedUptime() ip, _ := ips.ParseAddrPort(p.conn.RemoteAddr().String()) return Info{ - IP: ip, - PublicIP: p.ip.AddrPort, - ID: p.id, - Version: p.version.String(), - LastSent: p.LastSent(), - LastReceived: p.LastReceived(), - ObservedUptime: json.Uint32(primaryUptime), - ObservedSubnetUptimes: uptimes, - TrackedSubnets: p.trackedSubnets, - SupportedACPs: p.supportedACPs, - ObjectedACPs: p.objectedACPs, + IP: ip, + PublicIP: p.ip.AddrPort, + ID: p.id, + Version: p.version.String(), + LastSent: p.LastSent(), + LastReceived: p.LastReceived(), + ObservedUptime: json.Uint32(primaryUptime), + TrackedSubnets: p.trackedSubnets, + SupportedACPs: p.supportedACPs, + ObjectedACPs: p.objectedACPs, } } @@ -312,12 +296,8 @@ func (p *peer) TrackedSubnets() set.Set[ids.ID] { return p.trackedSubnets } -func (p *peer) ObservedUptime(subnetID ids.ID) (uint32, bool) { - p.observedUptimesLock.RLock() - defer p.observedUptimesLock.RUnlock() - - uptime, exist := p.observedUptimes[subnetID] - return uptime, exist +func (p *peer) ObservedUptime() uint32 { + return p.observedUptime.Get() } func (p *peer) Send(ctx context.Context, msg message.OutboundMessage) bool { @@ -678,8 +658,8 @@ func (p *peer) sendNetworkMessages() { return } - primaryUptime, subnetUptimes := p.getUptimes() - pingMessage, err := p.MessageCreator.Ping(primaryUptime, subnetUptimes) + primaryUptime := p.getUptime() + pingMessage, err := p.MessageCreator.Ping(primaryUptime) if err != nil { p.Log.Error(failedToCreateMessageLog, zap.Stringer("nodeID", p.id), @@ -790,45 +770,7 @@ func (p *peer) handlePing(msg *p2p.Ping) { p.StartClose() return } - p.observeUptime(constants.PrimaryNetworkID, msg.Uptime) - - for _, subnetUptime := range msg.SubnetUptimes { - subnetID, err := ids.ToID(subnetUptime.SubnetId) - if err != nil { - p.Log.Debug(malformedMessageLog, - zap.Stringer("nodeID", p.id), - zap.Stringer("messageOp", message.PingOp), - zap.String("field", "subnetID"), - zap.Error(err), - ) - p.StartClose() - return - } - - if !p.MySubnets.Contains(subnetID) { - p.Log.Debug(malformedMessageLog, - zap.Stringer("nodeID", p.id), - zap.Stringer("messageOp", message.PingOp), - zap.Stringer("subnetID", subnetID), - zap.String("reason", "not tracking subnet"), - ) - p.StartClose() - return - } - - uptime := subnetUptime.Uptime - if uptime > 100 { - p.Log.Debug(malformedMessageLog, - zap.Stringer("nodeID", p.id), - zap.Stringer("messageOp", message.PingOp), - zap.Stringer("subnetID", subnetID), - zap.Uint32("uptime", uptime), - ) - p.StartClose() - return - } - p.observeUptime(subnetID, uptime) - } + p.observedUptime.Set(msg.Uptime) pongMessage, err := p.MessageCreator.Pong() if err != nil { @@ -844,10 +786,9 @@ func (p *peer) handlePing(msg *p2p.Ping) { p.Send(p.onClosingCtx, pongMessage) } -func (p *peer) getUptimes() (uint32, []*p2p.SubnetUptime) { +func (p *peer) getUptime() uint32 { primaryUptime, err := p.UptimeCalculator.CalculateUptimePercent( p.id, - constants.PrimaryNetworkID, ) if err != nil { p.Log.Debug(failedToGetUptimeLog, @@ -858,45 +799,12 @@ func (p *peer) getUptimes() (uint32, []*p2p.SubnetUptime) { primaryUptime = 0 } - subnetUptimes := make([]*p2p.SubnetUptime, 0, p.MySubnets.Len()) - for subnetID := range p.MySubnets { - if !p.trackedSubnets.Contains(subnetID) { - continue - } - - subnetUptime, err := p.UptimeCalculator.CalculateUptimePercent(p.id, subnetID) - if err != nil { - p.Log.Debug(failedToGetUptimeLog, - zap.Stringer("nodeID", p.id), - zap.Stringer("subnetID", subnetID), - zap.Error(err), - ) - continue - } - - subnetID := subnetID - subnetUptimes = append(subnetUptimes, &p2p.SubnetUptime{ - SubnetId: subnetID[:], - Uptime: uint32(subnetUptime * 100), - }) - } - primaryUptimePercent := uint32(primaryUptime * 100) - return primaryUptimePercent, subnetUptimes + return primaryUptimePercent } func (*peer) handlePong(*p2p.Pong) {} -// Record that the given peer perceives our uptime for the given [subnetID] -// to be [uptime]. -// Assumes [uptime] is in the range [0, 100] and [subnetID] is a valid ID of a -// subnet this peer tracks. -func (p *peer) observeUptime(subnetID ids.ID, uptime uint32) { - p.observedUptimesLock.Lock() - p.observedUptimes[subnetID] = uptime // [0, 100] percentage - p.observedUptimesLock.Unlock() -} - func (p *peer) handleHandshake(msg *p2p.Handshake) { if p.gotHandshake.Get() { p.Log.Debug(malformedMessageLog, diff --git a/network/peer/peer_test.go b/network/peer/peer_test.go index 0ae75b571f2..f66b523ce1e 100644 --- a/network/peer/peer_test.go +++ b/network/peer/peer_test.go @@ -17,7 +17,6 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/message" "github.com/ava-labs/avalanchego/network/throttling" - "github.com/ava-labs/avalanchego/proto/pb/p2p" "github.com/ava-labs/avalanchego/snow/networking/router" "github.com/ava-labs/avalanchego/snow/networking/tracker" "github.com/ava-labs/avalanchego/snow/uptime" @@ -210,122 +209,35 @@ func TestSend(t *testing.T) { } func TestPingUptimes(t *testing.T) { - trackedSubnetID := ids.GenerateTestID() - untrackedSubnetID := ids.GenerateTestID() - sharedConfig := newConfig(t) - sharedConfig.MySubnets = set.Of(trackedSubnetID) - - testCases := []struct { - name string - msg message.OutboundMessage - shouldClose bool - assertFn func(*require.Assertions, *testPeer) - }{ - { - name: "primary network only", - msg: func() message.OutboundMessage { - pingMsg, err := sharedConfig.MessageCreator.Ping(1, nil) - require.NoError(t, err) - return pingMsg - }(), - shouldClose: false, - assertFn: func(require *require.Assertions, peer *testPeer) { - uptime, ok := peer.ObservedUptime(constants.PrimaryNetworkID) - require.True(ok) - require.Equal(uint32(1), uptime) - - uptime, ok = peer.ObservedUptime(trackedSubnetID) - require.False(ok) - require.Zero(uptime) - }, - }, - { - name: "primary network and subnet", - msg: func() message.OutboundMessage { - pingMsg, err := sharedConfig.MessageCreator.Ping( - 1, - []*p2p.SubnetUptime{ - { - SubnetId: trackedSubnetID[:], - Uptime: 1, - }, - }, - ) - require.NoError(t, err) - return pingMsg - }(), - shouldClose: false, - assertFn: func(require *require.Assertions, peer *testPeer) { - uptime, ok := peer.ObservedUptime(constants.PrimaryNetworkID) - require.True(ok) - require.Equal(uint32(1), uptime) - - uptime, ok = peer.ObservedUptime(trackedSubnetID) - require.True(ok) - require.Equal(uint32(1), uptime) - }, - }, - { - name: "primary network and non tracked subnet", - msg: func() message.OutboundMessage { - pingMsg, err := sharedConfig.MessageCreator.Ping( - 1, - []*p2p.SubnetUptime{ - { - // Providing the untrackedSubnetID here should cause - // the remote peer to disconnect from us. - SubnetId: untrackedSubnetID[:], - Uptime: 1, - }, - { - SubnetId: trackedSubnetID[:], - Uptime: 1, - }, - }, - ) - require.NoError(t, err) - return pingMsg - }(), - shouldClose: true, - assertFn: nil, - }, - } // The raw peers are generated outside of the test cases to avoid generating // many TLS keys. rawPeer0 := newRawTestPeer(t, sharedConfig) rawPeer1 := newRawTestPeer(t, sharedConfig) - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - require := require.New(t) - - peer0, peer1 := startTestPeers(rawPeer0, rawPeer1) - awaitReady(t, peer0, peer1) - defer func() { - peer1.StartClose() - peer0.StartClose() - require.NoError(peer0.AwaitClosed(context.Background())) - require.NoError(peer1.AwaitClosed(context.Background())) - }() - - require.True(peer0.Send(context.Background(), tc.msg)) + require := require.New(t) - if tc.shouldClose { - require.NoError(peer1.AwaitClosed(context.Background())) - return - } + peer0, peer1 := startTestPeers(rawPeer0, rawPeer1) + awaitReady(t, peer0, peer1) + defer func() { + peer1.StartClose() + peer0.StartClose() + require.NoError(peer0.AwaitClosed(context.Background())) + require.NoError(peer1.AwaitClosed(context.Background())) + }() + pingMsg, err := sharedConfig.MessageCreator.Ping(1) + require.NoError(err) + require.True(peer0.Send(context.Background(), pingMsg)) - // we send Get message after ping to ensure Ping is handled by the - // time Get is handled. This is because Get is routed to the handler - // whereas Ping is handled by the peer directly. We have no way to - // know when the peer has handled the Ping message. - sendAndFlush(t, peer0, peer1) + // we send Get message after ping to ensure Ping is handled by the + // time Get is handled. This is because Get is routed to the handler + // whereas Ping is handled by the peer directly. We have no way to + // know when the peer has handled the Ping message. + sendAndFlush(t, peer0, peer1) - tc.assertFn(require, peer1) - }) - } + uptime := peer1.ObservedUptime() + require.Equal(uint32(1), uptime) } func TestTrackedSubnets(t *testing.T) { diff --git a/network/peer/set_test.go b/network/peer/set_test.go index c28c1ce7ea9..fb84b5e67d7 100644 --- a/network/peer/set_test.go +++ b/network/peer/set_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/utils/constants" + "github.com/ava-labs/avalanchego/utils" ) func TestSet(t *testing.T) { @@ -18,12 +18,12 @@ func TestSet(t *testing.T) { set := NewSet() peer1 := &peer{ - id: ids.BuildTestNodeID([]byte{0x01}), - observedUptimes: map[ids.ID]uint32{constants.PrimaryNetworkID: 0}, + id: ids.BuildTestNodeID([]byte{0x01}), + observedUptime: *utils.NewAtomic[uint32](0), } updatedPeer1 := &peer{ - id: ids.BuildTestNodeID([]byte{0x01}), - observedUptimes: map[ids.ID]uint32{constants.PrimaryNetworkID: 1}, + id: ids.BuildTestNodeID([]byte{0x01}), + observedUptime: *utils.NewAtomic[uint32](1), } peer2 := &peer{ id: ids.BuildTestNodeID([]byte{0x02}), @@ -42,8 +42,8 @@ func TestSet(t *testing.T) { set.Add(peer1) retrievedPeer1, peer1Found := set.GetByID(peer1.id) require.True(peer1Found) - observed1, _ := peer1.ObservedUptime(constants.PrimaryNetworkID) - observed2, _ := retrievedPeer1.ObservedUptime(constants.PrimaryNetworkID) + observed1 := peer1.ObservedUptime() + observed2 := retrievedPeer1.ObservedUptime() require.Equal(observed1, observed2) require.Equal(1, set.Len()) @@ -51,8 +51,8 @@ func TestSet(t *testing.T) { set.Add(updatedPeer1) retrievedPeer1, peer1Found = set.GetByID(peer1.id) require.True(peer1Found) - observed1, _ = updatedPeer1.ObservedUptime(constants.PrimaryNetworkID) - observed2, _ = retrievedPeer1.ObservedUptime(constants.PrimaryNetworkID) + observed1 = updatedPeer1.ObservedUptime() + observed2 = retrievedPeer1.ObservedUptime() require.Equal(observed1, observed2) require.Equal(1, set.Len()) @@ -60,8 +60,8 @@ func TestSet(t *testing.T) { set.Add(peer2) retrievedPeer2, peer2Found := set.GetByID(peer2.id) require.True(peer2Found) - observed1, _ = peer2.ObservedUptime(constants.PrimaryNetworkID) - observed2, _ = retrievedPeer2.ObservedUptime(constants.PrimaryNetworkID) + observed1 = peer2.ObservedUptime() + observed2 = retrievedPeer2.ObservedUptime() require.Equal(observed1, observed2) require.Equal(2, set.Len()) diff --git a/proto/p2p/p2p.proto b/proto/p2p/p2p.proto index 7df36717c56..43f1a880950 100644 --- a/proto/p2p/p2p.proto +++ b/proto/p2p/p2p.proto @@ -64,16 +64,7 @@ message Message { message Ping { // Uptime percentage on the primary network [0, 100] uint32 uptime = 1; - // Deprecated - repeated SubnetUptime subnet_uptimes = 2; -} - -// SubnetUptime is a descriptor for a peer's perceived uptime on a subnet. -message SubnetUptime { - // Subnet the peer is validating - bytes subnet_id = 1; - // Uptime percentage on the subnet [0, 100] - uint32 uptime = 2; + reserved 2; // Until Etna upgrade is activated. } // Pong is sent in response to a Ping. diff --git a/proto/pb/p2p/p2p.pb.go b/proto/pb/p2p/p2p.pb.go index 9b10923bbf2..9e5ba7727b8 100644 --- a/proto/pb/p2p/p2p.pb.go +++ b/proto/pb/p2p/p2p.pb.go @@ -498,8 +498,6 @@ type Ping struct { // Uptime percentage on the primary network [0, 100] Uptime uint32 `protobuf:"varint,1,opt,name=uptime,proto3" json:"uptime,omitempty"` - // Deprecated - SubnetUptimes []*SubnetUptime `protobuf:"bytes,2,rep,name=subnet_uptimes,json=subnetUptimes,proto3" json:"subnet_uptimes,omitempty"` } func (x *Ping) Reset() { @@ -541,71 +539,6 @@ func (x *Ping) GetUptime() uint32 { return 0 } -func (x *Ping) GetSubnetUptimes() []*SubnetUptime { - if x != nil { - return x.SubnetUptimes - } - return nil -} - -// SubnetUptime is a descriptor for a peer's perceived uptime on a subnet. -type SubnetUptime struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Subnet the peer is validating - SubnetId []byte `protobuf:"bytes,1,opt,name=subnet_id,json=subnetId,proto3" json:"subnet_id,omitempty"` - // Uptime percentage on the subnet [0, 100] - Uptime uint32 `protobuf:"varint,2,opt,name=uptime,proto3" json:"uptime,omitempty"` -} - -func (x *SubnetUptime) Reset() { - *x = SubnetUptime{} - if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubnetUptime) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SubnetUptime) ProtoMessage() {} - -func (x *SubnetUptime) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SubnetUptime.ProtoReflect.Descriptor instead. -func (*SubnetUptime) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{2} -} - -func (x *SubnetUptime) GetSubnetId() []byte { - if x != nil { - return x.SubnetId - } - return nil -} - -func (x *SubnetUptime) GetUptime() uint32 { - if x != nil { - return x.Uptime - } - return 0 -} - // Pong is sent in response to a Ping. type Pong struct { state protoimpl.MessageState @@ -616,7 +549,7 @@ type Pong struct { func (x *Pong) Reset() { *x = Pong{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[3] + mi := &file_p2p_p2p_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -629,7 +562,7 @@ func (x *Pong) String() string { func (*Pong) ProtoMessage() {} func (x *Pong) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[3] + mi := &file_p2p_p2p_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -642,7 +575,7 @@ func (x *Pong) ProtoReflect() protoreflect.Message { // Deprecated: Use Pong.ProtoReflect.Descriptor instead. func (*Pong) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{3} + return file_p2p_p2p_proto_rawDescGZIP(), []int{2} } // Handshake is the first outbound message sent to a peer when a connection is @@ -687,7 +620,7 @@ type Handshake struct { func (x *Handshake) Reset() { *x = Handshake{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[4] + mi := &file_p2p_p2p_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -700,7 +633,7 @@ func (x *Handshake) String() string { func (*Handshake) ProtoMessage() {} func (x *Handshake) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[4] + mi := &file_p2p_p2p_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -713,7 +646,7 @@ func (x *Handshake) ProtoReflect() protoreflect.Message { // Deprecated: Use Handshake.ProtoReflect.Descriptor instead. func (*Handshake) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{4} + return file_p2p_p2p_proto_rawDescGZIP(), []int{3} } func (x *Handshake) GetNetworkId() uint32 { @@ -824,7 +757,7 @@ type Client struct { func (x *Client) Reset() { *x = Client{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[5] + mi := &file_p2p_p2p_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -837,7 +770,7 @@ func (x *Client) String() string { func (*Client) ProtoMessage() {} func (x *Client) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[5] + mi := &file_p2p_p2p_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -850,7 +783,7 @@ func (x *Client) ProtoReflect() protoreflect.Message { // Deprecated: Use Client.ProtoReflect.Descriptor instead. func (*Client) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{5} + return file_p2p_p2p_proto_rawDescGZIP(), []int{4} } func (x *Client) GetName() string { @@ -894,7 +827,7 @@ type BloomFilter struct { func (x *BloomFilter) Reset() { *x = BloomFilter{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[6] + mi := &file_p2p_p2p_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -907,7 +840,7 @@ func (x *BloomFilter) String() string { func (*BloomFilter) ProtoMessage() {} func (x *BloomFilter) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[6] + mi := &file_p2p_p2p_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -920,7 +853,7 @@ func (x *BloomFilter) ProtoReflect() protoreflect.Message { // Deprecated: Use BloomFilter.ProtoReflect.Descriptor instead. func (*BloomFilter) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{6} + return file_p2p_p2p_proto_rawDescGZIP(), []int{5} } func (x *BloomFilter) GetFilter() []byte { @@ -960,7 +893,7 @@ type ClaimedIpPort struct { func (x *ClaimedIpPort) Reset() { *x = ClaimedIpPort{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[7] + mi := &file_p2p_p2p_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -973,7 +906,7 @@ func (x *ClaimedIpPort) String() string { func (*ClaimedIpPort) ProtoMessage() {} func (x *ClaimedIpPort) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[7] + mi := &file_p2p_p2p_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -986,7 +919,7 @@ func (x *ClaimedIpPort) ProtoReflect() protoreflect.Message { // Deprecated: Use ClaimedIpPort.ProtoReflect.Descriptor instead. func (*ClaimedIpPort) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{7} + return file_p2p_p2p_proto_rawDescGZIP(), []int{6} } func (x *ClaimedIpPort) GetX509Certificate() []byte { @@ -1049,7 +982,7 @@ type GetPeerList struct { func (x *GetPeerList) Reset() { *x = GetPeerList{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[8] + mi := &file_p2p_p2p_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1062,7 +995,7 @@ func (x *GetPeerList) String() string { func (*GetPeerList) ProtoMessage() {} func (x *GetPeerList) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[8] + mi := &file_p2p_p2p_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1075,7 +1008,7 @@ func (x *GetPeerList) ProtoReflect() protoreflect.Message { // Deprecated: Use GetPeerList.ProtoReflect.Descriptor instead. func (*GetPeerList) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{8} + return file_p2p_p2p_proto_rawDescGZIP(), []int{7} } func (x *GetPeerList) GetKnownPeers() *BloomFilter { @@ -1112,7 +1045,7 @@ type PeerList struct { func (x *PeerList) Reset() { *x = PeerList{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[9] + mi := &file_p2p_p2p_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1125,7 +1058,7 @@ func (x *PeerList) String() string { func (*PeerList) ProtoMessage() {} func (x *PeerList) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[9] + mi := &file_p2p_p2p_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1138,7 +1071,7 @@ func (x *PeerList) ProtoReflect() protoreflect.Message { // Deprecated: Use PeerList.ProtoReflect.Descriptor instead. func (*PeerList) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{9} + return file_p2p_p2p_proto_rawDescGZIP(), []int{8} } func (x *PeerList) GetClaimedIpPorts() []*ClaimedIpPort { @@ -1166,7 +1099,7 @@ type GetStateSummaryFrontier struct { func (x *GetStateSummaryFrontier) Reset() { *x = GetStateSummaryFrontier{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[10] + mi := &file_p2p_p2p_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1179,7 +1112,7 @@ func (x *GetStateSummaryFrontier) String() string { func (*GetStateSummaryFrontier) ProtoMessage() {} func (x *GetStateSummaryFrontier) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[10] + mi := &file_p2p_p2p_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1192,7 +1125,7 @@ func (x *GetStateSummaryFrontier) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStateSummaryFrontier.ProtoReflect.Descriptor instead. func (*GetStateSummaryFrontier) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{10} + return file_p2p_p2p_proto_rawDescGZIP(), []int{9} } func (x *GetStateSummaryFrontier) GetChainId() []byte { @@ -1233,7 +1166,7 @@ type StateSummaryFrontier struct { func (x *StateSummaryFrontier) Reset() { *x = StateSummaryFrontier{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[11] + mi := &file_p2p_p2p_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1246,7 +1179,7 @@ func (x *StateSummaryFrontier) String() string { func (*StateSummaryFrontier) ProtoMessage() {} func (x *StateSummaryFrontier) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[11] + mi := &file_p2p_p2p_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1259,7 +1192,7 @@ func (x *StateSummaryFrontier) ProtoReflect() protoreflect.Message { // Deprecated: Use StateSummaryFrontier.ProtoReflect.Descriptor instead. func (*StateSummaryFrontier) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{11} + return file_p2p_p2p_proto_rawDescGZIP(), []int{10} } func (x *StateSummaryFrontier) GetChainId() []byte { @@ -1303,7 +1236,7 @@ type GetAcceptedStateSummary struct { func (x *GetAcceptedStateSummary) Reset() { *x = GetAcceptedStateSummary{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[12] + mi := &file_p2p_p2p_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1316,7 +1249,7 @@ func (x *GetAcceptedStateSummary) String() string { func (*GetAcceptedStateSummary) ProtoMessage() {} func (x *GetAcceptedStateSummary) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[12] + mi := &file_p2p_p2p_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1329,7 +1262,7 @@ func (x *GetAcceptedStateSummary) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAcceptedStateSummary.ProtoReflect.Descriptor instead. func (*GetAcceptedStateSummary) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{12} + return file_p2p_p2p_proto_rawDescGZIP(), []int{11} } func (x *GetAcceptedStateSummary) GetChainId() []byte { @@ -1377,7 +1310,7 @@ type AcceptedStateSummary struct { func (x *AcceptedStateSummary) Reset() { *x = AcceptedStateSummary{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[13] + mi := &file_p2p_p2p_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1390,7 +1323,7 @@ func (x *AcceptedStateSummary) String() string { func (*AcceptedStateSummary) ProtoMessage() {} func (x *AcceptedStateSummary) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[13] + mi := &file_p2p_p2p_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1403,7 +1336,7 @@ func (x *AcceptedStateSummary) ProtoReflect() protoreflect.Message { // Deprecated: Use AcceptedStateSummary.ProtoReflect.Descriptor instead. func (*AcceptedStateSummary) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{13} + return file_p2p_p2p_proto_rawDescGZIP(), []int{12} } func (x *AcceptedStateSummary) GetChainId() []byte { @@ -1446,7 +1379,7 @@ type GetAcceptedFrontier struct { func (x *GetAcceptedFrontier) Reset() { *x = GetAcceptedFrontier{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[14] + mi := &file_p2p_p2p_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1459,7 +1392,7 @@ func (x *GetAcceptedFrontier) String() string { func (*GetAcceptedFrontier) ProtoMessage() {} func (x *GetAcceptedFrontier) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[14] + mi := &file_p2p_p2p_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1472,7 +1405,7 @@ func (x *GetAcceptedFrontier) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAcceptedFrontier.ProtoReflect.Descriptor instead. func (*GetAcceptedFrontier) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{14} + return file_p2p_p2p_proto_rawDescGZIP(), []int{13} } func (x *GetAcceptedFrontier) GetChainId() []byte { @@ -1515,7 +1448,7 @@ type AcceptedFrontier struct { func (x *AcceptedFrontier) Reset() { *x = AcceptedFrontier{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[15] + mi := &file_p2p_p2p_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1528,7 +1461,7 @@ func (x *AcceptedFrontier) String() string { func (*AcceptedFrontier) ProtoMessage() {} func (x *AcceptedFrontier) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[15] + mi := &file_p2p_p2p_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1541,7 +1474,7 @@ func (x *AcceptedFrontier) ProtoReflect() protoreflect.Message { // Deprecated: Use AcceptedFrontier.ProtoReflect.Descriptor instead. func (*AcceptedFrontier) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{15} + return file_p2p_p2p_proto_rawDescGZIP(), []int{14} } func (x *AcceptedFrontier) GetChainId() []byte { @@ -1587,7 +1520,7 @@ type GetAccepted struct { func (x *GetAccepted) Reset() { *x = GetAccepted{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[16] + mi := &file_p2p_p2p_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1600,7 +1533,7 @@ func (x *GetAccepted) String() string { func (*GetAccepted) ProtoMessage() {} func (x *GetAccepted) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[16] + mi := &file_p2p_p2p_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1613,7 +1546,7 @@ func (x *GetAccepted) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAccepted.ProtoReflect.Descriptor instead. func (*GetAccepted) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{16} + return file_p2p_p2p_proto_rawDescGZIP(), []int{15} } func (x *GetAccepted) GetChainId() []byte { @@ -1664,7 +1597,7 @@ type Accepted struct { func (x *Accepted) Reset() { *x = Accepted{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[17] + mi := &file_p2p_p2p_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1677,7 +1610,7 @@ func (x *Accepted) String() string { func (*Accepted) ProtoMessage() {} func (x *Accepted) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[17] + mi := &file_p2p_p2p_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1690,7 +1623,7 @@ func (x *Accepted) ProtoReflect() protoreflect.Message { // Deprecated: Use Accepted.ProtoReflect.Descriptor instead. func (*Accepted) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{17} + return file_p2p_p2p_proto_rawDescGZIP(), []int{16} } func (x *Accepted) GetChainId() []byte { @@ -1737,7 +1670,7 @@ type GetAncestors struct { func (x *GetAncestors) Reset() { *x = GetAncestors{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[18] + mi := &file_p2p_p2p_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1750,7 +1683,7 @@ func (x *GetAncestors) String() string { func (*GetAncestors) ProtoMessage() {} func (x *GetAncestors) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[18] + mi := &file_p2p_p2p_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1763,7 +1696,7 @@ func (x *GetAncestors) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAncestors.ProtoReflect.Descriptor instead. func (*GetAncestors) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{18} + return file_p2p_p2p_proto_rawDescGZIP(), []int{17} } func (x *GetAncestors) GetChainId() []byte { @@ -1821,7 +1754,7 @@ type Ancestors struct { func (x *Ancestors) Reset() { *x = Ancestors{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[19] + mi := &file_p2p_p2p_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1834,7 +1767,7 @@ func (x *Ancestors) String() string { func (*Ancestors) ProtoMessage() {} func (x *Ancestors) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[19] + mi := &file_p2p_p2p_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1847,7 +1780,7 @@ func (x *Ancestors) ProtoReflect() protoreflect.Message { // Deprecated: Use Ancestors.ProtoReflect.Descriptor instead. func (*Ancestors) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{19} + return file_p2p_p2p_proto_rawDescGZIP(), []int{18} } func (x *Ancestors) GetChainId() []byte { @@ -1892,7 +1825,7 @@ type Get struct { func (x *Get) Reset() { *x = Get{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[20] + mi := &file_p2p_p2p_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1905,7 +1838,7 @@ func (x *Get) String() string { func (*Get) ProtoMessage() {} func (x *Get) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[20] + mi := &file_p2p_p2p_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1918,7 +1851,7 @@ func (x *Get) ProtoReflect() protoreflect.Message { // Deprecated: Use Get.ProtoReflect.Descriptor instead. func (*Get) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{20} + return file_p2p_p2p_proto_rawDescGZIP(), []int{19} } func (x *Get) GetChainId() []byte { @@ -1966,7 +1899,7 @@ type Put struct { func (x *Put) Reset() { *x = Put{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[21] + mi := &file_p2p_p2p_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1979,7 +1912,7 @@ func (x *Put) String() string { func (*Put) ProtoMessage() {} func (x *Put) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[21] + mi := &file_p2p_p2p_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1992,7 +1925,7 @@ func (x *Put) ProtoReflect() protoreflect.Message { // Deprecated: Use Put.ProtoReflect.Descriptor instead. func (*Put) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{21} + return file_p2p_p2p_proto_rawDescGZIP(), []int{20} } func (x *Put) GetChainId() []byte { @@ -2039,7 +1972,7 @@ type PushQuery struct { func (x *PushQuery) Reset() { *x = PushQuery{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[22] + mi := &file_p2p_p2p_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2052,7 +1985,7 @@ func (x *PushQuery) String() string { func (*PushQuery) ProtoMessage() {} func (x *PushQuery) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[22] + mi := &file_p2p_p2p_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2065,7 +1998,7 @@ func (x *PushQuery) ProtoReflect() protoreflect.Message { // Deprecated: Use PushQuery.ProtoReflect.Descriptor instead. func (*PushQuery) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{22} + return file_p2p_p2p_proto_rawDescGZIP(), []int{21} } func (x *PushQuery) GetChainId() []byte { @@ -2126,7 +2059,7 @@ type PullQuery struct { func (x *PullQuery) Reset() { *x = PullQuery{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[23] + mi := &file_p2p_p2p_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2139,7 +2072,7 @@ func (x *PullQuery) String() string { func (*PullQuery) ProtoMessage() {} func (x *PullQuery) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[23] + mi := &file_p2p_p2p_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2152,7 +2085,7 @@ func (x *PullQuery) ProtoReflect() protoreflect.Message { // Deprecated: Use PullQuery.ProtoReflect.Descriptor instead. func (*PullQuery) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{23} + return file_p2p_p2p_proto_rawDescGZIP(), []int{22} } func (x *PullQuery) GetChainId() []byte { @@ -2212,7 +2145,7 @@ type Chits struct { func (x *Chits) Reset() { *x = Chits{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[24] + mi := &file_p2p_p2p_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2225,7 +2158,7 @@ func (x *Chits) String() string { func (*Chits) ProtoMessage() {} func (x *Chits) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[24] + mi := &file_p2p_p2p_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2238,7 +2171,7 @@ func (x *Chits) ProtoReflect() protoreflect.Message { // Deprecated: Use Chits.ProtoReflect.Descriptor instead. func (*Chits) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{24} + return file_p2p_p2p_proto_rawDescGZIP(), []int{23} } func (x *Chits) GetChainId() []byte { @@ -2298,7 +2231,7 @@ type AppRequest struct { func (x *AppRequest) Reset() { *x = AppRequest{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[25] + mi := &file_p2p_p2p_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2311,7 +2244,7 @@ func (x *AppRequest) String() string { func (*AppRequest) ProtoMessage() {} func (x *AppRequest) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[25] + mi := &file_p2p_p2p_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2324,7 +2257,7 @@ func (x *AppRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AppRequest.ProtoReflect.Descriptor instead. func (*AppRequest) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{25} + return file_p2p_p2p_proto_rawDescGZIP(), []int{24} } func (x *AppRequest) GetChainId() []byte { @@ -2372,7 +2305,7 @@ type AppResponse struct { func (x *AppResponse) Reset() { *x = AppResponse{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[26] + mi := &file_p2p_p2p_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2385,7 +2318,7 @@ func (x *AppResponse) String() string { func (*AppResponse) ProtoMessage() {} func (x *AppResponse) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[26] + mi := &file_p2p_p2p_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2398,7 +2331,7 @@ func (x *AppResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AppResponse.ProtoReflect.Descriptor instead. func (*AppResponse) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{26} + return file_p2p_p2p_proto_rawDescGZIP(), []int{25} } func (x *AppResponse) GetChainId() []byte { @@ -2441,7 +2374,7 @@ type AppError struct { func (x *AppError) Reset() { *x = AppError{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[27] + mi := &file_p2p_p2p_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2454,7 +2387,7 @@ func (x *AppError) String() string { func (*AppError) ProtoMessage() {} func (x *AppError) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[27] + mi := &file_p2p_p2p_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2467,7 +2400,7 @@ func (x *AppError) ProtoReflect() protoreflect.Message { // Deprecated: Use AppError.ProtoReflect.Descriptor instead. func (*AppError) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{27} + return file_p2p_p2p_proto_rawDescGZIP(), []int{26} } func (x *AppError) GetChainId() []byte { @@ -2513,7 +2446,7 @@ type AppGossip struct { func (x *AppGossip) Reset() { *x = AppGossip{} if protoimpl.UnsafeEnabled { - mi := &file_p2p_p2p_proto_msgTypes[28] + mi := &file_p2p_p2p_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2526,7 +2459,7 @@ func (x *AppGossip) String() string { func (*AppGossip) ProtoMessage() {} func (x *AppGossip) ProtoReflect() protoreflect.Message { - mi := &file_p2p_p2p_proto_msgTypes[28] + mi := &file_p2p_p2p_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2539,7 +2472,7 @@ func (x *AppGossip) ProtoReflect() protoreflect.Message { // Deprecated: Use AppGossip.ProtoReflect.Descriptor instead. func (*AppGossip) Descriptor() ([]byte, []int) { - return file_p2p_p2p_proto_rawDescGZIP(), []int{28} + return file_p2p_p2p_proto_rawDescGZIP(), []int{27} } func (x *AppGossip) GetChainId() []byte { @@ -2647,244 +2580,236 @@ var file_p2p_p2p_proto_rawDesc = []byte{ 0x6f, 0x72, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x41, 0x70, 0x70, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x48, 0x00, 0x52, 0x08, 0x61, 0x70, 0x70, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4a, 0x04, - 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x24, 0x10, 0x25, 0x22, 0x58, 0x0a, 0x04, 0x50, 0x69, + 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x24, 0x10, 0x25, 0x22, 0x24, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x0e, 0x73, 0x75, - 0x62, 0x6e, 0x65, 0x74, 0x5f, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x55, - 0x70, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x55, 0x70, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x22, 0x43, 0x0a, 0x0c, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x55, 0x70, - 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x49, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x12, 0x0a, 0x04, 0x50, 0x6f, 0x6e, - 0x67, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, 0x22, 0xd4, 0x03, - 0x0a, 0x09, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x09, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x79, - 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6d, 0x79, 0x54, - 0x69, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x4a, 0x04, 0x08, 0x02, 0x10, 0x03, + 0x22, 0x12, 0x0a, 0x04, 0x50, 0x6f, 0x6e, 0x67, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x4a, 0x04, + 0x08, 0x02, 0x10, 0x03, 0x22, 0xd4, 0x03, 0x0a, 0x09, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, + 0x6b, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, + 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x06, 0x6d, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x69, 0x70, 0x41, + 0x64, 0x64, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x26, 0x0a, 0x0f, + 0x69, 0x70, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x69, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0e, 0x69, 0x70, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, + 0x69, 0x64, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x70, + 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x53, 0x69, 0x67, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, + 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, + 0x28, 0x0c, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x53, 0x75, 0x62, 0x6e, 0x65, + 0x74, 0x73, 0x12, 0x23, 0x0a, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, + 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x70, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x41, 0x63, 0x70, 0x73, 0x12, 0x23, + 0x0a, 0x0d, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x70, 0x73, 0x18, + 0x0b, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x41, + 0x63, 0x70, 0x73, 0x12, 0x31, 0x0a, 0x0b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x65, 0x65, + 0x72, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x42, + 0x6c, 0x6f, 0x6f, 0x6d, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x6b, 0x6e, 0x6f, 0x77, + 0x6e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x0a, 0x0a, 0x69, 0x70, 0x5f, 0x62, 0x6c, 0x73, + 0x5f, 0x73, 0x69, 0x67, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x69, 0x70, 0x42, 0x6c, + 0x73, 0x53, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x75, 0x62, 0x6e, + 0x65, 0x74, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x53, 0x75, + 0x62, 0x6e, 0x65, 0x74, 0x73, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x5e, 0x0a, 0x06, 0x43, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, + 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, + 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, + 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x22, 0x39, 0x0a, 0x0b, 0x42, + 0x6c, 0x6f, 0x6f, 0x6d, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, + 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x22, 0xbd, 0x01, 0x0a, 0x0d, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x65, 0x64, 0x49, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x78, 0x35, 0x30, 0x39, + 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0f, 0x78, 0x35, 0x30, 0x39, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x12, 0x17, 0x0a, 0x07, - 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, - 0x70, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x69, 0x70, 0x5f, 0x73, 0x69, 0x67, 0x6e, - 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, - 0x69, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, - 0x0e, 0x69, 0x70, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x73, 0x69, 0x67, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x70, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x53, - 0x69, 0x67, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x73, 0x75, - 0x62, 0x6e, 0x65, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, 0x74, 0x72, 0x61, - 0x63, 0x6b, 0x65, 0x64, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, 0x12, 0x23, 0x0a, 0x06, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x32, - 0x70, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x63, - 0x70, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x64, 0x41, 0x63, 0x70, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x5f, 0x61, 0x63, 0x70, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x0c, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x41, 0x63, 0x70, 0x73, 0x12, 0x31, 0x0a, 0x0b, - 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x42, 0x6c, 0x6f, 0x6f, 0x6d, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x52, 0x0a, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, - 0x1c, 0x0a, 0x0a, 0x69, 0x70, 0x5f, 0x62, 0x6c, 0x73, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x0d, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x08, 0x69, 0x70, 0x42, 0x6c, 0x73, 0x53, 0x69, 0x67, 0x12, 0x1f, 0x0a, - 0x0b, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, 0x18, 0x0e, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, 0x4a, 0x04, - 0x08, 0x05, 0x10, 0x06, 0x22, 0x5e, 0x0a, 0x06, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, - 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x70, - 0x61, 0x74, 0x63, 0x68, 0x22, 0x39, 0x0a, 0x0b, 0x42, 0x6c, 0x6f, 0x6f, 0x6d, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x73, - 0x61, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x61, 0x6c, 0x74, 0x22, - 0xbd, 0x01, 0x0a, 0x0d, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x49, 0x70, 0x50, 0x6f, 0x72, - 0x74, 0x12, 0x29, 0x0a, 0x10, 0x78, 0x35, 0x30, 0x39, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x78, 0x35, 0x30, - 0x39, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, - 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x69, - 0x70, 0x41, 0x64, 0x64, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1c, - 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09, - 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x13, 0x0a, 0x05, 0x74, 0x78, - 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x74, 0x78, 0x49, 0x64, 0x22, - 0x61, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x31, - 0x0a, 0x0b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x42, 0x6c, 0x6f, 0x6f, 0x6d, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x6e, 0x65, - 0x74, 0x73, 0x22, 0x48, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3c, - 0x0a, 0x10, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x5f, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, - 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x49, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x63, 0x6c, - 0x61, 0x69, 0x6d, 0x65, 0x64, 0x49, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x22, 0x6f, 0x0a, 0x17, - 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x46, - 0x72, 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, - 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x6a, 0x0a, - 0x14, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x46, 0x72, 0x6f, - 0x6e, 0x74, 0x69, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, - 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x22, 0x89, 0x01, 0x0a, 0x17, 0x47, 0x65, - 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, - 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x68, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x04, 0x52, 0x07, 0x68, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x73, 0x22, 0x71, 0x0a, 0x14, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, - 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x19, 0x0a, - 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x49, 0x64, 0x73, 0x22, 0x71, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x41, - 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x12, - 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, - 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, - 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x6f, 0x0a, 0x10, 0x41, - 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x12, - 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x22, 0x8e, 0x01, 0x0a, - 0x0b, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, + 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, + 0x70, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x13, 0x0a, 0x05, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x04, 0x74, 0x78, 0x49, 0x64, 0x22, 0x61, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, + 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x0b, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x70, + 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x32, 0x70, + 0x2e, 0x42, 0x6c, 0x6f, 0x6f, 0x6d, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x6b, 0x6e, + 0x6f, 0x77, 0x6e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x5f, + 0x73, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, + 0x6c, 0x6c, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, 0x22, 0x48, 0x0a, 0x08, 0x50, 0x65, 0x65, + 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x10, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, + 0x5f, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x49, 0x70, 0x50, + 0x6f, 0x72, 0x74, 0x52, 0x0e, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x65, 0x64, 0x49, 0x70, 0x50, 0x6f, + 0x72, 0x74, 0x73, 0x22, 0x6f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, + 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x12, 0x19, + 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, + 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, + 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x6a, 0x0a, 0x14, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, + 0x6d, 0x61, 0x72, 0x79, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, + 0x22, 0x89, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, - 0x6e, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x69, 0x0a, - 0x08, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0xb9, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, - 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, - 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0b, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x5f, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x45, 0x6e, - 0x67, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x22, 0x65, 0x0a, 0x09, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, - 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, - 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x03, - 0x47, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x04, 0x52, 0x07, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x22, 0x71, 0x0a, 0x14, + 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x75, 0x6d, + 0x6d, 0x61, 0x72, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1f, + 0x0a, 0x0b, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x49, 0x64, 0x73, 0x22, + 0x71, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x46, 0x72, + 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x4a, 0x04, 0x08, 0x04, + 0x10, 0x05, 0x22, 0x6f, 0x0a, 0x10, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x46, 0x72, + 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, + 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x64, 0x22, 0x8e, 0x01, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x70, + 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, - 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x4a, 0x04, 0x08, 0x05, - 0x10, 0x06, 0x22, 0x5d, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, - 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, - 0x72, 0x22, 0xb0, 0x01, 0x0a, 0x09, 0x50, 0x75, 0x73, 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, - 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, - 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, - 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, - 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4a, 0x04, - 0x08, 0x05, 0x10, 0x06, 0x22, 0xb5, 0x01, 0x0a, 0x09, 0x50, 0x75, 0x6c, 0x6c, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, - 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, - 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, - 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, - 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, - 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, - 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xba, 0x01, 0x0a, - 0x05, 0x43, 0x68, 0x69, 0x74, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, + 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, + 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x4a, 0x04, + 0x08, 0x05, 0x10, 0x06, 0x22, 0x69, 0x0a, 0x08, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, + 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0c, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, + 0xb9, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, + 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, + 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, + 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, + 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x30, 0x0a, 0x0b, 0x65, 0x6e, 0x67, + 0x69, 0x6e, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, + 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x0a, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x65, 0x0a, 0x09, 0x41, + 0x6e, 0x63, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, + 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, + 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, + 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x49, 0x64, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0x5d, 0x0a, 0x03, 0x50, 0x75, 0x74, + 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x22, 0xb0, 0x01, 0x0a, 0x09, 0x50, 0x75, 0x73, + 0x68, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, - 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x69, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, - 0x64, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x5f, - 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, - 0x65, 0x64, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x16, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, - 0x64, 0x5f, 0x69, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x49, - 0x64, 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x7f, 0x0a, 0x0a, 0x41, 0x70, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, - 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1b, 0x0a, - 0x09, 0x61, 0x70, 0x70, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x08, 0x61, 0x70, 0x70, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x64, 0x0a, 0x0b, 0x41, 0x70, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, + 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1c, 0x0a, 0x09, + 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x48, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x22, 0xb5, 0x01, 0x0a, 0x09, + 0x50, 0x75, 0x6c, 0x6c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x70, 0x70, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x61, 0x70, 0x70, 0x42, 0x79, 0x74, 0x65, 0x73, - 0x22, 0x88, 0x01, 0x0a, 0x08, 0x41, 0x70, 0x70, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x19, 0x0a, + 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, + 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, + 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4a, 0x04, 0x08, + 0x05, 0x10, 0x06, 0x22, 0xba, 0x01, 0x0a, 0x05, 0x43, 0x68, 0x69, 0x74, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x09, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x43, 0x0a, 0x09, 0x41, - 0x70, 0x70, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x70, 0x70, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x61, 0x70, 0x70, 0x42, 0x79, 0x74, 0x65, 0x73, - 0x2a, 0x5d, 0x0a, 0x0a, 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, - 0x0a, 0x17, 0x45, 0x4e, 0x47, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x45, - 0x4e, 0x47, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x41, 0x56, 0x41, 0x4c, 0x41, - 0x4e, 0x43, 0x48, 0x45, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x4e, 0x47, 0x49, 0x4e, 0x45, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x4e, 0x4f, 0x57, 0x4d, 0x41, 0x4e, 0x10, 0x02, 0x42, - 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x76, - 0x61, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x61, 0x76, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x68, 0x65, - 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x2f, 0x70, 0x32, 0x70, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x72, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x70, + 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x63, + 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0a, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x16, 0x70, + 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x69, 0x64, 0x5f, 0x61, 0x74, 0x5f, 0x68, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x70, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x49, 0x64, 0x41, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x22, 0x7f, 0x0a, 0x0a, 0x41, 0x70, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x61, 0x64, + 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x61, 0x64, + 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x70, 0x70, 0x5f, 0x62, 0x79, 0x74, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x61, 0x70, 0x70, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x22, 0x64, 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x70, + 0x70, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x61, + 0x70, 0x70, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x08, 0x41, 0x70, 0x70, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1d, + 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x11, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, + 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x22, 0x43, 0x0a, 0x09, 0x41, 0x70, 0x70, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x12, + 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x70, + 0x70, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x61, + 0x70, 0x70, 0x42, 0x79, 0x74, 0x65, 0x73, 0x2a, 0x5d, 0x0a, 0x0a, 0x45, 0x6e, 0x67, 0x69, 0x6e, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x45, 0x4e, 0x47, 0x49, 0x4e, 0x45, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x45, 0x4e, 0x47, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x41, 0x56, 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x48, 0x45, 0x10, 0x01, 0x12, 0x17, 0x0a, + 0x13, 0x45, 0x4e, 0x47, 0x49, 0x4e, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x4e, 0x4f, + 0x57, 0x4d, 0x41, 0x4e, 0x10, 0x02, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x76, 0x61, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x61, 0x76, + 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x62, 0x2f, 0x70, 0x32, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2900,75 +2825,73 @@ func file_p2p_p2p_proto_rawDescGZIP() []byte { } var file_p2p_p2p_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_p2p_p2p_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_p2p_p2p_proto_msgTypes = make([]protoimpl.MessageInfo, 28) var file_p2p_p2p_proto_goTypes = []interface{}{ (EngineType)(0), // 0: p2p.EngineType (*Message)(nil), // 1: p2p.Message (*Ping)(nil), // 2: p2p.Ping - (*SubnetUptime)(nil), // 3: p2p.SubnetUptime - (*Pong)(nil), // 4: p2p.Pong - (*Handshake)(nil), // 5: p2p.Handshake - (*Client)(nil), // 6: p2p.Client - (*BloomFilter)(nil), // 7: p2p.BloomFilter - (*ClaimedIpPort)(nil), // 8: p2p.ClaimedIpPort - (*GetPeerList)(nil), // 9: p2p.GetPeerList - (*PeerList)(nil), // 10: p2p.PeerList - (*GetStateSummaryFrontier)(nil), // 11: p2p.GetStateSummaryFrontier - (*StateSummaryFrontier)(nil), // 12: p2p.StateSummaryFrontier - (*GetAcceptedStateSummary)(nil), // 13: p2p.GetAcceptedStateSummary - (*AcceptedStateSummary)(nil), // 14: p2p.AcceptedStateSummary - (*GetAcceptedFrontier)(nil), // 15: p2p.GetAcceptedFrontier - (*AcceptedFrontier)(nil), // 16: p2p.AcceptedFrontier - (*GetAccepted)(nil), // 17: p2p.GetAccepted - (*Accepted)(nil), // 18: p2p.Accepted - (*GetAncestors)(nil), // 19: p2p.GetAncestors - (*Ancestors)(nil), // 20: p2p.Ancestors - (*Get)(nil), // 21: p2p.Get - (*Put)(nil), // 22: p2p.Put - (*PushQuery)(nil), // 23: p2p.PushQuery - (*PullQuery)(nil), // 24: p2p.PullQuery - (*Chits)(nil), // 25: p2p.Chits - (*AppRequest)(nil), // 26: p2p.AppRequest - (*AppResponse)(nil), // 27: p2p.AppResponse - (*AppError)(nil), // 28: p2p.AppError - (*AppGossip)(nil), // 29: p2p.AppGossip + (*Pong)(nil), // 3: p2p.Pong + (*Handshake)(nil), // 4: p2p.Handshake + (*Client)(nil), // 5: p2p.Client + (*BloomFilter)(nil), // 6: p2p.BloomFilter + (*ClaimedIpPort)(nil), // 7: p2p.ClaimedIpPort + (*GetPeerList)(nil), // 8: p2p.GetPeerList + (*PeerList)(nil), // 9: p2p.PeerList + (*GetStateSummaryFrontier)(nil), // 10: p2p.GetStateSummaryFrontier + (*StateSummaryFrontier)(nil), // 11: p2p.StateSummaryFrontier + (*GetAcceptedStateSummary)(nil), // 12: p2p.GetAcceptedStateSummary + (*AcceptedStateSummary)(nil), // 13: p2p.AcceptedStateSummary + (*GetAcceptedFrontier)(nil), // 14: p2p.GetAcceptedFrontier + (*AcceptedFrontier)(nil), // 15: p2p.AcceptedFrontier + (*GetAccepted)(nil), // 16: p2p.GetAccepted + (*Accepted)(nil), // 17: p2p.Accepted + (*GetAncestors)(nil), // 18: p2p.GetAncestors + (*Ancestors)(nil), // 19: p2p.Ancestors + (*Get)(nil), // 20: p2p.Get + (*Put)(nil), // 21: p2p.Put + (*PushQuery)(nil), // 22: p2p.PushQuery + (*PullQuery)(nil), // 23: p2p.PullQuery + (*Chits)(nil), // 24: p2p.Chits + (*AppRequest)(nil), // 25: p2p.AppRequest + (*AppResponse)(nil), // 26: p2p.AppResponse + (*AppError)(nil), // 27: p2p.AppError + (*AppGossip)(nil), // 28: p2p.AppGossip } var file_p2p_p2p_proto_depIdxs = []int32{ 2, // 0: p2p.Message.ping:type_name -> p2p.Ping - 4, // 1: p2p.Message.pong:type_name -> p2p.Pong - 5, // 2: p2p.Message.handshake:type_name -> p2p.Handshake - 9, // 3: p2p.Message.get_peer_list:type_name -> p2p.GetPeerList - 10, // 4: p2p.Message.peer_list:type_name -> p2p.PeerList - 11, // 5: p2p.Message.get_state_summary_frontier:type_name -> p2p.GetStateSummaryFrontier - 12, // 6: p2p.Message.state_summary_frontier:type_name -> p2p.StateSummaryFrontier - 13, // 7: p2p.Message.get_accepted_state_summary:type_name -> p2p.GetAcceptedStateSummary - 14, // 8: p2p.Message.accepted_state_summary:type_name -> p2p.AcceptedStateSummary - 15, // 9: p2p.Message.get_accepted_frontier:type_name -> p2p.GetAcceptedFrontier - 16, // 10: p2p.Message.accepted_frontier:type_name -> p2p.AcceptedFrontier - 17, // 11: p2p.Message.get_accepted:type_name -> p2p.GetAccepted - 18, // 12: p2p.Message.accepted:type_name -> p2p.Accepted - 19, // 13: p2p.Message.get_ancestors:type_name -> p2p.GetAncestors - 20, // 14: p2p.Message.ancestors:type_name -> p2p.Ancestors - 21, // 15: p2p.Message.get:type_name -> p2p.Get - 22, // 16: p2p.Message.put:type_name -> p2p.Put - 23, // 17: p2p.Message.push_query:type_name -> p2p.PushQuery - 24, // 18: p2p.Message.pull_query:type_name -> p2p.PullQuery - 25, // 19: p2p.Message.chits:type_name -> p2p.Chits - 26, // 20: p2p.Message.app_request:type_name -> p2p.AppRequest - 27, // 21: p2p.Message.app_response:type_name -> p2p.AppResponse - 29, // 22: p2p.Message.app_gossip:type_name -> p2p.AppGossip - 28, // 23: p2p.Message.app_error:type_name -> p2p.AppError - 3, // 24: p2p.Ping.subnet_uptimes:type_name -> p2p.SubnetUptime - 6, // 25: p2p.Handshake.client:type_name -> p2p.Client - 7, // 26: p2p.Handshake.known_peers:type_name -> p2p.BloomFilter - 7, // 27: p2p.GetPeerList.known_peers:type_name -> p2p.BloomFilter - 8, // 28: p2p.PeerList.claimed_ip_ports:type_name -> p2p.ClaimedIpPort - 0, // 29: p2p.GetAncestors.engine_type:type_name -> p2p.EngineType - 30, // [30:30] is the sub-list for method output_type - 30, // [30:30] is the sub-list for method input_type - 30, // [30:30] is the sub-list for extension type_name - 30, // [30:30] is the sub-list for extension extendee - 0, // [0:30] is the sub-list for field type_name + 3, // 1: p2p.Message.pong:type_name -> p2p.Pong + 4, // 2: p2p.Message.handshake:type_name -> p2p.Handshake + 8, // 3: p2p.Message.get_peer_list:type_name -> p2p.GetPeerList + 9, // 4: p2p.Message.peer_list:type_name -> p2p.PeerList + 10, // 5: p2p.Message.get_state_summary_frontier:type_name -> p2p.GetStateSummaryFrontier + 11, // 6: p2p.Message.state_summary_frontier:type_name -> p2p.StateSummaryFrontier + 12, // 7: p2p.Message.get_accepted_state_summary:type_name -> p2p.GetAcceptedStateSummary + 13, // 8: p2p.Message.accepted_state_summary:type_name -> p2p.AcceptedStateSummary + 14, // 9: p2p.Message.get_accepted_frontier:type_name -> p2p.GetAcceptedFrontier + 15, // 10: p2p.Message.accepted_frontier:type_name -> p2p.AcceptedFrontier + 16, // 11: p2p.Message.get_accepted:type_name -> p2p.GetAccepted + 17, // 12: p2p.Message.accepted:type_name -> p2p.Accepted + 18, // 13: p2p.Message.get_ancestors:type_name -> p2p.GetAncestors + 19, // 14: p2p.Message.ancestors:type_name -> p2p.Ancestors + 20, // 15: p2p.Message.get:type_name -> p2p.Get + 21, // 16: p2p.Message.put:type_name -> p2p.Put + 22, // 17: p2p.Message.push_query:type_name -> p2p.PushQuery + 23, // 18: p2p.Message.pull_query:type_name -> p2p.PullQuery + 24, // 19: p2p.Message.chits:type_name -> p2p.Chits + 25, // 20: p2p.Message.app_request:type_name -> p2p.AppRequest + 26, // 21: p2p.Message.app_response:type_name -> p2p.AppResponse + 28, // 22: p2p.Message.app_gossip:type_name -> p2p.AppGossip + 27, // 23: p2p.Message.app_error:type_name -> p2p.AppError + 5, // 24: p2p.Handshake.client:type_name -> p2p.Client + 6, // 25: p2p.Handshake.known_peers:type_name -> p2p.BloomFilter + 6, // 26: p2p.GetPeerList.known_peers:type_name -> p2p.BloomFilter + 7, // 27: p2p.PeerList.claimed_ip_ports:type_name -> p2p.ClaimedIpPort + 0, // 28: p2p.GetAncestors.engine_type:type_name -> p2p.EngineType + 29, // [29:29] is the sub-list for method output_type + 29, // [29:29] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name } func init() { file_p2p_p2p_proto_init() } @@ -3002,18 +2925,6 @@ func file_p2p_p2p_proto_init() { } } file_p2p_p2p_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubnetUptime); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_p2p_p2p_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Pong); i { case 0: return &v.state @@ -3025,7 +2936,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Handshake); i { case 0: return &v.state @@ -3037,7 +2948,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Client); i { case 0: return &v.state @@ -3049,7 +2960,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BloomFilter); i { case 0: return &v.state @@ -3061,7 +2972,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ClaimedIpPort); i { case 0: return &v.state @@ -3073,7 +2984,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetPeerList); i { case 0: return &v.state @@ -3085,7 +2996,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PeerList); i { case 0: return &v.state @@ -3097,7 +3008,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetStateSummaryFrontier); i { case 0: return &v.state @@ -3109,7 +3020,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateSummaryFrontier); i { case 0: return &v.state @@ -3121,7 +3032,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetAcceptedStateSummary); i { case 0: return &v.state @@ -3133,7 +3044,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AcceptedStateSummary); i { case 0: return &v.state @@ -3145,7 +3056,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetAcceptedFrontier); i { case 0: return &v.state @@ -3157,7 +3068,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AcceptedFrontier); i { case 0: return &v.state @@ -3169,7 +3080,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetAccepted); i { case 0: return &v.state @@ -3181,7 +3092,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Accepted); i { case 0: return &v.state @@ -3193,7 +3104,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetAncestors); i { case 0: return &v.state @@ -3205,7 +3116,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Ancestors); i { case 0: return &v.state @@ -3217,7 +3128,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Get); i { case 0: return &v.state @@ -3229,7 +3140,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Put); i { case 0: return &v.state @@ -3241,7 +3152,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PushQuery); i { case 0: return &v.state @@ -3253,7 +3164,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PullQuery); i { case 0: return &v.state @@ -3265,7 +3176,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Chits); i { case 0: return &v.state @@ -3277,7 +3188,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AppRequest); i { case 0: return &v.state @@ -3289,7 +3200,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AppResponse); i { case 0: return &v.state @@ -3301,7 +3212,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AppError); i { case 0: return &v.state @@ -3313,7 +3224,7 @@ func file_p2p_p2p_proto_init() { return nil } } - file_p2p_p2p_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + file_p2p_p2p_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AppGossip); i { case 0: return &v.state @@ -3359,7 +3270,7 @@ func file_p2p_p2p_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_p2p_p2p_proto_rawDesc, NumEnums: 1, - NumMessages: 29, + NumMessages: 28, NumExtensions: 0, NumServices: 0, }, diff --git a/scripts/mocks.mockgen.txt b/scripts/mocks.mockgen.txt index 256fcf1a11d..a758d6f1f8c 100644 --- a/scripts/mocks.mockgen.txt +++ b/scripts/mocks.mockgen.txt @@ -17,7 +17,6 @@ github.com/ava-labs/avalanchego/snow/networking/tracker=Targeter=snow/networking github.com/ava-labs/avalanchego/snow/networking/tracker=Tracker=snow/networking/tracker/trackermock/tracker.go github.com/ava-labs/avalanchego/snow/uptime=Calculator=snow/uptime/uptimemock/calculator.go github.com/ava-labs/avalanchego/snow/validators=State=snow/validators/validatorsmock/state.go -github.com/ava-labs/avalanchego/snow/validators=SubnetConnector=snow/validators/validatorsmock/subnet_connector.go github.com/ava-labs/avalanchego/utils/crypto/keychain=Ledger=utils/crypto/keychain/keychainmock/ledger.go github.com/ava-labs/avalanchego/utils/filesystem=Reader=utils/filesystem/filesystemmock/reader.go github.com/ava-labs/avalanchego/utils/hashing=Hasher=utils/hashing/hashingmock/hasher.go diff --git a/snow/networking/handler/handler.go b/snow/networking/handler/handler.go index 28582c60001..73e40ceee60 100644 --- a/snow/networking/handler/handler.go +++ b/snow/networking/handler/handler.go @@ -118,8 +118,6 @@ type handler struct { // Closed when this handler and [engine] are done shutting down closed chan struct{} - subnetConnector validators.SubnetConnector - subnet subnets.Subnet // Tracks the peers that are currently connected to this subnet @@ -136,7 +134,6 @@ func New( gossipFrequency time.Duration, threadPoolSize int, resourceTracker tracker.ResourceTracker, - subnetConnector validators.SubnetConnector, subnet subnets.Subnet, peerTracker commontracker.Peers, p2pTracker *p2p.PeerTracker, @@ -152,7 +149,6 @@ func New( closingChan: make(chan struct{}), closed: make(chan struct{}), resourceTracker: resourceTracker, - subnetConnector: subnetConnector, subnet: subnet, peerTracker: peerTracker, p2pTracker: p2pTracker, @@ -768,9 +764,6 @@ func (h *handler) handleSyncMsg(ctx context.Context, msg Message) error { h.p2pTracker.Connected(nodeID, msg.NodeVersion) return engine.Connected(ctx, nodeID, msg.NodeVersion) - case *message.ConnectedSubnet: - return h.subnetConnector.ConnectedSubnet(ctx, nodeID, msg.SubnetID) - case *message.Disconnected: err := h.peerTracker.Disconnected(ctx, nodeID) if err != nil { diff --git a/snow/networking/handler/handler_test.go b/snow/networking/handler/handler_test.go index 7bd3f1f3d52..a2b5aa9acc8 100644 --- a/snow/networking/handler/handler_test.go +++ b/snow/networking/handler/handler_test.go @@ -12,7 +12,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/require" - "go.uber.org/mock/gomock" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/message" @@ -23,7 +22,6 @@ import ( "github.com/ava-labs/avalanchego/snow/networking/tracker" "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/snow/validators" - "github.com/ava-labs/avalanchego/snow/validators/validatorsmock" "github.com/ava-labs/avalanchego/subnets" "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/utils/math/meter" @@ -75,7 +73,6 @@ func TestHandlerDropsTimedOutMessages(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), peerTracker, @@ -182,7 +179,6 @@ func TestHandlerClosesOnError(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), peerTracker, @@ -285,7 +281,6 @@ func TestHandlerDropsGossipDuringBootstrapping(t *testing.T) { 1, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), peerTracker, @@ -376,7 +371,6 @@ func TestHandlerDispatchInternal(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), peerTracker, @@ -425,98 +419,6 @@ func TestHandlerDispatchInternal(t *testing.T) { wg.Wait() } -func TestHandlerSubnetConnector(t *testing.T) { - require := require.New(t) - - snowCtx := snowtest.Context(t, snowtest.CChainID) - ctx := snowtest.ConsensusContext(snowCtx) - vdrs := validators.NewManager() - require.NoError(vdrs.AddStaker(ctx.SubnetID, ids.GenerateTestNodeID(), nil, ids.Empty, 1)) - - resourceTracker, err := tracker.NewResourceTracker( - prometheus.NewRegistry(), - resource.NoUsage, - meter.ContinuousFactory{}, - time.Second, - ) - require.NoError(err) - ctrl := gomock.NewController(t) - connector := validatorsmock.NewSubnetConnector(ctrl) - - nodeID := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() - - peerTracker, err := p2p.NewPeerTracker( - logging.NoLog{}, - "", - prometheus.NewRegistry(), - nil, - version.CurrentApp, - ) - require.NoError(err) - - handler, err := New( - ctx, - vdrs, - nil, - time.Second, - testThreadPoolSize, - resourceTracker, - connector, - subnets.New(ctx.NodeID, subnets.Config{}), - commontracker.NewPeers(), - peerTracker, - prometheus.NewRegistry(), - ) - require.NoError(err) - - bootstrapper := &enginetest.Bootstrapper{ - Engine: enginetest.Engine{ - T: t, - }, - } - bootstrapper.Default(false) - - engine := &enginetest.Engine{T: t} - engine.Default(false) - engine.ContextF = func() *snow.ConsensusContext { - return ctx - } - - handler.SetEngineManager(&EngineManager{ - Snowman: &Engine{ - Bootstrapper: bootstrapper, - Consensus: engine, - }, - }) - ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, - State: snow.NormalOp, // assumed bootstrap is done - }) - - bootstrapper.StartF = func(context.Context, uint32) error { - return nil - } - - handler.Start(context.Background(), false) - - // Handler should call subnet connector when ConnectedSubnet message is received - var wg sync.WaitGroup - connector.EXPECT().ConnectedSubnet(gomock.Any(), nodeID, subnetID).Do( - func(context.Context, ids.NodeID, ids.ID) { - wg.Done() - }) - - wg.Add(1) - defer wg.Wait() - - subnetInboundMessage := Message{ - InboundMessage: message.InternalConnectedSubnet(nodeID, subnetID), - EngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, - } - handler.Push(context.Background(), subnetInboundMessage) -} - // Tests that messages are routed to the correct engine type func TestDynamicEngineTypeDispatch(t *testing.T) { tests := []struct { @@ -644,7 +546,6 @@ func TestDynamicEngineTypeDispatch(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ids.EmptyNodeID, subnets.Config{}), commontracker.NewPeers(), peerTracker, @@ -727,7 +628,6 @@ func TestHandlerStartError(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - nil, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), peerTracker, diff --git a/snow/networking/handler/health_test.go b/snow/networking/handler/health_test.go index 4e27a786dc1..aa082b04232 100644 --- a/snow/networking/handler/health_test.go +++ b/snow/networking/handler/health_test.go @@ -89,7 +89,6 @@ func TestHealthCheckSubnet(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, sb, peerTracker, p2pTracker, diff --git a/snow/networking/handler/message_queue.go b/snow/networking/handler/message_queue.go index 4d632c62d77..fbf362c86f7 100644 --- a/snow/networking/handler/message_queue.go +++ b/snow/networking/handler/message_queue.go @@ -203,7 +203,7 @@ func (m *messageQueue) Shutdown() { // canPop will return true for at least one message in [m.msgs] func (m *messageQueue) canPop(msg message.InboundMessage) bool { // Always pop connected and disconnected messages. - if op := msg.Op(); op == message.ConnectedOp || op == message.DisconnectedOp || op == message.ConnectedSubnetOp { + if op := msg.Op(); op == message.ConnectedOp || op == message.DisconnectedOp { return true } diff --git a/snow/networking/router/chain_router.go b/snow/networking/router/chain_router.go index 46c6e80545d..16cac1df54d 100644 --- a/snow/networking/router/chain_router.go +++ b/snow/networking/router/chain_router.go @@ -51,9 +51,6 @@ type peer struct { version *version.Application // The subnets that this peer is currently tracking trackedSubnets set.Set[ids.ID] - // The subnets that this peer actually has a connection to. - // This is a subset of trackedSubnets. - connectedSubnets set.Set[ids.ID] } // ChainRouter routes incoming messages from the validator network @@ -435,25 +432,6 @@ func (cr *ChainRouter) AddChain(ctx context.Context, chain handler.Handler) { }, ) } - - // When we register the P-chain, we mark ourselves as connected on all of - // the subnets that we have tracked. - if chainID != constants.PlatformChainID { - return - } - - // If we have currently benched ourselves, we will mark ourselves as - // connected when we unbench. So skip connecting now. - // This is not "theoretically" possible, but keeping this here prevents us - // from keeping an invariant that we never bench ourselves. - if _, benched := cr.benched[cr.myNodeID]; benched { - return - } - - myself := cr.peers[cr.myNodeID] - for subnetID := range myself.trackedSubnets { - cr.connectedSubnet(myself, cr.myNodeID, subnetID) - } } // Connected routes an incoming notification that a validator was just connected @@ -507,8 +485,6 @@ func (cr *ChainRouter) Connected(nodeID ids.NodeID, nodeVersion *version.Applica } } } - - cr.connectedSubnet(connectedPeer, nodeID, subnetID) } // Disconnected routes an incoming notification that a validator was connected @@ -585,8 +561,6 @@ func (cr *ChainRouter) Benched(chainID ids.ID, nodeID ids.NodeID) { }) } } - - peer.connectedSubnets.Clear() } // Unbenched routes an incoming notification that a validator was just unbenched @@ -629,13 +603,6 @@ func (cr *ChainRouter) Unbenched(chainID ids.ID, nodeID ids.NodeID) { }) } } - - // This will unbench the node from all its subnets. - // We handle this case separately because the node may have been benched on - // a subnet that has no chains. - for subnetID := range peer.trackedSubnets { - cr.connectedSubnet(peer, nodeID, subnetID) - } } // HealthCheck returns results of router health checks. Returns: @@ -739,46 +706,3 @@ func (cr *ChainRouter) clearRequest( cr.metrics.outstandingRequests.Set(float64(cr.timedRequests.Len())) return uniqueRequestID, &request } - -// connectedSubnet pushes an InternalSubnetConnected message with [nodeID] and -// [subnetID] to the P-chain. This should be called when a node is either first -// connecting to [subnetID] or when a node that was already connected is -// unbenched on [subnetID]. This is a noop if [subnetID] is the Primary Network -// or if the peer is already marked as connected to the subnet. -// Invariant: should be called after *message.Connected is pushed to the P-chain -// Invariant: should be called after the P-chain was provided in [AddChain] -func (cr *ChainRouter) connectedSubnet(peer *peer, nodeID ids.NodeID, subnetID ids.ID) { - // if connected to primary network, we can skip this - // because Connected has its own internal message - if subnetID == constants.PrimaryNetworkID { - return - } - - // peer already connected to this subnet - if peer.connectedSubnets.Contains(subnetID) { - return - } - - msg := message.InternalConnectedSubnet(nodeID, subnetID) - // We only push this message to the P-chain because it is the only chain - // that cares about the connectivity of all subnets. Others chains learn - // about the connectivity of their own subnet when they receive a - // *message.Connected. - platformChain, ok := cr.chainHandlers[constants.PlatformChainID] - if !ok { - cr.log.Error("trying to issue InternalConnectedSubnet message, but platform chain is not registered", - zap.Stringer("nodeID", nodeID), - zap.Stringer("subnetID", subnetID), - ) - return - } - platformChain.Push( - context.TODO(), - handler.Message{ - InboundMessage: msg, - EngineType: p2p.EngineType_ENGINE_TYPE_UNSPECIFIED, - }, - ) - - peer.connectedSubnets.Add(subnetID) -} diff --git a/snow/networking/router/chain_router_test.go b/snow/networking/router/chain_router_test.go index 17c08960fb5..d2770ce1d21 100644 --- a/snow/networking/router/chain_router_test.go +++ b/snow/networking/router/chain_router_test.go @@ -27,7 +27,6 @@ import ( "github.com/ava-labs/avalanchego/snow/snowtest" "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/subnets" - "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/utils/math/meter" "github.com/ava-labs/avalanchego/utils/resource" @@ -111,7 +110,6 @@ func TestShutdown(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(chainCtx.NodeID, subnets.Config{}), commontracker.NewPeers(), p2pTracker, @@ -237,7 +235,6 @@ func TestConnectedAfterShutdownErrorLogRegression(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(chainCtx.NodeID, subnets.Config{}), commontracker.NewPeers(), p2pTracker, @@ -370,7 +367,6 @@ func TestShutdownTimesOut(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), p2pTracker, @@ -539,7 +535,6 @@ func TestRouterTimeout(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), p2pTracker, @@ -1071,7 +1066,6 @@ func TestValidatorOnlyMessageDrops(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, sb, commontracker.NewPeers(), p2pTracker, @@ -1161,121 +1155,6 @@ func TestValidatorOnlyMessageDrops(t *testing.T) { require.True(calledF) // should be called since this is a validator request } -func TestConnectedSubnet(t *testing.T) { - require := require.New(t) - ctrl := gomock.NewController(t) - - tm, err := timeout.NewManager( - &timer.AdaptiveTimeoutConfig{ - InitialTimeout: 3 * time.Second, - MinimumTimeout: 3 * time.Second, - MaximumTimeout: 5 * time.Minute, - TimeoutCoefficient: 1, - TimeoutHalflife: 5 * time.Minute, - }, - benchlist.NewNoBenchlist(), - prometheus.NewRegistry(), - prometheus.NewRegistry(), - ) - require.NoError(err) - - go tm.Dispatch() - defer tm.Stop() - - // Create chain router - myNodeID := ids.GenerateTestNodeID() - peerNodeID := ids.GenerateTestNodeID() - subnetID0 := ids.GenerateTestID() - subnetID1 := ids.GenerateTestID() - trackedSubnets := set.Of(subnetID0, subnetID1) - chainRouter := ChainRouter{} - require.NoError(chainRouter.Initialize( - myNodeID, - logging.NoLog{}, - tm, - time.Millisecond, - set.Set[ids.ID]{}, - true, - trackedSubnets, - nil, - HealthConfig{}, - prometheus.NewRegistry(), - )) - - // Create bootstrapper, engine and handler - snowCtx := snowtest.Context(t, snowtest.PChainID) - ctx := snowtest.ConsensusContext(snowCtx) - ctx.Executing.Set(false) - ctx.State.Set(snow.EngineState{ - Type: engineType, - State: snow.NormalOp, - }) - - myConnectedMsg := handler.Message{ - InboundMessage: message.InternalConnected(myNodeID, version.CurrentApp), - EngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, - } - mySubnetConnectedMsg0 := handler.Message{ - InboundMessage: message.InternalConnectedSubnet(myNodeID, subnetID0), - EngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, - } - mySubnetConnectedMsg1 := handler.Message{ - InboundMessage: message.InternalConnectedSubnet(myNodeID, subnetID1), - EngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, - } - - platformHandler := handlermock.NewHandler(ctrl) - platformHandler.EXPECT().Context().Return(ctx).AnyTimes() - platformHandler.EXPECT().SetOnStopped(gomock.Any()).AnyTimes() - platformHandler.EXPECT().Push(gomock.Any(), myConnectedMsg).Times(1) - platformHandler.EXPECT().Push(gomock.Any(), mySubnetConnectedMsg0).Times(1) - platformHandler.EXPECT().Push(gomock.Any(), mySubnetConnectedMsg1).Times(1) - - chainRouter.AddChain(context.Background(), platformHandler) - - peerConnectedMsg := handler.Message{ - InboundMessage: message.InternalConnected(peerNodeID, version.CurrentApp), - EngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, - } - platformHandler.EXPECT().Push(gomock.Any(), peerConnectedMsg).Times(1) - chainRouter.Connected(peerNodeID, version.CurrentApp, constants.PrimaryNetworkID) - - peerSubnetConnectedMsg0 := handler.Message{ - InboundMessage: message.InternalConnectedSubnet(peerNodeID, subnetID0), - EngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, - } - platformHandler.EXPECT().Push(gomock.Any(), peerSubnetConnectedMsg0).Times(1) - chainRouter.Connected(peerNodeID, version.CurrentApp, subnetID0) - - myDisconnectedMsg := handler.Message{ - InboundMessage: message.InternalDisconnected(myNodeID), - EngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, - } - platformHandler.EXPECT().Push(gomock.Any(), myDisconnectedMsg).Times(1) - chainRouter.Benched(constants.PlatformChainID, myNodeID) - - peerDisconnectedMsg := handler.Message{ - InboundMessage: message.InternalDisconnected(peerNodeID), - EngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, - } - platformHandler.EXPECT().Push(gomock.Any(), peerDisconnectedMsg).Times(1) - chainRouter.Benched(constants.PlatformChainID, peerNodeID) - - platformHandler.EXPECT().Push(gomock.Any(), myConnectedMsg).Times(1) - platformHandler.EXPECT().Push(gomock.Any(), mySubnetConnectedMsg0).Times(1) - platformHandler.EXPECT().Push(gomock.Any(), mySubnetConnectedMsg1).Times(1) - - chainRouter.Unbenched(constants.PlatformChainID, myNodeID) - - platformHandler.EXPECT().Push(gomock.Any(), peerConnectedMsg).Times(1) - platformHandler.EXPECT().Push(gomock.Any(), peerSubnetConnectedMsg0).Times(1) - - chainRouter.Unbenched(constants.PlatformChainID, peerNodeID) - - platformHandler.EXPECT().Push(gomock.Any(), peerDisconnectedMsg).Times(1) - chainRouter.Disconnected(peerNodeID) -} - func TestValidatorOnlyAllowedNodeMessageDrops(t *testing.T) { require := require.New(t) @@ -1352,7 +1231,6 @@ func TestValidatorOnlyAllowedNodeMessageDrops(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, sb, commontracker.NewPeers(), p2pTracker, @@ -1604,7 +1482,6 @@ func newChainRouterTest(t *testing.T) (*ChainRouter, *enginetest.Engine) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), p2pTracker, diff --git a/snow/networking/sender/sender_test.go b/snow/networking/sender/sender_test.go index ef9081b4581..79b9ca0ba08 100644 --- a/snow/networking/sender/sender_test.go +++ b/snow/networking/sender/sender_test.go @@ -136,7 +136,6 @@ func TestTimeout(t *testing.T) { time.Hour, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), p2pTracker, @@ -395,7 +394,6 @@ func TestReliableMessages(t *testing.T) { 1, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), p2pTracker, @@ -552,7 +550,6 @@ func TestReliableMessagesToMyself(t *testing.T) { time.Second, testThreadPoolSize, resourceTracker, - validators.UnhandledSubnetConnector, subnets.New(ctx.NodeID, subnets.Config{}), commontracker.NewPeers(), p2pTracker, diff --git a/snow/uptime/locked_calculator.go b/snow/uptime/locked_calculator.go index 884878ab24f..a1e9537a5e2 100644 --- a/snow/uptime/locked_calculator.go +++ b/snow/uptime/locked_calculator.go @@ -35,7 +35,7 @@ func NewLockedCalculator() LockedCalculator { return &lockedCalculator{} } -func (c *lockedCalculator) CalculateUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error) { +func (c *lockedCalculator) CalculateUptime(nodeID ids.NodeID) (time.Duration, time.Time, error) { c.lock.RLock() defer c.lock.RUnlock() @@ -46,10 +46,10 @@ func (c *lockedCalculator) CalculateUptime(nodeID ids.NodeID, subnetID ids.ID) ( c.calculatorLock.Lock() defer c.calculatorLock.Unlock() - return c.c.CalculateUptime(nodeID, subnetID) + return c.c.CalculateUptime(nodeID) } -func (c *lockedCalculator) CalculateUptimePercent(nodeID ids.NodeID, subnetID ids.ID) (float64, error) { +func (c *lockedCalculator) CalculateUptimePercent(nodeID ids.NodeID) (float64, error) { c.lock.RLock() defer c.lock.RUnlock() @@ -60,10 +60,10 @@ func (c *lockedCalculator) CalculateUptimePercent(nodeID ids.NodeID, subnetID id c.calculatorLock.Lock() defer c.calculatorLock.Unlock() - return c.c.CalculateUptimePercent(nodeID, subnetID) + return c.c.CalculateUptimePercent(nodeID) } -func (c *lockedCalculator) CalculateUptimePercentFrom(nodeID ids.NodeID, subnetID ids.ID, startTime time.Time) (float64, error) { +func (c *lockedCalculator) CalculateUptimePercentFrom(nodeID ids.NodeID, startTime time.Time) (float64, error) { c.lock.RLock() defer c.lock.RUnlock() @@ -74,7 +74,7 @@ func (c *lockedCalculator) CalculateUptimePercentFrom(nodeID ids.NodeID, subnetI c.calculatorLock.Lock() defer c.calculatorLock.Unlock() - return c.c.CalculateUptimePercentFrom(nodeID, subnetID, startTime) + return c.c.CalculateUptimePercentFrom(nodeID, startTime) } func (c *lockedCalculator) SetCalculator(isBootstrapped *utils.Atomic[bool], lock sync.Locker, newC Calculator) { diff --git a/snow/uptime/locked_calculator_test.go b/snow/uptime/locked_calculator_test.go index 60735985f65..e3295fc5658 100644 --- a/snow/uptime/locked_calculator_test.go +++ b/snow/uptime/locked_calculator_test.go @@ -25,14 +25,13 @@ func TestLockedCalculator(t *testing.T) { // Should still error because ctx is nil nodeID := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() - _, _, err := lc.CalculateUptime(nodeID, subnetID) + _, _, err := lc.CalculateUptime(nodeID) require.ErrorIs(err, errStillBootstrapping) - _, err = lc.CalculateUptimePercent(nodeID, subnetID) + _, err = lc.CalculateUptimePercent(nodeID) require.ErrorIs(err, errStillBootstrapping) - _, err = lc.CalculateUptimePercentFrom(nodeID, subnetID, time.Now()) + _, err = lc.CalculateUptimePercentFrom(nodeID, time.Now()) require.ErrorIs(err, errStillBootstrapping) var isBootstrapped utils.Atomic[bool] @@ -40,27 +39,27 @@ func TestLockedCalculator(t *testing.T) { // Should still error because ctx is not bootstrapped lc.SetCalculator(&isBootstrapped, &sync.Mutex{}, mockCalc) - _, _, err = lc.CalculateUptime(nodeID, subnetID) + _, _, err = lc.CalculateUptime(nodeID) require.ErrorIs(err, errStillBootstrapping) - _, err = lc.CalculateUptimePercent(nodeID, subnetID) + _, err = lc.CalculateUptimePercent(nodeID) require.ErrorIs(err, errStillBootstrapping) - _, err = lc.CalculateUptimePercentFrom(nodeID, subnetID, time.Now()) + _, err = lc.CalculateUptimePercentFrom(nodeID, time.Now()) require.ErrorIs(err, errStillBootstrapping) isBootstrapped.Set(true) // Should return the value from the mocked inner calculator - mockCalc.EXPECT().CalculateUptime(gomock.Any(), gomock.Any()).AnyTimes().Return(time.Duration(0), time.Time{}, errTest) - _, _, err = lc.CalculateUptime(nodeID, subnetID) + mockCalc.EXPECT().CalculateUptime(gomock.Any()).AnyTimes().Return(time.Duration(0), time.Time{}, errTest) + _, _, err = lc.CalculateUptime(nodeID) require.ErrorIs(err, errTest) - mockCalc.EXPECT().CalculateUptimePercent(gomock.Any(), gomock.Any()).AnyTimes().Return(float64(0), errTest) - _, err = lc.CalculateUptimePercent(nodeID, subnetID) + mockCalc.EXPECT().CalculateUptimePercent(gomock.Any()).AnyTimes().Return(float64(0), errTest) + _, err = lc.CalculateUptimePercent(nodeID) require.ErrorIs(err, errTest) - mockCalc.EXPECT().CalculateUptimePercentFrom(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(float64(0), errTest) - _, err = lc.CalculateUptimePercentFrom(nodeID, subnetID, time.Now()) + mockCalc.EXPECT().CalculateUptimePercentFrom(gomock.Any(), gomock.Any()).AnyTimes().Return(float64(0), errTest) + _, err = lc.CalculateUptimePercentFrom(nodeID, time.Now()) require.ErrorIs(err, errTest) } diff --git a/snow/uptime/manager.go b/snow/uptime/manager.go index a64b71ca62d..70f576060aa 100644 --- a/snow/uptime/manager.go +++ b/snow/uptime/manager.go @@ -8,7 +8,6 @@ import ( "github.com/ava-labs/avalanchego/database" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/utils/set" "github.com/ava-labs/avalanchego/utils/timer/mockable" ) @@ -20,42 +19,48 @@ type Manager interface { } type Tracker interface { - StartTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error - StopTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error + StartTracking(nodeIDs []ids.NodeID) error + StopTracking(nodeIDs []ids.NodeID) error + StartedTracking() bool - Connect(nodeID ids.NodeID, subnetID ids.ID) error - IsConnected(nodeID ids.NodeID, subnetID ids.ID) bool + Connect(nodeID ids.NodeID) error + IsConnected(nodeID ids.NodeID) bool Disconnect(nodeID ids.NodeID) error } type Calculator interface { - CalculateUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error) - CalculateUptimePercent(nodeID ids.NodeID, subnetID ids.ID) (float64, error) + CalculateUptime(nodeID ids.NodeID) (time.Duration, time.Time, error) + CalculateUptimePercent(nodeID ids.NodeID) (float64, error) // CalculateUptimePercentFrom expects [startTime] to be truncated (floored) to the nearest second - CalculateUptimePercentFrom(nodeID ids.NodeID, subnetID ids.ID, startTime time.Time) (float64, error) + CalculateUptimePercentFrom(nodeID ids.NodeID, startTime time.Time) (float64, error) } type manager struct { // Used to get time. Useful for faking time during tests. clock *mockable.Clock - state State - connections map[ids.NodeID]map[ids.ID]time.Time // nodeID -> subnetID -> time - trackedSubnets set.Set[ids.ID] + state State + connections map[ids.NodeID]time.Time // nodeID -> connected at + // Whether we have started tracking the uptime of the nodes + // This is used to avoid setting the uptime before we have started tracking + startedTracking bool } func NewManager(state State, clk *mockable.Clock) Manager { return &manager{ clock: clk, state: state, - connections: make(map[ids.NodeID]map[ids.ID]time.Time), + connections: make(map[ids.NodeID]time.Time), } } -func (m *manager) StartTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error { +func (m *manager) StartTracking(nodeIDs []ids.NodeID) error { + if m.startedTracking { + return nil + } now := m.clock.UnixTime() for _, nodeID := range nodeIDs { - upDuration, lastUpdated, err := m.state.GetUptime(nodeID, subnetID) + upDuration, lastUpdated, err := m.CalculateUptime(nodeID) if err != nil { return err } @@ -66,35 +71,35 @@ func (m *manager) StartTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error { continue } - durationOffline := now.Sub(lastUpdated) - newUpDuration := upDuration + durationOffline - if err := m.state.SetUptime(nodeID, subnetID, newUpDuration, now); err != nil { + if err := m.state.SetUptime(nodeID, upDuration, lastUpdated); err != nil { return err } } - m.trackedSubnets.Add(subnetID) + m.startedTracking = true return nil } -func (m *manager) StopTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error { +func (m *manager) StopTracking(nodeIDs []ids.NodeID) error { + if !m.startedTracking { + return nil + } + defer func() { + m.startedTracking = false + }() now := m.clock.UnixTime() for _, nodeID := range nodeIDs { - connectedSubnets := m.connections[nodeID] - // If the node is already connected to this subnet, then we can just + // If the node is already connected, then we can just // update the uptime in the state and remove the connection - if _, isConnected := connectedSubnets[subnetID]; isConnected { - if err := m.updateSubnetUptime(nodeID, subnetID); err != nil { - delete(connectedSubnets, subnetID) + if m.IsConnected(nodeID) { + if err := m.Disconnect(nodeID); err != nil { return err } - delete(connectedSubnets, subnetID) continue } - // if the node is not connected to this subnet, then we need to update - // the uptime in the state from the last time the node was connected to - // this subnet to now. - upDuration, lastUpdated, err := m.state.GetUptime(nodeID, subnetID) + // if the node is not connected, then we need to update + // the uptime in the state from the last time the node was connected to current time. + upDuration, lastUpdated, err := m.state.GetUptime(nodeID) if err != nil { return err } @@ -105,41 +110,38 @@ func (m *manager) StopTracking(nodeIDs []ids.NodeID, subnetID ids.ID) error { continue } - if err := m.state.SetUptime(nodeID, subnetID, upDuration, now); err != nil { + if err := m.state.SetUptime(nodeID, upDuration, now); err != nil { return err } } return nil } -func (m *manager) Connect(nodeID ids.NodeID, subnetID ids.ID) error { - subnetConnections, ok := m.connections[nodeID] - if !ok { - subnetConnections = make(map[ids.ID]time.Time) - m.connections[nodeID] = subnetConnections - } - subnetConnections[subnetID] = m.clock.UnixTime() +func (m *manager) StartedTracking() bool { + return m.startedTracking +} + +func (m *manager) Connect(nodeID ids.NodeID) error { + m.connections[nodeID] = m.clock.UnixTime() return nil } -func (m *manager) IsConnected(nodeID ids.NodeID, subnetID ids.ID) bool { - _, connected := m.connections[nodeID][subnetID] +func (m *manager) IsConnected(nodeID ids.NodeID) bool { + _, connected := m.connections[nodeID] return connected } func (m *manager) Disconnect(nodeID ids.NodeID) error { - // Update every subnet that this node was connected to - for subnetID := range m.connections[nodeID] { - if err := m.updateSubnetUptime(nodeID, subnetID); err != nil { - return err - } + defer delete(m.connections, nodeID) + if err := m.updateUptime(nodeID); err != nil { + return err } - delete(m.connections, nodeID) + return nil } -func (m *manager) CalculateUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error) { - upDuration, lastUpdated, err := m.state.GetUptime(nodeID, subnetID) +func (m *manager) CalculateUptime(nodeID ids.NodeID) (time.Duration, time.Time, error) { + upDuration, lastUpdated, err := m.state.GetUptime(nodeID) if err != nil { return 0, time.Time{}, err } @@ -151,13 +153,13 @@ func (m *manager) CalculateUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Dura return upDuration, lastUpdated, nil } - if !m.trackedSubnets.Contains(subnetID) { + if !m.startedTracking { durationOffline := now.Sub(lastUpdated) newUpDuration := upDuration + durationOffline return newUpDuration, now, nil } - timeConnected, isConnected := m.connections[nodeID][subnetID] + timeConnected, isConnected := m.connections[nodeID] if !isConnected { return upDuration, now, nil } @@ -181,16 +183,16 @@ func (m *manager) CalculateUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Dura return newUpDuration, now, nil } -func (m *manager) CalculateUptimePercent(nodeID ids.NodeID, subnetID ids.ID) (float64, error) { - startTime, err := m.state.GetStartTime(nodeID, subnetID) +func (m *manager) CalculateUptimePercent(nodeID ids.NodeID) (float64, error) { + startTime, err := m.state.GetStartTime(nodeID) if err != nil { return 0, err } - return m.CalculateUptimePercentFrom(nodeID, subnetID, startTime) + return m.CalculateUptimePercentFrom(nodeID, startTime) } -func (m *manager) CalculateUptimePercentFrom(nodeID ids.NodeID, subnetID ids.ID, startTime time.Time) (float64, error) { - upDuration, now, err := m.CalculateUptime(nodeID, subnetID) +func (m *manager) CalculateUptimePercentFrom(nodeID ids.NodeID, startTime time.Time) (float64, error) { + upDuration, now, err := m.CalculateUptime(nodeID) if err != nil { return 0, err } @@ -202,15 +204,13 @@ func (m *manager) CalculateUptimePercentFrom(nodeID ids.NodeID, subnetID ids.ID, return uptime, nil } -// updateSubnetUptime updates the subnet uptime of the node on the state by the amount -// of time that the node has been connected to the subnet. -func (m *manager) updateSubnetUptime(nodeID ids.NodeID, subnetID ids.ID) error { - // we're not tracking this subnet, skip updating it. - if !m.trackedSubnets.Contains(subnetID) { +// updateUptime updates the uptime of the node on the state by the amount +// of time that the node has been connected. +func (m *manager) updateUptime(nodeID ids.NodeID) error { + if !m.startedTracking { return nil } - - newDuration, newLastUpdated, err := m.CalculateUptime(nodeID, subnetID) + newDuration, newLastUpdated, err := m.CalculateUptime(nodeID) if err == database.ErrNotFound { // If a non-validator disconnects, we don't care return nil @@ -219,5 +219,5 @@ func (m *manager) updateSubnetUptime(nodeID ids.NodeID, subnetID ids.ID) error { return err } - return m.state.SetUptime(nodeID, subnetID, newDuration, newLastUpdated) + return m.state.SetUptime(nodeID, newDuration, newLastUpdated) } diff --git a/snow/uptime/manager_test.go b/snow/uptime/manager_test.go index e04fcc3a9fb..ef3de35070b 100644 --- a/snow/uptime/manager_test.go +++ b/snow/uptime/manager_test.go @@ -21,11 +21,10 @@ func TestStartTracking(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() startTime := time.Now() s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) @@ -33,9 +32,9 @@ func TestStartTracking(t *testing.T) { currentTime := startTime.Add(time.Second) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Second, duration) require.Equal(clk.UnixTime(), lastUpdated) @@ -45,12 +44,11 @@ func TestStartTrackingDBError(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() startTime := time.Now() s := NewTestState() s.dbWriteError = errTest - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) @@ -58,7 +56,7 @@ func TestStartTrackingDBError(t *testing.T) { currentTime := startTime.Add(time.Second) clk.Set(currentTime) - err := up.StartTracking([]ids.NodeID{nodeID0}, subnetID) + err := up.StartTracking([]ids.NodeID{nodeID0}) require.ErrorIs(err, errTest) } @@ -70,9 +68,8 @@ func TestStartTrackingNonValidator(t *testing.T) { up := NewManager(s, &clk) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() - err := up.StartTracking([]ids.NodeID{nodeID0}, subnetID) + err := up.StartTracking([]ids.NodeID{nodeID0}) require.ErrorIs(err, database.ErrNotFound) } @@ -80,11 +77,10 @@ func TestStartTrackingInThePast(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() startTime := time.Now() s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) @@ -92,9 +88,9 @@ func TestStartTrackingInThePast(t *testing.T) { currentTime := startTime.Add(-time.Second) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Duration(0), duration) require.Equal(startTime.Truncate(time.Second), lastUpdated) @@ -104,29 +100,28 @@ func TestStopTrackingDecreasesUptime(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) currentTime = startTime.Add(time.Second) clk.Set(currentTime) - require.NoError(up.StopTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StopTracking([]ids.NodeID{nodeID0})) up = NewManager(s, &clk) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Duration(0), duration) require.Equal(clk.UnixTime(), lastUpdated) @@ -136,31 +131,30 @@ func TestStopTrackingIncreasesUptime(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - require.NoError(up.Connect(nodeID0, subnetID)) + require.NoError(up.Connect(nodeID0)) currentTime = startTime.Add(time.Second) clk.Set(currentTime) - require.NoError(up.StopTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StopTracking([]ids.NodeID{nodeID0})) up = NewManager(s, &clk) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Second, duration) require.Equal(clk.UnixTime(), lastUpdated) @@ -170,15 +164,14 @@ func TestStopTrackingDisconnectedNonValidator(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() s := NewTestState() clk := mockable.Clock{} up := NewManager(s, &clk) - require.NoError(up.StartTracking(nil, subnetID)) + require.NoError(up.StartTracking(nil)) - err := up.StopTracking([]ids.NodeID{nodeID0}, subnetID) + err := up.StopTracking([]ids.NodeID{nodeID0}) require.ErrorIs(err, database.ErrNotFound) } @@ -186,20 +179,19 @@ func TestStopTrackingConnectedDBError(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() startTime := time.Now() s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) - require.NoError(up.StartTracking(nil, subnetID)) + require.NoError(up.StartTracking(nil)) - require.NoError(up.Connect(nodeID0, subnetID)) + require.NoError(up.Connect(nodeID0)) s.dbReadError = errTest - err := up.StopTracking([]ids.NodeID{nodeID0}, subnetID) + err := up.StopTracking([]ids.NodeID{nodeID0}) require.ErrorIs(err, errTest) } @@ -207,24 +199,23 @@ func TestStopTrackingNonConnectedPast(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) currentTime = currentTime.Add(-time.Second) clk.Set(currentTime) - require.NoError(up.StopTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StopTracking([]ids.NodeID{nodeID0})) - duration, lastUpdated, err := s.GetUptime(nodeID0, subnetID) + duration, lastUpdated, err := s.GetUptime(nodeID0) require.NoError(err) require.Equal(time.Duration(0), duration) require.Equal(startTime.Truncate(time.Second), lastUpdated) @@ -234,131 +225,104 @@ func TestStopTrackingNonConnectedDBError(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) currentTime = currentTime.Add(time.Second) clk.Set(currentTime) s.dbWriteError = errTest - err := up.StopTracking([]ids.NodeID{nodeID0}, subnetID) + err := up.StopTracking([]ids.NodeID{nodeID0}) require.ErrorIs(err, errTest) } func TestConnectAndDisconnect(t *testing.T) { - tests := []struct { - name string - subnetIDs []ids.ID - }{ - { - name: "Single Subnet", - subnetIDs: []ids.ID{ids.GenerateTestID()}, - }, - { - name: "Multiple Subnets", - subnetIDs: []ids.ID{ids.GenerateTestID(), ids.GenerateTestID()}, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - require := require.New(t) - - nodeID0 := ids.GenerateTestNodeID() - currentTime := time.Now() - startTime := currentTime - - s := NewTestState() - clk := mockable.Clock{} - up := NewManager(s, &clk) - clk.Set(currentTime) - - for _, subnetID := range tt.subnetIDs { - s.AddNode(nodeID0, subnetID, startTime) - - connected := up.IsConnected(nodeID0, subnetID) - require.False(connected) - - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) - - connected = up.IsConnected(nodeID0, subnetID) - require.False(connected) - - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) - require.NoError(err) - require.Equal(time.Duration(0), duration) - require.Equal(clk.UnixTime(), lastUpdated) - - require.NoError(up.Connect(nodeID0, subnetID)) - - connected = up.IsConnected(nodeID0, subnetID) - require.True(connected) - } - - currentTime = currentTime.Add(time.Second) - clk.Set(currentTime) - - for _, subnetID := range tt.subnetIDs { - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) - require.NoError(err) - require.Equal(time.Second, duration) - require.Equal(clk.UnixTime(), lastUpdated) - } - - require.NoError(up.Disconnect(nodeID0)) - - for _, subnetID := range tt.subnetIDs { - connected := up.IsConnected(nodeID0, subnetID) - require.False(connected) - } - - currentTime = currentTime.Add(time.Second) - clk.Set(currentTime) - - for _, subnetID := range tt.subnetIDs { - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) - require.NoError(err) - require.Equal(time.Second, duration) - require.Equal(clk.UnixTime(), lastUpdated) - } - }) - } + require := require.New(t) + + nodeID0 := ids.GenerateTestNodeID() + currentTime := time.Now() + startTime := currentTime + + s := NewTestState() + clk := mockable.Clock{} + up := NewManager(s, &clk) + clk.Set(currentTime) + + s.AddNode(nodeID0, startTime) + + connected := up.IsConnected(nodeID0) + require.False(connected) + + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) + + connected = up.IsConnected(nodeID0) + require.False(connected) + + duration, lastUpdated, err := up.CalculateUptime(nodeID0) + require.NoError(err) + require.Equal(time.Duration(0), duration) + require.Equal(clk.UnixTime(), lastUpdated) + + require.NoError(up.Connect(nodeID0)) + + connected = up.IsConnected(nodeID0) + require.True(connected) + + currentTime = currentTime.Add(time.Second) + clk.Set(currentTime) + + duration, lastUpdated, err = up.CalculateUptime(nodeID0) + require.NoError(err) + require.Equal(time.Second, duration) + require.Equal(clk.UnixTime(), lastUpdated) + + require.NoError(up.Disconnect(nodeID0)) + + connected = up.IsConnected(nodeID0) + require.False(connected) + + currentTime = currentTime.Add(time.Second) + clk.Set(currentTime) + + duration, lastUpdated, err = up.CalculateUptime(nodeID0) + require.NoError(err) + require.Equal(time.Second, duration) + require.Equal(clk.UnixTime(), lastUpdated) } func TestConnectAndDisconnectBeforeTracking(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) currentTime = currentTime.Add(time.Second) clk.Set(currentTime) - require.NoError(up.Connect(nodeID0, subnetID)) + require.NoError(up.Connect(nodeID0)) currentTime = currentTime.Add(time.Second) clk.Set(currentTime) require.NoError(up.Disconnect(nodeID0)) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(2*time.Second, duration) require.Equal(clk.UnixTime(), lastUpdated) @@ -368,33 +332,32 @@ func TestUnrelatedNodeDisconnect(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() nodeID1 := ids.GenerateTestNodeID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Duration(0), duration) require.Equal(clk.UnixTime(), lastUpdated) - require.NoError(up.Connect(nodeID0, subnetID)) + require.NoError(up.Connect(nodeID0)) - require.NoError(up.Connect(nodeID1, subnetID)) + require.NoError(up.Connect(nodeID1)) currentTime = currentTime.Add(time.Second) clk.Set(currentTime) - duration, lastUpdated, err = up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err = up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Second, duration) require.Equal(clk.UnixTime(), lastUpdated) @@ -404,7 +367,7 @@ func TestUnrelatedNodeDisconnect(t *testing.T) { currentTime = currentTime.Add(time.Second) clk.Set(currentTime) - duration, lastUpdated, err = up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err = up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(2*time.Second, duration) require.Equal(clk.UnixTime(), lastUpdated) @@ -414,11 +377,10 @@ func TestCalculateUptimeWhenNeverTracked(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() startTime := time.Now() s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) @@ -426,12 +388,12 @@ func TestCalculateUptimeWhenNeverTracked(t *testing.T) { currentTime := startTime.Add(time.Second) clk.Set(currentTime) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Second, duration) require.Equal(clk.UnixTime(), lastUpdated) - uptime, err := up.CalculateUptimePercentFrom(nodeID0, subnetID, startTime.Truncate(time.Second)) + uptime, err := up.CalculateUptimePercentFrom(nodeID0, startTime.Truncate(time.Second)) require.NoError(err) require.Equal(float64(1), uptime) } @@ -440,7 +402,6 @@ func TestCalculateUptimeWhenNeverConnected(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() startTime := time.Now() s := NewTestState() @@ -448,19 +409,19 @@ func TestCalculateUptimeWhenNeverConnected(t *testing.T) { clk := mockable.Clock{} up := NewManager(s, &clk) - require.NoError(up.StartTracking([]ids.NodeID{}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{})) - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) currentTime := startTime.Add(time.Second) clk.Set(currentTime) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Duration(0), duration) require.Equal(clk.UnixTime(), lastUpdated) - uptime, err := up.CalculateUptimePercentFrom(nodeID0, subnetID, startTime) + uptime, err := up.CalculateUptimePercentFrom(nodeID0, startTime) require.NoError(err) require.Equal(float64(0), uptime) } @@ -469,28 +430,27 @@ func TestCalculateUptimeWhenConnectedBeforeTracking(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - require.NoError(up.Connect(nodeID0, subnetID)) + require.NoError(up.Connect(nodeID0)) currentTime = currentTime.Add(time.Second) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) currentTime = currentTime.Add(time.Second) clk.Set(currentTime) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(2*time.Second, duration) require.Equal(clk.UnixTime(), lastUpdated) @@ -500,28 +460,27 @@ func TestCalculateUptimeWhenConnectedInFuture(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) currentTime = currentTime.Add(2 * time.Second) clk.Set(currentTime) - require.NoError(up.Connect(nodeID0, subnetID)) + require.NoError(up.Connect(nodeID0)) currentTime = currentTime.Add(-time.Second) clk.Set(currentTime) - duration, lastUpdated, err := up.CalculateUptime(nodeID0, subnetID) + duration, lastUpdated, err := up.CalculateUptime(nodeID0) require.NoError(err) require.Equal(time.Duration(0), duration) require.Equal(clk.UnixTime(), lastUpdated) @@ -531,7 +490,6 @@ func TestCalculateUptimeNonValidator(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() startTime := time.Now() s := NewTestState() @@ -539,7 +497,7 @@ func TestCalculateUptimeNonValidator(t *testing.T) { clk := mockable.Clock{} up := NewManager(s, &clk) - _, err := up.CalculateUptimePercentFrom(nodeID0, subnetID, startTime) + _, err := up.CalculateUptimePercentFrom(nodeID0, startTime) require.ErrorIs(err, database.ErrNotFound) } @@ -547,18 +505,17 @@ func TestCalculateUptimePercentageDivBy0(t *testing.T) { require := require.New(t) nodeID0 := ids.GenerateTestNodeID() - subnetID := ids.GenerateTestID() currentTime := time.Now() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - uptime, err := up.CalculateUptimePercentFrom(nodeID0, subnetID, startTime.Truncate(time.Second)) + uptime, err := up.CalculateUptimePercentFrom(nodeID0, startTime.Truncate(time.Second)) require.NoError(err) require.Equal(float64(1), uptime) } @@ -568,21 +525,20 @@ func TestCalculateUptimePercentage(t *testing.T) { nodeID0 := ids.GenerateTestNodeID() currentTime := time.Now() - subnetID := ids.GenerateTestID() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) currentTime = currentTime.Add(time.Second) clk.Set(currentTime) - uptime, err := up.CalculateUptimePercentFrom(nodeID0, subnetID, startTime.Truncate(time.Second)) + uptime, err := up.CalculateUptimePercentFrom(nodeID0, startTime.Truncate(time.Second)) require.NoError(err) require.Equal(float64(0), uptime) } @@ -592,24 +548,23 @@ func TestStopTrackingUnixTimeRegression(t *testing.T) { nodeID0 := ids.GenerateTestNodeID() currentTime := time.Now() - subnetID := ids.GenerateTestID() startTime := currentTime s := NewTestState() - s.AddNode(nodeID0, subnetID, startTime) + s.AddNode(nodeID0, startTime) clk := mockable.Clock{} up := NewManager(s, &clk) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - require.NoError(up.Connect(nodeID0, subnetID)) + require.NoError(up.Connect(nodeID0)) currentTime = startTime.Add(time.Second) clk.Set(currentTime) - require.NoError(up.StopTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StopTracking([]ids.NodeID{nodeID0})) currentTime = startTime.Add(time.Second) clk.Set(currentTime) @@ -619,14 +574,14 @@ func TestStopTrackingUnixTimeRegression(t *testing.T) { currentTime = startTime.Add(time.Second) clk.Set(currentTime) - require.NoError(up.StartTracking([]ids.NodeID{nodeID0}, subnetID)) + require.NoError(up.StartTracking([]ids.NodeID{nodeID0})) - require.NoError(up.Connect(nodeID0, subnetID)) + require.NoError(up.Connect(nodeID0)) currentTime = startTime.Add(time.Second) clk.Set(currentTime) - perc, err := up.CalculateUptimePercent(nodeID0, subnetID) + perc, err := up.CalculateUptimePercent(nodeID0) require.NoError(err) require.GreaterOrEqual(float64(1), perc) } diff --git a/snow/uptime/no_op_calculator.go b/snow/uptime/no_op_calculator.go index fb308f4f603..2f715d799e7 100644 --- a/snow/uptime/no_op_calculator.go +++ b/snow/uptime/no_op_calculator.go @@ -13,14 +13,14 @@ var NoOpCalculator Calculator = noOpCalculator{} type noOpCalculator struct{} -func (noOpCalculator) CalculateUptime(ids.NodeID, ids.ID) (time.Duration, time.Time, error) { +func (noOpCalculator) CalculateUptime(ids.NodeID) (time.Duration, time.Time, error) { return 0, time.Time{}, nil } -func (noOpCalculator) CalculateUptimePercent(ids.NodeID, ids.ID) (float64, error) { +func (noOpCalculator) CalculateUptimePercent(ids.NodeID) (float64, error) { return 0, nil } -func (noOpCalculator) CalculateUptimePercentFrom(ids.NodeID, ids.ID, time.Time) (float64, error) { +func (noOpCalculator) CalculateUptimePercentFrom(ids.NodeID, time.Time) (float64, error) { return 0, nil } diff --git a/snow/uptime/state.go b/snow/uptime/state.go index f9edeb76a3e..59a720c897b 100644 --- a/snow/uptime/state.go +++ b/snow/uptime/state.go @@ -10,34 +10,25 @@ import ( ) type State interface { - // GetUptime returns [upDuration] and [lastUpdated] of [nodeID] on - // [subnetID]. - // Returns [database.ErrNotFound] if [nodeID] isn't currently a validator of - // the subnet. + // GetUptime returns [upDuration] and [lastUpdated] of [nodeID] + // Returns [database.ErrNotFound] if [nodeID] isn't currently a validator. GetUptime( nodeID ids.NodeID, - subnetID ids.ID, ) (upDuration time.Duration, lastUpdated time.Time, err error) - // SetUptime updates [upDuration] and [lastUpdated] of [nodeID] on - // [subnetID]. - // Returns [database.ErrNotFound] if [nodeID] isn't currently a validator of - // the subnet. + // SetUptime updates [upDuration] and [lastUpdated] of [nodeID] + // Returns [database.ErrNotFound] if [nodeID] isn't currently a validator // Invariant: expects [lastUpdated] to be truncated (floored) to the nearest // second. SetUptime( nodeID ids.NodeID, - subnetID ids.ID, upDuration time.Duration, lastUpdated time.Time, ) error - // GetStartTime returns the time that [nodeID] started validating - // [subnetID]. - // Returns [database.ErrNotFound] if [nodeID] isn't currently a validator of - // the subnet. + // GetStartTime returns the time that [nodeID] started validating. + // Returns [database.ErrNotFound] if [nodeID] isn't currently a validator. GetStartTime( nodeID ids.NodeID, - subnetID ids.ID, ) (startTime time.Time, err error) } diff --git a/snow/uptime/test_state.go b/snow/uptime/test_state.go index 23879b5cb3a..213b591bc71 100644 --- a/snow/uptime/test_state.go +++ b/snow/uptime/test_state.go @@ -21,38 +21,33 @@ type uptime struct { type TestState struct { dbReadError error dbWriteError error - nodes map[ids.NodeID]map[ids.ID]*uptime + nodes map[ids.NodeID]*uptime } func NewTestState() *TestState { return &TestState{ - nodes: make(map[ids.NodeID]map[ids.ID]*uptime), + nodes: make(map[ids.NodeID]*uptime), } } -func (s *TestState) AddNode(nodeID ids.NodeID, subnetID ids.ID, startTime time.Time) { - subnetUptimes, ok := s.nodes[nodeID] - if !ok { - subnetUptimes = make(map[ids.ID]*uptime) - s.nodes[nodeID] = subnetUptimes - } +func (s *TestState) AddNode(nodeID ids.NodeID, startTime time.Time) { st := time.Unix(startTime.Unix(), 0) - subnetUptimes[subnetID] = &uptime{ + s.nodes[nodeID] = &uptime{ lastUpdated: st, startTime: st, } } -func (s *TestState) GetUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error) { - up, exists := s.nodes[nodeID][subnetID] +func (s *TestState) GetUptime(nodeID ids.NodeID) (time.Duration, time.Time, error) { + up, exists := s.nodes[nodeID] if !exists { return 0, time.Time{}, database.ErrNotFound } return up.upDuration, up.lastUpdated, s.dbReadError } -func (s *TestState) SetUptime(nodeID ids.NodeID, subnetID ids.ID, upDuration time.Duration, lastUpdated time.Time) error { - up, exists := s.nodes[nodeID][subnetID] +func (s *TestState) SetUptime(nodeID ids.NodeID, upDuration time.Duration, lastUpdated time.Time) error { + up, exists := s.nodes[nodeID] if !exists { return database.ErrNotFound } @@ -61,8 +56,8 @@ func (s *TestState) SetUptime(nodeID ids.NodeID, subnetID ids.ID, upDuration tim return s.dbWriteError } -func (s *TestState) GetStartTime(nodeID ids.NodeID, subnetID ids.ID) (time.Time, error) { - up, exists := s.nodes[nodeID][subnetID] +func (s *TestState) GetStartTime(nodeID ids.NodeID) (time.Time, error) { + up, exists := s.nodes[nodeID] if !exists { return time.Time{}, database.ErrNotFound } diff --git a/snow/uptime/uptimemock/calculator.go b/snow/uptime/uptimemock/calculator.go index 0203b6b4a79..c587637cc36 100644 --- a/snow/uptime/uptimemock/calculator.go +++ b/snow/uptime/uptimemock/calculator.go @@ -41,9 +41,9 @@ func (m *Calculator) EXPECT() *CalculatorMockRecorder { } // CalculateUptime mocks base method. -func (m *Calculator) CalculateUptime(arg0 ids.NodeID, arg1 ids.ID) (time.Duration, time.Time, error) { +func (m *Calculator) CalculateUptime(arg0 ids.NodeID) (time.Duration, time.Time, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CalculateUptime", arg0, arg1) + ret := m.ctrl.Call(m, "CalculateUptime", arg0) ret0, _ := ret[0].(time.Duration) ret1, _ := ret[1].(time.Time) ret2, _ := ret[2].(error) @@ -51,37 +51,37 @@ func (m *Calculator) CalculateUptime(arg0 ids.NodeID, arg1 ids.ID) (time.Duratio } // CalculateUptime indicates an expected call of CalculateUptime. -func (mr *CalculatorMockRecorder) CalculateUptime(arg0, arg1 any) *gomock.Call { +func (mr *CalculatorMockRecorder) CalculateUptime(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptime", reflect.TypeOf((*Calculator)(nil).CalculateUptime), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptime", reflect.TypeOf((*Calculator)(nil).CalculateUptime), arg0) } // CalculateUptimePercent mocks base method. -func (m *Calculator) CalculateUptimePercent(arg0 ids.NodeID, arg1 ids.ID) (float64, error) { +func (m *Calculator) CalculateUptimePercent(arg0 ids.NodeID) (float64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CalculateUptimePercent", arg0, arg1) + ret := m.ctrl.Call(m, "CalculateUptimePercent", arg0) ret0, _ := ret[0].(float64) ret1, _ := ret[1].(error) return ret0, ret1 } // CalculateUptimePercent indicates an expected call of CalculateUptimePercent. -func (mr *CalculatorMockRecorder) CalculateUptimePercent(arg0, arg1 any) *gomock.Call { +func (mr *CalculatorMockRecorder) CalculateUptimePercent(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptimePercent", reflect.TypeOf((*Calculator)(nil).CalculateUptimePercent), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptimePercent", reflect.TypeOf((*Calculator)(nil).CalculateUptimePercent), arg0) } // CalculateUptimePercentFrom mocks base method. -func (m *Calculator) CalculateUptimePercentFrom(arg0 ids.NodeID, arg1 ids.ID, arg2 time.Time) (float64, error) { +func (m *Calculator) CalculateUptimePercentFrom(arg0 ids.NodeID, arg1 time.Time) (float64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CalculateUptimePercentFrom", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "CalculateUptimePercentFrom", arg0, arg1) ret0, _ := ret[0].(float64) ret1, _ := ret[1].(error) return ret0, ret1 } // CalculateUptimePercentFrom indicates an expected call of CalculateUptimePercentFrom. -func (mr *CalculatorMockRecorder) CalculateUptimePercentFrom(arg0, arg1, arg2 any) *gomock.Call { +func (mr *CalculatorMockRecorder) CalculateUptimePercentFrom(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptimePercentFrom", reflect.TypeOf((*Calculator)(nil).CalculateUptimePercentFrom), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CalculateUptimePercentFrom", reflect.TypeOf((*Calculator)(nil).CalculateUptimePercentFrom), arg0, arg1) } diff --git a/snow/validators/subnet_connector.go b/snow/validators/subnet_connector.go deleted file mode 100644 index 06b02ff9082..00000000000 --- a/snow/validators/subnet_connector.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package validators - -import ( - "context" - - "github.com/ava-labs/avalanchego/ids" -) - -// SubnetConnector represents a handler that is called when a connection is -// marked as connected to a subnet -type SubnetConnector interface { - ConnectedSubnet(ctx context.Context, nodeID ids.NodeID, subnetID ids.ID) error -} diff --git a/snow/validators/unhandled_subnet_connector.go b/snow/validators/unhandled_subnet_connector.go deleted file mode 100644 index 08447c4582a..00000000000 --- a/snow/validators/unhandled_subnet_connector.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package validators - -import ( - "context" - "fmt" - - "github.com/ava-labs/avalanchego/ids" -) - -var UnhandledSubnetConnector SubnetConnector = &unhandledSubnetConnector{} - -type unhandledSubnetConnector struct{} - -func (unhandledSubnetConnector) ConnectedSubnet(_ context.Context, nodeID ids.NodeID, subnetID ids.ID) error { - return fmt.Errorf( - "unhandled ConnectedSubnet with nodeID=%q and subnetID=%q", - nodeID, - subnetID, - ) -} diff --git a/snow/validators/validatorsmock/subnet_connector.go b/snow/validators/validatorsmock/subnet_connector.go deleted file mode 100644 index 118a287ac68..00000000000 --- a/snow/validators/validatorsmock/subnet_connector.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ava-labs/avalanchego/snow/validators (interfaces: SubnetConnector) -// -// Generated by this command: -// -// mockgen -package=validatorsmock -destination=snow/validators/validatorsmock/subnet_connector.go -mock_names=SubnetConnector=SubnetConnector github.com/ava-labs/avalanchego/snow/validators SubnetConnector -// - -// Package validatorsmock is a generated GoMock package. -package validatorsmock - -import ( - context "context" - reflect "reflect" - - ids "github.com/ava-labs/avalanchego/ids" - gomock "go.uber.org/mock/gomock" -) - -// SubnetConnector is a mock of SubnetConnector interface. -type SubnetConnector struct { - ctrl *gomock.Controller - recorder *SubnetConnectorMockRecorder -} - -// SubnetConnectorMockRecorder is the mock recorder for SubnetConnector. -type SubnetConnectorMockRecorder struct { - mock *SubnetConnector -} - -// NewSubnetConnector creates a new mock instance. -func NewSubnetConnector(ctrl *gomock.Controller) *SubnetConnector { - mock := &SubnetConnector{ctrl: ctrl} - mock.recorder = &SubnetConnectorMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *SubnetConnector) EXPECT() *SubnetConnectorMockRecorder { - return m.recorder -} - -// ConnectedSubnet mocks base method. -func (m *SubnetConnector) ConnectedSubnet(arg0 context.Context, arg1 ids.NodeID, arg2 ids.ID) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ConnectedSubnet", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// ConnectedSubnet indicates an expected call of ConnectedSubnet. -func (mr *SubnetConnectorMockRecorder) ConnectedSubnet(arg0, arg1, arg2 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectedSubnet", reflect.TypeOf((*SubnetConnector)(nil).ConnectedSubnet), arg0, arg1, arg2) -} diff --git a/vms/platformvm/api/static_service.go b/vms/platformvm/api/static_service.go index 46f02bd46ba..326e5fb5e8a 100644 --- a/vms/platformvm/api/static_service.go +++ b/vms/platformvm/api/static_service.go @@ -115,19 +115,15 @@ 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 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"` + 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,omitempty"` + Staked []UTXO `json:"staked,omitempty"` + Signer *signer.ProofOfPossession `json:"signer,omitempty"` // The delegators delegating to this validator DelegatorCount *json.Uint64 `json:"delegatorCount,omitempty"` @@ -149,7 +145,7 @@ type GenesisPermissionlessValidator struct { type PermissionedValidator struct { Staker // The owner the staking reward, if applicable, will go to - Connected bool `json:"connected"` + Connected *bool `json:"connected,omitempty"` Uptime *json.Float32 `json:"uptime,omitempty"` } diff --git a/vms/platformvm/block/builder/helpers_test.go b/vms/platformvm/block/builder/helpers_test.go index 02f7102a562..f1f22960c23 100644 --- a/vms/platformvm/block/builder/helpers_test.go +++ b/vms/platformvm/block/builder/helpers_test.go @@ -190,7 +190,7 @@ func newEnvironment(t *testing.T, f upgradetest.Fork) *environment { //nolint:un if res.isBootstrapped.Get() { validatorIDs := res.config.Validators.GetValidatorIDs(constants.PrimaryNetworkID) - require.NoError(res.uptimes.StopTracking(validatorIDs, constants.PrimaryNetworkID)) + require.NoError(res.uptimes.StopTracking(validatorIDs)) require.NoError(res.state.Commit()) } diff --git a/vms/platformvm/block/executor/block_test.go b/vms/platformvm/block/executor/block_test.go index 27eaed41598..b7a101d96bd 100644 --- a/vms/platformvm/block/executor/block_test.go +++ b/vms/platformvm/block/executor/block_test.go @@ -287,7 +287,7 @@ func TestBlockOptions(t *testing.T) { state.EXPECT().GetCurrentValidator(constants.PrimaryNetworkID, nodeID).Return(staker, nil) uptimes := uptimemock.NewCalculator(ctrl) - uptimes.EXPECT().CalculateUptimePercentFrom(nodeID, constants.PrimaryNetworkID, primaryNetworkValidatorStartTime).Return(0.0, database.ErrNotFound) + uptimes.EXPECT().CalculateUptimePercentFrom(nodeID, primaryNetworkValidatorStartTime).Return(0.0, database.ErrNotFound) manager := &manager{ backend: &backend{ @@ -405,7 +405,7 @@ func TestBlockOptions(t *testing.T) { state.EXPECT().GetSubnetTransformation(subnetID).Return(transformSubnetTx, nil) uptimes := uptimemock.NewCalculator(ctrl) - uptimes.EXPECT().CalculateUptimePercentFrom(nodeID, constants.PrimaryNetworkID, primaryNetworkValidatorStartTime).Return(.5, nil) + uptimes.EXPECT().CalculateUptimePercentFrom(nodeID, primaryNetworkValidatorStartTime).Return(.5, nil) manager := &manager{ backend: &backend{ @@ -467,7 +467,7 @@ func TestBlockOptions(t *testing.T) { state.EXPECT().GetSubnetTransformation(subnetID).Return(transformSubnetTx, nil) uptimes := uptimemock.NewCalculator(ctrl) - uptimes.EXPECT().CalculateUptimePercentFrom(nodeID, constants.PrimaryNetworkID, primaryNetworkValidatorStartTime).Return(.5, nil) + uptimes.EXPECT().CalculateUptimePercentFrom(nodeID, primaryNetworkValidatorStartTime).Return(.5, nil) manager := &manager{ backend: &backend{ diff --git a/vms/platformvm/block/executor/helpers_test.go b/vms/platformvm/block/executor/helpers_test.go index b11e4714c88..61df509156e 100644 --- a/vms/platformvm/block/executor/helpers_test.go +++ b/vms/platformvm/block/executor/helpers_test.go @@ -195,7 +195,7 @@ func newEnvironment(t *testing.T, ctrl *gomock.Controller, f upgradetest.Fork) * if res.isBootstrapped.Get() { validatorIDs := res.config.Validators.GetValidatorIDs(constants.PrimaryNetworkID) - require.NoError(res.uptimes.StopTracking(validatorIDs, constants.PrimaryNetworkID)) + require.NoError(res.uptimes.StopTracking(validatorIDs)) require.NoError(res.state.Commit()) } diff --git a/vms/platformvm/block/executor/options.go b/vms/platformvm/block/executor/options.go index f2071c8e13c..7487ea44933 100644 --- a/vms/platformvm/block/executor/options.go +++ b/vms/platformvm/block/executor/options.go @@ -175,10 +175,8 @@ func (o *options) prefersCommit(tx *txs.Tx) (bool, error) { expectedUptimePercentage = float64(transformSubnet.UptimeRequirement) / reward.PercentDenominator } - // TODO: calculate subnet uptimes uptime, err := o.uptimes.CalculateUptimePercentFrom( nodeID, - constants.PrimaryNetworkID, primaryNetworkValidator.StartTime, ) if err != nil { diff --git a/vms/platformvm/block/executor/proposal_block_test.go b/vms/platformvm/block/executor/proposal_block_test.go index 66a6c7604e2..60520a83ccf 100644 --- a/vms/platformvm/block/executor/proposal_block_test.go +++ b/vms/platformvm/block/executor/proposal_block_test.go @@ -108,7 +108,7 @@ func TestApricotProposalBlockTimeVerification(t *testing.T) { onParentAccept.EXPECT().GetCurrentSupply(constants.PrimaryNetworkID).Return(uint64(1000), nil).AnyTimes() onParentAccept.EXPECT().GetDelegateeReward(constants.PrimaryNetworkID, utx.NodeID()).Return(uint64(0), nil).AnyTimes() - env.mockedState.EXPECT().GetUptime(gomock.Any(), constants.PrimaryNetworkID).Return( + env.mockedState.EXPECT().GetUptime(gomock.Any()).Return( time.Microsecond, /*upDuration*/ time.Time{}, /*lastUpdated*/ nil, /*err*/ @@ -222,7 +222,7 @@ func TestBanffProposalBlockTimeVerification(t *testing.T) { pendingStakersIt.EXPECT().Release().AnyTimes() onParentAccept.EXPECT().GetPendingStakerIterator().Return(pendingStakersIt, nil).AnyTimes() - env.mockedState.EXPECT().GetUptime(gomock.Any(), gomock.Any()).Return( + env.mockedState.EXPECT().GetUptime(gomock.Any).Return( time.Microsecond, /*upDuration*/ time.Time{}, /*lastUpdated*/ nil, /*err*/ diff --git a/vms/platformvm/client_permissionless_validator.go b/vms/platformvm/client_permissionless_validator.go index b2e48b0cce2..d460a22579d 100644 --- a/vms/platformvm/client_permissionless_validator.go +++ b/vms/platformvm/client_permissionless_validator.go @@ -137,7 +137,7 @@ func getClientPermissionlessValidators(validatorsSliceIntf []interface{}) ([]Cli AccruedDelegateeReward: (*uint64)(apiValidator.AccruedDelegateeReward), DelegationFee: float32(apiValidator.DelegationFee), Uptime: (*float32)(apiValidator.Uptime), - Connected: &apiValidator.Connected, + Connected: apiValidator.Connected, Signer: apiValidator.Signer, DelegatorCount: (*uint64)(apiValidator.DelegatorCount), DelegatorWeight: (*uint64)(apiValidator.DelegatorWeight), diff --git a/vms/platformvm/service.go b/vms/platformvm/service.go index fd753de47c3..2e9bb346a8e 100644 --- a/vms/platformvm/service.go +++ b/vms/platformvm/service.go @@ -847,13 +847,24 @@ func (s *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidato shares := attr.shares delegationFee := avajson.Float32(100 * float32(shares) / float32(reward.PercentDenominator)) - - uptime, err := s.getAPIUptime(currentStaker) - if err != nil { - return err + var uptime *avajson.Float32 + var connected *bool + if args.SubnetID == constants.PrimaryNetworkID { + rawUptime, err := s.vm.uptimeManager.CalculateUptimePercentFrom(currentStaker.NodeID, currentStaker.StartTime) + if err != nil { + return err + } + // Transform this to a percentage (0-100) to make it consistent + // with observedUptime in info.peers API + currentUptime := avajson.Float32(rawUptime * 100) + if err != nil { + return err + } + isConnected := s.vm.uptimeManager.IsConnected(currentStaker.NodeID) + connected = &isConnected + uptime = ¤tUptime } - connected := s.vm.uptimeManager.IsConnected(nodeID, args.SubnetID) var ( validationRewardOwner *platformapi.Owner delegationRewardOwner *platformapi.Owner @@ -913,15 +924,8 @@ func (s *Service) GetCurrentValidators(_ *http.Request, args *GetCurrentValidato vdrToDelegators[delegator.NodeID] = append(vdrToDelegators[delegator.NodeID], delegator) case txs.SubnetPermissionedValidatorCurrentPriority: - uptime, err := s.getAPIUptime(currentStaker) - if err != nil { - return err - } - connected := s.vm.uptimeManager.IsConnected(nodeID, args.SubnetID) reply.Validators = append(reply.Validators, platformapi.PermissionedValidator{ - Staker: apiStaker, - Connected: connected, - Uptime: uptime, + Staker: apiStaker, }) default: @@ -1888,22 +1892,6 @@ func (s *Service) GetFeeState(_ *http.Request, _ *struct{}, reply *GetFeeStateRe return nil } -func (s *Service) getAPIUptime(staker *state.Staker) (*avajson.Float32, error) { - // Only report uptimes that we have been actively tracking. - if constants.PrimaryNetworkID != staker.SubnetID && !s.vm.TrackedSubnets.Contains(staker.SubnetID) { - return nil, nil - } - - rawUptime, err := s.vm.uptimeManager.CalculateUptimePercentFrom(staker.NodeID, staker.SubnetID, staker.StartTime) - if err != nil { - return nil, err - } - // Transform this to a percentage (0-100) to make it consistent - // with observedUptime in info.peers API - uptime := avajson.Float32(rawUptime * 100) - return &uptime, nil -} - func (s *Service) getAPIOwner(owner *secp256k1fx.OutputOwners) (*platformapi.Owner, error) { apiOwner := &platformapi.Owner{ Locktime: avajson.Uint64(owner.Locktime), diff --git a/vms/platformvm/service_test.go b/vms/platformvm/service_test.go index 9454de53455..0f09bc3a25f 100644 --- a/vms/platformvm/service_test.go +++ b/vms/platformvm/service_test.go @@ -34,6 +34,8 @@ import ( "github.com/ava-labs/avalanchego/utils/formatting" "github.com/ava-labs/avalanchego/utils/formatting/address" "github.com/ava-labs/avalanchego/utils/logging" + "github.com/ava-labs/avalanchego/utils/set" + "github.com/ava-labs/avalanchego/version" "github.com/ava-labs/avalanchego/vms/components/avax" "github.com/ava-labs/avalanchego/vms/components/gas" "github.com/ava-labs/avalanchego/vms/platformvm/block" @@ -616,6 +618,14 @@ func TestGetCurrentValidators(t *testing.T) { args := GetCurrentValidatorsArgs{SubnetID: constants.PrimaryNetworkID} response := GetCurrentValidatorsReply{} + // Connect to nodes other than the last node in genesis.Validators, which is the node being tested. + connectedIDs := set.NewSet[ids.NodeID](len(genesis.Validators) - 1) + for _, validatorTx := range genesis.Validators[:len(genesis.Validators)-1] { + validator := validatorTx.Unsigned.(*txs.AddValidatorTx) + connectedIDs.Add(validator.NodeID()) + require.NoError(service.vm.Connected(context.Background(), validator.NodeID(), version.CurrentApp)) + } + require.NoError(service.GetCurrentValidators(nil, &args, &response)) require.Len(response.Validators, len(genesis.Validators)) @@ -632,6 +642,8 @@ func TestGetCurrentValidators(t *testing.T) { require.Equal(validator.EndTime().Unix(), int64(gotVdr.EndTime)) require.Equal(validator.StartTime().Unix(), int64(gotVdr.StartTime)) + require.Equal(connectedIDs.Contains(validator.NodeID()), *gotVdr.Connected) + require.Equal(avajson.Float32(100), *gotVdr.Uptime) found = true break } diff --git a/vms/platformvm/state/mock_state.go b/vms/platformvm/state/mock_state.go index 1dfbd0a004a..de9dd04c55c 100644 --- a/vms/platformvm/state/mock_state.go +++ b/vms/platformvm/state/mock_state.go @@ -544,18 +544,18 @@ func (mr *MockStateMockRecorder) GetRewardUTXOs(txID any) *gomock.Call { } // GetStartTime mocks base method. -func (m *MockState) GetStartTime(nodeID ids.NodeID, subnetID ids.ID) (time.Time, error) { +func (m *MockState) GetStartTime(nodeID ids.NodeID) (time.Time, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetStartTime", nodeID, subnetID) + ret := m.ctrl.Call(m, "GetStartTime", nodeID) ret0, _ := ret[0].(time.Time) ret1, _ := ret[1].(error) return ret0, ret1 } // GetStartTime indicates an expected call of GetStartTime. -func (mr *MockStateMockRecorder) GetStartTime(nodeID, subnetID any) *gomock.Call { +func (mr *MockStateMockRecorder) GetStartTime(nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStartTime", reflect.TypeOf((*MockState)(nil).GetStartTime), nodeID, subnetID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStartTime", reflect.TypeOf((*MockState)(nil).GetStartTime), nodeID) } // GetStatelessBlock mocks base method. @@ -680,9 +680,9 @@ func (mr *MockStateMockRecorder) GetUTXO(utxoID any) *gomock.Call { } // GetUptime mocks base method. -func (m *MockState) GetUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration, time.Time, error) { +func (m *MockState) GetUptime(nodeID ids.NodeID) (time.Duration, time.Time, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetUptime", nodeID, subnetID) + ret := m.ctrl.Call(m, "GetUptime", nodeID) ret0, _ := ret[0].(time.Duration) ret1, _ := ret[1].(time.Time) ret2, _ := ret[2].(error) @@ -690,9 +690,9 @@ func (m *MockState) GetUptime(nodeID ids.NodeID, subnetID ids.ID) (time.Duration } // GetUptime indicates an expected call of GetUptime. -func (mr *MockStateMockRecorder) GetUptime(nodeID, subnetID any) *gomock.Call { +func (mr *MockStateMockRecorder) GetUptime(nodeID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUptime", reflect.TypeOf((*MockState)(nil).GetUptime), nodeID, subnetID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUptime", reflect.TypeOf((*MockState)(nil).GetUptime), nodeID) } // HasExpiry mocks base method. @@ -899,17 +899,17 @@ func (mr *MockStateMockRecorder) SetTimestamp(tm any) *gomock.Call { } // SetUptime mocks base method. -func (m *MockState) SetUptime(nodeID ids.NodeID, subnetID ids.ID, upDuration time.Duration, lastUpdated time.Time) error { +func (m *MockState) SetUptime(nodeID ids.NodeID, upDuration time.Duration, lastUpdated time.Time) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetUptime", nodeID, subnetID, upDuration, lastUpdated) + ret := m.ctrl.Call(m, "SetUptime", nodeID, upDuration, lastUpdated) ret0, _ := ret[0].(error) return ret0 } // SetUptime indicates an expected call of SetUptime. -func (mr *MockStateMockRecorder) SetUptime(nodeID, subnetID, upDuration, lastUpdated any) *gomock.Call { +func (mr *MockStateMockRecorder) SetUptime(nodeID, upDuration, lastUpdated any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetUptime", reflect.TypeOf((*MockState)(nil).SetUptime), nodeID, subnetID, upDuration, lastUpdated) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetUptime", reflect.TypeOf((*MockState)(nil).SetUptime), nodeID, upDuration, lastUpdated) } // UTXOIDs mocks base method. diff --git a/vms/platformvm/state/state.go b/vms/platformvm/state/state.go index bbc635500ec..4ca8db4dd45 100644 --- a/vms/platformvm/state/state.go +++ b/vms/platformvm/state/state.go @@ -1087,8 +1087,8 @@ func (s *state) DeleteUTXO(utxoID ids.ID) { s.modifiedUTXOs[utxoID] = nil } -func (s *state) GetStartTime(nodeID ids.NodeID, subnetID ids.ID) (time.Time, error) { - staker, err := s.currentStakers.GetValidator(subnetID, nodeID) +func (s *state) GetStartTime(nodeID ids.NodeID) (time.Time, error) { + staker, err := s.currentStakers.GetValidator(constants.PrimaryNetworkID, nodeID) if err != nil { return time.Time{}, err } @@ -2646,6 +2646,14 @@ func (s *state) ReindexBlocks(lock sync.Locker, log logging.Logger) error { return s.Commit() } +func (s *state) GetUptime(vdrID ids.NodeID) (time.Duration, time.Time, error) { + return s.validatorState.GetUptime(vdrID, constants.PrimaryNetworkID) +} + +func (s *state) SetUptime(vdrID ids.NodeID, upDuration time.Duration, lastUpdated time.Time) error { + return s.validatorState.SetUptime(vdrID, constants.PrimaryNetworkID, upDuration, lastUpdated) +} + func markInitialized(db database.KeyValueWriter) error { return db.Put(InitializedKey, nil) } diff --git a/vms/platformvm/state/state_test.go b/vms/platformvm/state/state_test.go index a0dcd0cb7dc..0f23a3ebc83 100644 --- a/vms/platformvm/state/state_test.go +++ b/vms/platformvm/state/state_test.go @@ -178,10 +178,15 @@ func TestPersistStakers(t *testing.T) { ) }, checkValidatorUptimes: func(r *require.Assertions, s *state, staker *Staker) { - upDuration, lastUpdated, err := s.GetUptime(staker.NodeID, staker.SubnetID) - r.NoError(err) - r.Equal(upDuration, time.Duration(0)) - r.Equal(lastUpdated, staker.StartTime) + upDuration, lastUpdated, err := s.GetUptime(staker.NodeID) + if staker.SubnetID != constants.PrimaryNetworkID { + // only primary network validators have uptimes + r.ErrorIs(err, database.ErrNotFound) + } else { + r.NoError(err) + r.Equal(upDuration, time.Duration(0)) + r.Equal(lastUpdated, staker.StartTime) + } }, checkDiffs: func(r *require.Assertions, s *state, staker *Staker, height uint64) { weightDiffBytes, err := s.validatorWeightDiffsDB.Get(marshalDiffKey(staker.SubnetID, height, staker.NodeID)) @@ -332,7 +337,7 @@ func TestPersistStakers(t *testing.T) { }, checkValidatorUptimes: func(r *require.Assertions, s *state, staker *Staker) { // pending validators uptime is not tracked - _, _, err := s.GetUptime(staker.NodeID, staker.SubnetID) + _, _, err := s.GetUptime(staker.NodeID) r.ErrorIs(err, database.ErrNotFound) }, checkDiffs: func(r *require.Assertions, s *state, staker *Staker, height uint64) { @@ -454,7 +459,7 @@ func TestPersistStakers(t *testing.T) { }, checkValidatorUptimes: func(r *require.Assertions, s *state, staker *Staker) { // uptimes of delete validators are dropped - _, _, err := s.GetUptime(staker.NodeID, staker.SubnetID) + _, _, err := s.GetUptime(staker.NodeID) r.ErrorIs(err, database.ErrNotFound) }, checkDiffs: func(r *require.Assertions, s *state, staker *Staker, height uint64) { @@ -607,7 +612,7 @@ func TestPersistStakers(t *testing.T) { r.NotContains(valsMap, staker.NodeID) }, checkValidatorUptimes: func(r *require.Assertions, s *state, staker *Staker) { - _, _, err := s.GetUptime(staker.NodeID, staker.SubnetID) + _, _, err := s.GetUptime(staker.NodeID) r.ErrorIs(err, database.ErrNotFound) }, checkDiffs: func(r *require.Assertions, s *state, staker *Staker, height uint64) { diff --git a/vms/platformvm/txs/executor/helpers_test.go b/vms/platformvm/txs/executor/helpers_test.go index 595f4cc2ae6..90828174b82 100644 --- a/vms/platformvm/txs/executor/helpers_test.go +++ b/vms/platformvm/txs/executor/helpers_test.go @@ -157,13 +157,8 @@ func newEnvironment(t *testing.T, f upgradetest.Fork) *environment { if env.isBootstrapped.Get() { validatorIDs := env.config.Validators.GetValidatorIDs(constants.PrimaryNetworkID) - require.NoError(env.uptimes.StopTracking(validatorIDs, constants.PrimaryNetworkID)) + require.NoError(env.uptimes.StopTracking(validatorIDs)) - for subnetID := range env.config.TrackedSubnets { - validatorIDs := env.config.Validators.GetValidatorIDs(subnetID) - - require.NoError(env.uptimes.StopTracking(validatorIDs, subnetID)) - } env.state.SetHeight(math.MaxUint64) require.NoError(env.state.Commit()) } diff --git a/vms/platformvm/vm.go b/vms/platformvm/vm.go index ba86190e953..405f9faeba3 100644 --- a/vms/platformvm/vm.go +++ b/vms/platformvm/vm.go @@ -52,10 +52,9 @@ import ( ) var ( - _ snowmanblock.ChainVM = (*VM)(nil) - _ secp256k1fx.VM = (*VM)(nil) - _ validators.State = (*VM)(nil) - _ validators.SubnetConnector = (*VM)(nil) + _ snowmanblock.ChainVM = (*VM)(nil) + _ secp256k1fx.VM = (*VM)(nil) + _ validators.State = (*VM)(nil) ) type VM struct { @@ -349,7 +348,7 @@ func (vm *VM) onNormalOperationsStarted() error { } primaryVdrIDs := vm.Validators.GetValidatorIDs(constants.PrimaryNetworkID) - if err := vm.uptimeManager.StartTracking(primaryVdrIDs, constants.PrimaryNetworkID); err != nil { + if err := vm.uptimeManager.StartTracking(primaryVdrIDs); err != nil { return err } @@ -357,11 +356,6 @@ func (vm *VM) onNormalOperationsStarted() error { vm.Validators.RegisterSetCallbackListener(constants.PrimaryNetworkID, vl) for subnetID := range vm.TrackedSubnets { - vdrIDs := vm.Validators.GetValidatorIDs(subnetID) - if err := vm.uptimeManager.StartTracking(vdrIDs, subnetID); err != nil { - return err - } - vl := validators.NewLogger(vm.ctx.Log, subnetID, vm.ctx.NodeID) vm.Validators.RegisterSetCallbackListener(subnetID, vl) } @@ -397,17 +391,10 @@ func (vm *VM) Shutdown(context.Context) error { if vm.bootstrapped.Get() { primaryVdrIDs := vm.Validators.GetValidatorIDs(constants.PrimaryNetworkID) - if err := vm.uptimeManager.StopTracking(primaryVdrIDs, constants.PrimaryNetworkID); err != nil { + if err := vm.uptimeManager.StopTracking(primaryVdrIDs); err != nil { return err } - for subnetID := range vm.TrackedSubnets { - vdrIDs := vm.Validators.GetValidatorIDs(subnetID) - if err := vm.uptimeManager.StopTracking(vdrIDs, subnetID); err != nil { - return err - } - } - if err := vm.state.Commit(); err != nil { return err } @@ -473,16 +460,12 @@ func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error) { } func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, version *version.Application) error { - if err := vm.uptimeManager.Connect(nodeID, constants.PrimaryNetworkID); err != nil { + if err := vm.uptimeManager.Connect(nodeID); err != nil { return err } return vm.Network.Connected(ctx, nodeID, version) } -func (vm *VM) ConnectedSubnet(_ context.Context, nodeID ids.NodeID, subnetID ids.ID) error { - return vm.uptimeManager.Connect(nodeID, subnetID) -} - func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error { if err := vm.uptimeManager.Disconnect(nodeID); err != nil { return err diff --git a/vms/platformvm/vm_test.go b/vms/platformvm/vm_test.go index ab31ba76402..9c87556e760 100644 --- a/vms/platformvm/vm_test.go +++ b/vms/platformvm/vm_test.go @@ -1349,7 +1349,6 @@ func TestBootstrapPartiallyAccepted(t *testing.T) { time.Hour, 2, cpuTracker, - vm, subnets.New(ctx.NodeID, subnets.Config{}), tracker.NewPeers(), peerTracker,