diff --git a/node/app/db_console.go b/node/app/db_console.go index 7266674..25efbbd 100644 --- a/node/app/db_console.go +++ b/node/app/db_console.go @@ -886,11 +886,11 @@ func logoVersion(width int) string { out += " ####################################### ########\n" out += " ############################# ##\n" out += " \n" - out += " Quilibrium Node - v1.2.4 – Dawn\n" + out += " Quilibrium Node - v1.2.5 – Dawn\n" out += " \n" out += " DB Console\n" } else { - out = "Quilibrium Node - v1.2.4 – Dawn - DB Console\n" + out = "Quilibrium Node - v1.2.5 – Dawn - DB Console\n" } return out } diff --git a/node/config/engine.go b/node/config/engine.go index b2f5f22..3785df3 100644 --- a/node/config/engine.go +++ b/node/config/engine.go @@ -7,6 +7,7 @@ type EngineConfig struct { MaxFrames int64 `yaml:"maxFrames"` PendingCommitWorkers int64 `yaml:"pendingCommitWorkers"` MinimumPeersRequired int `yaml:"minimumPeersRequired"` + StatsMultiaddr string `yaml:"statsMultiaddr` // Values used only for testing – do not override these in production, your // node will get kicked out diff --git a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go index f58cee0..bd031fd 100644 --- a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go +++ b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go @@ -2,14 +2,19 @@ package ceremony import ( "bytes" + "context" "crypto" + "crypto/tls" "encoding/binary" "sync" "time" + "github.com/multiformats/go-multiaddr" + mn "github.com/multiformats/go-multiaddr/net" "github.com/pkg/errors" "go.uber.org/zap" "google.golang.org/grpc" + "google.golang.org/grpc/credentials" "google.golang.org/protobuf/types/known/anypb" "source.quilibrium.com/quilibrium/monorepo/nekryptology/pkg/core/curves" "source.quilibrium.com/quilibrium/monorepo/node/config" @@ -77,6 +82,7 @@ type CeremonyDataClockConsensusEngine struct { frameProver qcrypto.FrameProver stagedLobbyStateTransitions *protobufs.CeremonyLobbyStateTransition minimumPeersRequired int + statsClient protobufs.NodeStatsClient frameChan chan *protobufs.ClockFrame executionEngines map[string]execution.ExecutionEngine @@ -167,6 +173,35 @@ func NewCeremonyDataClockConsensusEngine( difficulty = 10000 } + var statsClient protobufs.NodeStatsClient + if engineConfig.StatsMultiaddr != "" { + ma, err := multiaddr.NewMultiaddr(engineConfig.StatsMultiaddr) + if err != nil { + panic(err) + } + + _, addr, err := mn.DialArgs(ma) + if err != nil { + panic(err) + } + + cc, err := grpc.Dial( + addr, + grpc.WithTransportCredentials( + credentials.NewTLS(&tls.Config{InsecureSkipVerify: false}), + ), + grpc.WithDefaultCallOptions( + grpc.MaxCallSendMsgSize(600*1024*1024), + grpc.MaxCallRecvMsgSize(600*1024*1024), + ), + ) + if err != nil { + panic(err) + } + + statsClient = protobufs.NewNodeStatsClient(cc) + } + e := &CeremonyDataClockConsensusEngine{ difficulty: difficulty, logger: logger, @@ -195,6 +230,7 @@ func NewCeremonyDataClockConsensusEngine( frameProver: frameProver, masterTimeReel: masterTimeReel, dataTimeReel: dataTimeReel, + statsClient: statsClient, } logger.Info("constructing consensus engine") @@ -312,6 +348,20 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error { } e.peerMapMx.Unlock() + if e.statsClient != nil { + peerInfo := e.GetPeerInfo() + _, err := e.statsClient.PutPeerInfo( + context.Background(), + &protobufs.PutPeerInfoRequest{ + PeerInfo: peerInfo.PeerInfo, + UncooperativePeerInfo: peerInfo.UncooperativePeerInfo, + }, + ) + if err != nil { + e.logger.Error("could not emit stats", zap.Error(err)) + } + } + if err := e.publishMessage(e.filter, list); err != nil { e.logger.Debug("error publishing message", zap.Error(err)) } diff --git a/node/consensus/consensus_engine.go b/node/consensus/consensus_engine.go index 3379363..00076a6 100644 --- a/node/consensus/consensus_engine.go +++ b/node/consensus/consensus_engine.go @@ -59,5 +59,5 @@ func GetMinimumVersion() []byte { } func GetVersion() []byte { - return []byte{0x01, 0x02, 0x04} + return []byte{0x01, 0x02, 0x05} } diff --git a/node/consensus/time/data_time_reel.go b/node/consensus/time/data_time_reel.go index 46fe6a9..69ba839 100644 --- a/node/consensus/time/data_time_reel.go +++ b/node/consensus/time/data_time_reel.go @@ -174,10 +174,15 @@ func (d *DataTimeReel) createGenesisFrame() ( panic("initial prover keys is nil") } + difficulty := d.engineConfig.Difficulty + if difficulty == 0 { + difficulty = 10000 + } + frame, trie, err := d.frameProver.CreateDataGenesisFrame( d.filter, d.origin, - d.engineConfig.Difficulty, + difficulty, d.initialInclusionProof, d.initialProverKeys, true, diff --git a/node/consensus/time/master_time_reel.go b/node/consensus/time/master_time_reel.go index 8ba02ab..7797b8d 100644 --- a/node/consensus/time/master_time_reel.go +++ b/node/consensus/time/master_time_reel.go @@ -78,7 +78,24 @@ func (m *MasterTimeReel) Start() error { panic(err) } - if frame == nil { + genesis, err := m.clockStore.GetMasterClockFrame(m.filter, 0) + if err != nil && !errors.Is(err, store.ErrNotFound) { + panic(err) + } + + rebuildGenesisFrame := false + if genesis != nil && genesis.Difficulty == 0 { + m.logger.Warn("corrupted genesis frame detected, rebuilding") + + err = m.clockStore.ResetMasterClockFrames(m.filter) + if err != nil { + panic(err) + } + + rebuildGenesisFrame = true + } + + if frame == nil || rebuildGenesisFrame { m.head = m.createGenesisFrame() } else { m.head = frame @@ -125,10 +142,15 @@ func (m *MasterTimeReel) createGenesisFrame() *protobufs.ClockFrame { panic(errors.New("genesis seed is nil")) } + difficulty := m.engineConfig.Difficulty + if difficulty == 0 { + difficulty = 10000 + } + frame, err := m.frameProver.CreateMasterGenesisFrame( m.filter, seed, - m.engineConfig.Difficulty, + difficulty, ) if err != nil { panic(err) diff --git a/node/execution/intrinsics/ceremony/application/ceremony_application.go b/node/execution/intrinsics/ceremony/application/ceremony_application.go index 38b0dcb..34f773f 100644 --- a/node/execution/intrinsics/ceremony/application/ceremony_application.go +++ b/node/execution/intrinsics/ceremony/application/ceremony_application.go @@ -562,7 +562,6 @@ func GetOutputsFromClockFrame( ) { var associatedProof []byte var lobbyState *protobufs.CeremonyLobbyState - if len(frame.AggregateProofs) > 0 { for _, proofs := range frame.AggregateProofs { for _, inclusion := range proofs.InclusionCommitments { diff --git a/node/execution/intrinsics/ceremony/ceremony_execution_engine.go b/node/execution/intrinsics/ceremony/ceremony_execution_engine.go index 01f30fc..4de6e15 100644 --- a/node/execution/intrinsics/ceremony/ceremony_execution_engine.go +++ b/node/execution/intrinsics/ceremony/ceremony_execution_engine.go @@ -87,12 +87,25 @@ func NewCeremonyExecutionEngine( p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)..., ) - _, _, err = clockStore.GetDataClockFrame(intrinsicFilter, 0) + frame, _, err := clockStore.GetDataClockFrame(intrinsicFilter, 0) var origin []byte var inclusionProof *qcrypto.InclusionAggregateProof var proverKeys [][]byte - if err != nil && errors.Is(err, store.ErrNotFound) { + rebuildGenesisFrame := false + if frame != nil && + len(frame.AggregateProofs[0].InclusionCommitments[0].Data) < 2000 { + logger.Warn("corrupted genesis frame detected, rebuilding") + + err = clockStore.ResetDataClockFrames(intrinsicFilter) + if err != nil { + panic(err) + } + + rebuildGenesisFrame = true + } + + if err != nil && errors.Is(err, store.ErrNotFound) || rebuildGenesisFrame { origin, inclusionProof, proverKeys = CreateGenesisState( logger, engineConfig, @@ -205,8 +218,13 @@ func CreateGenesisState( logger.Info(l) } + difficulty := engineConfig.Difficulty + if difficulty == 0 { + difficulty = 10000 + } + b := sha3.Sum256(seed) - v := vdf.New(engineConfig.Difficulty, b) + v := vdf.New(difficulty, b) v.Execute() o := v.GetOutput() @@ -355,8 +373,17 @@ func CreateGenesisState( panic(err) } + intrinsicFilter := append( + p2p.GetBloomFilter(application.CEREMONY_ADDRESS, 256, 3), + p2p.GetBloomFilterIndices(application.CEREMONY_ADDRESS, 65536, 24)..., + ) + + // Compat: there was a bug that went unnoticed in prior versions, + // the raw filter was used instead of the application address, which didn't + // affect execution because we forcibly stashed it. Preserving this to ensure + // no rebuilding of frame history is required. executionOutput := &protobufs.IntrinsicExecutionOutput{ - Address: application.CEREMONY_ADDRESS, + Address: intrinsicFilter, Output: outputBytes, Proof: proofBytes, } @@ -366,23 +393,9 @@ func CreateGenesisState( panic(err) } - logger.Info("encoded execution output") - - digest := sha3.NewShake256() - _, err = digest.Write(data) - if err != nil { - panic(err) - } - - expand := make([]byte, 1024) - _, err = digest.Read(expand) - if err != nil { - panic(err) - } - logger.Info("proving execution output for inclusion") commitment, err := inclusionProver.Commit( - expand, + data, protobufs.IntrinsicExecutionOutputType, ) if err != nil { diff --git a/node/main.go b/node/main.go index fd20de0..1d58d89 100644 --- a/node/main.go +++ b/node/main.go @@ -10,9 +10,10 @@ import ( "os" "os/signal" "path/filepath" - "source.quilibrium.com/quilibrium/monorepo/node/protobufs" "syscall" + "source.quilibrium.com/quilibrium/monorepo/node/protobufs" + "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" "github.com/pkg/errors" @@ -283,5 +284,5 @@ func printLogo() { func printVersion() { fmt.Println(" ") - fmt.Println(" Quilibrium Node - v1.2.4 – Dawn") + fmt.Println(" Quilibrium Node - v1.2.5 – Dawn") } diff --git a/node/protobufs/node.pb.go b/node/protobufs/node.pb.go index 4b916ac..eed75c7 100644 --- a/node/protobufs/node.pb.go +++ b/node/protobufs/node.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.23.4 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: node.proto package protobufs @@ -638,6 +638,170 @@ func (x *NodeInfoResponse) GetPeerScore() uint64 { return 0 } +type PutPeerInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PeerInfo []*PeerInfo `protobuf:"bytes,1,rep,name=peer_info,json=peerInfo,proto3" json:"peer_info,omitempty"` + UncooperativePeerInfo []*PeerInfo `protobuf:"bytes,2,rep,name=uncooperative_peer_info,json=uncooperativePeerInfo,proto3" json:"uncooperative_peer_info,omitempty"` +} + +func (x *PutPeerInfoRequest) Reset() { + *x = PutPeerInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_node_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutPeerInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutPeerInfoRequest) ProtoMessage() {} + +func (x *PutPeerInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_node_proto_msgTypes[11] + 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 PutPeerInfoRequest.ProtoReflect.Descriptor instead. +func (*PutPeerInfoRequest) Descriptor() ([]byte, []int) { + return file_node_proto_rawDescGZIP(), []int{11} +} + +func (x *PutPeerInfoRequest) GetPeerInfo() []*PeerInfo { + if x != nil { + return x.PeerInfo + } + return nil +} + +func (x *PutPeerInfoRequest) GetUncooperativePeerInfo() []*PeerInfo { + if x != nil { + return x.UncooperativePeerInfo + } + return nil +} + +type PutNodeInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + MaxFrame uint64 `protobuf:"varint,2,opt,name=max_frame,json=maxFrame,proto3" json:"max_frame,omitempty"` + PeerScore uint64 `protobuf:"varint,3,opt,name=peer_score,json=peerScore,proto3" json:"peer_score,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *PutNodeInfoRequest) Reset() { + *x = PutNodeInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_node_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutNodeInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutNodeInfoRequest) ProtoMessage() {} + +func (x *PutNodeInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_node_proto_msgTypes[12] + 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 PutNodeInfoRequest.ProtoReflect.Descriptor instead. +func (*PutNodeInfoRequest) Descriptor() ([]byte, []int) { + return file_node_proto_rawDescGZIP(), []int{12} +} + +func (x *PutNodeInfoRequest) GetPeerId() string { + if x != nil { + return x.PeerId + } + return "" +} + +func (x *PutNodeInfoRequest) GetMaxFrame() uint64 { + if x != nil { + return x.MaxFrame + } + return 0 +} + +func (x *PutNodeInfoRequest) GetPeerScore() uint64 { + if x != nil { + return x.PeerScore + } + return 0 +} + +func (x *PutNodeInfoRequest) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +type PutResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PutResponse) Reset() { + *x = PutResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_node_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_node_proto_msgTypes[13] + 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 PutResponse.ProtoReflect.Descriptor instead. +func (*PutResponse) Descriptor() ([]byte, []int) { + return file_node_proto_rawDescGZIP(), []int{13} +} + type NetworkInfoResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -649,7 +813,7 @@ type NetworkInfoResponse struct { func (x *NetworkInfoResponse) Reset() { *x = NetworkInfoResponse{} if protoimpl.UnsafeEnabled { - mi := &file_node_proto_msgTypes[11] + mi := &file_node_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -662,7 +826,7 @@ func (x *NetworkInfoResponse) String() string { func (*NetworkInfoResponse) ProtoMessage() {} func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_node_proto_msgTypes[11] + mi := &file_node_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -675,7 +839,7 @@ func (x *NetworkInfoResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use NetworkInfoResponse.ProtoReflect.Descriptor instead. func (*NetworkInfoResponse) Descriptor() ([]byte, []int) { - return file_node_proto_rawDescGZIP(), []int{11} + return file_node_proto_rawDescGZIP(), []int{14} } func (x *NetworkInfoResponse) GetNetworkInfo() []*NetworkInfo { @@ -694,7 +858,7 @@ type GetTokenInfoRequest struct { func (x *GetTokenInfoRequest) Reset() { *x = GetTokenInfoRequest{} if protoimpl.UnsafeEnabled { - mi := &file_node_proto_msgTypes[12] + mi := &file_node_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -707,7 +871,7 @@ func (x *GetTokenInfoRequest) String() string { func (*GetTokenInfoRequest) ProtoMessage() {} func (x *GetTokenInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_node_proto_msgTypes[12] + mi := &file_node_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -720,7 +884,7 @@ func (x *GetTokenInfoRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetTokenInfoRequest.ProtoReflect.Descriptor instead. func (*GetTokenInfoRequest) Descriptor() ([]byte, []int) { - return file_node_proto_rawDescGZIP(), []int{12} + return file_node_proto_rawDescGZIP(), []int{15} } type TokenInfoResponse struct { @@ -745,7 +909,7 @@ type TokenInfoResponse struct { func (x *TokenInfoResponse) Reset() { *x = TokenInfoResponse{} if protoimpl.UnsafeEnabled { - mi := &file_node_proto_msgTypes[13] + mi := &file_node_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -758,7 +922,7 @@ func (x *TokenInfoResponse) String() string { func (*TokenInfoResponse) ProtoMessage() {} func (x *TokenInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_node_proto_msgTypes[13] + mi := &file_node_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -771,7 +935,7 @@ func (x *TokenInfoResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TokenInfoResponse.ProtoReflect.Descriptor instead. func (*TokenInfoResponse) Descriptor() ([]byte, []int) { - return file_node_proto_rawDescGZIP(), []int{13} + return file_node_proto_rawDescGZIP(), []int{16} } func (x *TokenInfoResponse) GetConfirmedTokenSupply() []byte { @@ -880,73 +1044,107 @@ var file_node_proto_rawDesc = []byte{ 0x61, 0x78, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x65, - 0x65, 0x72, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x5e, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, 0x6f, - 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, - 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, - 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xe0, - 0x01, 0x0a, 0x11, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, - 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x38, 0x0a, 0x18, 0x75, 0x6e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x75, 0x6e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x5f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6f, 0x77, 0x6e, 0x65, - 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x75, 0x6e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x75, 0x6e, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x73, 0x32, 0x80, 0x05, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x5f, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x29, - 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, - 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x65, 0x72, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x12, 0x50, 0x75, 0x74, 0x50, + 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, + 0x0a, 0x09, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x59, + 0x0a, 0x17, 0x75, 0x6e, 0x63, 0x6f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, + 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, + 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x15, 0x75, 0x6e, 0x63, 0x6f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x76, + 0x65, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x87, 0x01, 0x0a, 0x12, 0x50, 0x75, + 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, + 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, + 0x78, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x73, + 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, + 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, + 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x5e, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, + 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, + 0x66, 0x6f, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xe0, 0x01, 0x0a, 0x11, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x34, 0x0a, 0x16, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x14, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x38, 0x0a, 0x18, 0x75, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x72, 0x6d, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x75, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x72, 0x6d, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x12, + 0x21, 0x0a, 0x0c, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x75, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, + 0x64, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x75, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, + 0x64, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x32, 0x80, 0x05, 0x0a, + 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x09, + 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, - 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, - 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, - 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, - 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, + 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, + 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x46, + 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, + 0x0c, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x2e, + 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, - 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, - 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, - 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, - 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x0e, 0x47, 0x65, - 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, 0x71, - 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, - 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, - 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, - 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65, - 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, + 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x50, 0x65, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, + 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, + 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, + 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, + 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, + 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, - 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, - 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x70, 0x62, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x71, - 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, - 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x6d, 0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x70, - 0x6f, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, + 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, + 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, + 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, + 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, + 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, + 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, + 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, + 0xcf, 0x01, 0x0a, 0x09, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x60, 0x0a, + 0x0b, 0x50, 0x75, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, + 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x60, 0x0a, 0x0b, 0x50, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, + 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x71, 0x75, + 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, + 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x6c, + 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, 0x69, 0x6c, 0x69, + 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x6d, 0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6e, + 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -961,7 +1159,7 @@ func file_node_proto_rawDescGZIP() []byte { return file_node_proto_rawDescData } -var file_node_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_node_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_node_proto_goTypes = []interface{}{ (*GetFramesRequest)(nil), // 0: quilibrium.node.node.pb.GetFramesRequest (*GetFrameInfoRequest)(nil), // 1: quilibrium.node.node.pb.GetFrameInfoRequest @@ -974,34 +1172,43 @@ var file_node_proto_goTypes = []interface{}{ (*PeerInfoResponse)(nil), // 8: quilibrium.node.node.pb.PeerInfoResponse (*NetworkInfo)(nil), // 9: quilibrium.node.node.pb.NetworkInfo (*NodeInfoResponse)(nil), // 10: quilibrium.node.node.pb.NodeInfoResponse - (*NetworkInfoResponse)(nil), // 11: quilibrium.node.node.pb.NetworkInfoResponse - (*GetTokenInfoRequest)(nil), // 12: quilibrium.node.node.pb.GetTokenInfoRequest - (*TokenInfoResponse)(nil), // 13: quilibrium.node.node.pb.TokenInfoResponse - (*ClockFrame)(nil), // 14: quilibrium.node.clock.pb.ClockFrame + (*PutPeerInfoRequest)(nil), // 11: quilibrium.node.node.pb.PutPeerInfoRequest + (*PutNodeInfoRequest)(nil), // 12: quilibrium.node.node.pb.PutNodeInfoRequest + (*PutResponse)(nil), // 13: quilibrium.node.node.pb.PutResponse + (*NetworkInfoResponse)(nil), // 14: quilibrium.node.node.pb.NetworkInfoResponse + (*GetTokenInfoRequest)(nil), // 15: quilibrium.node.node.pb.GetTokenInfoRequest + (*TokenInfoResponse)(nil), // 16: quilibrium.node.node.pb.TokenInfoResponse + (*ClockFrame)(nil), // 17: quilibrium.node.clock.pb.ClockFrame } var file_node_proto_depIdxs = []int32{ - 14, // 0: quilibrium.node.node.pb.FramesResponse.truncated_clock_frames:type_name -> quilibrium.node.clock.pb.ClockFrame - 14, // 1: quilibrium.node.node.pb.FrameInfoResponse.clock_frame:type_name -> quilibrium.node.clock.pb.ClockFrame + 17, // 0: quilibrium.node.node.pb.FramesResponse.truncated_clock_frames:type_name -> quilibrium.node.clock.pb.ClockFrame + 17, // 1: quilibrium.node.node.pb.FrameInfoResponse.clock_frame:type_name -> quilibrium.node.clock.pb.ClockFrame 7, // 2: quilibrium.node.node.pb.PeerInfoResponse.peer_info:type_name -> quilibrium.node.node.pb.PeerInfo 7, // 3: quilibrium.node.node.pb.PeerInfoResponse.uncooperative_peer_info:type_name -> quilibrium.node.node.pb.PeerInfo - 9, // 4: quilibrium.node.node.pb.NetworkInfoResponse.network_info:type_name -> quilibrium.node.node.pb.NetworkInfo - 0, // 5: quilibrium.node.node.pb.NodeService.GetFrames:input_type -> quilibrium.node.node.pb.GetFramesRequest - 1, // 6: quilibrium.node.node.pb.NodeService.GetFrameInfo:input_type -> quilibrium.node.node.pb.GetFrameInfoRequest - 2, // 7: quilibrium.node.node.pb.NodeService.GetPeerInfo:input_type -> quilibrium.node.node.pb.GetPeerInfoRequest - 3, // 8: quilibrium.node.node.pb.NodeService.GetNodeInfo:input_type -> quilibrium.node.node.pb.GetNodeInfoRequest - 4, // 9: quilibrium.node.node.pb.NodeService.GetNetworkInfo:input_type -> quilibrium.node.node.pb.GetNetworkInfoRequest - 12, // 10: quilibrium.node.node.pb.NodeService.GetTokenInfo:input_type -> quilibrium.node.node.pb.GetTokenInfoRequest - 5, // 11: quilibrium.node.node.pb.NodeService.GetFrames:output_type -> quilibrium.node.node.pb.FramesResponse - 6, // 12: quilibrium.node.node.pb.NodeService.GetFrameInfo:output_type -> quilibrium.node.node.pb.FrameInfoResponse - 8, // 13: quilibrium.node.node.pb.NodeService.GetPeerInfo:output_type -> quilibrium.node.node.pb.PeerInfoResponse - 10, // 14: quilibrium.node.node.pb.NodeService.GetNodeInfo:output_type -> quilibrium.node.node.pb.NodeInfoResponse - 11, // 15: quilibrium.node.node.pb.NodeService.GetNetworkInfo:output_type -> quilibrium.node.node.pb.NetworkInfoResponse - 13, // 16: quilibrium.node.node.pb.NodeService.GetTokenInfo:output_type -> quilibrium.node.node.pb.TokenInfoResponse - 11, // [11:17] is the sub-list for method output_type - 5, // [5:11] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 7, // 4: quilibrium.node.node.pb.PutPeerInfoRequest.peer_info:type_name -> quilibrium.node.node.pb.PeerInfo + 7, // 5: quilibrium.node.node.pb.PutPeerInfoRequest.uncooperative_peer_info:type_name -> quilibrium.node.node.pb.PeerInfo + 9, // 6: quilibrium.node.node.pb.NetworkInfoResponse.network_info:type_name -> quilibrium.node.node.pb.NetworkInfo + 0, // 7: quilibrium.node.node.pb.NodeService.GetFrames:input_type -> quilibrium.node.node.pb.GetFramesRequest + 1, // 8: quilibrium.node.node.pb.NodeService.GetFrameInfo:input_type -> quilibrium.node.node.pb.GetFrameInfoRequest + 2, // 9: quilibrium.node.node.pb.NodeService.GetPeerInfo:input_type -> quilibrium.node.node.pb.GetPeerInfoRequest + 3, // 10: quilibrium.node.node.pb.NodeService.GetNodeInfo:input_type -> quilibrium.node.node.pb.GetNodeInfoRequest + 4, // 11: quilibrium.node.node.pb.NodeService.GetNetworkInfo:input_type -> quilibrium.node.node.pb.GetNetworkInfoRequest + 15, // 12: quilibrium.node.node.pb.NodeService.GetTokenInfo:input_type -> quilibrium.node.node.pb.GetTokenInfoRequest + 12, // 13: quilibrium.node.node.pb.NodeStats.PutNodeInfo:input_type -> quilibrium.node.node.pb.PutNodeInfoRequest + 11, // 14: quilibrium.node.node.pb.NodeStats.PutPeerInfo:input_type -> quilibrium.node.node.pb.PutPeerInfoRequest + 5, // 15: quilibrium.node.node.pb.NodeService.GetFrames:output_type -> quilibrium.node.node.pb.FramesResponse + 6, // 16: quilibrium.node.node.pb.NodeService.GetFrameInfo:output_type -> quilibrium.node.node.pb.FrameInfoResponse + 8, // 17: quilibrium.node.node.pb.NodeService.GetPeerInfo:output_type -> quilibrium.node.node.pb.PeerInfoResponse + 10, // 18: quilibrium.node.node.pb.NodeService.GetNodeInfo:output_type -> quilibrium.node.node.pb.NodeInfoResponse + 14, // 19: quilibrium.node.node.pb.NodeService.GetNetworkInfo:output_type -> quilibrium.node.node.pb.NetworkInfoResponse + 16, // 20: quilibrium.node.node.pb.NodeService.GetTokenInfo:output_type -> quilibrium.node.node.pb.TokenInfoResponse + 13, // 21: quilibrium.node.node.pb.NodeStats.PutNodeInfo:output_type -> quilibrium.node.node.pb.PutResponse + 13, // 22: quilibrium.node.node.pb.NodeStats.PutPeerInfo:output_type -> quilibrium.node.node.pb.PutResponse + 15, // [15:23] is the sub-list for method output_type + 7, // [7:15] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_node_proto_init() } @@ -1144,7 +1351,7 @@ func file_node_proto_init() { } } file_node_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NetworkInfoResponse); i { + switch v := v.(*PutPeerInfoRequest); i { case 0: return &v.state case 1: @@ -1156,7 +1363,7 @@ func file_node_proto_init() { } } file_node_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetTokenInfoRequest); i { + switch v := v.(*PutNodeInfoRequest); i { case 0: return &v.state case 1: @@ -1168,6 +1375,42 @@ func file_node_proto_init() { } } file_node_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PutResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_node_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NetworkInfoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_node_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTokenInfoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_node_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TokenInfoResponse); i { case 0: return &v.state @@ -1186,9 +1429,9 @@ func file_node_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_node_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 17, NumExtensions: 0, - NumServices: 1, + NumServices: 2, }, GoTypes: file_node_proto_goTypes, DependencyIndexes: file_node_proto_depIdxs, diff --git a/node/protobufs/node.pb.gw.go b/node/protobufs/node.pb.gw.go index 471f9c6..652141d 100644 --- a/node/protobufs/node.pb.gw.go +++ b/node/protobufs/node.pb.gw.go @@ -235,6 +235,74 @@ func local_request_NodeService_GetTokenInfo_0(ctx context.Context, marshaler run } +func request_NodeStats_PutNodeInfo_0(ctx context.Context, marshaler runtime.Marshaler, client NodeStatsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PutNodeInfoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.PutNodeInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NodeStats_PutNodeInfo_0(ctx context.Context, marshaler runtime.Marshaler, server NodeStatsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PutNodeInfoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.PutNodeInfo(ctx, &protoReq) + return msg, metadata, err + +} + +func request_NodeStats_PutPeerInfo_0(ctx context.Context, marshaler runtime.Marshaler, client NodeStatsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PutPeerInfoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.PutPeerInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NodeStats_PutPeerInfo_0(ctx context.Context, marshaler runtime.Marshaler, server NodeStatsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PutPeerInfoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.PutPeerInfo(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterNodeServiceHandlerServer registers the http handlers for service NodeService to "mux". // UnaryRPC :call NodeServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -394,6 +462,65 @@ func RegisterNodeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return nil } +// RegisterNodeStatsHandlerServer registers the http handlers for service NodeStats to "mux". +// UnaryRPC :call NodeStatsServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterNodeStatsHandlerFromEndpoint instead. +func RegisterNodeStatsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NodeStatsServer) error { + + mux.Handle("POST", pattern_NodeStats_PutNodeInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/quilibrium.node.node.pb.NodeStats/PutNodeInfo", runtime.WithHTTPPathPattern("/quilibrium.node.node.pb.NodeStats/PutNodeInfo")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NodeStats_PutNodeInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NodeStats_PutNodeInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_NodeStats_PutPeerInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/quilibrium.node.node.pb.NodeStats/PutPeerInfo", runtime.WithHTTPPathPattern("/quilibrium.node.node.pb.NodeStats/PutPeerInfo")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NodeStats_PutPeerInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NodeStats_PutPeerInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + // RegisterNodeServiceHandlerFromEndpoint is same as RegisterNodeServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterNodeServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -594,3 +721,100 @@ var ( forward_NodeService_GetTokenInfo_0 = runtime.ForwardResponseMessage ) + +// RegisterNodeStatsHandlerFromEndpoint is same as RegisterNodeStatsHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterNodeStatsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterNodeStatsHandler(ctx, mux, conn) +} + +// RegisterNodeStatsHandler registers the http handlers for service NodeStats to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterNodeStatsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterNodeStatsHandlerClient(ctx, mux, NewNodeStatsClient(conn)) +} + +// RegisterNodeStatsHandlerClient registers the http handlers for service NodeStats +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NodeStatsClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NodeStatsClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "NodeStatsClient" to call the correct interceptors. +func RegisterNodeStatsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NodeStatsClient) error { + + mux.Handle("POST", pattern_NodeStats_PutNodeInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/quilibrium.node.node.pb.NodeStats/PutNodeInfo", runtime.WithHTTPPathPattern("/quilibrium.node.node.pb.NodeStats/PutNodeInfo")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NodeStats_PutNodeInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NodeStats_PutNodeInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_NodeStats_PutPeerInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/quilibrium.node.node.pb.NodeStats/PutPeerInfo", runtime.WithHTTPPathPattern("/quilibrium.node.node.pb.NodeStats/PutPeerInfo")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NodeStats_PutPeerInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NodeStats_PutPeerInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_NodeStats_PutNodeInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.node.pb.NodeStats", "PutNodeInfo"}, "")) + + pattern_NodeStats_PutPeerInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.node.pb.NodeStats", "PutPeerInfo"}, "")) +) + +var ( + forward_NodeStats_PutNodeInfo_0 = runtime.ForwardResponseMessage + + forward_NodeStats_PutPeerInfo_0 = runtime.ForwardResponseMessage +) diff --git a/node/protobufs/node.proto b/node/protobufs/node.proto index 8f3dad9..d9cc367 100644 --- a/node/protobufs/node.proto +++ b/node/protobufs/node.proto @@ -60,6 +60,20 @@ message NodeInfoResponse { uint64 peer_score = 3; } +message PutPeerInfoRequest { + repeated PeerInfo peer_info = 1; + repeated PeerInfo uncooperative_peer_info = 2; +} + +message PutNodeInfoRequest { + string peer_id = 1; + uint64 max_frame = 2; + uint64 peer_score = 3; + bytes signature = 4; +} + +message PutResponse {} + message NetworkInfoResponse { repeated NetworkInfo network_info = 1; } @@ -88,4 +102,9 @@ service NodeService { rpc GetNodeInfo(GetNodeInfoRequest) returns (NodeInfoResponse); rpc GetNetworkInfo(GetNetworkInfoRequest) returns (NetworkInfoResponse); rpc GetTokenInfo(GetTokenInfoRequest) returns (TokenInfoResponse); +} + +service NodeStats { + rpc PutNodeInfo(PutNodeInfoRequest) returns (PutResponse); + rpc PutPeerInfo(PutPeerInfoRequest) returns (PutResponse); } \ No newline at end of file diff --git a/node/protobufs/node_grpc.pb.go b/node/protobufs/node_grpc.pb.go index 19d6daf..110c799 100644 --- a/node/protobufs/node_grpc.pb.go +++ b/node/protobufs/node_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v3.21.12 // source: node.proto package protobufs @@ -292,3 +292,130 @@ var NodeService_ServiceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "node.proto", } + +const ( + NodeStats_PutNodeInfo_FullMethodName = "/quilibrium.node.node.pb.NodeStats/PutNodeInfo" + NodeStats_PutPeerInfo_FullMethodName = "/quilibrium.node.node.pb.NodeStats/PutPeerInfo" +) + +// NodeStatsClient is the client API for NodeStats service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type NodeStatsClient interface { + PutNodeInfo(ctx context.Context, in *PutNodeInfoRequest, opts ...grpc.CallOption) (*PutResponse, error) + PutPeerInfo(ctx context.Context, in *PutPeerInfoRequest, opts ...grpc.CallOption) (*PutResponse, error) +} + +type nodeStatsClient struct { + cc grpc.ClientConnInterface +} + +func NewNodeStatsClient(cc grpc.ClientConnInterface) NodeStatsClient { + return &nodeStatsClient{cc} +} + +func (c *nodeStatsClient) PutNodeInfo(ctx context.Context, in *PutNodeInfoRequest, opts ...grpc.CallOption) (*PutResponse, error) { + out := new(PutResponse) + err := c.cc.Invoke(ctx, NodeStats_PutNodeInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nodeStatsClient) PutPeerInfo(ctx context.Context, in *PutPeerInfoRequest, opts ...grpc.CallOption) (*PutResponse, error) { + out := new(PutResponse) + err := c.cc.Invoke(ctx, NodeStats_PutPeerInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NodeStatsServer is the server API for NodeStats service. +// All implementations must embed UnimplementedNodeStatsServer +// for forward compatibility +type NodeStatsServer interface { + PutNodeInfo(context.Context, *PutNodeInfoRequest) (*PutResponse, error) + PutPeerInfo(context.Context, *PutPeerInfoRequest) (*PutResponse, error) + mustEmbedUnimplementedNodeStatsServer() +} + +// UnimplementedNodeStatsServer must be embedded to have forward compatible implementations. +type UnimplementedNodeStatsServer struct { +} + +func (UnimplementedNodeStatsServer) PutNodeInfo(context.Context, *PutNodeInfoRequest) (*PutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PutNodeInfo not implemented") +} +func (UnimplementedNodeStatsServer) PutPeerInfo(context.Context, *PutPeerInfoRequest) (*PutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PutPeerInfo not implemented") +} +func (UnimplementedNodeStatsServer) mustEmbedUnimplementedNodeStatsServer() {} + +// UnsafeNodeStatsServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to NodeStatsServer will +// result in compilation errors. +type UnsafeNodeStatsServer interface { + mustEmbedUnimplementedNodeStatsServer() +} + +func RegisterNodeStatsServer(s grpc.ServiceRegistrar, srv NodeStatsServer) { + s.RegisterService(&NodeStats_ServiceDesc, srv) +} + +func _NodeStats_PutNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutNodeInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeStatsServer).PutNodeInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NodeStats_PutNodeInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeStatsServer).PutNodeInfo(ctx, req.(*PutNodeInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NodeStats_PutPeerInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutPeerInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NodeStatsServer).PutPeerInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NodeStats_PutPeerInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NodeStatsServer).PutPeerInfo(ctx, req.(*PutPeerInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// NodeStats_ServiceDesc is the grpc.ServiceDesc for NodeStats service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var NodeStats_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "quilibrium.node.node.pb.NodeStats", + HandlerType: (*NodeStatsServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "PutNodeInfo", + Handler: _NodeStats_PutNodeInfo_Handler, + }, + { + MethodName: "PutPeerInfo", + Handler: _NodeStats_PutPeerInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "node.proto", +} diff --git a/node/store/clock.go b/node/store/clock.go index b43adae..f35a684 100644 --- a/node/store/clock.go +++ b/node/store/clock.go @@ -101,6 +101,8 @@ type ClockStore interface { GetHighestCandidateDataClockFrame( filter []byte, ) (*protobufs.ClockFrame, error) + ResetMasterClockFrames(filter []byte) error + ResetDataClockFrames(filter []byte) error } type PebbleClockStore struct { @@ -1659,3 +1661,39 @@ func (p *PebbleClockStore) GetHighestCandidateDataClockFrame( return frame, nil } +func (p *PebbleClockStore) ResetMasterClockFrames(filter []byte) error { + if err := p.db.DeleteRange( + clockMasterFrameKey(filter, 0), + clockMasterFrameKey(filter, 200000), + ); err != nil { + return errors.Wrap(err, "reset master clock frames") + } + + if err := p.db.Delete(clockMasterEarliestIndex(filter)); err != nil { + return errors.Wrap(err, "reset master clock frames") + } + + if err := p.db.Delete(clockMasterLatestIndex(filter)); err != nil { + return errors.Wrap(err, "reset master clock frames") + } + + return nil +} + +func (p *PebbleClockStore) ResetDataClockFrames(filter []byte) error { + if err := p.db.DeleteRange( + clockDataFrameKey(filter, 0), + clockDataFrameKey(filter, 200000), + ); err != nil { + return errors.Wrap(err, "reset data clock frames") + } + + if err := p.db.Delete(clockDataEarliestIndex(filter)); err != nil { + return errors.Wrap(err, "reset data clock frames") + } + if err := p.db.Delete(clockDataLatestIndex(filter)); err != nil { + return errors.Wrap(err, "reset data clock frames") + } + + return nil +}