From ab9f7047736cf34a8d3c2cb1772052b19e644d81 Mon Sep 17 00:00:00 2001 From: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com> Date: Fri, 13 Sep 2024 09:24:23 +0100 Subject: [PATCH 1/3] Add LatestHead method to relayer interface --- pkg/types/core/relayerset.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/types/core/relayerset.go b/pkg/types/core/relayerset.go index 14a0bfb92..bb1b84d45 100644 --- a/pkg/types/core/relayerset.go +++ b/pkg/types/core/relayerset.go @@ -32,4 +32,5 @@ type Relayer interface { NewPluginProvider(context.Context, RelayArgs, PluginArgs) (types.PluginProvider, error) NewContractReader(_ context.Context, contractReaderConfig []byte) (types.ContractReader, error) NewChainWriter(_ context.Context, chainWriterConfig []byte) (types.ChainWriter, error) + LatestHead(context.Context) (types.Head, error) } From 6deff999448afc2a38322e1774f7d7da1856f513 Mon Sep 17 00:00:00 2001 From: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:07:00 +0100 Subject: [PATCH 2/3] Add LatestHead implementation to relayerset server and clients --- .../internal/pb/relayerset/relayerset.pb.go | 384 ++++++++++++------ .../internal/pb/relayerset/relayerset.proto | 11 + .../pb/relayerset/relayerset_grpc.pb.go | 37 ++ pkg/loop/internal/relayerset/client.go | 15 + pkg/loop/internal/relayerset/relayer.go | 9 + pkg/loop/internal/relayerset/server.go | 17 + pkg/types/core/mocks/relayer.go | 56 +++ 7 files changed, 415 insertions(+), 114 deletions(-) diff --git a/pkg/loop/internal/pb/relayerset/relayerset.pb.go b/pkg/loop/internal/pb/relayerset/relayerset.pb.go index 31df3c965..05e07cabf 100644 --- a/pkg/loop/internal/pb/relayerset/relayerset.pb.go +++ b/pkg/loop/internal/pb/relayerset/relayerset.pb.go @@ -777,6 +777,116 @@ func (x *NewChainWriterResponse) GetChainWriterId() uint32 { return 0 } +type LatestHeadRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RelayerId *RelayerId `protobuf:"bytes,1,opt,name=relayerId,proto3" json:"relayerId,omitempty"` +} + +func (x *LatestHeadRequest) Reset() { + *x = LatestHeadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_relayerset_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LatestHeadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LatestHeadRequest) ProtoMessage() {} + +func (x *LatestHeadRequest) ProtoReflect() protoreflect.Message { + mi := &file_relayerset_proto_msgTypes[14] + 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 LatestHeadRequest.ProtoReflect.Descriptor instead. +func (*LatestHeadRequest) Descriptor() ([]byte, []int) { + return file_relayerset_proto_rawDescGZIP(), []int{14} +} + +func (x *LatestHeadRequest) GetRelayerId() *RelayerId { + if x != nil { + return x.RelayerId + } + return nil +} + +type LatestHeadResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Height string `protobuf:"bytes,1,opt,name=height,proto3" json:"height,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` + Timestamp uint64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *LatestHeadResponse) Reset() { + *x = LatestHeadResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_relayerset_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LatestHeadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LatestHeadResponse) ProtoMessage() {} + +func (x *LatestHeadResponse) ProtoReflect() protoreflect.Message { + mi := &file_relayerset_proto_msgTypes[15] + 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 LatestHeadResponse.ProtoReflect.Descriptor instead. +func (*LatestHeadResponse) Descriptor() ([]byte, []int) { + return file_relayerset_proto_rawDescGZIP(), []int{15} +} + +func (x *LatestHeadResponse) GetHeight() string { + if x != nil { + return x.Height + } + return "" +} + +func (x *LatestHeadResponse) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +func (x *LatestHeadResponse) GetTimestamp() uint64 { + if x != nil { + return x.Timestamp + } + return 0 +} + type RelayerHealthReportResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -788,7 +898,7 @@ type RelayerHealthReportResponse struct { func (x *RelayerHealthReportResponse) Reset() { *x = RelayerHealthReportResponse{} if protoimpl.UnsafeEnabled { - mi := &file_relayerset_proto_msgTypes[14] + mi := &file_relayerset_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -801,7 +911,7 @@ func (x *RelayerHealthReportResponse) String() string { func (*RelayerHealthReportResponse) ProtoMessage() {} func (x *RelayerHealthReportResponse) ProtoReflect() protoreflect.Message { - mi := &file_relayerset_proto_msgTypes[14] + mi := &file_relayerset_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -814,7 +924,7 @@ func (x *RelayerHealthReportResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RelayerHealthReportResponse.ProtoReflect.Descriptor instead. func (*RelayerHealthReportResponse) Descriptor() ([]byte, []int) { - return file_relayerset_proto_rawDescGZIP(), []int{14} + return file_relayerset_proto_rawDescGZIP(), []int{16} } func (x *RelayerHealthReportResponse) GetReport() map[string]string { @@ -835,7 +945,7 @@ type RelayerNameResponse struct { func (x *RelayerNameResponse) Reset() { *x = RelayerNameResponse{} if protoimpl.UnsafeEnabled { - mi := &file_relayerset_proto_msgTypes[15] + mi := &file_relayerset_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -848,7 +958,7 @@ func (x *RelayerNameResponse) String() string { func (*RelayerNameResponse) ProtoMessage() {} func (x *RelayerNameResponse) ProtoReflect() protoreflect.Message { - mi := &file_relayerset_proto_msgTypes[15] + mi := &file_relayerset_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -861,7 +971,7 @@ func (x *RelayerNameResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RelayerNameResponse.ProtoReflect.Descriptor instead. func (*RelayerNameResponse) Descriptor() ([]byte, []int) { - return file_relayerset_proto_rawDescGZIP(), []int{15} + return file_relayerset_proto_rawDescGZIP(), []int{17} } func (x *RelayerNameResponse) GetName() string { @@ -968,82 +1078,99 @@ var file_relayerset_proto_rawDesc = []byte{ 0x57, 0x72, 0x69, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x72, 0x69, 0x74, - 0x65, 0x72, 0x49, 0x64, 0x22, 0xaa, 0x01, 0x0a, 0x1b, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x48, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x29, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x84, 0x07, 0x0a, - 0x0a, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x53, 0x65, 0x74, 0x12, 0x50, 0x0a, 0x03, 0x47, - 0x65, 0x74, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, - 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x52, - 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6c, 0x0a, 0x11, 0x4e, 0x65, - 0x77, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, - 0x29, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, - 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x77, - 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6c, 0x0a, 0x11, 0x4e, 0x65, 0x77, 0x43, - 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x29, 0x2e, + 0x65, 0x72, 0x49, 0x64, 0x22, 0x4d, 0x0a, 0x11, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x48, 0x65, + 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x72, 0x65, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, + 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x52, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x49, 0x64, 0x22, 0x5e, 0x0a, 0x12, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x22, 0xaa, 0x01, 0x0a, 0x1b, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x48, + 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x48, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0x29, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0xe4, 0x07, 0x0a, 0x0a, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x53, 0x65, 0x74, 0x12, 0x50, 0x0a, 0x03, 0x47, 0x65, + 0x74, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x04, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, - 0x4e, 0x65, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x43, 0x6f, - 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x0e, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, - 0x69, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, - 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0c, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, - 0x00, 0x12, 0x44, 0x0a, 0x0c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x52, 0x65, 0x61, 0x64, 0x79, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, - 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x49, 0x64, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x61, 0x0a, - 0x13, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, - 0x1a, 0x2c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, - 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x51, 0x0a, 0x0b, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, - 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x24, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x42, 0x4e, 0x5a, 0x4c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, - 0x69, 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x62, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x73, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6c, 0x0a, 0x11, 0x4e, 0x65, 0x77, + 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x29, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, + 0x2e, 0x4e, 0x65, 0x77, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x50, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6c, 0x0a, 0x11, 0x4e, 0x65, 0x77, 0x43, 0x6f, + 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x29, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4e, + 0x65, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, + 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x0e, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, + 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, + 0x74, 0x2e, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0c, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x44, 0x0a, 0x0c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, + 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x52, 0x65, 0x61, 0x64, 0x79, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x49, 0x64, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x61, 0x0a, 0x13, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x1a, + 0x2c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, + 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x51, 0x0a, 0x0b, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, + 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x24, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x5e, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x72, + 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, + 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x4c, 0x61, + 0x74, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x42, 0x4e, 0x5a, 0x4c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x6b, 0x69, + 0x74, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x6b, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x62, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, + 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1058,7 +1185,7 @@ func file_relayerset_proto_rawDescGZIP() []byte { return file_relayerset_proto_rawDescData } -var file_relayerset_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_relayerset_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_relayerset_proto_goTypes = []interface{}{ (*RelayerId)(nil), // 0: loop.relayerset.RelayerId (*GetRelayerRequest)(nil), // 1: loop.relayerset.GetRelayerRequest @@ -1074,10 +1201,12 @@ var file_relayerset_proto_goTypes = []interface{}{ (*NewContractReaderResponse)(nil), // 11: loop.relayerset.NewContractReaderResponse (*NewChainWriterRequest)(nil), // 12: loop.relayerset.NewChainWriterRequest (*NewChainWriterResponse)(nil), // 13: loop.relayerset.NewChainWriterResponse - (*RelayerHealthReportResponse)(nil), // 14: loop.relayerset.RelayerHealthReportResponse - (*RelayerNameResponse)(nil), // 15: loop.relayerset.RelayerNameResponse - nil, // 16: loop.relayerset.RelayerHealthReportResponse.ReportEntry - (*emptypb.Empty)(nil), // 17: google.protobuf.Empty + (*LatestHeadRequest)(nil), // 14: loop.relayerset.LatestHeadRequest + (*LatestHeadResponse)(nil), // 15: loop.relayerset.LatestHeadResponse + (*RelayerHealthReportResponse)(nil), // 16: loop.relayerset.RelayerHealthReportResponse + (*RelayerNameResponse)(nil), // 17: loop.relayerset.RelayerNameResponse + nil, // 18: loop.relayerset.RelayerHealthReportResponse.ReportEntry + (*emptypb.Empty)(nil), // 19: google.protobuf.Empty } var file_relayerset_proto_depIdxs = []int32{ 0, // 0: loop.relayerset.GetRelayerRequest.id:type_name -> loop.relayerset.RelayerId @@ -1090,32 +1219,35 @@ var file_relayerset_proto_depIdxs = []int32{ 7, // 7: loop.relayerset.NewPluginProviderRequest.pluginArgs:type_name -> loop.relayerset.PluginArgs 0, // 8: loop.relayerset.NewContractReaderRequest.relayerId:type_name -> loop.relayerset.RelayerId 0, // 9: loop.relayerset.NewChainWriterRequest.relayerId:type_name -> loop.relayerset.RelayerId - 16, // 10: loop.relayerset.RelayerHealthReportResponse.report:type_name -> loop.relayerset.RelayerHealthReportResponse.ReportEntry - 1, // 11: loop.relayerset.RelayerSet.Get:input_type -> loop.relayerset.GetRelayerRequest - 3, // 12: loop.relayerset.RelayerSet.List:input_type -> loop.relayerset.ListAllRelayersRequest - 8, // 13: loop.relayerset.RelayerSet.NewPluginProvider:input_type -> loop.relayerset.NewPluginProviderRequest - 10, // 14: loop.relayerset.RelayerSet.NewContractReader:input_type -> loop.relayerset.NewContractReaderRequest - 12, // 15: loop.relayerset.RelayerSet.NewChainWriter:input_type -> loop.relayerset.NewChainWriterRequest - 0, // 16: loop.relayerset.RelayerSet.StartRelayer:input_type -> loop.relayerset.RelayerId - 0, // 17: loop.relayerset.RelayerSet.CloseRelayer:input_type -> loop.relayerset.RelayerId - 0, // 18: loop.relayerset.RelayerSet.RelayerReady:input_type -> loop.relayerset.RelayerId - 0, // 19: loop.relayerset.RelayerSet.RelayerHealthReport:input_type -> loop.relayerset.RelayerId - 0, // 20: loop.relayerset.RelayerSet.RelayerName:input_type -> loop.relayerset.RelayerId - 2, // 21: loop.relayerset.RelayerSet.Get:output_type -> loop.relayerset.GetRelayerResponse - 4, // 22: loop.relayerset.RelayerSet.List:output_type -> loop.relayerset.ListAllRelayersResponse - 9, // 23: loop.relayerset.RelayerSet.NewPluginProvider:output_type -> loop.relayerset.NewPluginProviderResponse - 11, // 24: loop.relayerset.RelayerSet.NewContractReader:output_type -> loop.relayerset.NewContractReaderResponse - 13, // 25: loop.relayerset.RelayerSet.NewChainWriter:output_type -> loop.relayerset.NewChainWriterResponse - 17, // 26: loop.relayerset.RelayerSet.StartRelayer:output_type -> google.protobuf.Empty - 17, // 27: loop.relayerset.RelayerSet.CloseRelayer:output_type -> google.protobuf.Empty - 17, // 28: loop.relayerset.RelayerSet.RelayerReady:output_type -> google.protobuf.Empty - 14, // 29: loop.relayerset.RelayerSet.RelayerHealthReport:output_type -> loop.relayerset.RelayerHealthReportResponse - 15, // 30: loop.relayerset.RelayerSet.RelayerName:output_type -> loop.relayerset.RelayerNameResponse - 21, // [21:31] is the sub-list for method output_type - 11, // [11:21] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 0, // 10: loop.relayerset.LatestHeadRequest.relayerId:type_name -> loop.relayerset.RelayerId + 18, // 11: loop.relayerset.RelayerHealthReportResponse.report:type_name -> loop.relayerset.RelayerHealthReportResponse.ReportEntry + 1, // 12: loop.relayerset.RelayerSet.Get:input_type -> loop.relayerset.GetRelayerRequest + 3, // 13: loop.relayerset.RelayerSet.List:input_type -> loop.relayerset.ListAllRelayersRequest + 8, // 14: loop.relayerset.RelayerSet.NewPluginProvider:input_type -> loop.relayerset.NewPluginProviderRequest + 10, // 15: loop.relayerset.RelayerSet.NewContractReader:input_type -> loop.relayerset.NewContractReaderRequest + 12, // 16: loop.relayerset.RelayerSet.NewChainWriter:input_type -> loop.relayerset.NewChainWriterRequest + 0, // 17: loop.relayerset.RelayerSet.StartRelayer:input_type -> loop.relayerset.RelayerId + 0, // 18: loop.relayerset.RelayerSet.CloseRelayer:input_type -> loop.relayerset.RelayerId + 0, // 19: loop.relayerset.RelayerSet.RelayerReady:input_type -> loop.relayerset.RelayerId + 0, // 20: loop.relayerset.RelayerSet.RelayerHealthReport:input_type -> loop.relayerset.RelayerId + 0, // 21: loop.relayerset.RelayerSet.RelayerName:input_type -> loop.relayerset.RelayerId + 14, // 22: loop.relayerset.RelayerSet.RelayerLatestHead:input_type -> loop.relayerset.LatestHeadRequest + 2, // 23: loop.relayerset.RelayerSet.Get:output_type -> loop.relayerset.GetRelayerResponse + 4, // 24: loop.relayerset.RelayerSet.List:output_type -> loop.relayerset.ListAllRelayersResponse + 9, // 25: loop.relayerset.RelayerSet.NewPluginProvider:output_type -> loop.relayerset.NewPluginProviderResponse + 11, // 26: loop.relayerset.RelayerSet.NewContractReader:output_type -> loop.relayerset.NewContractReaderResponse + 13, // 27: loop.relayerset.RelayerSet.NewChainWriter:output_type -> loop.relayerset.NewChainWriterResponse + 19, // 28: loop.relayerset.RelayerSet.StartRelayer:output_type -> google.protobuf.Empty + 19, // 29: loop.relayerset.RelayerSet.CloseRelayer:output_type -> google.protobuf.Empty + 19, // 30: loop.relayerset.RelayerSet.RelayerReady:output_type -> google.protobuf.Empty + 16, // 31: loop.relayerset.RelayerSet.RelayerHealthReport:output_type -> loop.relayerset.RelayerHealthReportResponse + 17, // 32: loop.relayerset.RelayerSet.RelayerName:output_type -> loop.relayerset.RelayerNameResponse + 15, // 33: loop.relayerset.RelayerSet.RelayerLatestHead:output_type -> loop.relayerset.LatestHeadResponse + 23, // [23:34] is the sub-list for method output_type + 12, // [12:23] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_relayerset_proto_init() } @@ -1293,7 +1425,7 @@ func file_relayerset_proto_init() { } } file_relayerset_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RelayerHealthReportResponse); i { + switch v := v.(*LatestHeadRequest); i { case 0: return &v.state case 1: @@ -1305,6 +1437,30 @@ func file_relayerset_proto_init() { } } file_relayerset_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LatestHeadResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relayerset_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RelayerHealthReportResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_relayerset_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RelayerNameResponse); i { case 0: return &v.state @@ -1323,7 +1479,7 @@ func file_relayerset_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_relayerset_proto_rawDesc, NumEnums: 0, - NumMessages: 17, + NumMessages: 19, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/loop/internal/pb/relayerset/relayerset.proto b/pkg/loop/internal/pb/relayerset/relayerset.proto index c401e640a..5e1e4e441 100644 --- a/pkg/loop/internal/pb/relayerset/relayerset.proto +++ b/pkg/loop/internal/pb/relayerset/relayerset.proto @@ -76,6 +76,16 @@ message NewChainWriterResponse { uint32 chainWriterId = 1; } +message LatestHeadRequest { + RelayerId relayerId = 1; +} + +message LatestHeadResponse { + string height = 1; + bytes hash = 2; + uint64 timestamp = 3; +} + message RelayerHealthReportResponse { map report = 1; } @@ -96,6 +106,7 @@ service RelayerSet { rpc RelayerReady(RelayerId) returns (google.protobuf.Empty) {} rpc RelayerHealthReport(RelayerId) returns (RelayerHealthReportResponse) {} rpc RelayerName(RelayerId) returns (RelayerNameResponse) {} + rpc RelayerLatestHead(LatestHeadRequest) returns (LatestHeadResponse) {} } diff --git a/pkg/loop/internal/pb/relayerset/relayerset_grpc.pb.go b/pkg/loop/internal/pb/relayerset/relayerset_grpc.pb.go index e1b81b64c..d922c51c0 100644 --- a/pkg/loop/internal/pb/relayerset/relayerset_grpc.pb.go +++ b/pkg/loop/internal/pb/relayerset/relayerset_grpc.pb.go @@ -30,6 +30,7 @@ const ( RelayerSet_RelayerReady_FullMethodName = "/loop.relayerset.RelayerSet/RelayerReady" RelayerSet_RelayerHealthReport_FullMethodName = "/loop.relayerset.RelayerSet/RelayerHealthReport" RelayerSet_RelayerName_FullMethodName = "/loop.relayerset.RelayerSet/RelayerName" + RelayerSet_RelayerLatestHead_FullMethodName = "/loop.relayerset.RelayerSet/RelayerLatestHead" ) // RelayerSetClient is the client API for RelayerSet service. @@ -46,6 +47,7 @@ type RelayerSetClient interface { RelayerReady(ctx context.Context, in *RelayerId, opts ...grpc.CallOption) (*emptypb.Empty, error) RelayerHealthReport(ctx context.Context, in *RelayerId, opts ...grpc.CallOption) (*RelayerHealthReportResponse, error) RelayerName(ctx context.Context, in *RelayerId, opts ...grpc.CallOption) (*RelayerNameResponse, error) + RelayerLatestHead(ctx context.Context, in *LatestHeadRequest, opts ...grpc.CallOption) (*LatestHeadResponse, error) } type relayerSetClient struct { @@ -146,6 +148,15 @@ func (c *relayerSetClient) RelayerName(ctx context.Context, in *RelayerId, opts return out, nil } +func (c *relayerSetClient) RelayerLatestHead(ctx context.Context, in *LatestHeadRequest, opts ...grpc.CallOption) (*LatestHeadResponse, error) { + out := new(LatestHeadResponse) + err := c.cc.Invoke(ctx, RelayerSet_RelayerLatestHead_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // RelayerSetServer is the server API for RelayerSet service. // All implementations must embed UnimplementedRelayerSetServer // for forward compatibility @@ -160,6 +171,7 @@ type RelayerSetServer interface { RelayerReady(context.Context, *RelayerId) (*emptypb.Empty, error) RelayerHealthReport(context.Context, *RelayerId) (*RelayerHealthReportResponse, error) RelayerName(context.Context, *RelayerId) (*RelayerNameResponse, error) + RelayerLatestHead(context.Context, *LatestHeadRequest) (*LatestHeadResponse, error) mustEmbedUnimplementedRelayerSetServer() } @@ -197,6 +209,9 @@ func (UnimplementedRelayerSetServer) RelayerHealthReport(context.Context, *Relay func (UnimplementedRelayerSetServer) RelayerName(context.Context, *RelayerId) (*RelayerNameResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RelayerName not implemented") } +func (UnimplementedRelayerSetServer) RelayerLatestHead(context.Context, *LatestHeadRequest) (*LatestHeadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RelayerLatestHead not implemented") +} func (UnimplementedRelayerSetServer) mustEmbedUnimplementedRelayerSetServer() {} // UnsafeRelayerSetServer may be embedded to opt out of forward compatibility for this service. @@ -390,6 +405,24 @@ func _RelayerSet_RelayerName_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _RelayerSet_RelayerLatestHead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LatestHeadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RelayerSetServer).RelayerLatestHead(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RelayerSet_RelayerLatestHead_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RelayerSetServer).RelayerLatestHead(ctx, req.(*LatestHeadRequest)) + } + return interceptor(ctx, in, info, handler) +} + // RelayerSet_ServiceDesc is the grpc.ServiceDesc for RelayerSet service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -437,6 +470,10 @@ var RelayerSet_ServiceDesc = grpc.ServiceDesc{ MethodName: "RelayerName", Handler: _RelayerSet_RelayerName_Handler, }, + { + MethodName: "RelayerLatestHead", + Handler: _RelayerSet_RelayerLatestHead_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "relayerset.proto", diff --git a/pkg/loop/internal/relayerset/client.go b/pkg/loop/internal/relayerset/client.go index bb343dff6..4821cc632 100644 --- a/pkg/loop/internal/relayerset/client.go +++ b/pkg/loop/internal/relayerset/client.go @@ -100,6 +100,21 @@ func (k *Client) RelayerName(ctx context.Context, relayID types.RelayID) (string return resp.Name, nil } +func (k *Client) RelayerLatestHead(ctx context.Context, relayID types.RelayID) (types.Head, error) { + req := &relayerset.LatestHeadRequest{ + RelayerId: &relayerset.RelayerId{ChainId: relayID.ChainID, Network: relayID.Network}, + } + resp, err := k.relayerSetClient.RelayerLatestHead(ctx, req) + if err != nil { + return types.Head{}, fmt.Errorf("error getting new chain writer: %w", err) + } + return types.Head{ + Height: resp.Height, + Hash: resp.Hash, + Timestamp: resp.Timestamp, + }, nil +} + func (k *Client) NewPluginProvider(ctx context.Context, relayID types.RelayID, relayArgs core.RelayArgs, pluginArgs core.PluginArgs) (uint32, error) { // TODO at a later phase these credentials should be set as part of the relay config and not as a separate field var mercuryCredentials *relayerset.MercuryCredentials diff --git a/pkg/loop/internal/relayerset/relayer.go b/pkg/loop/internal/relayerset/relayer.go index caa842c5e..8a5ffc751 100644 --- a/pkg/loop/internal/relayerset/relayer.go +++ b/pkg/loop/internal/relayerset/relayer.go @@ -92,3 +92,12 @@ func (r *relayerClient) Name() string { return name } + +func (r *relayerClient) LatestHead(_ context.Context) (types.Head, error) { + latestHead, err := r.relayerSetClient.RelayerLatestHead(context.Background(), r.relayerID) + if err != nil { + r.log.Error("error getting latestHead", "error", err) + return types.Head{}, err + } + return latestHead, err +} diff --git a/pkg/loop/internal/relayerset/server.go b/pkg/loop/internal/relayerset/server.go index 0ec1c93fe..8e809f1f8 100644 --- a/pkg/loop/internal/relayerset/server.go +++ b/pkg/loop/internal/relayerset/server.go @@ -315,6 +315,23 @@ func (s *Server) RelayerName(ctx context.Context, relayID *relayerset.RelayerId) return &relayerset.RelayerNameResponse{Name: relayer.Name()}, nil } +func (s *Server) RelayerLatestHead(ctx context.Context, req *relayerset.LatestHeadRequest) (*relayerset.LatestHeadResponse, error) { + relayer, err := s.getRelayer(ctx, req.RelayerId) + if err != nil { + return nil, err + } + + latestHead, err := relayer.LatestHead(ctx) + if err != nil { + return nil, err + } + return &relayerset.LatestHeadResponse{ + Height: latestHead.Height, + Hash: latestHead.Hash, + Timestamp: latestHead.Timestamp, + }, nil +} + func (s *Server) getRelayer(ctx context.Context, relayerID *relayerset.RelayerId) (core.Relayer, error) { relayer, err := s.impl.Get(ctx, types.RelayID{ChainID: relayerID.ChainId, Network: relayerID.Network}) if err != nil { diff --git a/pkg/types/core/mocks/relayer.go b/pkg/types/core/mocks/relayer.go index 4e3cf87ca..f8dfc59a8 100644 --- a/pkg/types/core/mocks/relayer.go +++ b/pkg/types/core/mocks/relayer.go @@ -116,6 +116,62 @@ func (_c *Relayer_HealthReport_Call) RunAndReturn(run func() map[string]error) * return _c } +// LatestHead provides a mock function with given fields: _a0 +func (_m *Relayer) LatestHead(_a0 context.Context) (types.Head, error) { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for LatestHead") + } + + var r0 types.Head + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (types.Head, error)); ok { + return rf(_a0) + } + if rf, ok := ret.Get(0).(func(context.Context) types.Head); ok { + r0 = rf(_a0) + } else { + r0 = ret.Get(0).(types.Head) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(_a0) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Relayer_LatestHead_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LatestHead' +type Relayer_LatestHead_Call struct { + *mock.Call +} + +// LatestHead is a helper method to define mock.On call +// - _a0 context.Context +func (_e *Relayer_Expecter) LatestHead(_a0 interface{}) *Relayer_LatestHead_Call { + return &Relayer_LatestHead_Call{Call: _e.mock.On("LatestHead", _a0)} +} + +func (_c *Relayer_LatestHead_Call) Run(run func(_a0 context.Context)) *Relayer_LatestHead_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Relayer_LatestHead_Call) Return(_a0 types.Head, _a1 error) *Relayer_LatestHead_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Relayer_LatestHead_Call) RunAndReturn(run func(context.Context) (types.Head, error)) *Relayer_LatestHead_Call { + _c.Call.Return(run) + return _c +} + // Name provides a mock function with given fields: func (_m *Relayer) Name() string { ret := _m.Called() From 8aa9bde064886ef21f8e4255835b621a4ea5f0ea Mon Sep 17 00:00:00 2001 From: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:11:34 +0100 Subject: [PATCH 3/3] Fix error message --- pkg/loop/internal/relayerset/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/loop/internal/relayerset/client.go b/pkg/loop/internal/relayerset/client.go index 4821cc632..5dc4524b3 100644 --- a/pkg/loop/internal/relayerset/client.go +++ b/pkg/loop/internal/relayerset/client.go @@ -106,7 +106,7 @@ func (k *Client) RelayerLatestHead(ctx context.Context, relayID types.RelayID) ( } resp, err := k.relayerSetClient.RelayerLatestHead(ctx, req) if err != nil { - return types.Head{}, fmt.Errorf("error getting new chain writer: %w", err) + return types.Head{}, fmt.Errorf("error getting latest head from relayerset client for relayer: %w", err) } return types.Head{ Height: resp.Height,