diff --git a/Makefile b/Makefile index 74aeab58..c411f4db 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..." diff --git a/api/core/v1/orbiter.pulsar.go b/api/core/v1/orbiter.pulsar.go index 2eaba40f..4b7c1df9 100644 --- a/api/core/v1/orbiter.pulsar.go +++ b/api/core/v1/orbiter.pulsar.go @@ -2055,6 +2055,537 @@ func (x *fastReflection_PayloadWrapper) ProtoMethods() *protoiface.Methods { } } +var ( + md_PendingPayload protoreflect.MessageDescriptor + fd_PendingPayload_sequence protoreflect.FieldDescriptor + fd_PendingPayload_payload protoreflect.FieldDescriptor + fd_PendingPayload_timestamp 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") + fd_PendingPayload_timestamp = md_PendingPayload.Fields().ByName("timestamp") +} + +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 + } + } + if x.Timestamp != int64(0) { + value := protoreflect.ValueOfInt64(x.Timestamp) + if !f(fd_PendingPayload_timestamp, 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 + 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")) + } + 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 + 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")) + } + 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()) + 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")) + } + 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) + 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")) + } + 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")) + 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")) + } + 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()) + 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")) + } + 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.Timestamp != 0 { + n += 1 + runtime.Sov(uint64(x.Timestamp)) + } + 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.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 { + 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 + 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:]) + 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 +2803,61 @@ 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 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() { + *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 +} + +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{ @@ -2323,22 +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, 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 ( @@ -2353,29 +2948,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 +3030,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 +3049,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 9cf5c9f9..d9501b3c 100644 --- a/api/v1/query.pulsar.go +++ b/api/v1/query.pulsar.go @@ -5,6 +5,7 @@ import ( _ "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" @@ -2019,6 +2020,861 @@ func (x *fastReflection_QueryProtocolIDsResponse) ProtoMethods() *protoiface.Met } } +var ( + md_QueryPendingPayloadRequest protoreflect.MessageDescriptor + fd_QueryPendingPayloadRequest_hash protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_query_proto_init() + md_QueryPendingPayloadRequest = File_noble_orbiter_v1_query_proto.Messages().ByName("QueryPendingPayloadRequest") + fd_QueryPendingPayloadRequest_hash = md_QueryPendingPayloadRequest.Fields().ByName("hash") +} + +var _ protoreflect.Message = (*fastReflection_QueryPendingPayloadRequest)(nil) + +type fastReflection_QueryPendingPayloadRequest QueryPendingPayloadRequest + +func (x *QueryPendingPayloadRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadRequest)(x) +} + +func (x *QueryPendingPayloadRequest) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_query_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_QueryPendingPayloadRequest_messageType fastReflection_QueryPendingPayloadRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryPendingPayloadRequest_messageType{} + +type fastReflection_QueryPendingPayloadRequest_messageType struct{} + +func (x fastReflection_QueryPendingPayloadRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadRequest)(nil) +} +func (x fastReflection_QueryPendingPayloadRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadRequest) +} +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_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_QueryPendingPayloadRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryPendingPayloadRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +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_QueryPendingPayloadRequest) Interface() protoreflect.ProtoMessage { + return (*QueryPendingPayloadRequest)(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_QueryPendingPayloadRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Hash != "" { + value := protoreflect.ValueOfString(x.Hash) + if !f(fd_QueryPendingPayloadRequest_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_QueryPendingPayloadRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + return x.Hash != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest 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_QueryPendingPayloadRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + x.Hash = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest 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_QueryPendingPayloadRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + value := x.Hash + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest 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_QueryPendingPayloadRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + x.Hash = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadRequest 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_QueryPendingPayloadRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + 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.QueryPendingPayloadRequest")) + } + 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_QueryPendingPayloadRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadRequest.hash": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadRequest")) + } + 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_QueryPendingPayloadRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.QueryPendingPayloadRequest", 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_QueryPendingPayloadRequest) 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_QueryPendingPayloadRequest) 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_QueryPendingPayloadRequest) 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_QueryPendingPayloadRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryPendingPayloadRequest) + 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().(*QueryPendingPayloadRequest) + 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().(*QueryPendingPayloadRequest) + 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: QueryPendingPayloadRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + 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 Hash", 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.Hash = 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_QueryPendingPayloadResponse protoreflect.MessageDescriptor + fd_QueryPendingPayloadResponse_payload protoreflect.FieldDescriptor +) + +func init() { + file_noble_orbiter_v1_query_proto_init() + md_QueryPendingPayloadResponse = File_noble_orbiter_v1_query_proto.Messages().ByName("QueryPendingPayloadResponse") + fd_QueryPendingPayloadResponse_payload = md_QueryPendingPayloadResponse.Fields().ByName("payload") +} + +var _ protoreflect.Message = (*fastReflection_QueryPendingPayloadResponse)(nil) + +type fastReflection_QueryPendingPayloadResponse QueryPendingPayloadResponse + +func (x *QueryPendingPayloadResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadResponse)(x) +} + +func (x *QueryPendingPayloadResponse) slowProtoReflect() protoreflect.Message { + mi := &file_noble_orbiter_v1_query_proto_msgTypes[5] + 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_QueryPendingPayloadResponse_messageType fastReflection_QueryPendingPayloadResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryPendingPayloadResponse_messageType{} + +type fastReflection_QueryPendingPayloadResponse_messageType struct{} + +func (x fastReflection_QueryPendingPayloadResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryPendingPayloadResponse)(nil) +} +func (x fastReflection_QueryPendingPayloadResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryPendingPayloadResponse) +} +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_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_QueryPendingPayloadResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryPendingPayloadResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +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_QueryPendingPayloadResponse) Interface() protoreflect.ProtoMessage { + return (*QueryPendingPayloadResponse)(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_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 + } + } +} + +// 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_QueryPendingPayloadResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + 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.QueryPendingPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse 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_QueryPendingPayloadResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + 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.QueryPendingPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse 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_QueryPendingPayloadResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + 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.QueryPendingPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse 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_QueryPendingPayloadResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + 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.QueryPendingPayloadResponse")) + } + panic(fmt.Errorf("message noble.orbiter.v1.QueryPendingPayloadResponse 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_QueryPendingPayloadResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "noble.orbiter.v1.QueryPendingPayloadResponse.payload": + if x.Payload == nil { + x.Payload = new(v1.Payload) + } + return protoreflect.ValueOfMessage(x.Payload.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: noble.orbiter.v1.QueryPendingPayloadResponse")) + } + 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_QueryPendingPayloadResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + 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.QueryPendingPayloadResponse")) + } + 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_QueryPendingPayloadResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in noble.orbiter.v1.QueryPendingPayloadResponse", 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_QueryPendingPayloadResponse) 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_QueryPendingPayloadResponse) 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_QueryPendingPayloadResponse) 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_QueryPendingPayloadResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryPendingPayloadResponse) + 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.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().(*QueryPendingPayloadResponse) + 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] = 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().(*QueryPendingPayloadResponse) + 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: QueryPendingPayloadResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + 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 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, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -2154,6 +3010,78 @@ func (x *QueryProtocolIDsResponse) GetProtocolIds() map[int32]string { return nil } +type QueryPendingPayloadRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 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() { + *x = QueryPendingPayloadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryPendingPayloadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryPendingPayloadRequest) ProtoMessage() {} + +// Deprecated: Use QueryPendingPayloadRequest.ProtoReflect.Descriptor instead. +func (*QueryPendingPayloadRequest) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryPendingPayloadRequest) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + +type QueryPendingPayloadResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The payload contents of the registered payload. + Payload *v1.Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` +} + +func (x *QueryPendingPayloadResponse) Reset() { + *x = QueryPendingPayloadResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_noble_orbiter_v1_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryPendingPayloadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryPendingPayloadResponse) ProtoMessage() {} + +// Deprecated: Use QueryPendingPayloadResponse.ProtoReflect.Descriptor instead. +func (*QueryPendingPayloadResponse) Descriptor() ([]byte, []int) { + return file_noble_orbiter_v1_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryPendingPayloadResponse) GetPayload() *v1.Payload { + if x != nil { + return x.Payload + } + return nil +} + var File_noble_orbiter_v1_query_proto protoreflect.FileDescriptor var file_noble_orbiter_v1_query_proto_rawDesc = []byte{ @@ -2163,33 +3091,44 @@ var file_noble_orbiter_v1_query_proto_rawDesc = []byte{ 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, 0x17, 0x0a, 0x15, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x22, 0xae, 0x01, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x56, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, - 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x44, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x1a, 0x3c, 0x0a, 0x0e, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x19, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x44, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0xba, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x49, 0x44, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, - 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, - 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x44, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x73, 0x1a, 0x3e, 0x0a, - 0x10, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0xb9, 0x02, + 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, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x44, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xae, 0x01, 0x0a, 0x16, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, + 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x09, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x1a, 0x3c, 0x0a, 0x0e, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x19, 0x0a, 0x17, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x44, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xba, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x44, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x69, + 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, + 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x44, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, + 0x64, 0x73, 0x1a, 0x3e, 0x0a, 0x10, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 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, 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, 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, 0xd8, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x92, 0x01, 0x0a, 0x09, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x73, 0x12, 0x27, 0x2e, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2e, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x63, @@ -2209,20 +3148,30 @@ var file_noble_orbiter_v1_query_proto_rawDesc = []byte{ 0x6e, 0x73, 0x65, 0x22, 0x34, 0x88, 0xe7, 0xb0, 0x2a, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x12, 0x27, 0x2f, 0x6e, 0x6f, 0x62, 0x6c, 0x65, 0x2f, 0x6f, 0x72, 0x62, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 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, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 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 ( @@ -2237,27 +3186,33 @@ func file_noble_orbiter_v1_query_proto_rawDescGZIP() []byte { return file_noble_orbiter_v1_query_proto_rawDescData } -var file_noble_orbiter_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_noble_orbiter_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_noble_orbiter_v1_query_proto_goTypes = []interface{}{ - (*QueryActionIDsRequest)(nil), // 0: noble.orbiter.v1.QueryActionIDsRequest - (*QueryActionIDsResponse)(nil), // 1: noble.orbiter.v1.QueryActionIDsResponse - (*QueryProtocolIDsRequest)(nil), // 2: noble.orbiter.v1.QueryProtocolIDsRequest - (*QueryProtocolIDsResponse)(nil), // 3: noble.orbiter.v1.QueryProtocolIDsResponse - nil, // 4: noble.orbiter.v1.QueryActionIDsResponse.ActionIdsEntry - nil, // 5: noble.orbiter.v1.QueryProtocolIDsResponse.ProtocolIdsEntry + (*QueryActionIDsRequest)(nil), // 0: noble.orbiter.v1.QueryActionIDsRequest + (*QueryActionIDsResponse)(nil), // 1: noble.orbiter.v1.QueryActionIDsResponse + (*QueryProtocolIDsRequest)(nil), // 2: noble.orbiter.v1.QueryProtocolIDsRequest + (*QueryProtocolIDsResponse)(nil), // 3: noble.orbiter.v1.QueryProtocolIDsResponse + (*QueryPendingPayloadRequest)(nil), // 4: noble.orbiter.v1.QueryPendingPayloadRequest + (*QueryPendingPayloadResponse)(nil), // 5: noble.orbiter.v1.QueryPendingPayloadResponse + nil, // 6: noble.orbiter.v1.QueryActionIDsResponse.ActionIdsEntry + nil, // 7: noble.orbiter.v1.QueryProtocolIDsResponse.ProtocolIdsEntry + (*v1.Payload)(nil), // 8: noble.orbiter.core.v1.Payload } var file_noble_orbiter_v1_query_proto_depIdxs = []int32{ - 4, // 0: noble.orbiter.v1.QueryActionIDsResponse.action_ids:type_name -> noble.orbiter.v1.QueryActionIDsResponse.ActionIdsEntry - 5, // 1: noble.orbiter.v1.QueryProtocolIDsResponse.protocol_ids:type_name -> noble.orbiter.v1.QueryProtocolIDsResponse.ProtocolIdsEntry - 0, // 2: noble.orbiter.v1.Query.ActionIDs:input_type -> noble.orbiter.v1.QueryActionIDsRequest - 2, // 3: noble.orbiter.v1.Query.ProtocolIDs:input_type -> noble.orbiter.v1.QueryProtocolIDsRequest - 1, // 4: noble.orbiter.v1.Query.ActionIDs:output_type -> noble.orbiter.v1.QueryActionIDsResponse - 3, // 5: noble.orbiter.v1.Query.ProtocolIDs:output_type -> noble.orbiter.v1.QueryProtocolIDsResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] 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 + 6, // 0: noble.orbiter.v1.QueryActionIDsResponse.action_ids:type_name -> noble.orbiter.v1.QueryActionIDsResponse.ActionIdsEntry + 7, // 1: noble.orbiter.v1.QueryProtocolIDsResponse.protocol_ids:type_name -> noble.orbiter.v1.QueryProtocolIDsResponse.ProtocolIdsEntry + 8, // 2: noble.orbiter.v1.QueryPendingPayloadResponse.payload:type_name -> noble.orbiter.core.v1.Payload + 0, // 3: noble.orbiter.v1.Query.ActionIDs:input_type -> noble.orbiter.v1.QueryActionIDsRequest + 2, // 4: noble.orbiter.v1.Query.ProtocolIDs:input_type -> noble.orbiter.v1.QueryProtocolIDsRequest + 4, // 5: noble.orbiter.v1.Query.PendingPayload:input_type -> noble.orbiter.v1.QueryPendingPayloadRequest + 1, // 6: noble.orbiter.v1.Query.ActionIDs:output_type -> noble.orbiter.v1.QueryActionIDsResponse + 3, // 7: noble.orbiter.v1.Query.ProtocolIDs:output_type -> noble.orbiter.v1.QueryProtocolIDsResponse + 5, // 8: noble.orbiter.v1.Query.PendingPayload:output_type -> noble.orbiter.v1.QueryPendingPayloadResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_noble_orbiter_v1_query_proto_init() } @@ -2314,6 +3269,30 @@ func file_noble_orbiter_v1_query_proto_init() { return nil } } + file_noble_orbiter_v1_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryPendingPayloadRequest); 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[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryPendingPayloadResponse); 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{ @@ -2321,7 +3300,7 @@ func file_noble_orbiter_v1_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_noble_orbiter_v1_query_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/v1/query_grpc.pb.go b/api/v1/query_grpc.pb.go index 46b9e64e..98b4f975 100644 --- a/api/v1/query_grpc.pb.go +++ b/api/v1/query_grpc.pb.go @@ -19,8 +19,9 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Query_ActionIDs_FullMethodName = "/noble.orbiter.v1.Query/ActionIDs" - Query_ProtocolIDs_FullMethodName = "/noble.orbiter.v1.Query/ProtocolIDs" + Query_ActionIDs_FullMethodName = "/noble.orbiter.v1.Query/ActionIDs" + Query_ProtocolIDs_FullMethodName = "/noble.orbiter.v1.Query/ProtocolIDs" + Query_PendingPayload_FullMethodName = "/noble.orbiter.v1.Query/PendingPayload" ) // QueryClient is the client API for Query service. @@ -31,6 +32,7 @@ const ( type QueryClient interface { ActionIDs(ctx context.Context, in *QueryActionIDsRequest, opts ...grpc.CallOption) (*QueryActionIDsResponse, error) ProtocolIDs(ctx context.Context, in *QueryProtocolIDsRequest, opts ...grpc.CallOption) (*QueryProtocolIDsResponse, error) + PendingPayload(ctx context.Context, in *QueryPendingPayloadRequest, opts ...grpc.CallOption) (*QueryPendingPayloadResponse, error) } type queryClient struct { @@ -61,6 +63,16 @@ func (c *queryClient) ProtocolIDs(ctx context.Context, in *QueryProtocolIDsReque return out, nil } +func (c *queryClient) PendingPayload(ctx context.Context, in *QueryPendingPayloadRequest, opts ...grpc.CallOption) (*QueryPendingPayloadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueryPendingPayloadResponse) + err := c.cc.Invoke(ctx, Query_PendingPayload_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. @@ -69,6 +81,7 @@ func (c *queryClient) ProtocolIDs(ctx context.Context, in *QueryProtocolIDsReque type QueryServer interface { ActionIDs(context.Context, *QueryActionIDsRequest) (*QueryActionIDsResponse, error) ProtocolIDs(context.Context, *QueryProtocolIDsRequest) (*QueryProtocolIDsResponse, error) + PendingPayload(context.Context, *QueryPendingPayloadRequest) (*QueryPendingPayloadResponse, error) mustEmbedUnimplementedQueryServer() } @@ -85,6 +98,9 @@ func (UnimplementedQueryServer) ActionIDs(context.Context, *QueryActionIDsReques func (UnimplementedQueryServer) ProtocolIDs(context.Context, *QueryProtocolIDsRequest) (*QueryProtocolIDsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProtocolIDs 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() {} @@ -142,6 +158,24 @@ func _Query_ProtocolIDs_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +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).PendingPayload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_PendingPayload_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PendingPayload(ctx, req.(*QueryPendingPayloadRequest)) + } + 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) @@ -157,6 +191,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "ProtocolIDs", Handler: _Query_ProtocolIDs_Handler, }, + { + MethodName: "PendingPayload", + Handler: _Query_PendingPayload_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "noble/orbiter/v1/query.proto", diff --git a/api/v1/tx.pulsar.go b/api/v1/tx.pulsar.go new file mode 100644 index 00000000..6df89827 --- /dev/null +++ b/api/v1/tx.pulsar.go @@ -0,0 +1,1142 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +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" + 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 x.Hash != "" { + value := protoreflect.ValueOfString(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 x.Hash != "" + 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 = "" + 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.ValueOfString(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.Interface().(string) + 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.ValueOfString("") + 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 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.Hash = 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, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: noble/orbiter/v1/tx.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) +) + +// MsgSubmitPayload enters a new Orbiter payload into the list 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 sha256 hash of the registered +// pending payload. +type MsgSubmitPayloadResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 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() { + *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() string { + if x != nil { + return x.Hash + } + return "" +} + +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, 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, 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, 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, + 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, 2) +var file_noble_orbiter_v1_tx_proto_goTypes = []interface{}{ + (*MsgSubmitPayload)(nil), // 0: noble.orbiter.v1.MsgSubmitPayload + (*MsgSubmitPayloadResponse)(nil), // 1: noble.orbiter.v1.MsgSubmitPayloadResponse +} +var file_noble_orbiter_v1_tx_proto_depIdxs = []int32{ + 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() } +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 + } + } + } + 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: 2, + 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 + file_noble_orbiter_v1_tx_proto_goTypes = nil + file_noble_orbiter_v1_tx_proto_depIdxs = nil +} diff --git a/api/v1/tx_grpc.pb.go b/api/v1/tx_grpc.pb.go new file mode 100644 index 00000000..36fcb41e --- /dev/null +++ b/api/v1/tx_grpc.pb.go @@ -0,0 +1,129 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: noble/orbiter/v1/tx.proto + +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 +// is compatible with the grpc package it is being compiled against. +// 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 allows to insert a new pending payload + // into the module storage. + SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) +} + +type msgClient struct { + cc grpc.ClientConnInterface +} + +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 allows to insert a new pending payload + // into the module storage. + SubmitPayload(context.Context, *MsgSubmitPayload) (*MsgSubmitPayloadResponse, error) + mustEmbedUnimplementedMsgServer() +} + +// UnimplementedMsgServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// 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() {} + +// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MsgServer will +// result in compilation errors. +type UnsafeMsgServer interface { + mustEmbedUnimplementedMsgServer() +} + +func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { + // If the following call pancis, it indicates UnimplementedMsgServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + 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{ + { + MethodName: "SubmitPayload", + Handler: _Msg_SubmitPayload_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "noble/orbiter/v1/tx.proto", +} diff --git a/autocli.go b/autocli.go index ee8c8e5a..76ce77e3 100644 --- a/autocli.go +++ b/autocli.go @@ -28,7 +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" - "github.com/noble-assets/orbiter/types" + 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 +38,15 @@ import ( 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, @@ -54,6 +63,11 @@ func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Cross-chain adapter management commands", RpcCommandOptions: adapter.TxCommandOptions(), }, + "payload": { + Service: orbitertypes.Msg_serviceDesc.ServiceName, + Short: "Payload management commands", + RpcCommandOptions: orbitertypes.TxCommandOptions(), + }, }, }, Query: &autocliv1.ServiceCommandDescriptor{ @@ -69,10 +83,16 @@ func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcMethod: "ProtocolIDs", Skip: true, }, + { + // NOTE: we're manually moving this to the `payload` sub command for better + // navigation + RpcMethod: "PendingPayload", + Skip: true, + }, }, SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{ "identifiers": { - Service: types.Query_serviceDesc.ServiceName, + Service: orbitertypes.Query_serviceDesc.ServiceName, Short: "Action and Protocol identifiers", RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { @@ -107,6 +127,11 @@ func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Cross-chain forwarder query commands", RpcCommandOptions: forwarder.QueryCommandOptions(), }, + "payload": { + Service: orbitertypes.Query_serviceDesc.ServiceName, + Short: "Payload management commands", + RpcCommandOptions: orbitertypes.QueryCommandOptions(), + }, }, }, } 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 335ef9dc..4587fec6 100644 --- a/keeper/keeper.go +++ b/keeper/keeper.go @@ -24,6 +24,7 @@ import ( "errors" "cosmossdk.io/collections" + "cosmossdk.io/collections/indexes" "cosmossdk.io/core/address" "cosmossdk.io/core/event" "cosmossdk.io/core/store" @@ -35,11 +36,11 @@ 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{} // Keeper is the main module keeper. type Keeper struct { @@ -55,6 +56,31 @@ type Keeper struct { forwarder *forwardercomp.Forwarder dispatcher *dispatchercomp.Dispatcher adapter *adaptercomp.Adapter + + // pendingPayloads stores the pending payloads addressed by their sha256 hash. + 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. @@ -66,7 +92,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) @@ -79,6 +105,24 @@ func NewKeeper( eventService: eventService, logger: logger.With("module", core.ModuleName), authority: authority, + + 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, + core.PendingPayloadsSequencePrefix, + core.PendingPayloadsSequenceName, + ), } if err := k.setComponents(k.cdc, k.logger, k.eventService, sb, bankKeeper); err != nil { @@ -104,7 +148,7 @@ func validateKeeperInputs( logger log.Logger, eventService event.Service, storeService store.KVStoreService, - bankKeeper types.BankKeeper, + bankKeeper orbitertypes.BankKeeper, authority string, ) error { if cdc == nil { @@ -176,7 +220,7 @@ func (k *Keeper) Adapter() *adaptercomp.Adapter { return k.adapter } -func (k *Keeper) SetForwardingControllers(controllers ...types.ForwardingController) error { +func (k *Keeper) SetForwardingControllers(controllers ...orbitertypes.ForwardingController) error { router := k.forwarder.Router() for _, c := range controllers { if err := router.AddRoute(c); err != nil { @@ -190,7 +234,7 @@ func (k *Keeper) SetForwardingControllers(controllers ...types.ForwardingControl return nil } -func (k *Keeper) SetActionControllers(controllers ...types.ActionController) error { +func (k *Keeper) SetActionControllers(controllers ...orbitertypes.ActionController) error { router := k.executor.Router() for _, c := range controllers { if err := router.AddRoute(c); err != nil { @@ -204,7 +248,7 @@ func (k *Keeper) SetActionControllers(controllers ...types.ActionController) err return nil } -func (k *Keeper) SetAdapterControllers(controllers ...types.AdapterController) error { +func (k *Keeper) SetAdapterControllers(controllers ...orbitertypes.AdapterController) error { router := k.adapter.Router() for _, c := range controllers { if err := router.AddRoute(c); err != nil { @@ -234,7 +278,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..4c88cf6a --- /dev/null +++ b/keeper/msg_server.go @@ -0,0 +1,81 @@ +// 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" + "github.com/noble-assets/orbiter/types/core" +) + +var _ orbitertypes.MsgServer = &msgServer{} + +// 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) { + 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, 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 := s.validatePayloadAgainstState(ctx, &payload); err != nil { + return nil, status.Errorf( + codes.FailedPrecondition, + "payload failed stateful checks: %s", + err, + ) + } + + payloadHash, err := s.submit( + ctx, + &payload, + ) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &orbitertypes.MsgSubmitPayloadResponse{ + Hash: payloadHash.String(), + }, nil +} diff --git a/keeper/msg_server_test.go b/keeper/msg_server_test.go new file mode 100644 index 00000000..ab3e272a --- /dev/null +++ b/keeper/msg_server_test.go @@ -0,0 +1,274 @@ +// 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" + "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" + 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) + + 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") + + destDomain := uint32(1) + recipient := testutil.RandomBytes(32) + + testCases := []struct { + name string + setup func(*testing.T, context.Context, *orbiterkeeper.Keeper) + payload func() *core.Payload + expError string + expHash *core.PayloadHash + }{ + { + name: "success - valid payload", + payload: func() *core.Payload { return examplePayload.Payload }, + expHash: exampleHash, + }, + { + 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 + }, + expError: "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 pause protocol") + }, + 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 + }, + expError: "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 + }, + expError: "cross-chain 2:1 is paused", + }, + { + name: "error - invalid (empty) payload", + payload: func() *core.Payload { return &core.Payload{} }, + expError: "forwarding is not set: invalid nil pointer", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(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) + } + + 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.expError == "" { + require.NoError(t, err, "failed to submit payload") + require.Equal(t, tc.expHash.String(), res.Hash, "expected different hash") + } else { + require.ErrorContains(t, err, tc.expError, "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) + ms := orbiterkeeper.NewMsgServer(k) + + 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") + + 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 + require.Equal(t, expHash.String(), res.Hash, "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.SHA256Hash() + require.NoError(t, err, "failed to hash payload") + + // ASSERT: expected hash is returned + require.Equal(t, expHash2.String(), res2.Hash, "expected different hash") + + // ASSERT: hashes of subsequent submissions of the same payload are different + 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) + + 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, 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") + + // 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( + sequence uint64, + timestamp time.Time, +) (*core.PendingPayload, error) { + recipient := make([]byte, 32) + copy(recipient[32-3:], []byte{1, 2, 3}) + + validForwarding, err := forwarding.NewCCTPForwarding( + 0, + recipient, + recipient, + nil, + ) + if err != nil { + return nil, errorsmod.Wrap(err, "failed to create valid forwarding") + } + + validPayload := &core.Payload{ + PreActions: nil, + Forwarding: validForwarding, + } + + return &core.PendingPayload{ + Sequence: sequence, + Payload: validPayload, + Timestamp: timestamp.UnixNano(), + }, nil +} diff --git a/keeper/payload_handler.go b/keeper/payload_handler.go new file mode 100644 index 00000000..ee8425a4 --- /dev/null +++ b/keeper/payload_handler.go @@ -0,0 +1,239 @@ +// 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" + "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. +// +// CONTRACT: The payload MUST be validated before using this method. +func (k *Keeper) submit( + ctx context.Context, + payload *core.Payload, +) (*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, + Timestamp: sdkCtx.BlockTime().UnixNano(), + } + + hash, err := pendingPayload.SHA256Hash() + 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") + } + + return hash, 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().String()) + } + } + + paused, err := k.forwarder.IsProtocolPaused(ctx, payload.Forwarding.ProtocolId) + if err != nil { + return errorsmod.Wrap(err, "failed to check if protocol is paused") + } + + if paused { + return fmt.Errorf("protocol %s is paused", payload.Forwarding.ProtocolId.String()) + } + + cachedAttrs, err := payload.Forwarding.CachedAttributes() + if err != nil { + return err + } + + 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 %s is paused", ccID.String()) + } + + 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 *core.PayloadHash, +) (*core.PendingPayload, error) { + if hash == nil { + return nil, core.ErrNilPointer.Wrap("payload hash") + } + + payload, err := k.pendingPayloads.Get(ctx, hash.Bytes()) + if err != nil { + 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", hash.String(), + "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 *core.PayloadHash, +) error { + 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 sdkerrors.ErrNotFound.Wrapf("payload with hash %q", hash.String()) + } + + 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", hash.String()) + + 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 new file mode 100644 index 00000000..612e44b0 --- /dev/null +++ b/keeper/payload_handler_test.go @@ -0,0 +1,309 @@ +// 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" + "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" + 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() + + 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 + expError string + }{ + { + name: "success - valid payload", + setup: func(t *testing.T, ctx context.Context, cdc codec.Codec, ms orbitertypes.MsgServer) { + t.Helper() + + 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, + }, + { + name: "error - valid payload but not found in store", + setup: nil, + hash: expHash, + expError: sdkerrors.ErrNotFound.Wrapf( + "payload with hash %q", + expHash.String(), + ).Error(), + }, + { + name: "error - nil hash", + setup: nil, + hash: nil, + expError: core.ErrNilPointer.Wrap("payload hash").Error(), + }, + } + + 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) + + ctx = ctx.WithBlockTime(nowUTC) + + if tc.setup != nil { + tc.setup(t, ctx, k.Codec(), ms) + } + + err := k.RemovePendingPayload(ctx, tc.hash) + if tc.expError == "" { + require.NoError(t, err, "failed to remove payload") + + // ASSERT: value with hash was removed. + gotPayload, err := qs.PendingPayload( + ctx, + &orbitertypes.QueryPendingPayloadRequest{ + Hash: tc.hash.String(), + }, + ) + require.Error(t, err, "payload should not be present anymore") + require.Nil(t, gotPayload, "expected nil payload") + } else { + require.ErrorContains(t, err, tc.expError, "expected different error") + } + }) + } +} + +const timeBetweenBlocks = 1 * time.Second + +func TestRemovePayloads(t *testing.T) { + nowUTC := time.Now().UTC() + startUTC := nowUTC.Add(1 * time.Second) + + 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: startUTC.Add(3 * timeBetweenBlocks / 2), + 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: startUTC.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 = ctx.WithBlockTime(startUTC) + + 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.go b/keeper/query_server.go index 444d993d..c6d1586b 100644 --- a/keeper/query_server.go +++ b/keeper/query_server.go @@ -23,6 +23,10 @@ package keeper import ( "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + errorsmod "cosmossdk.io/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" orbitertypes "github.com/noble-assets/orbiter/types" @@ -80,3 +84,26 @@ func (q *queryServer) ProtocolIDs( ProtocolIds: ids, }, nil } + +func (s *queryServer) PendingPayload( + ctx context.Context, + req *orbitertypes.QueryPendingPayloadRequest, +) (*orbitertypes.QueryPendingPayloadResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + hash, err := core.NewPayloadHash(req.Hash) + if err != nil { + 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, errorsmod.Wrap(err, "payload not found").Error()) + } + + 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..c3765bc5 --- /dev/null +++ b/keeper/query_server_test.go @@ -0,0 +1,132 @@ +// 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" + "time" + + "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() + + 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 + expError 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, + req: &orbitertypes.QueryPendingPayloadRequest{ + Hash: exampleHash.String(), + }, + }, + { + name: "error - hash not found", + setup: nil, + req: &orbitertypes.QueryPendingPayloadRequest{ + Hash: exampleHash.String(), + }, + expError: codes.NotFound.String(), + }, + { + name: "error - nil request", + setup: nil, + req: nil, + expError: codes.InvalidArgument.String(), + }, + { + name: "error - empty hash", + setup: nil, + req: &orbitertypes.QueryPendingPayloadRequest{ + Hash: "", + }, + expError: 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) + + // 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) + } + + got, err := qs.PendingPayload( + ctx, + tc.req, + ) + + if tc.expError == "" { + require.NoError(t, err, "failed to get pending payload") + require.Equal( + t, + tc.expPayload.Payload.String(), + got.Payload.String(), + "expected different payload", + ) + } else { + require.ErrorContains(t, err, tc.expError, "expected different error") + } + }) + } +} diff --git a/keeper/servers_registration.go b/keeper/servers_registration.go index 5575b714..6fb182eb 100644 --- a/keeper/servers_registration.go +++ b/keeper/servers_registration.go @@ -27,7 +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" - "github.com/noble-assets/orbiter/types" + 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 +38,9 @@ import ( // (Forwarder, Executor, and Adapter) with the module configurator. func RegisterMsgServers(cfg module.Configurator, k *Keeper) { ms := cfg.MsgServer() + + orbitertypes.RegisterMsgServer(ms, NewMsgServer(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)) @@ -47,7 +50,9 @@ func RegisterMsgServers(cfg module.Configurator, k *Keeper) { // with the module configurator. func RegisterQueryServers(cfg module.Configurator, k *Keeper) { qs := cfg.QueryServer() - types.RegisterQueryServer(qs, NewQueryServer(k)) + + 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/module.go b/module.go index 25f9a885..12990308 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{} @@ -150,3 +152,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 1bac683d..c7aa17ac 100644 --- a/proto/generate.sh +++ b/proto/generate.sh @@ -13,6 +13,6 @@ cp -r api/noble/orbiter/* api/ # the following command requires GNU sed 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 8b10e90f..10fde132 100644 --- a/proto/noble/orbiter/core/v1/orbiter.proto +++ b/proto/noble/orbiter/core/v1/orbiter.proto @@ -74,3 +74,13 @@ 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 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/query.proto b/proto/noble/orbiter/v1/query.proto index c7a9a89d..8a7d0627 100644 --- a/proto/noble/orbiter/v1/query.proto +++ b/proto/noble/orbiter/v1/query.proto @@ -4,6 +4,7 @@ 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"; @@ -17,6 +18,10 @@ service Query { option (cosmos.query.v1.module_query_safe) = true; option (google.api.http).get = "/noble/orbiter/v1/identifiers/protocols"; } + rpc PendingPayload(QueryPendingPayloadRequest) returns (QueryPendingPayloadResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http).get = "/noble/orbiter/v1/payload/{hash}"; + } } message QueryActionIDsRequest {} @@ -30,3 +35,13 @@ message QueryProtocolIDsRequest {} message QueryProtocolIDsResponse { map protocol_ids = 1; } + +message QueryPendingPayloadRequest { + // The hex-encoded bytes of the registered hash of the payload to retrieve. + string hash = 1; +} + +message QueryPendingPayloadResponse { + // The payload contents of the registered payload. + noble.orbiter.core.v1.Payload payload = 1; +} diff --git a/proto/noble/orbiter/v1/tx.proto b/proto/noble/orbiter/v1/tx.proto new file mode 100644 index 00000000..b564f11e --- /dev/null +++ b/proto/noble/orbiter/v1/tx.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; + +package noble.orbiter.v1; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.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 allows to insert a new pending payload + // into the module storage. + rpc SubmitPayload(MsgSubmitPayload) returns (MsgSubmitPayloadResponse); +} + +// MsgSubmitPayload enters a new Orbiter payload into the list 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 sha256 hash of the registered +// pending payload. +message MsgSubmitPayloadResponse { + // 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/autocli.go b/types/autocli.go new file mode 100644 index 00000000..e40a708c --- /dev/null +++ b/types/autocli.go @@ -0,0 +1,54 @@ +// 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: `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"}, + }, + }, + } +} + +func QueryCommandOptions() []*autocliv1.RpcCommandOptions { + return []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "PendingPayload", + Use: "pending", + 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/codec.go b/types/codec.go index 1ec34f68..89c71519 100644 --- a/types/codec.go +++ b/types/codec.go @@ -23,6 +23,8 @@ 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" "github.com/noble-assets/orbiter/types/controller" @@ -47,6 +49,13 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*core.ActionAttributes)(nil), ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSubmitPayload{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + component.RegisterInterfaces(registry) controller.RegisterInterfaces(registry) } diff --git a/types/core/keys.go b/types/core/keys.go index 48a2b37e..bfb0276c 100644 --- a/types/core/keys.go +++ b/types/core/keys.go @@ -106,3 +106,21 @@ const ( var OrbiterPrefix = ModuleName var AdapterParamsPrefix = collections.NewPrefix(40) + +// ==================================================================================================== +// Keeper +// ====================================================================================================. + +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 ea86972e..7ccd5566 100644 --- a/types/core/orbiter.pb.go +++ b/types/core/orbiter.pb.go @@ -230,11 +230,76 @@ 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 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{} } +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 (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") 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 +307,39 @@ 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, + // 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) { @@ -445,6 +513,51 @@ 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.Timestamp != 0 { + i = encodeVarintOrbiter(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x18 + } + 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 +637,25 @@ 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)) + } + if m.Timestamp != 0 { + n += 1 + sovOrbiter(uint64(m.Timestamp)) + } + return n +} + func sovOrbiter(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -980,6 +1112,130 @@ 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 + 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:]) + 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/core/payload.go b/types/core/payload.go new file mode 100644 index 00000000..3842e4e1 --- /dev/null +++ b/types/core/payload.go @@ -0,0 +1,76 @@ +// 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 ( + "crypto/sha256" + "encoding/hex" + "errors" + + errorsmod "cosmossdk.io/errors" +) + +// 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) SHA256Hash() (*PayloadHash, error) { + bz, err := p.Marshal() + if err != nil { + return nil, err + } + + hash := sha256.Sum256(bz) + pHash := PayloadHash(hash) + + return &pHash, nil +} + +// 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 + +// 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") + } + + 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/core/payload_test.go b/types/core/payload_test.go new file mode 100644 index 00000000..d9178308 --- /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.NewPayloadHash(hash.String()) + require.NoError(t, err, "failed to parse payload hash") + + require.Equal(t, hash.String(), parsedHash.String(), "payload hash mismatch") +} + +func TestNewPayloadHash(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 + expError string + }{ + { + name: "success - valid hash", + input: hash.String(), + }, + { + name: "error - invalid hash", + input: "abcdefg", + expError: "invalid payload hash", + }, + { + name: "error - too short hash", + input: "0123ab", + expError: "malformed payload hash", + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + + parsed, err := core.NewPayloadHash(tc.input) + 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.expError) + } + }) + } +} + +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, + } +} diff --git a/types/query.pb.go b/types/query.pb.go index 4f4e4b2a..a5d72669 100644 --- a/types/query.pb.go +++ b/types/query.pb.go @@ -9,6 +9,7 @@ import ( _ "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" @@ -189,6 +190,96 @@ func (m *QueryProtocolIDsResponse) GetProtocolIds() map[int32]string { return nil } +type QueryPendingPayloadRequest struct { + // 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{} } +func (m *QueryPendingPayloadRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPendingPayloadRequest) ProtoMessage() {} +func (*QueryPendingPayloadRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_390782105f057f99, []int{4} +} +func (m *QueryPendingPayloadRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPendingPayloadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPendingPayloadRequest.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 *QueryPendingPayloadRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPayloadRequest.Merge(m, src) +} +func (m *QueryPendingPayloadRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPendingPayloadRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPayloadRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPendingPayloadRequest proto.InternalMessageInfo + +func (m *QueryPendingPayloadRequest) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + +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 *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{5} +} +func (m *QueryPendingPayloadResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPendingPayloadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPendingPayloadResponse.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 *QueryPendingPayloadResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPendingPayloadResponse.Merge(m, src) +} +func (m *QueryPendingPayloadResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPendingPayloadResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPendingPayloadResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPendingPayloadResponse proto.InternalMessageInfo + +func (m *QueryPendingPayloadResponse) GetPayload() *core.Payload { + if m != nil { + return m.Payload + } + return nil +} + func init() { proto.RegisterType((*QueryActionIDsRequest)(nil), "noble.orbiter.v1.QueryActionIDsRequest") proto.RegisterType((*QueryActionIDsResponse)(nil), "noble.orbiter.v1.QueryActionIDsResponse") @@ -196,39 +287,48 @@ func init() { proto.RegisterType((*QueryProtocolIDsRequest)(nil), "noble.orbiter.v1.QueryProtocolIDsRequest") proto.RegisterType((*QueryProtocolIDsResponse)(nil), "noble.orbiter.v1.QueryProtocolIDsResponse") proto.RegisterMapType((map[int32]string)(nil), "noble.orbiter.v1.QueryProtocolIDsResponse.ProtocolIdsEntry") + 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{ - // 428 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, 0x64, 0x95, 0xc4, 0xb9, 0x44, 0x03, 0x41, 0x8a, 0x1d, - 0x93, 0x41, 0xa2, 0x9e, 0x2e, 0xc5, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x4a, 0xeb, 0x18, - 0xb9, 0xc4, 0xd0, 0x65, 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0xc2, 0xb8, 0xb8, 0x12, 0xc1, - 0x82, 0xf1, 0x99, 0x29, 0xc5, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xe6, 0x7a, 0xe8, 0xae, - 0xd2, 0xc3, 0xae, 0x5b, 0x0f, 0x2a, 0x92, 0x52, 0xec, 0x9a, 0x57, 0x52, 0x54, 0x19, 0xc4, 0x99, - 0x08, 0xe3, 0x4b, 0xd9, 0x70, 0xf1, 0xa1, 0x4a, 0x0a, 0x09, 0x70, 0x31, 0x67, 0xa7, 0x56, 0x4a, - 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x06, 0x81, 0x98, 0x42, 0x22, 0x5c, 0xac, 0x65, 0x89, 0x39, 0xa5, - 0xa9, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x10, 0x8e, 0x15, 0x93, 0x05, 0xa3, 0x92, 0x24, - 0x97, 0x38, 0xd8, 0xc6, 0x00, 0x90, 0xbf, 0x92, 0xf3, 0x73, 0x90, 0xfc, 0xb2, 0x8b, 0x91, 0x4b, - 0x02, 0x53, 0x0e, 0xea, 0x9b, 0x38, 0x2e, 0x9e, 0x02, 0xa8, 0x30, 0x92, 0x7f, 0xac, 0x71, 0xf8, - 0x07, 0x8b, 0x09, 0x7a, 0x70, 0x31, 0x98, 0x9f, 0xb8, 0x0b, 0x10, 0x22, 0x52, 0x76, 0x5c, 0x02, - 0xe8, 0x0a, 0x48, 0xf1, 0x97, 0xd1, 0x4e, 0x26, 0x2e, 0x56, 0xb0, 0xd5, 0x42, 0x93, 0x18, 0xb9, - 0x38, 0xe1, 0xe1, 0x29, 0xa4, 0x4e, 0x38, 0xc4, 0xc1, 0xbe, 0x97, 0xd2, 0x20, 0x36, 0x6a, 0x94, - 0x8c, 0x3a, 0x9e, 0x6f, 0xd0, 0x62, 0x6c, 0xba, 0xfc, 0x64, 0x32, 0x93, 0xba, 0x90, 0xaa, 0x3e, - 0x46, 0x2a, 0xcc, 0x4c, 0x49, 0xcd, 0x2b, 0xc9, 0x4c, 0xcb, 0x4c, 0x2d, 0x2a, 0xd6, 0x87, 0x44, - 0x5b, 0xb1, 0xd0, 0x2c, 0x46, 0x2e, 0x6e, 0xa4, 0x40, 0x11, 0xd2, 0x24, 0x26, 0xe0, 0x20, 0x0e, - 0xd3, 0x22, 0x3e, 0x8c, 0x95, 0x4c, 0x10, 0x4e, 0xd3, 0x14, 0x52, 0xc7, 0xef, 0x34, 0x58, 0xe8, - 0x17, 0x3b, 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, 0x30, 0xdd, 0xc4, 0xe2, 0xe2, 0xd4, - 0x92, 0x62, 0xb8, 0x99, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xb3, 0x8c, 0x01, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x31, 0x0b, 0xb4, 0x23, 0x92, 0x03, 0x00, 0x00, + // 533 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcf, 0x8b, 0xd3, 0x40, + 0x14, 0xee, 0xb4, 0x56, 0xe9, 0xab, 0x2c, 0x65, 0x50, 0xb7, 0x66, 0x97, 0x50, 0x22, 0x4b, 0xbb, + 0x8b, 0x4d, 0xdc, 0x2a, 0xb8, 0xa8, 0x28, 0x8a, 0x1e, 0xbc, 0xad, 0x39, 0x28, 0x78, 0x50, 0xa6, + 0xc9, 0xd8, 0x06, 0xb3, 0x99, 0x6c, 0x66, 0x5a, 0x08, 0xe2, 0xc5, 0x93, 0x47, 0xd1, 0x9b, 0xf8, + 0x37, 0x88, 0x67, 0xff, 0x02, 0x8f, 0x0b, 0x5e, 0xf6, 0x28, 0xad, 0xe0, 0xbf, 0x21, 0x99, 0x4c, + 0xfa, 0x23, 0xed, 0x6a, 0xf7, 0x96, 0x79, 0xef, 0x7b, 0xdf, 0xfb, 0x3e, 0xbe, 0x17, 0xd8, 0x0c, + 0x58, 0xd7, 0xa7, 0x16, 0x8b, 0xba, 0x9e, 0xa0, 0x91, 0x35, 0xdc, 0xb5, 0x0e, 0x07, 0x34, 0x8a, + 0xcd, 0x30, 0x62, 0x82, 0xe1, 0x9a, 0xec, 0x9a, 0xaa, 0x6b, 0x0e, 0x77, 0xb5, 0x0d, 0x87, 0xf1, + 0x03, 0xc6, 0x53, 0x54, 0x0e, 0xae, 0x6d, 0xf6, 0x18, 0xeb, 0xf9, 0xd4, 0x22, 0xa1, 0x67, 0x91, + 0x20, 0x60, 0x82, 0x08, 0x8f, 0x05, 0x5c, 0x75, 0xaf, 0xcc, 0xaf, 0x72, 0x58, 0x44, 0x13, 0x82, + 0x8c, 0x5c, 0x82, 0x8c, 0x75, 0xb8, 0xf8, 0x24, 0x61, 0xbc, 0xef, 0x24, 0xa3, 0x8f, 0x1f, 0x72, + 0x9b, 0x1e, 0x0e, 0x28, 0x17, 0xc6, 0x57, 0x04, 0x97, 0xf2, 0x1d, 0x1e, 0xb2, 0x80, 0x53, 0xfc, + 0x14, 0x80, 0xc8, 0xe2, 0x4b, 0xcf, 0xe5, 0x75, 0xd4, 0x28, 0xb5, 0xaa, 0x9d, 0x9b, 0x66, 0x5e, + 0xba, 0xb9, 0x7c, 0xda, 0x54, 0x15, 0x97, 0x3f, 0x0a, 0x44, 0x14, 0xdb, 0x15, 0x92, 0xbd, 0xb5, + 0x3b, 0xb0, 0x36, 0xdf, 0xc4, 0x35, 0x28, 0xbd, 0xa6, 0x71, 0x1d, 0x35, 0x50, 0xab, 0x6c, 0x27, + 0x9f, 0xf8, 0x02, 0x94, 0x87, 0xc4, 0x1f, 0xd0, 0x7a, 0xb1, 0x81, 0x5a, 0x15, 0x3b, 0x7d, 0xdc, + 0x2a, 0xee, 0x21, 0xe3, 0x32, 0xac, 0xcb, 0x8d, 0xfb, 0x89, 0x2f, 0x87, 0xf9, 0x33, 0x5e, 0xbe, + 0x23, 0xa8, 0x2f, 0xf6, 0x94, 0x9b, 0x17, 0x70, 0x3e, 0x54, 0xe5, 0x19, 0x3f, 0xb7, 0x4f, 0xf0, + 0xb3, 0x84, 0xc1, 0x9c, 0xd4, 0x32, 0x4f, 0xd5, 0x70, 0x5a, 0xd1, 0xee, 0x42, 0x2d, 0x0f, 0x38, + 0x95, 0xaf, 0x6b, 0xa0, 0xa5, 0x9b, 0x69, 0xe0, 0x7a, 0x41, 0x6f, 0x9f, 0xc4, 0x3e, 0x23, 0xae, + 0xb2, 0x86, 0x31, 0x9c, 0xe9, 0x13, 0xde, 0x97, 0x54, 0x15, 0x5b, 0x7e, 0x1b, 0xcf, 0x60, 0x63, + 0xe9, 0x84, 0x32, 0xbc, 0x07, 0xe7, 0xc2, 0xb4, 0x24, 0xa7, 0xaa, 0x1d, 0x3d, 0xe7, 0x35, 0xb9, + 0x94, 0xc4, 0x70, 0x36, 0x98, 0xc1, 0x3b, 0xc7, 0x25, 0x28, 0x4b, 0x66, 0xfc, 0x11, 0x41, 0x65, + 0x12, 0x2d, 0x6e, 0xfe, 0x3f, 0x7c, 0xa9, 0x56, 0x6b, 0xad, 0x7a, 0x25, 0x46, 0xe7, 0xfd, 0x9f, + 0x6f, 0x3b, 0xe8, 0xdd, 0xcf, 0xdf, 0x9f, 0x8a, 0x4d, 0xbc, 0x65, 0x2d, 0xfc, 0x35, 0x9e, 0x4b, + 0x03, 0xe1, 0xbd, 0xf2, 0x68, 0xc4, 0xad, 0xf4, 0x82, 0x38, 0xfe, 0x8c, 0xa0, 0x3a, 0x93, 0x0f, + 0xde, 0x5e, 0x25, 0xc3, 0x54, 0xd8, 0xce, 0xea, 0x71, 0x1b, 0x37, 0xa6, 0xd2, 0xb6, 0x71, 0xf3, + 0xdf, 0xd2, 0xb2, 0x43, 0xe0, 0xf8, 0x0b, 0x82, 0xb5, 0xf9, 0x40, 0xf0, 0xd5, 0x93, 0x96, 0x2e, + 0x4b, 0x5a, 0x6b, 0xaf, 0x88, 0x56, 0x2a, 0xdb, 0x53, 0x95, 0x06, 0x6e, 0x2c, 0xaa, 0x54, 0x99, + 0x5a, 0x6f, 0x92, 0x93, 0x79, 0xfb, 0xe0, 0xde, 0x8f, 0x91, 0x8e, 0x8e, 0x46, 0x3a, 0xfa, 0x35, + 0xd2, 0xd1, 0x87, 0xb1, 0x5e, 0x38, 0x1a, 0xeb, 0x85, 0xe3, 0xb1, 0x5e, 0x78, 0xbe, 0xd5, 0xf3, + 0x44, 0x7f, 0xd0, 0x35, 0x1d, 0x76, 0x90, 0xb2, 0xb4, 0x09, 0xe7, 0x54, 0xf0, 0x09, 0x99, 0x88, + 0x43, 0xca, 0xbb, 0x67, 0xa5, 0xd5, 0xeb, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x46, 0x8e, + 0x6f, 0xe1, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -245,6 +345,7 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { ActionIDs(ctx context.Context, in *QueryActionIDsRequest, opts ...grpc.CallOption) (*QueryActionIDsResponse, error) ProtocolIDs(ctx context.Context, in *QueryProtocolIDsRequest, opts ...grpc.CallOption) (*QueryProtocolIDsResponse, error) + PendingPayload(ctx context.Context, in *QueryPendingPayloadRequest, opts ...grpc.CallOption) (*QueryPendingPayloadResponse, error) } type queryClient struct { @@ -273,10 +374,20 @@ func (c *queryClient) ProtocolIDs(ctx context.Context, in *QueryProtocolIDsReque return out, nil } +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 + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { ActionIDs(context.Context, *QueryActionIDsRequest) (*QueryActionIDsResponse, error) ProtocolIDs(context.Context, *QueryProtocolIDsRequest) (*QueryProtocolIDsResponse, error) + PendingPayload(context.Context, *QueryPendingPayloadRequest) (*QueryPendingPayloadResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -289,6 +400,9 @@ func (*UnimplementedQueryServer) ActionIDs(ctx context.Context, req *QueryAction func (*UnimplementedQueryServer) ProtocolIDs(ctx context.Context, req *QueryProtocolIDsRequest) (*QueryProtocolIDsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProtocolIDs 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) @@ -330,6 +444,24 @@ func _Query_ProtocolIDs_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +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).PendingPayload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/noble.orbiter.v1.Query/PendingPayload", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).PendingPayload(ctx, req.(*QueryPendingPayloadRequest)) + } + return interceptor(ctx, in, info, handler) +} + var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "noble.orbiter.v1.Query", @@ -343,6 +475,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ProtocolIDs", Handler: _Query_ProtocolIDs_Handler, }, + { + MethodName: "PendingPayload", + Handler: _Query_PendingPayload_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "noble/orbiter/v1/query.proto", @@ -474,6 +610,71 @@ func (m *QueryProtocolIDsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryPendingPayloadRequest) 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 *QueryPendingPayloadRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingPayloadRequest) 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 = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryPendingPayloadResponse) 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 *QueryPendingPayloadResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPendingPayloadResponse) 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 = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -537,6 +738,32 @@ func (m *QueryProtocolIDsResponse) Size() (n int) { return n } +func (m *QueryPendingPayloadRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPendingPayloadResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Payload != nil { + l = m.Payload.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -969,6 +1196,174 @@ func (m *QueryProtocolIDsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryPendingPayloadRequest) 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: QueryPendingPayloadRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + 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 Hash", 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.Hash = string(dAtA[iNdEx:postIndex]) + 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 *QueryPendingPayloadResponse) 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: QueryPendingPayloadResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + 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 Payload", 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.Payload == nil { + m.Payload = &core.Payload{} + } + if err := m.Payload.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 diff --git a/types/query.pb.gw.go b/types/query.pb.gw.go index 63226d14..55335ba7 100644 --- a/types/query.pb.gw.go +++ b/types/query.pb.gw.go @@ -69,6 +69,60 @@ func local_request_Query_ProtocolIDs_0(ctx context.Context, marshaler runtime.Ma } +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 + + 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") + } + + protoReq.Hash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + msg, err := client.PendingPayload(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +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 + + 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") + } + + protoReq.Hash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + msg, err := server.PendingPayload(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. @@ -121,6 +175,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + 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 + 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_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 { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_PendingPayload_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -202,6 +279,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + 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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + 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_PendingPayload_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -209,10 +306,14 @@ var ( pattern_Query_ActionIDs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"noble", "orbiter", "v1", "identifiers", "actions"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ProtocolIDs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"noble", "orbiter", "v1", "identifiers", "protocols"}, "", 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_ActionIDs_0 = runtime.ForwardResponseMessage forward_Query_ProtocolIDs_0 = runtime.ForwardResponseMessage + + forward_Query_PendingPayload_0 = runtime.ForwardResponseMessage ) diff --git a/types/tx.pb.go b/types/tx.pb.go new file mode 100644 index 00000000..5847d2d5 --- /dev/null +++ b/types/tx.pb.go @@ -0,0 +1,646 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: noble/orbiter/v1/tx.proto + +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" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + 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. +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 + +// MsgSubmitPayload enters a new Orbiter payload into the list 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 sha256 hash of the registered +// pending payload. +type MsgSubmitPayloadResponse struct { + // 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{} } +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() string { + if m != nil { + return m.Hash + } + return "" +} + +func init() { + proto.RegisterType((*MsgSubmitPayload)(nil), "noble.orbiter.v1.MsgSubmitPayload") + proto.RegisterType((*MsgSubmitPayloadResponse)(nil), "noble.orbiter.v1.MsgSubmitPayloadResponse") +} + +func init() { proto.RegisterFile("noble/orbiter/v1/tx.proto", fileDescriptor_4f89c0e5a76b9120) } + +var fileDescriptor_4f89c0e5a76b9120 = []byte{ + // 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, + 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, 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. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// 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 allows to insert a new pending payload + // into the module storage. + SubmitPayload(ctx context.Context, in *MsgSubmitPayload, opts ...grpc.CallOption) (*MsgSubmitPayloadResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +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 allows to insert a new pending payload + // into the module storage. + 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{ + { + 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 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 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 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.Hash = 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 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") +)