diff --git a/CHANGELOG.md b/CHANGELOG.md index e2cc98858..423599bc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * (wardend) Bump IAVL to v1.2.2. Fixes some potential apphash mismatches that happen in some rare cases. * (x/async) Scaffold new module with create/read operations * (x/warden) Sign requests query return all request (not only with broadcastType=BroadcastType.Disabled) +* (prophet) First version. Includes the task runner for Futures and Votes, and the interface for handlers. ### Bug Fixes diff --git a/api/warden/async/v1beta1/ve.pulsar.go b/api/warden/async/v1beta1/ve.pulsar.go new file mode 100644 index 000000000..a99b5f19a --- /dev/null +++ b/api/warden/async/v1beta1/ve.pulsar.go @@ -0,0 +1,2410 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package asyncv1beta1 + +import ( + abci "cosmossdk.io/api/tendermint/abci" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + 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 _ protoreflect.List = (*_AsyncInjectedTx_1_list)(nil) + +type _AsyncInjectedTx_1_list struct { + list *[]*abci.ExtendedVoteInfo +} + +func (x *_AsyncInjectedTx_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_AsyncInjectedTx_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_AsyncInjectedTx_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*abci.ExtendedVoteInfo) + (*x.list)[i] = concreteValue +} + +func (x *_AsyncInjectedTx_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*abci.ExtendedVoteInfo) + *x.list = append(*x.list, concreteValue) +} + +func (x *_AsyncInjectedTx_1_list) AppendMutable() protoreflect.Value { + v := new(abci.ExtendedVoteInfo) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_AsyncInjectedTx_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_AsyncInjectedTx_1_list) NewElement() protoreflect.Value { + v := new(abci.ExtendedVoteInfo) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_AsyncInjectedTx_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_AsyncInjectedTx protoreflect.MessageDescriptor + fd_AsyncInjectedTx_extended_votes_info protoreflect.FieldDescriptor +) + +func init() { + file_warden_async_v1beta1_ve_proto_init() + md_AsyncInjectedTx = File_warden_async_v1beta1_ve_proto.Messages().ByName("AsyncInjectedTx") + fd_AsyncInjectedTx_extended_votes_info = md_AsyncInjectedTx.Fields().ByName("extended_votes_info") +} + +var _ protoreflect.Message = (*fastReflection_AsyncInjectedTx)(nil) + +type fastReflection_AsyncInjectedTx AsyncInjectedTx + +func (x *AsyncInjectedTx) ProtoReflect() protoreflect.Message { + return (*fastReflection_AsyncInjectedTx)(x) +} + +func (x *AsyncInjectedTx) slowProtoReflect() protoreflect.Message { + mi := &file_warden_async_v1beta1_ve_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_AsyncInjectedTx_messageType fastReflection_AsyncInjectedTx_messageType +var _ protoreflect.MessageType = fastReflection_AsyncInjectedTx_messageType{} + +type fastReflection_AsyncInjectedTx_messageType struct{} + +func (x fastReflection_AsyncInjectedTx_messageType) Zero() protoreflect.Message { + return (*fastReflection_AsyncInjectedTx)(nil) +} +func (x fastReflection_AsyncInjectedTx_messageType) New() protoreflect.Message { + return new(fastReflection_AsyncInjectedTx) +} +func (x fastReflection_AsyncInjectedTx_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_AsyncInjectedTx +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_AsyncInjectedTx) Descriptor() protoreflect.MessageDescriptor { + return md_AsyncInjectedTx +} + +// 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_AsyncInjectedTx) Type() protoreflect.MessageType { + return _fastReflection_AsyncInjectedTx_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_AsyncInjectedTx) New() protoreflect.Message { + return new(fastReflection_AsyncInjectedTx) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_AsyncInjectedTx) Interface() protoreflect.ProtoMessage { + return (*AsyncInjectedTx)(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_AsyncInjectedTx) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.ExtendedVotesInfo) != 0 { + value := protoreflect.ValueOfList(&_AsyncInjectedTx_1_list{list: &x.ExtendedVotesInfo}) + if !f(fd_AsyncInjectedTx_extended_votes_info, 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_AsyncInjectedTx) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncInjectedTx.extended_votes_info": + return len(x.ExtendedVotesInfo) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncInjectedTx")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncInjectedTx 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_AsyncInjectedTx) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncInjectedTx.extended_votes_info": + x.ExtendedVotesInfo = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncInjectedTx")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncInjectedTx 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_AsyncInjectedTx) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "warden.async.v1beta1.AsyncInjectedTx.extended_votes_info": + if len(x.ExtendedVotesInfo) == 0 { + return protoreflect.ValueOfList(&_AsyncInjectedTx_1_list{}) + } + listValue := &_AsyncInjectedTx_1_list{list: &x.ExtendedVotesInfo} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncInjectedTx")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncInjectedTx 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_AsyncInjectedTx) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncInjectedTx.extended_votes_info": + lv := value.List() + clv := lv.(*_AsyncInjectedTx_1_list) + x.ExtendedVotesInfo = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncInjectedTx")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncInjectedTx 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_AsyncInjectedTx) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncInjectedTx.extended_votes_info": + if x.ExtendedVotesInfo == nil { + x.ExtendedVotesInfo = []*abci.ExtendedVoteInfo{} + } + value := &_AsyncInjectedTx_1_list{list: &x.ExtendedVotesInfo} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncInjectedTx")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncInjectedTx 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_AsyncInjectedTx) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncInjectedTx.extended_votes_info": + list := []*abci.ExtendedVoteInfo{} + return protoreflect.ValueOfList(&_AsyncInjectedTx_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncInjectedTx")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncInjectedTx 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_AsyncInjectedTx) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in warden.async.v1beta1.AsyncInjectedTx", 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_AsyncInjectedTx) 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_AsyncInjectedTx) 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_AsyncInjectedTx) 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_AsyncInjectedTx) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*AsyncInjectedTx) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.ExtendedVotesInfo) > 0 { + for _, e := range x.ExtendedVotesInfo { + l = options.Size(e) + 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().(*AsyncInjectedTx) + 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.ExtendedVotesInfo) > 0 { + for iNdEx := len(x.ExtendedVotesInfo) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ExtendedVotesInfo[iNdEx]) + 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().(*AsyncInjectedTx) + 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: AsyncInjectedTx: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AsyncInjectedTx: 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 ExtendedVotesInfo", 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 + } + x.ExtendedVotesInfo = append(x.ExtendedVotesInfo, &abci.ExtendedVoteInfo{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ExtendedVotesInfo[len(x.ExtendedVotesInfo)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_AsyncVoteExtension_1_list)(nil) + +type _AsyncVoteExtension_1_list struct { + list *[]*VEResultItem +} + +func (x *_AsyncVoteExtension_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_AsyncVoteExtension_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_AsyncVoteExtension_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*VEResultItem) + (*x.list)[i] = concreteValue +} + +func (x *_AsyncVoteExtension_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*VEResultItem) + *x.list = append(*x.list, concreteValue) +} + +func (x *_AsyncVoteExtension_1_list) AppendMutable() protoreflect.Value { + v := new(VEResultItem) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_AsyncVoteExtension_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_AsyncVoteExtension_1_list) NewElement() protoreflect.Value { + v := new(VEResultItem) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_AsyncVoteExtension_1_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_AsyncVoteExtension_2_list)(nil) + +type _AsyncVoteExtension_2_list struct { + list *[]*VEVoteItem +} + +func (x *_AsyncVoteExtension_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_AsyncVoteExtension_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_AsyncVoteExtension_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*VEVoteItem) + (*x.list)[i] = concreteValue +} + +func (x *_AsyncVoteExtension_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*VEVoteItem) + *x.list = append(*x.list, concreteValue) +} + +func (x *_AsyncVoteExtension_2_list) AppendMutable() protoreflect.Value { + v := new(VEVoteItem) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_AsyncVoteExtension_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_AsyncVoteExtension_2_list) NewElement() protoreflect.Value { + v := new(VEVoteItem) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_AsyncVoteExtension_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_AsyncVoteExtension protoreflect.MessageDescriptor + fd_AsyncVoteExtension_results protoreflect.FieldDescriptor + fd_AsyncVoteExtension_votes protoreflect.FieldDescriptor +) + +func init() { + file_warden_async_v1beta1_ve_proto_init() + md_AsyncVoteExtension = File_warden_async_v1beta1_ve_proto.Messages().ByName("AsyncVoteExtension") + fd_AsyncVoteExtension_results = md_AsyncVoteExtension.Fields().ByName("results") + fd_AsyncVoteExtension_votes = md_AsyncVoteExtension.Fields().ByName("votes") +} + +var _ protoreflect.Message = (*fastReflection_AsyncVoteExtension)(nil) + +type fastReflection_AsyncVoteExtension AsyncVoteExtension + +func (x *AsyncVoteExtension) ProtoReflect() protoreflect.Message { + return (*fastReflection_AsyncVoteExtension)(x) +} + +func (x *AsyncVoteExtension) slowProtoReflect() protoreflect.Message { + mi := &file_warden_async_v1beta1_ve_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_AsyncVoteExtension_messageType fastReflection_AsyncVoteExtension_messageType +var _ protoreflect.MessageType = fastReflection_AsyncVoteExtension_messageType{} + +type fastReflection_AsyncVoteExtension_messageType struct{} + +func (x fastReflection_AsyncVoteExtension_messageType) Zero() protoreflect.Message { + return (*fastReflection_AsyncVoteExtension)(nil) +} +func (x fastReflection_AsyncVoteExtension_messageType) New() protoreflect.Message { + return new(fastReflection_AsyncVoteExtension) +} +func (x fastReflection_AsyncVoteExtension_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_AsyncVoteExtension +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_AsyncVoteExtension) Descriptor() protoreflect.MessageDescriptor { + return md_AsyncVoteExtension +} + +// 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_AsyncVoteExtension) Type() protoreflect.MessageType { + return _fastReflection_AsyncVoteExtension_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_AsyncVoteExtension) New() protoreflect.Message { + return new(fastReflection_AsyncVoteExtension) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_AsyncVoteExtension) Interface() protoreflect.ProtoMessage { + return (*AsyncVoteExtension)(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_AsyncVoteExtension) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Results) != 0 { + value := protoreflect.ValueOfList(&_AsyncVoteExtension_1_list{list: &x.Results}) + if !f(fd_AsyncVoteExtension_results, value) { + return + } + } + if len(x.Votes) != 0 { + value := protoreflect.ValueOfList(&_AsyncVoteExtension_2_list{list: &x.Votes}) + if !f(fd_AsyncVoteExtension_votes, 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_AsyncVoteExtension) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncVoteExtension.results": + return len(x.Results) != 0 + case "warden.async.v1beta1.AsyncVoteExtension.votes": + return len(x.Votes) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncVoteExtension")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncVoteExtension 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_AsyncVoteExtension) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncVoteExtension.results": + x.Results = nil + case "warden.async.v1beta1.AsyncVoteExtension.votes": + x.Votes = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncVoteExtension")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncVoteExtension 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_AsyncVoteExtension) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "warden.async.v1beta1.AsyncVoteExtension.results": + if len(x.Results) == 0 { + return protoreflect.ValueOfList(&_AsyncVoteExtension_1_list{}) + } + listValue := &_AsyncVoteExtension_1_list{list: &x.Results} + return protoreflect.ValueOfList(listValue) + case "warden.async.v1beta1.AsyncVoteExtension.votes": + if len(x.Votes) == 0 { + return protoreflect.ValueOfList(&_AsyncVoteExtension_2_list{}) + } + listValue := &_AsyncVoteExtension_2_list{list: &x.Votes} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncVoteExtension")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncVoteExtension 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_AsyncVoteExtension) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncVoteExtension.results": + lv := value.List() + clv := lv.(*_AsyncVoteExtension_1_list) + x.Results = *clv.list + case "warden.async.v1beta1.AsyncVoteExtension.votes": + lv := value.List() + clv := lv.(*_AsyncVoteExtension_2_list) + x.Votes = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncVoteExtension")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncVoteExtension 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_AsyncVoteExtension) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncVoteExtension.results": + if x.Results == nil { + x.Results = []*VEResultItem{} + } + value := &_AsyncVoteExtension_1_list{list: &x.Results} + return protoreflect.ValueOfList(value) + case "warden.async.v1beta1.AsyncVoteExtension.votes": + if x.Votes == nil { + x.Votes = []*VEVoteItem{} + } + value := &_AsyncVoteExtension_2_list{list: &x.Votes} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncVoteExtension")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncVoteExtension 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_AsyncVoteExtension) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.async.v1beta1.AsyncVoteExtension.results": + list := []*VEResultItem{} + return protoreflect.ValueOfList(&_AsyncVoteExtension_1_list{list: &list}) + case "warden.async.v1beta1.AsyncVoteExtension.votes": + list := []*VEVoteItem{} + return protoreflect.ValueOfList(&_AsyncVoteExtension_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.AsyncVoteExtension")) + } + panic(fmt.Errorf("message warden.async.v1beta1.AsyncVoteExtension 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_AsyncVoteExtension) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in warden.async.v1beta1.AsyncVoteExtension", 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_AsyncVoteExtension) 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_AsyncVoteExtension) 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_AsyncVoteExtension) 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_AsyncVoteExtension) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*AsyncVoteExtension) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Results) > 0 { + for _, e := range x.Results { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.Votes) > 0 { + for _, e := range x.Votes { + l = options.Size(e) + 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().(*AsyncVoteExtension) + 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.Votes) > 0 { + for iNdEx := len(x.Votes) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Votes[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.Results) > 0 { + for iNdEx := len(x.Results) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Results[iNdEx]) + 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().(*AsyncVoteExtension) + 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: AsyncVoteExtension: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AsyncVoteExtension: 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 Results", 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 + } + x.Results = append(x.Results, &VEResultItem{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Results[len(x.Results)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Votes", 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 + } + x.Votes = append(x.Votes, &VEVoteItem{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Votes[len(x.Votes)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_VEResultItem protoreflect.MessageDescriptor + fd_VEResultItem_future_id protoreflect.FieldDescriptor + fd_VEResultItem_output protoreflect.FieldDescriptor +) + +func init() { + file_warden_async_v1beta1_ve_proto_init() + md_VEResultItem = File_warden_async_v1beta1_ve_proto.Messages().ByName("VEResultItem") + fd_VEResultItem_future_id = md_VEResultItem.Fields().ByName("future_id") + fd_VEResultItem_output = md_VEResultItem.Fields().ByName("output") +} + +var _ protoreflect.Message = (*fastReflection_VEResultItem)(nil) + +type fastReflection_VEResultItem VEResultItem + +func (x *VEResultItem) ProtoReflect() protoreflect.Message { + return (*fastReflection_VEResultItem)(x) +} + +func (x *VEResultItem) slowProtoReflect() protoreflect.Message { + mi := &file_warden_async_v1beta1_ve_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_VEResultItem_messageType fastReflection_VEResultItem_messageType +var _ protoreflect.MessageType = fastReflection_VEResultItem_messageType{} + +type fastReflection_VEResultItem_messageType struct{} + +func (x fastReflection_VEResultItem_messageType) Zero() protoreflect.Message { + return (*fastReflection_VEResultItem)(nil) +} +func (x fastReflection_VEResultItem_messageType) New() protoreflect.Message { + return new(fastReflection_VEResultItem) +} +func (x fastReflection_VEResultItem_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_VEResultItem +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_VEResultItem) Descriptor() protoreflect.MessageDescriptor { + return md_VEResultItem +} + +// 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_VEResultItem) Type() protoreflect.MessageType { + return _fastReflection_VEResultItem_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_VEResultItem) New() protoreflect.Message { + return new(fastReflection_VEResultItem) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_VEResultItem) Interface() protoreflect.ProtoMessage { + return (*VEResultItem)(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_VEResultItem) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.FutureId != uint64(0) { + value := protoreflect.ValueOfUint64(x.FutureId) + if !f(fd_VEResultItem_future_id, value) { + return + } + } + if len(x.Output) != 0 { + value := protoreflect.ValueOfBytes(x.Output) + if !f(fd_VEResultItem_output, 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_VEResultItem) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "warden.async.v1beta1.VEResultItem.future_id": + return x.FutureId != uint64(0) + case "warden.async.v1beta1.VEResultItem.output": + return len(x.Output) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEResultItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEResultItem 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_VEResultItem) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "warden.async.v1beta1.VEResultItem.future_id": + x.FutureId = uint64(0) + case "warden.async.v1beta1.VEResultItem.output": + x.Output = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEResultItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEResultItem 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_VEResultItem) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "warden.async.v1beta1.VEResultItem.future_id": + value := x.FutureId + return protoreflect.ValueOfUint64(value) + case "warden.async.v1beta1.VEResultItem.output": + value := x.Output + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEResultItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEResultItem 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_VEResultItem) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "warden.async.v1beta1.VEResultItem.future_id": + x.FutureId = value.Uint() + case "warden.async.v1beta1.VEResultItem.output": + x.Output = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEResultItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEResultItem 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_VEResultItem) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.async.v1beta1.VEResultItem.future_id": + panic(fmt.Errorf("field future_id of message warden.async.v1beta1.VEResultItem is not mutable")) + case "warden.async.v1beta1.VEResultItem.output": + panic(fmt.Errorf("field output of message warden.async.v1beta1.VEResultItem is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEResultItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEResultItem 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_VEResultItem) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.async.v1beta1.VEResultItem.future_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "warden.async.v1beta1.VEResultItem.output": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEResultItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEResultItem 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_VEResultItem) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in warden.async.v1beta1.VEResultItem", 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_VEResultItem) 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_VEResultItem) 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_VEResultItem) 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_VEResultItem) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*VEResultItem) + 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.FutureId != 0 { + n += 1 + runtime.Sov(uint64(x.FutureId)) + } + l = len(x.Output) + 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().(*VEResultItem) + 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.Output) > 0 { + i -= len(x.Output) + copy(dAtA[i:], x.Output) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Output))) + i-- + dAtA[i] = 0x12 + } + if x.FutureId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.FutureId)) + 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().(*VEResultItem) + 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: VEResultItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: VEResultItem: 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 FutureId", wireType) + } + x.FutureId = 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.FutureId |= 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 Output", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Output = append(x.Output[:0], dAtA[iNdEx:postIndex]...) + if x.Output == nil { + x.Output = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_VEVoteItem protoreflect.MessageDescriptor + fd_VEVoteItem_future_id protoreflect.FieldDescriptor + fd_VEVoteItem_vote protoreflect.FieldDescriptor +) + +func init() { + file_warden_async_v1beta1_ve_proto_init() + md_VEVoteItem = File_warden_async_v1beta1_ve_proto.Messages().ByName("VEVoteItem") + fd_VEVoteItem_future_id = md_VEVoteItem.Fields().ByName("future_id") + fd_VEVoteItem_vote = md_VEVoteItem.Fields().ByName("vote") +} + +var _ protoreflect.Message = (*fastReflection_VEVoteItem)(nil) + +type fastReflection_VEVoteItem VEVoteItem + +func (x *VEVoteItem) ProtoReflect() protoreflect.Message { + return (*fastReflection_VEVoteItem)(x) +} + +func (x *VEVoteItem) slowProtoReflect() protoreflect.Message { + mi := &file_warden_async_v1beta1_ve_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_VEVoteItem_messageType fastReflection_VEVoteItem_messageType +var _ protoreflect.MessageType = fastReflection_VEVoteItem_messageType{} + +type fastReflection_VEVoteItem_messageType struct{} + +func (x fastReflection_VEVoteItem_messageType) Zero() protoreflect.Message { + return (*fastReflection_VEVoteItem)(nil) +} +func (x fastReflection_VEVoteItem_messageType) New() protoreflect.Message { + return new(fastReflection_VEVoteItem) +} +func (x fastReflection_VEVoteItem_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_VEVoteItem +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_VEVoteItem) Descriptor() protoreflect.MessageDescriptor { + return md_VEVoteItem +} + +// 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_VEVoteItem) Type() protoreflect.MessageType { + return _fastReflection_VEVoteItem_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_VEVoteItem) New() protoreflect.Message { + return new(fastReflection_VEVoteItem) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_VEVoteItem) Interface() protoreflect.ProtoMessage { + return (*VEVoteItem)(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_VEVoteItem) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.FutureId != uint64(0) { + value := protoreflect.ValueOfUint64(x.FutureId) + if !f(fd_VEVoteItem_future_id, value) { + return + } + } + if x.Vote != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Vote)) + if !f(fd_VEVoteItem_vote, 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_VEVoteItem) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "warden.async.v1beta1.VEVoteItem.future_id": + return x.FutureId != uint64(0) + case "warden.async.v1beta1.VEVoteItem.vote": + return x.Vote != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEVoteItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEVoteItem 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_VEVoteItem) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "warden.async.v1beta1.VEVoteItem.future_id": + x.FutureId = uint64(0) + case "warden.async.v1beta1.VEVoteItem.vote": + x.Vote = 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEVoteItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEVoteItem 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_VEVoteItem) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "warden.async.v1beta1.VEVoteItem.future_id": + value := x.FutureId + return protoreflect.ValueOfUint64(value) + case "warden.async.v1beta1.VEVoteItem.vote": + value := x.Vote + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEVoteItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEVoteItem 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_VEVoteItem) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "warden.async.v1beta1.VEVoteItem.future_id": + x.FutureId = value.Uint() + case "warden.async.v1beta1.VEVoteItem.vote": + x.Vote = (FutureVoteType)(value.Enum()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEVoteItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEVoteItem 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_VEVoteItem) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.async.v1beta1.VEVoteItem.future_id": + panic(fmt.Errorf("field future_id of message warden.async.v1beta1.VEVoteItem is not mutable")) + case "warden.async.v1beta1.VEVoteItem.vote": + panic(fmt.Errorf("field vote of message warden.async.v1beta1.VEVoteItem is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEVoteItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEVoteItem 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_VEVoteItem) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.async.v1beta1.VEVoteItem.future_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "warden.async.v1beta1.VEVoteItem.vote": + return protoreflect.ValueOfEnum(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.async.v1beta1.VEVoteItem")) + } + panic(fmt.Errorf("message warden.async.v1beta1.VEVoteItem 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_VEVoteItem) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in warden.async.v1beta1.VEVoteItem", 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_VEVoteItem) 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_VEVoteItem) 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_VEVoteItem) 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_VEVoteItem) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*VEVoteItem) + 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.FutureId != 0 { + n += 1 + runtime.Sov(uint64(x.FutureId)) + } + if x.Vote != 0 { + n += 1 + runtime.Sov(uint64(x.Vote)) + } + 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().(*VEVoteItem) + 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.Vote != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Vote)) + i-- + dAtA[i] = 0x10 + } + if x.FutureId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.FutureId)) + 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().(*VEVoteItem) + 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: VEVoteItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: VEVoteItem: 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 FutureId", wireType) + } + x.FutureId = 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.FutureId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Vote", wireType) + } + x.Vote = 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.Vote |= FutureVoteType(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 +// protoc (unknown) +// source: warden/async/v1beta1/ve.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) +) + +type AsyncInjectedTx struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // All the vote extensions gathered for this block. + // + // FIXME: slinky also does that, so technically we're duplicating information + // and wasting block space. + ExtendedVotesInfo []*abci.ExtendedVoteInfo `protobuf:"bytes,1,rep,name=extended_votes_info,json=extendedVotesInfo,proto3" json:"extended_votes_info,omitempty"` +} + +func (x *AsyncInjectedTx) Reset() { + *x = AsyncInjectedTx{} + if protoimpl.UnsafeEnabled { + mi := &file_warden_async_v1beta1_ve_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AsyncInjectedTx) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AsyncInjectedTx) ProtoMessage() {} + +// Deprecated: Use AsyncInjectedTx.ProtoReflect.Descriptor instead. +func (*AsyncInjectedTx) Descriptor() ([]byte, []int) { + return file_warden_async_v1beta1_ve_proto_rawDescGZIP(), []int{0} +} + +func (x *AsyncInjectedTx) GetExtendedVotesInfo() []*abci.ExtendedVoteInfo { + if x != nil { + return x.ExtendedVotesInfo + } + return nil +} + +// A vote extension coming from a validator. It contains results and votes for +// some futures. +type AsyncVoteExtension struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Results []*VEResultItem `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + Votes []*VEVoteItem `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes,omitempty"` +} + +func (x *AsyncVoteExtension) Reset() { + *x = AsyncVoteExtension{} + if protoimpl.UnsafeEnabled { + mi := &file_warden_async_v1beta1_ve_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AsyncVoteExtension) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AsyncVoteExtension) ProtoMessage() {} + +// Deprecated: Use AsyncVoteExtension.ProtoReflect.Descriptor instead. +func (*AsyncVoteExtension) Descriptor() ([]byte, []int) { + return file_warden_async_v1beta1_ve_proto_rawDescGZIP(), []int{1} +} + +func (x *AsyncVoteExtension) GetResults() []*VEResultItem { + if x != nil { + return x.Results + } + return nil +} + +func (x *AsyncVoteExtension) GetVotes() []*VEVoteItem { + if x != nil { + return x.Votes + } + return nil +} + +type VEResultItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FutureId uint64 `protobuf:"varint,1,opt,name=future_id,json=futureId,proto3" json:"future_id,omitempty"` + Output []byte `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` +} + +func (x *VEResultItem) Reset() { + *x = VEResultItem{} + if protoimpl.UnsafeEnabled { + mi := &file_warden_async_v1beta1_ve_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VEResultItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VEResultItem) ProtoMessage() {} + +// Deprecated: Use VEResultItem.ProtoReflect.Descriptor instead. +func (*VEResultItem) Descriptor() ([]byte, []int) { + return file_warden_async_v1beta1_ve_proto_rawDescGZIP(), []int{2} +} + +func (x *VEResultItem) GetFutureId() uint64 { + if x != nil { + return x.FutureId + } + return 0 +} + +func (x *VEResultItem) GetOutput() []byte { + if x != nil { + return x.Output + } + return nil +} + +type VEVoteItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FutureId uint64 `protobuf:"varint,1,opt,name=future_id,json=futureId,proto3" json:"future_id,omitempty"` + Vote FutureVoteType `protobuf:"varint,2,opt,name=vote,proto3,enum=warden.async.v1beta1.FutureVoteType" json:"vote,omitempty"` +} + +func (x *VEVoteItem) Reset() { + *x = VEVoteItem{} + if protoimpl.UnsafeEnabled { + mi := &file_warden_async_v1beta1_ve_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VEVoteItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VEVoteItem) ProtoMessage() {} + +// Deprecated: Use VEVoteItem.ProtoReflect.Descriptor instead. +func (*VEVoteItem) Descriptor() ([]byte, []int) { + return file_warden_async_v1beta1_ve_proto_rawDescGZIP(), []int{3} +} + +func (x *VEVoteItem) GetFutureId() uint64 { + if x != nil { + return x.FutureId + } + return 0 +} + +func (x *VEVoteItem) GetVote() FutureVoteType { + if x != nil { + return x.Vote + } + return FutureVoteType_VOTE_TYPE_UNSPECIFIED +} + +var File_warden_async_v1beta1_ve_proto protoreflect.FileDescriptor + +var file_warden_async_v1beta1_ve_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2f, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x76, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x14, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2e, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x74, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x61, 0x62, 0x63, 0x69, 0x2f, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, + 0x2f, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x66, + 0x75, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a, 0x0a, 0x0f, 0x41, + 0x73, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x54, 0x78, 0x12, 0x57, + 0x0a, 0x13, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x76, 0x6f, 0x74, 0x65, 0x73, + 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x56, 0x6f, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x11, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x56, 0x6f, + 0x74, 0x65, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x8a, 0x01, 0x0a, 0x12, 0x41, 0x73, 0x79, 0x6e, + 0x63, 0x56, 0x6f, 0x74, 0x65, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3c, + 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2e, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x45, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x49, + 0x74, 0x65, 0x6d, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x36, 0x0a, 0x05, + 0x76, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x77, 0x61, + 0x72, 0x64, 0x65, 0x6e, 0x2e, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x56, 0x45, 0x56, 0x6f, 0x74, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, + 0x6f, 0x74, 0x65, 0x73, 0x22, 0x43, 0x0a, 0x0c, 0x56, 0x45, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x66, 0x75, 0x74, 0x75, 0x72, 0x65, 0x49, + 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x63, 0x0a, 0x0a, 0x56, 0x45, 0x56, + 0x6f, 0x74, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x74, 0x75, 0x72, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x66, 0x75, 0x74, 0x75, + 0x72, 0x65, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2e, 0x61, 0x73, 0x79, 0x6e, + 0x63, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, + 0x56, 0x6f, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x42, 0xe6, + 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2e, 0x61, 0x73, + 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x56, 0x65, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x2f, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2f, 0x61, 0x73, 0x79, + 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x73, 0x79, 0x6e, 0x63, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x57, 0x41, 0x58, 0xaa, 0x02, 0x14, + 0x57, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2e, 0x41, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x56, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x14, 0x57, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x5c, 0x41, 0x73, + 0x79, 0x6e, 0x63, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x20, 0x57, 0x61, + 0x72, 0x64, 0x65, 0x6e, 0x5c, 0x41, 0x73, 0x79, 0x6e, 0x63, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x16, 0x57, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x3a, 0x3a, 0x41, 0x73, 0x79, 0x6e, 0x63, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_warden_async_v1beta1_ve_proto_rawDescOnce sync.Once + file_warden_async_v1beta1_ve_proto_rawDescData = file_warden_async_v1beta1_ve_proto_rawDesc +) + +func file_warden_async_v1beta1_ve_proto_rawDescGZIP() []byte { + file_warden_async_v1beta1_ve_proto_rawDescOnce.Do(func() { + file_warden_async_v1beta1_ve_proto_rawDescData = protoimpl.X.CompressGZIP(file_warden_async_v1beta1_ve_proto_rawDescData) + }) + return file_warden_async_v1beta1_ve_proto_rawDescData +} + +var file_warden_async_v1beta1_ve_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_warden_async_v1beta1_ve_proto_goTypes = []interface{}{ + (*AsyncInjectedTx)(nil), // 0: warden.async.v1beta1.AsyncInjectedTx + (*AsyncVoteExtension)(nil), // 1: warden.async.v1beta1.AsyncVoteExtension + (*VEResultItem)(nil), // 2: warden.async.v1beta1.VEResultItem + (*VEVoteItem)(nil), // 3: warden.async.v1beta1.VEVoteItem + (*abci.ExtendedVoteInfo)(nil), // 4: tendermint.abci.ExtendedVoteInfo + (FutureVoteType)(0), // 5: warden.async.v1beta1.FutureVoteType +} +var file_warden_async_v1beta1_ve_proto_depIdxs = []int32{ + 4, // 0: warden.async.v1beta1.AsyncInjectedTx.extended_votes_info:type_name -> tendermint.abci.ExtendedVoteInfo + 2, // 1: warden.async.v1beta1.AsyncVoteExtension.results:type_name -> warden.async.v1beta1.VEResultItem + 3, // 2: warden.async.v1beta1.AsyncVoteExtension.votes:type_name -> warden.async.v1beta1.VEVoteItem + 5, // 3: warden.async.v1beta1.VEVoteItem.vote:type_name -> warden.async.v1beta1.FutureVoteType + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_warden_async_v1beta1_ve_proto_init() } +func file_warden_async_v1beta1_ve_proto_init() { + if File_warden_async_v1beta1_ve_proto != nil { + return + } + file_warden_async_v1beta1_future_proto_init() + if !protoimpl.UnsafeEnabled { + file_warden_async_v1beta1_ve_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AsyncInjectedTx); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_warden_async_v1beta1_ve_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AsyncVoteExtension); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_warden_async_v1beta1_ve_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VEResultItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_warden_async_v1beta1_ve_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VEVoteItem); 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_warden_async_v1beta1_ve_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_warden_async_v1beta1_ve_proto_goTypes, + DependencyIndexes: file_warden_async_v1beta1_ve_proto_depIdxs, + MessageInfos: file_warden_async_v1beta1_ve_proto_msgTypes, + }.Build() + File_warden_async_v1beta1_ve_proto = out.File + file_warden_async_v1beta1_ve_proto_rawDesc = nil + file_warden_async_v1beta1_ve_proto_goTypes = nil + file_warden_async_v1beta1_ve_proto_depIdxs = nil +} diff --git a/api/warden/vemanager/vemanager.pulsar.go b/api/warden/vemanager/vemanager.pulsar.go new file mode 100644 index 000000000..a8db4c709 --- /dev/null +++ b/api/warden/vemanager/vemanager.pulsar.go @@ -0,0 +1,632 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package vemanager + +import ( + fmt "fmt" + 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 _ protoreflect.List = (*_VoteExtensions_1_list)(nil) + +type _VoteExtensions_1_list struct { + list *[][]byte +} + +func (x *_VoteExtensions_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_VoteExtensions_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfBytes((*x.list)[i]) +} + +func (x *_VoteExtensions_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Bytes() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_VoteExtensions_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Bytes() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_VoteExtensions_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message VoteExtensions at list field Extensions as it is not of Message kind")) +} + +func (x *_VoteExtensions_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_VoteExtensions_1_list) NewElement() protoreflect.Value { + var v []byte + return protoreflect.ValueOfBytes(v) +} + +func (x *_VoteExtensions_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_VoteExtensions protoreflect.MessageDescriptor + fd_VoteExtensions_extensions protoreflect.FieldDescriptor +) + +func init() { + file_warden_vemanager_vemanager_proto_init() + md_VoteExtensions = File_warden_vemanager_vemanager_proto.Messages().ByName("VoteExtensions") + fd_VoteExtensions_extensions = md_VoteExtensions.Fields().ByName("extensions") +} + +var _ protoreflect.Message = (*fastReflection_VoteExtensions)(nil) + +type fastReflection_VoteExtensions VoteExtensions + +func (x *VoteExtensions) ProtoReflect() protoreflect.Message { + return (*fastReflection_VoteExtensions)(x) +} + +func (x *VoteExtensions) slowProtoReflect() protoreflect.Message { + mi := &file_warden_vemanager_vemanager_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_VoteExtensions_messageType fastReflection_VoteExtensions_messageType +var _ protoreflect.MessageType = fastReflection_VoteExtensions_messageType{} + +type fastReflection_VoteExtensions_messageType struct{} + +func (x fastReflection_VoteExtensions_messageType) Zero() protoreflect.Message { + return (*fastReflection_VoteExtensions)(nil) +} +func (x fastReflection_VoteExtensions_messageType) New() protoreflect.Message { + return new(fastReflection_VoteExtensions) +} +func (x fastReflection_VoteExtensions_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_VoteExtensions +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_VoteExtensions) Descriptor() protoreflect.MessageDescriptor { + return md_VoteExtensions +} + +// 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_VoteExtensions) Type() protoreflect.MessageType { + return _fastReflection_VoteExtensions_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_VoteExtensions) New() protoreflect.Message { + return new(fastReflection_VoteExtensions) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_VoteExtensions) Interface() protoreflect.ProtoMessage { + return (*VoteExtensions)(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_VoteExtensions) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Extensions) != 0 { + value := protoreflect.ValueOfList(&_VoteExtensions_1_list{list: &x.Extensions}) + if !f(fd_VoteExtensions_extensions, 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_VoteExtensions) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "warden.vemanager.VoteExtensions.extensions": + return len(x.Extensions) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.vemanager.VoteExtensions")) + } + panic(fmt.Errorf("message warden.vemanager.VoteExtensions 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_VoteExtensions) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "warden.vemanager.VoteExtensions.extensions": + x.Extensions = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.vemanager.VoteExtensions")) + } + panic(fmt.Errorf("message warden.vemanager.VoteExtensions 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_VoteExtensions) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "warden.vemanager.VoteExtensions.extensions": + if len(x.Extensions) == 0 { + return protoreflect.ValueOfList(&_VoteExtensions_1_list{}) + } + listValue := &_VoteExtensions_1_list{list: &x.Extensions} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.vemanager.VoteExtensions")) + } + panic(fmt.Errorf("message warden.vemanager.VoteExtensions 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_VoteExtensions) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "warden.vemanager.VoteExtensions.extensions": + lv := value.List() + clv := lv.(*_VoteExtensions_1_list) + x.Extensions = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.vemanager.VoteExtensions")) + } + panic(fmt.Errorf("message warden.vemanager.VoteExtensions 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_VoteExtensions) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.vemanager.VoteExtensions.extensions": + if x.Extensions == nil { + x.Extensions = [][]byte{} + } + value := &_VoteExtensions_1_list{list: &x.Extensions} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.vemanager.VoteExtensions")) + } + panic(fmt.Errorf("message warden.vemanager.VoteExtensions 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_VoteExtensions) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "warden.vemanager.VoteExtensions.extensions": + list := [][]byte{} + return protoreflect.ValueOfList(&_VoteExtensions_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: warden.vemanager.VoteExtensions")) + } + panic(fmt.Errorf("message warden.vemanager.VoteExtensions 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_VoteExtensions) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in warden.vemanager.VoteExtensions", 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_VoteExtensions) 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_VoteExtensions) 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_VoteExtensions) 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_VoteExtensions) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*VoteExtensions) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Extensions) > 0 { + for _, b := range x.Extensions { + l = len(b) + 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().(*VoteExtensions) + 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.Extensions) > 0 { + for iNdEx := len(x.Extensions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Extensions[iNdEx]) + copy(dAtA[i:], x.Extensions[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Extensions[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*VoteExtensions) + 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: VoteExtensions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: VoteExtensions: 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 Extensions", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Extensions = append(x.Extensions, make([]byte, postIndex-iNdEx)) + copy(x.Extensions[len(x.Extensions)-1], 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: warden/vemanager/vemanager.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) +) + +// ABCI treats a VoteExtensions as a byte array, but we need to distinguish +// between multiple extensions coming from different sources, i.e. we want an +// array of byte arrays, which is what this type represents. +type VoteExtensions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Extensions [][]byte `protobuf:"bytes,1,rep,name=extensions,proto3" json:"extensions,omitempty"` +} + +func (x *VoteExtensions) Reset() { + *x = VoteExtensions{} + if protoimpl.UnsafeEnabled { + mi := &file_warden_vemanager_vemanager_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VoteExtensions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VoteExtensions) ProtoMessage() {} + +// Deprecated: Use VoteExtensions.ProtoReflect.Descriptor instead. +func (*VoteExtensions) Descriptor() ([]byte, []int) { + return file_warden_vemanager_vemanager_proto_rawDescGZIP(), []int{0} +} + +func (x *VoteExtensions) GetExtensions() [][]byte { + if x != nil { + return x.Extensions + } + return nil +} + +var File_warden_vemanager_vemanager_proto protoreflect.FileDescriptor + +var file_warden_vemanager_vemanager_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2f, 0x76, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x2f, 0x76, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x10, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2e, 0x76, 0x65, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x0e, 0x56, 0x6f, 0x74, 0x65, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0xc7, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x77, + 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2e, 0x76, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x42, + 0x0e, 0x56, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x61, + 0x72, 0x64, 0x65, 0x6e, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x61, + 0x72, 0x64, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x77, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x2f, 0x76, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0xa2, 0x02, 0x03, 0x57, 0x56, 0x58, 0xaa, 0x02, 0x10, 0x57, 0x61, 0x72, 0x64, 0x65, 0x6e, + 0x2e, 0x56, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0xca, 0x02, 0x10, 0x57, 0x61, 0x72, + 0x64, 0x65, 0x6e, 0x5c, 0x56, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0xe2, 0x02, 0x1c, + 0x57, 0x61, 0x72, 0x64, 0x65, 0x6e, 0x5c, 0x56, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x57, + 0x61, 0x72, 0x64, 0x65, 0x6e, 0x3a, 0x3a, 0x56, 0x65, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_warden_vemanager_vemanager_proto_rawDescOnce sync.Once + file_warden_vemanager_vemanager_proto_rawDescData = file_warden_vemanager_vemanager_proto_rawDesc +) + +func file_warden_vemanager_vemanager_proto_rawDescGZIP() []byte { + file_warden_vemanager_vemanager_proto_rawDescOnce.Do(func() { + file_warden_vemanager_vemanager_proto_rawDescData = protoimpl.X.CompressGZIP(file_warden_vemanager_vemanager_proto_rawDescData) + }) + return file_warden_vemanager_vemanager_proto_rawDescData +} + +var file_warden_vemanager_vemanager_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_warden_vemanager_vemanager_proto_goTypes = []interface{}{ + (*VoteExtensions)(nil), // 0: warden.vemanager.VoteExtensions +} +var file_warden_vemanager_vemanager_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_warden_vemanager_vemanager_proto_init() } +func file_warden_vemanager_vemanager_proto_init() { + if File_warden_vemanager_vemanager_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_warden_vemanager_vemanager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VoteExtensions); 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_warden_vemanager_vemanager_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_warden_vemanager_vemanager_proto_goTypes, + DependencyIndexes: file_warden_vemanager_vemanager_proto_depIdxs, + MessageInfos: file_warden_vemanager_vemanager_proto_msgTypes, + }.Build() + File_warden_vemanager_vemanager_proto = out.File + file_warden_vemanager_vemanager_proto_rawDesc = nil + file_warden_vemanager_vemanager_proto_goTypes = nil + file_warden_vemanager_vemanager_proto_depIdxs = nil +} diff --git a/go.mod b/go.mod index 94ceb4b77..f2e279994 100644 --- a/go.mod +++ b/go.mod @@ -59,6 +59,7 @@ require ( github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 + github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/iancoleman/strcase v0.3.0 github.com/labstack/echo/v4 v4.12.0 github.com/prometheus/client_golang v1.20.5 @@ -217,7 +218,6 @@ require ( github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect - github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect diff --git a/prophet/dedup.go b/prophet/dedup.go new file mode 100644 index 000000000..be6260886 --- /dev/null +++ b/prophet/dedup.go @@ -0,0 +1,67 @@ +package prophet + +import ( + lru "github.com/hashicorp/golang-lru/v2" +) + +var dedupLRUSize = 10000 + +type getIDer interface { + getID() uint64 +} + +// dedup takes a channel of requests, deduplicates them, and emits +// returns a new channel of unique requests. +// +// It does so by keeping a LRU cache of unique IDs. +// Requests coming after [dedupLRUSize] requests will be emitted +// again, even if duplicated. +type dedup[T getIDer] struct { + in <-chan T + out chan T + c *lru.Cache[uint64, struct{}] +} + +func newDedup[T getIDer](ch <-chan T) (*dedup[T], error) { + c, err := lru.New[uint64, struct{}](dedupLRUSize) + if err != nil { + return nil, err + } + + out := make(chan T) + + go func() { + defer close(out) + for req := range ch { + if c.Contains(req.getID()) { + continue + } + c.Add(req.getID(), struct{}{}) + out <- req + } + }() + + return &dedup[T]{ + in: ch, + c: c, + out: out, + }, nil +} + +// dedupFutureReader wraps a [FutureReader] and deduplicates the incoming +// futures. +type dedupFutureReader struct { + d *dedup[Future] +} + +func newDedupFutureReader(r FutureReader) (*dedupFutureReader, error) { + d, err := newDedup(r.Read()) + if err != nil { + return nil, err + } + return &dedupFutureReader{d: d}, nil +} + +func (d dedupFutureReader) Read() <-chan Future { + return d.d.out +} diff --git a/prophet/doc.go b/prophet/doc.go new file mode 100644 index 000000000..3c8c001e3 --- /dev/null +++ b/prophet/doc.go @@ -0,0 +1,19 @@ +// Package prophet implements an asynchronous task-runner for the Warden +// Protocol. +// +// The tasks are called "Futures". +// +// A [Future] consist of a []byte input, and a handler identified by a string. +// +// The handler implements the [FutureHandler] interface and is responsible for +// executing a future, or verifying the correctness of a future output (e.g. by +// re-executing it, or by implementing more sophisticated verification). +// +// The handlers are registered in a global registry, and are looked up by their +// unique string identifier. +// See [Register] for registering a new handler. +// +// The entry point for the prophet package is the [P] struct, which implements +// the asynchronous process. See the methods of [P] for more information on +// starting it, and scheduling new futures. +package prophet diff --git a/prophet/exec.go b/prophet/exec.go new file mode 100644 index 000000000..1952d7932 --- /dev/null +++ b/prophet/exec.go @@ -0,0 +1,70 @@ +package prophet + +import ( + "context" + "log/slog" +) + +// FutureResultWriter writes results of future executions. +type FutureResultWriter interface { + Write(result FutureResult) error +} + +// ExecFutures executes futures coming from the specified reader and writes +// them to the specified writer. +// +// This call is non-blocking, the main loop is executed in a goroutine. +func ExecFutures(r FutureReader, w FutureResultWriter) error { + log := slog.With("process", "exec_futures") + + go func() { + for future := range r.Read() { + log := log.With("future", future.ID) + + log.Debug("running future") + output, err := Execute(context.TODO(), future) + if err != nil { + log.Error("failed to run future", "err", err) + continue + } + err = w.Write(output) + if err != nil { + log.Error("failed to write future result", "err", err) + continue + } + } + }() + + return nil +} + +// VoteWriter writes votes of future verifications. +type VoteWriter interface { + Write(result Vote) error +} + +// ExecVotes executes future verifications coming from the specified reader and +// writes them to the specified writer. +// +// This call is non-blocking, the main loop is executed in a goroutine. +func ExecVotes(r FutureResultReader, w VoteWriter) error { + log := slog.With("process", "exec_votes") + + go func() { + for proposal := range r.Read() { + plog := log.With("future", proposal.ID) + + plog.Debug("verifying future proposal") + err := Verify(context.TODO(), proposal) + if err := w.Write(Vote{ + ID: proposal.ID, + Err: err, + }); err != nil { + plog.Error("failed to write vote", "err", err) + continue + } + } + }() + + return nil +} diff --git a/prophet/future.go b/prophet/future.go new file mode 100644 index 000000000..59b87c8a5 --- /dev/null +++ b/prophet/future.go @@ -0,0 +1,46 @@ +package prophet + +// Future is a unit of computation. +type Future struct { + // ID is a globally unique identifier for this Future. + ID uint64 + // Handler identifies what handler will execute the computation. + Handler string + // Input is the input data for the handler. + Input []byte +} + +// getID implements [getIDer]. +func (r Future) getID() uint64 { return r.ID } + +// FutureReader is a source of futures. +type FutureReader interface { + Read() <-chan Future +} + +// FutureResult is the result of the computation of a future. +type FutureResult struct { + Future + Output []byte +} + +// getID implements [getIDer]. +func (r FutureResult) getID() uint64 { return r.ID } + +// FutureResultReader is a source of future results. +type FutureResultReader interface { + Read() <-chan FutureResult +} + +// Vote is a vote on a future result, indicating if it could be verified or +// not. +type Vote struct { + // ID is the ID of the future. + ID uint64 + // Err is the error that occurred during the verification. If it is nil, + // the future result was verified. + Err error +} + +// getID implements [getIDer]. +func (v Vote) getID() uint64 { return v.ID } diff --git a/prophet/handlers.go b/prophet/handlers.go new file mode 100644 index 000000000..1832b209b --- /dev/null +++ b/prophet/handlers.go @@ -0,0 +1,64 @@ +package prophet + +import ( + "context" + "fmt" + "log/slog" + "time" +) + +// FutureHandler is the interface implemented by the future handlers. A handler +// is able to execute and verify futures. +type FutureHandler interface { + // Execute the computation with the given input, returning the output. + Execute(ctx context.Context, input []byte) ([]byte, error) + + // Verify the output of the computation with the given input, returning an + // error if the output is invalid. + Verify(ctx context.Context, input []byte, output []byte) error +} + +// Execute executes a given future, by invoking the registered handler. +func Execute(ctx context.Context, f Future) (FutureResult, error) { + s := getHandler(f.Handler) + if s == nil { + return FutureResult{}, fmt.Errorf("no future handler registered for %s", f.Handler) + } + + log := slog.With("task", "Execute", "future", f.ID, "handler", f.Handler) + log.Debug("start") + start := time.Now() + + output, err := s.Execute(ctx, f.Input) + if err != nil { + return FutureResult{}, fmt.Errorf("executing future: %w", err) + } + + log.Debug("end", "took", time.Since(start)) + + return FutureResult{ + Future: f, + Output: output, + }, nil +} + +// Verify verifies a given future result, by invoking the registered handler. +func Verify(ctx context.Context, f FutureResult) error { + s := getHandler(f.Handler) + if s == nil { + return fmt.Errorf("no future handler registered for %s", f.Handler) + } + + log := slog.With("task", "Verify", "future", f.ID, "handler", f.Handler) + log.Debug("start") + start := time.Now() + + err := s.Verify(ctx, f.Input, f.Output) + if err != nil { + return err + } + + log.Debug("end", "took", time.Since(start)) + + return nil +} diff --git a/prophet/handlers/echo/echo.go b/prophet/handlers/echo/echo.go new file mode 100644 index 000000000..129c681f0 --- /dev/null +++ b/prophet/handlers/echo/echo.go @@ -0,0 +1,26 @@ +// Package echo provides a mock implementation of the FutureHandler interface +// for testing purposes. It simply echoes back any input it receives. +package echo + +import ( + "bytes" + "context" + "fmt" + + "github.com/warden-protocol/wardenprotocol/prophet" +) + +type Handler struct{} + +var _ prophet.FutureHandler = (*Handler)(nil) + +func (s Handler) Execute(ctx context.Context, input []byte) ([]byte, error) { + return input, nil +} + +func (s Handler) Verify(ctx context.Context, input []byte, output []byte) error { + if bytes.Compare(input, output) != 0 { + return fmt.Errorf("input and output do not match") + } + return nil +} diff --git a/prophet/prophet.go b/prophet/prophet.go new file mode 100644 index 000000000..973cd106c --- /dev/null +++ b/prophet/prophet.go @@ -0,0 +1,147 @@ +package prophet + +import ( + "fmt" + "log/slog" + + lru "github.com/hashicorp/golang-lru/v2" +) + +// queueBufferSize sets the default size for incoming queues, i.e. the number +// of futures waiting to be executed and the number of future results waiting +// to be verified. +// Trying to add more items to the queue than this size will drop the new +// items. +var queueBufferSize = 100 + +// P is the main prophet process. Use [New] to create a new P. +type P struct { + futures *q[Future] + proposals *q[FutureResult] + + resultsWriter *s[FutureResult] + votesWriter *s[Vote] +} + +// New returns an initialized P. Call [P.Run] to start the main loop. +func New() (*P, error) { + resultsWriter, err := newS[FutureResult]() + if err != nil { + return nil, err + } + + votesWriter, err := newS[Vote]() + if err != nil { + return nil, err + } + + return &P{ + futures: newQ[Future](queueBufferSize), + proposals: newQ[FutureResult](queueBufferSize), + resultsWriter: resultsWriter, + votesWriter: votesWriter, + }, nil +} + +// Run starts the main loop of the prophet process. +// +// Goroutines are started to execute incoming futures and verifying incoming +// future results. +func (p *P) Run() error { + futures, err := newDedupFutureReader(p.futures) + if err != nil { + return fmt.Errorf("failed to create futures dedup reader: %w", err) + } + + if err := ExecFutures(futures, p.resultsWriter); err != nil { + return fmt.Errorf("failed to run futures loop: %w", err) + } + + if err := ExecVotes(p.proposals, p.votesWriter); err != nil { + return fmt.Errorf("failed to run votes loop: %w", err) + } + + return nil +} + +// AddFuture adds a future to be executed. This call is non-blocking. The +// future will be executed in the background, the results can be retrieved by +// calling [P.Results]. +func (p *P) AddFuture(future Future) { + p.futures.Add(future) +} + +// AddFutureResult adds a future result to be voted on. This call is +// non-blocking. +func (p *P) AddFutureResult(proposal FutureResult) { + p.proposals.Add(proposal) +} + +// Results returns a slice with all the results of futures that have been +// executed. +// The returned function must be called to remove the results from the set. +func (p *P) Results() ([]FutureResult, func()) { + values := p.resultsWriter.Values() + if len(values) == 0 { + return nil, func() {} + } + + return values, func() { + p.resultsWriter.Remove(values...) + } +} + +// q is a queue that doesn't block the producer (i.e. q.Add is non-blocking). +type q[T any] struct { + ch chan T +} + +func newQ[T any](buffer int) *q[T] { + return &q[T]{ + ch: make(chan T, buffer), + } +} + +func (q *q[T]) Add(item T) { + select { + case q.ch <- item: + default: + slog.Warn("q.Add: queue is full, dropped item", "item", item) + } +} + +func (q *q[T]) Read() <-chan T { + return q.ch +} + +var defaultSetSize = 10000 + +// s is a set with a size bound, and thread-safe. +// Adding elements to the set may delete older elements, if the set is full. +type s[T getIDer] struct { + l *lru.Cache[uint64, T] +} + +func newS[T getIDer]() (*s[T], error) { + l, err := lru.New[uint64, T](defaultSetSize) + if err != nil { + return nil, err + } + return &s[T]{l: l}, nil +} + +func (s *s[T]) Write(value T) error { + id := value.getID() + s.l.Add(id, value) + return nil +} + +func (s *s[T]) Values() []T { + return s.l.Values() +} + +func (s *s[T]) Remove(values ...T) { + for _, v := range values { + s.l.Remove(v.getID()) + } +} diff --git a/prophet/registry.go b/prophet/registry.go new file mode 100644 index 000000000..dad361053 --- /dev/null +++ b/prophet/registry.go @@ -0,0 +1,29 @@ +package prophet + +import "sync" + +// registry is a global registry of futures handlers. +var registry = r{ + futures: make(map[string]FutureHandler), +} + +type r struct { + rw sync.RWMutex + futures map[string]FutureHandler +} + +// Register registers a new future handler with the given unique name. +func Register(name string, future FutureHandler) { + registry.rw.Lock() + defer registry.rw.Unlock() + if _, found := registry.futures[name]; found { + panic("future already registered") + } + registry.futures[name] = future +} + +func getHandler(name string) FutureHandler { + registry.rw.RLock() + defer registry.rw.RUnlock() + return registry.futures[name] +} diff --git a/proto/warden/async/v1beta1/ve.proto b/proto/warden/async/v1beta1/ve.proto new file mode 100644 index 000000000..7cd03052c --- /dev/null +++ b/proto/warden/async/v1beta1/ve.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package warden.async.v1beta1; + +import "gogoproto/gogo.proto"; +import "tendermint/abci/types.proto"; +import "warden/async/v1beta1/future.proto"; + +option go_package = "github.com/warden-protocol/wardenprotocol/warden/x/async/types/v1beta1"; + +message AsyncInjectedTx { + // All the vote extensions gathered for this block. + // + // FIXME: slinky also does that, so technically we're duplicating information + // and wasting block space. + repeated tendermint.abci.ExtendedVoteInfo extended_votes_info = 1 [(gogoproto.nullable) = false]; +} + +// A vote extension coming from a validator. It contains results and votes for +// some futures. +message AsyncVoteExtension { + repeated VEResultItem results = 1; + repeated VEVoteItem votes = 2; +} + +message VEResultItem { + uint64 future_id = 1; + bytes output = 2; +} + +message VEVoteItem { + uint64 future_id = 1; + FutureVoteType vote = 2; +} + diff --git a/proto/warden/vemanager/vemanager.proto b/proto/warden/vemanager/vemanager.proto new file mode 100644 index 000000000..24e943232 --- /dev/null +++ b/proto/warden/vemanager/vemanager.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package warden.vemanager; + +option go_package = "github.com/warden-protocol/wardenprotocol/warden/app/vemanager"; + +// ABCI treats a VoteExtensions as a byte array, but we need to distinguish +// between multiple extensions coming from different sources, i.e. we want an +// array of byte arrays, which is what this type represents. +message VoteExtensions { + repeated bytes extensions = 1; +} diff --git a/warden/app/app.go b/warden/app/app.go index 6d028b90f..e72b314cd 100644 --- a/warden/app/app.go +++ b/warden/app/app.go @@ -86,6 +86,9 @@ import ( evmosencodingcodec "github.com/evmos/evmos/v20/encoding/codec" marketmapkeeper "github.com/skip-mev/slinky/x/marketmap/keeper" oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper" + + "github.com/warden-protocol/wardenprotocol/prophet" + "github.com/warden-protocol/wardenprotocol/prophet/handlers/echo" ) const ( @@ -113,6 +116,8 @@ type App struct { txConfig client.TxConfig interfaceRegistry codectypes.InterfaceRegistry + prophet *prophet.P + // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper @@ -240,6 +245,12 @@ func New( wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp), ) (*App, error) { + prophet.Register("echo", echo.Handler{}) + prophetP, err := prophet.New() + if err != nil { + panic(fmt.Errorf("failed to create prophet: %w", err)) + } + var ( app = &App{} appBuilder *runtime.AppBuilder @@ -262,6 +273,10 @@ func New( app.GetFeemarketKeeper, // Supply the logger logger, + + // Supply the prophet + prophetP, + func() ast.Expander { // I don't know if a lazy function is the best way to do this. // x/act wants to access this ExpanderManager, but the @@ -323,6 +338,7 @@ func New( &app.legacyAmino, &app.txConfig, &app.interfaceRegistry, + &app.prophet, &app.AccountKeeper, &app.BankKeeper, &app.StakingKeeper, @@ -388,6 +404,10 @@ func New( // oracle initialization app.initializeOracles(appOpts) + if err := app.prophet.Run(); err != nil { + panic(fmt.Errorf("failed to run prophet: %w", err)) + } + // register legacy modules wasmConfig := app.registerLegacyModules(appOpts, wasmOpts) diff --git a/warden/app/oracle.go b/warden/app/oracle.go index 8ac734c0e..31f3b6b62 100644 --- a/warden/app/oracle.go +++ b/warden/app/oracle.go @@ -2,31 +2,34 @@ package app import ( "context" + "fmt" "math/big" "time" "cosmossdk.io/log" - storetypes "cosmossdk.io/store/types" - upgradetypes "cosmossdk.io/x/upgrade/types" + cometabci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/mempool" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - slinkytypes "github.com/skip-mev/slinky/pkg/types" - oraclepreblock "github.com/skip-mev/slinky/abci/preblock/oracle" "github.com/skip-mev/slinky/abci/proposals" "github.com/skip-mev/slinky/abci/strategies/aggregator" + "github.com/skip-mev/slinky/abci/strategies/codec" compression "github.com/skip-mev/slinky/abci/strategies/codec" "github.com/skip-mev/slinky/abci/strategies/currencypair" "github.com/skip-mev/slinky/abci/ve" + vetypes "github.com/skip-mev/slinky/abci/ve/types" slinkyaggregator "github.com/skip-mev/slinky/aggregator" oracleconfig "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/pkg/math/voteweighted" + slinkytypes "github.com/skip-mev/slinky/pkg/types" oracleclient "github.com/skip-mev/slinky/service/clients/oracle" servicemetrics "github.com/skip-mev/slinky/service/metrics" oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper" + + "github.com/warden-protocol/wardenprotocol/warden/app/vemanager" ) func (app *App) initializeOracles(appOpts types.AppOptions) { @@ -120,10 +123,12 @@ func NewSlinkyClient( cfg: cfg, metrics: metrics, client: client, - veCodec: compression.NewCompressionVoteExtensionCodec( - compression.NewDefaultVoteExtensionCodec(), - compression.NewZLibCompressor(), - ), + veCodec: &WardenSlinkyCodec{ + slinkyCodec: compression.NewCompressionVoteExtensionCodec( + compression.NewDefaultVoteExtensionCodec(), + compression.NewZLibCompressor(), + ), + }, extCommitCodec: compression.NewCompressionExtendedCommitCodec( compression.NewDefaultExtendedCommitCodec(), compression.NewZStdCompressor(), @@ -143,10 +148,7 @@ func (sc *SlinkyClient) ProposalHandler( processProposalHandler, ve.NewDefaultValidateVoteExtensionsFn(sc.stakingKeeper), sc.veCodec, - compression.NewCompressionExtendedCommitCodec( - compression.NewDefaultExtendedCommitCodec(), - compression.NewZStdCompressor(), - ), + sc.extCommitCodec, currencypair.NewDeltaCurrencyPairStrategy(sc.oracleKeeper), sc.metrics, ) @@ -210,15 +212,90 @@ func (app *App) setupABCILifecycle( slinkyPreBlockHandler := app.slinkyClient.PreblockHandler() slinkyVEHandler := app.slinkyClient.VoteExtensionHandler() - app.SetPrepareProposal(slinkyProposalHandler.PrepareProposalHandler()) - app.SetProcessProposal(slinkyProposalHandler.ProcessProposalHandler()) - app.SetPreBlocker(slinkyPreBlockHandler.WrappedPreBlocker(app.ModuleManager)) - app.SetExtendVoteHandler(slinkyVEHandler.ExtendVoteHandler()) - app.SetVerifyVoteExtensionHandler(slinkyVEHandler.VerifyVoteExtensionHandler()) + app.SetProcessProposal(combineProcessProposal( + slinkyProposalHandler.ProcessProposalHandler(), + app.AsyncKeeper.ProcessProposalHandler(), + )) + + app.SetPreBlocker(combinePreBlocker( + slinkyPreBlockHandler.WrappedPreBlocker(app.ModuleManager), + app.AsyncKeeper.PreBlocker(), + )) + + veManager := vemanager.NewVoteExtensionManager() + + // register slinky handlers + veManager.Register( + slinkyVEHandler.ExtendVoteHandler(), + slinkyVEHandler.VerifyVoteExtensionHandler(), + slinkyProposalHandler.PrepareProposalHandler(), + ) + + // register x/async handlers + veManager.Register( + app.AsyncKeeper.ExtendVoteHandler(), + app.AsyncKeeper.VerifyVoteExtensionHandler(), + app.AsyncKeeper.PrepareProposalHandler(), + ) + + app.SetPrepareProposal(veManager.PrepareProposalHandler()) + app.SetExtendVoteHandler(veManager.ExtendVoteHandler()) + app.SetVerifyVoteExtensionHandler(veManager.VerifyVoteExtensionHandler()) +} + +func combineProcessProposal(a, b sdk.ProcessProposalHandler) sdk.ProcessProposalHandler { + return func(ctx sdk.Context, req *cometabci.RequestProcessProposal) (*cometabci.ResponseProcessProposal, error) { + resp, err := a(ctx, req) + if err != nil || resp.Status == cometabci.ResponseProcessProposal_REJECT { + return resp, err + } + + return b(ctx, req) + } +} + +func combinePreBlocker(a, b sdk.PreBlocker) sdk.PreBlocker { + return func(ctx sdk.Context, req *cometabci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + respA, err := a(ctx, req) + if err != nil { + return respA, err + } + + respB, err := b(ctx, req) + if err != nil { + return respB, err + } + + return &sdk.ResponsePreBlock{ + ConsensusParamsChanged: respA.ConsensusParamsChanged || respB.ConsensusParamsChanged, + }, nil + } +} + +// WardenSlinkyCodec wraps slinky's codec.VoteExtensionCodec to support our +// custom vote extension format (vemanager.VE). +type WardenSlinkyCodec struct { + slinkyCodec codec.VoteExtensionCodec +} + +var _ compression.VoteExtensionCodec = (*WardenSlinkyCodec)(nil) + +// Decode a vote extension []byte into a vemanager.VE, then decode the first +// vote extension item using the wrapped slinky codec. +func (a *WardenSlinkyCodec) Decode(b []byte) (vetypes.OracleVoteExtension, error) { + var w vemanager.VoteExtensions + + if err := w.Unmarshal(b); err != nil { + return vetypes.OracleVoteExtension{}, err + } + + if len(w.Extensions) == 0 { + return vetypes.OracleVoteExtension{}, fmt.Errorf("no vote extension") + } + + return a.slinkyCodec.Decode(w.Extensions[0]) } -type AppUpgrade struct { - Name string - Handler upgradetypes.UpgradeHandler - StoreUpgrade storetypes.StoreUpgrades +func (a *WardenSlinkyCodec) Encode(ve vetypes.OracleVoteExtension) ([]byte, error) { + return a.slinkyCodec.Encode(ve) } diff --git a/warden/app/vemanager/vemanager.go b/warden/app/vemanager/vemanager.go new file mode 100644 index 000000000..f85cfee6f --- /dev/null +++ b/warden/app/vemanager/vemanager.go @@ -0,0 +1,137 @@ +// Package vemanager implements a vote extension manager, which is a way of +// aggregating multiple vote extensions into a single one. +// +// In Warden, we use this to aggregate slinky and x/async vote extensions. +package vemanager + +import ( + fmt "fmt" + + cometabci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// VoteExtensionManager wraps multiple ABCI handlers (ExtendVoteHandler, +// VerifyVoteExtensionHandler, PrepareProposalHandler) and exposes a single +// ABCI handler that aggregates all of them. +type VoteExtensionManager struct { + extendVoteHandler []sdk.ExtendVoteHandler + verifyVoteExtensionHandler []sdk.VerifyVoteExtensionHandler + prepareProposalHandler []sdk.PrepareProposalHandler +} + +// NewVoteExtensionManager creates a new empty VoteExtensionManager. +func NewVoteExtensionManager() *VoteExtensionManager { + return &VoteExtensionManager{} +} + +// Register new ABCI handlers to the manager. +// +// CONTRACT: changing the order of registration it's a consensus breaking +// change. +func (m *VoteExtensionManager) Register( + extendVoteHandler sdk.ExtendVoteHandler, + verifyVoteExtensionHandler sdk.VerifyVoteExtensionHandler, + prepareProposalHandler sdk.PrepareProposalHandler, +) { + m.extendVoteHandler = append(m.extendVoteHandler, extendVoteHandler) + m.verifyVoteExtensionHandler = append(m.verifyVoteExtensionHandler, verifyVoteExtensionHandler) + m.prepareProposalHandler = append(m.prepareProposalHandler, prepareProposalHandler) +} + +// ExtendVoteHandler returns the ExtendVoteHandler that aggregates all the +// registered ExtendVoteHandlers. +func (m *VoteExtensionManager) ExtendVoteHandler() sdk.ExtendVoteHandler { + return func(ctx sdk.Context, req *cometabci.RequestExtendVote) (*cometabci.ResponseExtendVote, error) { + w := VoteExtensions{ + Extensions: make([][]byte, len(m.extendVoteHandler)), + } + + for i, handler := range m.extendVoteHandler { + resp, err := handler(ctx, req) + if err != nil { + return nil, err + } + w.Extensions[i] = resp.VoteExtension + } + + bz, err := w.Marshal() + if err != nil { + return nil, err + } + return &cometabci.ResponseExtendVote{ + VoteExtension: bz, + }, nil + } +} + +// VerifyVoteExtensionHandler returns the VerifyVoteExtensionHandler that +// aggregates all the registered VerifyVoteExtensionHandlers. +func (m *VoteExtensionManager) VerifyVoteExtensionHandler() sdk.VerifyVoteExtensionHandler { + return func(ctx sdk.Context, req *cometabci.RequestVerifyVoteExtension) (*cometabci.ResponseVerifyVoteExtension, error) { + var w VoteExtensions + if err := w.Unmarshal(req.VoteExtension); err != nil { + return nil, err + } + + if len(w.Extensions) > len(m.verifyVoteExtensionHandler) { + return nil, fmt.Errorf("too many vote extensions, not enough VerifyVoteExtensionHandlers registered to the VoteExtensionManager") + } + + var resps []*cometabci.ResponseVerifyVoteExtension + for i, ext := range w.Extensions { + handler := m.verifyVoteExtensionHandler[i] + reqWithExt := &cometabci.RequestVerifyVoteExtension{ + Hash: req.Hash, + ValidatorAddress: req.ValidatorAddress, + Height: req.Height, + VoteExtension: ext, + } + resp, err := handler(ctx, reqWithExt) + if err != nil { + return nil, err + } + + resps = append(resps, resp) + } + + return combineResponseVerifyVoteExtension(resps), nil + } +} + +// PrepareProposalHandler returns the PrepareProposalHandler that aggregates +// all the registered PrepareProposalHandlers. +func (m *VoteExtensionManager) PrepareProposalHandler() sdk.PrepareProposalHandler { + return func(ctx sdk.Context, req *cometabci.RequestPrepareProposal) (*cometabci.ResponsePrepareProposal, error) { + var resp *cometabci.ResponsePrepareProposal + for _, handler := range m.prepareProposalHandler { + if resp != nil { + // handlers are a pipeline, so the txs returned by the previous + // handler are the txs that will be included in the request for + // the next + req.Txs = resp.Txs + } + + scopedResp, err := handler(ctx, req) + if err != nil { + return nil, err + } + resp = scopedResp + } + + return resp, nil + } +} + +func combineResponseVerifyVoteExtension(resps []*cometabci.ResponseVerifyVoteExtension) *cometabci.ResponseVerifyVoteExtension { + combined := &cometabci.ResponseVerifyVoteExtension{ + Status: cometabci.ResponseVerifyVoteExtension_ACCEPT, + } + for _, resp := range resps { + if resp.Status == cometabci.ResponseVerifyVoteExtension_REJECT { + combined.Status = cometabci.ResponseVerifyVoteExtension_REJECT + break + } + } + return combined +} diff --git a/warden/app/vemanager/vemanager.pb.go b/warden/app/vemanager/vemanager.pb.go new file mode 100644 index 000000000..c1e494f53 --- /dev/null +++ b/warden/app/vemanager/vemanager.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: warden/vemanager/vemanager.proto + +package vemanager + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// ABCI treats a VoteExtensions as a byte array, but we need to distinguish +// between multiple extensions coming from different sources, i.e. we want an +// array of byte arrays, which is what this type represents. +type VoteExtensions struct { + Extensions [][]byte `protobuf:"bytes,1,rep,name=extensions,proto3" json:"extensions,omitempty"` +} + +func (m *VoteExtensions) Reset() { *m = VoteExtensions{} } +func (m *VoteExtensions) String() string { return proto.CompactTextString(m) } +func (*VoteExtensions) ProtoMessage() {} +func (*VoteExtensions) Descriptor() ([]byte, []int) { + return fileDescriptor_d55545178de18eb8, []int{0} +} +func (m *VoteExtensions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VoteExtensions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VoteExtensions.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 *VoteExtensions) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoteExtensions.Merge(m, src) +} +func (m *VoteExtensions) XXX_Size() int { + return m.Size() +} +func (m *VoteExtensions) XXX_DiscardUnknown() { + xxx_messageInfo_VoteExtensions.DiscardUnknown(m) +} + +var xxx_messageInfo_VoteExtensions proto.InternalMessageInfo + +func (m *VoteExtensions) GetExtensions() [][]byte { + if m != nil { + return m.Extensions + } + return nil +} + +func init() { + proto.RegisterType((*VoteExtensions)(nil), "warden.vemanager.VoteExtensions") +} + +func init() { proto.RegisterFile("warden/vemanager/vemanager.proto", fileDescriptor_d55545178de18eb8) } + +var fileDescriptor_d55545178de18eb8 = []byte{ + // 154 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0x4f, 0x2c, 0x4a, + 0x49, 0xcd, 0xd3, 0x2f, 0x4b, 0xcd, 0x4d, 0xcc, 0x4b, 0x4c, 0x4f, 0x2d, 0x42, 0xb0, 0xf4, 0x0a, + 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x20, 0x2a, 0xf4, 0xe0, 0xe2, 0x4a, 0x06, 0x5c, 0x7c, 0x61, + 0xf9, 0x25, 0xa9, 0xae, 0x15, 0x25, 0xa9, 0x79, 0xc5, 0x99, 0xf9, 0x79, 0xc5, 0x42, 0x72, 0x5c, + 0x5c, 0xa9, 0x70, 0x9e, 0x04, 0xa3, 0x02, 0xb3, 0x06, 0x4f, 0x10, 0x92, 0x88, 0x53, 0xc4, 0x89, + 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, + 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xd9, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, + 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x2c, 0xd2, 0x05, 0x5b, 0x9b, 0x9c, 0x9f, 0x03, 0xe5, 0xa3, + 0x71, 0xf5, 0x13, 0x0b, 0x0a, 0x10, 0x6e, 0x4c, 0x62, 0x03, 0x4b, 0x1b, 0x03, 0x02, 0x00, 0x00, + 0xff, 0xff, 0x72, 0x05, 0xf0, 0x0b, 0xc8, 0x00, 0x00, 0x00, +} + +func (m *VoteExtensions) 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 *VoteExtensions) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VoteExtensions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Extensions) > 0 { + for iNdEx := len(m.Extensions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Extensions[iNdEx]) + copy(dAtA[i:], m.Extensions[iNdEx]) + i = encodeVarintVemanager(dAtA, i, uint64(len(m.Extensions[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintVemanager(dAtA []byte, offset int, v uint64) int { + offset -= sovVemanager(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *VoteExtensions) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Extensions) > 0 { + for _, b := range m.Extensions { + l = len(b) + n += 1 + l + sovVemanager(uint64(l)) + } + } + return n +} + +func sovVemanager(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozVemanager(x uint64) (n int) { + return sovVemanager(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *VoteExtensions) 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 ErrIntOverflowVemanager + } + 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: VoteExtensions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VoteExtensions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Extensions", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVemanager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthVemanager + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthVemanager + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Extensions = append(m.Extensions, make([]byte, postIndex-iNdEx)) + copy(m.Extensions[len(m.Extensions)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVemanager(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthVemanager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipVemanager(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, ErrIntOverflowVemanager + } + 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, ErrIntOverflowVemanager + } + 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, ErrIntOverflowVemanager + } + 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, ErrInvalidLengthVemanager + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupVemanager + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthVemanager + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthVemanager = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowVemanager = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupVemanager = fmt.Errorf("proto: unexpected end of group") +) diff --git a/warden/testutil/keeper/async.go b/warden/testutil/keeper/async.go index c36a8a708..0490e0374 100644 --- a/warden/testutil/keeper/async.go +++ b/warden/testutil/keeper/async.go @@ -38,6 +38,7 @@ func AsyncKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { runtime.NewKVStoreService(storeKey), log.NewNopLogger(), authority.String(), + nil, ) ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) diff --git a/warden/x/async/keeper/abci.go b/warden/x/async/keeper/abci.go index 09715b7f7..84a409cfb 100644 --- a/warden/x/async/keeper/abci.go +++ b/warden/x/async/keeper/abci.go @@ -1,11 +1,249 @@ package keeper -import "context" +import ( + "context" + "fmt" + + cometabci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/skip-mev/slinky/abci/ve" + "github.com/warden-protocol/wardenprotocol/prophet" + "github.com/warden-protocol/wardenprotocol/warden/app/vemanager" + types "github.com/warden-protocol/wardenprotocol/warden/x/async/types/v1beta1" +) func (k Keeper) BeginBlocker(ctx context.Context) error { return nil } +// EndBlocker schedules some pending futures to the Prophet's process. +// +// Note: if a future remains pending for more blocks, it could be re-added to +// Prophet even if it's already in the Prophet's queue or it's being processed. +// This is not a problem as Prophet filters out incoming duplicate futures. func (k Keeper) EndBlocker(ctx context.Context) error { + futures, err := k.futures.PendingFutures(ctx, 10) + if err != nil { + return err + } + + for _, f := range futures { + k.p.AddFuture(prophet.Future{ + ID: f.Id, + Handler: f.Handler, + Input: f.Input, + }) + } + return nil } + +func (k Keeper) ExtendVoteHandler() sdk.ExtendVoteHandler { + return func(ctx sdk.Context, req *cometabci.RequestExtendVote) (*cometabci.ResponseExtendVote, error) { + pResults, done := k.p.Results() + defer done() + + results := make([]*types.VEResultItem, len(pResults)) + for i, r := range pResults { + results[i] = &types.VEResultItem{ + FutureId: r.ID, + Output: r.Output, + } + } + + asyncve := types.AsyncVoteExtension{ + Results: results, + } + + asyncveBytes, err := asyncve.Marshal() + if err != nil { + return nil, err + } + + return &cometabci.ResponseExtendVote{ + VoteExtension: asyncveBytes, + }, nil + } +} + +func (k Keeper) VerifyVoteExtensionHandler() sdk.VerifyVoteExtensionHandler { + return func(ctx sdk.Context, req *cometabci.RequestVerifyVoteExtension) (*cometabci.ResponseVerifyVoteExtension, error) { + var ve types.AsyncVoteExtension + err := ve.Unmarshal(req.VoteExtension) + if err != nil { + return &cometabci.ResponseVerifyVoteExtension{ + Status: cometabci.ResponseVerifyVoteExtension_REJECT, + }, nil + } + + return &cometabci.ResponseVerifyVoteExtension{ + Status: cometabci.ResponseVerifyVoteExtension_ACCEPT, + }, nil + } +} + +func (k Keeper) PrepareProposalHandler() sdk.PrepareProposalHandler { + return func(ctx sdk.Context, req *cometabci.RequestPrepareProposal) (*cometabci.ResponsePrepareProposal, error) { + resp := &cometabci.ResponsePrepareProposal{ + Txs: req.Txs, + } + + if !ve.VoteExtensionsEnabled(ctx) { + return resp, nil + } + + log := ctx.Logger().With("module", "prophet") + asyncTx, err := k.buildAsyncTx(req.LocalLastCommit.Votes) + if err != nil { + log.Error("failed to build async tx", "err", err) + return resp, nil + } + resp.Txs = trimExcessBytes(resp.Txs, req.MaxTxBytes-int64(len(asyncTx))) + resp.Txs = injectTx(asyncTx, 1, resp.Txs) + + return resp, nil + } +} + +func (k Keeper) ProcessProposalHandler() sdk.ProcessProposalHandler { + return func(ctx sdk.Context, req *cometabci.RequestProcessProposal) (*cometabci.ResponseProcessProposal, error) { + resp := &cometabci.ResponseProcessProposal{ + Status: cometabci.ResponseProcessProposal_ACCEPT, + } + + if !ve.VoteExtensionsEnabled(ctx) || len(req.Txs) < 2 { + return resp, nil + } + + log := ctx.Logger().With("module", "prophet") + asyncTx := req.Txs[1] + if len(asyncTx) == 0 { + return resp, nil + } + + var tx types.AsyncInjectedTx + if err := tx.Unmarshal(asyncTx); err != nil { + log.Error("failed to unmarshal async tx", "err", err) + // probably not an async tx? + // but slinky in this case rejects their proposal so maybe we + // should do the same? + return &cometabci.ResponseProcessProposal{ + Status: cometabci.ResponseProcessProposal_ACCEPT, + }, nil + } + + return &cometabci.ResponseProcessProposal{ + Status: cometabci.ResponseProcessProposal_ACCEPT, + }, nil + } +} + +// PreBlocker executes a pre-block logic specific for the x/async module. +// It looks for the first async transaction in the block and executes it. +func (k Keeper) PreBlocker() sdk.PreBlocker { + return func(ctx sdk.Context, req *cometabci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + resp := &sdk.ResponsePreBlock{} + if !ve.VoteExtensionsEnabled(ctx) || len(req.Txs) < 2 { + return resp, nil + } + + log := ctx.Logger().With("module", "x/async") + asyncTx := req.Txs[1] + if len(asyncTx) == 0 { + return resp, nil + } + + var tx types.AsyncInjectedTx + if err := tx.Unmarshal(asyncTx); err != nil { + log.Error("failed to unmarshal async tx", "err", err, "tx", asyncTx) + // probably not an async tx? + // but slinky in this case rejects their proposal so maybe we + // should do the same? + return resp, nil + } + + for _, v := range tx.ExtendedVotesInfo { + var w vemanager.VoteExtensions + if err := w.Unmarshal(v.VoteExtension); err != nil { + return resp, fmt.Errorf("failed to unmarshal vote extension wrapper: %w", err) + } + + // todo: check VE signature, or maybe do it in the verify ve handler? + + if len(w.Extensions) < 2 { + continue + } + + var asyncve types.AsyncVoteExtension + if err := asyncve.Unmarshal(w.Extensions[1]); err != nil { + return resp, fmt.Errorf("failed to unmarshal x/async vote extension: %w", err) + } + + if err := k.processVE(ctx, v.Validator.Address, asyncve); err != nil { + return resp, fmt.Errorf("failed to process vote extension: %w", err) + } + } + + return resp, nil + } +} + +func (k Keeper) processVE(ctx sdk.Context, fromAddr []byte, ve types.AsyncVoteExtension) error { + for _, r := range ve.Results { + if err := k.AddFutureResult(ctx, r.FutureId, fromAddr, r.Output); err != nil { + return fmt.Errorf("failed to add future result: %w", err) + } + } + + for _, vote := range ve.Votes { + if err := k.SetFutureVote(ctx, vote.FutureId, fromAddr, vote.Vote); err != nil { + return fmt.Errorf("failed to set task vote: %w", err) + } + } + + return nil +} + +func (k Keeper) buildAsyncTx(votes []cometabci.ExtendedVoteInfo) ([]byte, error) { + tx := types.AsyncInjectedTx{ + ExtendedVotesInfo: votes, + } + + txBytes, err := tx.Marshal() + if err != nil { + return nil, err + } + + return txBytes, nil +} + +func injectTx(newTx []byte, position int, appTxs [][]byte) [][]byte { + if position < 0 { + panic("position must be >= 0") + } + + if position == 0 { + return append([][]byte{newTx}, appTxs...) + } + + if position >= len(appTxs) { + return append(appTxs, newTx) + } + + return append(appTxs[:position], append([][]byte{newTx}, appTxs[position:]...)...) +} + +func trimExcessBytes(txs [][]byte, maxSizeBytes int64) [][]byte { + var ( + returnedTxs [][]byte + consumedBytes int64 + ) + for _, tx := range txs { + consumedBytes += int64(len(tx)) + if consumedBytes > maxSizeBytes { + break + } + returnedTxs = append(returnedTxs, tx) + } + return returnedTxs +} diff --git a/warden/x/async/keeper/abci_test.go b/warden/x/async/keeper/abci_test.go new file mode 100644 index 000000000..5e2acd2a4 --- /dev/null +++ b/warden/x/async/keeper/abci_test.go @@ -0,0 +1,137 @@ +package keeper + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestTrimExcessBytes(t *testing.T) { + type args struct { + txs [][]byte + maxSizeBytes int64 + } + tests := []struct { + name string + args args + want [][]byte + }{ + { + name: "don't trim", + args: args{ + txs: [][]byte{[]byte("tx1"), []byte("tx2")}, + maxSizeBytes: 10, + }, + want: [][]byte{[]byte("tx1"), []byte("tx2")}, + }, + { + name: "trim one tx precise", + args: args{ + txs: [][]byte{[]byte("tx1"), []byte("tx2"), []byte("tx3")}, + maxSizeBytes: 6, + }, + want: [][]byte{[]byte("tx1"), []byte("tx2")}, + }, + { + name: "trim one tx with 1 byte excess", + args: args{ + txs: [][]byte{[]byte("tx1"), []byte("tx2"), []byte("tx3")}, + maxSizeBytes: 7, + }, + want: [][]byte{[]byte("tx1"), []byte("tx2")}, + }, + { + name: "trim one tx with 2 bytes excess", + args: args{ + txs: [][]byte{[]byte("tx1"), []byte("tx2"), []byte("tx3")}, + maxSizeBytes: 8, + }, + want: [][]byte{[]byte("tx1"), []byte("tx2")}, + }, + { + name: "empty list", + args: args{ + txs: [][]byte{}, + maxSizeBytes: 8, + }, + want: nil, + }, + { + name: "nil list", + args: args{ + txs: nil, + maxSizeBytes: 8, + }, + want: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + require.Equal(t, tt.want, trimExcessBytes(tt.args.txs, tt.args.maxSizeBytes)) + }) + } +} + +func TestInjectTx(t *testing.T) { + type args struct { + newTx []byte + position int + appTxs [][]byte + } + tests := []struct { + name string + args args + want [][]byte + }{ + { + name: "inject at the beginning, empty list", + args: args{ + newTx: []byte("newTx"), + position: 0, + appTxs: [][]byte{}, + }, + want: [][]byte{[]byte("newTx")}, + }, + { + name: "inject at the beginning, non-empty list", + args: args{ + newTx: []byte("newTx"), + position: 0, + appTxs: [][]byte{[]byte("appTx1"), []byte("appTx2")}, + }, + want: [][]byte{[]byte("newTx"), []byte("appTx1"), []byte("appTx2")}, + }, + { + name: "position is over the length of the list, empty list", + args: args{ + newTx: []byte("newTx"), + position: 2, + appTxs: [][]byte{}, + }, + want: [][]byte{[]byte("newTx")}, + }, + { + name: "position is over the length of the list, non-empty list", + args: args{ + newTx: []byte("newTx"), + position: 4, + appTxs: [][]byte{[]byte("appTx1"), []byte("appTx2")}, + }, + want: [][]byte{[]byte("appTx1"), []byte("appTx2"), []byte("newTx")}, + }, + { + name: "position in the middle", + args: args{ + newTx: []byte("newTx"), + position: 1, + appTxs: [][]byte{[]byte("appTx1"), []byte("appTx2")}, + }, + want: [][]byte{[]byte("appTx1"), []byte("newTx"), []byte("appTx2")}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + require.Equal(t, tt.want, injectTx(tt.args.newTx, tt.args.position, tt.args.appTxs)) + }) + } +} diff --git a/warden/x/async/keeper/futures.go b/warden/x/async/keeper/futures.go index a9d49a0a4..50b78f047 100644 --- a/warden/x/async/keeper/futures.go +++ b/warden/x/async/keeper/futures.go @@ -16,6 +16,7 @@ type FutureKeeper struct { futures repo.SeqCollection[types.Future] futureByCreator collections.KeySet[collections.Pair[sdk.AccAddress, uint64]] results collections.Map[uint64, types.FutureResult] + pendingFutures collections.KeySet[uint64] } func NewFutureKeeper(sb *collections.SchemaBuilder, cdc codec.Codec) *FutureKeeper { @@ -27,10 +28,13 @@ func NewFutureKeeper(sb *collections.SchemaBuilder, cdc codec.Codec) *FutureKeep results := collections.NewMap(sb, ResultsPrefix, "future_results", collections.Uint64Key, codec.CollValue[types.FutureResult](cdc)) + pendingFutures := collections.NewKeySet(sb, PendingFuturesPrefix, "pending_futures", collections.Uint64Key) + return &FutureKeeper{ futures: futures, futureByCreator: futureByCreator, results: results, + pendingFutures: pendingFutures, } } @@ -49,6 +53,10 @@ func (k *FutureKeeper) Append(ctx context.Context, t *types.Future) (uint64, err return 0, err } + if err := k.pendingFutures.Set(ctx, id); err != nil { + return 0, err + } + return id, nil } @@ -61,6 +69,9 @@ func (k *FutureKeeper) Set(ctx context.Context, f types.Future) error { } func (k *FutureKeeper) SetResult(ctx context.Context, result types.FutureResult) error { + if err := k.pendingFutures.Remove(ctx, result.Id); err != nil { + return err + } return k.results.Set(ctx, result.Id, result) } @@ -75,3 +86,31 @@ func (k *FutureKeeper) HasResult(ctx context.Context, id uint64) (bool, error) { func (k *FutureKeeper) Futures() repo.SeqCollection[types.Future] { return k.futures } + +func (k *FutureKeeper) PendingFutures(ctx context.Context, limit int) ([]types.Future, error) { + it, err := k.pendingFutures.IterateRaw(ctx, nil, nil, collections.OrderAscending) + if err != nil { + return nil, err + } + defer it.Close() + + futures := make([]types.Future, 0, limit) + for ; it.Valid(); it.Next() { + id, err := it.Key() + if err != nil { + return nil, err + } + + fut, err := k.futures.Get(ctx, id) + if err != nil { + return nil, err + } + + futures = append(futures, fut) + if len(futures) == limit { + break + } + } + + return futures, nil +} diff --git a/warden/x/async/keeper/keeper.go b/warden/x/async/keeper/keeper.go index 54ae4c5ec..ea04c6d37 100644 --- a/warden/x/async/keeper/keeper.go +++ b/warden/x/async/keeper/keeper.go @@ -10,6 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/warden-protocol/wardenprotocol/prophet" types "github.com/warden-protocol/wardenprotocol/warden/x/async/types/v1beta1" ) @@ -25,6 +26,8 @@ type ( futures *FutureKeeper votes collections.Map[collections.Pair[uint64, []byte], int32] + + p *prophet.P } ) @@ -34,6 +37,7 @@ var ( FutureByAddressPrefix = collections.NewPrefix(2) ResultsPrefix = collections.NewPrefix(3) VotesPrefix = collections.NewPrefix(4) + PendingFuturesPrefix = collections.NewPrefix(5) ) func NewKeeper( @@ -41,6 +45,8 @@ func NewKeeper( storeService store.KVStoreService, logger log.Logger, authority string, + p *prophet.P, + //selfValAddr sdk.ConsAddress, ) Keeper { if _, err := sdk.AccAddressFromBech32(authority); err != nil { panic(fmt.Sprintf("invalid authority address: %s", authority)) @@ -70,6 +76,8 @@ func NewKeeper( futures: futures, votes: votes, + + p: p, } } @@ -83,6 +91,29 @@ func (k Keeper) Logger() log.Logger { return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) } +func (k Keeper) AddFutureResult(ctx context.Context, id uint64, submitter, output []byte) error { + if err := k.futures.SetResult(ctx, types.FutureResult{ + Id: id, + Output: output, + Submitter: submitter, + }); err != nil { + return err + } + + if err := k.SetFutureVote(ctx, id, submitter, types.FutureVoteType_VOTE_TYPE_VERIFIED); err != nil { + return err + } + + return nil +} + +func (k Keeper) SetFutureVote(ctx context.Context, id uint64, voter []byte, vote types.FutureVoteType) error { + if !vote.IsValid() { + return fmt.Errorf("invalid vote type: %v", vote) + } + return k.votes.Set(ctx, collections.Join(id, voter), int32(vote)) +} + func (k Keeper) GetFutureVotes(ctx context.Context, futureId uint64) ([]types.FutureVote, error) { it, err := k.votes.Iterate(ctx, collections.NewPrefixedPairRange[uint64, []byte](futureId)) if err != nil { diff --git a/warden/x/async/module/module.go b/warden/x/async/module/module.go index 834bd1f17..dc31ec406 100644 --- a/warden/x/async/module/module.go +++ b/warden/x/async/module/module.go @@ -21,6 +21,7 @@ import ( // this line is used by starport scaffolding # 1 modulev1 "github.com/warden-protocol/wardenprotocol/api/warden/async/module" + "github.com/warden-protocol/wardenprotocol/prophet" "github.com/warden-protocol/wardenprotocol/warden/x/async/keeper" types "github.com/warden-protocol/wardenprotocol/warden/x/async/types/v1beta1" ) @@ -190,6 +191,8 @@ type ModuleInputs struct { AccountKeeper types.AccountKeeper BankKeeper types.BankKeeper + + Prophet *prophet.P `optional:"true"` } type ModuleOutputs struct { @@ -211,6 +214,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { in.StoreService, in.Logger, authority.String(), + in.Prophet, ) m := NewAppModule( in.Cdc, diff --git a/warden/x/async/types/v1beta1/future.go b/warden/x/async/types/v1beta1/future.go new file mode 100644 index 000000000..abd8be0d1 --- /dev/null +++ b/warden/x/async/types/v1beta1/future.go @@ -0,0 +1,6 @@ +package v1beta1 + +func (v FutureVoteType) IsValid() bool { + _, ok := FutureVoteType_name[int32(v)] + return ok +} diff --git a/warden/x/async/types/v1beta1/ve.pb.go b/warden/x/async/types/v1beta1/ve.pb.go index 5c55313ce..0b2b57763 100644 --- a/warden/x/async/types/v1beta1/ve.pb.go +++ b/warden/x/async/types/v1beta1/ve.pb.go @@ -25,11 +25,11 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type AsyncInjectedTx struct { - // The results of the execution of the Futures. - Results []*FutureResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` // All the vote extensions gathered for this block. - // TODO: slinky also does that, so technically we're duplicating information and wasting block space. - ExtendedVotesInfo []types.ExtendedVoteInfo `protobuf:"bytes,2,rep,name=extended_votes_info,json=extendedVotesInfo,proto3" json:"extended_votes_info"` + // + // FIXME: slinky also does that, so technically we're duplicating information + // and wasting block space. + ExtendedVotesInfo []types.ExtendedVoteInfo `protobuf:"bytes,1,rep,name=extended_votes_info,json=extendedVotesInfo,proto3" json:"extended_votes_info"` } func (m *AsyncInjectedTx) Reset() { *m = AsyncInjectedTx{} } @@ -65,13 +65,6 @@ func (m *AsyncInjectedTx) XXX_DiscardUnknown() { var xxx_messageInfo_AsyncInjectedTx proto.InternalMessageInfo -func (m *AsyncInjectedTx) GetResults() []*FutureResult { - if m != nil { - return m.Results - } - return nil -} - func (m *AsyncInjectedTx) GetExtendedVotesInfo() []types.ExtendedVoteInfo { if m != nil { return m.ExtendedVotesInfo @@ -79,10 +72,11 @@ func (m *AsyncInjectedTx) GetExtendedVotesInfo() []types.ExtendedVoteInfo { return nil } -// A vote extension coming from a validator. It contains multiple votes for -// different Futures. +// A vote extension coming from a validator. It contains results and votes for +// some futures. type AsyncVoteExtension struct { - Votes []*AsyncVoteExtensionItem `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes,omitempty"` + Results []*VEResultItem `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` + Votes []*VEVoteItem `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes,omitempty"` } func (m *AsyncVoteExtension) Reset() { *m = AsyncVoteExtension{} } @@ -118,30 +112,89 @@ func (m *AsyncVoteExtension) XXX_DiscardUnknown() { var xxx_messageInfo_AsyncVoteExtension proto.InternalMessageInfo -func (m *AsyncVoteExtension) GetVotes() []*AsyncVoteExtensionItem { +func (m *AsyncVoteExtension) GetResults() []*VEResultItem { + if m != nil { + return m.Results + } + return nil +} + +func (m *AsyncVoteExtension) GetVotes() []*VEVoteItem { if m != nil { return m.Votes } return nil } -type AsyncVoteExtensionItem struct { +type VEResultItem struct { + FutureId uint64 `protobuf:"varint,1,opt,name=future_id,json=futureId,proto3" json:"future_id,omitempty"` + Output []byte `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` +} + +func (m *VEResultItem) Reset() { *m = VEResultItem{} } +func (m *VEResultItem) String() string { return proto.CompactTextString(m) } +func (*VEResultItem) ProtoMessage() {} +func (*VEResultItem) Descriptor() ([]byte, []int) { + return fileDescriptor_e3e24cf4461cf67a, []int{2} +} +func (m *VEResultItem) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VEResultItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VEResultItem.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 *VEResultItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_VEResultItem.Merge(m, src) +} +func (m *VEResultItem) XXX_Size() int { + return m.Size() +} +func (m *VEResultItem) XXX_DiscardUnknown() { + xxx_messageInfo_VEResultItem.DiscardUnknown(m) +} + +var xxx_messageInfo_VEResultItem proto.InternalMessageInfo + +func (m *VEResultItem) GetFutureId() uint64 { + if m != nil { + return m.FutureId + } + return 0 +} + +func (m *VEResultItem) GetOutput() []byte { + if m != nil { + return m.Output + } + return nil +} + +type VEVoteItem struct { FutureId uint64 `protobuf:"varint,1,opt,name=future_id,json=futureId,proto3" json:"future_id,omitempty"` Vote FutureVoteType `protobuf:"varint,2,opt,name=vote,proto3,enum=warden.async.v1beta1.FutureVoteType" json:"vote,omitempty"` } -func (m *AsyncVoteExtensionItem) Reset() { *m = AsyncVoteExtensionItem{} } -func (m *AsyncVoteExtensionItem) String() string { return proto.CompactTextString(m) } -func (*AsyncVoteExtensionItem) ProtoMessage() {} -func (*AsyncVoteExtensionItem) Descriptor() ([]byte, []int) { - return fileDescriptor_e3e24cf4461cf67a, []int{2} +func (m *VEVoteItem) Reset() { *m = VEVoteItem{} } +func (m *VEVoteItem) String() string { return proto.CompactTextString(m) } +func (*VEVoteItem) ProtoMessage() {} +func (*VEVoteItem) Descriptor() ([]byte, []int) { + return fileDescriptor_e3e24cf4461cf67a, []int{3} } -func (m *AsyncVoteExtensionItem) XXX_Unmarshal(b []byte) error { +func (m *VEVoteItem) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *AsyncVoteExtensionItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *VEVoteItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_AsyncVoteExtensionItem.Marshal(b, m, deterministic) + return xxx_messageInfo_VEVoteItem.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -151,26 +204,26 @@ func (m *AsyncVoteExtensionItem) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *AsyncVoteExtensionItem) XXX_Merge(src proto.Message) { - xxx_messageInfo_AsyncVoteExtensionItem.Merge(m, src) +func (m *VEVoteItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_VEVoteItem.Merge(m, src) } -func (m *AsyncVoteExtensionItem) XXX_Size() int { +func (m *VEVoteItem) XXX_Size() int { return m.Size() } -func (m *AsyncVoteExtensionItem) XXX_DiscardUnknown() { - xxx_messageInfo_AsyncVoteExtensionItem.DiscardUnknown(m) +func (m *VEVoteItem) XXX_DiscardUnknown() { + xxx_messageInfo_VEVoteItem.DiscardUnknown(m) } -var xxx_messageInfo_AsyncVoteExtensionItem proto.InternalMessageInfo +var xxx_messageInfo_VEVoteItem proto.InternalMessageInfo -func (m *AsyncVoteExtensionItem) GetFutureId() uint64 { +func (m *VEVoteItem) GetFutureId() uint64 { if m != nil { return m.FutureId } return 0 } -func (m *AsyncVoteExtensionItem) GetVote() FutureVoteType { +func (m *VEVoteItem) GetVote() FutureVoteType { if m != nil { return m.Vote } @@ -180,36 +233,39 @@ func (m *AsyncVoteExtensionItem) GetVote() FutureVoteType { func init() { proto.RegisterType((*AsyncInjectedTx)(nil), "warden.async.v1beta1.AsyncInjectedTx") proto.RegisterType((*AsyncVoteExtension)(nil), "warden.async.v1beta1.AsyncVoteExtension") - proto.RegisterType((*AsyncVoteExtensionItem)(nil), "warden.async.v1beta1.AsyncVoteExtensionItem") + proto.RegisterType((*VEResultItem)(nil), "warden.async.v1beta1.VEResultItem") + proto.RegisterType((*VEVoteItem)(nil), "warden.async.v1beta1.VEVoteItem") } func init() { proto.RegisterFile("warden/async/v1beta1/ve.proto", fileDescriptor_e3e24cf4461cf67a) } var fileDescriptor_e3e24cf4461cf67a = []byte{ - // 367 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0xcb, 0x4e, 0xf2, 0x40, - 0x14, 0xee, 0xf0, 0xf3, 0xdf, 0xc6, 0x44, 0x63, 0x25, 0xa6, 0x81, 0x58, 0xa1, 0x71, 0xc1, 0x42, - 0x67, 0x02, 0x6e, 0x5c, 0xb8, 0x91, 0x44, 0x92, 0x6e, 0x1b, 0xa2, 0xc6, 0x0d, 0xf6, 0x72, 0xc0, - 0x1a, 0x98, 0x21, 0xed, 0x14, 0xe1, 0x2d, 0x7c, 0x0c, 0x1f, 0x85, 0x25, 0x4b, 0x57, 0xc6, 0xc0, - 0x8b, 0x98, 0x99, 0x0e, 0xd1, 0x68, 0xe3, 0x6e, 0xe6, 0x7c, 0x97, 0xf3, 0xe5, 0x7c, 0xf8, 0xe0, - 0xd1, 0x4f, 0x22, 0x60, 0xd4, 0x4f, 0xe7, 0x2c, 0xa4, 0xd3, 0x56, 0x00, 0xc2, 0x6f, 0xd1, 0x29, - 0x90, 0x49, 0xc2, 0x05, 0x37, 0x2b, 0x39, 0x4c, 0x14, 0x4c, 0x34, 0x5c, 0xad, 0x0c, 0xf9, 0x90, - 0x2b, 0x02, 0x95, 0xaf, 0x9c, 0x5b, 0xad, 0x09, 0x60, 0x11, 0x24, 0xe3, 0x98, 0x09, 0xea, 0x07, - 0x61, 0x4c, 0xc5, 0x7c, 0x02, 0xa9, 0x06, 0x1b, 0x85, 0x7b, 0x06, 0x99, 0xc8, 0x12, 0xbd, 0xcb, - 0x79, 0x46, 0x78, 0xe7, 0x42, 0xc2, 0x2e, 0x7b, 0x80, 0x50, 0x40, 0xd4, 0x9b, 0x99, 0xe7, 0xf8, - 0x6f, 0x02, 0x69, 0x36, 0x12, 0xa9, 0x85, 0xea, 0xbf, 0x9a, 0x5b, 0x6d, 0x87, 0x14, 0x25, 0x22, - 0x5d, 0x65, 0xe4, 0x29, 0xaa, 0xb7, 0x91, 0x98, 0xd7, 0x78, 0x0f, 0x66, 0x2a, 0x55, 0xd4, 0x9f, - 0x72, 0x01, 0x69, 0x3f, 0x66, 0x03, 0x6e, 0x95, 0x94, 0x53, 0x83, 0x7c, 0xe4, 0x25, 0x32, 0x2f, - 0xb9, 0xd4, 0xdc, 0x2b, 0x2e, 0xc0, 0x65, 0x03, 0xde, 0x29, 0x2f, 0x5e, 0x0f, 0x0d, 0x6f, 0x17, - 0x3e, 0xcd, 0x53, 0x09, 0x38, 0x37, 0xd8, 0x54, 0x49, 0xe5, 0x44, 0xa9, 0xd2, 0x98, 0x33, 0xb3, - 0x83, 0x7f, 0xab, 0x2d, 0x3a, 0xea, 0x71, 0x71, 0xd4, 0xef, 0x42, 0x57, 0xc0, 0xd8, 0xcb, 0xa5, - 0x0e, 0xc7, 0xfb, 0xc5, 0x04, 0xb3, 0x86, 0xff, 0xe7, 0xe7, 0xea, 0xc7, 0x91, 0x85, 0xea, 0xa8, - 0x59, 0xf6, 0xfe, 0xe5, 0x03, 0x37, 0x32, 0xcf, 0x70, 0x59, 0xea, 0xad, 0x52, 0x1d, 0x35, 0xb7, - 0xdb, 0x47, 0x3f, 0x1d, 0x49, 0x3a, 0xf7, 0xe6, 0x13, 0xf0, 0x94, 0xa2, 0x73, 0xb7, 0x58, 0xd9, - 0x68, 0xb9, 0xb2, 0xd1, 0xdb, 0xca, 0x46, 0x4f, 0x6b, 0xdb, 0x58, 0xae, 0x6d, 0xe3, 0x65, 0x6d, - 0x1b, 0xb7, 0xdd, 0x61, 0x2c, 0xee, 0xb3, 0x80, 0x84, 0x7c, 0x4c, 0x73, 0xbf, 0x13, 0x55, 0x54, - 0xc8, 0x47, 0xfa, 0xff, 0xe5, 0x4b, 0x67, 0xba, 0x5e, 0x55, 0xfc, 0xa6, 0xe4, 0xe0, 0x8f, 0xa2, - 0x9d, 0xbe, 0x07, 0x00, 0x00, 0xff, 0xff, 0xae, 0x79, 0x85, 0xd7, 0x6b, 0x02, 0x00, 0x00, + // 390 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x4f, 0x6b, 0xe2, 0x40, + 0x14, 0xcf, 0xb8, 0xae, 0xbb, 0x3b, 0x2b, 0xbb, 0x6c, 0x56, 0x4a, 0x50, 0x9a, 0xc6, 0xd0, 0x83, + 0x97, 0xce, 0xa0, 0x85, 0xd2, 0x43, 0x2f, 0xb5, 0x28, 0xe4, 0x1a, 0xc4, 0x42, 0x2f, 0x36, 0x7f, + 0x46, 0x1b, 0xd1, 0x99, 0x90, 0x4c, 0xac, 0x7e, 0x85, 0x9e, 0xfa, 0xb1, 0x3c, 0x7a, 0xec, 0xa9, + 0x14, 0xfd, 0x22, 0x65, 0x26, 0x23, 0x4a, 0xb1, 0xbd, 0xcd, 0x7b, 0xbf, 0x7f, 0x8f, 0x37, 0x0f, + 0x1e, 0x3f, 0x7a, 0x49, 0x48, 0x28, 0xf6, 0xd2, 0x05, 0x0d, 0xf0, 0xac, 0xe9, 0x13, 0xee, 0x35, + 0xf1, 0x8c, 0xa0, 0x38, 0x61, 0x9c, 0xe9, 0x95, 0x1c, 0x46, 0x12, 0x46, 0x0a, 0xae, 0x56, 0x46, + 0x6c, 0xc4, 0x24, 0x01, 0x8b, 0x57, 0xce, 0xad, 0xd6, 0x38, 0xa1, 0x21, 0x49, 0xa6, 0x11, 0xe5, + 0xd8, 0xf3, 0x83, 0x08, 0xf3, 0x45, 0x4c, 0x52, 0x05, 0xd6, 0x0f, 0xe6, 0x0c, 0x33, 0x9e, 0x25, + 0x2a, 0xcb, 0x1e, 0xc3, 0xbf, 0xd7, 0x02, 0x75, 0xe8, 0x98, 0x04, 0x9c, 0x84, 0xbd, 0xb9, 0x7e, + 0x0b, 0xff, 0x93, 0xb9, 0xb4, 0x0d, 0x07, 0x33, 0xc6, 0x49, 0x3a, 0x88, 0xe8, 0x90, 0x19, 0xc0, + 0xfa, 0xd6, 0xf8, 0xdd, 0xaa, 0xa3, 0x5d, 0x20, 0x12, 0x81, 0xa8, 0xa3, 0xb8, 0x7d, 0xc6, 0x89, + 0x43, 0x87, 0xac, 0x5d, 0x5c, 0xbe, 0x9e, 0x68, 0xee, 0x3f, 0xb2, 0xd7, 0x4f, 0x05, 0x60, 0x3f, + 0x01, 0xa8, 0xcb, 0x30, 0xd1, 0x92, 0xb2, 0x34, 0x62, 0x54, 0xbf, 0x82, 0x3f, 0x12, 0x92, 0x66, + 0x13, 0x9e, 0xaa, 0x0c, 0x1b, 0x1d, 0x5a, 0x00, 0xea, 0x77, 0x5c, 0x49, 0x73, 0x38, 0x99, 0xba, + 0x5b, 0x89, 0x7e, 0x01, 0xbf, 0xcb, 0x21, 0x8d, 0x82, 0xd4, 0x5a, 0x9f, 0x69, 0xe5, 0x78, 0x42, + 0x99, 0xd3, 0xed, 0x1b, 0x58, 0xde, 0x37, 0xd4, 0x6b, 0xf0, 0x57, 0xbe, 0x98, 0x41, 0x14, 0x1a, + 0xc0, 0x02, 0x8d, 0xa2, 0xfb, 0x33, 0x6f, 0x38, 0xa1, 0x7e, 0x04, 0x4b, 0x2c, 0xe3, 0x71, 0xc6, + 0x8d, 0x82, 0x05, 0x1a, 0x65, 0x57, 0x55, 0x76, 0x00, 0xe1, 0xce, 0xf9, 0x6b, 0x8b, 0x4b, 0x58, + 0x14, 0xc1, 0xd2, 0xe0, 0x4f, 0xeb, 0xf4, 0xf0, 0x98, 0x5d, 0xc9, 0x16, 0x86, 0xbd, 0x45, 0x4c, + 0x5c, 0xa9, 0x68, 0xdf, 0x2f, 0xd7, 0x26, 0x58, 0xad, 0x4d, 0xf0, 0xb6, 0x36, 0xc1, 0xf3, 0xc6, + 0xd4, 0x56, 0x1b, 0x53, 0x7b, 0xd9, 0x98, 0xda, 0x5d, 0x77, 0x14, 0xf1, 0x87, 0xcc, 0x47, 0x01, + 0x9b, 0xe2, 0xdc, 0xef, 0x4c, 0xfe, 0x6a, 0xc0, 0x26, 0xaa, 0xfe, 0x50, 0xe2, 0xb9, 0xba, 0x05, + 0x79, 0x25, 0xdb, 0x8b, 0xf0, 0x4b, 0x92, 0x76, 0xfe, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x46, 0xd4, + 0x19, 0x03, 0x98, 0x02, 0x00, 0x00, } func (m *AsyncInjectedTx) Marshal() (dAtA []byte, err error) { @@ -243,20 +299,6 @@ func (m *AsyncInjectedTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintVe(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - } - if len(m.Results) > 0 { - for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintVe(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0xa } } @@ -294,13 +336,27 @@ func (m *AsyncVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintVe(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x12 + } + } + if len(m.Results) > 0 { + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintVe(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } -func (m *AsyncVoteExtensionItem) Marshal() (dAtA []byte, err error) { +func (m *VEResultItem) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -310,12 +366,47 @@ func (m *AsyncVoteExtensionItem) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *AsyncVoteExtensionItem) MarshalTo(dAtA []byte) (int, error) { +func (m *VEResultItem) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *AsyncVoteExtensionItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *VEResultItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Output) > 0 { + i -= len(m.Output) + copy(dAtA[i:], m.Output) + i = encodeVarintVe(dAtA, i, uint64(len(m.Output))) + i-- + dAtA[i] = 0x12 + } + if m.FutureId != 0 { + i = encodeVarintVe(dAtA, i, uint64(m.FutureId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *VEVoteItem) 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 *VEVoteItem) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VEVoteItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -350,12 +441,6 @@ func (m *AsyncInjectedTx) Size() (n int) { } var l int _ = l - if len(m.Results) > 0 { - for _, e := range m.Results { - l = e.Size() - n += 1 + l + sovVe(uint64(l)) - } - } if len(m.ExtendedVotesInfo) > 0 { for _, e := range m.ExtendedVotesInfo { l = e.Size() @@ -371,6 +456,12 @@ func (m *AsyncVoteExtension) Size() (n int) { } var l int _ = l + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.Size() + n += 1 + l + sovVe(uint64(l)) + } + } if len(m.Votes) > 0 { for _, e := range m.Votes { l = e.Size() @@ -380,7 +471,23 @@ func (m *AsyncVoteExtension) Size() (n int) { return n } -func (m *AsyncVoteExtensionItem) Size() (n int) { +func (m *VEResultItem) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FutureId != 0 { + n += 1 + sovVe(uint64(m.FutureId)) + } + l = len(m.Output) + if l > 0 { + n += 1 + l + sovVe(uint64(l)) + } + return n +} + +func (m *VEVoteItem) Size() (n int) { if m == nil { return 0 } @@ -430,6 +537,90 @@ func (m *AsyncInjectedTx) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: AsyncInjectedTx: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtendedVotesInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVe + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthVe + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthVe + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtendedVotesInfo = append(m.ExtendedVotesInfo, types.ExtendedVoteInfo{}) + if err := m.ExtendedVotesInfo[len(m.ExtendedVotesInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipVe(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthVe + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AsyncVoteExtension) 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 ErrIntOverflowVe + } + 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: AsyncVoteExtension: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AsyncVoteExtension: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) @@ -459,14 +650,14 @@ func (m *AsyncInjectedTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Results = append(m.Results, &FutureResult{}) + m.Results = append(m.Results, &VEResultItem{}) if err := m.Results[len(m.Results)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtendedVotesInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -493,8 +684,8 @@ func (m *AsyncInjectedTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ExtendedVotesInfo = append(m.ExtendedVotesInfo, types.ExtendedVoteInfo{}) - if err := m.ExtendedVotesInfo[len(m.ExtendedVotesInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Votes = append(m.Votes, &VEVoteItem{}) + if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -519,7 +710,7 @@ func (m *AsyncInjectedTx) Unmarshal(dAtA []byte) error { } return nil } -func (m *AsyncVoteExtension) Unmarshal(dAtA []byte) error { +func (m *VEResultItem) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -542,17 +733,36 @@ func (m *AsyncVoteExtension) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AsyncVoteExtension: wiretype end group for non-group") + return fmt.Errorf("proto: VEResultItem: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AsyncVoteExtension: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: VEResultItem: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FutureId", wireType) + } + m.FutureId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowVe + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FutureId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVe @@ -562,24 +772,24 @@ func (m *AsyncVoteExtension) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthVe } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthVe } if postIndex > l { return io.ErrUnexpectedEOF } - m.Votes = append(m.Votes, &AsyncVoteExtensionItem{}) - if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Output = append(m.Output[:0], dAtA[iNdEx:postIndex]...) + if m.Output == nil { + m.Output = []byte{} } iNdEx = postIndex default: @@ -603,7 +813,7 @@ func (m *AsyncVoteExtension) Unmarshal(dAtA []byte) error { } return nil } -func (m *AsyncVoteExtensionItem) Unmarshal(dAtA []byte) error { +func (m *VEVoteItem) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -626,10 +836,10 @@ func (m *AsyncVoteExtensionItem) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AsyncVoteExtensionItem: wiretype end group for non-group") + return fmt.Errorf("proto: VEVoteItem: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AsyncVoteExtensionItem: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: VEVoteItem: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: