From 884e1d0099d4bb04ab4824c488d49e1e11874b1a Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Wed, 8 Oct 2025 16:39:44 +0200 Subject: [PATCH 01/29] add protos for pending payloads and handling --- api/core/v1/orbiter.pulsar.go | 608 +++++- api/v1/query.pulsar.go | 1209 ++++++++++- api/v1/query_grpc.pb.go | 51 +- api/v1/tx.pulsar.go | 2242 ++++++++++++++++++++- api/v1/tx_grpc.pb.go | 55 +- proto/noble/orbiter/core/v1/orbiter.proto | 8 + proto/noble/orbiter/v1/query.proto | 24 +- proto/noble/orbiter/v1/tx.proto | 48 + types/core/orbiter.pb.go | 279 ++- types/query.pb.go | 605 +++++- types/query.pb.gw.go | 171 ++ types/tx.pb.go | 1055 +++++++++- 12 files changed, 6214 insertions(+), 141 deletions(-) create mode 100644 types/query.pb.gw.go diff --git a/api/core/v1/orbiter.pulsar.go b/api/core/v1/orbiter.pulsar.go index 8b1b4ba1..166f36a8 100644 --- a/api/core/v1/orbiter.pulsar.go +++ b/api/core/v1/orbiter.pulsar.go @@ -2055,6 +2055,489 @@ func (x *fastReflection_PayloadWrapper) ProtoMethods() *protoiface.Methods { } } +var ( + md_PendingPayload protoreflect.MessageDescriptor + fd_PendingPayload_sequence protoreflect.FieldDescriptor + fd_PendingPayload_payload protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_core_v1_orbiter_proto_init() + md_PendingPayload = File_noble_orbiter_core_v1_orbiter_proto.Messages().ByName("PendingPayload") + fd_PendingPayload_sequence = md_PendingPayload.Fields().ByName("sequence") + fd_PendingPayload_payload = md_PendingPayload.Fields().ByName("payload") +} + +var _ protoreflect.Message = (*fastReflection_PendingPayload)(nil) + +type fastReflection_PendingPayload PendingPayload + +func (x *PendingPayload) ProtoReflect() protoreflect.Message { + return (*fastReflection_PendingPayload)(x) +} + +func (x *PendingPayload) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_core_v1_orbiter_proto_msgTypes[4] + 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) +} + +var _fastReflection_PendingPayload_messageType fastReflection_PendingPayload_messageType +var _ protoreflect.MessageType = fastReflection_PendingPayload_messageType{} + +type fastReflection_PendingPayload_messageType struct{} + +func (x fastReflection_PendingPayload_messageType) Zero() protoreflect.Message { + return (*fastReflection_PendingPayload)(nil) +} +func (x fastReflection_PendingPayload_messageType) New() protoreflect.Message { + return new(fastReflection_PendingPayload) +} +func (x fastReflection_PendingPayload_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_PendingPayload +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_PendingPayload) Descriptor() protoreflect.MessageDescriptor { + return md_PendingPayload +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_PendingPayload) Type() protoreflect.MessageType { + return _fastReflection_PendingPayload_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_PendingPayload) New() protoreflect.Message { + return new(fastReflection_PendingPayload) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_PendingPayload) Interface() protoreflect.ProtoMessage { + return (*PendingPayload)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_PendingPayload) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Sequence != uint64(0) { + value := protoreflect.ValueOfUint64(x.Sequence) + if !f(fd_PendingPayload_sequence, value) { + return + } + } + if x.Payload != nil { + value := protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) + if !f(fd_PendingPayload_payload, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_PendingPayload) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.core.v1.PendingPayload.sequence": + return x.Sequence != uint64(0) + case "noble.orbiter.core.v1.PendingPayload.payload": + return x.Payload != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) + } + panic(fmt.Errorf("message noble.orbiter.core.v1.PendingPayload does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_PendingPayload) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.core.v1.PendingPayload.sequence": + x.Sequence = uint64(0) + case "noble.orbiter.core.v1.PendingPayload.payload": + x.Payload = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) + } + panic(fmt.Errorf("message noble.orbiter.core.v1.PendingPayload does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_PendingPayload) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.core.v1.PendingPayload.sequence": + value := x.Sequence + return protoreflect.ValueOfUint64(value) + case "noble.orbiter.core.v1.PendingPayload.payload": + value := x.Payload + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) + } + panic(fmt.Errorf("message noble.orbiter.core.v1.PendingPayload does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_PendingPayload) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.core.v1.PendingPayload.sequence": + x.Sequence = value.Uint() + case "noble.orbiter.core.v1.PendingPayload.payload": + x.Payload = value.Message().Interface().(*Payload) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) + } + panic(fmt.Errorf("message noble.orbiter.core.v1.PendingPayload does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_PendingPayload) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.core.v1.PendingPayload.payload": + if x.Payload == nil { + x.Payload = new(Payload) + } + return protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) + case "noble.orbiter.core.v1.PendingPayload.sequence": + panic(fmt.Errorf("field sequence of message noble.orbiter.core.v1.PendingPayload is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) + } + panic(fmt.Errorf("message noble.orbiter.core.v1.PendingPayload does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_PendingPayload) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.core.v1.PendingPayload.sequence": + return protoreflect.ValueOfUint64(uint64(0)) + case "noble.orbiter.core.v1.PendingPayload.payload": + m := new(Payload) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) + } + panic(fmt.Errorf("message noble.orbiter.core.v1.PendingPayload does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_PendingPayload) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.core.v1.PendingPayload", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_PendingPayload) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_PendingPayload) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_PendingPayload) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_PendingPayload) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*PendingPayload) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Sequence != 0 { + n += 1 + runtime.Sov(uint64(x.Sequence)) + } + if x.Payload != nil { + l = options.Size(x.Payload) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*PendingPayload) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Payload != nil { + encoded, err := options.Marshal(x.Payload) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if x.Sequence != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Sequence)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*PendingPayload) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PendingPayload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PendingPayload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + x.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Payload == nil { + x.Payload = &Payload{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Payload); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -2272,6 +2755,52 @@ func (x *PayloadWrapper) GetOrbiter() *Payload { return nil } +// PendingPayload holds the information that goes into the stored payload hash. +type PendingPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The sequence number of the pending payload. + Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` + // The submitted payload that will is registered as pending. + Payload *Payload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *PendingPayload) Reset() { + *x = PendingPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_core_v1_orbiter_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PendingPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PendingPayload) ProtoMessage() {} + +// Deprecated: Use PendingPayload.ProtoReflect.Descriptor instead. +func (*PendingPayload) Descriptor() ([]byte, []int) { + return file_noble_orbiter_core_v1_orbiter_proto_rawDescGZIP(), []int{4} +} + +func (x *PendingPayload) GetSequence() uint64 { + if x != nil { + return x.Sequence + } + return 0 +} + +func (x *PendingPayload) GetPayload() *Payload { + if x != nil { + return x.Payload + } + return nil +} + var File_noble_orbiter_core_v1_orbiter_proto protoreflect.FileDescriptor var file_noble_orbiter_core_v1_orbiter_proto_rawDesc = []byte{ @@ -2323,22 +2852,29 @@ var file_noble_orbiter_core_v1_orbiter_proto_rawDesc = []byte{ 0x70, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x42, 0xe2, 0x01, - 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, - 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x4f, 0x72, 0x62, - 0x69, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, - 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, - 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x72, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, - 0x4e, 0x4f, 0x43, 0xaa, 0x02, 0x15, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, - 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x15, 0x4e, 0x6f, + 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x22, 0x66, 0x0a, + 0x0e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, + 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0xe2, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, + 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, + 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, + 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x63, + 0x6f, 0x72, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x43, 0xaa, 0x02, 0x15, 0x4e, 0x6f, + 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x72, 0x65, + 0x2e, 0x56, 0x31, 0xca, 0x02, 0x15, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, + 0x74, 0x65, 0x72, 0x5c, 0x43, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x21, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x43, 0x6f, 0x72, 0x65, - 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x21, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, - 0x74, 0x65, 0x72, 0x5c, 0x43, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x18, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, - 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x43, 0x6f, 0x72, 0x65, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x18, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, + 0x3a, 0x3a, 0x43, 0x6f, 0x72, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -2353,29 +2889,31 @@ func file_noble_orbiter_core_v1_orbiter_proto_rawDescGZIP() []byte { return file_noble_orbiter_core_v1_orbiter_proto_rawDescData } -var file_noble_orbiter_core_v1_orbiter_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_noble_orbiter_core_v1_orbiter_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_noble_orbiter_core_v1_orbiter_proto_goTypes = []interface{}{ (*Action)(nil), // 0: noble.orbiter.core.v1.Action (*Forwarding)(nil), // 1: noble.orbiter.core.v1.Forwarding (*Payload)(nil), // 2: noble.orbiter.core.v1.Payload (*PayloadWrapper)(nil), // 3: noble.orbiter.core.v1.PayloadWrapper - (ActionID)(0), // 4: noble.orbiter.core.v1.ActionID - (*anypb.Any)(nil), // 5: google.protobuf.Any - (ProtocolID)(0), // 6: noble.orbiter.core.v1.ProtocolID + (*PendingPayload)(nil), // 4: noble.orbiter.core.v1.PendingPayload + (ActionID)(0), // 5: noble.orbiter.core.v1.ActionID + (*anypb.Any)(nil), // 6: google.protobuf.Any + (ProtocolID)(0), // 7: noble.orbiter.core.v1.ProtocolID } var file_noble_orbiter_core_v1_orbiter_proto_depIdxs = []int32{ - 4, // 0: noble.orbiter.core.v1.Action.id:type_name -> noble.orbiter.core.v1.ActionID - 5, // 1: noble.orbiter.core.v1.Action.attributes:type_name -> google.protobuf.Any - 6, // 2: noble.orbiter.core.v1.Forwarding.protocol_id:type_name -> noble.orbiter.core.v1.ProtocolID - 5, // 3: noble.orbiter.core.v1.Forwarding.attributes:type_name -> google.protobuf.Any + 5, // 0: noble.orbiter.core.v1.Action.id:type_name -> noble.orbiter.core.v1.ActionID + 6, // 1: noble.orbiter.core.v1.Action.attributes:type_name -> google.protobuf.Any + 7, // 2: noble.orbiter.core.v1.Forwarding.protocol_id:type_name -> noble.orbiter.core.v1.ProtocolID + 6, // 3: noble.orbiter.core.v1.Forwarding.attributes:type_name -> google.protobuf.Any 0, // 4: noble.orbiter.core.v1.Payload.pre_actions:type_name -> noble.orbiter.core.v1.Action 1, // 5: noble.orbiter.core.v1.Payload.forwarding:type_name -> noble.orbiter.core.v1.Forwarding 2, // 6: noble.orbiter.core.v1.PayloadWrapper.orbiter:type_name -> noble.orbiter.core.v1.Payload - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] 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 + 2, // 7: noble.orbiter.core.v1.PendingPayload.payload:type_name -> noble.orbiter.core.v1.Payload + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_noble_orbiter_core_v1_orbiter_proto_init() } @@ -2433,6 +2971,18 @@ func file_noble_orbiter_core_v1_orbiter_proto_init() { return nil } } + file_noble_orbiter_core_v1_orbiter_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PendingPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2440,7 +2990,7 @@ func file_noble_orbiter_core_v1_orbiter_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_noble_orbiter_core_v1_orbiter_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/api/v1/query.pulsar.go b/api/v1/query.pulsar.go index 6695c8be..80087124 100644 --- a/api/v1/query.pulsar.go +++ b/api/v1/query.pulsar.go @@ -2,11 +2,1013 @@ package orbiterv1 import ( + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + _ "cosmossdk.io/api/cosmos/query/v1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" reflect "reflect" + sync "sync" ) +var ( + md_QueryPendingPayloadsRequest protoreflect.MessageDescriptor + fd_QueryPendingPayloadsRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_query_proto_init() + md_QueryPendingPayloadsRequest = File_noble_orbiter_v1_query_proto.Messages().ByName("QueryPendingPayloadsRequest") + fd_QueryPendingPayloadsRequest_pagination = md_QueryPendingPayloadsRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryPendingPayloadsRequest)(nil) + +type fastReflection_QueryPendingPayloadsRequest QueryPendingPayloadsRequest + +func (x *QueryPendingPayloadsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadsRequest)(x) +} + +func (x *QueryPendingPayloadsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_query_proto_msgTypes[0] + 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) +} + +var _fastReflection_QueryPendingPayloadsRequest_messageType fastReflection_QueryPendingPayloadsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryPendingPayloadsRequest_messageType{} + +type fastReflection_QueryPendingPayloadsRequest_messageType struct{} + +func (x fastReflection_QueryPendingPayloadsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadsRequest)(nil) +} +func (x fastReflection_QueryPendingPayloadsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadsRequest) +} +func (x fastReflection_QueryPendingPayloadsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPendingPayloadsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryPendingPayloadsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPendingPayloadsRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryPendingPayloadsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryPendingPayloadsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryPendingPayloadsRequest) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryPendingPayloadsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryPendingPayloadsRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryPendingPayloadsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryPendingPayloadsRequest_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryPendingPayloadsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPendingPayloadsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryPendingPayloadsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPendingPayloadsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPendingPayloadsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryPendingPayloadsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryPendingPayloadsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.QueryPendingPayloadsRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryPendingPayloadsRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPendingPayloadsRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryPendingPayloadsRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryPendingPayloadsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryPendingPayloadsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryPendingPayloadsRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryPendingPayloadsResponse_1_list)(nil) + +type _QueryPendingPayloadsResponse_1_list struct { + list *[]string +} + +func (x *_QueryPendingPayloadsResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryPendingPayloadsResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_QueryPendingPayloadsResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_QueryPendingPayloadsResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryPendingPayloadsResponse_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message QueryPendingPayloadsResponse at list field Hashes as it is not of Message kind")) +} + +func (x *_QueryPendingPayloadsResponse_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_QueryPendingPayloadsResponse_1_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_QueryPendingPayloadsResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryPendingPayloadsResponse protoreflect.MessageDescriptor + fd_QueryPendingPayloadsResponse_hashes protoreflect.FieldDescriptor + fd_QueryPendingPayloadsResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_query_proto_init() + md_QueryPendingPayloadsResponse = File_noble_orbiter_v1_query_proto.Messages().ByName("QueryPendingPayloadsResponse") + fd_QueryPendingPayloadsResponse_hashes = md_QueryPendingPayloadsResponse.Fields().ByName("hashes") + fd_QueryPendingPayloadsResponse_pagination = md_QueryPendingPayloadsResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryPendingPayloadsResponse)(nil) + +type fastReflection_QueryPendingPayloadsResponse QueryPendingPayloadsResponse + +func (x *QueryPendingPayloadsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadsResponse)(x) +} + +func (x *QueryPendingPayloadsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_query_proto_msgTypes[1] + 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) +} + +var _fastReflection_QueryPendingPayloadsResponse_messageType fastReflection_QueryPendingPayloadsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryPendingPayloadsResponse_messageType{} + +type fastReflection_QueryPendingPayloadsResponse_messageType struct{} + +func (x fastReflection_QueryPendingPayloadsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadsResponse)(nil) +} +func (x fastReflection_QueryPendingPayloadsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadsResponse) +} +func (x fastReflection_QueryPendingPayloadsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPendingPayloadsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryPendingPayloadsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPendingPayloadsResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_QueryPendingPayloadsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryPendingPayloadsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryPendingPayloadsResponse) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryPendingPayloadsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryPendingPayloadsResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_QueryPendingPayloadsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Hashes) != 0 { + value := protoreflect.ValueOfList(&_QueryPendingPayloadsResponse_1_list{list: &x.Hashes}) + if !f(fd_QueryPendingPayloadsResponse_hashes, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryPendingPayloadsResponse_pagination, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryPendingPayloadsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": + return len(x.Hashes) != 0 + case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPendingPayloadsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": + x.Hashes = nil + case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_QueryPendingPayloadsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": + if len(x.Hashes) == 0 { + return protoreflect.ValueOfList(&_QueryPendingPayloadsResponse_1_list{}) + } + listValue := &_QueryPendingPayloadsResponse_1_list{list: &x.Hashes} + return protoreflect.ValueOfList(listValue) + case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPendingPayloadsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": + lv := value.List() + clv := lv.(*_QueryPendingPayloadsResponse_1_list) + x.Hashes = *clv.list + case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPendingPayloadsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": + if x.Hashes == nil { + x.Hashes = []string{} + } + value := &_QueryPendingPayloadsResponse_1_list{list: &x.Hashes} + return protoreflect.ValueOfList(value) + case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_QueryPendingPayloadsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": + list := []string{} + return protoreflect.ValueOfList(&_QueryPendingPayloadsResponse_1_list{list: &list}) + case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_QueryPendingPayloadsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.QueryPendingPayloadsResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_QueryPendingPayloadsResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_QueryPendingPayloadsResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_QueryPendingPayloadsResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryPendingPayloadsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Hashes) > 0 { + for _, s := range x.Hashes { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryPendingPayloadsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Hashes) > 0 { + for iNdEx := len(x.Hashes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Hashes[iNdEx]) + copy(dAtA[i:], x.Hashes[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hashes[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryPendingPayloadsResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hashes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Hashes = append(x.Hashes, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -20,35 +1022,169 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type QueryPendingPayloadsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // pagination defines an optional pagination for the request. + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryPendingPayloadsRequest) Reset() { + *x = QueryPendingPayloadsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryPendingPayloadsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryPendingPayloadsRequest) ProtoMessage() {} + +// Deprecated: Use QueryPendingPayloadsRequest.ProtoReflect.Descriptor instead. +func (*QueryPendingPayloadsRequest) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_query_proto_rawDescGZIP(), []int{0} +} + +func (x *QueryPendingPayloadsRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryPendingPayloadsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Hex-formatted hashes of the currently pending payloads + Hashes []string `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` + // pagination defines the pagination in the response. + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryPendingPayloadsResponse) Reset() { + *x = QueryPendingPayloadsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryPendingPayloadsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryPendingPayloadsResponse) ProtoMessage() {} + +// Deprecated: Use QueryPendingPayloadsResponse.ProtoReflect.Descriptor instead. +func (*QueryPendingPayloadsResponse) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryPendingPayloadsResponse) GetHashes() []string { + if x != nil { + return x.Hashes + } + return nil +} + +func (x *QueryPendingPayloadsResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + var File_noble_orbiter_v1_query_proto protoreflect.FileDescriptor var file_noble_orbiter_v1_query_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, - 0x32, 0x07, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0xc4, 0x01, 0x0a, 0x14, 0x63, 0x6f, - 0x6d, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, - 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, - 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, - 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, - 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x76, 0x31, - 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x58, 0xaa, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, - 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, - 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x4e, - 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x4e, 0x6f, - 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_noble_orbiter_v1_query_proto_goTypes = []interface{}{} + 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x65, 0x0a, 0x1b, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7f, + 0x0a, 0x1c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, + 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, + 0xab, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0xa1, 0x01, 0x0a, 0x0f, 0x50, 0x65, + 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x12, 0x2d, 0x2e, + 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, + 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x88, 0xe7, + 0xb0, 0x2a, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, + 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x65, 0x6e, + 0x64, 0x69, 0x6e, 0x67, 0x2d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x42, 0xc4, 0x01, + 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, + 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, + 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, + 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x6f, 0x72, 0x62, 0x69, 0x74, + 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x58, 0xaa, 0x02, 0x10, 0x4e, 0x6f, 0x62, + 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, + 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, + 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_noble_orbiter_v1_query_proto_rawDescOnce sync.Once + file_noble_orbiter_v1_query_proto_rawDescData = file_noble_orbiter_v1_query_proto_rawDesc +) + +func file_noble_orbiter_v1_query_proto_rawDescGZIP() []byte { + file_noble_orbiter_v1_query_proto_rawDescOnce.Do(func() { + file_noble_orbiter_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_noble_orbiter_v1_query_proto_rawDescData) + }) + return file_noble_orbiter_v1_query_proto_rawDescData +} + +var file_noble_orbiter_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_noble_orbiter_v1_query_proto_goTypes = []interface{}{ + (*QueryPendingPayloadsRequest)(nil), // 0: noble.orbiter.v1.QueryPendingPayloadsRequest + (*QueryPendingPayloadsResponse)(nil), // 1: noble.orbiter.v1.QueryPendingPayloadsResponse + (*v1beta1.PageRequest)(nil), // 2: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 3: cosmos.base.query.v1beta1.PageResponse +} var file_noble_orbiter_v1_query_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 2, // 0: noble.orbiter.v1.QueryPendingPayloadsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 3, // 1: noble.orbiter.v1.QueryPendingPayloadsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 2: noble.orbiter.v1.Query.PendingPayloads:input_type -> noble.orbiter.v1.QueryPendingPayloadsRequest + 1, // 3: noble.orbiter.v1.Query.PendingPayloads:output_type -> noble.orbiter.v1.QueryPendingPayloadsResponse + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_noble_orbiter_v1_query_proto_init() } @@ -56,18 +1192,45 @@ func file_noble_orbiter_v1_query_proto_init() { if File_noble_orbiter_v1_query_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_noble_orbiter_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryPendingPayloadsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_noble_orbiter_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryPendingPayloadsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_noble_orbiter_v1_query_proto_rawDesc, NumEnums: 0, - NumMessages: 0, + NumMessages: 2, NumExtensions: 0, NumServices: 1, }, GoTypes: file_noble_orbiter_v1_query_proto_goTypes, DependencyIndexes: file_noble_orbiter_v1_query_proto_depIdxs, + MessageInfos: file_noble_orbiter_v1_query_proto_msgTypes, }.Build() File_noble_orbiter_v1_query_proto = out.File file_noble_orbiter_v1_query_proto_rawDesc = nil diff --git a/api/v1/query_grpc.pb.go b/api/v1/query_grpc.pb.go index f0ac45b5..404ea816 100644 --- a/api/v1/query_grpc.pb.go +++ b/api/v1/query_grpc.pb.go @@ -7,7 +7,10 @@ package orbiterv1 import ( + context "context" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file @@ -15,12 +18,17 @@ import ( // Requires gRPC-Go v1.64.0 or later. const _ = grpc.SupportPackageIsVersion9 +const ( + Query_PendingPayloads_FullMethodName = "/noble.orbiter.v1.Query/PendingPayloads" +) + // QueryClient is the client API for Query 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. // // Query defines the gRPC query service for the Orbiter module. type QueryClient interface { + PendingPayloads(ctx context.Context, in *QueryPendingPayloadsRequest, opts ...grpc.CallOption) (*QueryPendingPayloadsResponse, error) } type queryClient struct { @@ -31,12 +39,23 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { return &queryClient{cc} } +func (c *queryClient) PendingPayloads(ctx context.Context, in *QueryPendingPayloadsRequest, opts ...grpc.CallOption) (*QueryPendingPayloadsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueryPendingPayloadsResponse) + err := c.cc.Invoke(ctx, Query_PendingPayloads_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer // for forward compatibility. // // Query defines the gRPC query service for the Orbiter module. type QueryServer interface { + PendingPayloads(context.Context, *QueryPendingPayloadsRequest) (*QueryPendingPayloadsResponse, error) mustEmbedUnimplementedQueryServer() } @@ -47,6 +66,9 @@ type QueryServer interface { // pointer dereference when methods are called. type UnimplementedQueryServer struct{} +func (UnimplementedQueryServer) PendingPayloads(context.Context, *QueryPendingPayloadsRequest) (*QueryPendingPayloadsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PendingPayloads not implemented") +} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} func (UnimplementedQueryServer) testEmbeddedByValue() {} @@ -68,13 +90,36 @@ func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { s.RegisterService(&Query_ServiceDesc, srv) } +func _Query_PendingPayloads_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPendingPayloadsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PendingPayloads(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_PendingPayloads_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PendingPayloads(ctx, req.(*QueryPendingPayloadsRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Query_ServiceDesc is the grpc.ServiceDesc for Query service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Query_ServiceDesc = grpc.ServiceDesc{ ServiceName: "noble.orbiter.v1.Query", HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "noble/orbiter/v1/query.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "PendingPayloads", + Handler: _Query_PendingPayloads_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "noble/orbiter/v1/query.proto", } diff --git a/api/v1/tx.pulsar.go b/api/v1/tx.pulsar.go index 7fc881cc..e7adfe43 100644 --- a/api/v1/tx.pulsar.go +++ b/api/v1/tx.pulsar.go @@ -2,12 +2,1914 @@ package orbiterv1 import ( + _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + v1 "github.com/noble-assets/orbiter/api/core/v1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" reflect "reflect" + sync "sync" ) +var ( + md_MsgSubmitPayload protoreflect.MessageDescriptor + fd_MsgSubmitPayload_signer protoreflect.FieldDescriptor + fd_MsgSubmitPayload_payload protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_tx_proto_init() + md_MsgSubmitPayload = File_noble_orbiter_v1_tx_proto.Messages().ByName("MsgSubmitPayload") + fd_MsgSubmitPayload_signer = md_MsgSubmitPayload.Fields().ByName("signer") + fd_MsgSubmitPayload_payload = md_MsgSubmitPayload.Fields().ByName("payload") +} + +var _ protoreflect.Message = (*fastReflection_MsgSubmitPayload)(nil) + +type fastReflection_MsgSubmitPayload MsgSubmitPayload + +func (x *MsgSubmitPayload) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSubmitPayload)(x) +} + +func (x *MsgSubmitPayload) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_tx_proto_msgTypes[0] + 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) +} + +var _fastReflection_MsgSubmitPayload_messageType fastReflection_MsgSubmitPayload_messageType +var _ protoreflect.MessageType = fastReflection_MsgSubmitPayload_messageType{} + +type fastReflection_MsgSubmitPayload_messageType struct{} + +func (x fastReflection_MsgSubmitPayload_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSubmitPayload)(nil) +} +func (x fastReflection_MsgSubmitPayload_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSubmitPayload) +} +func (x fastReflection_MsgSubmitPayload_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSubmitPayload +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSubmitPayload) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSubmitPayload +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSubmitPayload) Type() protoreflect.MessageType { + return _fastReflection_MsgSubmitPayload_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSubmitPayload) New() protoreflect.Message { + return new(fastReflection_MsgSubmitPayload) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSubmitPayload) Interface() protoreflect.ProtoMessage { + return (*MsgSubmitPayload)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSubmitPayload) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Signer != "" { + value := protoreflect.ValueOfString(x.Signer) + if !f(fd_MsgSubmitPayload_signer, value) { + return + } + } + if x.Payload != "" { + value := protoreflect.ValueOfString(x.Payload) + if !f(fd_MsgSubmitPayload_payload, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSubmitPayload) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayload.signer": + return x.Signer != "" + case "noble.orbiter.v1.MsgSubmitPayload.payload": + return x.Payload != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayload")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayload does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitPayload) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayload.signer": + x.Signer = "" + case "noble.orbiter.v1.MsgSubmitPayload.payload": + x.Payload = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayload")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayload does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSubmitPayload) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.MsgSubmitPayload.signer": + value := x.Signer + return protoreflect.ValueOfString(value) + case "noble.orbiter.v1.MsgSubmitPayload.payload": + value := x.Payload + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayload")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayload does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitPayload) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayload.signer": + x.Signer = value.Interface().(string) + case "noble.orbiter.v1.MsgSubmitPayload.payload": + x.Payload = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayload")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayload does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitPayload) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayload.signer": + panic(fmt.Errorf("field signer of message noble.orbiter.v1.MsgSubmitPayload is not mutable")) + case "noble.orbiter.v1.MsgSubmitPayload.payload": + panic(fmt.Errorf("field payload of message noble.orbiter.v1.MsgSubmitPayload is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayload")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayload does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSubmitPayload) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayload.signer": + return protoreflect.ValueOfString("") + case "noble.orbiter.v1.MsgSubmitPayload.payload": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayload")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayload does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSubmitPayload) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.MsgSubmitPayload", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSubmitPayload) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitPayload) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSubmitPayload) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSubmitPayload) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSubmitPayload) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Signer) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Payload) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSubmitPayload) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Payload) > 0 { + i -= len(x.Payload) + copy(dAtA[i:], x.Payload) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Payload))) + i-- + dAtA[i] = 0x12 + } + if len(x.Signer) > 0 { + i -= len(x.Signer) + copy(dAtA[i:], x.Signer) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSubmitPayload) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitPayload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitPayload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Payload = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgSubmitPayloadResponse protoreflect.MessageDescriptor + fd_MsgSubmitPayloadResponse_hash protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_tx_proto_init() + md_MsgSubmitPayloadResponse = File_noble_orbiter_v1_tx_proto.Messages().ByName("MsgSubmitPayloadResponse") + fd_MsgSubmitPayloadResponse_hash = md_MsgSubmitPayloadResponse.Fields().ByName("hash") +} + +var _ protoreflect.Message = (*fastReflection_MsgSubmitPayloadResponse)(nil) + +type fastReflection_MsgSubmitPayloadResponse MsgSubmitPayloadResponse + +func (x *MsgSubmitPayloadResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgSubmitPayloadResponse)(x) +} + +func (x *MsgSubmitPayloadResponse) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_tx_proto_msgTypes[1] + 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) +} + +var _fastReflection_MsgSubmitPayloadResponse_messageType fastReflection_MsgSubmitPayloadResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgSubmitPayloadResponse_messageType{} + +type fastReflection_MsgSubmitPayloadResponse_messageType struct{} + +func (x fastReflection_MsgSubmitPayloadResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgSubmitPayloadResponse)(nil) +} +func (x fastReflection_MsgSubmitPayloadResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgSubmitPayloadResponse) +} +func (x fastReflection_MsgSubmitPayloadResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSubmitPayloadResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgSubmitPayloadResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgSubmitPayloadResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgSubmitPayloadResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgSubmitPayloadResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgSubmitPayloadResponse) New() protoreflect.Message { + return new(fastReflection_MsgSubmitPayloadResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgSubmitPayloadResponse) Interface() protoreflect.ProtoMessage { + return (*MsgSubmitPayloadResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgSubmitPayloadResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Hash) != 0 { + value := protoreflect.ValueOfBytes(x.Hash) + if !f(fd_MsgSubmitPayloadResponse_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgSubmitPayloadResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": + return len(x.Hash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayloadResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitPayloadResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": + x.Hash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayloadResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgSubmitPayloadResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": + value := x.Hash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayloadResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitPayloadResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": + x.Hash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayloadResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitPayloadResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": + panic(fmt.Errorf("field hash of message noble.orbiter.v1.MsgSubmitPayloadResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayloadResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgSubmitPayloadResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.MsgSubmitPayloadResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgSubmitPayloadResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.MsgSubmitPayloadResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgSubmitPayloadResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgSubmitPayloadResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgSubmitPayloadResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgSubmitPayloadResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgSubmitPayloadResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Hash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgSubmitPayloadResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Hash) > 0 { + i -= len(x.Hash) + copy(dAtA[i:], x.Hash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgSubmitPayloadResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitPayloadResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgSubmitPayloadResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) + if x.Hash == nil { + x.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EventPayloadSubmitted protoreflect.MessageDescriptor + fd_EventPayloadSubmitted_hash protoreflect.FieldDescriptor + fd_EventPayloadSubmitted_submitter protoreflect.FieldDescriptor + fd_EventPayloadSubmitted_payload protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_tx_proto_init() + md_EventPayloadSubmitted = File_noble_orbiter_v1_tx_proto.Messages().ByName("EventPayloadSubmitted") + fd_EventPayloadSubmitted_hash = md_EventPayloadSubmitted.Fields().ByName("hash") + fd_EventPayloadSubmitted_submitter = md_EventPayloadSubmitted.Fields().ByName("submitter") + fd_EventPayloadSubmitted_payload = md_EventPayloadSubmitted.Fields().ByName("payload") +} + +var _ protoreflect.Message = (*fastReflection_EventPayloadSubmitted)(nil) + +type fastReflection_EventPayloadSubmitted EventPayloadSubmitted + +func (x *EventPayloadSubmitted) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventPayloadSubmitted)(x) +} + +func (x *EventPayloadSubmitted) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EventPayloadSubmitted_messageType fastReflection_EventPayloadSubmitted_messageType +var _ protoreflect.MessageType = fastReflection_EventPayloadSubmitted_messageType{} + +type fastReflection_EventPayloadSubmitted_messageType struct{} + +func (x fastReflection_EventPayloadSubmitted_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventPayloadSubmitted)(nil) +} +func (x fastReflection_EventPayloadSubmitted_messageType) New() protoreflect.Message { + return new(fastReflection_EventPayloadSubmitted) +} +func (x fastReflection_EventPayloadSubmitted_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventPayloadSubmitted +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventPayloadSubmitted) Descriptor() protoreflect.MessageDescriptor { + return md_EventPayloadSubmitted +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventPayloadSubmitted) Type() protoreflect.MessageType { + return _fastReflection_EventPayloadSubmitted_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventPayloadSubmitted) New() protoreflect.Message { + return new(fastReflection_EventPayloadSubmitted) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventPayloadSubmitted) Interface() protoreflect.ProtoMessage { + return (*EventPayloadSubmitted)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventPayloadSubmitted) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Hash) != 0 { + value := protoreflect.ValueOfBytes(x.Hash) + if !f(fd_EventPayloadSubmitted_hash, value) { + return + } + } + if x.Submitter != "" { + value := protoreflect.ValueOfString(x.Submitter) + if !f(fd_EventPayloadSubmitted_submitter, value) { + return + } + } + if x.Payload != nil { + value := protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) + if !f(fd_EventPayloadSubmitted_payload, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventPayloadSubmitted) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + return len(x.Hash) != 0 + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + return x.Submitter != "" + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + return x.Payload != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadSubmitted) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + x.Hash = nil + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + x.Submitter = "" + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + x.Payload = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventPayloadSubmitted) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + value := x.Hash + return protoreflect.ValueOfBytes(value) + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + value := x.Submitter + return protoreflect.ValueOfString(value) + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + value := x.Payload + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadSubmitted) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + x.Hash = value.Bytes() + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + x.Submitter = value.Interface().(string) + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + x.Payload = value.Message().Interface().(*v1.Payload) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadSubmitted) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + if x.Payload == nil { + x.Payload = new(v1.Payload) + } + return protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + panic(fmt.Errorf("field hash of message noble.orbiter.v1.EventPayloadSubmitted is not mutable")) + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + panic(fmt.Errorf("field submitter of message noble.orbiter.v1.EventPayloadSubmitted is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventPayloadSubmitted) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + return protoreflect.ValueOfBytes(nil) + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + return protoreflect.ValueOfString("") + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + m := new(v1.Payload) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventPayloadSubmitted) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.EventPayloadSubmitted", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventPayloadSubmitted) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadSubmitted) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventPayloadSubmitted) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventPayloadSubmitted) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventPayloadSubmitted) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Hash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Submitter) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Payload != nil { + l = options.Size(x.Payload) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventPayloadSubmitted) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Payload != nil { + encoded, err := options.Marshal(x.Payload) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Submitter) > 0 { + i -= len(x.Submitter) + copy(dAtA[i:], x.Submitter) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Submitter))) + i-- + dAtA[i] = 0x12 + } + if len(x.Hash) > 0 { + i -= len(x.Hash) + copy(dAtA[i:], x.Hash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventPayloadSubmitted) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadSubmitted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) + if x.Hash == nil { + x.Hash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Submitter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Payload == nil { + x.Payload = &v1.Payload{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Payload); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EventPayloadRemoved protoreflect.MessageDescriptor + fd_EventPayloadRemoved_hash protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_tx_proto_init() + md_EventPayloadRemoved = File_noble_orbiter_v1_tx_proto.Messages().ByName("EventPayloadRemoved") + fd_EventPayloadRemoved_hash = md_EventPayloadRemoved.Fields().ByName("hash") +} + +var _ protoreflect.Message = (*fastReflection_EventPayloadRemoved)(nil) + +type fastReflection_EventPayloadRemoved EventPayloadRemoved + +func (x *EventPayloadRemoved) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventPayloadRemoved)(x) +} + +func (x *EventPayloadRemoved) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_tx_proto_msgTypes[3] + 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) +} + +var _fastReflection_EventPayloadRemoved_messageType fastReflection_EventPayloadRemoved_messageType +var _ protoreflect.MessageType = fastReflection_EventPayloadRemoved_messageType{} + +type fastReflection_EventPayloadRemoved_messageType struct{} + +func (x fastReflection_EventPayloadRemoved_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventPayloadRemoved)(nil) +} +func (x fastReflection_EventPayloadRemoved_messageType) New() protoreflect.Message { + return new(fastReflection_EventPayloadRemoved) +} +func (x fastReflection_EventPayloadRemoved_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventPayloadRemoved +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventPayloadRemoved) Descriptor() protoreflect.MessageDescriptor { + return md_EventPayloadRemoved +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventPayloadRemoved) Type() protoreflect.MessageType { + return _fastReflection_EventPayloadRemoved_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventPayloadRemoved) New() protoreflect.Message { + return new(fastReflection_EventPayloadRemoved) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventPayloadRemoved) Interface() protoreflect.ProtoMessage { + return (*EventPayloadRemoved)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventPayloadRemoved) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Hash) != 0 { + value := protoreflect.ValueOfBytes(x.Hash) + if !f(fd_EventPayloadRemoved_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventPayloadRemoved) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + return len(x.Hash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadRemoved) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + x.Hash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventPayloadRemoved) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + value := x.Hash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadRemoved) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + x.Hash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadRemoved) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + panic(fmt.Errorf("field hash of message noble.orbiter.v1.EventPayloadRemoved is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventPayloadRemoved) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventPayloadRemoved) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.EventPayloadRemoved", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventPayloadRemoved) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadRemoved) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventPayloadRemoved) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventPayloadRemoved) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventPayloadRemoved) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Hash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventPayloadRemoved) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Hash) > 0 { + i -= len(x.Hash) + copy(dAtA[i:], x.Hash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventPayloadRemoved) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadRemoved: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadRemoved: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) + if x.Hash == nil { + x.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -21,36 +1923,275 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// MsgSubmitPayload enters a new Orbiter payload into the queue of pending +// forwarding operations. +type MsgSubmitPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The signer of the transaction. + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // The marshalled JSON representation of the payload that is + // submitted to the Orbiter. + Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *MsgSubmitPayload) Reset() { + *x = MsgSubmitPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSubmitPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSubmitPayload) ProtoMessage() {} + +// Deprecated: Use MsgSubmitPayload.ProtoReflect.Descriptor instead. +func (*MsgSubmitPayload) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgSubmitPayload) GetSigner() string { + if x != nil { + return x.Signer + } + return "" +} + +func (x *MsgSubmitPayload) GetPayload() string { + if x != nil { + return x.Payload + } + return "" +} + +// MsgSubmitPayloadResponse returns the keccak256 of the registered +// pending payload. +type MsgSubmitPayloadResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The keccak256 hash by which to reference the submitted payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (x *MsgSubmitPayloadResponse) Reset() { + *x = MsgSubmitPayloadResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSubmitPayloadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSubmitPayloadResponse) ProtoMessage() {} + +// Deprecated: Use MsgSubmitPayloadResponse.ProtoReflect.Descriptor instead. +func (*MsgSubmitPayloadResponse) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_tx_proto_rawDescGZIP(), []int{1} +} + +func (x *MsgSubmitPayloadResponse) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +// EventPayloadSubmitted is emitted after successful submission of a payload. +type EventPayloadSubmitted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The keccak256 hash of the now pending payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // The address that has submitted the payload. + Submitter string `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` + // The submitted payload. + Payload *v1.Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *EventPayloadSubmitted) Reset() { + *x = EventPayloadSubmitted{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventPayloadSubmitted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventPayloadSubmitted) ProtoMessage() {} + +// Deprecated: Use EventPayloadSubmitted.ProtoReflect.Descriptor instead. +func (*EventPayloadSubmitted) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *EventPayloadSubmitted) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +func (x *EventPayloadSubmitted) GetSubmitter() string { + if x != nil { + return x.Submitter + } + return "" +} + +func (x *EventPayloadSubmitted) GetPayload() *v1.Payload { + if x != nil { + return x.Payload + } + return nil +} + +// EventPayloadRemoved is emitted after removing a pending payload from the queue. +type EventPayloadRemoved struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The keccak256 hash of the removed payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (x *EventPayloadRemoved) Reset() { + *x = EventPayloadRemoved{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventPayloadRemoved) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventPayloadRemoved) ProtoMessage() {} + +// Deprecated: Use EventPayloadRemoved.ProtoReflect.Descriptor instead. +func (*EventPayloadRemoved) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_tx_proto_rawDescGZIP(), []int{3} +} + +func (x *EventPayloadRemoved) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + var File_noble_orbiter_v1_tx_proto protoreflect.FileDescriptor var file_noble_orbiter_v1_tx_proto_rawDesc = []byte{ 0x0a, 0x19, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x6f, 0x62, - 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x0c, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x1a, 0x05, 0x80, - 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc1, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x62, - 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, - 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, - 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, - 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x6f, - 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x58, 0xaa, 0x02, - 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, - 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, - 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, - 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_noble_orbiter_v1_tx_proto_goTypes = []interface{}{} + 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, + 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x6e, 0x6f, 0x62, 0x6c, + 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, + 0x31, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x91, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, + 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x3a, 0x31, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x8a, 0xe7, 0xb0, + 0x2a, 0x21, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, + 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x22, 0x2e, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, + 0x61, 0x73, 0x68, 0x22, 0xa8, 0x01, 0x0a, 0x15, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, + 0x68, 0x12, 0x36, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, + 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x07, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x6f, 0x62, + 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, + 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x29, + 0x0a, 0x13, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x32, 0x6d, 0x0a, 0x03, 0x4d, 0x73, 0x67, + 0x12, 0x5f, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x12, 0x22, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, + 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x1a, 0x2a, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, + 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, + 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc1, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, + 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, + 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, + 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, + 0x76, 0x31, 0x3b, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, + 0x4f, 0x58, 0xaa, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, + 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, + 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, + 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, + 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_noble_orbiter_v1_tx_proto_rawDescOnce sync.Once + file_noble_orbiter_v1_tx_proto_rawDescData = file_noble_orbiter_v1_tx_proto_rawDesc +) + +func file_noble_orbiter_v1_tx_proto_rawDescGZIP() []byte { + file_noble_orbiter_v1_tx_proto_rawDescOnce.Do(func() { + file_noble_orbiter_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_noble_orbiter_v1_tx_proto_rawDescData) + }) + return file_noble_orbiter_v1_tx_proto_rawDescData +} + +var file_noble_orbiter_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_noble_orbiter_v1_tx_proto_goTypes = []interface{}{ + (*MsgSubmitPayload)(nil), // 0: noble.orbiter.v1.MsgSubmitPayload + (*MsgSubmitPayloadResponse)(nil), // 1: noble.orbiter.v1.MsgSubmitPayloadResponse + (*EventPayloadSubmitted)(nil), // 2: noble.orbiter.v1.EventPayloadSubmitted + (*EventPayloadRemoved)(nil), // 3: noble.orbiter.v1.EventPayloadRemoved + (*v1.Payload)(nil), // 4: noble.orbiter.core.v1.Payload +} var file_noble_orbiter_v1_tx_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 4, // 0: noble.orbiter.v1.EventPayloadSubmitted.payload:type_name -> noble.orbiter.core.v1.Payload + 0, // 1: noble.orbiter.v1.Msg.SubmitPayload:input_type -> noble.orbiter.v1.MsgSubmitPayload + 1, // 2: noble.orbiter.v1.Msg.SubmitPayload:output_type -> noble.orbiter.v1.MsgSubmitPayloadResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_noble_orbiter_v1_tx_proto_init() } @@ -58,18 +2199,69 @@ func file_noble_orbiter_v1_tx_proto_init() { if File_noble_orbiter_v1_tx_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_noble_orbiter_v1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSubmitPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_noble_orbiter_v1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSubmitPayloadResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_noble_orbiter_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventPayloadSubmitted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_noble_orbiter_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventPayloadRemoved); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_noble_orbiter_v1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 0, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, GoTypes: file_noble_orbiter_v1_tx_proto_goTypes, DependencyIndexes: file_noble_orbiter_v1_tx_proto_depIdxs, + MessageInfos: file_noble_orbiter_v1_tx_proto_msgTypes, }.Build() File_noble_orbiter_v1_tx_proto = out.File file_noble_orbiter_v1_tx_proto_rawDesc = nil diff --git a/api/v1/tx_grpc.pb.go b/api/v1/tx_grpc.pb.go index c1a1c193..031103c5 100644 --- a/api/v1/tx_grpc.pb.go +++ b/api/v1/tx_grpc.pb.go @@ -7,7 +7,10 @@ package orbiterv1 import ( + context "context" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file @@ -15,12 +18,19 @@ import ( // Requires gRPC-Go v1.64.0 or later. const _ = grpc.SupportPackageIsVersion9 +const ( + Msg_SubmitPayload_FullMethodName = "/noble.orbiter.v1.Msg/SubmitPayload" +) + // MsgClient is the client API for Msg 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. // // Msg defines the RPC methods for the Orbiter module. type MsgClient interface { + // SubmitPayload is the entrypoint to insert a new pending payload + // into the dispatching queue. + SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) } type msgClient struct { @@ -31,12 +41,25 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { return &msgClient{cc} } +func (c *msgClient) SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgSubmitPayloadResponse) + err := c.cc.Invoke(ctx, Msg_SubmitPayload_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility. // // Msg defines the RPC methods for the Orbiter module. type MsgServer interface { + // SubmitPayload is the entrypoint to insert a new pending payload + // into the dispatching queue. + SubmitPayload(context.Context, *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) mustEmbedUnimplementedMsgServer() } @@ -47,6 +70,9 @@ type MsgServer interface { // pointer dereference when methods are called. type UnimplementedMsgServer struct{} +func (UnimplementedMsgServer) SubmitPayload(context.Context, *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitPayload not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} func (UnimplementedMsgServer) testEmbeddedByValue() {} @@ -68,13 +94,36 @@ func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { s.RegisterService(&Msg_ServiceDesc, srv) } +func _Msg_SubmitPayload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitPayload) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitPayload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_SubmitPayload_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitPayload(ctx, req.(*MsgSubmitPayload)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Msg_ServiceDesc = grpc.ServiceDesc{ ServiceName: "noble.orbiter.v1.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "noble/orbiter/v1/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "SubmitPayload", + Handler: _Msg_SubmitPayload_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "noble/orbiter/v1/tx.proto", } diff --git a/proto/noble/orbiter/core/v1/orbiter.proto b/proto/noble/orbiter/core/v1/orbiter.proto index cc6d2056..838a9add 100644 --- a/proto/noble/orbiter/core/v1/orbiter.proto +++ b/proto/noble/orbiter/core/v1/orbiter.proto @@ -74,3 +74,11 @@ message PayloadWrapper { // routing info and possibly pre routing actions. Payload orbiter = 1; } + +// PendingPayload holds the information that goes into the stored payload hash. +message PendingPayload { + // The sequence number of the pending payload. + uint64 sequence = 1; + // The submitted payload that will is registered as pending. + Payload payload = 2; +} diff --git a/proto/noble/orbiter/v1/query.proto b/proto/noble/orbiter/v1/query.proto index 33472197..42067058 100644 --- a/proto/noble/orbiter/v1/query.proto +++ b/proto/noble/orbiter/v1/query.proto @@ -2,7 +2,29 @@ syntax = "proto3"; package noble.orbiter.v1; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/query/v1/query.proto"; +import "google/api/annotations.proto"; + option go_package = "github.com/noble-assets/orbiter/types"; // Query defines the gRPC query service for the Orbiter module. -service Query {} +service Query { + rpc PendingPayloads(QueryPendingPayloadsRequest) returns (QueryPendingPayloadsResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/noble/orbiter/v1/pending-payloads"; + } +} + +message QueryPendingPayloadsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryPendingPayloadsResponse { + // Hex-formatted hashes of the currently pending payloads + repeated string hashes = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/proto/noble/orbiter/v1/tx.proto b/proto/noble/orbiter/v1/tx.proto index f0ec6938..e67b1755 100644 --- a/proto/noble/orbiter/v1/tx.proto +++ b/proto/noble/orbiter/v1/tx.proto @@ -2,11 +2,59 @@ syntax = "proto3"; package noble.orbiter.v1; +import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "noble/orbiter/core/v1/orbiter.proto"; option go_package = "github.com/noble-assets/orbiter/types"; // Msg defines the RPC methods for the Orbiter module. service Msg { option (cosmos.msg.v1.service) = true; + + // SubmitPayload is the entrypoint to insert a new pending payload + // into the dispatching queue. + rpc SubmitPayload(MsgSubmitPayload) returns (MsgSubmitPayloadResponse); +} + +// MsgSubmitPayload enters a new Orbiter payload into the queue of pending +// forwarding operations. +message MsgSubmitPayload { + option (cosmos.msg.v1.signer) = "signer"; + option (amino.name) = "noble/orbiter/v1/MsgSubmitPayload"; + + // The signer of the transaction. + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // The marshalled JSON representation of the payload that is + // submitted to the Orbiter. + string payload = 2; +} + +// MsgSubmitPayloadResponse returns the keccak256 of the registered +// pending payload. +message MsgSubmitPayloadResponse { + // The keccak256 hash by which to reference the submitted payload. + bytes hash = 1; +} + +// EventPayloadSubmitted is emitted after successful submission of a payload. +message EventPayloadSubmitted { + // The keccak256 hash of the now pending payload. + bytes hash = 1; + // The address that has submitted the payload. + string submitter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // The submitted payload. + noble.orbiter.core.v1.Payload payload = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +// EventPayloadRemoved is emitted after removing a pending payload from the queue. +message EventPayloadRemoved { + // The keccak256 hash of the removed payload. + bytes hash = 1; } diff --git a/types/core/orbiter.pb.go b/types/core/orbiter.pb.go index c22e01d5..98c2b8a2 100644 --- a/types/core/orbiter.pb.go +++ b/types/core/orbiter.pb.go @@ -230,11 +230,67 @@ func (m *PayloadWrapper) GetOrbiter() *Payload { return nil } +// PendingPayload holds the information that goes into the stored payload hash. +type PendingPayload struct { + // The sequence number of the pending payload. + Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` + // The submitted payload that will is registered as pending. + Payload *Payload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (m *PendingPayload) Reset() { *m = PendingPayload{} } +func (m *PendingPayload) String() string { return proto.CompactTextString(m) } +func (*PendingPayload) ProtoMessage() {} +func (*PendingPayload) Descriptor() ([]byte, []int) { + return fileDescriptor_24aab38bf890c9f2, []int{4} +} +func (m *PendingPayload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PendingPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PendingPayload.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PendingPayload) XXX_Merge(src proto.Message) { + xxx_messageInfo_PendingPayload.Merge(m, src) +} +func (m *PendingPayload) XXX_Size() int { + return m.Size() +} +func (m *PendingPayload) XXX_DiscardUnknown() { + xxx_messageInfo_PendingPayload.DiscardUnknown(m) +} + +var xxx_messageInfo_PendingPayload proto.InternalMessageInfo + +func (m *PendingPayload) GetSequence() uint64 { + if m != nil { + return m.Sequence + } + return 0 +} + +func (m *PendingPayload) GetPayload() *Payload { + if m != nil { + return m.Payload + } + return nil +} + func init() { proto.RegisterType((*Action)(nil), "noble.orbiter.core.v1.Action") proto.RegisterType((*Forwarding)(nil), "noble.orbiter.core.v1.Forwarding") proto.RegisterType((*Payload)(nil), "noble.orbiter.core.v1.Payload") proto.RegisterType((*PayloadWrapper)(nil), "noble.orbiter.core.v1.PayloadWrapper") + proto.RegisterType((*PendingPayload)(nil), "noble.orbiter.core.v1.PendingPayload") } func init() { @@ -242,36 +298,38 @@ func init() { } var fileDescriptor_24aab38bf890c9f2 = []byte{ - // 451 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6a, 0x13, 0x41, - 0x18, 0xc7, 0x33, 0xa9, 0xb4, 0x30, 0x91, 0x1e, 0xc6, 0x0a, 0x69, 0xc1, 0x6d, 0x1a, 0x29, 0x44, - 0x21, 0x33, 0x34, 0x5e, 0xc4, 0x83, 0x90, 0x10, 0x84, 0x78, 0x2a, 0x7b, 0x11, 0xf4, 0xb0, 0xcc, - 0xee, 0x4e, 0x37, 0x03, 0xe9, 0x7e, 0xcb, 0xcc, 0xa4, 0x92, 0x37, 0xf0, 0xe0, 0xc1, 0x07, 0xf0, - 0xe0, 0x43, 0xf4, 0x21, 0xa4, 0xa7, 0x1e, 0x3d, 0x4a, 0x72, 0xf1, 0x31, 0x64, 0x67, 0x66, 0x37, - 0x11, 0x13, 0xf1, 0x36, 0xf3, 0x7d, 0xff, 0xef, 0xcf, 0xef, 0xff, 0xcd, 0xe0, 0xa7, 0x39, 0xc4, - 0x33, 0xc1, 0x40, 0xc5, 0xd2, 0x08, 0xc5, 0x12, 0x50, 0x82, 0xdd, 0x5c, 0x54, 0x77, 0x5a, 0x28, - 0x30, 0x40, 0x1e, 0x5b, 0x11, 0xad, 0x8a, 0xa5, 0x88, 0xde, 0x5c, 0x9c, 0x1c, 0x27, 0xa0, 0xaf, - 0x41, 0x47, 0x56, 0xc4, 0xdc, 0xc5, 0x4d, 0x9c, 0x1c, 0x65, 0x90, 0x81, 0xab, 0x97, 0x27, 0x5f, - 0x3d, 0xce, 0x00, 0xb2, 0x99, 0x60, 0xf6, 0x16, 0xcf, 0xaf, 0x18, 0xcf, 0x17, 0xbe, 0x15, 0x6c, - 0xe7, 0x90, 0xa9, 0xeb, 0x77, 0xbf, 0x22, 0xbc, 0x3f, 0x4c, 0x8c, 0x84, 0x9c, 0x30, 0xdc, 0x94, - 0x69, 0x1b, 0x75, 0x50, 0xef, 0x70, 0x70, 0x4a, 0xb7, 0xa2, 0x51, 0x27, 0x9d, 0x8c, 0xc3, 0xa6, - 0x4c, 0xc9, 0x07, 0x8c, 0xb9, 0x31, 0x4a, 0xc6, 0x73, 0x23, 0x74, 0xbb, 0xd9, 0x41, 0xbd, 0xd6, - 0xe0, 0x88, 0x3a, 0x16, 0x5a, 0xb1, 0xd0, 0x61, 0xbe, 0x18, 0x9d, 0xdf, 0xdd, 0xf6, 0xcf, 0xfe, - 0x74, 0xac, 0xcd, 0x86, 0xb5, 0x45, 0xb8, 0x61, 0xf7, 0xea, 0xc1, 0xa7, 0x6f, 0xa7, 0x8d, 0xee, - 0x2f, 0x84, 0xf1, 0x1b, 0x50, 0x1f, 0xb9, 0x4a, 0x65, 0x9e, 0x91, 0x11, 0x6e, 0x59, 0xdf, 0x04, - 0x66, 0x51, 0xcd, 0x7a, 0xb6, 0x83, 0xf5, 0xd2, 0x2b, 0x27, 0xe3, 0x10, 0x57, 0x53, 0x93, 0x94, - 0x44, 0xff, 0x4d, 0xfd, 0xec, 0xee, 0xb6, 0x7f, 0xfe, 0x17, 0xf5, 0x1a, 0x67, 0x3b, 0x39, 0x61, - 0xf8, 0x51, 0xc1, 0xb5, 0x36, 0x53, 0x05, 0xf3, 0x6c, 0x1a, 0x15, 0x7c, 0x31, 0x03, 0x9e, 0xb6, - 0xf7, 0x3a, 0xa8, 0xf7, 0x30, 0x24, 0x1b, 0xad, 0x4b, 0xd7, 0xf1, 0x51, 0x3f, 0x23, 0x7c, 0xe0, - 0x2b, 0xe4, 0x75, 0x99, 0x53, 0x44, 0xdc, 0x2e, 0x48, 0xb7, 0x51, 0x67, 0xaf, 0xd7, 0x1a, 0x3c, - 0xf9, 0xe7, 0x9b, 0x94, 0x19, 0x85, 0x3b, 0x6a, 0x32, 0xc4, 0xf8, 0xaa, 0xc6, 0xf4, 0x19, 0x77, - 0xad, 0x69, 0x9d, 0x27, 0xdc, 0x18, 0xea, 0xbe, 0xc5, 0x87, 0x9e, 0xe6, 0x9d, 0xe2, 0x45, 0x21, - 0x14, 0x79, 0x89, 0x0f, 0xfc, 0xac, 0x5d, 0x7c, 0x6b, 0x10, 0xec, 0x5a, 0xbc, 0x9b, 0x0b, 0x2b, - 0xf9, 0x68, 0xfc, 0x7d, 0x19, 0xa0, 0xfb, 0x65, 0x80, 0x7e, 0x2e, 0x03, 0xf4, 0x65, 0x15, 0x34, - 0xee, 0x57, 0x41, 0xe3, 0xc7, 0x2a, 0x68, 0xbc, 0x7f, 0x9e, 0x49, 0x33, 0x9d, 0xc7, 0x34, 0x81, - 0x6b, 0x66, 0xcd, 0xfa, 0x5c, 0x6b, 0x61, 0x74, 0xfd, 0x61, 0xcd, 0xa2, 0x10, 0xda, 0x7e, 0xdb, - 0x78, 0xdf, 0x3e, 0xce, 0x8b, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x35, 0x38, 0x44, 0x94, 0x5b, - 0x03, 0x00, 0x00, + // 484 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x3b, 0xdd, 0x65, 0x57, 0xa6, 0xd2, 0xc3, 0xb8, 0x42, 0xb7, 0x60, 0xb6, 0x5b, 0x59, + 0xa8, 0x42, 0x33, 0x6c, 0xbd, 0x88, 0x07, 0xa1, 0xa5, 0x08, 0xf5, 0x54, 0x72, 0x11, 0xf4, 0x10, + 0x26, 0xc9, 0x34, 0x0d, 0x74, 0xf3, 0xe2, 0xcc, 0x64, 0xa5, 0xdf, 0xc0, 0x83, 0x07, 0x3f, 0x80, + 0x07, 0x3f, 0xc4, 0x7e, 0x08, 0xd9, 0xd3, 0x1e, 0x3d, 0x4a, 0x7b, 0xf1, 0x63, 0x48, 0x66, 0x26, + 0xd9, 0x8a, 0xad, 0xf4, 0x36, 0xef, 0xbd, 0xff, 0xfb, 0xcf, 0xef, 0xbd, 0x64, 0xf0, 0xd3, 0x14, + 0x82, 0x05, 0xa7, 0x20, 0x82, 0x44, 0x71, 0x41, 0x43, 0x10, 0x9c, 0x5e, 0x5f, 0x96, 0xb1, 0x9b, + 0x09, 0x50, 0x40, 0x1e, 0x6b, 0x91, 0x5b, 0x26, 0x0b, 0x91, 0x7b, 0x7d, 0xd9, 0x3e, 0x0d, 0x41, + 0x5e, 0x81, 0xf4, 0xb5, 0x88, 0x9a, 0xc0, 0x74, 0xb4, 0x4f, 0x62, 0x88, 0xc1, 0xe4, 0x8b, 0x93, + 0xcd, 0x9e, 0xc6, 0x00, 0xf1, 0x82, 0x53, 0x1d, 0x05, 0xf9, 0x8c, 0xb2, 0x74, 0x69, 0x4b, 0xce, + 0x76, 0x8e, 0x24, 0x32, 0xf5, 0xee, 0x37, 0x84, 0x8f, 0x86, 0xa1, 0x4a, 0x20, 0x25, 0x14, 0xd7, + 0x93, 0xa8, 0x85, 0x3a, 0xa8, 0xd7, 0x1c, 0x9c, 0xb9, 0x5b, 0xd1, 0x5c, 0x23, 0x9d, 0x8c, 0xbd, + 0x7a, 0x12, 0x91, 0x0f, 0x18, 0x33, 0xa5, 0x44, 0x12, 0xe4, 0x8a, 0xcb, 0x56, 0xbd, 0x83, 0x7a, + 0x8d, 0xc1, 0x89, 0x6b, 0x58, 0xdc, 0x92, 0xc5, 0x1d, 0xa6, 0xcb, 0xd1, 0xc5, 0xed, 0x4d, 0xff, + 0xfc, 0x6f, 0xc7, 0xca, 0x6c, 0x58, 0x59, 0x78, 0x1b, 0x76, 0xaf, 0x0e, 0x3f, 0x7f, 0x3f, 0xab, + 0x75, 0x7f, 0x23, 0x8c, 0xdf, 0x80, 0xf8, 0xc4, 0x44, 0x94, 0xa4, 0x31, 0x19, 0xe1, 0x86, 0xf6, + 0x0d, 0x61, 0xe1, 0x57, 0xac, 0xe7, 0x3b, 0x58, 0xa7, 0x56, 0x39, 0x19, 0x7b, 0xb8, 0xec, 0x9a, + 0x44, 0xc4, 0xdf, 0x9b, 0xfa, 0xd9, 0xed, 0x4d, 0xff, 0xe2, 0x1f, 0xea, 0x7b, 0x9c, 0xed, 0xe4, + 0x84, 0xe2, 0x47, 0x19, 0x93, 0x52, 0xcd, 0x05, 0xe4, 0xf1, 0xdc, 0xcf, 0xd8, 0x72, 0x01, 0x2c, + 0x6a, 0x1d, 0x74, 0x50, 0xef, 0xa1, 0x47, 0x36, 0x4a, 0x53, 0x53, 0xb1, 0xa3, 0x7e, 0x41, 0xf8, + 0xd8, 0x66, 0xc8, 0xeb, 0x62, 0x4e, 0xee, 0x33, 0xbd, 0x20, 0xd9, 0x42, 0x9d, 0x83, 0x5e, 0x63, + 0xf0, 0xe4, 0xbf, 0xdf, 0xa4, 0x98, 0x91, 0x9b, 0xa3, 0x24, 0x43, 0x8c, 0x67, 0x15, 0xa6, 0x9d, + 0x71, 0xd7, 0x9a, 0xee, 0xe7, 0xf1, 0x36, 0x9a, 0xba, 0x6f, 0x71, 0xd3, 0xd2, 0xbc, 0x13, 0x2c, + 0xcb, 0xb8, 0x20, 0x2f, 0xf1, 0xb1, 0xed, 0xd5, 0x8b, 0x6f, 0x0c, 0x9c, 0x5d, 0x8b, 0x37, 0x7d, + 0x5e, 0x29, 0xef, 0xce, 0x70, 0x73, 0xca, 0xd3, 0xc2, 0xb6, 0x1c, 0xb0, 0x8d, 0x1f, 0x48, 0xfe, + 0x31, 0xe7, 0x69, 0xc8, 0xb5, 0xd9, 0xa1, 0x57, 0xc5, 0xc5, 0x3d, 0xe5, 0xce, 0xea, 0xfb, 0xdd, + 0x63, 0xe5, 0xa3, 0xf1, 0x8f, 0x95, 0x83, 0xee, 0x56, 0x0e, 0xfa, 0xb5, 0x72, 0xd0, 0xd7, 0xb5, + 0x53, 0xbb, 0x5b, 0x3b, 0xb5, 0x9f, 0x6b, 0xa7, 0xf6, 0xfe, 0x79, 0x9c, 0xa8, 0x79, 0x1e, 0xb8, + 0x21, 0x5c, 0x51, 0x6d, 0xd6, 0x67, 0x52, 0x72, 0x25, 0xab, 0x87, 0xa1, 0x96, 0x19, 0x97, 0xfa, + 0x79, 0x04, 0x47, 0xfa, 0x27, 0x78, 0xf1, 0x27, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x87, 0x28, 0x68, + 0xc3, 0x03, 0x00, 0x00, } func (m *Action) Marshal() (dAtA []byte, err error) { @@ -445,6 +503,46 @@ func (m *PayloadWrapper) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PendingPayload) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PendingPayload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PendingPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Payload != nil { + { + size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOrbiter(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Sequence != 0 { + i = encodeVarintOrbiter(dAtA, i, uint64(m.Sequence)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintOrbiter(dAtA []byte, offset int, v uint64) int { offset -= sovOrbiter(v) base := offset @@ -524,6 +622,22 @@ func (m *PayloadWrapper) Size() (n int) { return n } +func (m *PendingPayload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sequence != 0 { + n += 1 + sovOrbiter(uint64(m.Sequence)) + } + if m.Payload != nil { + l = m.Payload.Size() + n += 1 + l + sovOrbiter(uint64(l)) + } + return n +} + func sovOrbiter(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -980,6 +1094,111 @@ func (m *PayloadWrapper) Unmarshal(dAtA []byte) error { } return nil } +func (m *PendingPayload) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrbiter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PendingPayload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PendingPayload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) + } + m.Sequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrbiter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Sequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrbiter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOrbiter + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOrbiter + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Payload == nil { + m.Payload = &Payload{} + } + if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOrbiter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOrbiter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipOrbiter(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/query.pb.go b/types/query.pb.go index 4397f2cf..8d1967e9 100644 --- a/types/query.pb.go +++ b/types/query.pb.go @@ -6,10 +6,16 @@ package types import ( context "context" fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -23,19 +29,137 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type QueryPendingPayloadsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPendingPayloadsRequest) Reset() { *m = QueryPendingPayloadsRequest{} } +func (m *QueryPendingPayloadsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPayloadsRequest) ProtoMessage() {} +func (*QueryPendingPayloadsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_390782105f057f99, []int{0} +} +func (m *QueryPendingPayloadsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPendingPayloadsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPendingPayloadsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPendingPayloadsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPayloadsRequest.Merge(m, src) +} +func (m *QueryPendingPayloadsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPendingPayloadsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPayloadsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPendingPayloadsRequest proto.InternalMessageInfo + +func (m *QueryPendingPayloadsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryPendingPayloadsResponse struct { + // Hex-formatted hashes of the currently pending payloads + Hashes []string `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryPendingPayloadsResponse) Reset() { *m = QueryPendingPayloadsResponse{} } +func (m *QueryPendingPayloadsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPayloadsResponse) ProtoMessage() {} +func (*QueryPendingPayloadsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_390782105f057f99, []int{1} +} +func (m *QueryPendingPayloadsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPendingPayloadsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPendingPayloadsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryPendingPayloadsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPayloadsResponse.Merge(m, src) +} +func (m *QueryPendingPayloadsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPendingPayloadsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPayloadsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPendingPayloadsResponse proto.InternalMessageInfo + +func (m *QueryPendingPayloadsResponse) GetHashes() []string { + if m != nil { + return m.Hashes + } + return nil +} + +func (m *QueryPendingPayloadsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QueryPendingPayloadsRequest)(nil), "noble.orbiter.v1.QueryPendingPayloadsRequest") + proto.RegisterType((*QueryPendingPayloadsResponse)(nil), "noble.orbiter.v1.QueryPendingPayloadsResponse") +} + func init() { proto.RegisterFile("noble/orbiter/v1/query.proto", fileDescriptor_390782105f057f99) } var fileDescriptor_390782105f057f99 = []byte{ - // 133 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0xcb, 0x4f, 0xca, - 0x49, 0xd5, 0xcf, 0x2f, 0x4a, 0xca, 0x2c, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, - 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0xcb, 0xea, 0x41, 0x65, 0xf5, - 0xca, 0x0c, 0x8d, 0xd8, 0xb9, 0x58, 0x03, 0x41, 0x0a, 0x9c, 0xec, 0x4f, 0x3c, 0x92, 0x63, 0xbc, - 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, - 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x35, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, - 0x57, 0x1f, 0xac, 0x5f, 0x37, 0xb1, 0xb8, 0x38, 0xb5, 0xa4, 0x18, 0x6e, 0x49, 0x49, 0x65, 0x41, - 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x0a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x42, 0xef, 0x5b, - 0x58, 0x82, 0x00, 0x00, 0x00, + // 354 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbd, 0x4a, 0x2b, 0x41, + 0x14, 0xc7, 0x33, 0xb9, 0xdc, 0xc0, 0x9d, 0x5b, 0x28, 0x53, 0x48, 0xd8, 0x84, 0x25, 0x2c, 0x7e, + 0x84, 0x40, 0x66, 0xd8, 0xf8, 0x00, 0x82, 0x85, 0xb6, 0x31, 0xa5, 0xdd, 0x6c, 0x72, 0xd8, 0x2c, + 0x24, 0x33, 0x93, 0x3d, 0x93, 0x40, 0x2a, 0xc1, 0xca, 0x52, 0xf0, 0x09, 0xac, 0x6d, 0x7c, 0x0c, + 0xcb, 0x80, 0x8d, 0xa5, 0x24, 0x82, 0xaf, 0x21, 0xd9, 0x59, 0x35, 0x46, 0x51, 0xcb, 0xe5, 0xff, + 0xf1, 0xfb, 0x73, 0x76, 0x68, 0x55, 0xe9, 0x68, 0x00, 0x42, 0xa7, 0x51, 0x62, 0x21, 0x15, 0x93, + 0x50, 0x8c, 0xc6, 0x90, 0x4e, 0xb9, 0x49, 0xb5, 0xd5, 0x6c, 0x33, 0x53, 0x79, 0xae, 0xf2, 0x49, + 0xe8, 0x35, 0xba, 0x1a, 0x87, 0x1a, 0x45, 0x24, 0x11, 0x9c, 0x55, 0x4c, 0xc2, 0x08, 0xac, 0x0c, + 0x85, 0x91, 0x71, 0xa2, 0xa4, 0x4d, 0xb4, 0x72, 0x69, 0xaf, 0x92, 0x7b, 0x5f, 0x6d, 0xab, 0xd5, + 0x5e, 0x35, 0xd6, 0x3a, 0x1e, 0x80, 0x90, 0x26, 0x11, 0x52, 0x29, 0x6d, 0xb3, 0x24, 0x3a, 0x35, + 0x00, 0x5a, 0x39, 0x59, 0x9a, 0xdb, 0xa0, 0x7a, 0x89, 0x8a, 0xdb, 0x72, 0x3a, 0xd0, 0xb2, 0x87, + 0x1d, 0x18, 0x8d, 0x01, 0x2d, 0x3b, 0xa2, 0xf4, 0x9d, 0x56, 0x26, 0x35, 0x52, 0xff, 0xdf, 0xda, + 0xe5, 0x0e, 0xc7, 0x97, 0xd3, 0xb8, 0x43, 0xe5, 0xd3, 0x78, 0x5b, 0xc6, 0x90, 0x67, 0x3b, 0x2b, + 0xc9, 0xe0, 0x8c, 0x56, 0xbf, 0xc6, 0xa0, 0xd1, 0x0a, 0x81, 0x6d, 0xd1, 0x52, 0x5f, 0x62, 0x1f, + 0xb0, 0x4c, 0x6a, 0x7f, 0xea, 0xff, 0x3a, 0xf9, 0x17, 0x3b, 0xfe, 0xc0, 0x2f, 0x66, 0xfc, 0xbd, + 0x1f, 0xf9, 0xae, 0x74, 0x75, 0x40, 0xeb, 0x86, 0xd0, 0xbf, 0xd9, 0x02, 0x76, 0x4d, 0xe8, 0xc6, + 0xda, 0x0c, 0xd6, 0xe4, 0xeb, 0xf7, 0xe7, 0xdf, 0x5c, 0xc5, 0xe3, 0xbf, 0xb5, 0xbb, 0x21, 0x81, + 0xb8, 0x78, 0xbe, 0x6d, 0x90, 0xf3, 0xfb, 0xa7, 0xab, 0xe2, 0x36, 0x0b, 0xc4, 0xa7, 0x97, 0x60, + 0x5c, 0xae, 0x69, 0xf2, 0xe0, 0xe1, 0xc1, 0xdd, 0xdc, 0x27, 0xb3, 0xb9, 0x4f, 0x1e, 0xe7, 0x3e, + 0xb9, 0x5c, 0xf8, 0x85, 0xd9, 0xc2, 0x2f, 0x3c, 0x2c, 0xfc, 0xc2, 0xe9, 0x4e, 0x9c, 0xd8, 0xfe, + 0x38, 0xe2, 0x5d, 0x3d, 0x74, 0x3d, 0x4d, 0x89, 0x08, 0x16, 0xdf, 0xea, 0xec, 0xd4, 0x00, 0x46, + 0xa5, 0xec, 0xef, 0xee, 0xbf, 0x04, 0x00, 0x00, 0xff, 0xff, 0x22, 0x29, 0x42, 0x97, 0x76, 0x02, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -50,6 +174,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + PendingPayloads(ctx context.Context, in *QueryPendingPayloadsRequest, opts ...grpc.CallOption) (*QueryPendingPayloadsResponse, error) } type queryClient struct { @@ -60,23 +185,477 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) PendingPayloads(ctx context.Context, in *QueryPendingPayloadsRequest, opts ...grpc.CallOption) (*QueryPendingPayloadsResponse, error) { + out := new(QueryPendingPayloadsResponse) + err := c.cc.Invoke(ctx, "/noble.orbiter.v1.Query/PendingPayloads", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { + PendingPayloads(context.Context, *QueryPendingPayloadsRequest) (*QueryPendingPayloadsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) PendingPayloads(ctx context.Context, req *QueryPendingPayloadsRequest) (*QueryPendingPayloadsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PendingPayloads not implemented") +} + func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_PendingPayloads_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPendingPayloadsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).PendingPayloads(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/noble.orbiter.v1.Query/PendingPayloads", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PendingPayloads(ctx, req.(*QueryPendingPayloadsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "noble.orbiter.v1.Query", HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "noble/orbiter/v1/query.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "PendingPayloads", + Handler: _Query_PendingPayloads_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "noble/orbiter/v1/query.proto", +} + +func (m *QueryPendingPayloadsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPendingPayloadsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingPayloadsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPendingPayloadsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryPendingPayloadsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingPayloadsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Hashes) > 0 { + for iNdEx := len(m.Hashes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Hashes[iNdEx]) + copy(dAtA[i:], m.Hashes[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Hashes[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryPendingPayloadsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPendingPayloadsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Hashes) > 0 { + for _, s := range m.Hashes { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryPendingPayloadsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPendingPayloadsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPendingPayloadsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPendingPayloadsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryPendingPayloadsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPendingPayloadsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hashes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hashes = append(m.Hashes, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/types/query.pb.gw.go b/types/query.pb.gw.go new file mode 100644 index 00000000..75c9baf6 --- /dev/null +++ b/types/query.pb.gw.go @@ -0,0 +1,171 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: noble/orbiter/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_Query_PendingPayloads_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_PendingPayloads_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingPayloadsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PendingPayloads_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.PendingPayloads(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_PendingPayloads_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingPayloadsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PendingPayloads_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.PendingPayloads(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer 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 RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_PendingPayloads_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_PendingPayloads_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PendingPayloads_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(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 RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_PendingPayloads_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_PendingPayloads_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PendingPayloads_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_PendingPayloads_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"noble", "orbiter", "v1", "pending-payloads"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_PendingPayloads_0 = runtime.ForwardResponseMessage +) diff --git a/types/tx.pb.go b/types/tx.pb.go index 09cb964a..1a45cbf8 100644 --- a/types/tx.pb.go +++ b/types/tx.pb.go @@ -6,11 +6,19 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + core "github.com/noble-assets/orbiter/types/core" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -24,20 +32,258 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgSubmitPayload enters a new Orbiter payload into the queue of pending +// forwarding operations. +type MsgSubmitPayload struct { + // The signer of the transaction. + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // The marshalled JSON representation of the payload that is + // submitted to the Orbiter. + Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (m *MsgSubmitPayload) Reset() { *m = MsgSubmitPayload{} } +func (m *MsgSubmitPayload) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitPayload) ProtoMessage() {} +func (*MsgSubmitPayload) Descriptor() ([]byte, []int) { + return fileDescriptor_4f89c0e5a76b9120, []int{0} +} +func (m *MsgSubmitPayload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitPayload.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitPayload) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitPayload.Merge(m, src) +} +func (m *MsgSubmitPayload) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitPayload) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitPayload.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitPayload proto.InternalMessageInfo + +func (m *MsgSubmitPayload) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgSubmitPayload) GetPayload() string { + if m != nil { + return m.Payload + } + return "" +} + +// MsgSubmitPayloadResponse returns the keccak256 of the registered +// pending payload. +type MsgSubmitPayloadResponse struct { + // The keccak256 hash by which to reference the submitted payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (m *MsgSubmitPayloadResponse) Reset() { *m = MsgSubmitPayloadResponse{} } +func (m *MsgSubmitPayloadResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitPayloadResponse) ProtoMessage() {} +func (*MsgSubmitPayloadResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4f89c0e5a76b9120, []int{1} +} +func (m *MsgSubmitPayloadResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitPayloadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitPayloadResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitPayloadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitPayloadResponse.Merge(m, src) +} +func (m *MsgSubmitPayloadResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitPayloadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitPayloadResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitPayloadResponse proto.InternalMessageInfo + +func (m *MsgSubmitPayloadResponse) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +// EventPayloadSubmitted is emitted after successful submission of a payload. +type EventPayloadSubmitted struct { + // The keccak256 hash of the now pending payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // The address that has submitted the payload. + Submitter string `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` + // The submitted payload. + Payload core.Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload"` +} + +func (m *EventPayloadSubmitted) Reset() { *m = EventPayloadSubmitted{} } +func (m *EventPayloadSubmitted) String() string { return proto.CompactTextString(m) } +func (*EventPayloadSubmitted) ProtoMessage() {} +func (*EventPayloadSubmitted) Descriptor() ([]byte, []int) { + return fileDescriptor_4f89c0e5a76b9120, []int{2} +} +func (m *EventPayloadSubmitted) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPayloadSubmitted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPayloadSubmitted.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPayloadSubmitted) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPayloadSubmitted.Merge(m, src) +} +func (m *EventPayloadSubmitted) XXX_Size() int { + return m.Size() +} +func (m *EventPayloadSubmitted) XXX_DiscardUnknown() { + xxx_messageInfo_EventPayloadSubmitted.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPayloadSubmitted proto.InternalMessageInfo + +func (m *EventPayloadSubmitted) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func (m *EventPayloadSubmitted) GetSubmitter() string { + if m != nil { + return m.Submitter + } + return "" +} + +func (m *EventPayloadSubmitted) GetPayload() core.Payload { + if m != nil { + return m.Payload + } + return core.Payload{} +} + +// EventPayloadRemoved is emitted after removing a pending payload from the queue. +type EventPayloadRemoved struct { + // The keccak256 hash of the removed payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (m *EventPayloadRemoved) Reset() { *m = EventPayloadRemoved{} } +func (m *EventPayloadRemoved) String() string { return proto.CompactTextString(m) } +func (*EventPayloadRemoved) ProtoMessage() {} +func (*EventPayloadRemoved) Descriptor() ([]byte, []int) { + return fileDescriptor_4f89c0e5a76b9120, []int{3} +} +func (m *EventPayloadRemoved) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPayloadRemoved) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPayloadRemoved.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPayloadRemoved) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPayloadRemoved.Merge(m, src) +} +func (m *EventPayloadRemoved) XXX_Size() int { + return m.Size() +} +func (m *EventPayloadRemoved) XXX_DiscardUnknown() { + xxx_messageInfo_EventPayloadRemoved.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPayloadRemoved proto.InternalMessageInfo + +func (m *EventPayloadRemoved) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func init() { + proto.RegisterType((*MsgSubmitPayload)(nil), "noble.orbiter.v1.MsgSubmitPayload") + proto.RegisterType((*MsgSubmitPayloadResponse)(nil), "noble.orbiter.v1.MsgSubmitPayloadResponse") + proto.RegisterType((*EventPayloadSubmitted)(nil), "noble.orbiter.v1.EventPayloadSubmitted") + proto.RegisterType((*EventPayloadRemoved)(nil), "noble.orbiter.v1.EventPayloadRemoved") +} + func init() { proto.RegisterFile("noble/orbiter/v1/tx.proto", fileDescriptor_4f89c0e5a76b9120) } var fileDescriptor_4f89c0e5a76b9120 = []byte{ - // 156 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcb, 0x4f, 0xca, - 0x49, 0xd5, 0xcf, 0x2f, 0x4a, 0xca, 0x2c, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0x4b, 0xe9, 0x41, 0xa5, 0xf4, 0xca, 0x0c, 0xa5, - 0xc4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0x41, 0x2a, 0x73, 0x8b, 0xd3, - 0x21, 0x4a, 0x8d, 0x78, 0xb8, 0x98, 0x7d, 0x8b, 0xd3, 0xa5, 0x58, 0x1b, 0x9e, 0x6f, 0xd0, 0x62, - 0x74, 0xb2, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, - 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xd5, 0xf4, 0xcc, - 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xb0, 0xe9, 0xba, 0x89, 0xc5, 0xc5, 0xa9, - 0x25, 0xc5, 0x70, 0xfb, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xa6, 0x1a, 0x03, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x4d, 0xa8, 0x52, 0x16, 0x9d, 0x00, 0x00, 0x00, + // 425 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x31, 0x6f, 0xd4, 0x30, + 0x14, 0x8e, 0x29, 0x14, 0x9d, 0x01, 0xa9, 0x98, 0x22, 0xd2, 0x0c, 0xa1, 0x04, 0x21, 0x95, 0x48, + 0x75, 0x48, 0x91, 0x18, 0x58, 0x10, 0x87, 0x18, 0x2b, 0xa1, 0x74, 0x63, 0xa9, 0x92, 0x8b, 0xe5, + 0x8b, 0x54, 0xc7, 0x91, 0x9f, 0x1b, 0xd1, 0x0d, 0x31, 0x32, 0xc1, 0xbf, 0xe8, 0x78, 0x03, 0x3f, + 0xa2, 0xe3, 0x89, 0x89, 0x09, 0xa1, 0xbb, 0xe1, 0xfe, 0x06, 0x8a, 0xe3, 0xdc, 0x71, 0xe1, 0x04, + 0x8b, 0xe5, 0xf7, 0xbe, 0xef, 0xf9, 0x7d, 0xfe, 0xde, 0xc3, 0x7b, 0xa5, 0xcc, 0xce, 0x58, 0x24, + 0x55, 0x56, 0x68, 0xa6, 0xa2, 0x3a, 0x8e, 0xf4, 0x07, 0x5a, 0x29, 0xa9, 0x25, 0xd9, 0x31, 0x10, + 0xb5, 0x10, 0xad, 0x63, 0xef, 0x6e, 0x2a, 0x8a, 0x52, 0x46, 0xe6, 0x6c, 0x49, 0xde, 0x83, 0x91, + 0x04, 0x21, 0x21, 0x12, 0xc0, 0x9b, 0x62, 0x01, 0xdc, 0x02, 0x7b, 0x2d, 0x70, 0x6a, 0xa2, 0xa8, + 0x0d, 0x2c, 0xb4, 0xcb, 0x25, 0x97, 0x6d, 0xbe, 0xb9, 0xd9, 0xec, 0xe3, 0x75, 0x25, 0x23, 0xa9, + 0x58, 0xf3, 0x62, 0xd7, 0xde, 0x90, 0x82, 0xaf, 0x08, 0xef, 0x1c, 0x03, 0x3f, 0x39, 0xcf, 0x44, + 0xa1, 0xdf, 0xa5, 0x17, 0x67, 0x32, 0xcd, 0xc9, 0x33, 0xbc, 0x0d, 0x05, 0x2f, 0x99, 0x72, 0xd1, + 0x3e, 0x3a, 0x18, 0x0c, 0xdd, 0xef, 0xdf, 0x0e, 0x77, 0x6d, 0xc7, 0xd7, 0x79, 0xae, 0x18, 0xc0, + 0x89, 0x56, 0x45, 0xc9, 0x13, 0xcb, 0x23, 0x2e, 0xbe, 0x59, 0xb5, 0xc5, 0xee, 0xb5, 0xa6, 0x24, + 0xe9, 0xc2, 0x97, 0xf1, 0xa7, 0xc5, 0x24, 0xb4, 0xb4, 0xcf, 0x8b, 0x49, 0xf8, 0xe8, 0x2f, 0x7f, + 0xfa, 0xed, 0x03, 0x8a, 0xdd, 0x7e, 0x2e, 0x61, 0x50, 0xc9, 0x12, 0x18, 0x21, 0xf8, 0xfa, 0x38, + 0x85, 0xb1, 0x11, 0x76, 0x3b, 0x31, 0xf7, 0xe0, 0x12, 0xe1, 0xfb, 0x6f, 0x6b, 0x56, 0x76, 0xe4, + 0xb6, 0x52, 0xb3, 0x7c, 0x13, 0x9b, 0xbc, 0xc0, 0x03, 0xb0, 0x04, 0xd5, 0x8a, 0xfd, 0xc7, 0xff, + 0x56, 0x54, 0xf2, 0x66, 0xf5, 0xc5, 0xad, 0x7d, 0x74, 0x70, 0xeb, 0xc8, 0xa7, 0xeb, 0xf3, 0x6c, + 0x0c, 0xa6, 0x75, 0x4c, 0xad, 0x8a, 0xe1, 0xe0, 0xea, 0xe7, 0x43, 0xe7, 0x72, 0x31, 0x09, 0xd1, + 0xd2, 0x8d, 0xe0, 0x29, 0xbe, 0xf7, 0xa7, 0xd2, 0x84, 0x09, 0x59, 0x6f, 0xd6, 0x79, 0x24, 0xf0, + 0xd6, 0x31, 0x70, 0x72, 0x8a, 0xef, 0xac, 0x0f, 0x27, 0xa0, 0xfd, 0x35, 0xa2, 0x7d, 0xb7, 0xbc, + 0xf0, 0xff, 0x9c, 0xce, 0x51, 0xef, 0xc6, 0xc7, 0x46, 0xe2, 0xf0, 0xd5, 0xd5, 0xcc, 0x47, 0xd3, + 0x99, 0x8f, 0x7e, 0xcd, 0x7c, 0xf4, 0x65, 0xee, 0x3b, 0xd3, 0xb9, 0xef, 0xfc, 0x98, 0xfb, 0xce, + 0xfb, 0x27, 0xbc, 0xd0, 0xe3, 0xf3, 0x8c, 0x8e, 0xa4, 0x88, 0xcc, 0xb3, 0x87, 0x29, 0x00, 0xd3, + 0xb0, 0x9c, 0xa1, 0xbe, 0xa8, 0x18, 0x64, 0xdb, 0x66, 0xa1, 0x9e, 0xff, 0x0e, 0x00, 0x00, 0xff, + 0xff, 0x23, 0x59, 0x71, 0xc3, 0x01, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -52,6 +298,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // SubmitPayload is the entrypoint to insert a new pending payload + // into the dispatching queue. + SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) } type msgClient struct { @@ -62,23 +311,801 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) { + out := new(MsgSubmitPayloadResponse) + err := c.cc.Invoke(ctx, "/noble.orbiter.v1.Msg/SubmitPayload", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + // SubmitPayload is the entrypoint to insert a new pending payload + // into the dispatching queue. + SubmitPayload(context.Context, *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) SubmitPayload(ctx context.Context, req *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitPayload not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_SubmitPayload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitPayload) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitPayload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/noble.orbiter.v1.Msg/SubmitPayload", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitPayload(ctx, req.(*MsgSubmitPayload)) + } + return interceptor(ctx, in, info, handler) +} + var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "noble.orbiter.v1.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "noble/orbiter/v1/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "SubmitPayload", + Handler: _Msg_SubmitPayload_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "noble/orbiter/v1/tx.proto", +} + +func (m *MsgSubmitPayload) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitPayload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintTx(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitPayloadResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitPayloadResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitPayloadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventPayloadSubmitted) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventPayloadSubmitted) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPayloadSubmitted) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) + i-- + dAtA[i] = 0x12 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventPayloadRemoved) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } + +func (m *EventPayloadRemoved) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPayloadRemoved) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSubmitPayload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitPayloadResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *EventPayloadSubmitted) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Payload.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *EventPayloadRemoved) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSubmitPayload) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitPayload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitPayload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitPayloadResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitPayloadResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitPayloadResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPayloadSubmitted) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPayloadSubmitted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPayloadSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Submitter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPayloadRemoved) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPayloadRemoved: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPayloadRemoved: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From 3a1bad995624eaca58356b24f26b6f5c64334f03 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Wed, 8 Oct 2025 16:53:34 +0200 Subject: [PATCH 02/29] add payload handling logic and server implementations --- keeper/keeper.go | 42 +++- keeper/msg_server.go | 58 +++++ keeper/msg_server_test.go | 101 ++++++++ keeper/payload_handler.go | 197 ++++++++++++++++ keeper/payload_handler_test.go | 414 +++++++++++++++++++++++++++++++++ keeper/query_server.go | 57 +++++ keeper/query_server_test.go | 96 ++++++++ types/core/errors.go | 2 + types/core/keys.go | 14 ++ types/core/payload.go | 46 ++++ types/expected_keepers.go | 10 + 11 files changed, 1029 insertions(+), 8 deletions(-) create mode 100644 keeper/msg_server.go create mode 100644 keeper/msg_server_test.go create mode 100644 keeper/payload_handler.go create mode 100644 keeper/payload_handler_test.go create mode 100644 keeper/query_server.go create mode 100644 keeper/query_server_test.go create mode 100644 types/core/payload.go diff --git a/keeper/keeper.go b/keeper/keeper.go index d4d4a6f6..70f0258a 100644 --- a/keeper/keeper.go +++ b/keeper/keeper.go @@ -36,11 +36,16 @@ import ( dispatchercomp "github.com/noble-assets/orbiter/keeper/component/dispatcher" executorcomp "github.com/noble-assets/orbiter/keeper/component/executor" forwardercomp "github.com/noble-assets/orbiter/keeper/component/forwarder" - "github.com/noble-assets/orbiter/types" + orbitertypes "github.com/noble-assets/orbiter/types" "github.com/noble-assets/orbiter/types/core" ) -var _ types.Authorizer = &Keeper{} +var ( + _ orbitertypes.Authorizer = &Keeper{} + _ orbitertypes.MsgServer = &Keeper{} + _ orbitertypes.QueryServer = &Keeper{} + _ orbitertypes.PendingPayloadsHandler = &Keeper{} +) // Keeper is the main module keeper. type Keeper struct { @@ -56,6 +61,14 @@ type Keeper struct { forwarder *forwardercomp.Forwarder dispatcher *dispatchercomp.Dispatcher adapter *adaptercomp.Adapter + + // pendingPayloads stores the pending payloads addressed by their keccak256 hash. + pendingPayloads collections.Map[[]byte, core.PendingPayload] + // PendingPayloadsSequence is the unique identifier of a given pending payload handled by the + // orbiter. + // + // TODO: this is only exported to be able to set the sequence in tests -- make private again? + PendingPayloadsSequence collections.Sequence } // NewKeeper returns a reference to a validated instance of the keeper. @@ -67,7 +80,7 @@ func NewKeeper( eventService event.Service, storeService store.KVStoreService, authority string, - bankKeeper types.BankKeeper, + bankKeeper orbitertypes.BankKeeper, ) *Keeper { if err := validateKeeperInputs(cdc, addressCdc, logger, eventService, storeService, bankKeeper, authority); err != nil { panic(err) @@ -80,6 +93,19 @@ func NewKeeper( eventService: eventService, logger: logger.With("module", fmt.Sprintf("x/%s", core.ModuleName)), authority: authority, + + PendingPayloadsSequence: collections.NewSequence( + sb, + core.PendingPayloadsSequencePrefix, + core.PendingPayloadsSequenceName, + ), + pendingPayloads: collections.NewMap[[]byte, core.PendingPayload]( + sb, + core.PendingPayloadsPrefix, + core.PendingPayloadsName, + collections.BytesKey, + codec.CollValue[core.PendingPayload](cdc), + ), } if err := k.setComponents(k.cdc, k.logger, k.eventService, sb, bankKeeper); err != nil { @@ -105,7 +131,7 @@ func validateKeeperInputs( logger log.Logger, eventService event.Service, storeService store.KVStoreService, - bankKeeper types.BankKeeper, + bankKeeper orbitertypes.BankKeeper, authority string, ) error { if cdc == nil { @@ -177,7 +203,7 @@ func (k *Keeper) Adapter() *adaptercomp.Adapter { return k.adapter } -func (k *Keeper) SetForwardingControllers(controllers ...types.ForwardingController) { +func (k *Keeper) SetForwardingControllers(controllers ...orbitertypes.ForwardingController) { router := k.forwarder.Router() for _, c := range controllers { if err := router.AddRoute(c); err != nil { @@ -189,7 +215,7 @@ func (k *Keeper) SetForwardingControllers(controllers ...types.ForwardingControl } } -func (k *Keeper) SetActionControllers(controllers ...types.ActionController) { +func (k *Keeper) SetActionControllers(controllers ...orbitertypes.ActionController) { router := k.executor.Router() for _, c := range controllers { if err := router.AddRoute(c); err != nil { @@ -201,7 +227,7 @@ func (k *Keeper) SetActionControllers(controllers ...types.ActionController) { } } -func (k *Keeper) SetAdapterControllers(controllers ...types.AdapterController) { +func (k *Keeper) SetAdapterControllers(controllers ...orbitertypes.AdapterController) { router := k.adapter.Router() for _, c := range controllers { if err := router.AddRoute(c); err != nil { @@ -229,7 +255,7 @@ func (k *Keeper) setComponents( logger log.Logger, eventService event.Service, sb *collections.SchemaBuilder, - bankKeeper types.BankKeeper, + bankKeeper orbitertypes.BankKeeper, ) error { executor, err := executorcomp.New(cdc, sb, logger, eventService) if err != nil { diff --git a/keeper/msg_server.go b/keeper/msg_server.go new file mode 100644 index 00000000..7a7ef4e5 --- /dev/null +++ b/keeper/msg_server.go @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper + +import ( + "context" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/core" +) + +var _ orbitertypes.MsgServer = &Keeper{} + +func (k *Keeper) SubmitPayload( + ctx context.Context, + req *orbitertypes.MsgSubmitPayload, +) (*orbitertypes.MsgSubmitPayloadResponse, error) { + var payload core.Payload + if err := orbitertypes.UnmarshalJSON(k.cdc, []byte(req.Payload), &payload); err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error()) + } + + if err := (&payload).Validate(); err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error()) + } + + payloadHash, err := k.AcceptPayload( + ctx, + &payload, + ) + if err != nil { + return nil, core.ErrSubmitPayload.Wrap(err.Error()) + } + + return &orbitertypes.MsgSubmitPayloadResponse{ + Hash: payloadHash, + }, nil +} diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go new file mode 100644 index 00000000..0b0d9c90 --- /dev/null +++ b/keeper/msg_server_test.go @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper_test + +import ( + "context" + "testing" + + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + + orbiterkeeper "github.com/noble-assets/orbiter/keeper" + mockorbiter "github.com/noble-assets/orbiter/testutil/mocks/orbiter" + orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/core" +) + +func TestSubmitPayload(t *testing.T) { + seq := uint64(0) + validPayload := createTestPendingPayloadWithSequence(t, seq) + + expHash, err := validPayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + testcases := []struct { + name string + setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) + payload *core.Payload + errContains string + expHash string + }{ + { + name: "success - valid payload", + payload: validPayload.Payload, + expHash: expHash.String(), + }, + { + name: "error - invalid (empty) payload", + payload: &core.Payload{}, + errContains: "forwarding is not set: invalid nil pointer", + }, + { + name: "error - hash already set", + setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { + t.Helper() + + preSeq, err := k.PendingPayloadsSequence.Peek(ctx) + require.NoError(t, err, "failed to get current payloads sequence") + + _, err = k.AcceptPayload(ctx, validPayload.Payload) + require.NoError(t, err, "failed to accept payload") + + // NOTE: we're resetting the nonce here to get the exact same hash bytes + require.NoError(t, k.PendingPayloadsSequence.Set(ctx, preSeq)) + }, + payload: validPayload.Payload, + errContains: core.ErrSubmitPayload.Error(), + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + ctx, _, k := mockorbiter.OrbiterKeeper(t) + + if tc.setup != nil { + tc.setup(t, ctx, k) + } + + payloadJSON, err := orbitertypes.MarshalJSON(k.Codec(), tc.payload) + require.NoError(t, err, "failed to marshal payload") + + res, err := k.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Payload: string(payloadJSON), + }) + if tc.errContains == "" { + require.NoError(t, err, "failed to accept payload") + require.Equal(t, tc.expHash, ethcommon.BytesToHash(res.Hash).String()) + } else { + require.ErrorContains(t, err, tc.errContains, "expected different error") + } + }) + } +} diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go new file mode 100644 index 00000000..acb49e61 --- /dev/null +++ b/keeper/payload_handler.go @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper + +import ( + "context" + "encoding/hex" + "errors" + "fmt" + + ethcommon "github.com/ethereum/go-ethereum/common" + + errorsmod "cosmossdk.io/errors" + + orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/core" +) + +var _ orbitertypes.PendingPayloadsHandler = &Keeper{} + +// AcceptPayload adds a new pending payload into the module storage. +// If the payload's hash is already set, an error is returned. +func (k *Keeper) AcceptPayload( + ctx context.Context, + payload *core.Payload, +) ([]byte, error) { + if err := payload.Validate(); err != nil { + return nil, errorsmod.Wrap(err, "invalid payload") + } + + if err := k.validatePayloadAgainstState(ctx, payload); err != nil { + return nil, errorsmod.Wrap(err, "payload failed stateful checks") + } + + next, err := k.PendingPayloadsSequence.Next(ctx) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to get next sequence number") + } + + pendingPayload := core.PendingPayload{ + Sequence: next, + Payload: payload, + } + + hash, err := pendingPayload.Keccak256Hash() + if err != nil { + return nil, err + } + + hashBz := hash.Bytes() + + found, err := k.pendingPayloads.Has(ctx, hashBz) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to check pending payloads") + } + + if found { + k.Logger().Error("payload hash already registered", "hash", hash.String()) + + return nil, errors.New("payload hash already registered") + } + + k.Logger().Debug("payload registered", "hash", hash.String(), "payload", payload.String()) + + if err = k.pendingPayloads.Set(ctx, hashBz, pendingPayload); err != nil { + return nil, errorsmod.Wrap(err, "failed to set pending payload") + } + + if err = k.eventService.EventManager(ctx).Emit( + ctx, + &orbitertypes.EventPayloadSubmitted{ + Hash: hashBz, + Payload: *payload, + }, + ); err != nil { + return nil, errorsmod.Wrap(err, "failed to emit payload submitted event") + } + + return hashBz, nil +} + +// validatePayloadAgainstState checks if the payload is valid with respect +// to the current state of the chain. +// This asserts that no actions or forwarding configurations contained in the payload +// are paused. +func (k *Keeper) validatePayloadAgainstState( + ctx context.Context, + payload *core.Payload, +) error { + for _, action := range payload.PreActions { + paused, err := k.executor.IsActionPaused(ctx, action.ID()) + if err != nil { + return errorsmod.Wrap(err, "failed to check if action is paused") + } + + if paused { + return fmt.Errorf("action %s is paused", action.ID()) + } + } + + paused, err := k.forwarder.IsProtocolPaused(ctx, payload.Forwarding.ProtocolId) + if err != nil { + return errorsmod.Wrap(err, "failed to check if forwarder is paused") + } + + if paused { + return fmt.Errorf("protocol %s is paused", payload.Forwarding.ProtocolId) + } + + cachedAttrs, err := payload.Forwarding.CachedAttributes() + if err != nil { + return err + } + + paused, err = k.forwarder.IsCrossChainPaused(ctx, core.CrossChainID{ + ProtocolId: payload.Forwarding.ProtocolId, + CounterpartyId: cachedAttrs.CounterpartyID(), + }) + if err != nil { + return errorsmod.Wrap(err, "failed to check if cross-chain paused") + } + + if paused { + return fmt.Errorf("cross-chain paused") + } + + return nil +} + +// PendingPayload returns the pending payload with the given hash +// if it is found in the module storage. +func (k *Keeper) PendingPayload( + ctx context.Context, + hash []byte, +) (*core.PendingPayload, error) { + payload, err := k.pendingPayloads.Get(ctx, hash) + if err != nil { + return nil, errorsmod.Wrap(err, "pending payload not found") + } + + k.Logger().Debug( + "retrieved pending payload", + "hash", hex.EncodeToString(hash), + "payload", payload.String(), + ) + + return &payload, nil +} + +// RemovePendingPayload removes the pending payload from the module state. +// If a payload is not found, it is a no-op but does not return an error. +func (k *Keeper) RemovePendingPayload( + ctx context.Context, + hash []byte, +) error { + found, err := k.pendingPayloads.Has(ctx, hash) + if err != nil { + return errorsmod.Wrap(err, "failed to check pending payloads") + } + + if !found { + return fmt.Errorf("payload with hash %s not found", ethcommon.BytesToHash(hash).Hex()) + } + + if err = k.pendingPayloads.Remove(ctx, hash); err != nil { + return core.ErrRemovePayload.Wrap(err.Error()) + } + + k.Logger().Debug("removed pending payload", "hash", hex.EncodeToString(hash)) + + if err = k.eventService.EventManager(ctx).Emit( + ctx, + &orbitertypes.EventPayloadRemoved{Hash: hash}, + ); err != nil { + return errorsmod.Wrap(err, "failed to emit remove pending payload event") + } + + return nil +} diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go new file mode 100644 index 00000000..4e5caf08 --- /dev/null +++ b/keeper/payload_handler_test.go @@ -0,0 +1,414 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper_test + +import ( + "context" + "fmt" + "strings" + "testing" + + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/require" + + orbiterkeeper "github.com/noble-assets/orbiter/keeper" + "github.com/noble-assets/orbiter/testutil" + mockorbiter "github.com/noble-assets/orbiter/testutil/mocks/orbiter" + orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/controller/action" + "github.com/noble-assets/orbiter/types/controller/forwarding" + "github.com/noble-assets/orbiter/types/core" +) + +func TestAcceptPayload(t *testing.T) { + seq := uint64(0) + destDomain := uint32(1) + recipient := testutil.RandomBytes(32) + validPayload := createTestPendingPayloadWithSequence(t, seq) + + expHash, err := validPayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + testcases := []struct { + name string + setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) + payload func() *core.PendingPayload + errContains string + expHash string + }{ + { + name: "success - valid payload", + payload: func() *core.PendingPayload { return validPayload }, + expHash: expHash.String(), + }, + { + name: "error - payload already registered", + setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { + t.Helper() + + _, err := k.AcceptPayload(ctx, validPayload.Payload) + require.NoError(t, err, "failed to accept payload during setup") + + // NOTE: we're resetting the pending payloads sequence to generate the same hash for + // the next submission + err = k.PendingPayloadsSequence.Set(ctx, seq) + require.NoError(t, err, "failed to set pending payloads sequence") + }, + payload: func() *core.PendingPayload { return validPayload }, + errContains: "already registered", + }, + { + name: "error - payload contains paused action", + setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { + t.Helper() + + err := k.Executor().Pause(ctx, core.ACTION_FEE) + require.NoError(t, err, "failed to pause fee action") + }, + payload: func() *core.PendingPayload { + p := *validPayload + + preAction, err := core.NewAction(core.ACTION_FEE, &action.FeeAttributes{}) + require.NoError(t, err, "failed to construct fee action") + + p.Payload.PreActions = append( + p.Payload.PreActions, + preAction, + ) + + return &p + }, + errContains: "action ACTION_FEE is paused", + }, + { + name: "error - payload contains paused protocol", + setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { + t.Helper() + + err := k.Forwarder().Pause(ctx, core.PROTOCOL_CCTP, nil) + require.NoError(t, err, "failed to unpause fee action") + }, + payload: func() *core.PendingPayload { + p := *validPayload + + fw, err := forwarding.NewCCTPForwarding(destDomain, recipient, nil, nil) + require.NoError(t, err, "failed to construct forwarding") + + p.Payload.Forwarding = fw + + return &p + }, + errContains: "protocol PROTOCOL_CCTP is paused", + }, + { + name: "error - payload contains paused cross-chain", + setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { + t.Helper() + + cID := (&forwarding.CCTPAttributes{ + DestinationDomain: destDomain, + MintRecipient: recipient, + }).CounterpartyID() + + err = k.Forwarder().Pause(ctx, core.PROTOCOL_CCTP, []string{cID}) + require.NoError(t, err, "failed to unpause cross-chain forwarding") + }, + payload: func() *core.PendingPayload { + p := *validPayload + + fw, err := forwarding.NewCCTPForwarding(destDomain, recipient, nil, nil) + require.NoError(t, err, "failed to construct forwarding") + + p.Payload.Forwarding = fw + + return &p + }, + errContains: "cross-chain paused", + }, + { + name: "error - invalid (empty) payload", + payload: func() *core.PendingPayload { + return &core.PendingPayload{Payload: &core.Payload{}} + }, + errContains: "forwarding is not set: invalid nil pointer", + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + ctx, _, k := mockorbiter.OrbiterKeeper(t) + + if tc.setup != nil { + tc.setup(t, ctx, k) + } + + pendingPayload := tc.payload() + + gotHash, err := k.AcceptPayload(ctx, pendingPayload.Payload) + if tc.errContains == "" { + require.NoError(t, err, "failed to accept payload") + + // ASSERT: expected hash returned + require.Equal(t, tc.expHash, ethcommon.BytesToHash(gotHash).String()) + + // ASSERT: expected event emitted + events := ctx.EventManager().Events() + require.Len(t, events, 1, "expected 1 event, got %d", len(events)) + + found := false + for _, e := range events { + if strings.Contains(e.Type, "EventPayloadSubmitted") { + require.False(t, found, "expected event to be emitted just once") + found = true + } + } + require.True(t, found, "expected event payload submitted to be found") + } else { + require.ErrorContains(t, err, tc.errContains, "expected different error") + } + }) + } +} + +func TestGetPendingPayloadWithHash(t *testing.T) { + t.Parallel() + + validPayload := createTestPendingPayloadWithSequence(t, 0) + expHash, err := validPayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + testcases := []struct { + name string + setup func(*testing.T, context.Context, orbitertypes.PendingPayloadsHandler) + hash []byte + expPayload *core.PendingPayload + errContains string + }{ + { + name: "success - hash found", + setup: func(t *testing.T, ctx context.Context, handler orbitertypes.PendingPayloadsHandler) { + t.Helper() + + _, err := handler.AcceptPayload(ctx, validPayload.Payload) + require.NoError(t, err) + }, + expPayload: validPayload, + hash: expHash.Bytes(), + }, + { + name: "error - hash not found", + setup: nil, + expPayload: validPayload, + errContains: "pending payload not found", + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + ctx, _, k := mockorbiter.OrbiterKeeper(t) + + if tc.setup != nil { + tc.setup(t, ctx, k) + } + + got, err := k.PendingPayload(ctx, tc.hash) + + if tc.errContains == "" { + require.NoError(t, err, "failed to get pending payload") + require.Equal(t, tc.expPayload.String(), got.String(), "expected different payload") + } else { + require.ErrorContains(t, err, tc.errContains, "expected different error") + } + }) + } +} + +func TestRemovePayload(t *testing.T) { + t.Parallel() + + validPayload := createTestPendingPayloadWithSequence(t, 0) + expHash, err := validPayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + testcases := []struct { + name string + setup func(*testing.T, context.Context, orbitertypes.PendingPayloadsHandler) + hash []byte + errContains string + }{ + { + name: "success - valid payload", + setup: func(t *testing.T, ctx context.Context, handler orbitertypes.PendingPayloadsHandler) { + t.Helper() + _, err := handler.AcceptPayload(ctx, validPayload.Payload) + require.NoError(t, err, "failed to setup testcase; accepting payload") + + gotPayload, err := handler.PendingPayload(ctx, expHash.Bytes()) + require.NoError(t, err, "error getting pending payload") + require.Equal( + t, + validPayload.String(), + gotPayload.String(), + "expected different payload", + ) + }, + hash: expHash.Bytes(), + }, + { + name: "error - valid payload but not found in store", + setup: nil, + hash: expHash.Bytes(), + errContains: fmt.Sprintf("payload with hash %s not found", expHash.Hex()), + }, + { + name: "error - nil hash", + setup: nil, + hash: nil, + errContains: fmt.Sprintf("payload with hash %s not found", ethcommon.Hash{}.Hex()), + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + ctx, _, k := mockorbiter.OrbiterKeeper(t) + + if tc.setup != nil { + tc.setup(t, ctx, k) + } + + err = k.RemovePendingPayload(ctx, tc.hash) + if tc.errContains == "" { + require.NoError(t, err, "failed to remove payload") + + // ASSERT: value with hash was removed. + gotPayload, err := k.PendingPayload(ctx, tc.hash) + require.Error(t, err, "payload should not be present anymore") + require.Nil(t, gotPayload, "expected nil payload") + + // ASSERT: event was emitted. + found := false + for _, event := range ctx.EventManager().ABCIEvents() { + if strings.Contains(event.Type, "EventPayloadRemoved") { + require.False(t, found, "event should only be emitted once") + + found = true + } + } + require.True(t, found, "expected event to be emitted") + } else { + require.ErrorContains(t, err, tc.errContains, "expected different error") + } + }) + } +} + +// TestSubsequentSubmissions asserts that two subsequently submitted +// identical orbiter payloads generate different hashes so that they can +// be uniquely identified. +func TestSubsequentSubmissions(t *testing.T) { + ctx, _, k := mockorbiter.OrbiterKeeper(t) + + validPayload := createTestPendingPayloadWithSequence(t, 0) + expHash, err := validPayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + validPayloadJSON, err := orbitertypes.MarshalJSON(k.Codec(), validPayload.Payload) + require.NoError(t, err, "failed to marshal payload into json") + + // ACT: submit first payload + res, err := k.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Signer: testutil.NewNobleAddress(), + Payload: string(validPayloadJSON), + }) + require.NoError(t, err, "failed to submit payload") + + // ASSERT: expected hash is returned + gotHash := ethcommon.BytesToHash(res.Hash) + require.Equal(t, expHash.String(), gotHash.String(), "expected different hash") + + // ACT: submit identical payload again + res2, err := k.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Signer: testutil.NewNobleAddress(), + Payload: string(validPayloadJSON), + }) + require.NoError(t, err, "failed to submit payload") + + validPayload.Sequence = uint64(1) + expHash2, err := validPayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + // ASSERT: expected hash is returned + gotHash2 := ethcommon.BytesToHash(res2.Hash) + require.Equal(t, expHash2.String(), gotHash2.String(), "expected different hash") + + // ASSERT: hashes of subsequent submissions of the same payload are different + require.NotEqual(t, gotHash.String(), gotHash2.String(), "expected different hashes") +} + +func TestDifferentSequenceGeneratesDifferentHash(t *testing.T) { + // ACT: Generate pending payload with sequence 1 + seq := uint64(1) + validForwarding := createTestPendingPayloadWithSequence(t, seq) + expHash, err := validForwarding.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + // ACT: Generate pending payload with sequence 2 + validForwarding2 := createTestPendingPayloadWithSequence(t, seq+1) + expHash2, err := validForwarding2.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + // ASSERT: hash 1 and hash 2 are NOT equal + require.NotEqual(t, expHash.String(), expHash2.String(), "expected different hash") +} + +// createTestPendingPayloadWithSequence creates a new example payload that can be submitted +// to the state handler. +func createTestPendingPayloadWithSequence( + t *testing.T, + sequence uint64, +) *core.PendingPayload { + t.Helper() + + recipient := make([]byte, 32) + copy(recipient[32-3:], []byte{1, 2, 3}) + + validForwarding, err := forwarding.NewCCTPForwarding( + 0, + recipient, + recipient, + nil, + ) + require.NoError(t, err, "failed to create valid forwarding") + + validPayload := &core.Payload{ + PreActions: nil, + Forwarding: validForwarding, + } + + return &core.PendingPayload{ + Sequence: sequence, + Payload: validPayload, + } +} diff --git a/keeper/query_server.go b/keeper/query_server.go new file mode 100644 index 00000000..9f2a0a69 --- /dev/null +++ b/keeper/query_server.go @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper + +import ( + "context" + + ethcommon "github.com/ethereum/go-ethereum/common" + + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/types/query" + + orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/core" +) + +var _ orbitertypes.QueryServer = &Keeper{} + +func (k *Keeper) PendingPayloads( + ctx context.Context, + req *orbitertypes.QueryPendingPayloadsRequest, +) (*orbitertypes.QueryPendingPayloadsResponse, error) { + hashes, pageRes, err := query.CollectionPaginate( + ctx, + k.pendingPayloads, + req.Pagination, + func(hash []byte, _ core.PendingPayload) (string, error) { + return ethcommon.BytesToHash(hash).Hex(), nil + }, + ) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to paginate pending payloads") + } + + return &orbitertypes.QueryPendingPayloadsResponse{ + Hashes: hashes, + Pagination: pageRes, + }, nil +} diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go new file mode 100644 index 00000000..870cbcc8 --- /dev/null +++ b/keeper/query_server_test.go @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/types/query" + + "github.com/noble-assets/orbiter/testutil/mocks/orbiter" + orbitertypes "github.com/noble-assets/orbiter/types" +) + +func TestPendingPayloads(t *testing.T) { + examplePayload := createTestPendingPayloadWithSequence(t, 0).Payload + + testcases := []struct { + name string + nPayloads int + pagination *query.PageRequest + expLen int + }{ + { + name: "success - no hashes stored", + nPayloads: 0, + expLen: 0, + }, + { + name: "success - 1 hashes stored", + nPayloads: 1, + expLen: 1, + }, + { + name: "success - 5 hashes stored", + nPayloads: 5, + expLen: 5, + }, + { + name: "success - 5 hashes stored with 2 pagination", + nPayloads: 5, + pagination: &query.PageRequest{Offset: 1, Limit: 2}, + expLen: 2, + }, + { + name: "success - 5 hashes stored with offset out of range so no results returned", + nPayloads: 5, + pagination: &query.PageRequest{Offset: 6, Limit: 2}, + expLen: 0, + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + ctx, _, k := orbiter.OrbiterKeeper(t) + + for range tc.nPayloads { + _, err := k.AcceptPayload(ctx, examplePayload) + require.NoError(t, err, "failed to setup payloads") + } + + res, err := k.PendingPayloads( + ctx, + &orbitertypes.QueryPendingPayloadsRequest{ + Pagination: tc.pagination, + }, + ) + require.NoError(t, err, "failed to query pending payloads") + require.Equal( + t, + tc.expLen, + len(res.Hashes), + "expected different number of hashes returned", + ) + }) + } +} diff --git a/types/core/errors.go b/types/core/errors.go index f4679851..b1049d2d 100644 --- a/types/core/errors.go +++ b/types/core/errors.go @@ -33,4 +33,6 @@ var ( ErrUnableToPause = errorsmod.Register(ModuleName, 8, "unable to pause") ErrUnableToUnpause = errorsmod.Register(ModuleName, 9, "unable to unpause") ErrAlreadySet = errorsmod.Register(ModuleName, 10, "value already set") + ErrSubmitPayload = errorsmod.Register(ModuleName, 11, "payload submission failed") + ErrRemovePayload = errorsmod.Register(ModuleName, 12, "payload removal failed") ) diff --git a/types/core/keys.go b/types/core/keys.go index 54a1d366..404d7ce4 100644 --- a/types/core/keys.go +++ b/types/core/keys.go @@ -114,3 +114,17 @@ const ( var OrbiterPrefix = ModuleName var AdapterParamsPrefix = collections.NewPrefix(40) + +// ==================================================================================================== +// Keeper +// ====================================================================================================. + +const ( + PendingPayloadsName = "pending_payloads" + PendingPayloadsSequenceName = "pending_payloads_sequence" +) + +var ( + PendingPayloadsPrefix = collections.NewPrefix(50) + PendingPayloadsSequencePrefix = collections.NewPrefix(51) +) diff --git a/types/core/payload.go b/types/core/payload.go new file mode 100644 index 00000000..32ec4d1c --- /dev/null +++ b/types/core/payload.go @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package core + +import ( + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" +) + +// Keccak256Hash returns the keccak 256 hash of the payload contents. +// To guarantee uniqueness the sequence number is included. +func (p *PendingPayload) Keccak256Hash() (common.Hash, error) { + bz, err := p.Marshal() + if err != nil { + return common.Hash{}, err + } + + return crypto.Keccak256Hash(bz), nil +} + +// Validate checks that the pending payload contents are valid. +func (p *PendingPayload) Validate() error { + if p == nil { + return ErrNilPointer.Wrap("pending payload") + } + + return p.Payload.Validate() +} diff --git a/types/expected_keepers.go b/types/expected_keepers.go index 331792a2..65041fc4 100644 --- a/types/expected_keepers.go +++ b/types/expected_keepers.go @@ -24,6 +24,8 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/noble-assets/orbiter/types/core" ) // BankKeeper wraps the bank behaviors expected by the orbiter @@ -52,3 +54,11 @@ type BankKeeperAdapter interface { amt sdk.Coins, ) error } + +// PendingPayloadsHandler defines the interface to adjust and query the Orbiter module +// state as it relates to the bookkeeping of pending payloads. +type PendingPayloadsHandler interface { + AcceptPayload(ctx context.Context, payload *core.Payload) ([]byte, error) + RemovePendingPayload(ctx context.Context, hash []byte) error + PendingPayload(ctx context.Context, hash []byte) (*core.PendingPayload, error) +} From 1461bc111b23804d9693c94b715bdab50ddf6a00 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Wed, 8 Oct 2025 17:22:30 +0200 Subject: [PATCH 03/29] register servers and codec --- keeper/servers_registration.go | 7 +++++++ types/codec.go | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/keeper/servers_registration.go b/keeper/servers_registration.go index 328790a9..f361fe81 100644 --- a/keeper/servers_registration.go +++ b/keeper/servers_registration.go @@ -27,6 +27,7 @@ import ( "github.com/noble-assets/orbiter/keeper/component/dispatcher" "github.com/noble-assets/orbiter/keeper/component/executor" "github.com/noble-assets/orbiter/keeper/component/forwarder" + orbitertypes "github.com/noble-assets/orbiter/types" adaptertypes "github.com/noble-assets/orbiter/types/component/adapter" dispatchertypes "github.com/noble-assets/orbiter/types/component/dispatcher" executortypes "github.com/noble-assets/orbiter/types/component/executor" @@ -37,6 +38,9 @@ import ( // (Forwarder, Executor, and Adapter) with the module configurator. func RegisterMsgServers(cfg module.Configurator, k *Keeper) { ms := cfg.MsgServer() + + orbitertypes.RegisterMsgServer(ms, k) + forwardertypes.RegisterMsgServer(ms, forwarder.NewMsgServer(k.forwarder, k)) executortypes.RegisterMsgServer(ms, executor.NewMsgServer(k.executor, k)) adaptertypes.RegisterMsgServer(ms, adapter.NewMsgServer(k.adapter, k)) @@ -46,6 +50,9 @@ func RegisterMsgServers(cfg module.Configurator, k *Keeper) { // with the module configurator. func RegisterQueryServers(cfg module.Configurator, k *Keeper) { qs := cfg.QueryServer() + + orbitertypes.RegisterQueryServer(qs, k) + forwardertypes.RegisterQueryServer(qs, forwarder.NewQueryServer(k.forwarder)) executortypes.RegisterQueryServer(qs, executor.NewQueryServer(k.executor)) adaptertypes.RegisterQueryServer(qs, adapter.NewQueryServer(k.adapter)) diff --git a/types/codec.go b/types/codec.go index efb05be7..89c71519 100644 --- a/types/codec.go +++ b/types/codec.go @@ -23,6 +23,7 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" "github.com/noble-assets/orbiter/types/component" @@ -48,6 +49,11 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*core.ActionAttributes)(nil), ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSubmitPayload{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) component.RegisterInterfaces(registry) From cb39e1b99587a9dd78b31d3d08be60e5115995d1 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Wed, 8 Oct 2025 17:53:53 +0200 Subject: [PATCH 04/29] add cli wiring --- autocli.go | 27 +++++++++++++++++++++++++++ types/autocli.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 types/autocli.go diff --git a/autocli.go b/autocli.go index 3e2efd1e..462ac619 100644 --- a/autocli.go +++ b/autocli.go @@ -28,6 +28,7 @@ import ( "github.com/noble-assets/orbiter/keeper/component/dispatcher" "github.com/noble-assets/orbiter/keeper/component/executor" "github.com/noble-assets/orbiter/keeper/component/forwarder" + orbitertypes "github.com/noble-assets/orbiter/types" adaptertypes "github.com/noble-assets/orbiter/types/component/adapter" dispatchertypes "github.com/noble-assets/orbiter/types/component/dispatcher" executortypes "github.com/noble-assets/orbiter/types/component/executor" @@ -38,6 +39,14 @@ func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Tx: &autocliv1.ServiceCommandDescriptor{ Service: orbiterv1.Msg_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + // NOTE: we're manually moving this to the `payload` sub command for better + // navigation + RpcMethod: "SubmitPayload", + Skip: true, + }, + }, SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{ "executor": { Service: executortypes.Msg_serviceDesc.ServiceName, @@ -57,10 +66,23 @@ func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{}, RpcCommandOptions: adapter.TxCommandOptions(), }, + "payload": { + Service: orbitertypes.Msg_serviceDesc.ServiceName, + Short: "Payload management commands", + RpcCommandOptions: orbitertypes.TxCommandOptions(), + }, }, }, Query: &autocliv1.ServiceCommandDescriptor{ Service: orbiterv1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + // NOTE: we're manually moving this to the `payload` sub command for better + // navigation + RpcMethod: "PendingPayloads", + Skip: true, + }, + }, SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{ "adapter": { Service: adaptertypes.Query_serviceDesc.ServiceName, @@ -86,6 +108,11 @@ func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{}, RpcCommandOptions: forwarder.QueryCommandOptions(), }, + "payload": { + Service: orbitertypes.Query_serviceDesc.ServiceName, + Short: "Payload management commands", + RpcCommandOptions: orbitertypes.QueryCommandOptions(), + }, }, }, } diff --git a/types/autocli.go b/types/autocli.go new file mode 100644 index 00000000..8095b7cd --- /dev/null +++ b/types/autocli.go @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package types + +import autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + +func TxCommandOptions() []*autocliv1.RpcCommandOptions { + return []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "SubmitPayload", + Use: "submit [payload]", + Short: "Submit a payload to be handled by the orbiter", + Long: `Submit a payload to be handled by the orbiter.`, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{ + {ProtoField: "payload"}, + }, + }, + } +} + +func QueryCommandOptions() []*autocliv1.RpcCommandOptions { + return []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "PendingPayloads", + Use: "pending", + Short: "Query pending payloads", + }, + } +} From a7e0db2366ad2693628c1093052be003b97372dc Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Wed, 8 Oct 2025 23:35:06 +0200 Subject: [PATCH 05/29] address review comment --- keeper/payload_handler_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index 4e5caf08..63932cf4 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -298,7 +298,7 @@ func TestRemovePayload(t *testing.T) { tc.setup(t, ctx, k) } - err = k.RemovePendingPayload(ctx, tc.hash) + err := k.RemovePendingPayload(ctx, tc.hash) if tc.errContains == "" { require.NoError(t, err, "failed to remove payload") From 9a3b61195f45638c1ea026648b34cbece904562e Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Wed, 8 Oct 2025 23:38:01 +0200 Subject: [PATCH 06/29] validate payload before returning hash --- types/core/payload.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/core/payload.go b/types/core/payload.go index 32ec4d1c..b644133c 100644 --- a/types/core/payload.go +++ b/types/core/payload.go @@ -28,6 +28,10 @@ import ( // Keccak256Hash returns the keccak 256 hash of the payload contents. // To guarantee uniqueness the sequence number is included. func (p *PendingPayload) Keccak256Hash() (common.Hash, error) { + if err := p.Validate(); err != nil { + return common.Hash{}, err + } + bz, err := p.Marshal() if err != nil { return common.Hash{}, err From b740d801aa54bf29f44f83eb2685f4d38d1b2c6f Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 14:35:08 +0200 Subject: [PATCH 07/29] align query and msg server implementations --- keeper/msg_server.go | 18 ++++++++++++++---- keeper/msg_server_test.go | 3 ++- keeper/payload_handler_test.go | 5 +++-- keeper/query_server.go | 14 +++++++++++--- keeper/query_server_test.go | 4 +++- keeper/servers_registration.go | 4 ++-- 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/keeper/msg_server.go b/keeper/msg_server.go index 7a7ef4e5..e7fc4cbd 100644 --- a/keeper/msg_server.go +++ b/keeper/msg_server.go @@ -29,14 +29,24 @@ import ( "github.com/noble-assets/orbiter/types/core" ) -var _ orbitertypes.MsgServer = &Keeper{} +var _ orbitertypes.MsgServer = &msgServer{} -func (k *Keeper) SubmitPayload( +// msgServer is the main message handler for the Orbiter. +type msgServer struct { + *Keeper +} + +// NewMsgServer returns a new Orbiter message server. +func NewMsgServer(keeper *Keeper) orbitertypes.MsgServer { + return &msgServer{keeper} +} + +func (s *msgServer) SubmitPayload( ctx context.Context, req *orbitertypes.MsgSubmitPayload, ) (*orbitertypes.MsgSubmitPayloadResponse, error) { var payload core.Payload - if err := orbitertypes.UnmarshalJSON(k.cdc, []byte(req.Payload), &payload); err != nil { + if err := orbitertypes.UnmarshalJSON(s.cdc, []byte(req.Payload), &payload); err != nil { return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error()) } @@ -44,7 +54,7 @@ func (k *Keeper) SubmitPayload( return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error()) } - payloadHash, err := k.AcceptPayload( + payloadHash, err := s.AcceptPayload( ctx, &payload, ) diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go index 0b0d9c90..a22ef17d 100644 --- a/keeper/msg_server_test.go +++ b/keeper/msg_server_test.go @@ -79,6 +79,7 @@ func TestSubmitPayload(t *testing.T) { for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { ctx, _, k := mockorbiter.OrbiterKeeper(t) + ms := orbiterkeeper.NewMsgServer(k) if tc.setup != nil { tc.setup(t, ctx, k) @@ -87,7 +88,7 @@ func TestSubmitPayload(t *testing.T) { payloadJSON, err := orbitertypes.MarshalJSON(k.Codec(), tc.payload) require.NoError(t, err, "failed to marshal payload") - res, err := k.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ Payload: string(payloadJSON), }) if tc.errContains == "" { diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index 63932cf4..ef44e06d 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -329,6 +329,7 @@ func TestRemovePayload(t *testing.T) { // be uniquely identified. func TestSubsequentSubmissions(t *testing.T) { ctx, _, k := mockorbiter.OrbiterKeeper(t) + ms := orbiterkeeper.NewMsgServer(k) validPayload := createTestPendingPayloadWithSequence(t, 0) expHash, err := validPayload.Keccak256Hash() @@ -338,7 +339,7 @@ func TestSubsequentSubmissions(t *testing.T) { require.NoError(t, err, "failed to marshal payload into json") // ACT: submit first payload - res, err := k.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ Signer: testutil.NewNobleAddress(), Payload: string(validPayloadJSON), }) @@ -349,7 +350,7 @@ func TestSubsequentSubmissions(t *testing.T) { require.Equal(t, expHash.String(), gotHash.String(), "expected different hash") // ACT: submit identical payload again - res2, err := k.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + res2, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ Signer: testutil.NewNobleAddress(), Payload: string(validPayloadJSON), }) diff --git a/keeper/query_server.go b/keeper/query_server.go index 9f2a0a69..aef0eb67 100644 --- a/keeper/query_server.go +++ b/keeper/query_server.go @@ -32,15 +32,23 @@ import ( "github.com/noble-assets/orbiter/types/core" ) -var _ orbitertypes.QueryServer = &Keeper{} +var _ orbitertypes.QueryServer = &queryServer{} -func (k *Keeper) PendingPayloads( +type queryServer struct { + *Keeper +} + +func NewQueryServer(k *Keeper) orbitertypes.QueryServer { + return &queryServer{k} +} + +func (s *queryServer) PendingPayloads( ctx context.Context, req *orbitertypes.QueryPendingPayloadsRequest, ) (*orbitertypes.QueryPendingPayloadsResponse, error) { hashes, pageRes, err := query.CollectionPaginate( ctx, - k.pendingPayloads, + s.pendingPayloads, req.Pagination, func(hash []byte, _ core.PendingPayload) (string, error) { return ethcommon.BytesToHash(hash).Hex(), nil diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index 870cbcc8..c9b90c5f 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -27,6 +27,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" + orbiterkeeper "github.com/noble-assets/orbiter/keeper" "github.com/noble-assets/orbiter/testutil/mocks/orbiter" orbitertypes "github.com/noble-assets/orbiter/types" ) @@ -72,13 +73,14 @@ func TestPendingPayloads(t *testing.T) { for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { ctx, _, k := orbiter.OrbiterKeeper(t) + ms := orbiterkeeper.NewQueryServer(k) for range tc.nPayloads { _, err := k.AcceptPayload(ctx, examplePayload) require.NoError(t, err, "failed to setup payloads") } - res, err := k.PendingPayloads( + res, err := ms.PendingPayloads( ctx, &orbitertypes.QueryPendingPayloadsRequest{ Pagination: tc.pagination, diff --git a/keeper/servers_registration.go b/keeper/servers_registration.go index f361fe81..6fb182eb 100644 --- a/keeper/servers_registration.go +++ b/keeper/servers_registration.go @@ -39,7 +39,7 @@ import ( func RegisterMsgServers(cfg module.Configurator, k *Keeper) { ms := cfg.MsgServer() - orbitertypes.RegisterMsgServer(ms, k) + orbitertypes.RegisterMsgServer(ms, NewMsgServer(k)) forwardertypes.RegisterMsgServer(ms, forwarder.NewMsgServer(k.forwarder, k)) executortypes.RegisterMsgServer(ms, executor.NewMsgServer(k.executor, k)) @@ -51,7 +51,7 @@ func RegisterMsgServers(cfg module.Configurator, k *Keeper) { func RegisterQueryServers(cfg module.Configurator, k *Keeper) { qs := cfg.QueryServer() - orbitertypes.RegisterQueryServer(qs, k) + orbitertypes.RegisterQueryServer(qs, NewQueryServer(k)) forwardertypes.RegisterQueryServer(qs, forwarder.NewQueryServer(k.forwarder)) executortypes.RegisterQueryServer(qs, executor.NewQueryServer(k.executor)) From c29954d6af5ce5f559c49da83d88f50083270b98 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 14:35:20 +0200 Subject: [PATCH 08/29] adjust instantiation order in keeper --- keeper/keeper.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/keeper/keeper.go b/keeper/keeper.go index 70f0258a..10e80481 100644 --- a/keeper/keeper.go +++ b/keeper/keeper.go @@ -42,8 +42,6 @@ import ( var ( _ orbitertypes.Authorizer = &Keeper{} - _ orbitertypes.MsgServer = &Keeper{} - _ orbitertypes.QueryServer = &Keeper{} _ orbitertypes.PendingPayloadsHandler = &Keeper{} ) @@ -94,11 +92,6 @@ func NewKeeper( logger: logger.With("module", fmt.Sprintf("x/%s", core.ModuleName)), authority: authority, - PendingPayloadsSequence: collections.NewSequence( - sb, - core.PendingPayloadsSequencePrefix, - core.PendingPayloadsSequenceName, - ), pendingPayloads: collections.NewMap[[]byte, core.PendingPayload]( sb, core.PendingPayloadsPrefix, @@ -106,6 +99,11 @@ func NewKeeper( collections.BytesKey, codec.CollValue[core.PendingPayload](cdc), ), + PendingPayloadsSequence: collections.NewSequence( + sb, + core.PendingPayloadsSequencePrefix, + core.PendingPayloadsSequenceName, + ), } if err := k.setComponents(k.cdc, k.logger, k.eventService, sb, bankKeeper); err != nil { From dc25b946dc0f4728cf6365596fe5ddc1d4e7eb5a Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 15:50:11 +0200 Subject: [PATCH 09/29] move handler interface out of expected_keepers.go --- types/expected_keepers.go | 10 ---------- types/interfaces.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 types/interfaces.go diff --git a/types/expected_keepers.go b/types/expected_keepers.go index 65041fc4..331792a2 100644 --- a/types/expected_keepers.go +++ b/types/expected_keepers.go @@ -24,8 +24,6 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/noble-assets/orbiter/types/core" ) // BankKeeper wraps the bank behaviors expected by the orbiter @@ -54,11 +52,3 @@ type BankKeeperAdapter interface { amt sdk.Coins, ) error } - -// PendingPayloadsHandler defines the interface to adjust and query the Orbiter module -// state as it relates to the bookkeeping of pending payloads. -type PendingPayloadsHandler interface { - AcceptPayload(ctx context.Context, payload *core.Payload) ([]byte, error) - RemovePendingPayload(ctx context.Context, hash []byte) error - PendingPayload(ctx context.Context, hash []byte) (*core.PendingPayload, error) -} diff --git a/types/interfaces.go b/types/interfaces.go new file mode 100644 index 00000000..67806247 --- /dev/null +++ b/types/interfaces.go @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package types + +import ( + "context" + + "github.com/noble-assets/orbiter/types/core" +) + +// PendingPayloadsHandler defines the interface to adjust and query the Orbiter module +// state as it relates to the bookkeeping of pending payloads. +type PendingPayloadsHandler interface { + Submit(ctx context.Context, payload *core.Payload) ([]byte, error) + RemovePendingPayload(ctx context.Context, hash []byte) error + PendingPayload(ctx context.Context, hash []byte) (*core.PendingPayload, error) +} From 2e0a283a1607d04dc9003ac3cac5cf2d8fe63d3a Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 15:54:56 +0200 Subject: [PATCH 10/29] rename AcceptPayload to Submit --- keeper/msg_server.go | 2 +- keeper/msg_server_test.go | 2 +- keeper/payload_handler.go | 4 ++-- keeper/payload_handler_test.go | 8 ++++---- keeper/query_server_test.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/keeper/msg_server.go b/keeper/msg_server.go index e7fc4cbd..ad02dc82 100644 --- a/keeper/msg_server.go +++ b/keeper/msg_server.go @@ -54,7 +54,7 @@ func (s *msgServer) SubmitPayload( return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error()) } - payloadHash, err := s.AcceptPayload( + payloadHash, err := s.Submit( ctx, &payload, ) diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go index a22ef17d..db4830db 100644 --- a/keeper/msg_server_test.go +++ b/keeper/msg_server_test.go @@ -65,7 +65,7 @@ func TestSubmitPayload(t *testing.T) { preSeq, err := k.PendingPayloadsSequence.Peek(ctx) require.NoError(t, err, "failed to get current payloads sequence") - _, err = k.AcceptPayload(ctx, validPayload.Payload) + _, err = k.Submit(ctx, validPayload.Payload) require.NoError(t, err, "failed to accept payload") // NOTE: we're resetting the nonce here to get the exact same hash bytes diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go index acb49e61..957f1d58 100644 --- a/keeper/payload_handler.go +++ b/keeper/payload_handler.go @@ -36,9 +36,9 @@ import ( var _ orbitertypes.PendingPayloadsHandler = &Keeper{} -// AcceptPayload adds a new pending payload into the module storage. +// Submit adds a new pending payload into the module storage. // If the payload's hash is already set, an error is returned. -func (k *Keeper) AcceptPayload( +func (k *Keeper) Submit( ctx context.Context, payload *core.Payload, ) ([]byte, error) { diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index ef44e06d..e4a01b18 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -64,7 +64,7 @@ func TestAcceptPayload(t *testing.T) { setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { t.Helper() - _, err := k.AcceptPayload(ctx, validPayload.Payload) + _, err := k.Submit(ctx, validPayload.Payload) require.NoError(t, err, "failed to accept payload during setup") // NOTE: we're resetting the pending payloads sequence to generate the same hash for @@ -162,7 +162,7 @@ func TestAcceptPayload(t *testing.T) { pendingPayload := tc.payload() - gotHash, err := k.AcceptPayload(ctx, pendingPayload.Payload) + gotHash, err := k.Submit(ctx, pendingPayload.Payload) if tc.errContains == "" { require.NoError(t, err, "failed to accept payload") @@ -207,7 +207,7 @@ func TestGetPendingPayloadWithHash(t *testing.T) { setup: func(t *testing.T, ctx context.Context, handler orbitertypes.PendingPayloadsHandler) { t.Helper() - _, err := handler.AcceptPayload(ctx, validPayload.Payload) + _, err := handler.Submit(ctx, validPayload.Payload) require.NoError(t, err) }, expPayload: validPayload, @@ -260,7 +260,7 @@ func TestRemovePayload(t *testing.T) { name: "success - valid payload", setup: func(t *testing.T, ctx context.Context, handler orbitertypes.PendingPayloadsHandler) { t.Helper() - _, err := handler.AcceptPayload(ctx, validPayload.Payload) + _, err := handler.Submit(ctx, validPayload.Payload) require.NoError(t, err, "failed to setup testcase; accepting payload") gotPayload, err := handler.PendingPayload(ctx, expHash.Bytes()) diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index c9b90c5f..b4524b2d 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -76,7 +76,7 @@ func TestPendingPayloads(t *testing.T) { ms := orbiterkeeper.NewQueryServer(k) for range tc.nPayloads { - _, err := k.AcceptPayload(ctx, examplePayload) + _, err := k.Submit(ctx, examplePayload) require.NoError(t, err, "failed to setup payloads") } From ee367f4e2431c90d9cd96bd20893cc8ee56d8669 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 16:00:53 +0200 Subject: [PATCH 11/29] add more info to long cli description --- types/autocli.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/autocli.go b/types/autocli.go index 8095b7cd..7eb1bf18 100644 --- a/types/autocli.go +++ b/types/autocli.go @@ -28,7 +28,10 @@ func TxCommandOptions() []*autocliv1.RpcCommandOptions { RpcMethod: "SubmitPayload", Use: "submit [payload]", Short: "Submit a payload to be handled by the orbiter", - Long: `Submit a payload to be handled by the orbiter.`, + Long: `Depending on the cross-chain technology, ` + + `it is required to submit the Orbiter payload directly to the Noble chain ` + + `and then referencing the resulting hash in the bridge transaction. ` + + `This command submits a given payload to be forwarded.`, PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "payload"}, }, From 951dc78b35806eb8df83c96badfbcf12c744475e Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 16:17:49 +0200 Subject: [PATCH 12/29] move events proto definition to events.proto --- api/v1/events.pulsar.go | 1228 +++++++++++++++++++++++++++ api/v1/tx.pulsar.go | 1210 +------------------------- proto/noble/orbiter/v1/events.proto | 29 + proto/noble/orbiter/v1/tx.proto | 21 - types/events.pb.go | 612 +++++++++++++ types/tx.pb.go | 505 +---------- 6 files changed, 1932 insertions(+), 1673 deletions(-) create mode 100644 api/v1/events.pulsar.go create mode 100644 proto/noble/orbiter/v1/events.proto create mode 100644 types/events.pb.go diff --git a/api/v1/events.pulsar.go b/api/v1/events.pulsar.go new file mode 100644 index 00000000..b41d8fb1 --- /dev/null +++ b/api/v1/events.pulsar.go @@ -0,0 +1,1228 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package orbiterv1 + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + v1 "github.com/noble-assets/orbiter/api/core/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_EventPayloadSubmitted protoreflect.MessageDescriptor + fd_EventPayloadSubmitted_hash protoreflect.FieldDescriptor + fd_EventPayloadSubmitted_submitter protoreflect.FieldDescriptor + fd_EventPayloadSubmitted_payload protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_events_proto_init() + md_EventPayloadSubmitted = File_noble_orbiter_v1_events_proto.Messages().ByName("EventPayloadSubmitted") + fd_EventPayloadSubmitted_hash = md_EventPayloadSubmitted.Fields().ByName("hash") + fd_EventPayloadSubmitted_submitter = md_EventPayloadSubmitted.Fields().ByName("submitter") + fd_EventPayloadSubmitted_payload = md_EventPayloadSubmitted.Fields().ByName("payload") +} + +var _ protoreflect.Message = (*fastReflection_EventPayloadSubmitted)(nil) + +type fastReflection_EventPayloadSubmitted EventPayloadSubmitted + +func (x *EventPayloadSubmitted) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventPayloadSubmitted)(x) +} + +func (x *EventPayloadSubmitted) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_events_proto_msgTypes[0] + 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) +} + +var _fastReflection_EventPayloadSubmitted_messageType fastReflection_EventPayloadSubmitted_messageType +var _ protoreflect.MessageType = fastReflection_EventPayloadSubmitted_messageType{} + +type fastReflection_EventPayloadSubmitted_messageType struct{} + +func (x fastReflection_EventPayloadSubmitted_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventPayloadSubmitted)(nil) +} +func (x fastReflection_EventPayloadSubmitted_messageType) New() protoreflect.Message { + return new(fastReflection_EventPayloadSubmitted) +} +func (x fastReflection_EventPayloadSubmitted_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventPayloadSubmitted +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventPayloadSubmitted) Descriptor() protoreflect.MessageDescriptor { + return md_EventPayloadSubmitted +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventPayloadSubmitted) Type() protoreflect.MessageType { + return _fastReflection_EventPayloadSubmitted_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventPayloadSubmitted) New() protoreflect.Message { + return new(fastReflection_EventPayloadSubmitted) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventPayloadSubmitted) Interface() protoreflect.ProtoMessage { + return (*EventPayloadSubmitted)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventPayloadSubmitted) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Hash) != 0 { + value := protoreflect.ValueOfBytes(x.Hash) + if !f(fd_EventPayloadSubmitted_hash, value) { + return + } + } + if x.Submitter != "" { + value := protoreflect.ValueOfString(x.Submitter) + if !f(fd_EventPayloadSubmitted_submitter, value) { + return + } + } + if x.Payload != nil { + value := protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) + if !f(fd_EventPayloadSubmitted_payload, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventPayloadSubmitted) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + return len(x.Hash) != 0 + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + return x.Submitter != "" + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + return x.Payload != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadSubmitted) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + x.Hash = nil + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + x.Submitter = "" + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + x.Payload = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventPayloadSubmitted) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + value := x.Hash + return protoreflect.ValueOfBytes(value) + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + value := x.Submitter + return protoreflect.ValueOfString(value) + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + value := x.Payload + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadSubmitted) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + x.Hash = value.Bytes() + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + x.Submitter = value.Interface().(string) + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + x.Payload = value.Message().Interface().(*v1.Payload) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadSubmitted) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + if x.Payload == nil { + x.Payload = new(v1.Payload) + } + return protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + panic(fmt.Errorf("field hash of message noble.orbiter.v1.EventPayloadSubmitted is not mutable")) + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + panic(fmt.Errorf("field submitter of message noble.orbiter.v1.EventPayloadSubmitted is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventPayloadSubmitted) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadSubmitted.hash": + return protoreflect.ValueOfBytes(nil) + case "noble.orbiter.v1.EventPayloadSubmitted.submitter": + return protoreflect.ValueOfString("") + case "noble.orbiter.v1.EventPayloadSubmitted.payload": + m := new(v1.Payload) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventPayloadSubmitted) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.EventPayloadSubmitted", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventPayloadSubmitted) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadSubmitted) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventPayloadSubmitted) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventPayloadSubmitted) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventPayloadSubmitted) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Hash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Submitter) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Payload != nil { + l = options.Size(x.Payload) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventPayloadSubmitted) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Payload != nil { + encoded, err := options.Marshal(x.Payload) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Submitter) > 0 { + i -= len(x.Submitter) + copy(dAtA[i:], x.Submitter) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Submitter))) + i-- + dAtA[i] = 0x12 + } + if len(x.Hash) > 0 { + i -= len(x.Hash) + copy(dAtA[i:], x.Hash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventPayloadSubmitted) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadSubmitted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) + if x.Hash == nil { + x.Hash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Submitter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Payload == nil { + x.Payload = &v1.Payload{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Payload); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EventPayloadRemoved protoreflect.MessageDescriptor + fd_EventPayloadRemoved_hash protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_events_proto_init() + md_EventPayloadRemoved = File_noble_orbiter_v1_events_proto.Messages().ByName("EventPayloadRemoved") + fd_EventPayloadRemoved_hash = md_EventPayloadRemoved.Fields().ByName("hash") +} + +var _ protoreflect.Message = (*fastReflection_EventPayloadRemoved)(nil) + +type fastReflection_EventPayloadRemoved EventPayloadRemoved + +func (x *EventPayloadRemoved) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventPayloadRemoved)(x) +} + +func (x *EventPayloadRemoved) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_events_proto_msgTypes[1] + 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) +} + +var _fastReflection_EventPayloadRemoved_messageType fastReflection_EventPayloadRemoved_messageType +var _ protoreflect.MessageType = fastReflection_EventPayloadRemoved_messageType{} + +type fastReflection_EventPayloadRemoved_messageType struct{} + +func (x fastReflection_EventPayloadRemoved_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventPayloadRemoved)(nil) +} +func (x fastReflection_EventPayloadRemoved_messageType) New() protoreflect.Message { + return new(fastReflection_EventPayloadRemoved) +} +func (x fastReflection_EventPayloadRemoved_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventPayloadRemoved +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventPayloadRemoved) Descriptor() protoreflect.MessageDescriptor { + return md_EventPayloadRemoved +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EventPayloadRemoved) Type() protoreflect.MessageType { + return _fastReflection_EventPayloadRemoved_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventPayloadRemoved) New() protoreflect.Message { + return new(fastReflection_EventPayloadRemoved) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventPayloadRemoved) Interface() protoreflect.ProtoMessage { + return (*EventPayloadRemoved)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EventPayloadRemoved) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Hash) != 0 { + value := protoreflect.ValueOfBytes(x.Hash) + if !f(fd_EventPayloadRemoved_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EventPayloadRemoved) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + return len(x.Hash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadRemoved) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + x.Hash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EventPayloadRemoved) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + value := x.Hash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadRemoved) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + x.Hash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadRemoved) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + panic(fmt.Errorf("field hash of message noble.orbiter.v1.EventPayloadRemoved is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EventPayloadRemoved) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.EventPayloadRemoved.hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) + } + panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EventPayloadRemoved) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.EventPayloadRemoved", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EventPayloadRemoved) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EventPayloadRemoved) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EventPayloadRemoved) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EventPayloadRemoved) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventPayloadRemoved) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Hash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EventPayloadRemoved) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Hash) > 0 { + i -= len(x.Hash) + copy(dAtA[i:], x.Hash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EventPayloadRemoved) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadRemoved: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadRemoved: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) + if x.Hash == nil { + x.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: noble/orbiter/v1/events.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// EventPayloadSubmitted is emitted after successful submission of a payload. +type EventPayloadSubmitted struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The keccak256 hash of the now pending payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // The address that has submitted the payload. + Submitter string `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` + // The submitted payload. + Payload *v1.Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *EventPayloadSubmitted) Reset() { + *x = EventPayloadSubmitted{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_events_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventPayloadSubmitted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventPayloadSubmitted) ProtoMessage() {} + +// Deprecated: Use EventPayloadSubmitted.ProtoReflect.Descriptor instead. +func (*EventPayloadSubmitted) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_events_proto_rawDescGZIP(), []int{0} +} + +func (x *EventPayloadSubmitted) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +func (x *EventPayloadSubmitted) GetSubmitter() string { + if x != nil { + return x.Submitter + } + return "" +} + +func (x *EventPayloadSubmitted) GetPayload() *v1.Payload { + if x != nil { + return x.Payload + } + return nil +} + +// EventPayloadRemoved is emitted after removing a pending payload from the queue. +type EventPayloadRemoved struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The keccak256 hash of the removed payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (x *EventPayloadRemoved) Reset() { + *x = EventPayloadRemoved{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_events_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventPayloadRemoved) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventPayloadRemoved) ProtoMessage() {} + +// Deprecated: Use EventPayloadRemoved.ProtoReflect.Descriptor instead. +func (*EventPayloadRemoved) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_events_proto_rawDescGZIP(), []int{1} +} + +func (x *EventPayloadRemoved) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +var File_noble_orbiter_v1_events_proto protoreflect.FileDescriptor + +var file_noble_orbiter_v1_events_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, + 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x10, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, + 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x01, 0x0a, 0x15, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x36, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6d, + 0x69, 0x74, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, + 0x12, 0x43, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, + 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x29, 0x0a, 0x13, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, + 0x42, 0xc5, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, + 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, + 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, + 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x6f, + 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x58, 0xaa, 0x02, + 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, + 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_noble_orbiter_v1_events_proto_rawDescOnce sync.Once + file_noble_orbiter_v1_events_proto_rawDescData = file_noble_orbiter_v1_events_proto_rawDesc +) + +func file_noble_orbiter_v1_events_proto_rawDescGZIP() []byte { + file_noble_orbiter_v1_events_proto_rawDescOnce.Do(func() { + file_noble_orbiter_v1_events_proto_rawDescData = protoimpl.X.CompressGZIP(file_noble_orbiter_v1_events_proto_rawDescData) + }) + return file_noble_orbiter_v1_events_proto_rawDescData +} + +var file_noble_orbiter_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_noble_orbiter_v1_events_proto_goTypes = []interface{}{ + (*EventPayloadSubmitted)(nil), // 0: noble.orbiter.v1.EventPayloadSubmitted + (*EventPayloadRemoved)(nil), // 1: noble.orbiter.v1.EventPayloadRemoved + (*v1.Payload)(nil), // 2: noble.orbiter.core.v1.Payload +} +var file_noble_orbiter_v1_events_proto_depIdxs = []int32{ + 2, // 0: noble.orbiter.v1.EventPayloadSubmitted.payload:type_name -> noble.orbiter.core.v1.Payload + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_noble_orbiter_v1_events_proto_init() } +func file_noble_orbiter_v1_events_proto_init() { + if File_noble_orbiter_v1_events_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_noble_orbiter_v1_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventPayloadSubmitted); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_noble_orbiter_v1_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventPayloadRemoved); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_noble_orbiter_v1_events_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_noble_orbiter_v1_events_proto_goTypes, + DependencyIndexes: file_noble_orbiter_v1_events_proto_depIdxs, + MessageInfos: file_noble_orbiter_v1_events_proto_msgTypes, + }.Build() + File_noble_orbiter_v1_events_proto = out.File + file_noble_orbiter_v1_events_proto_rawDesc = nil + file_noble_orbiter_v1_events_proto_goTypes = nil + file_noble_orbiter_v1_events_proto_depIdxs = nil +} diff --git a/api/v1/tx.pulsar.go b/api/v1/tx.pulsar.go index e7adfe43..54fba552 100644 --- a/api/v1/tx.pulsar.go +++ b/api/v1/tx.pulsar.go @@ -7,8 +7,6 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - v1 "github.com/noble-assets/orbiter/api/core/v1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -923,993 +921,6 @@ func (x *fastReflection_MsgSubmitPayloadResponse) ProtoMethods() *protoiface.Met } } -var ( - md_EventPayloadSubmitted protoreflect.MessageDescriptor - fd_EventPayloadSubmitted_hash protoreflect.FieldDescriptor - fd_EventPayloadSubmitted_submitter protoreflect.FieldDescriptor - fd_EventPayloadSubmitted_payload protoreflect.FieldDescriptor -) - -func init() { - file_noble_orbiter_v1_tx_proto_init() - md_EventPayloadSubmitted = File_noble_orbiter_v1_tx_proto.Messages().ByName("EventPayloadSubmitted") - fd_EventPayloadSubmitted_hash = md_EventPayloadSubmitted.Fields().ByName("hash") - fd_EventPayloadSubmitted_submitter = md_EventPayloadSubmitted.Fields().ByName("submitter") - fd_EventPayloadSubmitted_payload = md_EventPayloadSubmitted.Fields().ByName("payload") -} - -var _ protoreflect.Message = (*fastReflection_EventPayloadSubmitted)(nil) - -type fastReflection_EventPayloadSubmitted EventPayloadSubmitted - -func (x *EventPayloadSubmitted) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventPayloadSubmitted)(x) -} - -func (x *EventPayloadSubmitted) slowProtoReflect() protoreflect.Message { - mi := &file_noble_orbiter_v1_tx_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_EventPayloadSubmitted_messageType fastReflection_EventPayloadSubmitted_messageType -var _ protoreflect.MessageType = fastReflection_EventPayloadSubmitted_messageType{} - -type fastReflection_EventPayloadSubmitted_messageType struct{} - -func (x fastReflection_EventPayloadSubmitted_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventPayloadSubmitted)(nil) -} -func (x fastReflection_EventPayloadSubmitted_messageType) New() protoreflect.Message { - return new(fastReflection_EventPayloadSubmitted) -} -func (x fastReflection_EventPayloadSubmitted_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventPayloadSubmitted -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_EventPayloadSubmitted) Descriptor() protoreflect.MessageDescriptor { - return md_EventPayloadSubmitted -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_EventPayloadSubmitted) Type() protoreflect.MessageType { - return _fastReflection_EventPayloadSubmitted_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventPayloadSubmitted) New() protoreflect.Message { - return new(fastReflection_EventPayloadSubmitted) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_EventPayloadSubmitted) Interface() protoreflect.ProtoMessage { - return (*EventPayloadSubmitted)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_EventPayloadSubmitted) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Hash) != 0 { - value := protoreflect.ValueOfBytes(x.Hash) - if !f(fd_EventPayloadSubmitted_hash, value) { - return - } - } - if x.Submitter != "" { - value := protoreflect.ValueOfString(x.Submitter) - if !f(fd_EventPayloadSubmitted_submitter, value) { - return - } - } - if x.Payload != nil { - value := protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) - if !f(fd_EventPayloadSubmitted_payload, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_EventPayloadSubmitted) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - return len(x.Hash) != 0 - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - return x.Submitter != "" - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - return x.Payload != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadSubmitted) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - x.Hash = nil - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - x.Submitter = "" - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - x.Payload = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_EventPayloadSubmitted) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - value := x.Hash - return protoreflect.ValueOfBytes(value) - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - value := x.Submitter - return protoreflect.ValueOfString(value) - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - value := x.Payload - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadSubmitted) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - x.Hash = value.Bytes() - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - x.Submitter = value.Interface().(string) - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - x.Payload = value.Message().Interface().(*v1.Payload) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadSubmitted) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - if x.Payload == nil { - x.Payload = new(v1.Payload) - } - return protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - panic(fmt.Errorf("field hash of message noble.orbiter.v1.EventPayloadSubmitted is not mutable")) - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - panic(fmt.Errorf("field submitter of message noble.orbiter.v1.EventPayloadSubmitted is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_EventPayloadSubmitted) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - return protoreflect.ValueOfBytes(nil) - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - return protoreflect.ValueOfString("") - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - m := new(v1.Payload) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_EventPayloadSubmitted) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.EventPayloadSubmitted", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_EventPayloadSubmitted) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadSubmitted) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_EventPayloadSubmitted) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_EventPayloadSubmitted) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventPayloadSubmitted) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Hash) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Submitter) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Payload != nil { - l = options.Size(x.Payload) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventPayloadSubmitted) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Payload != nil { - encoded, err := options.Marshal(x.Payload) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if len(x.Submitter) > 0 { - i -= len(x.Submitter) - copy(dAtA[i:], x.Submitter) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Submitter))) - i-- - dAtA[i] = 0x12 - } - if len(x.Hash) > 0 { - i -= len(x.Hash) - copy(dAtA[i:], x.Hash) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventPayloadSubmitted) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadSubmitted: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) - if x.Hash == nil { - x.Hash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Submitter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Payload == nil { - x.Payload = &v1.Payload{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Payload); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_EventPayloadRemoved protoreflect.MessageDescriptor - fd_EventPayloadRemoved_hash protoreflect.FieldDescriptor -) - -func init() { - file_noble_orbiter_v1_tx_proto_init() - md_EventPayloadRemoved = File_noble_orbiter_v1_tx_proto.Messages().ByName("EventPayloadRemoved") - fd_EventPayloadRemoved_hash = md_EventPayloadRemoved.Fields().ByName("hash") -} - -var _ protoreflect.Message = (*fastReflection_EventPayloadRemoved)(nil) - -type fastReflection_EventPayloadRemoved EventPayloadRemoved - -func (x *EventPayloadRemoved) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventPayloadRemoved)(x) -} - -func (x *EventPayloadRemoved) slowProtoReflect() protoreflect.Message { - mi := &file_noble_orbiter_v1_tx_proto_msgTypes[3] - 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) -} - -var _fastReflection_EventPayloadRemoved_messageType fastReflection_EventPayloadRemoved_messageType -var _ protoreflect.MessageType = fastReflection_EventPayloadRemoved_messageType{} - -type fastReflection_EventPayloadRemoved_messageType struct{} - -func (x fastReflection_EventPayloadRemoved_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventPayloadRemoved)(nil) -} -func (x fastReflection_EventPayloadRemoved_messageType) New() protoreflect.Message { - return new(fastReflection_EventPayloadRemoved) -} -func (x fastReflection_EventPayloadRemoved_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventPayloadRemoved -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_EventPayloadRemoved) Descriptor() protoreflect.MessageDescriptor { - return md_EventPayloadRemoved -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_EventPayloadRemoved) Type() protoreflect.MessageType { - return _fastReflection_EventPayloadRemoved_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventPayloadRemoved) New() protoreflect.Message { - return new(fastReflection_EventPayloadRemoved) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_EventPayloadRemoved) Interface() protoreflect.ProtoMessage { - return (*EventPayloadRemoved)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_EventPayloadRemoved) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Hash) != 0 { - value := protoreflect.ValueOfBytes(x.Hash) - if !f(fd_EventPayloadRemoved_hash, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_EventPayloadRemoved) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - return len(x.Hash) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadRemoved) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - x.Hash = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_EventPayloadRemoved) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - value := x.Hash - return protoreflect.ValueOfBytes(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadRemoved) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - x.Hash = value.Bytes() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadRemoved) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - panic(fmt.Errorf("field hash of message noble.orbiter.v1.EventPayloadRemoved is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_EventPayloadRemoved) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - return protoreflect.ValueOfBytes(nil) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_EventPayloadRemoved) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.EventPayloadRemoved", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_EventPayloadRemoved) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadRemoved) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_EventPayloadRemoved) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_EventPayloadRemoved) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventPayloadRemoved) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Hash) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventPayloadRemoved) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Hash) > 0 { - i -= len(x.Hash) - copy(dAtA[i:], x.Hash) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventPayloadRemoved) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadRemoved: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadRemoved: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) - if x.Hash == nil { - x.Hash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -2009,98 +1020,6 @@ func (x *MsgSubmitPayloadResponse) GetHash() []byte { return nil } -// EventPayloadSubmitted is emitted after successful submission of a payload. -type EventPayloadSubmitted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The keccak256 hash of the now pending payload. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - // The address that has submitted the payload. - Submitter string `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` - // The submitted payload. - Payload *v1.Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` -} - -func (x *EventPayloadSubmitted) Reset() { - *x = EventPayloadSubmitted{} - if protoimpl.UnsafeEnabled { - mi := &file_noble_orbiter_v1_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventPayloadSubmitted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventPayloadSubmitted) ProtoMessage() {} - -// Deprecated: Use EventPayloadSubmitted.ProtoReflect.Descriptor instead. -func (*EventPayloadSubmitted) Descriptor() ([]byte, []int) { - return file_noble_orbiter_v1_tx_proto_rawDescGZIP(), []int{2} -} - -func (x *EventPayloadSubmitted) GetHash() []byte { - if x != nil { - return x.Hash - } - return nil -} - -func (x *EventPayloadSubmitted) GetSubmitter() string { - if x != nil { - return x.Submitter - } - return "" -} - -func (x *EventPayloadSubmitted) GetPayload() *v1.Payload { - if x != nil { - return x.Payload - } - return nil -} - -// EventPayloadRemoved is emitted after removing a pending payload from the queue. -type EventPayloadRemoved struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The keccak256 hash of the removed payload. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` -} - -func (x *EventPayloadRemoved) Reset() { - *x = EventPayloadRemoved{} - if protoimpl.UnsafeEnabled { - mi := &file_noble_orbiter_v1_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventPayloadRemoved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventPayloadRemoved) ProtoMessage() {} - -// Deprecated: Use EventPayloadRemoved.ProtoReflect.Descriptor instead. -func (*EventPayloadRemoved) Descriptor() ([]byte, []int) { - return file_noble_orbiter_v1_tx_proto_rawDescGZIP(), []int{3} -} - -func (x *EventPayloadRemoved) GetHash() []byte { - if x != nil { - return x.Hash - } - return nil -} - var File_noble_orbiter_v1_tx_proto protoreflect.FileDescriptor var file_noble_orbiter_v1_tx_proto_rawDesc = []byte{ @@ -2111,56 +1030,39 @@ var file_noble_orbiter_v1_tx_proto_rawDesc = []byte{ 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x6e, 0x6f, 0x62, 0x6c, - 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, - 0x31, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x91, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x3a, 0x31, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x8a, 0xe7, 0xb0, - 0x2a, 0x21, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, - 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x22, 0x2e, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, - 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, - 0x61, 0x73, 0x68, 0x22, 0xa8, 0x01, 0x0a, 0x15, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, - 0x68, 0x12, 0x36, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, - 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x07, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x6f, 0x62, - 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, - 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x29, - 0x0a, 0x13, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x32, 0x6d, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x5f, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x12, 0x22, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, - 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x1a, 0x2a, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, - 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc1, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, - 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, - 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, - 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, - 0x76, 0x31, 0x3b, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, - 0x4f, 0x58, 0xaa, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, - 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, - 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, - 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, - 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x91, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, + 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x69, 0x67, + 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x3a, 0x31, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, + 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x21, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x2e, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, + 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x32, 0x6d, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x5f, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x12, 0x22, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x1a, 0x2a, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, + 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc1, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, + 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, + 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, + 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, + 0x31, 0x3b, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, + 0x58, 0xaa, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, + 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, + 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, + 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -2175,23 +1077,19 @@ func file_noble_orbiter_v1_tx_proto_rawDescGZIP() []byte { return file_noble_orbiter_v1_tx_proto_rawDescData } -var file_noble_orbiter_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_noble_orbiter_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_noble_orbiter_v1_tx_proto_goTypes = []interface{}{ (*MsgSubmitPayload)(nil), // 0: noble.orbiter.v1.MsgSubmitPayload (*MsgSubmitPayloadResponse)(nil), // 1: noble.orbiter.v1.MsgSubmitPayloadResponse - (*EventPayloadSubmitted)(nil), // 2: noble.orbiter.v1.EventPayloadSubmitted - (*EventPayloadRemoved)(nil), // 3: noble.orbiter.v1.EventPayloadRemoved - (*v1.Payload)(nil), // 4: noble.orbiter.core.v1.Payload } var file_noble_orbiter_v1_tx_proto_depIdxs = []int32{ - 4, // 0: noble.orbiter.v1.EventPayloadSubmitted.payload:type_name -> noble.orbiter.core.v1.Payload - 0, // 1: noble.orbiter.v1.Msg.SubmitPayload:input_type -> noble.orbiter.v1.MsgSubmitPayload - 1, // 2: noble.orbiter.v1.Msg.SubmitPayload:output_type -> noble.orbiter.v1.MsgSubmitPayloadResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 0, // 0: noble.orbiter.v1.Msg.SubmitPayload:input_type -> noble.orbiter.v1.MsgSubmitPayload + 1, // 1: noble.orbiter.v1.Msg.SubmitPayload:output_type -> noble.orbiter.v1.MsgSubmitPayloadResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_noble_orbiter_v1_tx_proto_init() } @@ -2224,30 +1122,6 @@ func file_noble_orbiter_v1_tx_proto_init() { return nil } } - file_noble_orbiter_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventPayloadSubmitted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_noble_orbiter_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventPayloadRemoved); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2255,7 +1129,7 @@ func file_noble_orbiter_v1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_noble_orbiter_v1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 2, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/noble/orbiter/v1/events.proto b/proto/noble/orbiter/v1/events.proto new file mode 100644 index 00000000..ef4b155f --- /dev/null +++ b/proto/noble/orbiter/v1/events.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package noble.orbiter.v1; + +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "noble/orbiter/core/v1/orbiter.proto"; + +option go_package = "github.com/noble-assets/orbiter/types"; + +// EventPayloadSubmitted is emitted after successful submission of a payload. +message EventPayloadSubmitted { + // The keccak256 hash of the now pending payload. + bytes hash = 1; + // The address that has submitted the payload. + string submitter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // The submitted payload. + noble.orbiter.core.v1.Payload payload = 3 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +// EventPayloadRemoved is emitted after removing a pending payload from the queue. +message EventPayloadRemoved { + // The keccak256 hash of the removed payload. + bytes hash = 1; +} diff --git a/proto/noble/orbiter/v1/tx.proto b/proto/noble/orbiter/v1/tx.proto index e67b1755..b14a5ab5 100644 --- a/proto/noble/orbiter/v1/tx.proto +++ b/proto/noble/orbiter/v1/tx.proto @@ -5,8 +5,6 @@ package noble.orbiter.v1; import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "noble/orbiter/core/v1/orbiter.proto"; option go_package = "github.com/noble-assets/orbiter/types"; @@ -39,22 +37,3 @@ message MsgSubmitPayloadResponse { // The keccak256 hash by which to reference the submitted payload. bytes hash = 1; } - -// EventPayloadSubmitted is emitted after successful submission of a payload. -message EventPayloadSubmitted { - // The keccak256 hash of the now pending payload. - bytes hash = 1; - // The address that has submitted the payload. - string submitter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // The submitted payload. - noble.orbiter.core.v1.Payload payload = 3 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; -} - -// EventPayloadRemoved is emitted after removing a pending payload from the queue. -message EventPayloadRemoved { - // The keccak256 hash of the removed payload. - bytes hash = 1; -} diff --git a/types/events.pb.go b/types/events.pb.go new file mode 100644 index 00000000..5ddc5d5a --- /dev/null +++ b/types/events.pb.go @@ -0,0 +1,612 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: noble/orbiter/v1/events.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + core "github.com/noble-assets/orbiter/types/core" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// EventPayloadSubmitted is emitted after successful submission of a payload. +type EventPayloadSubmitted struct { + // The keccak256 hash of the now pending payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // The address that has submitted the payload. + Submitter string `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` + // The submitted payload. + Payload core.Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload"` +} + +func (m *EventPayloadSubmitted) Reset() { *m = EventPayloadSubmitted{} } +func (m *EventPayloadSubmitted) String() string { return proto.CompactTextString(m) } +func (*EventPayloadSubmitted) ProtoMessage() {} +func (*EventPayloadSubmitted) Descriptor() ([]byte, []int) { + return fileDescriptor_2255afc82d7db249, []int{0} +} +func (m *EventPayloadSubmitted) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPayloadSubmitted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPayloadSubmitted.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPayloadSubmitted) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPayloadSubmitted.Merge(m, src) +} +func (m *EventPayloadSubmitted) XXX_Size() int { + return m.Size() +} +func (m *EventPayloadSubmitted) XXX_DiscardUnknown() { + xxx_messageInfo_EventPayloadSubmitted.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPayloadSubmitted proto.InternalMessageInfo + +func (m *EventPayloadSubmitted) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func (m *EventPayloadSubmitted) GetSubmitter() string { + if m != nil { + return m.Submitter + } + return "" +} + +func (m *EventPayloadSubmitted) GetPayload() core.Payload { + if m != nil { + return m.Payload + } + return core.Payload{} +} + +// EventPayloadRemoved is emitted after removing a pending payload from the queue. +type EventPayloadRemoved struct { + // The keccak256 hash of the removed payload. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (m *EventPayloadRemoved) Reset() { *m = EventPayloadRemoved{} } +func (m *EventPayloadRemoved) String() string { return proto.CompactTextString(m) } +func (*EventPayloadRemoved) ProtoMessage() {} +func (*EventPayloadRemoved) Descriptor() ([]byte, []int) { + return fileDescriptor_2255afc82d7db249, []int{1} +} +func (m *EventPayloadRemoved) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventPayloadRemoved) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventPayloadRemoved.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventPayloadRemoved) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventPayloadRemoved.Merge(m, src) +} +func (m *EventPayloadRemoved) XXX_Size() int { + return m.Size() +} +func (m *EventPayloadRemoved) XXX_DiscardUnknown() { + xxx_messageInfo_EventPayloadRemoved.DiscardUnknown(m) +} + +var xxx_messageInfo_EventPayloadRemoved proto.InternalMessageInfo + +func (m *EventPayloadRemoved) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func init() { + proto.RegisterType((*EventPayloadSubmitted)(nil), "noble.orbiter.v1.EventPayloadSubmitted") + proto.RegisterType((*EventPayloadRemoved)(nil), "noble.orbiter.v1.EventPayloadRemoved") +} + +func init() { proto.RegisterFile("noble/orbiter/v1/events.proto", fileDescriptor_2255afc82d7db249) } + +var fileDescriptor_2255afc82d7db249 = []byte{ + // 313 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0xcb, 0x4f, 0xca, + 0x49, 0xd5, 0xcf, 0x2f, 0x4a, 0xca, 0x2c, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, + 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0x4b, 0xeb, 0x41, 0xa5, + 0xf5, 0xca, 0x0c, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, + 0x64, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0x71, 0x3c, 0x98, 0xa7, 0x0f, 0xe1, 0x40, 0xa5, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0x21, 0xe2, 0x20, 0x16, 0x54, 0x54, 0x19, 0xd5, 0xd2, 0xe4, 0xfc, 0xa2, 0x54, + 0x90, 0xcd, 0x30, 0x5b, 0xc0, 0x8a, 0x94, 0x56, 0x30, 0x72, 0x89, 0xba, 0x82, 0xdc, 0x12, 0x90, + 0x58, 0x99, 0x93, 0x9f, 0x98, 0x12, 0x5c, 0x9a, 0x94, 0x9b, 0x59, 0x52, 0x92, 0x9a, 0x22, 0x24, + 0xc4, 0xc5, 0x92, 0x91, 0x58, 0x9c, 0x21, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x13, 0x04, 0x66, 0x0b, + 0x99, 0x71, 0x71, 0x16, 0x43, 0x15, 0x14, 0x49, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x3a, 0x49, 0x5c, + 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x8d, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, + 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x90, 0x33, 0x17, 0x7b, 0x01, 0xc4, 0x7c, 0x09, 0x66, 0x05, + 0x46, 0x0d, 0x6e, 0x23, 0x39, 0x3d, 0x54, 0x2f, 0x83, 0x1c, 0xa7, 0x57, 0x66, 0xa8, 0x07, 0x75, + 0x85, 0x13, 0xe7, 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0xe9, 0x54, + 0xd2, 0xe4, 0x12, 0x46, 0x76, 0x69, 0x50, 0x6a, 0x6e, 0x7e, 0x19, 0x76, 0x77, 0x3a, 0xd9, 0x9f, + 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, + 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x6a, 0x7a, 0x66, 0x49, 0x46, 0x69, + 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xd8, 0x09, 0xba, 0x89, 0xc5, 0xc5, 0xa9, 0x25, 0xc5, 0xf0, + 0x60, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0x8e, 0x31, 0x20, 0x00, 0x00, 0xff, + 0xff, 0x86, 0xd6, 0x65, 0x2e, 0xb9, 0x01, 0x00, 0x00, +} + +func (m *EventPayloadSubmitted) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventPayloadSubmitted) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPayloadSubmitted) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Submitter))) + i-- + dAtA[i] = 0x12 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventPayloadRemoved) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventPayloadRemoved) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventPayloadRemoved) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventPayloadSubmitted) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = m.Payload.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + +func (m *EventPayloadRemoved) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventPayloadSubmitted) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPayloadSubmitted: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPayloadSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Submitter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventPayloadRemoved) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventPayloadRemoved: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventPayloadRemoved: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/types/tx.pb.go b/types/tx.pb.go index 1a45cbf8..d0615647 100644 --- a/types/tx.pb.go +++ b/types/tx.pb.go @@ -9,10 +9,8 @@ import ( _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - core "github.com/noble-assets/orbiter/types/core" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -136,154 +134,35 @@ func (m *MsgSubmitPayloadResponse) GetHash() []byte { return nil } -// EventPayloadSubmitted is emitted after successful submission of a payload. -type EventPayloadSubmitted struct { - // The keccak256 hash of the now pending payload. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - // The address that has submitted the payload. - Submitter string `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` - // The submitted payload. - Payload core.Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload"` -} - -func (m *EventPayloadSubmitted) Reset() { *m = EventPayloadSubmitted{} } -func (m *EventPayloadSubmitted) String() string { return proto.CompactTextString(m) } -func (*EventPayloadSubmitted) ProtoMessage() {} -func (*EventPayloadSubmitted) Descriptor() ([]byte, []int) { - return fileDescriptor_4f89c0e5a76b9120, []int{2} -} -func (m *EventPayloadSubmitted) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPayloadSubmitted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPayloadSubmitted.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventPayloadSubmitted) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPayloadSubmitted.Merge(m, src) -} -func (m *EventPayloadSubmitted) XXX_Size() int { - return m.Size() -} -func (m *EventPayloadSubmitted) XXX_DiscardUnknown() { - xxx_messageInfo_EventPayloadSubmitted.DiscardUnknown(m) -} - -var xxx_messageInfo_EventPayloadSubmitted proto.InternalMessageInfo - -func (m *EventPayloadSubmitted) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *EventPayloadSubmitted) GetSubmitter() string { - if m != nil { - return m.Submitter - } - return "" -} - -func (m *EventPayloadSubmitted) GetPayload() core.Payload { - if m != nil { - return m.Payload - } - return core.Payload{} -} - -// EventPayloadRemoved is emitted after removing a pending payload from the queue. -type EventPayloadRemoved struct { - // The keccak256 hash of the removed payload. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` -} - -func (m *EventPayloadRemoved) Reset() { *m = EventPayloadRemoved{} } -func (m *EventPayloadRemoved) String() string { return proto.CompactTextString(m) } -func (*EventPayloadRemoved) ProtoMessage() {} -func (*EventPayloadRemoved) Descriptor() ([]byte, []int) { - return fileDescriptor_4f89c0e5a76b9120, []int{3} -} -func (m *EventPayloadRemoved) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPayloadRemoved) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPayloadRemoved.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventPayloadRemoved) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPayloadRemoved.Merge(m, src) -} -func (m *EventPayloadRemoved) XXX_Size() int { - return m.Size() -} -func (m *EventPayloadRemoved) XXX_DiscardUnknown() { - xxx_messageInfo_EventPayloadRemoved.DiscardUnknown(m) -} - -var xxx_messageInfo_EventPayloadRemoved proto.InternalMessageInfo - -func (m *EventPayloadRemoved) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - func init() { proto.RegisterType((*MsgSubmitPayload)(nil), "noble.orbiter.v1.MsgSubmitPayload") proto.RegisterType((*MsgSubmitPayloadResponse)(nil), "noble.orbiter.v1.MsgSubmitPayloadResponse") - proto.RegisterType((*EventPayloadSubmitted)(nil), "noble.orbiter.v1.EventPayloadSubmitted") - proto.RegisterType((*EventPayloadRemoved)(nil), "noble.orbiter.v1.EventPayloadRemoved") } func init() { proto.RegisterFile("noble/orbiter/v1/tx.proto", fileDescriptor_4f89c0e5a76b9120) } var fileDescriptor_4f89c0e5a76b9120 = []byte{ - // 425 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x31, 0x6f, 0xd4, 0x30, - 0x14, 0x8e, 0x29, 0x14, 0x9d, 0x01, 0xa9, 0x98, 0x22, 0xd2, 0x0c, 0xa1, 0x04, 0x21, 0x95, 0x48, - 0x75, 0x48, 0x91, 0x18, 0x58, 0x10, 0x87, 0x18, 0x2b, 0xa1, 0x74, 0x63, 0xa9, 0x92, 0x8b, 0xe5, - 0x8b, 0x54, 0xc7, 0x91, 0x9f, 0x1b, 0xd1, 0x0d, 0x31, 0x32, 0xc1, 0xbf, 0xe8, 0x78, 0x03, 0x3f, - 0xa2, 0xe3, 0x89, 0x89, 0x09, 0xa1, 0xbb, 0xe1, 0xfe, 0x06, 0x8a, 0xe3, 0xdc, 0x71, 0xe1, 0x04, - 0x8b, 0xe5, 0xf7, 0xbe, 0xef, 0xf9, 0x7d, 0xfe, 0xde, 0xc3, 0x7b, 0xa5, 0xcc, 0xce, 0x58, 0x24, - 0x55, 0x56, 0x68, 0xa6, 0xa2, 0x3a, 0x8e, 0xf4, 0x07, 0x5a, 0x29, 0xa9, 0x25, 0xd9, 0x31, 0x10, - 0xb5, 0x10, 0xad, 0x63, 0xef, 0x6e, 0x2a, 0x8a, 0x52, 0x46, 0xe6, 0x6c, 0x49, 0xde, 0x83, 0x91, - 0x04, 0x21, 0x21, 0x12, 0xc0, 0x9b, 0x62, 0x01, 0xdc, 0x02, 0x7b, 0x2d, 0x70, 0x6a, 0xa2, 0xa8, - 0x0d, 0x2c, 0xb4, 0xcb, 0x25, 0x97, 0x6d, 0xbe, 0xb9, 0xd9, 0xec, 0xe3, 0x75, 0x25, 0x23, 0xa9, - 0x58, 0xf3, 0x62, 0xd7, 0xde, 0x90, 0x82, 0xaf, 0x08, 0xef, 0x1c, 0x03, 0x3f, 0x39, 0xcf, 0x44, - 0xa1, 0xdf, 0xa5, 0x17, 0x67, 0x32, 0xcd, 0xc9, 0x33, 0xbc, 0x0d, 0x05, 0x2f, 0x99, 0x72, 0xd1, - 0x3e, 0x3a, 0x18, 0x0c, 0xdd, 0xef, 0xdf, 0x0e, 0x77, 0x6d, 0xc7, 0xd7, 0x79, 0xae, 0x18, 0xc0, - 0x89, 0x56, 0x45, 0xc9, 0x13, 0xcb, 0x23, 0x2e, 0xbe, 0x59, 0xb5, 0xc5, 0xee, 0xb5, 0xa6, 0x24, - 0xe9, 0xc2, 0x97, 0xf1, 0xa7, 0xc5, 0x24, 0xb4, 0xb4, 0xcf, 0x8b, 0x49, 0xf8, 0xe8, 0x2f, 0x7f, - 0xfa, 0xed, 0x03, 0x8a, 0xdd, 0x7e, 0x2e, 0x61, 0x50, 0xc9, 0x12, 0x18, 0x21, 0xf8, 0xfa, 0x38, - 0x85, 0xb1, 0x11, 0x76, 0x3b, 0x31, 0xf7, 0xe0, 0x12, 0xe1, 0xfb, 0x6f, 0x6b, 0x56, 0x76, 0xe4, - 0xb6, 0x52, 0xb3, 0x7c, 0x13, 0x9b, 0xbc, 0xc0, 0x03, 0xb0, 0x04, 0xd5, 0x8a, 0xfd, 0xc7, 0xff, - 0x56, 0x54, 0xf2, 0x66, 0xf5, 0xc5, 0xad, 0x7d, 0x74, 0x70, 0xeb, 0xc8, 0xa7, 0xeb, 0xf3, 0x6c, - 0x0c, 0xa6, 0x75, 0x4c, 0xad, 0x8a, 0xe1, 0xe0, 0xea, 0xe7, 0x43, 0xe7, 0x72, 0x31, 0x09, 0xd1, - 0xd2, 0x8d, 0xe0, 0x29, 0xbe, 0xf7, 0xa7, 0xd2, 0x84, 0x09, 0x59, 0x6f, 0xd6, 0x79, 0x24, 0xf0, - 0xd6, 0x31, 0x70, 0x72, 0x8a, 0xef, 0xac, 0x0f, 0x27, 0xa0, 0xfd, 0x35, 0xa2, 0x7d, 0xb7, 0xbc, - 0xf0, 0xff, 0x9c, 0xce, 0x51, 0xef, 0xc6, 0xc7, 0x46, 0xe2, 0xf0, 0xd5, 0xd5, 0xcc, 0x47, 0xd3, - 0x99, 0x8f, 0x7e, 0xcd, 0x7c, 0xf4, 0x65, 0xee, 0x3b, 0xd3, 0xb9, 0xef, 0xfc, 0x98, 0xfb, 0xce, - 0xfb, 0x27, 0xbc, 0xd0, 0xe3, 0xf3, 0x8c, 0x8e, 0xa4, 0x88, 0xcc, 0xb3, 0x87, 0x29, 0x00, 0xd3, - 0xb0, 0x9c, 0xa1, 0xbe, 0xa8, 0x18, 0x64, 0xdb, 0x66, 0xa1, 0x9e, 0xff, 0x0e, 0x00, 0x00, 0xff, - 0xff, 0x23, 0x59, 0x71, 0xc3, 0x01, 0x03, 0x00, 0x00, + // 320 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcb, 0x4f, 0xca, + 0x49, 0xd5, 0xcf, 0x2f, 0x4a, 0xca, 0x2c, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0x4b, 0xe9, 0x41, 0xa5, 0xf4, 0xca, 0x0c, 0xa5, + 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x78, 0x72, 0x7e, 0x71, + 0x6e, 0x7e, 0xb1, 0x7e, 0x6e, 0x71, 0x3a, 0x48, 0x73, 0x6e, 0x71, 0x3a, 0x54, 0x42, 0x12, 0x22, + 0x11, 0x0f, 0xe6, 0xe9, 0x43, 0x38, 0x10, 0x29, 0xa5, 0x89, 0x8c, 0x5c, 0x02, 0xbe, 0xc5, 0xe9, + 0xc1, 0xa5, 0x49, 0xb9, 0x99, 0x25, 0x01, 0x89, 0x95, 0x39, 0xf9, 0x89, 0x29, 0x42, 0x06, 0x5c, + 0x6c, 0xc5, 0x99, 0xe9, 0x79, 0xa9, 0x45, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x12, 0x97, + 0xb6, 0xe8, 0x8a, 0x40, 0xb5, 0x39, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, 0x65, + 0xe6, 0xa5, 0x07, 0x41, 0xd5, 0x09, 0x49, 0x70, 0xb1, 0x17, 0x40, 0x34, 0x4b, 0x30, 0x81, 0xb4, + 0x04, 0xc1, 0xb8, 0x56, 0x86, 0x4d, 0xcf, 0x37, 0x68, 0x41, 0x95, 0x75, 0x3d, 0xdf, 0xa0, 0xa5, + 0x88, 0xe1, 0x49, 0x74, 0xeb, 0x95, 0xf4, 0xb8, 0x24, 0xd0, 0xc5, 0x82, 0x52, 0x8b, 0x0b, 0xf2, + 0xf3, 0x8a, 0x53, 0x85, 0x84, 0xb8, 0x58, 0x32, 0x12, 0x8b, 0x33, 0xc0, 0x0e, 0xe3, 0x09, 0x02, + 0xb3, 0x8d, 0x72, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0xe2, 0xb9, 0x78, 0x51, 0xbd, 0xa1, 0xa4, + 0x87, 0x1e, 0x6a, 0x7a, 0xe8, 0xe6, 0x4a, 0x69, 0x11, 0x56, 0x03, 0xb3, 0x5b, 0x8a, 0xb5, 0xe1, + 0xf9, 0x06, 0x2d, 0x46, 0x27, 0xfb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, + 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, + 0x52, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x1b, 0xab, 0x9b, + 0x58, 0x5c, 0x9c, 0x5a, 0x52, 0x0c, 0xf7, 0x6d, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, + 0xe8, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x67, 0x9c, 0x5b, 0xf0, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -438,83 +317,6 @@ func (m *MsgSubmitPayloadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *EventPayloadSubmitted) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPayloadSubmitted) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPayloadSubmitted) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Submitter) > 0 { - i -= len(m.Submitter) - copy(dAtA[i:], m.Submitter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) - i-- - dAtA[i] = 0x12 - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventPayloadRemoved) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPayloadRemoved) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPayloadRemoved) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -556,38 +358,6 @@ func (m *MsgSubmitPayloadResponse) Size() (n int) { return n } -func (m *EventPayloadSubmitted) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Submitter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Payload.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *EventPayloadRemoved) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -792,239 +562,6 @@ func (m *MsgSubmitPayloadResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventPayloadSubmitted) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventPayloadSubmitted: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventPayloadSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Submitter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventPayloadRemoved) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventPayloadRemoved: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventPayloadRemoved: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From bedd604805fbbf14a74f88c4b0f6f6c35b8da505 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 17:41:04 +0200 Subject: [PATCH 13/29] address more comments --- api/v1/tx_grpc.pb.go | 4 ++-- proto/noble/orbiter/v1/tx.proto | 2 +- types/tx.pb.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/v1/tx_grpc.pb.go b/api/v1/tx_grpc.pb.go index 031103c5..49a63ef8 100644 --- a/api/v1/tx_grpc.pb.go +++ b/api/v1/tx_grpc.pb.go @@ -29,7 +29,7 @@ const ( // Msg defines the RPC methods for the Orbiter module. type MsgClient interface { // SubmitPayload is the entrypoint to insert a new pending payload - // into the dispatching queue. + // into the module storage. SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) } @@ -58,7 +58,7 @@ func (c *msgClient) SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opt // Msg defines the RPC methods for the Orbiter module. type MsgServer interface { // SubmitPayload is the entrypoint to insert a new pending payload - // into the dispatching queue. + // into the module storage. SubmitPayload(context.Context, *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) mustEmbedUnimplementedMsgServer() } diff --git a/proto/noble/orbiter/v1/tx.proto b/proto/noble/orbiter/v1/tx.proto index b14a5ab5..bdc656c9 100644 --- a/proto/noble/orbiter/v1/tx.proto +++ b/proto/noble/orbiter/v1/tx.proto @@ -13,7 +13,7 @@ service Msg { option (cosmos.msg.v1.service) = true; // SubmitPayload is the entrypoint to insert a new pending payload - // into the dispatching queue. + // into the module storage. rpc SubmitPayload(MsgSubmitPayload) returns (MsgSubmitPayloadResponse); } diff --git a/types/tx.pb.go b/types/tx.pb.go index d0615647..2f11b7ac 100644 --- a/types/tx.pb.go +++ b/types/tx.pb.go @@ -178,7 +178,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { // SubmitPayload is the entrypoint to insert a new pending payload - // into the dispatching queue. + // into the module storage. SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) } @@ -202,7 +202,7 @@ func (c *msgClient) SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opt // MsgServer is the server API for Msg service. type MsgServer interface { // SubmitPayload is the entrypoint to insert a new pending payload - // into the dispatching queue. + // into the module storage. SubmitPayload(context.Context, *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) } From 98ff55fd4bbc95b8214d2c54e1a071461d8b8cdb Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 18:43:03 +0200 Subject: [PATCH 14/29] remove extra validation from hash generation and adjust error messages --- keeper/payload_handler.go | 10 ++++++---- types/core/payload.go | 6 ++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go index 957f1d58..ad55e136 100644 --- a/keeper/payload_handler.go +++ b/keeper/payload_handler.go @@ -118,7 +118,7 @@ func (k *Keeper) validatePayloadAgainstState( paused, err := k.forwarder.IsProtocolPaused(ctx, payload.Forwarding.ProtocolId) if err != nil { - return errorsmod.Wrap(err, "failed to check if forwarder is paused") + return errorsmod.Wrap(err, "failed to check if protocol is paused") } if paused { @@ -130,16 +130,18 @@ func (k *Keeper) validatePayloadAgainstState( return err } - paused, err = k.forwarder.IsCrossChainPaused(ctx, core.CrossChainID{ + ccID := core.CrossChainID{ ProtocolId: payload.Forwarding.ProtocolId, CounterpartyId: cachedAttrs.CounterpartyID(), - }) + } + + paused, err = k.forwarder.IsCrossChainPaused(ctx, ccID) if err != nil { return errorsmod.Wrap(err, "failed to check if cross-chain paused") } if paused { - return fmt.Errorf("cross-chain paused") + return fmt.Errorf("cross-chain %s is paused", ccID.ID()) } return nil diff --git a/types/core/payload.go b/types/core/payload.go index b644133c..d1bcb670 100644 --- a/types/core/payload.go +++ b/types/core/payload.go @@ -27,11 +27,9 @@ import ( // Keccak256Hash returns the keccak 256 hash of the payload contents. // To guarantee uniqueness the sequence number is included. +// +// CONTRACT: The pending payload should be validated before calling this function. func (p *PendingPayload) Keccak256Hash() (common.Hash, error) { - if err := p.Validate(); err != nil { - return common.Hash{}, err - } - bz, err := p.Marshal() if err != nil { return common.Hash{}, err From ab28500914ac766df6030ab97d524f93c13bab93 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 18:53:23 +0200 Subject: [PATCH 15/29] make pending payload sequence private and remove tests that require overwriting it --- keeper/keeper.go | 8 +++----- keeper/msg_server_test.go | 17 ----------------- keeper/payload_handler.go | 4 ++-- keeper/payload_handler_test.go | 20 ++------------------ 4 files changed, 7 insertions(+), 42 deletions(-) diff --git a/keeper/keeper.go b/keeper/keeper.go index 10e80481..3ab12a3c 100644 --- a/keeper/keeper.go +++ b/keeper/keeper.go @@ -62,11 +62,9 @@ type Keeper struct { // pendingPayloads stores the pending payloads addressed by their keccak256 hash. pendingPayloads collections.Map[[]byte, core.PendingPayload] - // PendingPayloadsSequence is the unique identifier of a given pending payload handled by the + // pendingPayloadsSequence is the unique identifier of a given pending payload handled by the // orbiter. - // - // TODO: this is only exported to be able to set the sequence in tests -- make private again? - PendingPayloadsSequence collections.Sequence + pendingPayloadsSequence collections.Sequence } // NewKeeper returns a reference to a validated instance of the keeper. @@ -99,7 +97,7 @@ func NewKeeper( collections.BytesKey, codec.CollValue[core.PendingPayload](cdc), ), - PendingPayloadsSequence: collections.NewSequence( + pendingPayloadsSequence: collections.NewSequence( sb, core.PendingPayloadsSequencePrefix, core.PendingPayloadsSequenceName, diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go index db4830db..eef8250d 100644 --- a/keeper/msg_server_test.go +++ b/keeper/msg_server_test.go @@ -57,23 +57,6 @@ func TestSubmitPayload(t *testing.T) { payload: &core.Payload{}, errContains: "forwarding is not set: invalid nil pointer", }, - { - name: "error - hash already set", - setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { - t.Helper() - - preSeq, err := k.PendingPayloadsSequence.Peek(ctx) - require.NoError(t, err, "failed to get current payloads sequence") - - _, err = k.Submit(ctx, validPayload.Payload) - require.NoError(t, err, "failed to accept payload") - - // NOTE: we're resetting the nonce here to get the exact same hash bytes - require.NoError(t, k.PendingPayloadsSequence.Set(ctx, preSeq)) - }, - payload: validPayload.Payload, - errContains: core.ErrSubmitPayload.Error(), - }, } for _, tc := range testcases { diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go index ad55e136..206eb630 100644 --- a/keeper/payload_handler.go +++ b/keeper/payload_handler.go @@ -50,7 +50,7 @@ func (k *Keeper) Submit( return nil, errorsmod.Wrap(err, "payload failed stateful checks") } - next, err := k.PendingPayloadsSequence.Next(ctx) + next, err := k.pendingPayloadsSequence.Next(ctx) if err != nil { return nil, errorsmod.Wrap(err, "failed to get next sequence number") } @@ -141,7 +141,7 @@ func (k *Keeper) validatePayloadAgainstState( } if paused { - return fmt.Errorf("cross-chain %s is paused", ccID.ID()) + return fmt.Errorf("cross-chain %s is paused", ccID) } return nil diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index e4a01b18..ed1ae958 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -38,7 +38,7 @@ import ( "github.com/noble-assets/orbiter/types/core" ) -func TestAcceptPayload(t *testing.T) { +func TestSubmit(t *testing.T) { seq := uint64(0) destDomain := uint32(1) recipient := testutil.RandomBytes(32) @@ -59,22 +59,6 @@ func TestAcceptPayload(t *testing.T) { payload: func() *core.PendingPayload { return validPayload }, expHash: expHash.String(), }, - { - name: "error - payload already registered", - setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { - t.Helper() - - _, err := k.Submit(ctx, validPayload.Payload) - require.NoError(t, err, "failed to accept payload during setup") - - // NOTE: we're resetting the pending payloads sequence to generate the same hash for - // the next submission - err = k.PendingPayloadsSequence.Set(ctx, seq) - require.NoError(t, err, "failed to set pending payloads sequence") - }, - payload: func() *core.PendingPayload { return validPayload }, - errContains: "already registered", - }, { name: "error - payload contains paused action", setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { @@ -141,7 +125,7 @@ func TestAcceptPayload(t *testing.T) { return &p }, - errContains: "cross-chain paused", + errContains: "cross-chain 2:1 is paused", }, { name: "error - invalid (empty) payload", From 7fb73d52f93fcb036a935286e4b60543767bdea1 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 18:55:07 +0200 Subject: [PATCH 16/29] address review comments --- api/v1/tx.pulsar.go | 2 +- api/v1/tx_grpc.pb.go | 4 ++-- proto/noble/orbiter/v1/tx.proto | 4 ++-- types/tx.pb.go | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api/v1/tx.pulsar.go b/api/v1/tx.pulsar.go index 54fba552..b56961b2 100644 --- a/api/v1/tx.pulsar.go +++ b/api/v1/tx.pulsar.go @@ -934,7 +934,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// MsgSubmitPayload enters a new Orbiter payload into the queue of pending +// MsgSubmitPayload enters a new Orbiter payload into the list of pending // forwarding operations. type MsgSubmitPayload struct { state protoimpl.MessageState diff --git a/api/v1/tx_grpc.pb.go b/api/v1/tx_grpc.pb.go index 49a63ef8..36fcb41e 100644 --- a/api/v1/tx_grpc.pb.go +++ b/api/v1/tx_grpc.pb.go @@ -28,7 +28,7 @@ const ( // // Msg defines the RPC methods for the Orbiter module. type MsgClient interface { - // SubmitPayload is the entrypoint to insert a new pending payload + // SubmitPayload allows to insert a new pending payload // into the module storage. SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) } @@ -57,7 +57,7 @@ func (c *msgClient) SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opt // // Msg defines the RPC methods for the Orbiter module. type MsgServer interface { - // SubmitPayload is the entrypoint to insert a new pending payload + // SubmitPayload allows to insert a new pending payload // into the module storage. SubmitPayload(context.Context, *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) mustEmbedUnimplementedMsgServer() diff --git a/proto/noble/orbiter/v1/tx.proto b/proto/noble/orbiter/v1/tx.proto index bdc656c9..02302c4d 100644 --- a/proto/noble/orbiter/v1/tx.proto +++ b/proto/noble/orbiter/v1/tx.proto @@ -12,12 +12,12 @@ option go_package = "github.com/noble-assets/orbiter/types"; service Msg { option (cosmos.msg.v1.service) = true; - // SubmitPayload is the entrypoint to insert a new pending payload + // SubmitPayload allows to insert a new pending payload // into the module storage. rpc SubmitPayload(MsgSubmitPayload) returns (MsgSubmitPayloadResponse); } -// MsgSubmitPayload enters a new Orbiter payload into the queue of pending +// MsgSubmitPayload enters a new Orbiter payload into the list of pending // forwarding operations. message MsgSubmitPayload { option (cosmos.msg.v1.signer) = "signer"; diff --git a/types/tx.pb.go b/types/tx.pb.go index 2f11b7ac..05f87560 100644 --- a/types/tx.pb.go +++ b/types/tx.pb.go @@ -30,7 +30,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgSubmitPayload enters a new Orbiter payload into the queue of pending +// MsgSubmitPayload enters a new Orbiter payload into the list of pending // forwarding operations. type MsgSubmitPayload struct { // The signer of the transaction. @@ -177,7 +177,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // SubmitPayload is the entrypoint to insert a new pending payload + // SubmitPayload allows to insert a new pending payload // into the module storage. SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) } @@ -201,7 +201,7 @@ func (c *msgClient) SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opt // MsgServer is the server API for Msg service. type MsgServer interface { - // SubmitPayload is the entrypoint to insert a new pending payload + // SubmitPayload allows to insert a new pending payload // into the module storage. SubmitPayload(context.Context, *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) } From 1a1fd94e1710406526c7f2b9456f3e58918fc8cb Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Thu, 9 Oct 2025 19:07:22 +0200 Subject: [PATCH 17/29] address more review comments - hash string encoding --- keeper/payload_handler.go | 10 ++++------ keeper/payload_handler_test.go | 31 ++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go index 206eb630..48483bfd 100644 --- a/keeper/payload_handler.go +++ b/keeper/payload_handler.go @@ -26,8 +26,6 @@ import ( "errors" "fmt" - ethcommon "github.com/ethereum/go-ethereum/common" - errorsmod "cosmossdk.io/errors" orbitertypes "github.com/noble-assets/orbiter/types" @@ -112,7 +110,7 @@ func (k *Keeper) validatePayloadAgainstState( } if paused { - return fmt.Errorf("action %s is paused", action.ID()) + return fmt.Errorf("action %s is paused", action.ID().String()) } } @@ -122,7 +120,7 @@ func (k *Keeper) validatePayloadAgainstState( } if paused { - return fmt.Errorf("protocol %s is paused", payload.Forwarding.ProtocolId) + return fmt.Errorf("protocol %s is paused", payload.Forwarding.ProtocolId.String()) } cachedAttrs, err := payload.Forwarding.CachedAttributes() @@ -141,7 +139,7 @@ func (k *Keeper) validatePayloadAgainstState( } if paused { - return fmt.Errorf("cross-chain %s is paused", ccID) + return fmt.Errorf("cross-chain %s is paused", ccID.String()) } return nil @@ -179,7 +177,7 @@ func (k *Keeper) RemovePendingPayload( } if !found { - return fmt.Errorf("payload with hash %s not found", ethcommon.BytesToHash(hash).Hex()) + return fmt.Errorf("payload with hash %q not found", hex.EncodeToString(hash)) } if err = k.pendingPayloads.Remove(ctx, hash); err != nil { diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index ed1ae958..29f71f37 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -22,6 +22,7 @@ package keeper_test import ( "context" + "encoding/hex" "fmt" "strings" "testing" @@ -259,16 +260,19 @@ func TestRemovePayload(t *testing.T) { hash: expHash.Bytes(), }, { - name: "error - valid payload but not found in store", - setup: nil, - hash: expHash.Bytes(), - errContains: fmt.Sprintf("payload with hash %s not found", expHash.Hex()), + name: "error - valid payload but not found in store", + setup: nil, + hash: expHash.Bytes(), + errContains: fmt.Sprintf( + "payload with hash %q not found", + hex.EncodeToString(expHash.Bytes()), + ), }, { name: "error - nil hash", setup: nil, hash: nil, - errContains: fmt.Sprintf("payload with hash %s not found", ethcommon.Hash{}.Hex()), + errContains: fmt.Sprintf("payload with hash %q not found", hex.EncodeToString(nil)), }, } @@ -330,8 +334,8 @@ func TestSubsequentSubmissions(t *testing.T) { require.NoError(t, err, "failed to submit payload") // ASSERT: expected hash is returned - gotHash := ethcommon.BytesToHash(res.Hash) - require.Equal(t, expHash.String(), gotHash.String(), "expected different hash") + gotHash := hex.EncodeToString(res.Hash) + require.Equal(t, hex.EncodeToString(expHash.Bytes()), gotHash, "expected different hash") // ACT: submit identical payload again res2, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ @@ -345,11 +349,11 @@ func TestSubsequentSubmissions(t *testing.T) { require.NoError(t, err, "failed to hash payload") // ASSERT: expected hash is returned - gotHash2 := ethcommon.BytesToHash(res2.Hash) - require.Equal(t, expHash2.String(), gotHash2.String(), "expected different hash") + gotHash2 := hex.EncodeToString(res2.Hash) + require.Equal(t, hex.EncodeToString(expHash2.Bytes()), gotHash2, "expected different hash") // ASSERT: hashes of subsequent submissions of the same payload are different - require.NotEqual(t, gotHash.String(), gotHash2.String(), "expected different hashes") + require.NotEqual(t, gotHash, gotHash2, "expected different hashes") } func TestDifferentSequenceGeneratesDifferentHash(t *testing.T) { @@ -365,7 +369,12 @@ func TestDifferentSequenceGeneratesDifferentHash(t *testing.T) { require.NoError(t, err, "failed to hash payload") // ASSERT: hash 1 and hash 2 are NOT equal - require.NotEqual(t, expHash.String(), expHash2.String(), "expected different hash") + require.NotEqual( + t, + hex.EncodeToString(expHash.Bytes()), + hex.EncodeToString(expHash2.Bytes()), + "expected different hash", + ) } // createTestPendingPayloadWithSequence creates a new example payload that can be submitted From 12b243479124c499b952a14c93b8ab9bcd9eb494 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Fri, 10 Oct 2025 13:19:53 +0200 Subject: [PATCH 18/29] remove event emitting and exposed pending payloads query to expose less information for potential griefing --- api/v1/events.pulsar.go | 1228 --------------------------- keeper/payload_handler.go | 17 - keeper/payload_handler_test.go | 25 - keeper/query_server.go | 65 -- keeper/query_server_test.go | 98 --- keeper/servers_registration.go | 2 - proto/noble/orbiter/v1/events.proto | 29 - proto/noble/orbiter/v1/query.proto | 24 +- types/events.pb.go | 612 ------------- 9 files changed, 1 insertion(+), 2099 deletions(-) delete mode 100644 api/v1/events.pulsar.go delete mode 100644 keeper/query_server.go delete mode 100644 keeper/query_server_test.go delete mode 100644 proto/noble/orbiter/v1/events.proto delete mode 100644 types/events.pb.go diff --git a/api/v1/events.pulsar.go b/api/v1/events.pulsar.go deleted file mode 100644 index b41d8fb1..00000000 --- a/api/v1/events.pulsar.go +++ /dev/null @@ -1,1228 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package orbiterv1 - -import ( - _ "cosmossdk.io/api/amino" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - v1 "github.com/noble-assets/orbiter/api/core/v1" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_EventPayloadSubmitted protoreflect.MessageDescriptor - fd_EventPayloadSubmitted_hash protoreflect.FieldDescriptor - fd_EventPayloadSubmitted_submitter protoreflect.FieldDescriptor - fd_EventPayloadSubmitted_payload protoreflect.FieldDescriptor -) - -func init() { - file_noble_orbiter_v1_events_proto_init() - md_EventPayloadSubmitted = File_noble_orbiter_v1_events_proto.Messages().ByName("EventPayloadSubmitted") - fd_EventPayloadSubmitted_hash = md_EventPayloadSubmitted.Fields().ByName("hash") - fd_EventPayloadSubmitted_submitter = md_EventPayloadSubmitted.Fields().ByName("submitter") - fd_EventPayloadSubmitted_payload = md_EventPayloadSubmitted.Fields().ByName("payload") -} - -var _ protoreflect.Message = (*fastReflection_EventPayloadSubmitted)(nil) - -type fastReflection_EventPayloadSubmitted EventPayloadSubmitted - -func (x *EventPayloadSubmitted) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventPayloadSubmitted)(x) -} - -func (x *EventPayloadSubmitted) slowProtoReflect() protoreflect.Message { - mi := &file_noble_orbiter_v1_events_proto_msgTypes[0] - 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) -} - -var _fastReflection_EventPayloadSubmitted_messageType fastReflection_EventPayloadSubmitted_messageType -var _ protoreflect.MessageType = fastReflection_EventPayloadSubmitted_messageType{} - -type fastReflection_EventPayloadSubmitted_messageType struct{} - -func (x fastReflection_EventPayloadSubmitted_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventPayloadSubmitted)(nil) -} -func (x fastReflection_EventPayloadSubmitted_messageType) New() protoreflect.Message { - return new(fastReflection_EventPayloadSubmitted) -} -func (x fastReflection_EventPayloadSubmitted_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventPayloadSubmitted -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_EventPayloadSubmitted) Descriptor() protoreflect.MessageDescriptor { - return md_EventPayloadSubmitted -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_EventPayloadSubmitted) Type() protoreflect.MessageType { - return _fastReflection_EventPayloadSubmitted_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventPayloadSubmitted) New() protoreflect.Message { - return new(fastReflection_EventPayloadSubmitted) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_EventPayloadSubmitted) Interface() protoreflect.ProtoMessage { - return (*EventPayloadSubmitted)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_EventPayloadSubmitted) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Hash) != 0 { - value := protoreflect.ValueOfBytes(x.Hash) - if !f(fd_EventPayloadSubmitted_hash, value) { - return - } - } - if x.Submitter != "" { - value := protoreflect.ValueOfString(x.Submitter) - if !f(fd_EventPayloadSubmitted_submitter, value) { - return - } - } - if x.Payload != nil { - value := protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) - if !f(fd_EventPayloadSubmitted_payload, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_EventPayloadSubmitted) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - return len(x.Hash) != 0 - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - return x.Submitter != "" - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - return x.Payload != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadSubmitted) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - x.Hash = nil - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - x.Submitter = "" - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - x.Payload = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_EventPayloadSubmitted) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - value := x.Hash - return protoreflect.ValueOfBytes(value) - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - value := x.Submitter - return protoreflect.ValueOfString(value) - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - value := x.Payload - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadSubmitted) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - x.Hash = value.Bytes() - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - x.Submitter = value.Interface().(string) - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - x.Payload = value.Message().Interface().(*v1.Payload) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadSubmitted) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - if x.Payload == nil { - x.Payload = new(v1.Payload) - } - return protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - panic(fmt.Errorf("field hash of message noble.orbiter.v1.EventPayloadSubmitted is not mutable")) - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - panic(fmt.Errorf("field submitter of message noble.orbiter.v1.EventPayloadSubmitted is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_EventPayloadSubmitted) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadSubmitted.hash": - return protoreflect.ValueOfBytes(nil) - case "noble.orbiter.v1.EventPayloadSubmitted.submitter": - return protoreflect.ValueOfString("") - case "noble.orbiter.v1.EventPayloadSubmitted.payload": - m := new(v1.Payload) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadSubmitted")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadSubmitted does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_EventPayloadSubmitted) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.EventPayloadSubmitted", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_EventPayloadSubmitted) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadSubmitted) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_EventPayloadSubmitted) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_EventPayloadSubmitted) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventPayloadSubmitted) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Hash) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Submitter) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Payload != nil { - l = options.Size(x.Payload) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventPayloadSubmitted) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Payload != nil { - encoded, err := options.Marshal(x.Payload) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if len(x.Submitter) > 0 { - i -= len(x.Submitter) - copy(dAtA[i:], x.Submitter) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Submitter))) - i-- - dAtA[i] = 0x12 - } - if len(x.Hash) > 0 { - i -= len(x.Hash) - copy(dAtA[i:], x.Hash) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventPayloadSubmitted) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadSubmitted: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) - if x.Hash == nil { - x.Hash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Submitter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Payload == nil { - x.Payload = &v1.Payload{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Payload); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_EventPayloadRemoved protoreflect.MessageDescriptor - fd_EventPayloadRemoved_hash protoreflect.FieldDescriptor -) - -func init() { - file_noble_orbiter_v1_events_proto_init() - md_EventPayloadRemoved = File_noble_orbiter_v1_events_proto.Messages().ByName("EventPayloadRemoved") - fd_EventPayloadRemoved_hash = md_EventPayloadRemoved.Fields().ByName("hash") -} - -var _ protoreflect.Message = (*fastReflection_EventPayloadRemoved)(nil) - -type fastReflection_EventPayloadRemoved EventPayloadRemoved - -func (x *EventPayloadRemoved) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventPayloadRemoved)(x) -} - -func (x *EventPayloadRemoved) slowProtoReflect() protoreflect.Message { - mi := &file_noble_orbiter_v1_events_proto_msgTypes[1] - 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) -} - -var _fastReflection_EventPayloadRemoved_messageType fastReflection_EventPayloadRemoved_messageType -var _ protoreflect.MessageType = fastReflection_EventPayloadRemoved_messageType{} - -type fastReflection_EventPayloadRemoved_messageType struct{} - -func (x fastReflection_EventPayloadRemoved_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventPayloadRemoved)(nil) -} -func (x fastReflection_EventPayloadRemoved_messageType) New() protoreflect.Message { - return new(fastReflection_EventPayloadRemoved) -} -func (x fastReflection_EventPayloadRemoved_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventPayloadRemoved -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_EventPayloadRemoved) Descriptor() protoreflect.MessageDescriptor { - return md_EventPayloadRemoved -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_EventPayloadRemoved) Type() protoreflect.MessageType { - return _fastReflection_EventPayloadRemoved_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventPayloadRemoved) New() protoreflect.Message { - return new(fastReflection_EventPayloadRemoved) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_EventPayloadRemoved) Interface() protoreflect.ProtoMessage { - return (*EventPayloadRemoved)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_EventPayloadRemoved) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Hash) != 0 { - value := protoreflect.ValueOfBytes(x.Hash) - if !f(fd_EventPayloadRemoved_hash, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_EventPayloadRemoved) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - return len(x.Hash) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadRemoved) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - x.Hash = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_EventPayloadRemoved) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - value := x.Hash - return protoreflect.ValueOfBytes(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadRemoved) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - x.Hash = value.Bytes() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadRemoved) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - panic(fmt.Errorf("field hash of message noble.orbiter.v1.EventPayloadRemoved is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_EventPayloadRemoved) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "noble.orbiter.v1.EventPayloadRemoved.hash": - return protoreflect.ValueOfBytes(nil) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.EventPayloadRemoved")) - } - panic(fmt.Errorf("message noble.orbiter.v1.EventPayloadRemoved does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_EventPayloadRemoved) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.EventPayloadRemoved", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_EventPayloadRemoved) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventPayloadRemoved) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_EventPayloadRemoved) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_EventPayloadRemoved) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventPayloadRemoved) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Hash) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventPayloadRemoved) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Hash) > 0 { - i -= len(x.Hash) - copy(dAtA[i:], x.Hash) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventPayloadRemoved) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadRemoved: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventPayloadRemoved: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) - if x.Hash == nil { - x.Hash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: noble/orbiter/v1/events.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// EventPayloadSubmitted is emitted after successful submission of a payload. -type EventPayloadSubmitted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The keccak256 hash of the now pending payload. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - // The address that has submitted the payload. - Submitter string `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` - // The submitted payload. - Payload *v1.Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` -} - -func (x *EventPayloadSubmitted) Reset() { - *x = EventPayloadSubmitted{} - if protoimpl.UnsafeEnabled { - mi := &file_noble_orbiter_v1_events_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventPayloadSubmitted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventPayloadSubmitted) ProtoMessage() {} - -// Deprecated: Use EventPayloadSubmitted.ProtoReflect.Descriptor instead. -func (*EventPayloadSubmitted) Descriptor() ([]byte, []int) { - return file_noble_orbiter_v1_events_proto_rawDescGZIP(), []int{0} -} - -func (x *EventPayloadSubmitted) GetHash() []byte { - if x != nil { - return x.Hash - } - return nil -} - -func (x *EventPayloadSubmitted) GetSubmitter() string { - if x != nil { - return x.Submitter - } - return "" -} - -func (x *EventPayloadSubmitted) GetPayload() *v1.Payload { - if x != nil { - return x.Payload - } - return nil -} - -// EventPayloadRemoved is emitted after removing a pending payload from the queue. -type EventPayloadRemoved struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The keccak256 hash of the removed payload. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` -} - -func (x *EventPayloadRemoved) Reset() { - *x = EventPayloadRemoved{} - if protoimpl.UnsafeEnabled { - mi := &file_noble_orbiter_v1_events_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EventPayloadRemoved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EventPayloadRemoved) ProtoMessage() {} - -// Deprecated: Use EventPayloadRemoved.ProtoReflect.Descriptor instead. -func (*EventPayloadRemoved) Descriptor() ([]byte, []int) { - return file_noble_orbiter_v1_events_proto_rawDescGZIP(), []int{1} -} - -func (x *EventPayloadRemoved) GetHash() []byte { - if x != nil { - return x.Hash - } - return nil -} - -var File_noble_orbiter_v1_events_proto protoreflect.FileDescriptor - -var file_noble_orbiter_v1_events_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, - 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x10, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, - 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, - 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x62, - 0x69, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x01, 0x0a, 0x15, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x75, 0x62, 0x6d, 0x69, - 0x74, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x36, 0x0a, 0x09, 0x73, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, - 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x72, - 0x12, 0x43, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, - 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x70, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x29, 0x0a, 0x13, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, - 0x42, 0xc5, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, - 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, - 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, - 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x6f, - 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x58, 0xaa, 0x02, - 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, - 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, - 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, - 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_noble_orbiter_v1_events_proto_rawDescOnce sync.Once - file_noble_orbiter_v1_events_proto_rawDescData = file_noble_orbiter_v1_events_proto_rawDesc -) - -func file_noble_orbiter_v1_events_proto_rawDescGZIP() []byte { - file_noble_orbiter_v1_events_proto_rawDescOnce.Do(func() { - file_noble_orbiter_v1_events_proto_rawDescData = protoimpl.X.CompressGZIP(file_noble_orbiter_v1_events_proto_rawDescData) - }) - return file_noble_orbiter_v1_events_proto_rawDescData -} - -var file_noble_orbiter_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_noble_orbiter_v1_events_proto_goTypes = []interface{}{ - (*EventPayloadSubmitted)(nil), // 0: noble.orbiter.v1.EventPayloadSubmitted - (*EventPayloadRemoved)(nil), // 1: noble.orbiter.v1.EventPayloadRemoved - (*v1.Payload)(nil), // 2: noble.orbiter.core.v1.Payload -} -var file_noble_orbiter_v1_events_proto_depIdxs = []int32{ - 2, // 0: noble.orbiter.v1.EventPayloadSubmitted.payload:type_name -> noble.orbiter.core.v1.Payload - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_noble_orbiter_v1_events_proto_init() } -func file_noble_orbiter_v1_events_proto_init() { - if File_noble_orbiter_v1_events_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_noble_orbiter_v1_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventPayloadSubmitted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_noble_orbiter_v1_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventPayloadRemoved); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_noble_orbiter_v1_events_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_noble_orbiter_v1_events_proto_goTypes, - DependencyIndexes: file_noble_orbiter_v1_events_proto_depIdxs, - MessageInfos: file_noble_orbiter_v1_events_proto_msgTypes, - }.Build() - File_noble_orbiter_v1_events_proto = out.File - file_noble_orbiter_v1_events_proto_rawDesc = nil - file_noble_orbiter_v1_events_proto_goTypes = nil - file_noble_orbiter_v1_events_proto_depIdxs = nil -} diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go index 48483bfd..c037e6bd 100644 --- a/keeper/payload_handler.go +++ b/keeper/payload_handler.go @@ -82,16 +82,6 @@ func (k *Keeper) Submit( return nil, errorsmod.Wrap(err, "failed to set pending payload") } - if err = k.eventService.EventManager(ctx).Emit( - ctx, - &orbitertypes.EventPayloadSubmitted{ - Hash: hashBz, - Payload: *payload, - }, - ); err != nil { - return nil, errorsmod.Wrap(err, "failed to emit payload submitted event") - } - return hashBz, nil } @@ -186,12 +176,5 @@ func (k *Keeper) RemovePendingPayload( k.Logger().Debug("removed pending payload", "hash", hex.EncodeToString(hash)) - if err = k.eventService.EventManager(ctx).Emit( - ctx, - &orbitertypes.EventPayloadRemoved{Hash: hash}, - ); err != nil { - return errorsmod.Wrap(err, "failed to emit remove pending payload event") - } - return nil } diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index 29f71f37..46f2a0ec 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -24,7 +24,6 @@ import ( "context" "encoding/hex" "fmt" - "strings" "testing" ethcommon "github.com/ethereum/go-ethereum/common" @@ -153,19 +152,6 @@ func TestSubmit(t *testing.T) { // ASSERT: expected hash returned require.Equal(t, tc.expHash, ethcommon.BytesToHash(gotHash).String()) - - // ASSERT: expected event emitted - events := ctx.EventManager().Events() - require.Len(t, events, 1, "expected 1 event, got %d", len(events)) - - found := false - for _, e := range events { - if strings.Contains(e.Type, "EventPayloadSubmitted") { - require.False(t, found, "expected event to be emitted just once") - found = true - } - } - require.True(t, found, "expected event payload submitted to be found") } else { require.ErrorContains(t, err, tc.errContains, "expected different error") } @@ -294,17 +280,6 @@ func TestRemovePayload(t *testing.T) { gotPayload, err := k.PendingPayload(ctx, tc.hash) require.Error(t, err, "payload should not be present anymore") require.Nil(t, gotPayload, "expected nil payload") - - // ASSERT: event was emitted. - found := false - for _, event := range ctx.EventManager().ABCIEvents() { - if strings.Contains(event.Type, "EventPayloadRemoved") { - require.False(t, found, "event should only be emitted once") - - found = true - } - } - require.True(t, found, "expected event to be emitted") } else { require.ErrorContains(t, err, tc.errContains, "expected different error") } diff --git a/keeper/query_server.go b/keeper/query_server.go deleted file mode 100644 index aef0eb67..00000000 --- a/keeper/query_server.go +++ /dev/null @@ -1,65 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2025, NASD Inc. All rights reserved. -// Use of this software is governed by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package keeper - -import ( - "context" - - ethcommon "github.com/ethereum/go-ethereum/common" - - errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/types/query" - - orbitertypes "github.com/noble-assets/orbiter/types" - "github.com/noble-assets/orbiter/types/core" -) - -var _ orbitertypes.QueryServer = &queryServer{} - -type queryServer struct { - *Keeper -} - -func NewQueryServer(k *Keeper) orbitertypes.QueryServer { - return &queryServer{k} -} - -func (s *queryServer) PendingPayloads( - ctx context.Context, - req *orbitertypes.QueryPendingPayloadsRequest, -) (*orbitertypes.QueryPendingPayloadsResponse, error) { - hashes, pageRes, err := query.CollectionPaginate( - ctx, - s.pendingPayloads, - req.Pagination, - func(hash []byte, _ core.PendingPayload) (string, error) { - return ethcommon.BytesToHash(hash).Hex(), nil - }, - ) - if err != nil { - return nil, errorsmod.Wrap(err, "failed to paginate pending payloads") - } - - return &orbitertypes.QueryPendingPayloadsResponse{ - Hashes: hashes, - Pagination: pageRes, - }, nil -} diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go deleted file mode 100644 index b4524b2d..00000000 --- a/keeper/query_server_test.go +++ /dev/null @@ -1,98 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2025, NASD Inc. All rights reserved. -// Use of this software is governed by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/cosmos/cosmos-sdk/types/query" - - orbiterkeeper "github.com/noble-assets/orbiter/keeper" - "github.com/noble-assets/orbiter/testutil/mocks/orbiter" - orbitertypes "github.com/noble-assets/orbiter/types" -) - -func TestPendingPayloads(t *testing.T) { - examplePayload := createTestPendingPayloadWithSequence(t, 0).Payload - - testcases := []struct { - name string - nPayloads int - pagination *query.PageRequest - expLen int - }{ - { - name: "success - no hashes stored", - nPayloads: 0, - expLen: 0, - }, - { - name: "success - 1 hashes stored", - nPayloads: 1, - expLen: 1, - }, - { - name: "success - 5 hashes stored", - nPayloads: 5, - expLen: 5, - }, - { - name: "success - 5 hashes stored with 2 pagination", - nPayloads: 5, - pagination: &query.PageRequest{Offset: 1, Limit: 2}, - expLen: 2, - }, - { - name: "success - 5 hashes stored with offset out of range so no results returned", - nPayloads: 5, - pagination: &query.PageRequest{Offset: 6, Limit: 2}, - expLen: 0, - }, - } - - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - ctx, _, k := orbiter.OrbiterKeeper(t) - ms := orbiterkeeper.NewQueryServer(k) - - for range tc.nPayloads { - _, err := k.Submit(ctx, examplePayload) - require.NoError(t, err, "failed to setup payloads") - } - - res, err := ms.PendingPayloads( - ctx, - &orbitertypes.QueryPendingPayloadsRequest{ - Pagination: tc.pagination, - }, - ) - require.NoError(t, err, "failed to query pending payloads") - require.Equal( - t, - tc.expLen, - len(res.Hashes), - "expected different number of hashes returned", - ) - }) - } -} diff --git a/keeper/servers_registration.go b/keeper/servers_registration.go index 6fb182eb..2294ff4b 100644 --- a/keeper/servers_registration.go +++ b/keeper/servers_registration.go @@ -51,8 +51,6 @@ func RegisterMsgServers(cfg module.Configurator, k *Keeper) { func RegisterQueryServers(cfg module.Configurator, k *Keeper) { qs := cfg.QueryServer() - orbitertypes.RegisterQueryServer(qs, NewQueryServer(k)) - forwardertypes.RegisterQueryServer(qs, forwarder.NewQueryServer(k.forwarder)) executortypes.RegisterQueryServer(qs, executor.NewQueryServer(k.executor)) adaptertypes.RegisterQueryServer(qs, adapter.NewQueryServer(k.adapter)) diff --git a/proto/noble/orbiter/v1/events.proto b/proto/noble/orbiter/v1/events.proto deleted file mode 100644 index ef4b155f..00000000 --- a/proto/noble/orbiter/v1/events.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; - -package noble.orbiter.v1; - -import "amino/amino.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "noble/orbiter/core/v1/orbiter.proto"; - -option go_package = "github.com/noble-assets/orbiter/types"; - -// EventPayloadSubmitted is emitted after successful submission of a payload. -message EventPayloadSubmitted { - // The keccak256 hash of the now pending payload. - bytes hash = 1; - // The address that has submitted the payload. - string submitter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // The submitted payload. - noble.orbiter.core.v1.Payload payload = 3 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; -} - -// EventPayloadRemoved is emitted after removing a pending payload from the queue. -message EventPayloadRemoved { - // The keccak256 hash of the removed payload. - bytes hash = 1; -} diff --git a/proto/noble/orbiter/v1/query.proto b/proto/noble/orbiter/v1/query.proto index 42067058..33472197 100644 --- a/proto/noble/orbiter/v1/query.proto +++ b/proto/noble/orbiter/v1/query.proto @@ -2,29 +2,7 @@ syntax = "proto3"; package noble.orbiter.v1; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos/query/v1/query.proto"; -import "google/api/annotations.proto"; - option go_package = "github.com/noble-assets/orbiter/types"; // Query defines the gRPC query service for the Orbiter module. -service Query { - rpc PendingPayloads(QueryPendingPayloadsRequest) returns (QueryPendingPayloadsResponse) { - option (cosmos.query.v1.module_query_safe) = true; - option (google.api.http).get = "/noble/orbiter/v1/pending-payloads"; - } -} - -message QueryPendingPayloadsRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -message QueryPendingPayloadsResponse { - // Hex-formatted hashes of the currently pending payloads - repeated string hashes = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} +service Query {} diff --git a/types/events.pb.go b/types/events.pb.go deleted file mode 100644 index 5ddc5d5a..00000000 --- a/types/events.pb.go +++ /dev/null @@ -1,612 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: noble/orbiter/v1/events.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - core "github.com/noble-assets/orbiter/types/core" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// EventPayloadSubmitted is emitted after successful submission of a payload. -type EventPayloadSubmitted struct { - // The keccak256 hash of the now pending payload. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - // The address that has submitted the payload. - Submitter string `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` - // The submitted payload. - Payload core.Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload"` -} - -func (m *EventPayloadSubmitted) Reset() { *m = EventPayloadSubmitted{} } -func (m *EventPayloadSubmitted) String() string { return proto.CompactTextString(m) } -func (*EventPayloadSubmitted) ProtoMessage() {} -func (*EventPayloadSubmitted) Descriptor() ([]byte, []int) { - return fileDescriptor_2255afc82d7db249, []int{0} -} -func (m *EventPayloadSubmitted) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPayloadSubmitted) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPayloadSubmitted.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventPayloadSubmitted) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPayloadSubmitted.Merge(m, src) -} -func (m *EventPayloadSubmitted) XXX_Size() int { - return m.Size() -} -func (m *EventPayloadSubmitted) XXX_DiscardUnknown() { - xxx_messageInfo_EventPayloadSubmitted.DiscardUnknown(m) -} - -var xxx_messageInfo_EventPayloadSubmitted proto.InternalMessageInfo - -func (m *EventPayloadSubmitted) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func (m *EventPayloadSubmitted) GetSubmitter() string { - if m != nil { - return m.Submitter - } - return "" -} - -func (m *EventPayloadSubmitted) GetPayload() core.Payload { - if m != nil { - return m.Payload - } - return core.Payload{} -} - -// EventPayloadRemoved is emitted after removing a pending payload from the queue. -type EventPayloadRemoved struct { - // The keccak256 hash of the removed payload. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` -} - -func (m *EventPayloadRemoved) Reset() { *m = EventPayloadRemoved{} } -func (m *EventPayloadRemoved) String() string { return proto.CompactTextString(m) } -func (*EventPayloadRemoved) ProtoMessage() {} -func (*EventPayloadRemoved) Descriptor() ([]byte, []int) { - return fileDescriptor_2255afc82d7db249, []int{1} -} -func (m *EventPayloadRemoved) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *EventPayloadRemoved) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_EventPayloadRemoved.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *EventPayloadRemoved) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventPayloadRemoved.Merge(m, src) -} -func (m *EventPayloadRemoved) XXX_Size() int { - return m.Size() -} -func (m *EventPayloadRemoved) XXX_DiscardUnknown() { - xxx_messageInfo_EventPayloadRemoved.DiscardUnknown(m) -} - -var xxx_messageInfo_EventPayloadRemoved proto.InternalMessageInfo - -func (m *EventPayloadRemoved) GetHash() []byte { - if m != nil { - return m.Hash - } - return nil -} - -func init() { - proto.RegisterType((*EventPayloadSubmitted)(nil), "noble.orbiter.v1.EventPayloadSubmitted") - proto.RegisterType((*EventPayloadRemoved)(nil), "noble.orbiter.v1.EventPayloadRemoved") -} - -func init() { proto.RegisterFile("noble/orbiter/v1/events.proto", fileDescriptor_2255afc82d7db249) } - -var fileDescriptor_2255afc82d7db249 = []byte{ - // 313 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0xcb, 0x4f, 0xca, - 0x49, 0xd5, 0xcf, 0x2f, 0x4a, 0xca, 0x2c, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, - 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0x4b, 0xeb, 0x41, 0xa5, - 0xf5, 0xca, 0x0c, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, - 0x64, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0x71, 0x3c, 0x98, 0xa7, 0x0f, 0xe1, 0x40, 0xa5, 0x44, 0xd2, - 0xf3, 0xd3, 0xf3, 0x21, 0xe2, 0x20, 0x16, 0x54, 0x54, 0x19, 0xd5, 0xd2, 0xe4, 0xfc, 0xa2, 0x54, - 0x90, 0xcd, 0x30, 0x5b, 0xc0, 0x8a, 0x94, 0x56, 0x30, 0x72, 0x89, 0xba, 0x82, 0xdc, 0x12, 0x90, - 0x58, 0x99, 0x93, 0x9f, 0x98, 0x12, 0x5c, 0x9a, 0x94, 0x9b, 0x59, 0x52, 0x92, 0x9a, 0x22, 0x24, - 0xc4, 0xc5, 0x92, 0x91, 0x58, 0x9c, 0x21, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x13, 0x04, 0x66, 0x0b, - 0x99, 0x71, 0x71, 0x16, 0x43, 0x15, 0x14, 0x49, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x3a, 0x49, 0x5c, - 0xda, 0xa2, 0x2b, 0x02, 0x75, 0x8d, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, - 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x90, 0x33, 0x17, 0x7b, 0x01, 0xc4, 0x7c, 0x09, 0x66, 0x05, - 0x46, 0x0d, 0x6e, 0x23, 0x39, 0x3d, 0x54, 0x2f, 0x83, 0x1c, 0xa7, 0x57, 0x66, 0xa8, 0x07, 0x75, - 0x85, 0x13, 0xe7, 0x89, 0x7b, 0xf2, 0x0c, 0x2b, 0x9e, 0x6f, 0xd0, 0x62, 0x0c, 0x82, 0xe9, 0x54, - 0xd2, 0xe4, 0x12, 0x46, 0x76, 0x69, 0x50, 0x6a, 0x6e, 0x7e, 0x19, 0x76, 0x77, 0x3a, 0xd9, 0x9f, - 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, - 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x6a, 0x7a, 0x66, 0x49, 0x46, 0x69, - 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xd8, 0x09, 0xba, 0x89, 0xc5, 0xc5, 0xa9, 0x25, 0xc5, 0xf0, - 0x60, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0x8e, 0x31, 0x20, 0x00, 0x00, 0xff, - 0xff, 0x86, 0xd6, 0x65, 0x2e, 0xb9, 0x01, 0x00, 0x00, -} - -func (m *EventPayloadSubmitted) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPayloadSubmitted) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPayloadSubmitted) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintEvents(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Submitter) > 0 { - i -= len(m.Submitter) - copy(dAtA[i:], m.Submitter) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Submitter))) - i-- - dAtA[i] = 0x12 - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *EventPayloadRemoved) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EventPayloadRemoved) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *EventPayloadRemoved) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintEvents(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { - offset -= sovEvents(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *EventPayloadSubmitted) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } - l = len(m.Submitter) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } - l = m.Payload.Size() - n += 1 + l + sovEvents(uint64(l)) - return n -} - -func (m *EventPayloadRemoved) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovEvents(uint64(l)) - } - return n -} - -func sovEvents(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozEvents(x uint64) (n int) { - return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *EventPayloadSubmitted) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventPayloadSubmitted: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventPayloadSubmitted: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEvents - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEvents - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Submitter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEvents - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvents(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EventPayloadRemoved) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EventPayloadRemoved: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EventPayloadRemoved: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEvents - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEvents - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEvents(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthEvents - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipEvents(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEvents - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEvents - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEvents - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthEvents - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupEvents - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthEvents - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") -) From 9770312fbc0928c77927666086a17d0b1e5112e5 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Fri, 10 Oct 2025 16:06:28 +0200 Subject: [PATCH 19/29] internalize state operations and expose one query for concrete payload with given hash --- api/v1/query.pulsar.go | 640 ++++++++++---------------- api/v1/query_grpc.pb.go | 30 +- keeper/keeper.go | 5 +- keeper/msg_server.go | 25 +- keeper/msg_server_test.go | 186 +++++++- keeper/payload_handler.go | 21 +- keeper/payload_handler_test.go | 308 +------------ keeper/query_server.go | 62 +++ keeper/query_server_test.go | 109 +++++ keeper/servers_registration.go | 2 + proto/noble/orbiter/v1/query.proto | 21 +- types/{interfaces.go => constants.go} | 15 +- types/query.pb.go | 289 +++++------- types/query.pb.gw.go | 70 +-- 14 files changed, 831 insertions(+), 952 deletions(-) create mode 100644 keeper/query_server.go create mode 100644 keeper/query_server_test.go rename types/{interfaces.go => constants.go} (67%) diff --git a/api/v1/query.pulsar.go b/api/v1/query.pulsar.go index 80087124..22b548eb 100644 --- a/api/v1/query.pulsar.go +++ b/api/v1/query.pulsar.go @@ -2,10 +2,10 @@ package orbiterv1 import ( - v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" _ "cosmossdk.io/api/cosmos/query/v1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" + v1 "github.com/noble-assets/orbiter/api/core/v1" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" @@ -16,25 +16,25 @@ import ( ) var ( - md_QueryPendingPayloadsRequest protoreflect.MessageDescriptor - fd_QueryPendingPayloadsRequest_pagination protoreflect.FieldDescriptor + md_QueryPendingPayloadRequest protoreflect.MessageDescriptor + fd_QueryPendingPayloadRequest_hash protoreflect.FieldDescriptor ) func init() { file_noble_orbiter_v1_query_proto_init() - md_QueryPendingPayloadsRequest = File_noble_orbiter_v1_query_proto.Messages().ByName("QueryPendingPayloadsRequest") - fd_QueryPendingPayloadsRequest_pagination = md_QueryPendingPayloadsRequest.Fields().ByName("pagination") + md_QueryPendingPayloadRequest = File_noble_orbiter_v1_query_proto.Messages().ByName("QueryPendingPayloadRequest") + fd_QueryPendingPayloadRequest_hash = md_QueryPendingPayloadRequest.Fields().ByName("hash") } -var _ protoreflect.Message = (*fastReflection_QueryPendingPayloadsRequest)(nil) +var _ protoreflect.Message = (*fastReflection_QueryPendingPayloadRequest)(nil) -type fastReflection_QueryPendingPayloadsRequest QueryPendingPayloadsRequest +type fastReflection_QueryPendingPayloadRequest QueryPendingPayloadRequest -func (x *QueryPendingPayloadsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryPendingPayloadsRequest)(x) +func (x *QueryPendingPayloadRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadRequest)(x) } -func (x *QueryPendingPayloadsRequest) slowProtoReflect() protoreflect.Message { +func (x *QueryPendingPayloadRequest) slowProtoReflect() protoreflect.Message { mi := &file_noble_orbiter_v1_query_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -46,43 +46,43 @@ func (x *QueryPendingPayloadsRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryPendingPayloadsRequest_messageType fastReflection_QueryPendingPayloadsRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryPendingPayloadsRequest_messageType{} +var _fastReflection_QueryPendingPayloadRequest_messageType fastReflection_QueryPendingPayloadRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryPendingPayloadRequest_messageType{} -type fastReflection_QueryPendingPayloadsRequest_messageType struct{} +type fastReflection_QueryPendingPayloadRequest_messageType struct{} -func (x fastReflection_QueryPendingPayloadsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryPendingPayloadsRequest)(nil) +func (x fastReflection_QueryPendingPayloadRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadRequest)(nil) } -func (x fastReflection_QueryPendingPayloadsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryPendingPayloadsRequest) +func (x fastReflection_QueryPendingPayloadRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadRequest) } -func (x fastReflection_QueryPendingPayloadsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryPendingPayloadsRequest +func (x fastReflection_QueryPendingPayloadRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPendingPayloadRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryPendingPayloadsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryPendingPayloadsRequest +func (x *fastReflection_QueryPendingPayloadRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPendingPayloadRequest } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryPendingPayloadsRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryPendingPayloadsRequest_messageType +func (x *fastReflection_QueryPendingPayloadRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryPendingPayloadRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryPendingPayloadsRequest) New() protoreflect.Message { - return new(fastReflection_QueryPendingPayloadsRequest) +func (x *fastReflection_QueryPendingPayloadRequest) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryPendingPayloadsRequest) Interface() protoreflect.ProtoMessage { - return (*QueryPendingPayloadsRequest)(x) +func (x *fastReflection_QueryPendingPayloadRequest) Interface() protoreflect.ProtoMessage { + return (*QueryPendingPayloadRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -90,10 +90,10 @@ func (x *fastReflection_QueryPendingPayloadsRequest) Interface() protoreflect.Pr // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryPendingPayloadsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Pagination != nil { - value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryPendingPayloadsRequest_pagination, value) { +func (x *fastReflection_QueryPendingPayloadRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Hash) != 0 { + value := protoreflect.ValueOfBytes(x.Hash) + if !f(fd_QueryPendingPayloadRequest_hash, value) { return } } @@ -110,15 +110,15 @@ func (x *fastReflection_QueryPendingPayloadsRequest) Range(f func(protoreflect.F // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryPendingPayloadsRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryPendingPayloadRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": - return x.Pagination != nil + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + return len(x.Hash) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest does not contain field %s", fd.FullName())) } } @@ -128,15 +128,15 @@ func (x *fastReflection_QueryPendingPayloadsRequest) Has(fd protoreflect.FieldDe // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryPendingPayloadsRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryPendingPayloadRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": - x.Pagination = nil + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + x.Hash = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest does not contain field %s", fd.FullName())) } } @@ -146,16 +146,16 @@ func (x *fastReflection_QueryPendingPayloadsRequest) Clear(fd protoreflect.Field // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryPendingPayloadsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryPendingPayloadRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": - value := x.Pagination - return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + value := x.Hash + return protoreflect.ValueOfBytes(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest does not contain field %s", descriptor.FullName())) } } @@ -169,15 +169,15 @@ func (x *fastReflection_QueryPendingPayloadsRequest) Get(descriptor protoreflect // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryPendingPayloadsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryPendingPayloadRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": - x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + x.Hash = value.Bytes() default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest does not contain field %s", fd.FullName())) } } @@ -191,44 +191,40 @@ func (x *fastReflection_QueryPendingPayloadsRequest) Set(fd protoreflect.FieldDe // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryPendingPayloadsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryPendingPayloadRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": - if x.Pagination == nil { - x.Pagination = new(v1beta1.PageRequest) - } - return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + panic(fmt.Errorf("field hash of message noble.orbiter.v1.QueryPendingPayloadRequest is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryPendingPayloadsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryPendingPayloadRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsRequest.pagination": - m := new(v1beta1.PageRequest) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + return protoreflect.ValueOfBytes(nil) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryPendingPayloadsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryPendingPayloadRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.QueryPendingPayloadsRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.QueryPendingPayloadRequest", d.FullName())) } panic("unreachable") } @@ -236,7 +232,7 @@ func (x *fastReflection_QueryPendingPayloadsRequest) WhichOneof(d protoreflect.O // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryPendingPayloadsRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryPendingPayloadRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -247,7 +243,7 @@ func (x *fastReflection_QueryPendingPayloadsRequest) GetUnknown() protoreflect.R // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryPendingPayloadsRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryPendingPayloadRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -259,7 +255,7 @@ func (x *fastReflection_QueryPendingPayloadsRequest) SetUnknown(fields protorefl // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryPendingPayloadsRequest) IsValid() bool { +func (x *fastReflection_QueryPendingPayloadRequest) IsValid() bool { return x != nil } @@ -269,9 +265,9 @@ func (x *fastReflection_QueryPendingPayloadsRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryPendingPayloadRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryPendingPayloadsRequest) + x := input.Message.Interface().(*QueryPendingPayloadRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -283,8 +279,8 @@ func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface. var n int var l int _ = l - if x.Pagination != nil { - l = options.Size(x.Pagination) + l = len(x.Hash) + if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -297,7 +293,7 @@ func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface. } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryPendingPayloadsRequest) + x := input.Message.Interface().(*QueryPendingPayloadRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -316,17 +312,10 @@ func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface. i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Pagination != nil { - encoded, err := options.Marshal(x.Pagination) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + if len(x.Hash) > 0 { + i -= len(x.Hash) + copy(dAtA[i:], x.Hash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) i-- dAtA[i] = 0xa } @@ -341,7 +330,7 @@ func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface. }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryPendingPayloadsRequest) + x := input.Message.Interface().(*QueryPendingPayloadRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -373,17 +362,17 @@ func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface. fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadsRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -393,26 +382,24 @@ func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface. } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.Pagination == nil { - x.Pagination = &v1beta1.PageRequest{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) + if x.Hash == nil { + x.Hash = []byte{} } iNdEx = postIndex default: @@ -450,74 +437,26 @@ func (x *fastReflection_QueryPendingPayloadsRequest) ProtoMethods() *protoiface. } } -var _ protoreflect.List = (*_QueryPendingPayloadsResponse_1_list)(nil) - -type _QueryPendingPayloadsResponse_1_list struct { - list *[]string -} - -func (x *_QueryPendingPayloadsResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_QueryPendingPayloadsResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_QueryPendingPayloadsResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_QueryPendingPayloadsResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_QueryPendingPayloadsResponse_1_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message QueryPendingPayloadsResponse at list field Hashes as it is not of Message kind")) -} - -func (x *_QueryPendingPayloadsResponse_1_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_QueryPendingPayloadsResponse_1_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_QueryPendingPayloadsResponse_1_list) IsValid() bool { - return x.list != nil -} - var ( - md_QueryPendingPayloadsResponse protoreflect.MessageDescriptor - fd_QueryPendingPayloadsResponse_hashes protoreflect.FieldDescriptor - fd_QueryPendingPayloadsResponse_pagination protoreflect.FieldDescriptor + md_QueryPendingPayloadResponse protoreflect.MessageDescriptor + fd_QueryPendingPayloadResponse_payload protoreflect.FieldDescriptor ) func init() { file_noble_orbiter_v1_query_proto_init() - md_QueryPendingPayloadsResponse = File_noble_orbiter_v1_query_proto.Messages().ByName("QueryPendingPayloadsResponse") - fd_QueryPendingPayloadsResponse_hashes = md_QueryPendingPayloadsResponse.Fields().ByName("hashes") - fd_QueryPendingPayloadsResponse_pagination = md_QueryPendingPayloadsResponse.Fields().ByName("pagination") + md_QueryPendingPayloadResponse = File_noble_orbiter_v1_query_proto.Messages().ByName("QueryPendingPayloadResponse") + fd_QueryPendingPayloadResponse_payload = md_QueryPendingPayloadResponse.Fields().ByName("payload") } -var _ protoreflect.Message = (*fastReflection_QueryPendingPayloadsResponse)(nil) +var _ protoreflect.Message = (*fastReflection_QueryPendingPayloadResponse)(nil) -type fastReflection_QueryPendingPayloadsResponse QueryPendingPayloadsResponse +type fastReflection_QueryPendingPayloadResponse QueryPendingPayloadResponse -func (x *QueryPendingPayloadsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryPendingPayloadsResponse)(x) +func (x *QueryPendingPayloadResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadResponse)(x) } -func (x *QueryPendingPayloadsResponse) slowProtoReflect() protoreflect.Message { +func (x *QueryPendingPayloadResponse) slowProtoReflect() protoreflect.Message { mi := &file_noble_orbiter_v1_query_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -529,43 +468,43 @@ func (x *QueryPendingPayloadsResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryPendingPayloadsResponse_messageType fastReflection_QueryPendingPayloadsResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryPendingPayloadsResponse_messageType{} +var _fastReflection_QueryPendingPayloadResponse_messageType fastReflection_QueryPendingPayloadResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryPendingPayloadResponse_messageType{} -type fastReflection_QueryPendingPayloadsResponse_messageType struct{} +type fastReflection_QueryPendingPayloadResponse_messageType struct{} -func (x fastReflection_QueryPendingPayloadsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryPendingPayloadsResponse)(nil) +func (x fastReflection_QueryPendingPayloadResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadResponse)(nil) } -func (x fastReflection_QueryPendingPayloadsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryPendingPayloadsResponse) +func (x fastReflection_QueryPendingPayloadResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadResponse) } -func (x fastReflection_QueryPendingPayloadsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryPendingPayloadsResponse +func (x fastReflection_QueryPendingPayloadResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPendingPayloadResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryPendingPayloadsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryPendingPayloadsResponse +func (x *fastReflection_QueryPendingPayloadResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryPendingPayloadResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryPendingPayloadsResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryPendingPayloadsResponse_messageType +func (x *fastReflection_QueryPendingPayloadResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryPendingPayloadResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryPendingPayloadsResponse) New() protoreflect.Message { - return new(fastReflection_QueryPendingPayloadsResponse) +func (x *fastReflection_QueryPendingPayloadResponse) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryPendingPayloadsResponse) Interface() protoreflect.ProtoMessage { - return (*QueryPendingPayloadsResponse)(x) +func (x *fastReflection_QueryPendingPayloadResponse) Interface() protoreflect.ProtoMessage { + return (*QueryPendingPayloadResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -573,16 +512,10 @@ func (x *fastReflection_QueryPendingPayloadsResponse) Interface() protoreflect.P // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryPendingPayloadsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Hashes) != 0 { - value := protoreflect.ValueOfList(&_QueryPendingPayloadsResponse_1_list{list: &x.Hashes}) - if !f(fd_QueryPendingPayloadsResponse_hashes, value) { - return - } - } - if x.Pagination != nil { - value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryPendingPayloadsResponse_pagination, value) { +func (x *fastReflection_QueryPendingPayloadResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Payload != nil { + value := protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) + if !f(fd_QueryPendingPayloadResponse_payload, value) { return } } @@ -599,17 +532,15 @@ func (x *fastReflection_QueryPendingPayloadsResponse) Range(f func(protoreflect. // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryPendingPayloadsResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryPendingPayloadResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": - return len(x.Hashes) != 0 - case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": - return x.Pagination != nil + case "noble.orbiter.v1.QueryPendingPayloadResponse.payload": + return x.Payload != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadResponse")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse does not contain field %s", fd.FullName())) } } @@ -619,17 +550,15 @@ func (x *fastReflection_QueryPendingPayloadsResponse) Has(fd protoreflect.FieldD // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryPendingPayloadsResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryPendingPayloadResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": - x.Hashes = nil - case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": - x.Pagination = nil + case "noble.orbiter.v1.QueryPendingPayloadResponse.payload": + x.Payload = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadResponse")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse does not contain field %s", fd.FullName())) } } @@ -639,22 +568,16 @@ func (x *fastReflection_QueryPendingPayloadsResponse) Clear(fd protoreflect.Fiel // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryPendingPayloadsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryPendingPayloadResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": - if len(x.Hashes) == 0 { - return protoreflect.ValueOfList(&_QueryPendingPayloadsResponse_1_list{}) - } - listValue := &_QueryPendingPayloadsResponse_1_list{list: &x.Hashes} - return protoreflect.ValueOfList(listValue) - case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": - value := x.Pagination + case "noble.orbiter.v1.QueryPendingPayloadResponse.payload": + value := x.Payload return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadResponse")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse does not contain field %s", descriptor.FullName())) } } @@ -668,19 +591,15 @@ func (x *fastReflection_QueryPendingPayloadsResponse) Get(descriptor protoreflec // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryPendingPayloadsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryPendingPayloadResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": - lv := value.List() - clv := lv.(*_QueryPendingPayloadsResponse_1_list) - x.Hashes = *clv.list - case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": - x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + case "noble.orbiter.v1.QueryPendingPayloadResponse.payload": + x.Payload = value.Message().Interface().(*v1.Payload) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadResponse")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse does not contain field %s", fd.FullName())) } } @@ -694,53 +613,44 @@ func (x *fastReflection_QueryPendingPayloadsResponse) Set(fd protoreflect.FieldD // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryPendingPayloadsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryPendingPayloadResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": - if x.Hashes == nil { - x.Hashes = []string{} - } - value := &_QueryPendingPayloadsResponse_1_list{list: &x.Hashes} - return protoreflect.ValueOfList(value) - case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": - if x.Pagination == nil { - x.Pagination = new(v1beta1.PageResponse) + case "noble.orbiter.v1.QueryPendingPayloadResponse.payload": + if x.Payload == nil { + x.Payload = new(v1.Payload) } - return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + return protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadResponse")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryPendingPayloadsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryPendingPayloadResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "noble.orbiter.v1.QueryPendingPayloadsResponse.hashes": - list := []string{} - return protoreflect.ValueOfList(&_QueryPendingPayloadsResponse_1_list{list: &list}) - case "noble.orbiter.v1.QueryPendingPayloadsResponse.pagination": - m := new(v1beta1.PageResponse) + case "noble.orbiter.v1.QueryPendingPayloadResponse.payload": + m := new(v1.Payload) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadResponse")) } - panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryPendingPayloadsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryPendingPayloadResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.QueryPendingPayloadsResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.QueryPendingPayloadResponse", d.FullName())) } panic("unreachable") } @@ -748,7 +658,7 @@ func (x *fastReflection_QueryPendingPayloadsResponse) WhichOneof(d protoreflect. // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryPendingPayloadsResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryPendingPayloadResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -759,7 +669,7 @@ func (x *fastReflection_QueryPendingPayloadsResponse) GetUnknown() protoreflect. // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryPendingPayloadsResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryPendingPayloadResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -771,7 +681,7 @@ func (x *fastReflection_QueryPendingPayloadsResponse) SetUnknown(fields protoref // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryPendingPayloadsResponse) IsValid() bool { +func (x *fastReflection_QueryPendingPayloadResponse) IsValid() bool { return x != nil } @@ -781,9 +691,9 @@ func (x *fastReflection_QueryPendingPayloadsResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryPendingPayloadResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryPendingPayloadsResponse) + x := input.Message.Interface().(*QueryPendingPayloadResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -795,14 +705,8 @@ func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface var n int var l int _ = l - if len(x.Hashes) > 0 { - for _, s := range x.Hashes { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.Pagination != nil { - l = options.Size(x.Pagination) + if x.Payload != nil { + l = options.Size(x.Payload) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -815,7 +719,7 @@ func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryPendingPayloadsResponse) + x := input.Message.Interface().(*QueryPendingPayloadResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -834,8 +738,8 @@ func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Pagination != nil { - encoded, err := options.Marshal(x.Pagination) + if x.Payload != nil { + encoded, err := options.Marshal(x.Payload) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -846,16 +750,7 @@ func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x12 - } - if len(x.Hashes) > 0 { - for iNdEx := len(x.Hashes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Hashes[iNdEx]) - copy(dAtA[i:], x.Hashes[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hashes[iNdEx]))) - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -868,7 +763,7 @@ func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryPendingPayloadsResponse) + x := input.Message.Interface().(*QueryPendingPayloadResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -900,47 +795,15 @@ func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadsResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryPendingPayloadResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hashes", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Hashes = append(x.Hashes, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -967,10 +830,10 @@ func (x *fastReflection_QueryPendingPayloadsResponse) ProtoMethods() *protoiface if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.Pagination == nil { - x.Pagination = &v1beta1.PageResponse{} + if x.Payload == nil { + x.Payload = &v1.Payload{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Payload); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -1022,17 +885,17 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type QueryPendingPayloadsRequest struct { +type QueryPendingPayloadRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // pagination defines an optional pagination for the request. - Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + // The keccak256 hash of the pending payload contents. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } -func (x *QueryPendingPayloadsRequest) Reset() { - *x = QueryPendingPayloadsRequest{} +func (x *QueryPendingPayloadRequest) Reset() { + *x = QueryPendingPayloadRequest{} if protoimpl.UnsafeEnabled { mi := &file_noble_orbiter_v1_query_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1040,37 +903,35 @@ func (x *QueryPendingPayloadsRequest) Reset() { } } -func (x *QueryPendingPayloadsRequest) String() string { +func (x *QueryPendingPayloadRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryPendingPayloadsRequest) ProtoMessage() {} +func (*QueryPendingPayloadRequest) ProtoMessage() {} -// Deprecated: Use QueryPendingPayloadsRequest.ProtoReflect.Descriptor instead. -func (*QueryPendingPayloadsRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryPendingPayloadRequest.ProtoReflect.Descriptor instead. +func (*QueryPendingPayloadRequest) Descriptor() ([]byte, []int) { return file_noble_orbiter_v1_query_proto_rawDescGZIP(), []int{0} } -func (x *QueryPendingPayloadsRequest) GetPagination() *v1beta1.PageRequest { +func (x *QueryPendingPayloadRequest) GetHash() []byte { if x != nil { - return x.Pagination + return x.Hash } return nil } -type QueryPendingPayloadsResponse struct { +type QueryPendingPayloadResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Hex-formatted hashes of the currently pending payloads - Hashes []string `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` - // pagination defines the pagination in the response. - Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + // The payload contents of the registered payload. + Payload *v1.Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` } -func (x *QueryPendingPayloadsResponse) Reset() { - *x = QueryPendingPayloadsResponse{} +func (x *QueryPendingPayloadResponse) Reset() { + *x = QueryPendingPayloadResponse{} if protoimpl.UnsafeEnabled { mi := &file_noble_orbiter_v1_query_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1078,27 +939,20 @@ func (x *QueryPendingPayloadsResponse) Reset() { } } -func (x *QueryPendingPayloadsResponse) String() string { +func (x *QueryPendingPayloadResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryPendingPayloadsResponse) ProtoMessage() {} +func (*QueryPendingPayloadResponse) ProtoMessage() {} -// Deprecated: Use QueryPendingPayloadsResponse.ProtoReflect.Descriptor instead. -func (*QueryPendingPayloadsResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryPendingPayloadResponse.ProtoReflect.Descriptor instead. +func (*QueryPendingPayloadResponse) Descriptor() ([]byte, []int) { return file_noble_orbiter_v1_query_proto_rawDescGZIP(), []int{1} } -func (x *QueryPendingPayloadsResponse) GetHashes() []string { +func (x *QueryPendingPayloadResponse) GetPayload() *v1.Payload { if x != nil { - return x.Hashes - } - return nil -} - -func (x *QueryPendingPayloadsResponse) GetPagination() *v1beta1.PageResponse { - if x != nil { - return x.Pagination + return x.Payload } return nil } @@ -1109,51 +963,45 @@ var file_noble_orbiter_v1_query_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, - 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x65, 0x0a, 0x1b, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7f, - 0x0a, 0x1c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x68, 0x61, 0x73, 0x68, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, - 0xab, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0xa1, 0x01, 0x0a, 0x0f, 0x50, 0x65, - 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x12, 0x2d, 0x2e, - 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6e, - 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x88, 0xe7, - 0xb0, 0x2a, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, - 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x65, 0x6e, - 0x64, 0x69, 0x6e, 0x67, 0x2d, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x42, 0xc4, 0x01, - 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, - 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, - 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, - 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x6f, 0x72, 0x62, 0x69, 0x74, - 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x58, 0xaa, 0x02, 0x10, 0x4e, 0x6f, 0x62, - 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, - 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, - 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1a, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, + 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x6e, 0x6f, 0x62, + 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x30, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, + 0x73, 0x68, 0x22, 0x57, 0x0a, 0x1b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, + 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x38, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, + 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x32, 0xa6, 0x01, 0x0a, 0x05, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x9c, 0x01, 0x0a, 0x0e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, + 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x2c, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, + 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, + 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x88, 0xe7, 0xb0, 0x2a, 0x01, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x22, 0x12, 0x20, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, + 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x7b, 0x68, + 0x61, 0x73, 0x68, 0x7d, 0x42, 0xc4, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x62, + 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, + 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, + 0x31, 0x3b, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, + 0x58, 0xaa, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, + 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, + 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, + 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, + 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1170,21 +1018,19 @@ func file_noble_orbiter_v1_query_proto_rawDescGZIP() []byte { var file_noble_orbiter_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_noble_orbiter_v1_query_proto_goTypes = []interface{}{ - (*QueryPendingPayloadsRequest)(nil), // 0: noble.orbiter.v1.QueryPendingPayloadsRequest - (*QueryPendingPayloadsResponse)(nil), // 1: noble.orbiter.v1.QueryPendingPayloadsResponse - (*v1beta1.PageRequest)(nil), // 2: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 3: cosmos.base.query.v1beta1.PageResponse + (*QueryPendingPayloadRequest)(nil), // 0: noble.orbiter.v1.QueryPendingPayloadRequest + (*QueryPendingPayloadResponse)(nil), // 1: noble.orbiter.v1.QueryPendingPayloadResponse + (*v1.Payload)(nil), // 2: noble.orbiter.core.v1.Payload } var file_noble_orbiter_v1_query_proto_depIdxs = []int32{ - 2, // 0: noble.orbiter.v1.QueryPendingPayloadsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 3, // 1: noble.orbiter.v1.QueryPendingPayloadsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 0, // 2: noble.orbiter.v1.Query.PendingPayloads:input_type -> noble.orbiter.v1.QueryPendingPayloadsRequest - 1, // 3: noble.orbiter.v1.Query.PendingPayloads:output_type -> noble.orbiter.v1.QueryPendingPayloadsResponse - 3, // [3:4] is the sub-list for method output_type - 2, // [2:3] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 2, // 0: noble.orbiter.v1.QueryPendingPayloadResponse.payload:type_name -> noble.orbiter.core.v1.Payload + 0, // 1: noble.orbiter.v1.Query.PendingPayload:input_type -> noble.orbiter.v1.QueryPendingPayloadRequest + 1, // 2: noble.orbiter.v1.Query.PendingPayload:output_type -> noble.orbiter.v1.QueryPendingPayloadResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_noble_orbiter_v1_query_proto_init() } @@ -1194,7 +1040,7 @@ func file_noble_orbiter_v1_query_proto_init() { } if !protoimpl.UnsafeEnabled { file_noble_orbiter_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryPendingPayloadsRequest); i { + switch v := v.(*QueryPendingPayloadRequest); i { case 0: return &v.state case 1: @@ -1206,7 +1052,7 @@ func file_noble_orbiter_v1_query_proto_init() { } } file_noble_orbiter_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryPendingPayloadsResponse); i { + switch v := v.(*QueryPendingPayloadResponse); i { case 0: return &v.state case 1: diff --git a/api/v1/query_grpc.pb.go b/api/v1/query_grpc.pb.go index 404ea816..017a76ac 100644 --- a/api/v1/query_grpc.pb.go +++ b/api/v1/query_grpc.pb.go @@ -19,7 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Query_PendingPayloads_FullMethodName = "/noble.orbiter.v1.Query/PendingPayloads" + Query_PendingPayload_FullMethodName = "/noble.orbiter.v1.Query/PendingPayload" ) // QueryClient is the client API for Query service. @@ -28,7 +28,7 @@ const ( // // Query defines the gRPC query service for the Orbiter module. type QueryClient interface { - PendingPayloads(ctx context.Context, in *QueryPendingPayloadsRequest, opts ...grpc.CallOption) (*QueryPendingPayloadsResponse, error) + PendingPayload(ctx context.Context, in *QueryPendingPayloadRequest, opts ...grpc.CallOption) (*QueryPendingPayloadResponse, error) } type queryClient struct { @@ -39,10 +39,10 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { return &queryClient{cc} } -func (c *queryClient) PendingPayloads(ctx context.Context, in *QueryPendingPayloadsRequest, opts ...grpc.CallOption) (*QueryPendingPayloadsResponse, error) { +func (c *queryClient) PendingPayload(ctx context.Context, in *QueryPendingPayloadRequest, opts ...grpc.CallOption) (*QueryPendingPayloadResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(QueryPendingPayloadsResponse) - err := c.cc.Invoke(ctx, Query_PendingPayloads_FullMethodName, in, out, cOpts...) + out := new(QueryPendingPayloadResponse) + err := c.cc.Invoke(ctx, Query_PendingPayload_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -55,7 +55,7 @@ func (c *queryClient) PendingPayloads(ctx context.Context, in *QueryPendingPaylo // // Query defines the gRPC query service for the Orbiter module. type QueryServer interface { - PendingPayloads(context.Context, *QueryPendingPayloadsRequest) (*QueryPendingPayloadsResponse, error) + PendingPayload(context.Context, *QueryPendingPayloadRequest) (*QueryPendingPayloadResponse, error) mustEmbedUnimplementedQueryServer() } @@ -66,8 +66,8 @@ type QueryServer interface { // pointer dereference when methods are called. type UnimplementedQueryServer struct{} -func (UnimplementedQueryServer) PendingPayloads(context.Context, *QueryPendingPayloadsRequest) (*QueryPendingPayloadsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PendingPayloads not implemented") +func (UnimplementedQueryServer) PendingPayload(context.Context, *QueryPendingPayloadRequest) (*QueryPendingPayloadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PendingPayload not implemented") } func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} func (UnimplementedQueryServer) testEmbeddedByValue() {} @@ -90,20 +90,20 @@ func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { s.RegisterService(&Query_ServiceDesc, srv) } -func _Query_PendingPayloads_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPendingPayloadsRequest) +func _Query_PendingPayload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPendingPayloadRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).PendingPayloads(ctx, in) + return srv.(QueryServer).PendingPayload(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Query_PendingPayloads_FullMethodName, + FullMethod: Query_PendingPayload_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PendingPayloads(ctx, req.(*QueryPendingPayloadsRequest)) + return srv.(QueryServer).PendingPayload(ctx, req.(*QueryPendingPayloadRequest)) } return interceptor(ctx, in, info, handler) } @@ -116,8 +116,8 @@ var Query_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "PendingPayloads", - Handler: _Query_PendingPayloads_Handler, + MethodName: "PendingPayload", + Handler: _Query_PendingPayload_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/keeper/keeper.go b/keeper/keeper.go index 3ab12a3c..a0d96245 100644 --- a/keeper/keeper.go +++ b/keeper/keeper.go @@ -40,10 +40,7 @@ import ( "github.com/noble-assets/orbiter/types/core" ) -var ( - _ orbitertypes.Authorizer = &Keeper{} - _ orbitertypes.PendingPayloadsHandler = &Keeper{} -) +var _ orbitertypes.Authorizer = &Keeper{} // Keeper is the main module keeper. type Keeper struct { diff --git a/keeper/msg_server.go b/keeper/msg_server.go index ad02dc82..73666408 100644 --- a/keeper/msg_server.go +++ b/keeper/msg_server.go @@ -23,7 +23,8 @@ package keeper import ( "context" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" orbitertypes "github.com/noble-assets/orbiter/types" "github.com/noble-assets/orbiter/types/core" @@ -45,21 +46,33 @@ func (s *msgServer) SubmitPayload( ctx context.Context, req *orbitertypes.MsgSubmitPayload, ) (*orbitertypes.MsgSubmitPayloadResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + var payload core.Payload if err := orbitertypes.UnmarshalJSON(s.cdc, []byte(req.Payload), &payload); err != nil { - return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error()) + return nil, status.Errorf(codes.InvalidArgument, "failed to unmarshal payload: %s", err) + } + + if err := payload.Validate(); err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid payload: %s", err) } - if err := (&payload).Validate(); err != nil { - return nil, sdkerrors.ErrInvalidRequest.Wrap(err.Error()) + if err := s.validatePayloadAgainstState(ctx, &payload); err != nil { + return nil, status.Errorf( + codes.FailedPrecondition, + "payload failed stateful checks: %s", + err, + ) } - payloadHash, err := s.Submit( + payloadHash, err := s.submit( ctx, &payload, ) if err != nil { - return nil, core.ErrSubmitPayload.Wrap(err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } return &orbitertypes.MsgSubmitPayloadResponse{ diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go index eef8250d..81f63771 100644 --- a/keeper/msg_server_test.go +++ b/keeper/msg_server_test.go @@ -22,39 +22,114 @@ package keeper_test import ( "context" + "encoding/hex" "testing" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" orbiterkeeper "github.com/noble-assets/orbiter/keeper" + "github.com/noble-assets/orbiter/testutil" mockorbiter "github.com/noble-assets/orbiter/testutil/mocks/orbiter" orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/controller/action" + "github.com/noble-assets/orbiter/types/controller/forwarding" "github.com/noble-assets/orbiter/types/core" ) func TestSubmitPayload(t *testing.T) { seq := uint64(0) - validPayload := createTestPendingPayloadWithSequence(t, seq) + examplePayload := createTestPendingPayloadWithSequence(t, seq) - expHash, err := validPayload.Keccak256Hash() + exampleHash, err := examplePayload.Keccak256Hash() require.NoError(t, err, "failed to hash payload") + destDomain := uint32(1) + recipient := testutil.RandomBytes(32) + testcases := []struct { name string setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) - payload *core.Payload + payload func() *core.Payload errContains string expHash string }{ { name: "success - valid payload", - payload: validPayload.Payload, - expHash: expHash.String(), + payload: func() *core.Payload { return examplePayload.Payload }, + expHash: exampleHash.String(), + }, + { + name: "error - payload contains paused action", + setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { + t.Helper() + + err := k.Executor().Pause(ctx, core.ACTION_FEE) + require.NoError(t, err, "failed to pause fee action") + }, + payload: func() *core.Payload { + p := *examplePayload.Payload + + preAction, err := core.NewAction(core.ACTION_FEE, &action.FeeAttributes{}) + require.NoError(t, err, "failed to construct fee action") + + p.PreActions = append( + p.PreActions, + preAction, + ) + + return &p + }, + errContains: "action ACTION_FEE is paused", + }, + { + name: "error - payload contains paused protocol", + setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { + t.Helper() + + err := k.Forwarder().Pause(ctx, core.PROTOCOL_CCTP, nil) + require.NoError(t, err, "failed to unpause fee action") + }, + payload: func() *core.Payload { + p := *examplePayload.Payload + + fw, err := forwarding.NewCCTPForwarding(destDomain, recipient, nil, nil) + require.NoError(t, err, "failed to construct forwarding") + + p.Forwarding = fw + + return &p + }, + errContains: "protocol PROTOCOL_CCTP is paused", + }, + { + name: "error - payload contains paused cross-chain", + setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { + t.Helper() + + cID := (&forwarding.CCTPAttributes{ + DestinationDomain: destDomain, + MintRecipient: recipient, + }).CounterpartyID() + + err = k.Forwarder().Pause(ctx, core.PROTOCOL_CCTP, []string{cID}) + require.NoError(t, err, "failed to unpause cross-chain forwarding") + }, + payload: func() *core.Payload { + p := *examplePayload.Payload + + fw, err := forwarding.NewCCTPForwarding(destDomain, recipient, nil, nil) + require.NoError(t, err, "failed to construct forwarding") + + p.Forwarding = fw + + return &p + }, + errContains: "cross-chain 2:1 is paused", }, { name: "error - invalid (empty) payload", - payload: &core.Payload{}, + payload: func() *core.Payload { return &core.Payload{} }, errContains: "forwarding is not set: invalid nil pointer", }, } @@ -68,14 +143,14 @@ func TestSubmitPayload(t *testing.T) { tc.setup(t, ctx, k) } - payloadJSON, err := orbitertypes.MarshalJSON(k.Codec(), tc.payload) + payloadJSON, err := orbitertypes.MarshalJSON(k.Codec(), tc.payload()) require.NoError(t, err, "failed to marshal payload") res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ Payload: string(payloadJSON), }) if tc.errContains == "" { - require.NoError(t, err, "failed to accept payload") + require.NoError(t, err, "failed to submit payload") require.Equal(t, tc.expHash, ethcommon.BytesToHash(res.Hash).String()) } else { require.ErrorContains(t, err, tc.errContains, "expected different error") @@ -83,3 +158,98 @@ func TestSubmitPayload(t *testing.T) { }) } } + +// TestSubsequentSubmissions asserts that two subsequently submitted +// identical orbiter payloads generate different hashes so that they can +// be uniquely identified. +func TestSubsequentSubmissions(t *testing.T) { + ctx, _, k := mockorbiter.OrbiterKeeper(t) + ms := orbiterkeeper.NewMsgServer(k) + + validPayload := createTestPendingPayloadWithSequence(t, 0) + expHash, err := validPayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + validPayloadJSON, err := orbitertypes.MarshalJSON(k.Codec(), validPayload.Payload) + require.NoError(t, err, "failed to marshal payload into json") + + // ACT: submit first payload + res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Signer: testutil.NewNobleAddress(), + Payload: string(validPayloadJSON), + }) + require.NoError(t, err, "failed to submit payload") + + // ASSERT: expected hash is returned + gotHash := hex.EncodeToString(res.Hash) + require.Equal(t, hex.EncodeToString(expHash.Bytes()), gotHash, "expected different hash") + + // ACT: submit identical payload again + res2, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Signer: testutil.NewNobleAddress(), + Payload: string(validPayloadJSON), + }) + require.NoError(t, err, "failed to submit payload") + + validPayload.Sequence = uint64(1) + expHash2, err := validPayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + // ASSERT: expected hash is returned + gotHash2 := hex.EncodeToString(res2.Hash) + require.Equal(t, hex.EncodeToString(expHash2.Bytes()), gotHash2, "expected different hash") + + // ASSERT: hashes of subsequent submissions of the same payload are different + require.NotEqual(t, gotHash, gotHash2, "expected different hashes") +} + +func TestDifferentSequenceGeneratesDifferentHash(t *testing.T) { + // ACT: Generate pending payload with sequence 1 + seq := uint64(1) + validForwarding := createTestPendingPayloadWithSequence(t, seq) + expHash, err := validForwarding.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + // ACT: Generate pending payload with sequence 2 + validForwarding2 := createTestPendingPayloadWithSequence(t, seq+1) + expHash2, err := validForwarding2.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + // ASSERT: hash 1 and hash 2 are NOT equal + require.NotEqual( + t, + hex.EncodeToString(expHash.Bytes()), + hex.EncodeToString(expHash2.Bytes()), + "expected different hash", + ) +} + +// createTestPendingPayloadWithSequence creates a new example payload that can be submitted +// to the state handler. +func createTestPendingPayloadWithSequence( + t *testing.T, + sequence uint64, +) *core.PendingPayload { + t.Helper() + + recipient := make([]byte, 32) + copy(recipient[32-3:], []byte{1, 2, 3}) + + validForwarding, err := forwarding.NewCCTPForwarding( + 0, + recipient, + recipient, + nil, + ) + require.NoError(t, err, "failed to create valid forwarding") + + validPayload := &core.Payload{ + PreActions: nil, + Forwarding: validForwarding, + } + + return &core.PendingPayload{ + Sequence: sequence, + Payload: validPayload, + } +} diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go index c037e6bd..68536900 100644 --- a/keeper/payload_handler.go +++ b/keeper/payload_handler.go @@ -28,26 +28,17 @@ import ( errorsmod "cosmossdk.io/errors" - orbitertypes "github.com/noble-assets/orbiter/types" "github.com/noble-assets/orbiter/types/core" ) -var _ orbitertypes.PendingPayloadsHandler = &Keeper{} - -// Submit adds a new pending payload into the module storage. +// submit adds a new pending payload into the module storage. // If the payload's hash is already set, an error is returned. -func (k *Keeper) Submit( +// +// CONTRACT: The payload MUST be validated before using this method. +func (k *Keeper) submit( ctx context.Context, payload *core.Payload, ) ([]byte, error) { - if err := payload.Validate(); err != nil { - return nil, errorsmod.Wrap(err, "invalid payload") - } - - if err := k.validatePayloadAgainstState(ctx, payload); err != nil { - return nil, errorsmod.Wrap(err, "payload failed stateful checks") - } - next, err := k.pendingPayloadsSequence.Next(ctx) if err != nil { return nil, errorsmod.Wrap(err, "failed to get next sequence number") @@ -135,9 +126,9 @@ func (k *Keeper) validatePayloadAgainstState( return nil } -// PendingPayload returns the pending payload with the given hash +// pendingPayload returns the pending payload with the given hash // if it is found in the module storage. -func (k *Keeper) PendingPayload( +func (k *Keeper) pendingPayload( ctx context.Context, hash []byte, ) (*core.PendingPayload, error) { diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index 46f2a0ec..58ad3e86 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -26,194 +26,15 @@ import ( "fmt" "testing" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" + orbiterkeeper "github.com/noble-assets/orbiter/keeper" - "github.com/noble-assets/orbiter/testutil" mockorbiter "github.com/noble-assets/orbiter/testutil/mocks/orbiter" orbitertypes "github.com/noble-assets/orbiter/types" - "github.com/noble-assets/orbiter/types/controller/action" - "github.com/noble-assets/orbiter/types/controller/forwarding" - "github.com/noble-assets/orbiter/types/core" ) -func TestSubmit(t *testing.T) { - seq := uint64(0) - destDomain := uint32(1) - recipient := testutil.RandomBytes(32) - validPayload := createTestPendingPayloadWithSequence(t, seq) - - expHash, err := validPayload.Keccak256Hash() - require.NoError(t, err, "failed to hash payload") - - testcases := []struct { - name string - setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) - payload func() *core.PendingPayload - errContains string - expHash string - }{ - { - name: "success - valid payload", - payload: func() *core.PendingPayload { return validPayload }, - expHash: expHash.String(), - }, - { - name: "error - payload contains paused action", - setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { - t.Helper() - - err := k.Executor().Pause(ctx, core.ACTION_FEE) - require.NoError(t, err, "failed to pause fee action") - }, - payload: func() *core.PendingPayload { - p := *validPayload - - preAction, err := core.NewAction(core.ACTION_FEE, &action.FeeAttributes{}) - require.NoError(t, err, "failed to construct fee action") - - p.Payload.PreActions = append( - p.Payload.PreActions, - preAction, - ) - - return &p - }, - errContains: "action ACTION_FEE is paused", - }, - { - name: "error - payload contains paused protocol", - setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { - t.Helper() - - err := k.Forwarder().Pause(ctx, core.PROTOCOL_CCTP, nil) - require.NoError(t, err, "failed to unpause fee action") - }, - payload: func() *core.PendingPayload { - p := *validPayload - - fw, err := forwarding.NewCCTPForwarding(destDomain, recipient, nil, nil) - require.NoError(t, err, "failed to construct forwarding") - - p.Payload.Forwarding = fw - - return &p - }, - errContains: "protocol PROTOCOL_CCTP is paused", - }, - { - name: "error - payload contains paused cross-chain", - setup: func(t *testing.T, ctx context.Context, k *orbiterkeeper.Keeper) { - t.Helper() - - cID := (&forwarding.CCTPAttributes{ - DestinationDomain: destDomain, - MintRecipient: recipient, - }).CounterpartyID() - - err = k.Forwarder().Pause(ctx, core.PROTOCOL_CCTP, []string{cID}) - require.NoError(t, err, "failed to unpause cross-chain forwarding") - }, - payload: func() *core.PendingPayload { - p := *validPayload - - fw, err := forwarding.NewCCTPForwarding(destDomain, recipient, nil, nil) - require.NoError(t, err, "failed to construct forwarding") - - p.Payload.Forwarding = fw - - return &p - }, - errContains: "cross-chain 2:1 is paused", - }, - { - name: "error - invalid (empty) payload", - payload: func() *core.PendingPayload { - return &core.PendingPayload{Payload: &core.Payload{}} - }, - errContains: "forwarding is not set: invalid nil pointer", - }, - } - - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - ctx, _, k := mockorbiter.OrbiterKeeper(t) - - if tc.setup != nil { - tc.setup(t, ctx, k) - } - - pendingPayload := tc.payload() - - gotHash, err := k.Submit(ctx, pendingPayload.Payload) - if tc.errContains == "" { - require.NoError(t, err, "failed to accept payload") - - // ASSERT: expected hash returned - require.Equal(t, tc.expHash, ethcommon.BytesToHash(gotHash).String()) - } else { - require.ErrorContains(t, err, tc.errContains, "expected different error") - } - }) - } -} - -func TestGetPendingPayloadWithHash(t *testing.T) { - t.Parallel() - - validPayload := createTestPendingPayloadWithSequence(t, 0) - expHash, err := validPayload.Keccak256Hash() - require.NoError(t, err, "failed to hash payload") - - testcases := []struct { - name string - setup func(*testing.T, context.Context, orbitertypes.PendingPayloadsHandler) - hash []byte - expPayload *core.PendingPayload - errContains string - }{ - { - name: "success - hash found", - setup: func(t *testing.T, ctx context.Context, handler orbitertypes.PendingPayloadsHandler) { - t.Helper() - - _, err := handler.Submit(ctx, validPayload.Payload) - require.NoError(t, err) - }, - expPayload: validPayload, - hash: expHash.Bytes(), - }, - { - name: "error - hash not found", - setup: nil, - expPayload: validPayload, - errContains: "pending payload not found", - }, - } - - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - - ctx, _, k := mockorbiter.OrbiterKeeper(t) - - if tc.setup != nil { - tc.setup(t, ctx, k) - } - - got, err := k.PendingPayload(ctx, tc.hash) - - if tc.errContains == "" { - require.NoError(t, err, "failed to get pending payload") - require.Equal(t, tc.expPayload.String(), got.String(), "expected different payload") - } else { - require.ErrorContains(t, err, tc.errContains, "expected different error") - } - }) - } -} - func TestRemovePayload(t *testing.T) { t.Parallel() @@ -223,25 +44,22 @@ func TestRemovePayload(t *testing.T) { testcases := []struct { name string - setup func(*testing.T, context.Context, orbitertypes.PendingPayloadsHandler) + setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) hash []byte errContains string }{ { name: "success - valid payload", - setup: func(t *testing.T, ctx context.Context, handler orbitertypes.PendingPayloadsHandler) { + setup: func(t *testing.T, ctx context.Context, cdc codec.Codec, ms orbitertypes.MsgServer) { t.Helper() - _, err := handler.Submit(ctx, validPayload.Payload) - require.NoError(t, err, "failed to setup testcase; accepting payload") - gotPayload, err := handler.PendingPayload(ctx, expHash.Bytes()) - require.NoError(t, err, "error getting pending payload") - require.Equal( - t, - validPayload.String(), - gotPayload.String(), - "expected different payload", - ) + bz, err := cdc.MarshalJSON(validPayload.Payload) + require.NoError(t, err, "failed to marshal payload") + + _, err = ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Payload: string(bz), + }) + require.NoError(t, err, "failed to setup testcase; accepting payload") }, hash: expHash.Bytes(), }, @@ -267,9 +85,11 @@ func TestRemovePayload(t *testing.T) { t.Parallel() ctx, _, k := mockorbiter.OrbiterKeeper(t) + ms := orbiterkeeper.NewMsgServer(k) + qs := orbiterkeeper.NewQueryServer(k) if tc.setup != nil { - tc.setup(t, ctx, k) + tc.setup(t, ctx, k.Codec(), ms) } err := k.RemovePendingPayload(ctx, tc.hash) @@ -277,7 +97,10 @@ func TestRemovePayload(t *testing.T) { require.NoError(t, err, "failed to remove payload") // ASSERT: value with hash was removed. - gotPayload, err := k.PendingPayload(ctx, tc.hash) + gotPayload, err := qs.PendingPayload( + ctx, + &orbitertypes.QueryPendingPayloadRequest{Hash: tc.hash}, + ) require.Error(t, err, "payload should not be present anymore") require.Nil(t, gotPayload, "expected nil payload") } else { @@ -286,98 +109,3 @@ func TestRemovePayload(t *testing.T) { }) } } - -// TestSubsequentSubmissions asserts that two subsequently submitted -// identical orbiter payloads generate different hashes so that they can -// be uniquely identified. -func TestSubsequentSubmissions(t *testing.T) { - ctx, _, k := mockorbiter.OrbiterKeeper(t) - ms := orbiterkeeper.NewMsgServer(k) - - validPayload := createTestPendingPayloadWithSequence(t, 0) - expHash, err := validPayload.Keccak256Hash() - require.NoError(t, err, "failed to hash payload") - - validPayloadJSON, err := orbitertypes.MarshalJSON(k.Codec(), validPayload.Payload) - require.NoError(t, err, "failed to marshal payload into json") - - // ACT: submit first payload - res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ - Signer: testutil.NewNobleAddress(), - Payload: string(validPayloadJSON), - }) - require.NoError(t, err, "failed to submit payload") - - // ASSERT: expected hash is returned - gotHash := hex.EncodeToString(res.Hash) - require.Equal(t, hex.EncodeToString(expHash.Bytes()), gotHash, "expected different hash") - - // ACT: submit identical payload again - res2, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ - Signer: testutil.NewNobleAddress(), - Payload: string(validPayloadJSON), - }) - require.NoError(t, err, "failed to submit payload") - - validPayload.Sequence = uint64(1) - expHash2, err := validPayload.Keccak256Hash() - require.NoError(t, err, "failed to hash payload") - - // ASSERT: expected hash is returned - gotHash2 := hex.EncodeToString(res2.Hash) - require.Equal(t, hex.EncodeToString(expHash2.Bytes()), gotHash2, "expected different hash") - - // ASSERT: hashes of subsequent submissions of the same payload are different - require.NotEqual(t, gotHash, gotHash2, "expected different hashes") -} - -func TestDifferentSequenceGeneratesDifferentHash(t *testing.T) { - // ACT: Generate pending payload with sequence 1 - seq := uint64(1) - validForwarding := createTestPendingPayloadWithSequence(t, seq) - expHash, err := validForwarding.Keccak256Hash() - require.NoError(t, err, "failed to hash payload") - - // ACT: Generate pending payload with sequence 2 - validForwarding2 := createTestPendingPayloadWithSequence(t, seq+1) - expHash2, err := validForwarding2.Keccak256Hash() - require.NoError(t, err, "failed to hash payload") - - // ASSERT: hash 1 and hash 2 are NOT equal - require.NotEqual( - t, - hex.EncodeToString(expHash.Bytes()), - hex.EncodeToString(expHash2.Bytes()), - "expected different hash", - ) -} - -// createTestPendingPayloadWithSequence creates a new example payload that can be submitted -// to the state handler. -func createTestPendingPayloadWithSequence( - t *testing.T, - sequence uint64, -) *core.PendingPayload { - t.Helper() - - recipient := make([]byte, 32) - copy(recipient[32-3:], []byte{1, 2, 3}) - - validForwarding, err := forwarding.NewCCTPForwarding( - 0, - recipient, - recipient, - nil, - ) - require.NoError(t, err, "failed to create valid forwarding") - - validPayload := &core.Payload{ - PreActions: nil, - Forwarding: validForwarding, - } - - return &core.PendingPayload{ - Sequence: sequence, - Payload: validPayload, - } -} diff --git a/keeper/query_server.go b/keeper/query_server.go new file mode 100644 index 00000000..4baa861f --- /dev/null +++ b/keeper/query_server.go @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper + +import ( + "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + orbitertypes "github.com/noble-assets/orbiter/types" +) + +var _ orbitertypes.QueryServer = &queryServer{} + +type queryServer struct { + *Keeper +} + +func NewQueryServer(k *Keeper) orbitertypes.QueryServer { + return &queryServer{Keeper: k} +} + +func (s queryServer) PendingPayload( + ctx context.Context, + req *orbitertypes.QueryPendingPayloadRequest, +) (*orbitertypes.QueryPendingPayloadResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if len(req.Hash) != orbitertypes.PayloadHashLength { + return nil, status.Error(codes.InvalidArgument, "malformed hash") + } + + payload, err := s.pendingPayload(ctx, req.Hash) + if err != nil { + return nil, status.Error(codes.NotFound, "payload not found") + } + + return &orbitertypes.QueryPendingPayloadResponse{ + Payload: payload.Payload, + }, nil +} diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go new file mode 100644 index 00000000..0bc40780 --- /dev/null +++ b/keeper/query_server_test.go @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + + "github.com/cosmos/cosmos-sdk/codec" + + orbiterkeeper "github.com/noble-assets/orbiter/keeper" + mockorbiter "github.com/noble-assets/orbiter/testutil/mocks/orbiter" + orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/core" +) + +func TestPendingPayload(t *testing.T) { + t.Parallel() + + examplePayload := createTestPendingPayloadWithSequence(t, 0) + exampleHash, err := examplePayload.Keccak256Hash() + require.NoError(t, err, "failed to hash payload") + + testcases := []struct { + name string + setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) + hash []byte + expPayload *core.PendingPayload + errContains string + }{ + { + name: "success - hash found", + setup: func(t *testing.T, ctx context.Context, cdc codec.Codec, ms orbitertypes.MsgServer) { + t.Helper() + + bz, err := cdc.MarshalJSON(examplePayload.Payload) + require.NoError(t, err, "failed to marshal payload") + + _, err = ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Payload: string(bz), + }) + require.NoError(t, err) + }, + expPayload: examplePayload, + hash: exampleHash.Bytes(), + }, + { + name: "error - hash not found", + setup: nil, + hash: exampleHash.Bytes(), + expPayload: examplePayload, + errContains: codes.NotFound.String(), + }, + { + name: "error - nil hash", + setup: nil, + hash: nil, + errContains: codes.InvalidArgument.String(), + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + ctx, _, k := mockorbiter.OrbiterKeeper(t) + ms := orbiterkeeper.NewMsgServer(k) + qs := orbiterkeeper.NewQueryServer(k) + + if tc.setup != nil { + tc.setup(t, ctx, k.Codec(), ms) + } + + got, err := qs.PendingPayload( + ctx, + &orbitertypes.QueryPendingPayloadRequest{ + Hash: tc.hash, + }) + + if tc.errContains == "" { + require.NoError(t, err, "failed to get pending payload") + require.Equal(t, tc.expPayload.String(), got.String(), "expected different payload") + } else { + require.ErrorContains(t, err, tc.errContains, "expected different error") + } + }) + } +} diff --git a/keeper/servers_registration.go b/keeper/servers_registration.go index 2294ff4b..6fb182eb 100644 --- a/keeper/servers_registration.go +++ b/keeper/servers_registration.go @@ -51,6 +51,8 @@ func RegisterMsgServers(cfg module.Configurator, k *Keeper) { func RegisterQueryServers(cfg module.Configurator, k *Keeper) { qs := cfg.QueryServer() + orbitertypes.RegisterQueryServer(qs, NewQueryServer(k)) + forwardertypes.RegisterQueryServer(qs, forwarder.NewQueryServer(k.forwarder)) executortypes.RegisterQueryServer(qs, executor.NewQueryServer(k.executor)) adaptertypes.RegisterQueryServer(qs, adapter.NewQueryServer(k.adapter)) diff --git a/proto/noble/orbiter/v1/query.proto b/proto/noble/orbiter/v1/query.proto index 33472197..f3ebea95 100644 --- a/proto/noble/orbiter/v1/query.proto +++ b/proto/noble/orbiter/v1/query.proto @@ -2,7 +2,26 @@ syntax = "proto3"; package noble.orbiter.v1; +import "cosmos/query/v1/query.proto"; +import "google/api/annotations.proto"; +import "noble/orbiter/core/v1/orbiter.proto"; + option go_package = "github.com/noble-assets/orbiter/types"; // Query defines the gRPC query service for the Orbiter module. -service Query {} +service Query { + rpc PendingPayload(QueryPendingPayloadRequest) returns (QueryPendingPayloadResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/noble/orbiter/v1/payload/{hash}"; + } +} + +message QueryPendingPayloadRequest { + // The keccak256 hash of the pending payload contents. + bytes hash = 1; +} + +message QueryPendingPayloadResponse { + // The payload contents of the registered payload. + noble.orbiter.core.v1.Payload payload = 1; +} diff --git a/types/interfaces.go b/types/constants.go similarity index 67% rename from types/interfaces.go rename to types/constants.go index 67806247..26f47395 100644 --- a/types/interfaces.go +++ b/types/constants.go @@ -20,16 +20,5 @@ package types -import ( - "context" - - "github.com/noble-assets/orbiter/types/core" -) - -// PendingPayloadsHandler defines the interface to adjust and query the Orbiter module -// state as it relates to the bookkeeping of pending payloads. -type PendingPayloadsHandler interface { - Submit(ctx context.Context, payload *core.Payload) ([]byte, error) - RemovePendingPayload(ctx context.Context, hash []byte) error - PendingPayload(ctx context.Context, hash []byte) (*core.PendingPayload, error) -} +// PayloadHashLength specifies the expected length of Orbiter payload hashes. +const PayloadHashLength = 32 diff --git a/types/query.pb.go b/types/query.pb.go index 8d1967e9..a2ccc9d2 100644 --- a/types/query.pb.go +++ b/types/query.pb.go @@ -6,9 +6,10 @@ package types import ( context "context" fmt "fmt" - query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/cosmos-sdk/types/query" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + core "github.com/noble-assets/orbiter/types/core" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -29,23 +30,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type QueryPendingPayloadsRequest struct { - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryPendingPayloadRequest struct { + // The keccak256 hash of the pending payload contents. + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } -func (m *QueryPendingPayloadsRequest) Reset() { *m = QueryPendingPayloadsRequest{} } -func (m *QueryPendingPayloadsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPendingPayloadsRequest) ProtoMessage() {} -func (*QueryPendingPayloadsRequest) Descriptor() ([]byte, []int) { +func (m *QueryPendingPayloadRequest) Reset() { *m = QueryPendingPayloadRequest{} } +func (m *QueryPendingPayloadRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPayloadRequest) ProtoMessage() {} +func (*QueryPendingPayloadRequest) Descriptor() ([]byte, []int) { return fileDescriptor_390782105f057f99, []int{0} } -func (m *QueryPendingPayloadsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryPendingPayloadRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPendingPayloadsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryPendingPayloadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPendingPayloadsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryPendingPayloadRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -55,44 +56,42 @@ func (m *QueryPendingPayloadsRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryPendingPayloadsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPendingPayloadsRequest.Merge(m, src) +func (m *QueryPendingPayloadRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPayloadRequest.Merge(m, src) } -func (m *QueryPendingPayloadsRequest) XXX_Size() int { +func (m *QueryPendingPayloadRequest) XXX_Size() int { return m.Size() } -func (m *QueryPendingPayloadsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPendingPayloadsRequest.DiscardUnknown(m) +func (m *QueryPendingPayloadRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPayloadRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryPendingPayloadsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryPendingPayloadRequest proto.InternalMessageInfo -func (m *QueryPendingPayloadsRequest) GetPagination() *query.PageRequest { +func (m *QueryPendingPayloadRequest) GetHash() []byte { if m != nil { - return m.Pagination + return m.Hash } return nil } -type QueryPendingPayloadsResponse struct { - // Hex-formatted hashes of the currently pending payloads - Hashes []string `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +type QueryPendingPayloadResponse struct { + // The payload contents of the registered payload. + Payload *core.Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` } -func (m *QueryPendingPayloadsResponse) Reset() { *m = QueryPendingPayloadsResponse{} } -func (m *QueryPendingPayloadsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPendingPayloadsResponse) ProtoMessage() {} -func (*QueryPendingPayloadsResponse) Descriptor() ([]byte, []int) { +func (m *QueryPendingPayloadResponse) Reset() { *m = QueryPendingPayloadResponse{} } +func (m *QueryPendingPayloadResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPayloadResponse) ProtoMessage() {} +func (*QueryPendingPayloadResponse) Descriptor() ([]byte, []int) { return fileDescriptor_390782105f057f99, []int{1} } -func (m *QueryPendingPayloadsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryPendingPayloadResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryPendingPayloadsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryPendingPayloadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryPendingPayloadsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryPendingPayloadResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -102,64 +101,54 @@ func (m *QueryPendingPayloadsResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryPendingPayloadsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPendingPayloadsResponse.Merge(m, src) +func (m *QueryPendingPayloadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPayloadResponse.Merge(m, src) } -func (m *QueryPendingPayloadsResponse) XXX_Size() int { +func (m *QueryPendingPayloadResponse) XXX_Size() int { return m.Size() } -func (m *QueryPendingPayloadsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPendingPayloadsResponse.DiscardUnknown(m) +func (m *QueryPendingPayloadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPayloadResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryPendingPayloadsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryPendingPayloadResponse proto.InternalMessageInfo -func (m *QueryPendingPayloadsResponse) GetHashes() []string { +func (m *QueryPendingPayloadResponse) GetPayload() *core.Payload { if m != nil { - return m.Hashes - } - return nil -} - -func (m *QueryPendingPayloadsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination + return m.Payload } return nil } func init() { - proto.RegisterType((*QueryPendingPayloadsRequest)(nil), "noble.orbiter.v1.QueryPendingPayloadsRequest") - proto.RegisterType((*QueryPendingPayloadsResponse)(nil), "noble.orbiter.v1.QueryPendingPayloadsResponse") + proto.RegisterType((*QueryPendingPayloadRequest)(nil), "noble.orbiter.v1.QueryPendingPayloadRequest") + proto.RegisterType((*QueryPendingPayloadResponse)(nil), "noble.orbiter.v1.QueryPendingPayloadResponse") } func init() { proto.RegisterFile("noble/orbiter/v1/query.proto", fileDescriptor_390782105f057f99) } var fileDescriptor_390782105f057f99 = []byte{ - // 354 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbd, 0x4a, 0x2b, 0x41, - 0x14, 0xc7, 0x33, 0xb9, 0xdc, 0xc0, 0x9d, 0x5b, 0x28, 0x53, 0x48, 0xd8, 0x84, 0x25, 0x2c, 0x7e, - 0x84, 0x40, 0x66, 0xd8, 0xf8, 0x00, 0x82, 0x85, 0xb6, 0x31, 0xa5, 0xdd, 0x6c, 0x72, 0xd8, 0x2c, - 0x24, 0x33, 0x93, 0x3d, 0x93, 0x40, 0x2a, 0xc1, 0xca, 0x52, 0xf0, 0x09, 0xac, 0x6d, 0x7c, 0x0c, - 0xcb, 0x80, 0x8d, 0xa5, 0x24, 0x82, 0xaf, 0x21, 0xd9, 0x59, 0x35, 0x46, 0x51, 0xcb, 0xe5, 0xff, - 0xf1, 0xfb, 0x73, 0x76, 0x68, 0x55, 0xe9, 0x68, 0x00, 0x42, 0xa7, 0x51, 0x62, 0x21, 0x15, 0x93, - 0x50, 0x8c, 0xc6, 0x90, 0x4e, 0xb9, 0x49, 0xb5, 0xd5, 0x6c, 0x33, 0x53, 0x79, 0xae, 0xf2, 0x49, - 0xe8, 0x35, 0xba, 0x1a, 0x87, 0x1a, 0x45, 0x24, 0x11, 0x9c, 0x55, 0x4c, 0xc2, 0x08, 0xac, 0x0c, - 0x85, 0x91, 0x71, 0xa2, 0xa4, 0x4d, 0xb4, 0x72, 0x69, 0xaf, 0x92, 0x7b, 0x5f, 0x6d, 0xab, 0xd5, - 0x5e, 0x35, 0xd6, 0x3a, 0x1e, 0x80, 0x90, 0x26, 0x11, 0x52, 0x29, 0x6d, 0xb3, 0x24, 0x3a, 0x35, - 0x00, 0x5a, 0x39, 0x59, 0x9a, 0xdb, 0xa0, 0x7a, 0x89, 0x8a, 0xdb, 0x72, 0x3a, 0xd0, 0xb2, 0x87, - 0x1d, 0x18, 0x8d, 0x01, 0x2d, 0x3b, 0xa2, 0xf4, 0x9d, 0x56, 0x26, 0x35, 0x52, 0xff, 0xdf, 0xda, - 0xe5, 0x0e, 0xc7, 0x97, 0xd3, 0xb8, 0x43, 0xe5, 0xd3, 0x78, 0x5b, 0xc6, 0x90, 0x67, 0x3b, 0x2b, - 0xc9, 0xe0, 0x8c, 0x56, 0xbf, 0xc6, 0xa0, 0xd1, 0x0a, 0x81, 0x6d, 0xd1, 0x52, 0x5f, 0x62, 0x1f, - 0xb0, 0x4c, 0x6a, 0x7f, 0xea, 0xff, 0x3a, 0xf9, 0x17, 0x3b, 0xfe, 0xc0, 0x2f, 0x66, 0xfc, 0xbd, - 0x1f, 0xf9, 0xae, 0x74, 0x75, 0x40, 0xeb, 0x86, 0xd0, 0xbf, 0xd9, 0x02, 0x76, 0x4d, 0xe8, 0xc6, - 0xda, 0x0c, 0xd6, 0xe4, 0xeb, 0xf7, 0xe7, 0xdf, 0x5c, 0xc5, 0xe3, 0xbf, 0xb5, 0xbb, 0x21, 0x81, - 0xb8, 0x78, 0xbe, 0x6d, 0x90, 0xf3, 0xfb, 0xa7, 0xab, 0xe2, 0x36, 0x0b, 0xc4, 0xa7, 0x97, 0x60, - 0x5c, 0xae, 0x69, 0xf2, 0xe0, 0xe1, 0xc1, 0xdd, 0xdc, 0x27, 0xb3, 0xb9, 0x4f, 0x1e, 0xe7, 0x3e, - 0xb9, 0x5c, 0xf8, 0x85, 0xd9, 0xc2, 0x2f, 0x3c, 0x2c, 0xfc, 0xc2, 0xe9, 0x4e, 0x9c, 0xd8, 0xfe, - 0x38, 0xe2, 0x5d, 0x3d, 0x74, 0x3d, 0x4d, 0x89, 0x08, 0x16, 0xdf, 0xea, 0xec, 0xd4, 0x00, 0x46, - 0xa5, 0xec, 0xef, 0xee, 0xbf, 0x04, 0x00, 0x00, 0xff, 0xff, 0x22, 0x29, 0x42, 0x97, 0x76, 0x02, - 0x00, 0x00, + // 316 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0xcb, 0x4f, 0xca, + 0x49, 0xd5, 0xcf, 0x2f, 0x4a, 0xca, 0x2c, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, + 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0xcb, 0xea, 0x41, 0x65, 0xf5, + 0xca, 0x0c, 0xa5, 0xa4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0x21, 0xaa, 0xd0, 0x94, 0x4b, 0xc9, + 0xa4, 0xe7, 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, + 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x65, 0x95, 0x51, 0xad, 0x4a, 0xce, 0x2f, 0x4a, 0x05, + 0x19, 0x00, 0x33, 0x1c, 0xac, 0x48, 0xc9, 0x80, 0x4b, 0x2a, 0x10, 0x64, 0x62, 0x40, 0x6a, 0x5e, + 0x4a, 0x66, 0x5e, 0x7a, 0x40, 0x62, 0x65, 0x4e, 0x7e, 0x62, 0x4a, 0x50, 0x6a, 0x61, 0x69, 0x6a, + 0x71, 0x89, 0x90, 0x10, 0x17, 0x4b, 0x46, 0x62, 0x71, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4f, + 0x10, 0x98, 0xad, 0x14, 0xce, 0x25, 0x8d, 0x55, 0x47, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x90, + 0x05, 0x17, 0x7b, 0x01, 0x44, 0x08, 0xac, 0x8b, 0xdb, 0x48, 0x4e, 0x0f, 0xd5, 0x53, 0x20, 0x77, + 0xe8, 0x95, 0x19, 0xea, 0xc1, 0x34, 0xc2, 0x94, 0x1b, 0x2d, 0x63, 0xe4, 0x62, 0x05, 0x9b, 0x2c, + 0x34, 0x87, 0x91, 0x8b, 0x0f, 0xd5, 0x78, 0x21, 0x1d, 0x3d, 0xf4, 0xa0, 0xd1, 0xc3, 0xed, 0x6e, + 0x29, 0x5d, 0x22, 0x55, 0x43, 0xdc, 0xac, 0xa4, 0xdb, 0xf1, 0x7c, 0x83, 0x16, 0x63, 0xd3, 0xe5, + 0x27, 0x93, 0x99, 0x94, 0x84, 0x14, 0xf4, 0x31, 0xa2, 0x08, 0xea, 0x42, 0xfd, 0x6a, 0x50, 0x00, + 0xd4, 0x3a, 0xd9, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, + 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x6a, 0x7a, + 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0x2e, 0xc4, 0x14, 0xdd, 0xc4, 0xe2, 0xe2, 0xd4, + 0x92, 0x62, 0xb8, 0x61, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0xb0, 0x37, 0x06, 0x04, + 0x00, 0x00, 0xff, 0xff, 0x2b, 0x4a, 0xe7, 0xe0, 0x0d, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -174,7 +163,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - PendingPayloads(ctx context.Context, in *QueryPendingPayloadsRequest, opts ...grpc.CallOption) (*QueryPendingPayloadsResponse, error) + PendingPayload(ctx context.Context, in *QueryPendingPayloadRequest, opts ...grpc.CallOption) (*QueryPendingPayloadResponse, error) } type queryClient struct { @@ -185,9 +174,9 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) PendingPayloads(ctx context.Context, in *QueryPendingPayloadsRequest, opts ...grpc.CallOption) (*QueryPendingPayloadsResponse, error) { - out := new(QueryPendingPayloadsResponse) - err := c.cc.Invoke(ctx, "/noble.orbiter.v1.Query/PendingPayloads", in, out, opts...) +func (c *queryClient) PendingPayload(ctx context.Context, in *QueryPendingPayloadRequest, opts ...grpc.CallOption) (*QueryPendingPayloadResponse, error) { + out := new(QueryPendingPayloadResponse) + err := c.cc.Invoke(ctx, "/noble.orbiter.v1.Query/PendingPayload", in, out, opts...) if err != nil { return nil, err } @@ -196,35 +185,35 @@ func (c *queryClient) PendingPayloads(ctx context.Context, in *QueryPendingPaylo // QueryServer is the server API for Query service. type QueryServer interface { - PendingPayloads(context.Context, *QueryPendingPayloadsRequest) (*QueryPendingPayloadsResponse, error) + PendingPayload(context.Context, *QueryPendingPayloadRequest) (*QueryPendingPayloadResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) PendingPayloads(ctx context.Context, req *QueryPendingPayloadsRequest) (*QueryPendingPayloadsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PendingPayloads not implemented") +func (*UnimplementedQueryServer) PendingPayload(ctx context.Context, req *QueryPendingPayloadRequest) (*QueryPendingPayloadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PendingPayload not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_PendingPayloads_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPendingPayloadsRequest) +func _Query_PendingPayload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPendingPayloadRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).PendingPayloads(ctx, in) + return srv.(QueryServer).PendingPayload(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/noble.orbiter.v1.Query/PendingPayloads", + FullMethod: "/noble.orbiter.v1.Query/PendingPayload", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).PendingPayloads(ctx, req.(*QueryPendingPayloadsRequest)) + return srv.(QueryServer).PendingPayload(ctx, req.(*QueryPendingPayloadRequest)) } return interceptor(ctx, in, info, handler) } @@ -235,15 +224,15 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "PendingPayloads", - Handler: _Query_PendingPayloads_Handler, + MethodName: "PendingPayload", + Handler: _Query_PendingPayload_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "noble/orbiter/v1/query.proto", } -func (m *QueryPendingPayloadsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryPendingPayloadRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -253,32 +242,27 @@ func (m *QueryPendingPayloadsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPendingPayloadsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPendingPayloadRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPendingPayloadsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPendingPayloadRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryPendingPayloadsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryPendingPayloadResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -288,19 +272,19 @@ func (m *QueryPendingPayloadsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryPendingPayloadsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryPendingPayloadResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryPendingPayloadsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryPendingPayloadResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { + if m.Payload != nil { { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -308,16 +292,7 @@ func (m *QueryPendingPayloadsResponse) MarshalToSizedBuffer(dAtA []byte) (int, e i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if len(m.Hashes) > 0 { - for iNdEx := len(m.Hashes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Hashes[iNdEx]) - copy(dAtA[i:], m.Hashes[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Hashes[iNdEx]))) - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -333,33 +308,27 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryPendingPayloadsRequest) Size() (n int) { +func (m *QueryPendingPayloadRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() + l = len(m.Hash) + if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryPendingPayloadsResponse) Size() (n int) { +func (m *QueryPendingPayloadResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Hashes) > 0 { - for _, s := range m.Hashes { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() + if m.Payload != nil { + l = m.Payload.Size() n += 1 + l + sovQuery(uint64(l)) } return n @@ -371,7 +340,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryPendingPayloadsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryPendingPayloadRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -394,17 +363,17 @@ func (m *QueryPendingPayloadsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPendingPayloadsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPendingPayloadRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPendingPayloadsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPendingPayloadRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -414,26 +383,24 @@ func (m *QueryPendingPayloadsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} } iNdEx = postIndex default: @@ -457,7 +424,7 @@ func (m *QueryPendingPayloadsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPendingPayloadsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryPendingPayloadResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -480,47 +447,15 @@ func (m *QueryPendingPayloadsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryPendingPayloadsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryPendingPayloadResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPendingPayloadsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryPendingPayloadResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hashes", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hashes = append(m.Hashes, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -547,10 +482,10 @@ func (m *QueryPendingPayloadsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} + if m.Payload == nil { + m.Payload = &core.Payload{} } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/types/query.pb.gw.go b/types/query.pb.gw.go index 75c9baf6..4649b83b 100644 --- a/types/query.pb.gw.go +++ b/types/query.pb.gw.go @@ -33,38 +33,56 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -var ( - filter_Query_PendingPayloads_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_PendingPayloads_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPendingPayloadsRequest +func request_Query_PendingPayload_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingPayloadRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PendingPayloads_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + protoReq.Hash, err = runtime.Bytes(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) } - msg, err := client.PendingPayloads(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.PendingPayload(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_PendingPayloads_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryPendingPayloadsRequest +func local_request_Query_PendingPayload_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryPendingPayloadRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_PendingPayloads_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + protoReq.Hash, err = runtime.Bytes(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) } - msg, err := server.PendingPayloads(ctx, &protoReq) + msg, err := server.PendingPayload(ctx, &protoReq) return msg, metadata, err } @@ -75,7 +93,7 @@ func local_request_Query_PendingPayloads_0(ctx context.Context, marshaler runtim // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_PendingPayloads_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PendingPayload_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -86,7 +104,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_PendingPayloads_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_PendingPayload_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -94,7 +112,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_PendingPayloads_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PendingPayload_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -139,7 +157,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_PendingPayloads_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_PendingPayload_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) @@ -148,14 +166,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_PendingPayloads_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_PendingPayload_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_PendingPayloads_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_PendingPayload_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -163,9 +181,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_PendingPayloads_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"noble", "orbiter", "v1", "pending-payloads"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_PendingPayload_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"noble", "orbiter", "v1", "payload", "hash"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_PendingPayloads_0 = runtime.ForwardResponseMessage + forward_Query_PendingPayload_0 = runtime.ForwardResponseMessage ) From 7fb99591afaabc73c10ee0ca84dd999b3cef7d27 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Fri, 10 Oct 2025 17:27:13 +0200 Subject: [PATCH 20/29] refactor to use payload hash type to unify encoding and decoding --- api/v1/query.pulsar.go | 38 ++++++++++++------------ api/v1/tx.pulsar.go | 4 +-- autocli.go | 2 +- keeper/keeper.go | 2 +- keeper/msg_server_test.go | 32 ++++++++++---------- keeper/payload_handler.go | 37 +++++++++++++++-------- keeper/payload_handler_test.go | 26 +++++++++-------- keeper/query_server.go | 8 +++-- keeper/query_server_test.go | 12 ++++---- proto/noble/orbiter/v1/query.proto | 4 +-- proto/noble/orbiter/v1/tx.proto | 4 +-- types/autocli.go | 8 +++-- types/constants.go | 24 --------------- types/core/errors.go | 2 -- types/core/payload.go | 47 ++++++++++++++++++++++++++---- types/query.pb.go | 26 ++++++++--------- types/query.pb.gw.go | 4 +-- types/tx.pb.go | 4 +-- 18 files changed, 154 insertions(+), 130 deletions(-) delete mode 100644 types/constants.go diff --git a/api/v1/query.pulsar.go b/api/v1/query.pulsar.go index 22b548eb..a727585b 100644 --- a/api/v1/query.pulsar.go +++ b/api/v1/query.pulsar.go @@ -91,8 +91,8 @@ func (x *fastReflection_QueryPendingPayloadRequest) Interface() protoreflect.Pro // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_QueryPendingPayloadRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Hash) != 0 { - value := protoreflect.ValueOfBytes(x.Hash) + if x.Hash != "" { + value := protoreflect.ValueOfString(x.Hash) if !f(fd_QueryPendingPayloadRequest_hash, value) { return } @@ -113,7 +113,7 @@ func (x *fastReflection_QueryPendingPayloadRequest) Range(f func(protoreflect.Fi func (x *fastReflection_QueryPendingPayloadRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": - return len(x.Hash) != 0 + return x.Hash != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) @@ -131,7 +131,7 @@ func (x *fastReflection_QueryPendingPayloadRequest) Has(fd protoreflect.FieldDes func (x *fastReflection_QueryPendingPayloadRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": - x.Hash = nil + x.Hash = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) @@ -150,7 +150,7 @@ func (x *fastReflection_QueryPendingPayloadRequest) Get(descriptor protoreflect. switch descriptor.FullName() { case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": value := x.Hash - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) @@ -172,7 +172,7 @@ func (x *fastReflection_QueryPendingPayloadRequest) Get(descriptor protoreflect. func (x *fastReflection_QueryPendingPayloadRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": - x.Hash = value.Bytes() + x.Hash = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) @@ -209,7 +209,7 @@ func (x *fastReflection_QueryPendingPayloadRequest) Mutable(fd protoreflect.Fiel func (x *fastReflection_QueryPendingPayloadRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": - return protoreflect.ValueOfBytes(nil) + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) @@ -372,7 +372,7 @@ func (x *fastReflection_QueryPendingPayloadRequest) ProtoMethods() *protoiface.M if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -382,25 +382,23 @@ func (x *fastReflection_QueryPendingPayloadRequest) ProtoMethods() *protoiface.M } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) - if x.Hash == nil { - x.Hash = []byte{} - } + x.Hash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -890,8 +888,8 @@ type QueryPendingPayloadRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The keccak256 hash of the pending payload contents. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // The hex-encoded bytes of the registered hash of the payload to retrieve. + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } func (x *QueryPendingPayloadRequest) Reset() { @@ -914,11 +912,11 @@ func (*QueryPendingPayloadRequest) Descriptor() ([]byte, []int) { return file_noble_orbiter_v1_query_proto_rawDescGZIP(), []int{0} } -func (x *QueryPendingPayloadRequest) GetHash() []byte { +func (x *QueryPendingPayloadRequest) GetHash() string { if x != nil { return x.Hash } - return nil + return "" } type QueryPendingPayloadResponse struct { @@ -971,7 +969,7 @@ var file_noble_orbiter_v1_query_proto_rawDesc = []byte{ 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x30, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, + 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x57, 0x0a, 0x1b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, diff --git a/api/v1/tx.pulsar.go b/api/v1/tx.pulsar.go index b56961b2..79f46c50 100644 --- a/api/v1/tx.pulsar.go +++ b/api/v1/tx.pulsar.go @@ -982,14 +982,14 @@ func (x *MsgSubmitPayload) GetPayload() string { return "" } -// MsgSubmitPayloadResponse returns the keccak256 of the registered +// MsgSubmitPayloadResponse returns the sha256 hash of the registered // pending payload. type MsgSubmitPayloadResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The keccak256 hash by which to reference the submitted payload. + // The sha256 hash that references the submitted payload in the module storage. Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } diff --git a/autocli.go b/autocli.go index 462ac619..d019d63b 100644 --- a/autocli.go +++ b/autocli.go @@ -79,7 +79,7 @@ func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { { // NOTE: we're manually moving this to the `payload` sub command for better // navigation - RpcMethod: "PendingPayloads", + RpcMethod: "PendingPayload", Skip: true, }, }, diff --git a/keeper/keeper.go b/keeper/keeper.go index a0d96245..6fb78c21 100644 --- a/keeper/keeper.go +++ b/keeper/keeper.go @@ -57,7 +57,7 @@ type Keeper struct { dispatcher *dispatchercomp.Dispatcher adapter *adaptercomp.Adapter - // pendingPayloads stores the pending payloads addressed by their keccak256 hash. + // pendingPayloads stores the pending payloads addressed by their sha256 hash. pendingPayloads collections.Map[[]byte, core.PendingPayload] // pendingPayloadsSequence is the unique identifier of a given pending payload handled by the // orbiter. diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go index 81f63771..fac87e2f 100644 --- a/keeper/msg_server_test.go +++ b/keeper/msg_server_test.go @@ -22,10 +22,8 @@ package keeper_test import ( "context" - "encoding/hex" "testing" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" orbiterkeeper "github.com/noble-assets/orbiter/keeper" @@ -41,7 +39,7 @@ func TestSubmitPayload(t *testing.T) { seq := uint64(0) examplePayload := createTestPendingPayloadWithSequence(t, seq) - exampleHash, err := examplePayload.Keccak256Hash() + exampleHash, err := examplePayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") destDomain := uint32(1) @@ -52,12 +50,12 @@ func TestSubmitPayload(t *testing.T) { setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) payload func() *core.Payload errContains string - expHash string + expHash *core.PayloadHash }{ { name: "success - valid payload", payload: func() *core.Payload { return examplePayload.Payload }, - expHash: exampleHash.String(), + expHash: exampleHash, }, { name: "error - payload contains paused action", @@ -151,7 +149,7 @@ func TestSubmitPayload(t *testing.T) { }) if tc.errContains == "" { require.NoError(t, err, "failed to submit payload") - require.Equal(t, tc.expHash, ethcommon.BytesToHash(res.Hash).String()) + require.Equal(t, tc.expHash.String(), core.PayloadHash(res.Hash).String()) } else { require.ErrorContains(t, err, tc.errContains, "expected different error") } @@ -167,7 +165,7 @@ func TestSubsequentSubmissions(t *testing.T) { ms := orbiterkeeper.NewMsgServer(k) validPayload := createTestPendingPayloadWithSequence(t, 0) - expHash, err := validPayload.Keccak256Hash() + expHash, err := validPayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") validPayloadJSON, err := orbitertypes.MarshalJSON(k.Codec(), validPayload.Payload) @@ -181,8 +179,8 @@ func TestSubsequentSubmissions(t *testing.T) { require.NoError(t, err, "failed to submit payload") // ASSERT: expected hash is returned - gotHash := hex.EncodeToString(res.Hash) - require.Equal(t, hex.EncodeToString(expHash.Bytes()), gotHash, "expected different hash") + gotHash := core.PayloadHash(res.Hash) + require.Equal(t, expHash.String(), gotHash.String(), "expected different hash") // ACT: submit identical payload again res2, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ @@ -192,34 +190,34 @@ func TestSubsequentSubmissions(t *testing.T) { require.NoError(t, err, "failed to submit payload") validPayload.Sequence = uint64(1) - expHash2, err := validPayload.Keccak256Hash() + expHash2, err := validPayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") // ASSERT: expected hash is returned - gotHash2 := hex.EncodeToString(res2.Hash) - require.Equal(t, hex.EncodeToString(expHash2.Bytes()), gotHash2, "expected different hash") + gotHash2 := core.PayloadHash(res2.Hash) + require.Equal(t, expHash2.String(), gotHash2.String(), "expected different hash") // ASSERT: hashes of subsequent submissions of the same payload are different - require.NotEqual(t, gotHash, gotHash2, "expected different hashes") + require.NotEqual(t, gotHash.String(), gotHash2.String(), "expected different hashes") } func TestDifferentSequenceGeneratesDifferentHash(t *testing.T) { // ACT: Generate pending payload with sequence 1 seq := uint64(1) validForwarding := createTestPendingPayloadWithSequence(t, seq) - expHash, err := validForwarding.Keccak256Hash() + expHash, err := validForwarding.SHA256Hash() require.NoError(t, err, "failed to hash payload") // ACT: Generate pending payload with sequence 2 validForwarding2 := createTestPendingPayloadWithSequence(t, seq+1) - expHash2, err := validForwarding2.Keccak256Hash() + expHash2, err := validForwarding2.SHA256Hash() require.NoError(t, err, "failed to hash payload") // ASSERT: hash 1 and hash 2 are NOT equal require.NotEqual( t, - hex.EncodeToString(expHash.Bytes()), - hex.EncodeToString(expHash2.Bytes()), + expHash.String(), + expHash2.String(), "expected different hash", ) } diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go index 68536900..a270485e 100644 --- a/keeper/payload_handler.go +++ b/keeper/payload_handler.go @@ -22,11 +22,11 @@ package keeper import ( "context" - "encoding/hex" "errors" "fmt" errorsmod "cosmossdk.io/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/noble-assets/orbiter/types/core" ) @@ -49,7 +49,7 @@ func (k *Keeper) submit( Payload: payload, } - hash, err := pendingPayload.Keccak256Hash() + hash, err := pendingPayload.SHA256Hash() if err != nil { return nil, err } @@ -130,16 +130,25 @@ func (k *Keeper) validatePayloadAgainstState( // if it is found in the module storage. func (k *Keeper) pendingPayload( ctx context.Context, - hash []byte, + hash *core.PayloadHash, ) (*core.PendingPayload, error) { - payload, err := k.pendingPayloads.Get(ctx, hash) + if hash == nil { + return nil, core.ErrNilPointer.Wrap("payload hash") + } + + payload, err := k.pendingPayloads.Get(ctx, hash.Bytes()) if err != nil { - return nil, errorsmod.Wrap(err, "pending payload not found") + k.Logger().Error( + "failed to retrieve pending payload", + "hash", hash.String(), + ) + + return nil, sdkerrors.ErrNotFound.Wrapf("payload with hash %s", hash.String()) } k.Logger().Debug( "retrieved pending payload", - "hash", hex.EncodeToString(hash), + "hash", hash.String(), "payload", payload.String(), ) @@ -150,22 +159,26 @@ func (k *Keeper) pendingPayload( // If a payload is not found, it is a no-op but does not return an error. func (k *Keeper) RemovePendingPayload( ctx context.Context, - hash []byte, + hash *core.PayloadHash, ) error { - found, err := k.pendingPayloads.Has(ctx, hash) + if hash == nil { + return core.ErrNilPointer.Wrap("payload hash") + } + + found, err := k.pendingPayloads.Has(ctx, hash.Bytes()) if err != nil { return errorsmod.Wrap(err, "failed to check pending payloads") } if !found { - return fmt.Errorf("payload with hash %q not found", hex.EncodeToString(hash)) + return sdkerrors.ErrNotFound.Wrapf("payload with hash %q", hash.String()) } - if err = k.pendingPayloads.Remove(ctx, hash); err != nil { - return core.ErrRemovePayload.Wrap(err.Error()) + if err = k.pendingPayloads.Remove(ctx, hash.Bytes()); err != nil { + return errorsmod.Wrap(err, "failed to remove pending payload") } - k.Logger().Debug("removed pending payload", "hash", hex.EncodeToString(hash)) + k.Logger().Debug("removed pending payload", "hash", hash.String()) return nil } diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index 58ad3e86..f174066a 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -22,30 +22,30 @@ package keeper_test import ( "context" - "encoding/hex" - "fmt" "testing" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/codec" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" orbiterkeeper "github.com/noble-assets/orbiter/keeper" mockorbiter "github.com/noble-assets/orbiter/testutil/mocks/orbiter" orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/core" ) func TestRemovePayload(t *testing.T) { t.Parallel() validPayload := createTestPendingPayloadWithSequence(t, 0) - expHash, err := validPayload.Keccak256Hash() + expHash, err := validPayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") testcases := []struct { name string setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) - hash []byte + hash *core.PayloadHash errContains string }{ { @@ -61,22 +61,22 @@ func TestRemovePayload(t *testing.T) { }) require.NoError(t, err, "failed to setup testcase; accepting payload") }, - hash: expHash.Bytes(), + hash: expHash, }, { name: "error - valid payload but not found in store", setup: nil, - hash: expHash.Bytes(), - errContains: fmt.Sprintf( - "payload with hash %q not found", - hex.EncodeToString(expHash.Bytes()), - ), + hash: expHash, + errContains: sdkerrors.ErrNotFound.Wrapf( + "payload with hash %q", + expHash.String(), + ).Error(), }, { name: "error - nil hash", setup: nil, hash: nil, - errContains: fmt.Sprintf("payload with hash %q not found", hex.EncodeToString(nil)), + errContains: core.ErrNilPointer.Wrap("payload hash").Error(), }, } @@ -99,7 +99,9 @@ func TestRemovePayload(t *testing.T) { // ASSERT: value with hash was removed. gotPayload, err := qs.PendingPayload( ctx, - &orbitertypes.QueryPendingPayloadRequest{Hash: tc.hash}, + &orbitertypes.QueryPendingPayloadRequest{ + Hash: tc.hash.String(), + }, ) require.Error(t, err, "payload should not be present anymore") require.Nil(t, gotPayload, "expected nil payload") diff --git a/keeper/query_server.go b/keeper/query_server.go index 4baa861f..4b58ae22 100644 --- a/keeper/query_server.go +++ b/keeper/query_server.go @@ -27,6 +27,7 @@ import ( "google.golang.org/grpc/status" orbitertypes "github.com/noble-assets/orbiter/types" + "github.com/noble-assets/orbiter/types/core" ) var _ orbitertypes.QueryServer = &queryServer{} @@ -47,11 +48,12 @@ func (s queryServer) PendingPayload( return nil, status.Error(codes.InvalidArgument, "empty request") } - if len(req.Hash) != orbitertypes.PayloadHashLength { - return nil, status.Error(codes.InvalidArgument, "malformed hash") + hash, err := core.ParsePayloadHash(req.Hash) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid hash") } - payload, err := s.pendingPayload(ctx, req.Hash) + payload, err := s.pendingPayload(ctx, hash) if err != nil { return nil, status.Error(codes.NotFound, "payload not found") } diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index 0bc40780..5888b798 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -39,14 +39,14 @@ func TestPendingPayload(t *testing.T) { t.Parallel() examplePayload := createTestPendingPayloadWithSequence(t, 0) - exampleHash, err := examplePayload.Keccak256Hash() + exampleHash, err := examplePayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") testcases := []struct { name string setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) - hash []byte expPayload *core.PendingPayload + hash string errContains string }{ { @@ -63,19 +63,19 @@ func TestPendingPayload(t *testing.T) { require.NoError(t, err) }, expPayload: examplePayload, - hash: exampleHash.Bytes(), + hash: exampleHash.String(), }, { name: "error - hash not found", setup: nil, - hash: exampleHash.Bytes(), expPayload: examplePayload, + hash: exampleHash.String(), errContains: codes.NotFound.String(), }, { - name: "error - nil hash", + name: "error - empty hash", setup: nil, - hash: nil, + hash: "", errContains: codes.InvalidArgument.String(), }, } diff --git a/proto/noble/orbiter/v1/query.proto b/proto/noble/orbiter/v1/query.proto index f3ebea95..f81e4b83 100644 --- a/proto/noble/orbiter/v1/query.proto +++ b/proto/noble/orbiter/v1/query.proto @@ -17,8 +17,8 @@ service Query { } message QueryPendingPayloadRequest { - // The keccak256 hash of the pending payload contents. - bytes hash = 1; + // The hex-encoded bytes of the registered hash of the payload to retrieve. + string hash = 1; } message QueryPendingPayloadResponse { diff --git a/proto/noble/orbiter/v1/tx.proto b/proto/noble/orbiter/v1/tx.proto index 02302c4d..57a6a3b6 100644 --- a/proto/noble/orbiter/v1/tx.proto +++ b/proto/noble/orbiter/v1/tx.proto @@ -31,9 +31,9 @@ message MsgSubmitPayload { string payload = 2; } -// MsgSubmitPayloadResponse returns the keccak256 of the registered +// MsgSubmitPayloadResponse returns the sha256 hash of the registered // pending payload. message MsgSubmitPayloadResponse { - // The keccak256 hash by which to reference the submitted payload. + // The sha256 hash that references the submitted payload in the module storage. bytes hash = 1; } diff --git a/types/autocli.go b/types/autocli.go index 7eb1bf18..e40a708c 100644 --- a/types/autocli.go +++ b/types/autocli.go @@ -42,9 +42,13 @@ func TxCommandOptions() []*autocliv1.RpcCommandOptions { func QueryCommandOptions() []*autocliv1.RpcCommandOptions { return []*autocliv1.RpcCommandOptions{ { - RpcMethod: "PendingPayloads", + RpcMethod: "PendingPayload", Use: "pending", - Short: "Query pending payloads", + Short: "Query a pending payload by its hash", + Long: `Query a pending payload by the sha256 hash of the payload contents and its submission sequence number.`, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{ + {ProtoField: "hash"}, + }, }, } } diff --git a/types/constants.go b/types/constants.go deleted file mode 100644 index 26f47395..00000000 --- a/types/constants.go +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2025, NASD Inc. All rights reserved. -// Use of this software is governed by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package types - -// PayloadHashLength specifies the expected length of Orbiter payload hashes. -const PayloadHashLength = 32 diff --git a/types/core/errors.go b/types/core/errors.go index b1049d2d..f4679851 100644 --- a/types/core/errors.go +++ b/types/core/errors.go @@ -33,6 +33,4 @@ var ( ErrUnableToPause = errorsmod.Register(ModuleName, 8, "unable to pause") ErrUnableToUnpause = errorsmod.Register(ModuleName, 9, "unable to unpause") ErrAlreadySet = errorsmod.Register(ModuleName, 10, "value already set") - ErrSubmitPayload = errorsmod.Register(ModuleName, 11, "payload submission failed") - ErrRemovePayload = errorsmod.Register(ModuleName, 12, "payload removal failed") ) diff --git a/types/core/payload.go b/types/core/payload.go index d1bcb670..a9b5bfca 100644 --- a/types/core/payload.go +++ b/types/core/payload.go @@ -21,21 +21,25 @@ package core import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "crypto/sha256" + "encoding/hex" + "errors" ) -// Keccak256Hash returns the keccak 256 hash of the payload contents. +// SHA256Hash returns the SHA-256 hash of the payload contents. // To guarantee uniqueness the sequence number is included. // // CONTRACT: The pending payload should be validated before calling this function. -func (p *PendingPayload) Keccak256Hash() (common.Hash, error) { +func (p *PendingPayload) SHA256Hash() (*PayloadHash, error) { bz, err := p.Marshal() if err != nil { - return common.Hash{}, err + return nil, err } - return crypto.Keccak256Hash(bz), nil + hash := sha256.Sum256(bz) + pHash := PayloadHash(hash) + + return &pHash, nil } // Validate checks that the pending payload contents are valid. @@ -46,3 +50,34 @@ func (p *PendingPayload) Validate() error { return p.Payload.Validate() } + +// PayloadHashLength specifies the expected length of Orbiter payload hashes. +const PayloadHashLength = 32 + +// PayloadHash is a helper type to define a unified interface for interacting with +// the generated SHA256 hashes for the PendingPayload type. +type PayloadHash [PayloadHashLength]byte + +// ParsePayloadHash takes a string and tries to parse a PayloadHash from it. +func ParsePayloadHash(s string) (*PayloadHash, error) { + bz, err := hex.DecodeString(s) + if err != nil { + return nil, err + } + + if len(bz) != PayloadHashLength { + return nil, errors.New("malformed payload hash") + } + + pHash := PayloadHash(bz) + + return &pHash, nil +} + +func (p PayloadHash) Bytes() []byte { + return p[:] +} + +func (p PayloadHash) String() string { + return hex.EncodeToString(p[:]) +} diff --git a/types/query.pb.go b/types/query.pb.go index a2ccc9d2..bf6cc106 100644 --- a/types/query.pb.go +++ b/types/query.pb.go @@ -31,8 +31,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type QueryPendingPayloadRequest struct { - // The keccak256 hash of the pending payload contents. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // The hex-encoded bytes of the registered hash of the payload to retrieve. + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } func (m *QueryPendingPayloadRequest) Reset() { *m = QueryPendingPayloadRequest{} } @@ -68,11 +68,11 @@ func (m *QueryPendingPayloadRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPendingPayloadRequest proto.InternalMessageInfo -func (m *QueryPendingPayloadRequest) GetHash() []byte { +func (m *QueryPendingPayloadRequest) GetHash() string { if m != nil { return m.Hash } - return nil + return "" } type QueryPendingPayloadResponse struct { @@ -137,7 +137,7 @@ var fileDescriptor_390782105f057f99 = []byte{ 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x65, 0x95, 0x51, 0xad, 0x4a, 0xce, 0x2f, 0x4a, 0x05, 0x19, 0x00, 0x33, 0x1c, 0xac, 0x48, 0xc9, 0x80, 0x4b, 0x2a, 0x10, 0x64, 0x62, 0x40, 0x6a, 0x5e, 0x4a, 0x66, 0x5e, 0x7a, 0x40, 0x62, 0x65, 0x4e, 0x7e, 0x62, 0x4a, 0x50, 0x6a, 0x61, 0x69, 0x6a, - 0x71, 0x89, 0x90, 0x10, 0x17, 0x4b, 0x46, 0x62, 0x71, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4f, + 0x71, 0x89, 0x90, 0x10, 0x17, 0x4b, 0x46, 0x62, 0x71, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x98, 0xad, 0x14, 0xce, 0x25, 0x8d, 0x55, 0x47, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x90, 0x05, 0x17, 0x7b, 0x01, 0x44, 0x08, 0xac, 0x8b, 0xdb, 0x48, 0x4e, 0x0f, 0xd5, 0x53, 0x20, 0x77, 0xe8, 0x95, 0x19, 0xea, 0xc1, 0x34, 0xc2, 0x94, 0x1b, 0x2d, 0x63, 0xe4, 0x62, 0x05, 0x9b, 0x2c, @@ -148,7 +148,7 @@ var fileDescriptor_390782105f057f99 = []byte{ 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x6a, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0x2e, 0xc4, 0x14, 0xdd, 0xc4, 0xe2, 0xe2, 0xd4, 0x92, 0x62, 0xb8, 0x61, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0xb0, 0x37, 0x06, 0x04, - 0x00, 0x00, 0xff, 0xff, 0x2b, 0x4a, 0xe7, 0xe0, 0x0d, 0x02, 0x00, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x1f, 0xcc, 0xdc, 0xe4, 0x0d, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -373,7 +373,7 @@ func (m *QueryPendingPayloadRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -383,25 +383,23 @@ func (m *QueryPendingPayloadRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } + m.Hash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/types/query.pb.gw.go b/types/query.pb.gw.go index 4649b83b..5d21163a 100644 --- a/types/query.pb.gw.go +++ b/types/query.pb.gw.go @@ -49,7 +49,7 @@ func request_Query_PendingPayload_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") } - protoReq.Hash, err = runtime.Bytes(val) + protoReq.Hash, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) @@ -76,7 +76,7 @@ func local_request_Query_PendingPayload_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") } - protoReq.Hash, err = runtime.Bytes(val) + protoReq.Hash, err = runtime.String(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) diff --git a/types/tx.pb.go b/types/tx.pb.go index 05f87560..2dd03b8e 100644 --- a/types/tx.pb.go +++ b/types/tx.pb.go @@ -87,10 +87,10 @@ func (m *MsgSubmitPayload) GetPayload() string { return "" } -// MsgSubmitPayloadResponse returns the keccak256 of the registered +// MsgSubmitPayloadResponse returns the sha256 hash of the registered // pending payload. type MsgSubmitPayloadResponse struct { - // The keccak256 hash by which to reference the submitted payload. + // The sha256 hash that references the submitted payload in the module storage. Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } From 5f7b37cd5da59ee81f38fea66f7ddf8fae5d9215 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Fri, 10 Oct 2025 17:29:02 +0200 Subject: [PATCH 21/29] add makefile target to auto-fix lint issues --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 0059224f..1ae3f507 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,12 @@ lint: -@go-license --config .github/license.yaml --verify $(FILES) @echo "Completed linting!" +lint-fix: + @echo "===================================================================" + @echo "Applying linter fixes..." + -@go tool golangci-lint run -c ./.golangci.yaml --fix + @echo "Completed linter fixes!" + vulncheck: @echo "===================================================================" @echo "Running vulnerability check..." From bdab7f1b7884a10be278d0da8a5ae45b094747a0 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Fri, 10 Oct 2025 17:58:36 +0200 Subject: [PATCH 22/29] add tests for pending payload methods and remove unused method --- keeper/query_server_test.go | 33 +++++++---- types/core/payload.go | 13 +---- types/core/payload_test.go | 107 ++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 21 deletions(-) create mode 100644 types/core/payload_test.go diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index 5888b798..c1c23c5d 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -46,7 +46,7 @@ func TestPendingPayload(t *testing.T) { name string setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) expPayload *core.PendingPayload - hash string + req *orbitertypes.QueryPendingPayloadRequest errContains string }{ { @@ -63,19 +63,31 @@ func TestPendingPayload(t *testing.T) { require.NoError(t, err) }, expPayload: examplePayload, - hash: exampleHash.String(), + req: &orbitertypes.QueryPendingPayloadRequest{ + Hash: exampleHash.String(), + }, }, { - name: "error - hash not found", - setup: nil, - expPayload: examplePayload, - hash: exampleHash.String(), + name: "error - hash not found", + setup: nil, + expPayload: examplePayload, + req: &orbitertypes.QueryPendingPayloadRequest{ + Hash: exampleHash.String(), + }, errContains: codes.NotFound.String(), }, { - name: "error - empty hash", + name: "error - nil request", setup: nil, - hash: "", + req: nil, + errContains: codes.InvalidArgument.String(), + }, + { + name: "error - empty hash", + setup: nil, + req: &orbitertypes.QueryPendingPayloadRequest{ + Hash: "", + }, errContains: codes.InvalidArgument.String(), }, } @@ -94,9 +106,8 @@ func TestPendingPayload(t *testing.T) { got, err := qs.PendingPayload( ctx, - &orbitertypes.QueryPendingPayloadRequest{ - Hash: tc.hash, - }) + tc.req, + ) if tc.errContains == "" { require.NoError(t, err, "failed to get pending payload") diff --git a/types/core/payload.go b/types/core/payload.go index a9b5bfca..49afffdf 100644 --- a/types/core/payload.go +++ b/types/core/payload.go @@ -24,6 +24,8 @@ import ( "crypto/sha256" "encoding/hex" "errors" + + errorsmod "cosmossdk.io/errors" ) // SHA256Hash returns the SHA-256 hash of the payload contents. @@ -42,15 +44,6 @@ func (p *PendingPayload) SHA256Hash() (*PayloadHash, error) { return &pHash, nil } -// Validate checks that the pending payload contents are valid. -func (p *PendingPayload) Validate() error { - if p == nil { - return ErrNilPointer.Wrap("pending payload") - } - - return p.Payload.Validate() -} - // PayloadHashLength specifies the expected length of Orbiter payload hashes. const PayloadHashLength = 32 @@ -62,7 +55,7 @@ type PayloadHash [PayloadHashLength]byte func ParsePayloadHash(s string) (*PayloadHash, error) { bz, err := hex.DecodeString(s) if err != nil { - return nil, err + return nil, errorsmod.Wrap(err, "invalid payload hash") } if len(bz) != PayloadHashLength { diff --git a/types/core/payload_test.go b/types/core/payload_test.go new file mode 100644 index 00000000..83a55b07 --- /dev/null +++ b/types/core/payload_test.go @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package core_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/noble-assets/orbiter/testutil" + "github.com/noble-assets/orbiter/types/controller/forwarding" + "github.com/noble-assets/orbiter/types/core" +) + +func TestPayloadRoundTrip(t *testing.T) { + pp := createPendingPayload(t) + + hash, err := pp.SHA256Hash() + require.NoError(t, err, "failed to hash payload") + + parsedHash, err := core.ParsePayloadHash(hash.String()) + require.NoError(t, err, "failed to parse payload hash") + + require.Equal(t, hash.String(), parsedHash.String(), "payload hash mismatch") +} + +func TestParsePayloadHash(t *testing.T) { + t.Parallel() + + pp := createPendingPayload(t) + + hash, err := pp.SHA256Hash() + require.NoError(t, err, "failed to hash payload") + + testcases := []struct { + name string + input string + errContains string + }{ + { + name: "success - valid hash", + input: hash.String(), + }, + { + name: "error - invalid hash", + input: "abcdefg", + errContains: "invalid payload hash", + }, + { + name: "error - too short hash", + input: "0123ab", + errContains: "malformed payload hash", + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + parsed, err := core.ParsePayloadHash(tc.input) + if tc.errContains == "" { + require.NoError(t, err, "failed to parse payload hash") + require.Equal(t, tc.input, parsed.String(), "payload hash mismatch") + } else { + require.ErrorContains(t, err, tc.errContains) + } + }) + } +} + +func createPendingPayload(t *testing.T) *core.PendingPayload { + t.Helper() + + fw, err := forwarding.NewCCTPForwarding( + 1, + testutil.RandomBytes(32), + nil, + nil, + ) + require.NoError(t, err, "failed to create forwarding") + + p, err := core.NewPayload(fw) + require.NoError(t, err, "failed to create payload") + + return &core.PendingPayload{ + Sequence: 0, + Payload: p, + } +} From 9939145785eefe855d592eb4ca956af081e95bad Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Fri, 10 Oct 2025 18:07:47 +0200 Subject: [PATCH 23/29] address rabbit comments --- keeper/query_server_test.go | 2 +- types/core/payload.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index c1c23c5d..84ad108b 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -111,7 +111,7 @@ func TestPendingPayload(t *testing.T) { if tc.errContains == "" { require.NoError(t, err, "failed to get pending payload") - require.Equal(t, tc.expPayload.String(), got.String(), "expected different payload") + require.Equal(t, tc.expPayload.Payload.String(), got.Payload.String(), "expected different payload") } else { require.ErrorContains(t, err, tc.errContains, "expected different error") } diff --git a/types/core/payload.go b/types/core/payload.go index 49afffdf..4c175775 100644 --- a/types/core/payload.go +++ b/types/core/payload.go @@ -32,7 +32,7 @@ import ( // To guarantee uniqueness the sequence number is included. // // CONTRACT: The pending payload should be validated before calling this function. -func (p *PendingPayload) SHA256Hash() (*PayloadHash, error) { +func (p PendingPayload) SHA256Hash() (*PayloadHash, error) { bz, err := p.Marshal() if err != nil { return nil, err From 102c237b6ce7e316a873d89792b55b3349293425 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Fri, 10 Oct 2025 18:09:16 +0200 Subject: [PATCH 24/29] address another rabbit nit --- keeper/query_server_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index 84ad108b..6c368468 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -68,9 +68,8 @@ func TestPendingPayload(t *testing.T) { }, }, { - name: "error - hash not found", - setup: nil, - expPayload: examplePayload, + name: "error - hash not found", + setup: nil, req: &orbitertypes.QueryPendingPayloadRequest{ Hash: exampleHash.String(), }, From 87af3b49d2b81b2c00657429b88bbe7ac8ec723c Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Fri, 10 Oct 2025 18:12:58 +0200 Subject: [PATCH 25/29] apply lint fixes --- keeper/query_server_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index 6c368468..559b3993 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -110,7 +110,12 @@ func TestPendingPayload(t *testing.T) { if tc.errContains == "" { require.NoError(t, err, "failed to get pending payload") - require.Equal(t, tc.expPayload.Payload.String(), got.Payload.String(), "expected different payload") + require.Equal( + t, + tc.expPayload.Payload.String(), + got.Payload.String(), + "expected different payload", + ) } else { require.ErrorContains(t, err, tc.errContains, "expected different error") } From d42a05fb259a995a78063c6652c1137e802aaaf4 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Mon, 13 Oct 2025 12:43:42 +0200 Subject: [PATCH 26/29] address review comments --- api/core/v1/orbiter.pulsar.go | 2 +- keeper/msg_server_test.go | 4 ++-- keeper/query_server.go | 8 +++++--- keeper/query_server_test.go | 4 ++-- proto/noble/orbiter/core/v1/orbiter.proto | 2 +- types/core/orbiter.pb.go | 2 +- types/core/payload.go | 4 ++-- types/core/payload_test.go | 6 +++--- 8 files changed, 17 insertions(+), 15 deletions(-) diff --git a/api/core/v1/orbiter.pulsar.go b/api/core/v1/orbiter.pulsar.go index 166f36a8..856f8f94 100644 --- a/api/core/v1/orbiter.pulsar.go +++ b/api/core/v1/orbiter.pulsar.go @@ -2763,7 +2763,7 @@ type PendingPayload struct { // The sequence number of the pending payload. Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` - // The submitted payload that will is registered as pending. + // The submitted payload that will be registered as pending. Payload *Payload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` } diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go index fac87e2f..2d559719 100644 --- a/keeper/msg_server_test.go +++ b/keeper/msg_server_test.go @@ -45,7 +45,7 @@ func TestSubmitPayload(t *testing.T) { destDomain := uint32(1) recipient := testutil.RandomBytes(32) - testcases := []struct { + testCases := []struct { name string setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) payload func() *core.Payload @@ -132,7 +132,7 @@ func TestSubmitPayload(t *testing.T) { }, } - for _, tc := range testcases { + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx, _, k := mockorbiter.OrbiterKeeper(t) ms := orbiterkeeper.NewMsgServer(k) diff --git a/keeper/query_server.go b/keeper/query_server.go index 4b58ae22..b1ea3ff5 100644 --- a/keeper/query_server.go +++ b/keeper/query_server.go @@ -26,6 +26,8 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + errorsmod "cosmossdk.io/errors" + orbitertypes "github.com/noble-assets/orbiter/types" "github.com/noble-assets/orbiter/types/core" ) @@ -48,14 +50,14 @@ func (s queryServer) PendingPayload( return nil, status.Error(codes.InvalidArgument, "empty request") } - hash, err := core.ParsePayloadHash(req.Hash) + hash, err := core.NewPayloadHash(req.Hash) if err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid hash") + return nil, status.Error(codes.InvalidArgument, errorsmod.Wrap(err, "invalid hash").Error()) } payload, err := s.pendingPayload(ctx, hash) if err != nil { - return nil, status.Error(codes.NotFound, "payload not found") + return nil, status.Error(codes.NotFound, errorsmod.Wrap(err, "payload not found").Error()) } return &orbitertypes.QueryPendingPayloadResponse{ diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index 559b3993..151ecc19 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -42,7 +42,7 @@ func TestPendingPayload(t *testing.T) { exampleHash, err := examplePayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") - testcases := []struct { + testCases := []struct { name string setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) expPayload *core.PendingPayload @@ -91,7 +91,7 @@ func TestPendingPayload(t *testing.T) { }, } - for _, tc := range testcases { + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/proto/noble/orbiter/core/v1/orbiter.proto b/proto/noble/orbiter/core/v1/orbiter.proto index 838a9add..c1689136 100644 --- a/proto/noble/orbiter/core/v1/orbiter.proto +++ b/proto/noble/orbiter/core/v1/orbiter.proto @@ -79,6 +79,6 @@ message PayloadWrapper { message PendingPayload { // The sequence number of the pending payload. uint64 sequence = 1; - // The submitted payload that will is registered as pending. + // The submitted payload that will be registered as pending. Payload payload = 2; } diff --git a/types/core/orbiter.pb.go b/types/core/orbiter.pb.go index 98c2b8a2..2bdd80f1 100644 --- a/types/core/orbiter.pb.go +++ b/types/core/orbiter.pb.go @@ -234,7 +234,7 @@ func (m *PayloadWrapper) GetOrbiter() *Payload { type PendingPayload struct { // The sequence number of the pending payload. Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` - // The submitted payload that will is registered as pending. + // The submitted payload that will be registered as pending. Payload *Payload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` } diff --git a/types/core/payload.go b/types/core/payload.go index 4c175775..3842e4e1 100644 --- a/types/core/payload.go +++ b/types/core/payload.go @@ -51,8 +51,8 @@ const PayloadHashLength = 32 // the generated SHA256 hashes for the PendingPayload type. type PayloadHash [PayloadHashLength]byte -// ParsePayloadHash takes a string and tries to parse a PayloadHash from it. -func ParsePayloadHash(s string) (*PayloadHash, error) { +// NewPayloadHash takes a string and tries to parse a PayloadHash from it. +func NewPayloadHash(s string) (*PayloadHash, error) { bz, err := hex.DecodeString(s) if err != nil { return nil, errorsmod.Wrap(err, "invalid payload hash") diff --git a/types/core/payload_test.go b/types/core/payload_test.go index 83a55b07..41094ea0 100644 --- a/types/core/payload_test.go +++ b/types/core/payload_test.go @@ -36,13 +36,13 @@ func TestPayloadRoundTrip(t *testing.T) { hash, err := pp.SHA256Hash() require.NoError(t, err, "failed to hash payload") - parsedHash, err := core.ParsePayloadHash(hash.String()) + parsedHash, err := core.NewPayloadHash(hash.String()) require.NoError(t, err, "failed to parse payload hash") require.Equal(t, hash.String(), parsedHash.String(), "payload hash mismatch") } -func TestParsePayloadHash(t *testing.T) { +func TestNewPayloadHash(t *testing.T) { t.Parallel() pp := createPendingPayload(t) @@ -75,7 +75,7 @@ func TestParsePayloadHash(t *testing.T) { t.Run(tc.name, func(t *testing.T) { t.Parallel() - parsed, err := core.ParsePayloadHash(tc.input) + parsed, err := core.NewPayloadHash(tc.input) if tc.errContains == "" { require.NoError(t, err, "failed to parse payload hash") require.Equal(t, tc.input, parsed.String(), "payload hash mismatch") From 3732e828655cf29aa5c0c38fddc4389b71c580ca Mon Sep 17 00:00:00 2001 From: MalteHerrmann <42640438+MalteHerrmann@users.noreply.github.com> Date: Mon, 20 Oct 2025 09:46:26 +0200 Subject: [PATCH 27/29] feat: add clean up logic for pending payloads (#52) This PR adds the required logic to clean up pending payloads after they have been submitted for a given lifespan period (currently set to 1 day). The clean up is done in the `BeginBlock` and is limited to 200 payloads per block to avoid running into timeouts or deadlocks after spam attacks through mass payload submissions. The iteration over the registered payloads is implemented by adding a new `collections.Index` for the block time of submission and using an `IndexedMap` instead of a regular `Map`. This makes it possible to call `k.pendingPayloads.Indexes.HashByTime.Walk(...)` which has a ranger implementation passed, to only iterate through those payloads that are expired. --- api/core/v1/orbiter.pulsar.go | 111 ++++++++--- api/v1/tx.pulsar.go | 38 ++-- keeper/abci.go | 41 ++++ keeper/abci_test.go | 79 ++++++++ keeper/keeper.go | 29 ++- keeper/msg_server.go | 2 +- keeper/msg_server_test.go | 83 +++++--- keeper/payload_handler.go | 67 ++++++- keeper/payload_handler_test.go | 219 ++++++++++++++++++++-- keeper/query_server_test.go | 36 ++-- module.go | 6 + proto/generate.sh | 2 +- proto/noble/orbiter/core/v1/orbiter.proto | 2 + proto/noble/orbiter/v1/tx.proto | 4 +- simapp/app.yaml | 2 +- types/core/keys.go | 4 + types/core/orbiter.pb.go | 101 ++++++---- types/core/payload_test.go | 22 +-- types/tx.pb.go | 40 ++-- 19 files changed, 708 insertions(+), 180 deletions(-) create mode 100644 keeper/abci.go create mode 100644 keeper/abci_test.go diff --git a/api/core/v1/orbiter.pulsar.go b/api/core/v1/orbiter.pulsar.go index 856f8f94..e63c3105 100644 --- a/api/core/v1/orbiter.pulsar.go +++ b/api/core/v1/orbiter.pulsar.go @@ -2056,9 +2056,10 @@ func (x *fastReflection_PayloadWrapper) ProtoMethods() *protoiface.Methods { } var ( - md_PendingPayload protoreflect.MessageDescriptor - fd_PendingPayload_sequence protoreflect.FieldDescriptor - fd_PendingPayload_payload protoreflect.FieldDescriptor + md_PendingPayload protoreflect.MessageDescriptor + fd_PendingPayload_sequence protoreflect.FieldDescriptor + fd_PendingPayload_payload protoreflect.FieldDescriptor + fd_PendingPayload_timestamp protoreflect.FieldDescriptor ) func init() { @@ -2066,6 +2067,7 @@ func init() { md_PendingPayload = File_noble_orbiter_core_v1_orbiter_proto.Messages().ByName("PendingPayload") fd_PendingPayload_sequence = md_PendingPayload.Fields().ByName("sequence") fd_PendingPayload_payload = md_PendingPayload.Fields().ByName("payload") + fd_PendingPayload_timestamp = md_PendingPayload.Fields().ByName("timestamp") } var _ protoreflect.Message = (*fastReflection_PendingPayload)(nil) @@ -2145,6 +2147,12 @@ func (x *fastReflection_PendingPayload) Range(f func(protoreflect.FieldDescripto return } } + if x.Timestamp != int64(0) { + value := protoreflect.ValueOfInt64(x.Timestamp) + if !f(fd_PendingPayload_timestamp, value) { + return + } + } } // Has reports whether a field is populated. @@ -2164,6 +2172,8 @@ func (x *fastReflection_PendingPayload) Has(fd protoreflect.FieldDescriptor) boo return x.Sequence != uint64(0) case "noble.orbiter.core.v1.PendingPayload.payload": return x.Payload != nil + case "noble.orbiter.core.v1.PendingPayload.timestamp": + return x.Timestamp != int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) @@ -2184,6 +2194,8 @@ func (x *fastReflection_PendingPayload) Clear(fd protoreflect.FieldDescriptor) { x.Sequence = uint64(0) case "noble.orbiter.core.v1.PendingPayload.payload": x.Payload = nil + case "noble.orbiter.core.v1.PendingPayload.timestamp": + x.Timestamp = int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) @@ -2206,6 +2218,9 @@ func (x *fastReflection_PendingPayload) Get(descriptor protoreflect.FieldDescrip case "noble.orbiter.core.v1.PendingPayload.payload": value := x.Payload return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "noble.orbiter.core.v1.PendingPayload.timestamp": + value := x.Timestamp + return protoreflect.ValueOfInt64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) @@ -2230,6 +2245,8 @@ func (x *fastReflection_PendingPayload) Set(fd protoreflect.FieldDescriptor, val x.Sequence = value.Uint() case "noble.orbiter.core.v1.PendingPayload.payload": x.Payload = value.Message().Interface().(*Payload) + case "noble.orbiter.core.v1.PendingPayload.timestamp": + x.Timestamp = value.Int() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) @@ -2257,6 +2274,8 @@ func (x *fastReflection_PendingPayload) Mutable(fd protoreflect.FieldDescriptor) return protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) case "noble.orbiter.core.v1.PendingPayload.sequence": panic(fmt.Errorf("field sequence of message noble.orbiter.core.v1.PendingPayload is not mutable")) + case "noble.orbiter.core.v1.PendingPayload.timestamp": + panic(fmt.Errorf("field timestamp of message noble.orbiter.core.v1.PendingPayload is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) @@ -2275,6 +2294,8 @@ func (x *fastReflection_PendingPayload) NewField(fd protoreflect.FieldDescriptor case "noble.orbiter.core.v1.PendingPayload.payload": m := new(Payload) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "noble.orbiter.core.v1.PendingPayload.timestamp": + return protoreflect.ValueOfInt64(int64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.core.v1.PendingPayload")) @@ -2351,6 +2372,9 @@ func (x *fastReflection_PendingPayload) ProtoMethods() *protoiface.Methods { l = options.Size(x.Payload) n += 1 + l + runtime.Sov(uint64(l)) } + if x.Timestamp != 0 { + n += 1 + runtime.Sov(uint64(x.Timestamp)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -2380,6 +2404,11 @@ func (x *fastReflection_PendingPayload) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Timestamp != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Timestamp)) + i-- + dAtA[i] = 0x18 + } if x.Payload != nil { encoded, err := options.Marshal(x.Payload) if err != nil { @@ -2503,6 +2532,25 @@ func (x *fastReflection_PendingPayload) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + x.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Timestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -2765,6 +2813,8 @@ type PendingPayload struct { Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` // The submitted payload that will be registered as pending. Payload *Payload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` + // The block time of inclusion of the payload in nanoseconds. + Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (x *PendingPayload) Reset() { @@ -2801,6 +2851,13 @@ func (x *PendingPayload) GetPayload() *Payload { return nil } +func (x *PendingPayload) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + var File_noble_orbiter_core_v1_orbiter_proto protoreflect.FileDescriptor var file_noble_orbiter_core_v1_orbiter_proto_rawDesc = []byte{ @@ -2852,29 +2909,31 @@ var file_noble_orbiter_core_v1_orbiter_proto_rawDesc = []byte{ 0x70, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x22, 0x66, 0x0a, - 0x0e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x70, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6e, - 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0xe2, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, - 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, - 0x69, 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, - 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x63, - 0x6f, 0x72, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x43, 0xaa, 0x02, 0x15, 0x4e, 0x6f, - 0x62, 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x72, 0x65, - 0x2e, 0x56, 0x31, 0xca, 0x02, 0x15, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, - 0x74, 0x65, 0x72, 0x5c, 0x43, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x21, 0x4e, 0x6f, - 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x43, 0x6f, 0x72, 0x65, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x18, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, - 0x3a, 0x3a, 0x43, 0x6f, 0x72, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x22, 0x84, 0x01, + 0x0a, 0x0e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x07, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, + 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x07, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x42, 0xe2, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x6e, 0x6f, 0x62, + 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x76, 0x31, 0x42, 0x0c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, + 0x6f, 0x62, 0x6c, 0x65, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x6f, 0x72, 0x62, 0x69, + 0x74, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, + 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, + 0x72, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4e, 0x4f, 0x43, 0xaa, 0x02, 0x15, 0x4e, 0x6f, 0x62, + 0x6c, 0x65, 0x2e, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x15, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, + 0x65, 0x72, 0x5c, 0x43, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x21, 0x4e, 0x6f, 0x62, + 0x6c, 0x65, 0x5c, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x5c, 0x43, 0x6f, 0x72, 0x65, 0x5c, + 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x18, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x3a, 0x3a, 0x4f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x3a, + 0x3a, 0x43, 0x6f, 0x72, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/api/v1/tx.pulsar.go b/api/v1/tx.pulsar.go index 79f46c50..6df89827 100644 --- a/api/v1/tx.pulsar.go +++ b/api/v1/tx.pulsar.go @@ -575,8 +575,8 @@ func (x *fastReflection_MsgSubmitPayloadResponse) Interface() protoreflect.Proto // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgSubmitPayloadResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Hash) != 0 { - value := protoreflect.ValueOfBytes(x.Hash) + if x.Hash != "" { + value := protoreflect.ValueOfString(x.Hash) if !f(fd_MsgSubmitPayloadResponse_hash, value) { return } @@ -597,7 +597,7 @@ func (x *fastReflection_MsgSubmitPayloadResponse) Range(f func(protoreflect.Fiel func (x *fastReflection_MsgSubmitPayloadResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": - return len(x.Hash) != 0 + return x.Hash != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) @@ -615,7 +615,7 @@ func (x *fastReflection_MsgSubmitPayloadResponse) Has(fd protoreflect.FieldDescr func (x *fastReflection_MsgSubmitPayloadResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": - x.Hash = nil + x.Hash = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) @@ -634,7 +634,7 @@ func (x *fastReflection_MsgSubmitPayloadResponse) Get(descriptor protoreflect.Fi switch descriptor.FullName() { case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": value := x.Hash - return protoreflect.ValueOfBytes(value) + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) @@ -656,7 +656,7 @@ func (x *fastReflection_MsgSubmitPayloadResponse) Get(descriptor protoreflect.Fi func (x *fastReflection_MsgSubmitPayloadResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": - x.Hash = value.Bytes() + x.Hash = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) @@ -693,7 +693,7 @@ func (x *fastReflection_MsgSubmitPayloadResponse) Mutable(fd protoreflect.FieldD func (x *fastReflection_MsgSubmitPayloadResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "noble.orbiter.v1.MsgSubmitPayloadResponse.hash": - return protoreflect.ValueOfBytes(nil) + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.MsgSubmitPayloadResponse")) @@ -856,7 +856,7 @@ func (x *fastReflection_MsgSubmitPayloadResponse) ProtoMethods() *protoiface.Met if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -866,25 +866,23 @@ func (x *fastReflection_MsgSubmitPayloadResponse) ProtoMethods() *protoiface.Met } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) - if x.Hash == nil { - x.Hash = []byte{} - } + x.Hash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -989,8 +987,8 @@ type MsgSubmitPayloadResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The sha256 hash that references the submitted payload in the module storage. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // The hex representation of the hash that references the submitted payload in the module storage. + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } func (x *MsgSubmitPayloadResponse) Reset() { @@ -1013,11 +1011,11 @@ func (*MsgSubmitPayloadResponse) Descriptor() ([]byte, []int) { return file_noble_orbiter_v1_tx_proto_rawDescGZIP(), []int{1} } -func (x *MsgSubmitPayloadResponse) GetHash() []byte { +func (x *MsgSubmitPayloadResponse) GetHash() string { if x != nil { return x.Hash } - return nil + return "" } var File_noble_orbiter_v1_tx_proto protoreflect.FileDescriptor @@ -1042,7 +1040,7 @@ var file_noble_orbiter_v1_tx_proto_rawDesc = []byte{ 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x2e, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x32, 0x6d, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x32, 0x6d, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5f, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x22, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x79, diff --git a/keeper/abci.go b/keeper/abci.go new file mode 100644 index 00000000..819357a4 --- /dev/null +++ b/keeper/abci.go @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper + +import ( + "context" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const PendingPayloadLifespan = 24 * time.Hour + +func (k *Keeper) BeginBlock(ctx context.Context) error { + blockTime := sdk.UnwrapSDKContext(ctx).BlockTime().UnixNano() + + cutoff := time.Unix( + 0, + blockTime-PendingPayloadLifespan.Nanoseconds(), + ) + + return k.RemoveExpiredPayloads(ctx, cutoff) +} diff --git a/keeper/abci_test.go b/keeper/abci_test.go new file mode 100644 index 00000000..eff1225f --- /dev/null +++ b/keeper/abci_test.go @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: BUSL-1.1 +// +// Copyright (C) 2025, NASD Inc. All rights reserved. +// Use of this software is governed by the Business Source License included +// in the LICENSE file of this repository and at www.mariadb.com/bsl11. +// +// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY +// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER +// VERSIONS OF THE LICENSED WORK. +// +// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF +// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF +// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). +// +// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON +// AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, +// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND +// TITLE. + +package keeper_test + +import ( + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/require" + + orbiterkeeper "github.com/noble-assets/orbiter/keeper" + mockorbiter "github.com/noble-assets/orbiter/testutil/mocks/orbiter" + orbitertypes "github.com/noble-assets/orbiter/types" +) + +func TestBeginBlock(t *testing.T) { + ctx, _, k := mockorbiter.OrbiterKeeper(t) + ms := orbiterkeeper.NewMsgServer(k) + qs := orbiterkeeper.NewQueryServer(k) + + pendingPayload, err := createTestPendingPayloadWithSequence(0, ctx.BlockTime()) + require.NoError(t, err, "failed to create pending payload") + + hash, err := pendingPayload.SHA256Hash() + require.NoError(t, err, "failed to create payload hash") + + payloadBz, err := orbitertypes.MarshalJSON(k.Codec(), pendingPayload.Payload) + require.NoError(t, err, "failed to marshal payload to json") + + // ASSERT: should run fine with no pending payloads. + require.NoError(t, k.BeginBlock(ctx), "failed to run begin block") + + // ACT: set up a pending payload. + res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{Payload: string(payloadBz)}) + require.NoError(t, err, "failed to submit payload") + require.Equal(t, hash.String(), res.Hash, "expected different hash") + + // ASSERT: payload should be registered. + _, err = qs.PendingPayload(ctx, &orbitertypes.QueryPendingPayloadRequest{Hash: hash.String()}) + require.NoError(t, err, "failed to query pending payload") + + // ASSERT: running begin block should NOT remove the just submitted payload. + ctx = ctx.WithBlockTime(ctx.BlockTime().Add(time.Hour)) + require.NoError(t, k.BeginBlock(ctx), "failed to run begin block with payload registered") + + _, err = qs.PendingPayload(ctx, &orbitertypes.QueryPendingPayloadRequest{Hash: hash.String()}) + require.NoError(t, err, "expected payload to still be registered") + + // ASSERT: after passing the lifespan, the pending payload should be removed. + ctx = ctx.WithBlockTime(ctx.BlockTime().Add(orbiterkeeper.PendingPayloadLifespan)) + require.NoError(t, k.BeginBlock(ctx), "failed to run begin block with expired payload") + + _, err = qs.PendingPayload(ctx, &orbitertypes.QueryPendingPayloadRequest{Hash: hash.String()}) + require.ErrorContains( + t, + err, + fmt.Sprintf("payload with hash %s: not found", hash.String()), + "expected payload to not be registered", + ) +} diff --git a/keeper/keeper.go b/keeper/keeper.go index 6fb78c21..327bcd8a 100644 --- a/keeper/keeper.go +++ b/keeper/keeper.go @@ -25,6 +25,7 @@ import ( "fmt" "cosmossdk.io/collections" + "cosmossdk.io/collections/indexes" "cosmossdk.io/core/address" "cosmossdk.io/core/event" "cosmossdk.io/core/store" @@ -58,12 +59,31 @@ type Keeper struct { adapter *adaptercomp.Adapter // pendingPayloads stores the pending payloads addressed by their sha256 hash. - pendingPayloads collections.Map[[]byte, core.PendingPayload] + pendingPayloads *collections.IndexedMap[[]byte, core.PendingPayload, HashToTimeIndex] // pendingPayloadsSequence is the unique identifier of a given pending payload handled by the // orbiter. pendingPayloadsSequence collections.Sequence } +type HashToTimeIndex struct { + *indexes.Multi[int64, []byte, core.PendingPayload] +} + +func NewHashToTimeIndex(sb *collections.SchemaBuilder) HashToTimeIndex { + return HashToTimeIndex{ + Multi: indexes.NewMulti( + sb, + core.HashesByTimeIndexPrefix, + core.HashesByTimeIndexName, + collections.Int64Key, + collections.BytesKey, + func(hash []byte, payload core.PendingPayload) (int64, error) { + return payload.Timestamp, nil + }, + ), + } +} + // NewKeeper returns a reference to a validated instance of the keeper. // Panic if the keeper initialization fails. func NewKeeper( @@ -87,12 +107,17 @@ func NewKeeper( logger: logger.With("module", fmt.Sprintf("x/%s", core.ModuleName)), authority: authority, - pendingPayloads: collections.NewMap[[]byte, core.PendingPayload]( + pendingPayloads: collections.NewIndexedMap[ + []byte, + core.PendingPayload, + HashToTimeIndex, + ]( sb, core.PendingPayloadsPrefix, core.PendingPayloadsName, collections.BytesKey, codec.CollValue[core.PendingPayload](cdc), + NewHashToTimeIndex(sb), ), pendingPayloadsSequence: collections.NewSequence( sb, diff --git a/keeper/msg_server.go b/keeper/msg_server.go index 73666408..4c88cf6a 100644 --- a/keeper/msg_server.go +++ b/keeper/msg_server.go @@ -76,6 +76,6 @@ func (s *msgServer) SubmitPayload( } return &orbitertypes.MsgSubmitPayloadResponse{ - Hash: payloadHash, + Hash: payloadHash.String(), }, nil } diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go index 2d559719..a6d62c1d 100644 --- a/keeper/msg_server_test.go +++ b/keeper/msg_server_test.go @@ -23,9 +23,12 @@ package keeper_test import ( "context" "testing" + "time" "github.com/stretchr/testify/require" + errorsmod "cosmossdk.io/errors" + orbiterkeeper "github.com/noble-assets/orbiter/keeper" "github.com/noble-assets/orbiter/testutil" mockorbiter "github.com/noble-assets/orbiter/testutil/mocks/orbiter" @@ -37,7 +40,10 @@ import ( func TestSubmitPayload(t *testing.T) { seq := uint64(0) - examplePayload := createTestPendingPayloadWithSequence(t, seq) + + nowUTC := time.Now().UTC() + examplePayload, err := createTestPendingPayloadWithSequence(seq, nowUTC) + require.NoError(t, err, "failed to create test payload") exampleHash, err := examplePayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") @@ -46,11 +52,11 @@ func TestSubmitPayload(t *testing.T) { recipient := testutil.RandomBytes(32) testCases := []struct { - name string - setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) - payload func() *core.Payload - errContains string - expHash *core.PayloadHash + name string + setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) + payload func() *core.Payload + expError string + expHash *core.PayloadHash }{ { name: "success - valid payload", @@ -78,7 +84,7 @@ func TestSubmitPayload(t *testing.T) { return &p }, - errContains: "action ACTION_FEE is paused", + expError: "action ACTION_FEE is paused", }, { name: "error - payload contains paused protocol", @@ -98,7 +104,7 @@ func TestSubmitPayload(t *testing.T) { return &p }, - errContains: "protocol PROTOCOL_CCTP is paused", + expError: "protocol PROTOCOL_CCTP is paused", }, { name: "error - payload contains paused cross-chain", @@ -123,12 +129,12 @@ func TestSubmitPayload(t *testing.T) { return &p }, - errContains: "cross-chain 2:1 is paused", + expError: "cross-chain 2:1 is paused", }, { - name: "error - invalid (empty) payload", - payload: func() *core.Payload { return &core.Payload{} }, - errContains: "forwarding is not set: invalid nil pointer", + name: "error - invalid (empty) payload", + payload: func() *core.Payload { return &core.Payload{} }, + expError: "forwarding is not set: invalid nil pointer", }, } @@ -137,6 +143,8 @@ func TestSubmitPayload(t *testing.T) { ctx, _, k := mockorbiter.OrbiterKeeper(t) ms := orbiterkeeper.NewMsgServer(k) + ctx = ctx.WithBlockTime(nowUTC) + if tc.setup != nil { tc.setup(t, ctx, k) } @@ -147,11 +155,11 @@ func TestSubmitPayload(t *testing.T) { res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ Payload: string(payloadJSON), }) - if tc.errContains == "" { + if tc.expError == "" { require.NoError(t, err, "failed to submit payload") - require.Equal(t, tc.expHash.String(), core.PayloadHash(res.Hash).String()) + require.Equal(t, tc.expHash.String(), res.Hash, "expected different hash") } else { - require.ErrorContains(t, err, tc.errContains, "expected different error") + require.ErrorContains(t, err, tc.expError, "expected different error") } }) } @@ -164,7 +172,14 @@ func TestSubsequentSubmissions(t *testing.T) { ctx, _, k := mockorbiter.OrbiterKeeper(t) ms := orbiterkeeper.NewMsgServer(k) - validPayload := createTestPendingPayloadWithSequence(t, 0) + nowUTC := time.Now().UTC() + ctx = ctx.WithBlockTime(nowUTC) + + validPayload, err := createTestPendingPayloadWithSequence(0, nowUTC) + require.NoError(t, err, "failed to create pending payload") + + validPayload.Timestamp = nowUTC.UnixNano() + expHash, err := validPayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") @@ -179,8 +194,7 @@ func TestSubsequentSubmissions(t *testing.T) { require.NoError(t, err, "failed to submit payload") // ASSERT: expected hash is returned - gotHash := core.PayloadHash(res.Hash) - require.Equal(t, expHash.String(), gotHash.String(), "expected different hash") + require.Equal(t, expHash.String(), res.Hash, "expected different hash") // ACT: submit identical payload again res2, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ @@ -194,22 +208,28 @@ func TestSubsequentSubmissions(t *testing.T) { require.NoError(t, err, "failed to hash payload") // ASSERT: expected hash is returned - gotHash2 := core.PayloadHash(res2.Hash) - require.Equal(t, expHash2.String(), gotHash2.String(), "expected different hash") + require.Equal(t, expHash2.String(), res2.Hash, "expected different hash") // ASSERT: hashes of subsequent submissions of the same payload are different - require.NotEqual(t, gotHash.String(), gotHash2.String(), "expected different hashes") + require.NotEqual(t, res.Hash, res2.Hash, "expected different hashes") } func TestDifferentSequenceGeneratesDifferentHash(t *testing.T) { // ACT: Generate pending payload with sequence 1 seq := uint64(1) - validForwarding := createTestPendingPayloadWithSequence(t, seq) + + nowUTC := time.Now().UTC() + + validForwarding, err := createTestPendingPayloadWithSequence(seq, nowUTC) + require.NoError(t, err, "failed to create pending payload") + expHash, err := validForwarding.SHA256Hash() require.NoError(t, err, "failed to hash payload") // ACT: Generate pending payload with sequence 2 - validForwarding2 := createTestPendingPayloadWithSequence(t, seq+1) + validForwarding2, err := createTestPendingPayloadWithSequence(seq+1, nowUTC) + require.NoError(t, err, "failed to create payload") + expHash2, err := validForwarding2.SHA256Hash() require.NoError(t, err, "failed to hash payload") @@ -225,11 +245,9 @@ func TestDifferentSequenceGeneratesDifferentHash(t *testing.T) { // createTestPendingPayloadWithSequence creates a new example payload that can be submitted // to the state handler. func createTestPendingPayloadWithSequence( - t *testing.T, sequence uint64, -) *core.PendingPayload { - t.Helper() - + timestamp time.Time, +) (*core.PendingPayload, error) { recipient := make([]byte, 32) copy(recipient[32-3:], []byte{1, 2, 3}) @@ -239,7 +257,9 @@ func createTestPendingPayloadWithSequence( recipient, nil, ) - require.NoError(t, err, "failed to create valid forwarding") + if err != nil { + return nil, errorsmod.Wrap(err, "failed to create valid forwarding") + } validPayload := &core.Payload{ PreActions: nil, @@ -247,7 +267,8 @@ func createTestPendingPayloadWithSequence( } return &core.PendingPayload{ - Sequence: sequence, - Payload: validPayload, - } + Sequence: sequence, + Payload: validPayload, + Timestamp: timestamp.UnixNano(), + }, nil } diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go index a270485e..ee8425a4 100644 --- a/keeper/payload_handler.go +++ b/keeper/payload_handler.go @@ -24,13 +24,24 @@ import ( "context" "errors" "fmt" + "time" + "cosmossdk.io/collections" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/noble-assets/orbiter/types/core" ) +// ExpiredPayloadsLimit defines the maximum number of expired payloads +// removed during the ABCI hooks. +// +// We're limiting the amount of payloads handled here to avoid +// impacts of spam attacks that would slow down the begin block logic +// by iterating over thousands of spam payloads. +const ExpiredPayloadsLimit = 200 + // submit adds a new pending payload into the module storage. // If the payload's hash is already set, an error is returned. // @@ -38,15 +49,18 @@ import ( func (k *Keeper) submit( ctx context.Context, payload *core.Payload, -) ([]byte, error) { +) (*core.PayloadHash, error) { next, err := k.pendingPayloadsSequence.Next(ctx) if err != nil { return nil, errorsmod.Wrap(err, "failed to get next sequence number") } + sdkCtx := sdk.UnwrapSDKContext(ctx) + pendingPayload := core.PendingPayload{ - Sequence: next, - Payload: payload, + Sequence: next, + Payload: payload, + Timestamp: sdkCtx.BlockTime().UnixNano(), } hash, err := pendingPayload.SHA256Hash() @@ -62,18 +76,18 @@ func (k *Keeper) submit( } if found { - k.Logger().Error("payload hash already registered", "hash", hash.String()) + k.logger.Error("payload hash already registered", "hash", hash.String()) return nil, errors.New("payload hash already registered") } - k.Logger().Debug("payload registered", "hash", hash.String(), "payload", payload.String()) + k.logger.Debug("payload registered", "hash", hash.String(), "payload", payload.String()) if err = k.pendingPayloads.Set(ctx, hashBz, pendingPayload); err != nil { return nil, errorsmod.Wrap(err, "failed to set pending payload") } - return hashBz, nil + return hash, nil } // validatePayloadAgainstState checks if the payload is valid with respect @@ -182,3 +196,44 @@ func (k *Keeper) RemovePendingPayload( return nil } + +// RemoveExpiredPayloads ranges over the payloads by their submission timestamps +// and removes those that are older than the cutoff date. +func (k *Keeper) RemoveExpiredPayloads( + ctx context.Context, + cutoff time.Time, +) error { + // NOTE: we range over all hashes from zero time UNTIL the cutoff. + rng := collections.NewPrefixUntilPairRange[int64, []byte](cutoff.UnixNano()) + + var count int + if err := k.pendingPayloads.Indexes.Walk( + ctx, + rng, + func(_ int64, hash []byte) (stop bool, err error) { + count++ + if count > ExpiredPayloadsLimit { + return true, nil + } + + h := core.PayloadHash(hash) + + err = k.RemovePendingPayload(ctx, &h) + if err != nil { + k.Logger().Error( + "failed to remove pending payload", + "hash", h.String(), + "error", err.Error(), + ) + + return true, err + } + + return false, nil + }, + ); err != nil { + return errorsmod.Wrap(err, "failed to iterate pending payloads") + } + + return nil +} diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index f174066a..1463aad9 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -23,10 +23,13 @@ package keeper_test import ( "context" "testing" + "time" "github.com/stretchr/testify/require" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" orbiterkeeper "github.com/noble-assets/orbiter/keeper" @@ -38,15 +41,19 @@ import ( func TestRemovePayload(t *testing.T) { t.Parallel() - validPayload := createTestPendingPayloadWithSequence(t, 0) + nowUTC := time.Now().UTC() + + validPayload, err := createTestPendingPayloadWithSequence(0, nowUTC) + require.NoError(t, err, "creating test pending payload") + expHash, err := validPayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") testcases := []struct { - name string - setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) - hash *core.PayloadHash - errContains string + name string + setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) + hash *core.PayloadHash + expError string }{ { name: "success - valid payload", @@ -67,16 +74,16 @@ func TestRemovePayload(t *testing.T) { name: "error - valid payload but not found in store", setup: nil, hash: expHash, - errContains: sdkerrors.ErrNotFound.Wrapf( + expError: sdkerrors.ErrNotFound.Wrapf( "payload with hash %q", expHash.String(), ).Error(), }, { - name: "error - nil hash", - setup: nil, - hash: nil, - errContains: core.ErrNilPointer.Wrap("payload hash").Error(), + name: "error - nil hash", + setup: nil, + hash: nil, + expError: core.ErrNilPointer.Wrap("payload hash").Error(), }, } @@ -88,12 +95,14 @@ func TestRemovePayload(t *testing.T) { ms := orbiterkeeper.NewMsgServer(k) qs := orbiterkeeper.NewQueryServer(k) + ctx = ctx.WithBlockTime(nowUTC) + if tc.setup != nil { tc.setup(t, ctx, k.Codec(), ms) } err := k.RemovePendingPayload(ctx, tc.hash) - if tc.errContains == "" { + if tc.expError == "" { require.NoError(t, err, "failed to remove payload") // ASSERT: value with hash was removed. @@ -106,8 +115,194 @@ func TestRemovePayload(t *testing.T) { require.Error(t, err, "payload should not be present anymore") require.Nil(t, gotPayload, "expected nil payload") } else { - require.ErrorContains(t, err, tc.errContains, "expected different error") + require.ErrorContains(t, err, tc.expError, "expected different error") + } + }) + } +} + +const timeBetweenBlocks = 1 * time.Second + +func TestRemovePayloads(t *testing.T) { + nowUTC := time.Now().UTC() + + testCases := []struct { + name string + setup func(sdk.Context, codec.Codec, orbitertypes.MsgServer) ([]string, error) + cutoff time.Time + expRemoved int + expError string + }{ + { + name: "success - remove only expired payloads", + setup: func(ctx sdk.Context, cdc codec.Codec, ms orbitertypes.MsgServer) ([]string, error) { + return setupPayloadsInState(ctx, cdc, ms, 4) + }, + cutoff: nowUTC.Add(2 * timeBetweenBlocks), + expRemoved: 2, + }, + { + name: "success - nothing should be removed if all are not expired", + setup: func(ctx sdk.Context, cdc codec.Codec, ms orbitertypes.MsgServer) ([]string, error) { + return setupPayloadsInState(ctx, cdc, ms, 4) + }, + cutoff: nowUTC, + expRemoved: 0, + }, + { + name: "success - no submitted payloads", + setup: nil, + cutoff: nowUTC.Add(2 * timeBetweenBlocks), + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + ctx, _, k := mockorbiter.OrbiterKeeper(t) + ms := orbiterkeeper.NewMsgServer(k) + qs := orbiterkeeper.NewQueryServer(k) + + // we set the context's block time to be sure of the behavior + ctx.WithBlockTime(nowUTC) + + var hashes []string + if tc.setup != nil { + var err error + hashes, err = tc.setup(ctx, k.Codec(), ms) + require.NoError(t, err, "failed to setup testcase") + } + + err := k.RemoveExpiredPayloads(ctx, tc.cutoff) + if tc.expError == "" { + require.NoError(t, err, "failed to remove expired payloads") + + // ASSERT: outdated ones were removed. + for _, hash := range hashes[:tc.expRemoved] { + _, err = qs.PendingPayload( + ctx, + &orbitertypes.QueryPendingPayloadRequest{Hash: hash}, + ) + require.ErrorContains( + t, + err, + "payload not found", + "payload should have been removed", + ) + } + + // ASSERT: active ones are not removed. + for _, hash := range hashes[tc.expRemoved:] { + _, err = qs.PendingPayload( + ctx, + &orbitertypes.QueryPendingPayloadRequest{Hash: hash}, + ) + require.NoError(t, err, "payload should not have been removed") + } + } else { + require.ErrorContains(t, err, tc.expError, "expected different error") } }) } } + +func setupPayloadsInState( + ctx sdk.Context, + codec codec.Codec, + ms orbitertypes.MsgServer, + nPayloads int, +) ([]string, error) { + validPayload, err := createTestPendingPayloadWithSequence(0, ctx.BlockTime().UTC()) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to create test payload") + } + + payloadBz, err := codec.MarshalJSON(validPayload.Payload) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to marshal payload") + } + + hashes := make([]string, nPayloads) + for i := range nPayloads { + res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Payload: string(payloadBz), + }) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to submit payload during setup") + } + + hashes[i] = res.Hash + + ctx = ctx.WithBlockTime(ctx.BlockTime().Add(timeBetweenBlocks)) + } + + return hashes, nil +} + +func BenchmarkRemovePendingPayload(b *testing.B) { + b.StopTimer() + + ctx, _, k := mockorbiter.OrbiterKeeper(b) + ms := orbiterkeeper.NewMsgServer(k) + + pending, err := createTestPendingPayloadWithSequence(0, ctx.BlockTime()) + if err != nil { + b.Fatal(err) + } + + payloadBz, err := orbitertypes.MarshalJSON(k.Codec(), pending.Payload) + if err != nil { + b.Fatal(err) + } + + b.ResetTimer() + + for b.Loop() { + res, err := ms.SubmitPayload(ctx, &orbitertypes.MsgSubmitPayload{ + Payload: string(payloadBz), + }) + if err != nil { + b.Fatal(err) + } + + hash, err := core.NewPayloadHash(res.Hash) + if err != nil { + b.Fatal(err) + } + + b.StartTimer() + + err = k.RemovePendingPayload(ctx, hash) + if err != nil { + b.Fatal(err) + } + + b.StopTimer() + } +} + +func BenchmarkRemoveExpiredPayloads(b *testing.B) { + b.StopTimer() + b.ResetTimer() + + ctx, _, k := mockorbiter.OrbiterKeeper(b) + ms := orbiterkeeper.NewMsgServer(k) + + for b.Loop() { + if _, err := setupPayloadsInState( + ctx, + k.Codec(), + ms, + orbiterkeeper.ExpiredPayloadsLimit, + ); err != nil { + b.Fatal(err) + } + + b.StartTimer() + + if err := k.RemoveExpiredPayloads(ctx, ctx.BlockTime()); err != nil { + b.Fatal(err) + } + + b.StopTimer() + } +} diff --git a/keeper/query_server_test.go b/keeper/query_server_test.go index 151ecc19..c3765bc5 100644 --- a/keeper/query_server_test.go +++ b/keeper/query_server_test.go @@ -23,6 +23,7 @@ package keeper_test import ( "context" "testing" + "time" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" @@ -38,16 +39,20 @@ import ( func TestPendingPayload(t *testing.T) { t.Parallel() - examplePayload := createTestPendingPayloadWithSequence(t, 0) + nowUTC := time.Now().UTC() + + examplePayload, err := createTestPendingPayloadWithSequence(0, nowUTC) + require.NoError(t, err, "failed to create test payload") + exampleHash, err := examplePayload.SHA256Hash() require.NoError(t, err, "failed to hash payload") testCases := []struct { - name string - setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) - expPayload *core.PendingPayload - req *orbitertypes.QueryPendingPayloadRequest - errContains string + name string + setup func(*testing.T, context.Context, codec.Codec, orbitertypes.MsgServer) + expPayload *core.PendingPayload + req *orbitertypes.QueryPendingPayloadRequest + expError string }{ { name: "success - hash found", @@ -73,13 +78,13 @@ func TestPendingPayload(t *testing.T) { req: &orbitertypes.QueryPendingPayloadRequest{ Hash: exampleHash.String(), }, - errContains: codes.NotFound.String(), + expError: codes.NotFound.String(), }, { - name: "error - nil request", - setup: nil, - req: nil, - errContains: codes.InvalidArgument.String(), + name: "error - nil request", + setup: nil, + req: nil, + expError: codes.InvalidArgument.String(), }, { name: "error - empty hash", @@ -87,7 +92,7 @@ func TestPendingPayload(t *testing.T) { req: &orbitertypes.QueryPendingPayloadRequest{ Hash: "", }, - errContains: codes.InvalidArgument.String(), + expError: codes.InvalidArgument.String(), }, } @@ -99,6 +104,9 @@ func TestPendingPayload(t *testing.T) { ms := orbiterkeeper.NewMsgServer(k) qs := orbiterkeeper.NewQueryServer(k) + // NOTE: we have to set this because the block time is included in the hash value. + ctx = ctx.WithBlockTime(nowUTC) + if tc.setup != nil { tc.setup(t, ctx, k.Codec(), ms) } @@ -108,7 +116,7 @@ func TestPendingPayload(t *testing.T) { tc.req, ) - if tc.errContains == "" { + if tc.expError == "" { require.NoError(t, err, "failed to get pending payload") require.Equal( t, @@ -117,7 +125,7 @@ func TestPendingPayload(t *testing.T) { "expected different payload", ) } else { - require.ErrorContains(t, err, tc.errContains, "expected different error") + require.ErrorContains(t, err, tc.expError, "expected different error") } }) } diff --git a/module.go b/module.go index b6c0e786..4e524645 100644 --- a/module.go +++ b/module.go @@ -53,6 +53,8 @@ var ( _ module.HasConsensusVersion = AppModule{} _ module.HasGenesis = AppModule{} _ module.HasServices = AppModule{} + + _ appmodule.HasBeginBlocker = AppModule{} ) type AppModuleBasic struct{} @@ -146,3 +148,7 @@ func (m AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawM return cdc.MustMarshalJSON(genesis) } + +func (m AppModule) BeginBlock(ctx context.Context) error { + return m.keeper.BeginBlock(ctx) +} diff --git a/proto/generate.sh b/proto/generate.sh index a1da4dda..77d54c0f 100644 --- a/proto/generate.sh +++ b/proto/generate.sh @@ -11,6 +11,6 @@ cp -r github.com/noble-assets/orbiter/* ./ cp -r api/noble/orbiter/* api/ find api/ -type f -name "*.go" -exec sed -i 's|github.com/noble-assets/orbiter/api/noble/orbiter|github.com/noble-assets/orbiter/api|g' {} + -rm -rf github.com/noble-assets/orbiter +rm -rf github.com rm -rf api/noble rm -rf noble diff --git a/proto/noble/orbiter/core/v1/orbiter.proto b/proto/noble/orbiter/core/v1/orbiter.proto index c1689136..6cf71fa4 100644 --- a/proto/noble/orbiter/core/v1/orbiter.proto +++ b/proto/noble/orbiter/core/v1/orbiter.proto @@ -81,4 +81,6 @@ message PendingPayload { uint64 sequence = 1; // The submitted payload that will be registered as pending. Payload payload = 2; + // The block time of inclusion of the payload in nanoseconds. + int64 timestamp = 3; } diff --git a/proto/noble/orbiter/v1/tx.proto b/proto/noble/orbiter/v1/tx.proto index 57a6a3b6..b564f11e 100644 --- a/proto/noble/orbiter/v1/tx.proto +++ b/proto/noble/orbiter/v1/tx.proto @@ -34,6 +34,6 @@ message MsgSubmitPayload { // MsgSubmitPayloadResponse returns the sha256 hash of the registered // pending payload. message MsgSubmitPayloadResponse { - // The sha256 hash that references the submitted payload in the module storage. - bytes hash = 1; + // The hex representation of the hash that references the submitted payload in the module storage. + string hash = 1; } diff --git a/simapp/app.yaml b/simapp/app.yaml index 3d6d5a05..d02c0ccb 100644 --- a/simapp/app.yaml +++ b/simapp/app.yaml @@ -4,7 +4,7 @@ modules: '@type': cosmos.app.runtime.v1alpha1.Module app_name: SimApp pre_blockers: [upgrade] - begin_blockers: [capability, staking, ibc] + begin_blockers: [capability, staking, ibc, orbiter] end_blockers: [staking] init_genesis: [ diff --git a/types/core/keys.go b/types/core/keys.go index 404d7ce4..c8ea0f72 100644 --- a/types/core/keys.go +++ b/types/core/keys.go @@ -122,9 +122,13 @@ var AdapterParamsPrefix = collections.NewPrefix(40) const ( PendingPayloadsName = "pending_payloads" PendingPayloadsSequenceName = "pending_payloads_sequence" + + HashesByTimeIndexName = "payload_hashes_by_time" ) var ( PendingPayloadsPrefix = collections.NewPrefix(50) PendingPayloadsSequencePrefix = collections.NewPrefix(51) + + HashesByTimeIndexPrefix = collections.NewPrefix(52) ) diff --git a/types/core/orbiter.pb.go b/types/core/orbiter.pb.go index 2bdd80f1..c59eaa1d 100644 --- a/types/core/orbiter.pb.go +++ b/types/core/orbiter.pb.go @@ -236,6 +236,8 @@ type PendingPayload struct { Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` // The submitted payload that will be registered as pending. Payload *Payload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` + // The block time of inclusion of the payload in nanoseconds. + Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (m *PendingPayload) Reset() { *m = PendingPayload{} } @@ -285,6 +287,13 @@ func (m *PendingPayload) GetPayload() *Payload { return nil } +func (m *PendingPayload) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + func init() { proto.RegisterType((*Action)(nil), "noble.orbiter.core.v1.Action") proto.RegisterType((*Forwarding)(nil), "noble.orbiter.core.v1.Forwarding") @@ -298,38 +307,39 @@ func init() { } var fileDescriptor_24aab38bf890c9f2 = []byte{ - // 484 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x3b, 0xdd, 0x65, 0x57, 0xa6, 0xd2, 0xc3, 0xb8, 0x42, 0xb7, 0x60, 0xb6, 0x5b, 0x59, - 0xa8, 0x42, 0x33, 0x6c, 0xbd, 0x88, 0x07, 0xa1, 0xa5, 0x08, 0xf5, 0x54, 0x72, 0x11, 0xf4, 0x10, - 0x26, 0xc9, 0x34, 0x0d, 0x74, 0xf3, 0xe2, 0xcc, 0x64, 0xa5, 0xdf, 0xc0, 0x83, 0x07, 0x3f, 0x80, - 0x07, 0x3f, 0xc4, 0x7e, 0x08, 0xd9, 0xd3, 0x1e, 0x3d, 0x4a, 0x7b, 0xf1, 0x63, 0x48, 0x66, 0x26, - 0xd9, 0x8a, 0xad, 0xf4, 0x36, 0xef, 0xbd, 0xff, 0xfb, 0xcf, 0xef, 0xbd, 0x64, 0xf0, 0xd3, 0x14, - 0x82, 0x05, 0xa7, 0x20, 0x82, 0x44, 0x71, 0x41, 0x43, 0x10, 0x9c, 0x5e, 0x5f, 0x96, 0xb1, 0x9b, - 0x09, 0x50, 0x40, 0x1e, 0x6b, 0x91, 0x5b, 0x26, 0x0b, 0x91, 0x7b, 0x7d, 0xd9, 0x3e, 0x0d, 0x41, - 0x5e, 0x81, 0xf4, 0xb5, 0x88, 0x9a, 0xc0, 0x74, 0xb4, 0x4f, 0x62, 0x88, 0xc1, 0xe4, 0x8b, 0x93, - 0xcd, 0x9e, 0xc6, 0x00, 0xf1, 0x82, 0x53, 0x1d, 0x05, 0xf9, 0x8c, 0xb2, 0x74, 0x69, 0x4b, 0xce, - 0x76, 0x8e, 0x24, 0x32, 0xf5, 0xee, 0x37, 0x84, 0x8f, 0x86, 0xa1, 0x4a, 0x20, 0x25, 0x14, 0xd7, - 0x93, 0xa8, 0x85, 0x3a, 0xa8, 0xd7, 0x1c, 0x9c, 0xb9, 0x5b, 0xd1, 0x5c, 0x23, 0x9d, 0x8c, 0xbd, - 0x7a, 0x12, 0x91, 0x0f, 0x18, 0x33, 0xa5, 0x44, 0x12, 0xe4, 0x8a, 0xcb, 0x56, 0xbd, 0x83, 0x7a, - 0x8d, 0xc1, 0x89, 0x6b, 0x58, 0xdc, 0x92, 0xc5, 0x1d, 0xa6, 0xcb, 0xd1, 0xc5, 0xed, 0x4d, 0xff, - 0xfc, 0x6f, 0xc7, 0xca, 0x6c, 0x58, 0x59, 0x78, 0x1b, 0x76, 0xaf, 0x0e, 0x3f, 0x7f, 0x3f, 0xab, - 0x75, 0x7f, 0x23, 0x8c, 0xdf, 0x80, 0xf8, 0xc4, 0x44, 0x94, 0xa4, 0x31, 0x19, 0xe1, 0x86, 0xf6, - 0x0d, 0x61, 0xe1, 0x57, 0xac, 0xe7, 0x3b, 0x58, 0xa7, 0x56, 0x39, 0x19, 0x7b, 0xb8, 0xec, 0x9a, - 0x44, 0xc4, 0xdf, 0x9b, 0xfa, 0xd9, 0xed, 0x4d, 0xff, 0xe2, 0x1f, 0xea, 0x7b, 0x9c, 0xed, 0xe4, - 0x84, 0xe2, 0x47, 0x19, 0x93, 0x52, 0xcd, 0x05, 0xe4, 0xf1, 0xdc, 0xcf, 0xd8, 0x72, 0x01, 0x2c, - 0x6a, 0x1d, 0x74, 0x50, 0xef, 0xa1, 0x47, 0x36, 0x4a, 0x53, 0x53, 0xb1, 0xa3, 0x7e, 0x41, 0xf8, - 0xd8, 0x66, 0xc8, 0xeb, 0x62, 0x4e, 0xee, 0x33, 0xbd, 0x20, 0xd9, 0x42, 0x9d, 0x83, 0x5e, 0x63, - 0xf0, 0xe4, 0xbf, 0xdf, 0xa4, 0x98, 0x91, 0x9b, 0xa3, 0x24, 0x43, 0x8c, 0x67, 0x15, 0xa6, 0x9d, - 0x71, 0xd7, 0x9a, 0xee, 0xe7, 0xf1, 0x36, 0x9a, 0xba, 0x6f, 0x71, 0xd3, 0xd2, 0xbc, 0x13, 0x2c, - 0xcb, 0xb8, 0x20, 0x2f, 0xf1, 0xb1, 0xed, 0xd5, 0x8b, 0x6f, 0x0c, 0x9c, 0x5d, 0x8b, 0x37, 0x7d, - 0x5e, 0x29, 0xef, 0xce, 0x70, 0x73, 0xca, 0xd3, 0xc2, 0xb6, 0x1c, 0xb0, 0x8d, 0x1f, 0x48, 0xfe, - 0x31, 0xe7, 0x69, 0xc8, 0xb5, 0xd9, 0xa1, 0x57, 0xc5, 0xc5, 0x3d, 0xe5, 0xce, 0xea, 0xfb, 0xdd, - 0x63, 0xe5, 0xa3, 0xf1, 0x8f, 0x95, 0x83, 0xee, 0x56, 0x0e, 0xfa, 0xb5, 0x72, 0xd0, 0xd7, 0xb5, - 0x53, 0xbb, 0x5b, 0x3b, 0xb5, 0x9f, 0x6b, 0xa7, 0xf6, 0xfe, 0x79, 0x9c, 0xa8, 0x79, 0x1e, 0xb8, - 0x21, 0x5c, 0x51, 0x6d, 0xd6, 0x67, 0x52, 0x72, 0x25, 0xab, 0x87, 0xa1, 0x96, 0x19, 0x97, 0xfa, - 0x79, 0x04, 0x47, 0xfa, 0x27, 0x78, 0xf1, 0x27, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x87, 0x28, 0x68, - 0xc3, 0x03, 0x00, 0x00, + // 501 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x73, 0x49, 0xd5, 0xc2, 0x0b, 0xca, 0x70, 0x14, 0x29, 0x8d, 0xc0, 0x4d, 0x83, 0x2a, + 0x05, 0xa4, 0xd8, 0x6a, 0x58, 0x10, 0x03, 0x52, 0xa2, 0x08, 0x29, 0x4c, 0x91, 0x17, 0x24, 0x18, + 0xac, 0xb3, 0x7d, 0x75, 0x2c, 0x25, 0x3e, 0x73, 0x77, 0x2e, 0xca, 0xce, 0xc0, 0xc0, 0xc0, 0x07, + 0x60, 0xe0, 0x43, 0xf4, 0x43, 0xa0, 0x4e, 0x1d, 0x19, 0x51, 0xb2, 0xf0, 0x31, 0x90, 0xef, 0xce, + 0x4e, 0x10, 0x49, 0x95, 0xed, 0xde, 0x7b, 0xff, 0xf7, 0xbf, 0xdf, 0x7b, 0xf6, 0xc1, 0xd3, 0x84, + 0xf9, 0x33, 0xea, 0x30, 0xee, 0xc7, 0x92, 0x72, 0x27, 0x60, 0x9c, 0x3a, 0x57, 0x17, 0x45, 0x6c, + 0xa7, 0x9c, 0x49, 0x86, 0x1f, 0x29, 0x91, 0x5d, 0x24, 0x73, 0x91, 0x7d, 0x75, 0xd1, 0x3a, 0x09, + 0x98, 0x98, 0x33, 0xe1, 0x29, 0x91, 0xa3, 0x03, 0xdd, 0xd1, 0x3a, 0x8e, 0x58, 0xc4, 0x74, 0x3e, + 0x3f, 0x99, 0xec, 0x49, 0xc4, 0x58, 0x34, 0xa3, 0x8e, 0x8a, 0xfc, 0xec, 0xd2, 0x21, 0xc9, 0xc2, + 0x94, 0xac, 0xed, 0x1c, 0x71, 0xa8, 0xeb, 0x9d, 0xef, 0x08, 0x0e, 0x07, 0x81, 0x8c, 0x59, 0x82, + 0x1d, 0xa8, 0xc6, 0x61, 0x13, 0xb5, 0x51, 0xb7, 0xd1, 0x3f, 0xb5, 0xb7, 0xa2, 0xd9, 0x5a, 0x3a, + 0x1e, 0xb9, 0xd5, 0x38, 0xc4, 0x1f, 0x00, 0x88, 0x94, 0x3c, 0xf6, 0x33, 0x49, 0x45, 0xb3, 0xda, + 0x46, 0xdd, 0x7a, 0xff, 0xd8, 0xd6, 0x2c, 0x76, 0xc1, 0x62, 0x0f, 0x92, 0xc5, 0xf0, 0xfc, 0xe6, + 0xba, 0x77, 0xf6, 0xaf, 0x63, 0x69, 0x36, 0x28, 0x2d, 0xdc, 0x0d, 0xbb, 0x57, 0x07, 0x5f, 0x7e, + 0x9c, 0x56, 0x3a, 0x7f, 0x10, 0xc0, 0x1b, 0xc6, 0x3f, 0x11, 0x1e, 0xc6, 0x49, 0x84, 0x87, 0x50, + 0x57, 0xbe, 0x01, 0x9b, 0x79, 0x25, 0xeb, 0xd9, 0x0e, 0xd6, 0x89, 0x51, 0x8e, 0x47, 0x2e, 0x14, + 0x5d, 0xe3, 0x10, 0x7b, 0x7b, 0x53, 0x3f, 0xbb, 0xb9, 0xee, 0x9d, 0xff, 0x47, 0xbd, 0xc6, 0xd9, + 0x4e, 0x8e, 0x1d, 0x78, 0x98, 0x12, 0x21, 0xe4, 0x94, 0xb3, 0x2c, 0x9a, 0x7a, 0x29, 0x59, 0xcc, + 0x18, 0x09, 0x9b, 0xb5, 0x36, 0xea, 0x3e, 0x70, 0xf1, 0x46, 0x69, 0xa2, 0x2b, 0x66, 0xd4, 0xaf, + 0x08, 0x8e, 0x4c, 0x06, 0xbf, 0xce, 0xe7, 0xa4, 0x1e, 0x51, 0x0b, 0x12, 0x4d, 0xd4, 0xae, 0x75, + 0xeb, 0xfd, 0x27, 0x77, 0x7e, 0x93, 0x7c, 0x46, 0xaa, 0x8f, 0x02, 0x0f, 0x00, 0x2e, 0x4b, 0x4c, + 0x33, 0xe3, 0xae, 0x35, 0xad, 0xe7, 0x71, 0x37, 0x9a, 0x3a, 0x6f, 0xa1, 0x61, 0x68, 0xde, 0x71, + 0x92, 0xa6, 0x94, 0xe3, 0x97, 0x70, 0x64, 0x7a, 0xd5, 0xe2, 0xeb, 0x7d, 0x6b, 0xd7, 0xe2, 0x75, + 0x9f, 0x5b, 0xc8, 0x3b, 0x9f, 0x11, 0x34, 0x26, 0x34, 0xc9, 0x7d, 0x8b, 0x09, 0x5b, 0x70, 0x4f, + 0xd0, 0x8f, 0x19, 0x4d, 0x02, 0xaa, 0xdc, 0x0e, 0xdc, 0x32, 0xce, 0x2f, 0x2a, 0x96, 0x56, 0xdd, + 0xef, 0x22, 0x23, 0xc7, 0x8f, 0xe1, 0xbe, 0x8c, 0xe7, 0x54, 0x48, 0x32, 0x4f, 0xd5, 0xc2, 0x6b, + 0xee, 0x3a, 0x31, 0x1c, 0xfd, 0x5c, 0x5a, 0xe8, 0x76, 0x69, 0xa1, 0xdf, 0x4b, 0x0b, 0x7d, 0x5b, + 0x59, 0x95, 0xdb, 0x95, 0x55, 0xf9, 0xb5, 0xb2, 0x2a, 0xef, 0x9f, 0x47, 0xb1, 0x9c, 0x66, 0xbe, + 0x1d, 0xb0, 0xb9, 0xa3, 0xae, 0xea, 0x11, 0x21, 0xa8, 0x14, 0xe5, 0xbb, 0x91, 0x8b, 0x94, 0x0a, + 0xf5, 0x7a, 0xfc, 0x43, 0xf5, 0x8f, 0xbc, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x5b, 0xee, + 0xd6, 0xe2, 0x03, 0x00, 0x00, } func (m *Action) Marshal() (dAtA []byte, err error) { @@ -523,6 +533,11 @@ func (m *PendingPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Timestamp != 0 { + i = encodeVarintOrbiter(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x18 + } if m.Payload != nil { { size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) @@ -635,6 +650,9 @@ func (m *PendingPayload) Size() (n int) { l = m.Payload.Size() n += 1 + l + sovOrbiter(uint64(l)) } + if m.Timestamp != 0 { + n += 1 + sovOrbiter(uint64(m.Timestamp)) + } return n } @@ -1178,6 +1196,25 @@ func (m *PendingPayload) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrbiter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipOrbiter(dAtA[iNdEx:]) diff --git a/types/core/payload_test.go b/types/core/payload_test.go index 41094ea0..d9178308 100644 --- a/types/core/payload_test.go +++ b/types/core/payload_test.go @@ -51,23 +51,23 @@ func TestNewPayloadHash(t *testing.T) { require.NoError(t, err, "failed to hash payload") testcases := []struct { - name string - input string - errContains string + name string + input string + expError string }{ { name: "success - valid hash", input: hash.String(), }, { - name: "error - invalid hash", - input: "abcdefg", - errContains: "invalid payload hash", + name: "error - invalid hash", + input: "abcdefg", + expError: "invalid payload hash", }, { - name: "error - too short hash", - input: "0123ab", - errContains: "malformed payload hash", + name: "error - too short hash", + input: "0123ab", + expError: "malformed payload hash", }, } @@ -76,11 +76,11 @@ func TestNewPayloadHash(t *testing.T) { t.Parallel() parsed, err := core.NewPayloadHash(tc.input) - if tc.errContains == "" { + if tc.expError == "" { require.NoError(t, err, "failed to parse payload hash") require.Equal(t, tc.input, parsed.String(), "payload hash mismatch") } else { - require.ErrorContains(t, err, tc.errContains) + require.ErrorContains(t, err, tc.expError) } }) } diff --git a/types/tx.pb.go b/types/tx.pb.go index 2dd03b8e..5847d2d5 100644 --- a/types/tx.pb.go +++ b/types/tx.pb.go @@ -90,8 +90,8 @@ func (m *MsgSubmitPayload) GetPayload() string { // MsgSubmitPayloadResponse returns the sha256 hash of the registered // pending payload. type MsgSubmitPayloadResponse struct { - // The sha256 hash that references the submitted payload in the module storage. - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + // The hex representation of the hash that references the submitted payload in the module storage. + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } func (m *MsgSubmitPayloadResponse) Reset() { *m = MsgSubmitPayloadResponse{} } @@ -127,11 +127,11 @@ func (m *MsgSubmitPayloadResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSubmitPayloadResponse proto.InternalMessageInfo -func (m *MsgSubmitPayloadResponse) GetHash() []byte { +func (m *MsgSubmitPayloadResponse) GetHash() string { if m != nil { return m.Hash } - return nil + return "" } func init() { @@ -142,7 +142,7 @@ func init() { func init() { proto.RegisterFile("noble/orbiter/v1/tx.proto", fileDescriptor_4f89c0e5a76b9120) } var fileDescriptor_4f89c0e5a76b9120 = []byte{ - // 320 bytes of a gzipped FileDescriptorProto + // 319 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0xcb, 0x4f, 0xca, 0x49, 0xd5, 0xcf, 0x2f, 0x4a, 0xca, 0x2c, 0x49, 0x2d, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x00, 0x4b, 0xe9, 0x41, 0xa5, 0xf4, 0xca, 0x0c, 0xa5, @@ -155,14 +155,14 @@ var fileDescriptor_4f89c0e5a76b9120 = []byte{ 0xe6, 0xa5, 0x07, 0x41, 0xd5, 0x09, 0x49, 0x70, 0xb1, 0x17, 0x40, 0x34, 0x4b, 0x30, 0x81, 0xb4, 0x04, 0xc1, 0xb8, 0x56, 0x86, 0x4d, 0xcf, 0x37, 0x68, 0x41, 0x95, 0x75, 0x3d, 0xdf, 0xa0, 0xa5, 0x88, 0xe1, 0x49, 0x74, 0xeb, 0x95, 0xf4, 0xb8, 0x24, 0xd0, 0xc5, 0x82, 0x52, 0x8b, 0x0b, 0xf2, - 0xf3, 0x8a, 0x53, 0x85, 0x84, 0xb8, 0x58, 0x32, 0x12, 0x8b, 0x33, 0xc0, 0x0e, 0xe3, 0x09, 0x02, - 0xb3, 0x8d, 0x72, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0xe2, 0xb9, 0x78, 0x51, 0xbd, 0xa1, 0xa4, - 0x87, 0x1e, 0x6a, 0x7a, 0xe8, 0xe6, 0x4a, 0x69, 0x11, 0x56, 0x03, 0xb3, 0x5b, 0x8a, 0xb5, 0xe1, - 0xf9, 0x06, 0x2d, 0x46, 0x27, 0xfb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, - 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, - 0x52, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x1b, 0xab, 0x9b, - 0x58, 0x5c, 0x9c, 0x5a, 0x52, 0x0c, 0xf7, 0x6d, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, - 0xe8, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x67, 0x9c, 0x5b, 0xf0, 0x01, 0x00, 0x00, + 0xf3, 0x8a, 0x53, 0x85, 0x84, 0xb8, 0x58, 0x32, 0x12, 0x8b, 0x33, 0x20, 0x0e, 0x0b, 0x02, 0xb3, + 0x8d, 0x72, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0xe2, 0xb9, 0x78, 0x51, 0xbd, 0xa1, 0xa4, 0x87, + 0x1e, 0x6a, 0x7a, 0xe8, 0xe6, 0x4a, 0x69, 0x11, 0x56, 0x03, 0xb3, 0x5b, 0x8a, 0xb5, 0xe1, 0xf9, + 0x06, 0x2d, 0x46, 0x27, 0xfb, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, + 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x52, + 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x1b, 0xab, 0x9b, 0x58, + 0x5c, 0x9c, 0x5a, 0x52, 0x0c, 0xf7, 0x6d, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xe8, + 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xa4, 0x0c, 0x4c, 0xf0, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -511,7 +511,7 @@ func (m *MsgSubmitPayloadResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -521,25 +521,23 @@ func (m *MsgSubmitPayloadResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } + m.Hash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex From fee59fdec12dd1c6022d9d7aa61f4ee21a1166b8 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Tue, 21 Oct 2025 14:31:18 +0200 Subject: [PATCH 28/29] address rabbit comments --- keeper/msg_server_test.go | 2 +- keeper/payload_handler_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go index a6d62c1d..ab3e272a 100644 --- a/keeper/msg_server_test.go +++ b/keeper/msg_server_test.go @@ -92,7 +92,7 @@ func TestSubmitPayload(t *testing.T) { t.Helper() err := k.Forwarder().Pause(ctx, core.PROTOCOL_CCTP, nil) - require.NoError(t, err, "failed to unpause fee action") + require.NoError(t, err, "failed to pause protocol") }, payload: func() *core.Payload { p := *examplePayload.Payload diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index 1463aad9..5bfa29bc 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -163,7 +163,7 @@ func TestRemovePayloads(t *testing.T) { qs := orbiterkeeper.NewQueryServer(k) // we set the context's block time to be sure of the behavior - ctx.WithBlockTime(nowUTC) + ctx = ctx.WithBlockTime(nowUTC) var hashes []string if tc.setup != nil { From cef3a2b51e935ad4c1f2ffc994cbf4ba8a831b96 Mon Sep 17 00:00:00 2001 From: Malte Herrmann Date: Tue, 21 Oct 2025 14:42:36 +0200 Subject: [PATCH 29/29] fix tests --- keeper/payload_handler_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/keeper/payload_handler_test.go b/keeper/payload_handler_test.go index 5bfa29bc..612e44b0 100644 --- a/keeper/payload_handler_test.go +++ b/keeper/payload_handler_test.go @@ -125,6 +125,7 @@ const timeBetweenBlocks = 1 * time.Second func TestRemovePayloads(t *testing.T) { nowUTC := time.Now().UTC() + startUTC := nowUTC.Add(1 * time.Second) testCases := []struct { name string @@ -138,7 +139,7 @@ func TestRemovePayloads(t *testing.T) { setup: func(ctx sdk.Context, cdc codec.Codec, ms orbitertypes.MsgServer) ([]string, error) { return setupPayloadsInState(ctx, cdc, ms, 4) }, - cutoff: nowUTC.Add(2 * timeBetweenBlocks), + cutoff: startUTC.Add(3 * timeBetweenBlocks / 2), expRemoved: 2, }, { @@ -152,7 +153,7 @@ func TestRemovePayloads(t *testing.T) { { name: "success - no submitted payloads", setup: nil, - cutoff: nowUTC.Add(2 * timeBetweenBlocks), + cutoff: startUTC.Add(2 * timeBetweenBlocks), }, } @@ -163,7 +164,7 @@ func TestRemovePayloads(t *testing.T) { qs := orbiterkeeper.NewQueryServer(k) // we set the context's block time to be sure of the behavior - ctx = ctx.WithBlockTime(nowUTC) + ctx = ctx.WithBlockTime(startUTC) var hashes []string if tc.setup != nil {