diff --git a/UPGRADING.md b/UPGRADING.md index ae7eae68d94b..f5c621bcc5aa 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -469,9 +469,23 @@ Accounts's AccountNumber will be used as a global account number tracking replac ```go import authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" ... -err := authkeeper.MigrateAccountNumberUnsafe(ctx, &app.AuthKeeper) -if err != nil { - return nil, err +app.UpgradeKeeper.SetUpgradeHandler(planName, + func(ctx context.Context, _ upgradetypes.Plan, fromVM appmodule.VersionMap) (appmodule.VersionMap, error) { + if err := authkeeper.MigrateAccountNumberUnsafe(ctx, &app.AuthKeeper); err != nil { + return nil, err + } + return app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM) + }, +) +``` + +Add `x/accounts` store while upgrading to v0.52.x: + +```go +storetypes.StoreUpgrades{ + Added: []string{ + accounts.StoreKey, + }, } ``` diff --git a/api/cosmos/store/v2/commit_info.pulsar.go b/api/cosmos/store/v2/commit_info.pulsar.go new file mode 100644 index 000000000000..572f80f0be48 --- /dev/null +++ b/api/cosmos/store/v2/commit_info.pulsar.go @@ -0,0 +1,2048 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package storev2 + +import ( + 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" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_CommitInfo_2_list)(nil) + +type _CommitInfo_2_list struct { + list *[]*StoreInfo +} + +func (x *_CommitInfo_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_CommitInfo_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_CommitInfo_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*StoreInfo) + (*x.list)[i] = concreteValue +} + +func (x *_CommitInfo_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*StoreInfo) + *x.list = append(*x.list, concreteValue) +} + +func (x *_CommitInfo_2_list) AppendMutable() protoreflect.Value { + v := new(StoreInfo) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_CommitInfo_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_CommitInfo_2_list) NewElement() protoreflect.Value { + v := new(StoreInfo) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_CommitInfo_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_CommitInfo protoreflect.MessageDescriptor + fd_CommitInfo_version protoreflect.FieldDescriptor + fd_CommitInfo_store_infos protoreflect.FieldDescriptor + fd_CommitInfo_timestamp protoreflect.FieldDescriptor + fd_CommitInfo_commit_hash protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_store_v2_commit_info_proto_init() + md_CommitInfo = File_cosmos_store_v2_commit_info_proto.Messages().ByName("CommitInfo") + fd_CommitInfo_version = md_CommitInfo.Fields().ByName("version") + fd_CommitInfo_store_infos = md_CommitInfo.Fields().ByName("store_infos") + fd_CommitInfo_timestamp = md_CommitInfo.Fields().ByName("timestamp") + fd_CommitInfo_commit_hash = md_CommitInfo.Fields().ByName("commit_hash") +} + +var _ protoreflect.Message = (*fastReflection_CommitInfo)(nil) + +type fastReflection_CommitInfo CommitInfo + +func (x *CommitInfo) ProtoReflect() protoreflect.Message { + return (*fastReflection_CommitInfo)(x) +} + +func (x *CommitInfo) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_store_v2_commit_info_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_CommitInfo_messageType fastReflection_CommitInfo_messageType +var _ protoreflect.MessageType = fastReflection_CommitInfo_messageType{} + +type fastReflection_CommitInfo_messageType struct{} + +func (x fastReflection_CommitInfo_messageType) Zero() protoreflect.Message { + return (*fastReflection_CommitInfo)(nil) +} +func (x fastReflection_CommitInfo_messageType) New() protoreflect.Message { + return new(fastReflection_CommitInfo) +} +func (x fastReflection_CommitInfo_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_CommitInfo +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_CommitInfo) Descriptor() protoreflect.MessageDescriptor { + return md_CommitInfo +} + +// 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_CommitInfo) Type() protoreflect.MessageType { + return _fastReflection_CommitInfo_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_CommitInfo) New() protoreflect.Message { + return new(fastReflection_CommitInfo) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_CommitInfo) Interface() protoreflect.ProtoMessage { + return (*CommitInfo)(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_CommitInfo) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Version != int64(0) { + value := protoreflect.ValueOfInt64(x.Version) + if !f(fd_CommitInfo_version, value) { + return + } + } + if len(x.StoreInfos) != 0 { + value := protoreflect.ValueOfList(&_CommitInfo_2_list{list: &x.StoreInfos}) + if !f(fd_CommitInfo_store_infos, value) { + return + } + } + if x.Timestamp != nil { + value := protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) + if !f(fd_CommitInfo_timestamp, value) { + return + } + } + if len(x.CommitHash) != 0 { + value := protoreflect.ValueOfBytes(x.CommitHash) + if !f(fd_CommitInfo_commit_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_CommitInfo) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.store.v2.CommitInfo.version": + return x.Version != int64(0) + case "cosmos.store.v2.CommitInfo.store_infos": + return len(x.StoreInfos) != 0 + case "cosmos.store.v2.CommitInfo.timestamp": + return x.Timestamp != nil + case "cosmos.store.v2.CommitInfo.commit_hash": + return len(x.CommitHash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitInfo 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_CommitInfo) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.store.v2.CommitInfo.version": + x.Version = int64(0) + case "cosmos.store.v2.CommitInfo.store_infos": + x.StoreInfos = nil + case "cosmos.store.v2.CommitInfo.timestamp": + x.Timestamp = nil + case "cosmos.store.v2.CommitInfo.commit_hash": + x.CommitHash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitInfo 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_CommitInfo) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.store.v2.CommitInfo.version": + value := x.Version + return protoreflect.ValueOfInt64(value) + case "cosmos.store.v2.CommitInfo.store_infos": + if len(x.StoreInfos) == 0 { + return protoreflect.ValueOfList(&_CommitInfo_2_list{}) + } + listValue := &_CommitInfo_2_list{list: &x.StoreInfos} + return protoreflect.ValueOfList(listValue) + case "cosmos.store.v2.CommitInfo.timestamp": + value := x.Timestamp + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.store.v2.CommitInfo.commit_hash": + value := x.CommitHash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitInfo 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_CommitInfo) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.store.v2.CommitInfo.version": + x.Version = value.Int() + case "cosmos.store.v2.CommitInfo.store_infos": + lv := value.List() + clv := lv.(*_CommitInfo_2_list) + x.StoreInfos = *clv.list + case "cosmos.store.v2.CommitInfo.timestamp": + x.Timestamp = value.Message().Interface().(*timestamppb.Timestamp) + case "cosmos.store.v2.CommitInfo.commit_hash": + x.CommitHash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitInfo 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_CommitInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.store.v2.CommitInfo.store_infos": + if x.StoreInfos == nil { + x.StoreInfos = []*StoreInfo{} + } + value := &_CommitInfo_2_list{list: &x.StoreInfos} + return protoreflect.ValueOfList(value) + case "cosmos.store.v2.CommitInfo.timestamp": + if x.Timestamp == nil { + x.Timestamp = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) + case "cosmos.store.v2.CommitInfo.version": + panic(fmt.Errorf("field version of message cosmos.store.v2.CommitInfo is not mutable")) + case "cosmos.store.v2.CommitInfo.commit_hash": + panic(fmt.Errorf("field commit_hash of message cosmos.store.v2.CommitInfo is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitInfo 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_CommitInfo) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.store.v2.CommitInfo.version": + return protoreflect.ValueOfInt64(int64(0)) + case "cosmos.store.v2.CommitInfo.store_infos": + list := []*StoreInfo{} + return protoreflect.ValueOfList(&_CommitInfo_2_list{list: &list}) + case "cosmos.store.v2.CommitInfo.timestamp": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.store.v2.CommitInfo.commit_hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitInfo 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_CommitInfo) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.store.v2.CommitInfo", 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_CommitInfo) 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_CommitInfo) 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_CommitInfo) 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_CommitInfo) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*CommitInfo) + 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.Version != 0 { + n += 1 + runtime.Sov(uint64(x.Version)) + } + if len(x.StoreInfos) > 0 { + for _, e := range x.StoreInfos { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Timestamp != nil { + l = options.Size(x.Timestamp) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.CommitHash) + 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().(*CommitInfo) + 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.CommitHash) > 0 { + i -= len(x.CommitHash) + copy(dAtA[i:], x.CommitHash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.CommitHash))) + i-- + dAtA[i] = 0x22 + } + if x.Timestamp != nil { + encoded, err := options.Marshal(x.Timestamp) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.StoreInfos) > 0 { + for iNdEx := len(x.StoreInfos) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.StoreInfos[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 x.Version != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Version)) + 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().(*CommitInfo) + 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: CommitInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CommitInfo: 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 Version", wireType) + } + x.Version = 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.Version |= int64(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 StoreInfos", 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.StoreInfos = append(x.StoreInfos, &StoreInfo{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.StoreInfos[len(x.StoreInfos)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Timestamp == nil { + x.Timestamp = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Timestamp); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CommitHash", 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.CommitHash = append(x.CommitHash[:0], dAtA[iNdEx:postIndex]...) + if x.CommitHash == nil { + x.CommitHash = []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_StoreInfo protoreflect.MessageDescriptor + fd_StoreInfo_name protoreflect.FieldDescriptor + fd_StoreInfo_commit_id protoreflect.FieldDescriptor + fd_StoreInfo_structure protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_store_v2_commit_info_proto_init() + md_StoreInfo = File_cosmos_store_v2_commit_info_proto.Messages().ByName("StoreInfo") + fd_StoreInfo_name = md_StoreInfo.Fields().ByName("name") + fd_StoreInfo_commit_id = md_StoreInfo.Fields().ByName("commit_id") + fd_StoreInfo_structure = md_StoreInfo.Fields().ByName("structure") +} + +var _ protoreflect.Message = (*fastReflection_StoreInfo)(nil) + +type fastReflection_StoreInfo StoreInfo + +func (x *StoreInfo) ProtoReflect() protoreflect.Message { + return (*fastReflection_StoreInfo)(x) +} + +func (x *StoreInfo) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_store_v2_commit_info_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_StoreInfo_messageType fastReflection_StoreInfo_messageType +var _ protoreflect.MessageType = fastReflection_StoreInfo_messageType{} + +type fastReflection_StoreInfo_messageType struct{} + +func (x fastReflection_StoreInfo_messageType) Zero() protoreflect.Message { + return (*fastReflection_StoreInfo)(nil) +} +func (x fastReflection_StoreInfo_messageType) New() protoreflect.Message { + return new(fastReflection_StoreInfo) +} +func (x fastReflection_StoreInfo_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_StoreInfo +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_StoreInfo) Descriptor() protoreflect.MessageDescriptor { + return md_StoreInfo +} + +// 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_StoreInfo) Type() protoreflect.MessageType { + return _fastReflection_StoreInfo_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_StoreInfo) New() protoreflect.Message { + return new(fastReflection_StoreInfo) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_StoreInfo) Interface() protoreflect.ProtoMessage { + return (*StoreInfo)(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_StoreInfo) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_StoreInfo_name, value) { + return + } + } + if x.CommitId != nil { + value := protoreflect.ValueOfMessage(x.CommitId.ProtoReflect()) + if !f(fd_StoreInfo_commit_id, value) { + return + } + } + if x.Structure != "" { + value := protoreflect.ValueOfString(x.Structure) + if !f(fd_StoreInfo_structure, 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_StoreInfo) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.store.v2.StoreInfo.name": + return x.Name != "" + case "cosmos.store.v2.StoreInfo.commit_id": + return x.CommitId != nil + case "cosmos.store.v2.StoreInfo.structure": + return x.Structure != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.StoreInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.StoreInfo 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_StoreInfo) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.store.v2.StoreInfo.name": + x.Name = "" + case "cosmos.store.v2.StoreInfo.commit_id": + x.CommitId = nil + case "cosmos.store.v2.StoreInfo.structure": + x.Structure = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.StoreInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.StoreInfo 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_StoreInfo) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.store.v2.StoreInfo.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "cosmos.store.v2.StoreInfo.commit_id": + value := x.CommitId + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.store.v2.StoreInfo.structure": + value := x.Structure + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.StoreInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.StoreInfo 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_StoreInfo) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.store.v2.StoreInfo.name": + x.Name = value.Interface().(string) + case "cosmos.store.v2.StoreInfo.commit_id": + x.CommitId = value.Message().Interface().(*CommitID) + case "cosmos.store.v2.StoreInfo.structure": + x.Structure = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.StoreInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.StoreInfo 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_StoreInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.store.v2.StoreInfo.commit_id": + if x.CommitId == nil { + x.CommitId = new(CommitID) + } + return protoreflect.ValueOfMessage(x.CommitId.ProtoReflect()) + case "cosmos.store.v2.StoreInfo.name": + panic(fmt.Errorf("field name of message cosmos.store.v2.StoreInfo is not mutable")) + case "cosmos.store.v2.StoreInfo.structure": + panic(fmt.Errorf("field structure of message cosmos.store.v2.StoreInfo is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.StoreInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.StoreInfo 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_StoreInfo) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.store.v2.StoreInfo.name": + return protoreflect.ValueOfString("") + case "cosmos.store.v2.StoreInfo.commit_id": + m := new(CommitID) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.store.v2.StoreInfo.structure": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.StoreInfo")) + } + panic(fmt.Errorf("message cosmos.store.v2.StoreInfo 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_StoreInfo) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.store.v2.StoreInfo", 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_StoreInfo) 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_StoreInfo) 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_StoreInfo) 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_StoreInfo) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*StoreInfo) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.CommitId != nil { + l = options.Size(x.CommitId) + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Structure) + 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().(*StoreInfo) + 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.Structure) > 0 { + i -= len(x.Structure) + copy(dAtA[i:], x.Structure) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Structure))) + i-- + dAtA[i] = 0x1a + } + if x.CommitId != nil { + encoded, err := options.Marshal(x.CommitId) + 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.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + 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().(*StoreInfo) + 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: StoreInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: StoreInfo: 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 Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CommitId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.CommitId == nil { + x.CommitId = &CommitID{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CommitId); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Structure", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Structure = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_CommitID protoreflect.MessageDescriptor + fd_CommitID_version protoreflect.FieldDescriptor + fd_CommitID_hash protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_store_v2_commit_info_proto_init() + md_CommitID = File_cosmos_store_v2_commit_info_proto.Messages().ByName("CommitID") + fd_CommitID_version = md_CommitID.Fields().ByName("version") + fd_CommitID_hash = md_CommitID.Fields().ByName("hash") +} + +var _ protoreflect.Message = (*fastReflection_CommitID)(nil) + +type fastReflection_CommitID CommitID + +func (x *CommitID) ProtoReflect() protoreflect.Message { + return (*fastReflection_CommitID)(x) +} + +func (x *CommitID) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_store_v2_commit_info_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_CommitID_messageType fastReflection_CommitID_messageType +var _ protoreflect.MessageType = fastReflection_CommitID_messageType{} + +type fastReflection_CommitID_messageType struct{} + +func (x fastReflection_CommitID_messageType) Zero() protoreflect.Message { + return (*fastReflection_CommitID)(nil) +} +func (x fastReflection_CommitID_messageType) New() protoreflect.Message { + return new(fastReflection_CommitID) +} +func (x fastReflection_CommitID_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_CommitID +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_CommitID) Descriptor() protoreflect.MessageDescriptor { + return md_CommitID +} + +// 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_CommitID) Type() protoreflect.MessageType { + return _fastReflection_CommitID_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_CommitID) New() protoreflect.Message { + return new(fastReflection_CommitID) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_CommitID) Interface() protoreflect.ProtoMessage { + return (*CommitID)(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_CommitID) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Version != int64(0) { + value := protoreflect.ValueOfInt64(x.Version) + if !f(fd_CommitID_version, value) { + return + } + } + if len(x.Hash) != 0 { + value := protoreflect.ValueOfBytes(x.Hash) + if !f(fd_CommitID_hash, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_CommitID) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.store.v2.CommitID.version": + return x.Version != int64(0) + case "cosmos.store.v2.CommitID.hash": + return len(x.Hash) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitID")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitID 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_CommitID) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.store.v2.CommitID.version": + x.Version = int64(0) + case "cosmos.store.v2.CommitID.hash": + x.Hash = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitID")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitID 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_CommitID) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.store.v2.CommitID.version": + value := x.Version + return protoreflect.ValueOfInt64(value) + case "cosmos.store.v2.CommitID.hash": + value := x.Hash + return protoreflect.ValueOfBytes(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitID")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitID 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_CommitID) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.store.v2.CommitID.version": + x.Version = value.Int() + case "cosmos.store.v2.CommitID.hash": + x.Hash = value.Bytes() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitID")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitID 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_CommitID) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.store.v2.CommitID.version": + panic(fmt.Errorf("field version of message cosmos.store.v2.CommitID is not mutable")) + case "cosmos.store.v2.CommitID.hash": + panic(fmt.Errorf("field hash of message cosmos.store.v2.CommitID is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitID")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitID 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_CommitID) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.store.v2.CommitID.version": + return protoreflect.ValueOfInt64(int64(0)) + case "cosmos.store.v2.CommitID.hash": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.store.v2.CommitID")) + } + panic(fmt.Errorf("message cosmos.store.v2.CommitID 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_CommitID) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.store.v2.CommitID", 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_CommitID) 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_CommitID) 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_CommitID) 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_CommitID) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*CommitID) + 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.Version != 0 { + n += 1 + runtime.Sov(uint64(x.Version)) + } + l = len(x.Hash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*CommitID) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Hash) > 0 { + i -= len(x.Hash) + copy(dAtA[i:], x.Hash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) + i-- + dAtA[i] = 0x12 + } + if x.Version != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Version)) + 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().(*CommitID) + 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: CommitID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CommitID: 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 Version", wireType) + } + x.Version = 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.Version |= int64(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 Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Hash = append(x.Hash[:0], dAtA[iNdEx:postIndex]...) + if x.Hash == nil { + x.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: cosmos/store/v2/commit_info.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) +) + +// CommitInfo defines commit information used by the multi-store when committing +// a version/height. +type CommitInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + StoreInfos []*StoreInfo `protobuf:"bytes,2,rep,name=store_infos,json=storeInfos,proto3" json:"store_infos,omitempty"` + Timestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + CommitHash []byte `protobuf:"bytes,4,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"` +} + +func (x *CommitInfo) Reset() { + *x = CommitInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_store_v2_commit_info_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommitInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommitInfo) ProtoMessage() {} + +// Deprecated: Use CommitInfo.ProtoReflect.Descriptor instead. +func (*CommitInfo) Descriptor() ([]byte, []int) { + return file_cosmos_store_v2_commit_info_proto_rawDescGZIP(), []int{0} +} + +func (x *CommitInfo) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *CommitInfo) GetStoreInfos() []*StoreInfo { + if x != nil { + return x.StoreInfos + } + return nil +} + +func (x *CommitInfo) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + +func (x *CommitInfo) GetCommitHash() []byte { + if x != nil { + return x.CommitHash + } + return nil +} + +// StoreInfo defines store-specific commit information. It contains a reference +// between a store name and the commit ID. +type StoreInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + CommitId *CommitID `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` + Structure string `protobuf:"bytes,3,opt,name=structure,proto3" json:"structure,omitempty"` +} + +func (x *StoreInfo) Reset() { + *x = StoreInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_store_v2_commit_info_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StoreInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StoreInfo) ProtoMessage() {} + +// Deprecated: Use StoreInfo.ProtoReflect.Descriptor instead. +func (*StoreInfo) Descriptor() ([]byte, []int) { + return file_cosmos_store_v2_commit_info_proto_rawDescGZIP(), []int{1} +} + +func (x *StoreInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *StoreInfo) GetCommitId() *CommitID { + if x != nil { + return x.CommitId + } + return nil +} + +func (x *StoreInfo) GetStructure() string { + if x != nil { + return x.Structure + } + return "" +} + +// CommitID defines the commitment information when a specific store is +// committed. +type CommitID struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (x *CommitID) Reset() { + *x = CommitID{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_store_v2_commit_info_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommitID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommitID) ProtoMessage() {} + +// Deprecated: Use CommitID.ProtoReflect.Descriptor instead. +func (*CommitID) Descriptor() ([]byte, []int) { + return file_cosmos_store_v2_commit_info_proto_rawDescGZIP(), []int{2} +} + +func (x *CommitID) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *CommitID) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil +} + +var File_cosmos_store_v2_commit_info_proto protoreflect.FileDescriptor + +var file_cosmos_store_v2_commit_info_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, + 0x32, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, + 0x65, 0x2e, 0x76, 0x32, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc8, 0x01, 0x0a, 0x0a, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3b, 0x0a, 0x0b, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x5f, 0x69, 0x6e, + 0x66, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x73, 0x12, 0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x48, 0x61, 0x73, 0x68, 0x22, 0x75, 0x0a, 0x09, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x49, 0x44, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x12, + 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3e, 0x0a, + 0x08, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0xae, 0x01, + 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, + 0x72, 0x65, 0x2e, 0x76, 0x32, 0x42, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x32, 0x3b, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x76, 0x32, 0xa2, 0x02, 0x03, 0x43, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0f, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x1b, 0x43, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x56, 0x32, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x43, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cosmos_store_v2_commit_info_proto_rawDescOnce sync.Once + file_cosmos_store_v2_commit_info_proto_rawDescData = file_cosmos_store_v2_commit_info_proto_rawDesc +) + +func file_cosmos_store_v2_commit_info_proto_rawDescGZIP() []byte { + file_cosmos_store_v2_commit_info_proto_rawDescOnce.Do(func() { + file_cosmos_store_v2_commit_info_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_store_v2_commit_info_proto_rawDescData) + }) + return file_cosmos_store_v2_commit_info_proto_rawDescData +} + +var file_cosmos_store_v2_commit_info_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_cosmos_store_v2_commit_info_proto_goTypes = []interface{}{ + (*CommitInfo)(nil), // 0: cosmos.store.v2.CommitInfo + (*StoreInfo)(nil), // 1: cosmos.store.v2.StoreInfo + (*CommitID)(nil), // 2: cosmos.store.v2.CommitID + (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp +} +var file_cosmos_store_v2_commit_info_proto_depIdxs = []int32{ + 1, // 0: cosmos.store.v2.CommitInfo.store_infos:type_name -> cosmos.store.v2.StoreInfo + 3, // 1: cosmos.store.v2.CommitInfo.timestamp:type_name -> google.protobuf.Timestamp + 2, // 2: cosmos.store.v2.StoreInfo.commit_id:type_name -> cosmos.store.v2.CommitID + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_cosmos_store_v2_commit_info_proto_init() } +func file_cosmos_store_v2_commit_info_proto_init() { + if File_cosmos_store_v2_commit_info_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cosmos_store_v2_commit_info_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommitInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_store_v2_commit_info_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StoreInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_store_v2_commit_info_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommitID); 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_cosmos_store_v2_commit_info_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_cosmos_store_v2_commit_info_proto_goTypes, + DependencyIndexes: file_cosmos_store_v2_commit_info_proto_depIdxs, + MessageInfos: file_cosmos_store_v2_commit_info_proto_msgTypes, + }.Build() + File_cosmos_store_v2_commit_info_proto = out.File + file_cosmos_store_v2_commit_info_proto_rawDesc = nil + file_cosmos_store_v2_commit_info_proto_goTypes = nil + file_cosmos_store_v2_commit_info_proto_depIdxs = nil +} diff --git a/api/cosmos/tx/v1beta1/tx.pulsar.go b/api/cosmos/tx/v1beta1/tx.pulsar.go index 421b01037ad7..2231d938a4d8 100644 --- a/api/cosmos/tx/v1beta1/tx.pulsar.go +++ b/api/cosmos/tx/v1beta1/tx.pulsar.go @@ -3629,6 +3629,892 @@ func (x *fastReflection_TxBody) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_TxBodyCompat_1_list)(nil) + +type _TxBodyCompat_1_list struct { + list *[]*anypb.Any +} + +func (x *_TxBodyCompat_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_TxBodyCompat_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_TxBodyCompat_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*anypb.Any) + (*x.list)[i] = concreteValue +} + +func (x *_TxBodyCompat_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*anypb.Any) + *x.list = append(*x.list, concreteValue) +} + +func (x *_TxBodyCompat_1_list) AppendMutable() protoreflect.Value { + v := new(anypb.Any) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_TxBodyCompat_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_TxBodyCompat_1_list) NewElement() protoreflect.Value { + v := new(anypb.Any) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_TxBodyCompat_1_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_TxBodyCompat_1023_list)(nil) + +type _TxBodyCompat_1023_list struct { + list *[]*anypb.Any +} + +func (x *_TxBodyCompat_1023_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_TxBodyCompat_1023_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_TxBodyCompat_1023_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*anypb.Any) + (*x.list)[i] = concreteValue +} + +func (x *_TxBodyCompat_1023_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*anypb.Any) + *x.list = append(*x.list, concreteValue) +} + +func (x *_TxBodyCompat_1023_list) AppendMutable() protoreflect.Value { + v := new(anypb.Any) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_TxBodyCompat_1023_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_TxBodyCompat_1023_list) NewElement() protoreflect.Value { + v := new(anypb.Any) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_TxBodyCompat_1023_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_TxBodyCompat_2047_list)(nil) + +type _TxBodyCompat_2047_list struct { + list *[]*anypb.Any +} + +func (x *_TxBodyCompat_2047_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_TxBodyCompat_2047_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_TxBodyCompat_2047_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*anypb.Any) + (*x.list)[i] = concreteValue +} + +func (x *_TxBodyCompat_2047_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*anypb.Any) + *x.list = append(*x.list, concreteValue) +} + +func (x *_TxBodyCompat_2047_list) AppendMutable() protoreflect.Value { + v := new(anypb.Any) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_TxBodyCompat_2047_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_TxBodyCompat_2047_list) NewElement() protoreflect.Value { + v := new(anypb.Any) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_TxBodyCompat_2047_list) IsValid() bool { + return x.list != nil +} + +var ( + md_TxBodyCompat protoreflect.MessageDescriptor + fd_TxBodyCompat_messages protoreflect.FieldDescriptor + fd_TxBodyCompat_memo protoreflect.FieldDescriptor + fd_TxBodyCompat_timeout_height protoreflect.FieldDescriptor + fd_TxBodyCompat_extension_options protoreflect.FieldDescriptor + fd_TxBodyCompat_non_critical_extension_options protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_tx_v1beta1_tx_proto_init() + md_TxBodyCompat = File_cosmos_tx_v1beta1_tx_proto.Messages().ByName("TxBodyCompat") + fd_TxBodyCompat_messages = md_TxBodyCompat.Fields().ByName("messages") + fd_TxBodyCompat_memo = md_TxBodyCompat.Fields().ByName("memo") + fd_TxBodyCompat_timeout_height = md_TxBodyCompat.Fields().ByName("timeout_height") + fd_TxBodyCompat_extension_options = md_TxBodyCompat.Fields().ByName("extension_options") + fd_TxBodyCompat_non_critical_extension_options = md_TxBodyCompat.Fields().ByName("non_critical_extension_options") +} + +var _ protoreflect.Message = (*fastReflection_TxBodyCompat)(nil) + +type fastReflection_TxBodyCompat TxBodyCompat + +func (x *TxBodyCompat) ProtoReflect() protoreflect.Message { + return (*fastReflection_TxBodyCompat)(x) +} + +func (x *TxBodyCompat) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_TxBodyCompat_messageType fastReflection_TxBodyCompat_messageType +var _ protoreflect.MessageType = fastReflection_TxBodyCompat_messageType{} + +type fastReflection_TxBodyCompat_messageType struct{} + +func (x fastReflection_TxBodyCompat_messageType) Zero() protoreflect.Message { + return (*fastReflection_TxBodyCompat)(nil) +} +func (x fastReflection_TxBodyCompat_messageType) New() protoreflect.Message { + return new(fastReflection_TxBodyCompat) +} +func (x fastReflection_TxBodyCompat_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TxBodyCompat +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TxBodyCompat) Descriptor() protoreflect.MessageDescriptor { + return md_TxBodyCompat +} + +// 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_TxBodyCompat) Type() protoreflect.MessageType { + return _fastReflection_TxBodyCompat_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TxBodyCompat) New() protoreflect.Message { + return new(fastReflection_TxBodyCompat) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TxBodyCompat) Interface() protoreflect.ProtoMessage { + return (*TxBodyCompat)(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_TxBodyCompat) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Messages) != 0 { + value := protoreflect.ValueOfList(&_TxBodyCompat_1_list{list: &x.Messages}) + if !f(fd_TxBodyCompat_messages, value) { + return + } + } + if x.Memo != "" { + value := protoreflect.ValueOfString(x.Memo) + if !f(fd_TxBodyCompat_memo, value) { + return + } + } + if x.TimeoutHeight != uint64(0) { + value := protoreflect.ValueOfUint64(x.TimeoutHeight) + if !f(fd_TxBodyCompat_timeout_height, value) { + return + } + } + if len(x.ExtensionOptions) != 0 { + value := protoreflect.ValueOfList(&_TxBodyCompat_1023_list{list: &x.ExtensionOptions}) + if !f(fd_TxBodyCompat_extension_options, value) { + return + } + } + if len(x.NonCriticalExtensionOptions) != 0 { + value := protoreflect.ValueOfList(&_TxBodyCompat_2047_list{list: &x.NonCriticalExtensionOptions}) + if !f(fd_TxBodyCompat_non_critical_extension_options, 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_TxBodyCompat) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxBodyCompat.messages": + return len(x.Messages) != 0 + case "cosmos.tx.v1beta1.TxBodyCompat.memo": + return x.Memo != "" + case "cosmos.tx.v1beta1.TxBodyCompat.timeout_height": + return x.TimeoutHeight != uint64(0) + case "cosmos.tx.v1beta1.TxBodyCompat.extension_options": + return len(x.ExtensionOptions) != 0 + case "cosmos.tx.v1beta1.TxBodyCompat.non_critical_extension_options": + return len(x.NonCriticalExtensionOptions) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxBodyCompat")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxBodyCompat 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_TxBodyCompat) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxBodyCompat.messages": + x.Messages = nil + case "cosmos.tx.v1beta1.TxBodyCompat.memo": + x.Memo = "" + case "cosmos.tx.v1beta1.TxBodyCompat.timeout_height": + x.TimeoutHeight = uint64(0) + case "cosmos.tx.v1beta1.TxBodyCompat.extension_options": + x.ExtensionOptions = nil + case "cosmos.tx.v1beta1.TxBodyCompat.non_critical_extension_options": + x.NonCriticalExtensionOptions = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxBodyCompat")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxBodyCompat 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_TxBodyCompat) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.tx.v1beta1.TxBodyCompat.messages": + if len(x.Messages) == 0 { + return protoreflect.ValueOfList(&_TxBodyCompat_1_list{}) + } + listValue := &_TxBodyCompat_1_list{list: &x.Messages} + return protoreflect.ValueOfList(listValue) + case "cosmos.tx.v1beta1.TxBodyCompat.memo": + value := x.Memo + return protoreflect.ValueOfString(value) + case "cosmos.tx.v1beta1.TxBodyCompat.timeout_height": + value := x.TimeoutHeight + return protoreflect.ValueOfUint64(value) + case "cosmos.tx.v1beta1.TxBodyCompat.extension_options": + if len(x.ExtensionOptions) == 0 { + return protoreflect.ValueOfList(&_TxBodyCompat_1023_list{}) + } + listValue := &_TxBodyCompat_1023_list{list: &x.ExtensionOptions} + return protoreflect.ValueOfList(listValue) + case "cosmos.tx.v1beta1.TxBodyCompat.non_critical_extension_options": + if len(x.NonCriticalExtensionOptions) == 0 { + return protoreflect.ValueOfList(&_TxBodyCompat_2047_list{}) + } + listValue := &_TxBodyCompat_2047_list{list: &x.NonCriticalExtensionOptions} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxBodyCompat")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxBodyCompat 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_TxBodyCompat) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxBodyCompat.messages": + lv := value.List() + clv := lv.(*_TxBodyCompat_1_list) + x.Messages = *clv.list + case "cosmos.tx.v1beta1.TxBodyCompat.memo": + x.Memo = value.Interface().(string) + case "cosmos.tx.v1beta1.TxBodyCompat.timeout_height": + x.TimeoutHeight = value.Uint() + case "cosmos.tx.v1beta1.TxBodyCompat.extension_options": + lv := value.List() + clv := lv.(*_TxBodyCompat_1023_list) + x.ExtensionOptions = *clv.list + case "cosmos.tx.v1beta1.TxBodyCompat.non_critical_extension_options": + lv := value.List() + clv := lv.(*_TxBodyCompat_2047_list) + x.NonCriticalExtensionOptions = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxBodyCompat")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxBodyCompat 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_TxBodyCompat) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxBodyCompat.messages": + if x.Messages == nil { + x.Messages = []*anypb.Any{} + } + value := &_TxBodyCompat_1_list{list: &x.Messages} + return protoreflect.ValueOfList(value) + case "cosmos.tx.v1beta1.TxBodyCompat.extension_options": + if x.ExtensionOptions == nil { + x.ExtensionOptions = []*anypb.Any{} + } + value := &_TxBodyCompat_1023_list{list: &x.ExtensionOptions} + return protoreflect.ValueOfList(value) + case "cosmos.tx.v1beta1.TxBodyCompat.non_critical_extension_options": + if x.NonCriticalExtensionOptions == nil { + x.NonCriticalExtensionOptions = []*anypb.Any{} + } + value := &_TxBodyCompat_2047_list{list: &x.NonCriticalExtensionOptions} + return protoreflect.ValueOfList(value) + case "cosmos.tx.v1beta1.TxBodyCompat.memo": + panic(fmt.Errorf("field memo of message cosmos.tx.v1beta1.TxBodyCompat is not mutable")) + case "cosmos.tx.v1beta1.TxBodyCompat.timeout_height": + panic(fmt.Errorf("field timeout_height of message cosmos.tx.v1beta1.TxBodyCompat is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxBodyCompat")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxBodyCompat 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_TxBodyCompat) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.tx.v1beta1.TxBodyCompat.messages": + list := []*anypb.Any{} + return protoreflect.ValueOfList(&_TxBodyCompat_1_list{list: &list}) + case "cosmos.tx.v1beta1.TxBodyCompat.memo": + return protoreflect.ValueOfString("") + case "cosmos.tx.v1beta1.TxBodyCompat.timeout_height": + return protoreflect.ValueOfUint64(uint64(0)) + case "cosmos.tx.v1beta1.TxBodyCompat.extension_options": + list := []*anypb.Any{} + return protoreflect.ValueOfList(&_TxBodyCompat_1023_list{list: &list}) + case "cosmos.tx.v1beta1.TxBodyCompat.non_critical_extension_options": + list := []*anypb.Any{} + return protoreflect.ValueOfList(&_TxBodyCompat_2047_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.tx.v1beta1.TxBodyCompat")) + } + panic(fmt.Errorf("message cosmos.tx.v1beta1.TxBodyCompat 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_TxBodyCompat) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.tx.v1beta1.TxBodyCompat", 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_TxBodyCompat) 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_TxBodyCompat) 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_TxBodyCompat) 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_TxBodyCompat) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TxBodyCompat) + 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.Messages) > 0 { + for _, e := range x.Messages { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + l = len(x.Memo) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.TimeoutHeight != 0 { + n += 1 + runtime.Sov(uint64(x.TimeoutHeight)) + } + if len(x.ExtensionOptions) > 0 { + for _, e := range x.ExtensionOptions { + l = options.Size(e) + n += 2 + l + runtime.Sov(uint64(l)) + } + } + if len(x.NonCriticalExtensionOptions) > 0 { + for _, e := range x.NonCriticalExtensionOptions { + l = options.Size(e) + n += 2 + 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().(*TxBodyCompat) + 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.NonCriticalExtensionOptions) > 0 { + for iNdEx := len(x.NonCriticalExtensionOptions) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.NonCriticalExtensionOptions[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] = 0x7f + i-- + dAtA[i] = 0xfa + } + } + if len(x.ExtensionOptions) > 0 { + for iNdEx := len(x.ExtensionOptions) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ExtensionOptions[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] = 0x3f + i-- + dAtA[i] = 0xfa + } + } + if x.TimeoutHeight != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.TimeoutHeight)) + i-- + dAtA[i] = 0x18 + } + if len(x.Memo) > 0 { + i -= len(x.Memo) + copy(dAtA[i:], x.Memo) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Memo))) + i-- + dAtA[i] = 0x12 + } + if len(x.Messages) > 0 { + for iNdEx := len(x.Messages) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Messages[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().(*TxBodyCompat) + 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: TxBodyCompat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TxBodyCompat: 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 Messages", 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.Messages = append(x.Messages, &anypb.Any{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Messages[len(x.Messages)-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 Memo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Memo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) + } + x.TimeoutHeight = 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.TimeoutHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 1023: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExtensionOptions", 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.ExtensionOptions = append(x.ExtensionOptions, &anypb.Any{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ExtensionOptions[len(x.ExtensionOptions)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2047: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NonCriticalExtensionOptions", 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.NonCriticalExtensionOptions = append(x.NonCriticalExtensionOptions, &anypb.Any{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.NonCriticalExtensionOptions[len(x.NonCriticalExtensionOptions)-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 = (*_AuthInfo_1_list)(nil) type _AuthInfo_1_list struct { @@ -3704,7 +4590,7 @@ func (x *AuthInfo) ProtoReflect() protoreflect.Message { } func (x *AuthInfo) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[5] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4305,7 +5191,7 @@ func (x *SignerInfo) ProtoReflect() protoreflect.Message { } func (x *SignerInfo) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[6] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4865,7 +5751,7 @@ func (x *ModeInfo) ProtoReflect() protoreflect.Message { } func (x *ModeInfo) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[7] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5441,7 +6327,7 @@ func (x *ModeInfo_Single) ProtoReflect() protoreflect.Message { } func (x *ModeInfo_Single) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[11] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5898,7 +6784,7 @@ func (x *ModeInfo_Multi) ProtoReflect() protoreflect.Message { } func (x *ModeInfo_Multi) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[12] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6475,7 +7361,7 @@ func (x *Fee) ProtoReflect() protoreflect.Message { } func (x *Fee) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[8] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7141,7 +8027,7 @@ func (x *Tip) ProtoReflect() protoreflect.Message { } func (x *Tip) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[9] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7652,7 +8538,7 @@ func (x *AuxSignerData) ProtoReflect() protoreflect.Message { } func (x *AuxSignerData) slowProtoReflect() protoreflect.Message { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[10] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8648,6 +9534,96 @@ func (x *TxBody) GetNonCriticalExtensionOptions() []*anypb.Any { return nil } +// TxBodyCompat is the body of a transaction that all signers sign over. +// This message is used to represent the transaction body before the unordered +// features was added. It is used to support backwards compatibility when user a newer +// client with an older chain. +type TxBodyCompat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // messages is a list of messages to be executed. The required signers of + // those messages define the number and order of elements in AuthInfo's + // signer_infos and Tx's signatures. Each required signer address is added to + // the list only the first time it occurs. + // By convention, the first required signer (usually from the first message) + // is referred to as the primary signer and pays the fee for the whole + // transaction. + Messages []*anypb.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + // memo is any arbitrary note/comment to be added to the transaction. + // WARNING: in clients, any publicly exposed text should not be called memo, + // but should be called `note` instead (see + // https://github.com/cosmos/cosmos-sdk/issues/9122). + Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` + // timeout_height is the block height after which this transaction will not + // be processed by the chain. + TimeoutHeight uint64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, the transaction will be rejected + ExtensionOptions []*anypb.Any `protobuf:"bytes,1023,rep,name=extension_options,json=extensionOptions,proto3" json:"extension_options,omitempty"` + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, they will be ignored + NonCriticalExtensionOptions []*anypb.Any `protobuf:"bytes,2047,rep,name=non_critical_extension_options,json=nonCriticalExtensionOptions,proto3" json:"non_critical_extension_options,omitempty"` +} + +func (x *TxBodyCompat) Reset() { + *x = TxBodyCompat{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TxBodyCompat) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxBodyCompat) ProtoMessage() {} + +// Deprecated: Use TxBodyCompat.ProtoReflect.Descriptor instead. +func (*TxBodyCompat) Descriptor() ([]byte, []int) { + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{5} +} + +func (x *TxBodyCompat) GetMessages() []*anypb.Any { + if x != nil { + return x.Messages + } + return nil +} + +func (x *TxBodyCompat) GetMemo() string { + if x != nil { + return x.Memo + } + return "" +} + +func (x *TxBodyCompat) GetTimeoutHeight() uint64 { + if x != nil { + return x.TimeoutHeight + } + return 0 +} + +func (x *TxBodyCompat) GetExtensionOptions() []*anypb.Any { + if x != nil { + return x.ExtensionOptions + } + return nil +} + +func (x *TxBodyCompat) GetNonCriticalExtensionOptions() []*anypb.Any { + if x != nil { + return x.NonCriticalExtensionOptions + } + return nil +} + // AuthInfo describes the fee and signer modes that are used to sign a // transaction. type AuthInfo struct { @@ -8677,7 +9653,7 @@ type AuthInfo struct { func (x *AuthInfo) Reset() { *x = AuthInfo{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[5] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8691,7 +9667,7 @@ func (*AuthInfo) ProtoMessage() {} // Deprecated: Use AuthInfo.ProtoReflect.Descriptor instead. func (*AuthInfo) Descriptor() ([]byte, []int) { - return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{5} + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{6} } func (x *AuthInfo) GetSignerInfos() []*SignerInfo { @@ -8739,7 +9715,7 @@ type SignerInfo struct { func (x *SignerInfo) Reset() { *x = SignerInfo{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[6] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8753,7 +9729,7 @@ func (*SignerInfo) ProtoMessage() {} // Deprecated: Use SignerInfo.ProtoReflect.Descriptor instead. func (*SignerInfo) Descriptor() ([]byte, []int) { - return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{6} + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{7} } func (x *SignerInfo) GetPublicKey() *anypb.Any { @@ -8796,7 +9772,7 @@ type ModeInfo struct { func (x *ModeInfo) Reset() { *x = ModeInfo{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[7] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8810,7 +9786,7 @@ func (*ModeInfo) ProtoMessage() {} // Deprecated: Use ModeInfo.ProtoReflect.Descriptor instead. func (*ModeInfo) Descriptor() ([]byte, []int) { - return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{7} + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{8} } func (x *ModeInfo) GetSum() isModeInfo_Sum { @@ -8880,7 +9856,7 @@ type Fee struct { func (x *Fee) Reset() { *x = Fee{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[8] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8894,7 +9870,7 @@ func (*Fee) ProtoMessage() {} // Deprecated: Use Fee.ProtoReflect.Descriptor instead. func (*Fee) Descriptor() ([]byte, []int) { - return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{8} + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{9} } func (x *Fee) GetAmount() []*v1beta12.Coin { @@ -8942,7 +9918,7 @@ type Tip struct { func (x *Tip) Reset() { *x = Tip{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[9] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8956,7 +9932,7 @@ func (*Tip) ProtoMessage() {} // Deprecated: Use Tip.ProtoReflect.Descriptor instead. func (*Tip) Descriptor() ([]byte, []int) { - return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{9} + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{10} } func (x *Tip) GetAmount() []*v1beta12.Coin { @@ -8999,7 +9975,7 @@ type AuxSignerData struct { func (x *AuxSignerData) Reset() { *x = AuxSignerData{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[10] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9013,7 +9989,7 @@ func (*AuxSignerData) ProtoMessage() {} // Deprecated: Use AuxSignerData.ProtoReflect.Descriptor instead. func (*AuxSignerData) Descriptor() ([]byte, []int) { - return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{10} + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{11} } func (x *AuxSignerData) GetAddress() string { @@ -9059,7 +10035,7 @@ type ModeInfo_Single struct { func (x *ModeInfo_Single) Reset() { *x = ModeInfo_Single{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[11] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9073,7 +10049,7 @@ func (*ModeInfo_Single) ProtoMessage() {} // Deprecated: Use ModeInfo_Single.ProtoReflect.Descriptor instead. func (*ModeInfo_Single) Descriptor() ([]byte, []int) { - return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{7, 0} + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{8, 0} } func (x *ModeInfo_Single) GetMode() v1beta1.SignMode { @@ -9099,7 +10075,7 @@ type ModeInfo_Multi struct { func (x *ModeInfo_Multi) Reset() { *x = ModeInfo_Multi{} if protoimpl.UnsafeEnabled { - mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[12] + mi := &file_cosmos_tx_v1beta1_tx_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9113,7 +10089,7 @@ func (*ModeInfo_Multi) ProtoMessage() {} // Deprecated: Use ModeInfo_Multi.ProtoReflect.Descriptor instead. func (*ModeInfo_Multi) Descriptor() ([]byte, []int) { - return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{7, 1} + return file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP(), []int{8, 1} } func (x *ModeInfo_Multi) GetBitarray() *v1beta11.CompactBitArray { @@ -9218,105 +10194,123 @@ var file_cosmos_tx_v1beta1_tx_proto_rawDesc = []byte{ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x1b, 0x6e, 0x6f, 0x6e, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0xb7, 0x01, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x40, 0x0a, 0x0c, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x12, 0x28, - 0x0a, 0x03, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, + 0x9b, 0x02, 0x0a, 0x0c, 0x54, 0x78, 0x42, 0x6f, 0x64, 0x79, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, + 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, + 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x42, 0x0a, + 0x11, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0xff, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x10, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x5a, 0x0a, 0x1e, 0x6e, 0x6f, 0x6e, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, + 0x6c, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0xff, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, + 0x52, 0x1b, 0x6e, 0x6f, 0x6e, 0x43, 0x72, 0x69, 0x74, 0x69, 0x63, 0x61, 0x6c, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb7, 0x01, + 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x40, 0x0a, 0x0c, 0x73, 0x69, + 0x67, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x12, 0x28, 0x0a, 0x03, + 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x46, 0x65, + 0x65, 0x52, 0x03, 0x66, 0x65, 0x65, 0x12, 0x3f, 0x0a, 0x03, 0x74, 0x69, 0x70, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x69, 0x70, 0x42, 0x15, 0xda, 0xb4, 0x2d, + 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, 0x34, 0x36, + 0x18, 0x01, 0x52, 0x03, 0x74, 0x69, 0x70, 0x22, 0x97, 0x01, 0x0a, 0x0a, 0x53, 0x69, 0x67, 0x6e, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, + 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x09, 0x6d, + 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6d, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x22, 0xe0, 0x02, 0x0a, 0x08, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x3c, + 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x69, 0x6e, 0x67, + 0x6c, 0x65, 0x48, 0x00, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x39, 0x0a, 0x05, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x46, 0x65, 0x65, 0x52, 0x03, 0x66, 0x65, 0x65, 0x12, 0x3f, 0x0a, 0x03, 0x74, 0x69, 0x70, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, - 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x69, 0x70, 0x42, 0x15, 0xda, - 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, - 0x34, 0x36, 0x18, 0x01, 0x52, 0x03, 0x74, 0x69, 0x70, 0x22, 0x97, 0x01, 0x0a, 0x0a, 0x53, 0x69, - 0x67, 0x6e, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, - 0x6e, 0x79, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x38, 0x0a, - 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6d, - 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, - 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, - 0x6e, 0x63, 0x65, 0x22, 0xe0, 0x02, 0x0a, 0x08, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x3c, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x12, 0x39, - 0x0a, 0x05, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, - 0x48, 0x00, 0x52, 0x05, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x1a, 0x41, 0x0a, 0x06, 0x53, 0x69, 0x6e, - 0x67, 0x6c, 0x65, 0x12, 0x37, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, 0x69, - 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x1a, 0x90, 0x01, 0x0a, - 0x05, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x12, 0x4b, 0x0a, 0x08, 0x62, 0x69, 0x74, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, - 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x63, - 0x74, 0x42, 0x69, 0x74, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x08, 0x62, 0x69, 0x74, 0x61, 0x72, - 0x72, 0x61, 0x79, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x42, - 0x05, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x22, 0x81, 0x02, 0x0a, 0x03, 0x46, 0x65, 0x65, 0x12, 0x79, - 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, - 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, - 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, - 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x61, 0x73, - 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x67, 0x61, - 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x70, 0x61, 0x79, 0x65, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x48, 0x00, + 0x52, 0x05, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x1a, 0x41, 0x0a, 0x06, 0x53, 0x69, 0x6e, 0x67, 0x6c, + 0x65, 0x12, 0x37, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, 0x69, 0x67, 0x6e, + 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x1a, 0x90, 0x01, 0x0a, 0x05, 0x4d, + 0x75, 0x6c, 0x74, 0x69, 0x12, 0x4b, 0x0a, 0x08, 0x62, 0x69, 0x74, 0x61, 0x72, 0x72, 0x61, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x73, 0x69, 0x67, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0x42, + 0x69, 0x74, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x08, 0x62, 0x69, 0x74, 0x61, 0x72, 0x72, 0x61, + 0x79, 0x12, 0x3a, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, + 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x42, 0x05, 0x0a, + 0x03, 0x73, 0x75, 0x6d, 0x22, 0x81, 0x02, 0x0a, 0x03, 0x46, 0x65, 0x65, 0x12, 0x79, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, + 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x70, 0x61, 0x79, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x70, + 0x61, 0x79, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, - 0x05, 0x70, 0x61, 0x79, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x22, 0xc9, 0x01, 0x0a, 0x03, 0x54, 0x69, 0x70, + 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, 0xde, 0x1f, + 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, + 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, 0xe7, 0xb0, + 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, + 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x74, + 0x69, 0x70, 0x70, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x3a, 0x15, 0xd2, + 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, + 0x34, 0x36, 0x18, 0x01, 0x22, 0xe3, 0x01, 0x0a, 0x0d, 0x41, 0x75, 0x78, 0x53, 0x69, 0x67, 0x6e, + 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x07, 0x67, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x72, 0x22, 0xc9, 0x01, 0x0a, 0x03, 0x54, - 0x69, 0x70, 0x12, 0x79, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x46, 0xc8, - 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, - 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x9a, - 0xe7, 0xb0, 0x2a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x73, - 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x30, 0x0a, - 0x06, 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, - 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x3a, - 0x15, 0xd2, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, - 0x30, 0x2e, 0x34, 0x36, 0x18, 0x01, 0x22, 0xe3, 0x01, 0x0a, 0x0d, 0x41, 0x75, 0x78, 0x53, 0x69, - 0x67, 0x6e, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x08, - 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x64, 0x6f, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x44, 0x6f, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x41, 0x75, 0x78, 0x52, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x44, 0x6f, 0x63, 0x12, 0x37, 0x0a, 0x04, - 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x52, - 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x03, 0x73, 0x69, 0x67, 0x3a, 0x13, 0xd2, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, 0x34, 0x36, 0x42, 0xb4, 0x01, 0x0a, - 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x74, 0x78, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, - 0x02, 0x03, 0x43, 0x54, 0x58, 0xaa, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x54, - 0x78, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1d, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, - 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x54, 0x78, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3e, 0x0a, 0x08, 0x73, 0x69, + 0x67, 0x6e, 0x5f, 0x64, 0x6f, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x44, 0x6f, 0x63, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x41, 0x75, + 0x78, 0x52, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x44, 0x6f, 0x63, 0x12, 0x37, 0x0a, 0x04, 0x6d, 0x6f, + 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, + 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x03, 0x73, 0x69, 0x67, 0x3a, 0x13, 0xd2, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, 0x34, 0x36, 0x42, 0xb4, 0x01, 0x0a, 0x15, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x74, 0x78, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x74, 0x78, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x3b, 0x74, 0x78, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, + 0x43, 0x54, 0x58, 0xaa, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x54, 0x78, 0x2e, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x11, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1d, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x54, 0x78, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x54, 0x78, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -9331,55 +10325,59 @@ func file_cosmos_tx_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_tx_v1beta1_tx_proto_rawDescData } -var file_cosmos_tx_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_cosmos_tx_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_cosmos_tx_v1beta1_tx_proto_goTypes = []interface{}{ (*Tx)(nil), // 0: cosmos.tx.v1beta1.Tx (*TxRaw)(nil), // 1: cosmos.tx.v1beta1.TxRaw (*SignDoc)(nil), // 2: cosmos.tx.v1beta1.SignDoc (*SignDocDirectAux)(nil), // 3: cosmos.tx.v1beta1.SignDocDirectAux (*TxBody)(nil), // 4: cosmos.tx.v1beta1.TxBody - (*AuthInfo)(nil), // 5: cosmos.tx.v1beta1.AuthInfo - (*SignerInfo)(nil), // 6: cosmos.tx.v1beta1.SignerInfo - (*ModeInfo)(nil), // 7: cosmos.tx.v1beta1.ModeInfo - (*Fee)(nil), // 8: cosmos.tx.v1beta1.Fee - (*Tip)(nil), // 9: cosmos.tx.v1beta1.Tip - (*AuxSignerData)(nil), // 10: cosmos.tx.v1beta1.AuxSignerData - (*ModeInfo_Single)(nil), // 11: cosmos.tx.v1beta1.ModeInfo.Single - (*ModeInfo_Multi)(nil), // 12: cosmos.tx.v1beta1.ModeInfo.Multi - (*anypb.Any)(nil), // 13: google.protobuf.Any - (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp - (*v1beta12.Coin)(nil), // 15: cosmos.base.v1beta1.Coin - (v1beta1.SignMode)(0), // 16: cosmos.tx.signing.v1beta1.SignMode - (*v1beta11.CompactBitArray)(nil), // 17: cosmos.crypto.multisig.v1beta1.CompactBitArray + (*TxBodyCompat)(nil), // 5: cosmos.tx.v1beta1.TxBodyCompat + (*AuthInfo)(nil), // 6: cosmos.tx.v1beta1.AuthInfo + (*SignerInfo)(nil), // 7: cosmos.tx.v1beta1.SignerInfo + (*ModeInfo)(nil), // 8: cosmos.tx.v1beta1.ModeInfo + (*Fee)(nil), // 9: cosmos.tx.v1beta1.Fee + (*Tip)(nil), // 10: cosmos.tx.v1beta1.Tip + (*AuxSignerData)(nil), // 11: cosmos.tx.v1beta1.AuxSignerData + (*ModeInfo_Single)(nil), // 12: cosmos.tx.v1beta1.ModeInfo.Single + (*ModeInfo_Multi)(nil), // 13: cosmos.tx.v1beta1.ModeInfo.Multi + (*anypb.Any)(nil), // 14: google.protobuf.Any + (*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp + (*v1beta12.Coin)(nil), // 16: cosmos.base.v1beta1.Coin + (v1beta1.SignMode)(0), // 17: cosmos.tx.signing.v1beta1.SignMode + (*v1beta11.CompactBitArray)(nil), // 18: cosmos.crypto.multisig.v1beta1.CompactBitArray } var file_cosmos_tx_v1beta1_tx_proto_depIdxs = []int32{ 4, // 0: cosmos.tx.v1beta1.Tx.body:type_name -> cosmos.tx.v1beta1.TxBody - 5, // 1: cosmos.tx.v1beta1.Tx.auth_info:type_name -> cosmos.tx.v1beta1.AuthInfo - 13, // 2: cosmos.tx.v1beta1.SignDocDirectAux.public_key:type_name -> google.protobuf.Any - 9, // 3: cosmos.tx.v1beta1.SignDocDirectAux.tip:type_name -> cosmos.tx.v1beta1.Tip - 13, // 4: cosmos.tx.v1beta1.TxBody.messages:type_name -> google.protobuf.Any - 14, // 5: cosmos.tx.v1beta1.TxBody.timeout_timestamp:type_name -> google.protobuf.Timestamp - 13, // 6: cosmos.tx.v1beta1.TxBody.extension_options:type_name -> google.protobuf.Any - 13, // 7: cosmos.tx.v1beta1.TxBody.non_critical_extension_options:type_name -> google.protobuf.Any - 6, // 8: cosmos.tx.v1beta1.AuthInfo.signer_infos:type_name -> cosmos.tx.v1beta1.SignerInfo - 8, // 9: cosmos.tx.v1beta1.AuthInfo.fee:type_name -> cosmos.tx.v1beta1.Fee - 9, // 10: cosmos.tx.v1beta1.AuthInfo.tip:type_name -> cosmos.tx.v1beta1.Tip - 13, // 11: cosmos.tx.v1beta1.SignerInfo.public_key:type_name -> google.protobuf.Any - 7, // 12: cosmos.tx.v1beta1.SignerInfo.mode_info:type_name -> cosmos.tx.v1beta1.ModeInfo - 11, // 13: cosmos.tx.v1beta1.ModeInfo.single:type_name -> cosmos.tx.v1beta1.ModeInfo.Single - 12, // 14: cosmos.tx.v1beta1.ModeInfo.multi:type_name -> cosmos.tx.v1beta1.ModeInfo.Multi - 15, // 15: cosmos.tx.v1beta1.Fee.amount:type_name -> cosmos.base.v1beta1.Coin - 15, // 16: cosmos.tx.v1beta1.Tip.amount:type_name -> cosmos.base.v1beta1.Coin - 3, // 17: cosmos.tx.v1beta1.AuxSignerData.sign_doc:type_name -> cosmos.tx.v1beta1.SignDocDirectAux - 16, // 18: cosmos.tx.v1beta1.AuxSignerData.mode:type_name -> cosmos.tx.signing.v1beta1.SignMode - 16, // 19: cosmos.tx.v1beta1.ModeInfo.Single.mode:type_name -> cosmos.tx.signing.v1beta1.SignMode - 17, // 20: cosmos.tx.v1beta1.ModeInfo.Multi.bitarray:type_name -> cosmos.crypto.multisig.v1beta1.CompactBitArray - 7, // 21: cosmos.tx.v1beta1.ModeInfo.Multi.mode_infos:type_name -> cosmos.tx.v1beta1.ModeInfo - 22, // [22:22] is the sub-list for method output_type - 22, // [22:22] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name + 6, // 1: cosmos.tx.v1beta1.Tx.auth_info:type_name -> cosmos.tx.v1beta1.AuthInfo + 14, // 2: cosmos.tx.v1beta1.SignDocDirectAux.public_key:type_name -> google.protobuf.Any + 10, // 3: cosmos.tx.v1beta1.SignDocDirectAux.tip:type_name -> cosmos.tx.v1beta1.Tip + 14, // 4: cosmos.tx.v1beta1.TxBody.messages:type_name -> google.protobuf.Any + 15, // 5: cosmos.tx.v1beta1.TxBody.timeout_timestamp:type_name -> google.protobuf.Timestamp + 14, // 6: cosmos.tx.v1beta1.TxBody.extension_options:type_name -> google.protobuf.Any + 14, // 7: cosmos.tx.v1beta1.TxBody.non_critical_extension_options:type_name -> google.protobuf.Any + 14, // 8: cosmos.tx.v1beta1.TxBodyCompat.messages:type_name -> google.protobuf.Any + 14, // 9: cosmos.tx.v1beta1.TxBodyCompat.extension_options:type_name -> google.protobuf.Any + 14, // 10: cosmos.tx.v1beta1.TxBodyCompat.non_critical_extension_options:type_name -> google.protobuf.Any + 7, // 11: cosmos.tx.v1beta1.AuthInfo.signer_infos:type_name -> cosmos.tx.v1beta1.SignerInfo + 9, // 12: cosmos.tx.v1beta1.AuthInfo.fee:type_name -> cosmos.tx.v1beta1.Fee + 10, // 13: cosmos.tx.v1beta1.AuthInfo.tip:type_name -> cosmos.tx.v1beta1.Tip + 14, // 14: cosmos.tx.v1beta1.SignerInfo.public_key:type_name -> google.protobuf.Any + 8, // 15: cosmos.tx.v1beta1.SignerInfo.mode_info:type_name -> cosmos.tx.v1beta1.ModeInfo + 12, // 16: cosmos.tx.v1beta1.ModeInfo.single:type_name -> cosmos.tx.v1beta1.ModeInfo.Single + 13, // 17: cosmos.tx.v1beta1.ModeInfo.multi:type_name -> cosmos.tx.v1beta1.ModeInfo.Multi + 16, // 18: cosmos.tx.v1beta1.Fee.amount:type_name -> cosmos.base.v1beta1.Coin + 16, // 19: cosmos.tx.v1beta1.Tip.amount:type_name -> cosmos.base.v1beta1.Coin + 3, // 20: cosmos.tx.v1beta1.AuxSignerData.sign_doc:type_name -> cosmos.tx.v1beta1.SignDocDirectAux + 17, // 21: cosmos.tx.v1beta1.AuxSignerData.mode:type_name -> cosmos.tx.signing.v1beta1.SignMode + 17, // 22: cosmos.tx.v1beta1.ModeInfo.Single.mode:type_name -> cosmos.tx.signing.v1beta1.SignMode + 18, // 23: cosmos.tx.v1beta1.ModeInfo.Multi.bitarray:type_name -> cosmos.crypto.multisig.v1beta1.CompactBitArray + 8, // 24: cosmos.tx.v1beta1.ModeInfo.Multi.mode_infos:type_name -> cosmos.tx.v1beta1.ModeInfo + 25, // [25:25] is the sub-list for method output_type + 25, // [25:25] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name } func init() { file_cosmos_tx_v1beta1_tx_proto_init() } @@ -9449,7 +10447,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } file_cosmos_tx_v1beta1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthInfo); i { + switch v := v.(*TxBodyCompat); i { case 0: return &v.state case 1: @@ -9461,7 +10459,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } file_cosmos_tx_v1beta1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SignerInfo); i { + switch v := v.(*AuthInfo); i { case 0: return &v.state case 1: @@ -9473,7 +10471,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } file_cosmos_tx_v1beta1_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ModeInfo); i { + switch v := v.(*SignerInfo); i { case 0: return &v.state case 1: @@ -9485,7 +10483,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } file_cosmos_tx_v1beta1_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Fee); i { + switch v := v.(*ModeInfo); i { case 0: return &v.state case 1: @@ -9497,7 +10495,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } file_cosmos_tx_v1beta1_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Tip); i { + switch v := v.(*Fee); i { case 0: return &v.state case 1: @@ -9509,7 +10507,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } file_cosmos_tx_v1beta1_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuxSignerData); i { + switch v := v.(*Tip); i { case 0: return &v.state case 1: @@ -9521,7 +10519,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } file_cosmos_tx_v1beta1_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ModeInfo_Single); i { + switch v := v.(*AuxSignerData); i { case 0: return &v.state case 1: @@ -9533,6 +10531,18 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } file_cosmos_tx_v1beta1_tx_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ModeInfo_Single); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_tx_v1beta1_tx_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ModeInfo_Multi); i { case 0: return &v.state @@ -9545,7 +10555,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { } } } - file_cosmos_tx_v1beta1_tx_proto_msgTypes[7].OneofWrappers = []interface{}{ + file_cosmos_tx_v1beta1_tx_proto_msgTypes[8].OneofWrappers = []interface{}{ (*ModeInfo_Single_)(nil), (*ModeInfo_Multi_)(nil), } @@ -9555,7 +10565,7 @@ func file_cosmos_tx_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_tx_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/baseapp/abci_utils_test.go b/baseapp/abci_utils_test.go index aeb6a298e23e..3c52fbe28c94 100644 --- a/baseapp/abci_utils_test.go +++ b/baseapp/abci_utils_test.go @@ -4,6 +4,7 @@ import ( "bytes" "sort" "testing" + "time" abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" cmtprotocrypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" @@ -499,10 +500,10 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_NoOpMempoolTxSelection() tx := builder.GetTx() txBz, err := txConfig.TxEncoder()(tx) s.Require().NoError(err) - s.Require().Len(txBz, 165) + s.Require().Len(txBz, 152) txDataSize := int(cmttypes.ComputeProtoSizeForTxs([]cmttypes.Tx{txBz})) - s.Require().Equal(txDataSize, 168) + s.Require().Equal(155, txDataSize) testCases := map[string]struct { ctx sdk.Context @@ -533,7 +534,7 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_NoOpMempoolTxSelection() ctx: s.ctx, req: &abci.PrepareProposalRequest{ Txs: [][]byte{txBz, txBz, txBz, txBz, txBz}, - MaxTxBytes: 465, + MaxTxBytes: 464, }, expectedTxs: 2, }, @@ -595,24 +596,24 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_PriorityNonceMempoolTxSe testTxs := []testTx{ // test 1 - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`0`), [][]byte{secret1}, []uint64{1}), priority: 10}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`12345678910`), [][]byte{secret1}, []uint64{2}), priority: 10}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`22`), [][]byte{secret1}, []uint64{3}), priority: 10}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`32`), [][]byte{secret2}, []uint64{1}), priority: 8}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`0`), [][]byte{secret1}, []uint64{1}, false), priority: 10}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`12345678910`), [][]byte{secret1}, []uint64{2}, false), priority: 10}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`22`), [][]byte{secret1}, []uint64{3}, false), priority: 10}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`32`), [][]byte{secret2}, []uint64{1}, false), priority: 8}, // test 2 - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`4`), [][]byte{secret1, secret2}, []uint64{3, 3}), priority: 10}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`52345678910`), [][]byte{secret1, secret3}, []uint64{4, 3}), priority: 10}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`62`), [][]byte{secret1, secret4}, []uint64{5, 3}), priority: 8}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`72`), [][]byte{secret3, secret5}, []uint64{4, 3}), priority: 8}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`82`), [][]byte{secret2, secret6}, []uint64{4, 3}), priority: 8}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`4`), [][]byte{secret1, secret2}, []uint64{3, 3}, false), priority: 10}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`52345678910`), [][]byte{secret1, secret3}, []uint64{4, 3}, false), priority: 10}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`62`), [][]byte{secret1, secret4}, []uint64{5, 3}, false), priority: 8}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`72`), [][]byte{secret3, secret5}, []uint64{4, 3}, false), priority: 8}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`82`), [][]byte{secret2, secret6}, []uint64{4, 3}, false), priority: 8}, // test 3 - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`9`), [][]byte{secret3, secret4}, []uint64{3, 3}), priority: 10}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`1052345678910`), [][]byte{secret1, secret2}, []uint64{4, 4}), priority: 8}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`11`), [][]byte{secret1, secret2}, []uint64{5, 5}), priority: 8}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`9`), [][]byte{secret3, secret4}, []uint64{3, 3}, false), priority: 10}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`1052345678910`), [][]byte{secret1, secret2}, []uint64{4, 4}, false), priority: 8}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`11`), [][]byte{secret1, secret2}, []uint64{5, 5}, false), priority: 8}, // test 4 - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`1252345678910`), [][]byte{secret1}, []uint64{3}), priority: 10}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`13`), [][]byte{secret1}, []uint64{5}), priority: 10}, - {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`14`), [][]byte{secret1}, []uint64{6}), priority: 8}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`1252345678910`), [][]byte{secret1}, []uint64{3}, false), priority: 10}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`13`), [][]byte{secret1}, []uint64{5}, false), priority: 10}, + {tx: buildMsg(s.T(), txConfig, signingCtx.AddressCodec(), []byte(`14`), [][]byte{secret1}, []uint64{6}, false), priority: 8}, } for i := range testTxs { @@ -622,15 +623,15 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_PriorityNonceMempoolTxSe testTxs[i].size = int(cmttypes.ComputeProtoSizeForTxs([]cmttypes.Tx{bz})) } - s.Require().Equal(193, testTxs[0].size) - s.Require().Equal(203, testTxs[1].size) - s.Require().Equal(194, testTxs[2].size) - s.Require().Equal(194, testTxs[3].size) - s.Require().Equal(276, testTxs[4].size) - s.Require().Equal(286, testTxs[5].size) - s.Require().Equal(277, testTxs[6].size) - s.Require().Equal(277, testTxs[7].size) - s.Require().Equal(277, testTxs[8].size) + s.Require().Equal(180, testTxs[0].size) + s.Require().Equal(190, testTxs[1].size) + s.Require().Equal(181, testTxs[2].size) + s.Require().Equal(181, testTxs[3].size) + s.Require().Equal(263, testTxs[4].size) + s.Require().Equal(273, testTxs[5].size) + s.Require().Equal(264, testTxs[6].size) + s.Require().Equal(264, testTxs[7].size) + s.Require().Equal(264, testTxs[8].size) testCases := map[string]struct { ctx sdk.Context @@ -643,7 +644,7 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_PriorityNonceMempoolTxSe ctx: s.ctx, txInputs: []testTx{testTxs[0], testTxs[1], testTxs[2], testTxs[3]}, req: &abci.PrepareProposalRequest{ - MaxTxBytes: 193 + 194, + MaxTxBytes: 180 + 181, }, expectedTxs: []int{0, 3}, }, @@ -651,7 +652,7 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_PriorityNonceMempoolTxSe ctx: s.ctx, txInputs: []testTx{testTxs[4], testTxs[5], testTxs[6], testTxs[7], testTxs[8]}, req: &abci.PrepareProposalRequest{ - MaxTxBytes: 276 + 277, + MaxTxBytes: 263 + 264, }, expectedTxs: []int{4, 8}, }, @@ -660,7 +661,7 @@ func (s *ABCIUtilsTestSuite) TestDefaultProposalHandler_PriorityNonceMempoolTxSe ctx: s.ctx, txInputs: []testTx{testTxs[9], testTxs[10], testTxs[11]}, req: &abci.PrepareProposalRequest{ - MaxTxBytes: 276 + 277, + MaxTxBytes: 263 + 264, }, expectedTxs: []int{9}, }, @@ -722,7 +723,7 @@ func marshalDelimitedFn(msg proto.Message) ([]byte, error) { return buf.Bytes(), nil } -func buildMsg(t *testing.T, txConfig client.TxConfig, ac address.Codec, value []byte, secrets [][]byte, nonces []uint64) sdk.Tx { +func buildMsg(t *testing.T, txConfig client.TxConfig, ac address.Codec, value []byte, secrets [][]byte, nonces []uint64, unordered bool) sdk.Tx { t.Helper() builder := txConfig.NewTxBuilder() @@ -742,6 +743,11 @@ func buildMsg(t *testing.T, txConfig client.TxConfig, ac address.Codec, value [] addr, err := ac.BytesToString(signatures[0].PubKey.Bytes()) require.NoError(t, err) + builder.SetUnordered(unordered) + if unordered { + builder.SetTimeoutTimestamp(time.Now().Add(time.Hour)) + } + _ = builder.SetMsgs( &baseapptestutil.MsgKeyValue{ Signer: addr, diff --git a/client/grpc/reflection/reflection.pb.go b/client/grpc/reflection/reflection.pb.go index 2f159025d30f..d54b1f600157 100644 --- a/client/grpc/reflection/reflection.pb.go +++ b/client/grpc/reflection/reflection.pb.go @@ -114,7 +114,7 @@ func (m *ListAllInterfacesResponse) GetInterfaceNames() []string { // ListImplementationsRequest is the request type of the ListImplementations // RPC. type ListImplementationsRequest struct { - // interface_name defines the interface to query the implementations. + // interface_name defines the interface to query the implementations for. InterfaceName string `protobuf:"bytes,1,opt,name=interface_name,json=interfaceName,proto3" json:"interface_name,omitempty"` } diff --git a/client/v2/autocli/testdata/flatten-output.golden b/client/v2/autocli/testdata/flatten-output.golden index 59b3c668d4c2..7b19e08d2906 100644 --- a/client/v2/autocli/testdata/flatten-output.golden +++ b/client/v2/autocli/testdata/flatten-output.golden @@ -1 +1 @@ -{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgUpdateParams","authority":"cosmos1y74p8wyy4enfhfn342njve6cjmj5c8dtl6emdk","params":{"send_enabled":[{"denom":"stake","enabled":true}],"default_send_enabled":true}}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"1970-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":[]} +{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgUpdateParams","authority":"cosmos1y74p8wyy4enfhfn342njve6cjmj5c8dtl6emdk","params":{"send_enabled":[{"denom":"stake","enabled":true}],"default_send_enabled":true}}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":null,"extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":[]} diff --git a/client/v2/autocli/testdata/msg-output.golden b/client/v2/autocli/testdata/msg-output.golden index b08520d20038..0e171b2bcde7 100644 --- a/client/v2/autocli/testdata/msg-output.golden +++ b/client/v2/autocli/testdata/msg-output.golden @@ -1 +1 @@ -{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1y74p8wyy4enfhfn342njve6cjmj5c8dtl6emdk","to_address":"cosmos1y74p8wyy4enfhfn342njve6cjmj5c8dtl6emdk","amount":[{"denom":"foo","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":"1970-01-01T00:00:00Z","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":[]} \ No newline at end of file +{"body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"cosmos1y74p8wyy4enfhfn342njve6cjmj5c8dtl6emdk","to_address":"cosmos1y74p8wyy4enfhfn342njve6cjmj5c8dtl6emdk","amount":[{"denom":"foo","amount":"1"}]}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":null,"extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":[]} \ No newline at end of file diff --git a/client/v2/go.mod b/client/v2/go.mod index 54efcd62112f..4758b57738b5 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/client/v2 go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 diff --git a/client/v2/go.sum b/client/v2/go.sum index 66d3016cf667..56ff7abbab1d 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/codec/proto_codec.go b/codec/proto_codec.go index 2c0c081896b1..89629b3625ee 100644 --- a/codec/proto_codec.go +++ b/codec/proto_codec.go @@ -21,13 +21,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" ) -// ProtoCodecMarshaler defines an interface for codecs that utilize Protobuf for both -// binary and JSON encoding. -// Deprecated: Use Codec instead. -type ProtoCodecMarshaler interface { - Codec -} - // ProtoCodec defines a codec that utilizes Protobuf for both binary and JSON // encoding. type ProtoCodec struct { diff --git a/core/testing/context.go b/core/testing/context.go index 39218f1f90f6..bd036705bcef 100644 --- a/core/testing/context.go +++ b/core/testing/context.go @@ -4,21 +4,65 @@ import ( "context" "cosmossdk.io/core/event" + "cosmossdk.io/core/gas" + "cosmossdk.io/core/header" "cosmossdk.io/core/store" "cosmossdk.io/core/transaction" ) type dummyKey struct{} -func Context() context.Context { +var _ context.Context = &TestContext{} + +type TestContext struct { + context.Context +} + +func Context() TestContext { dummy := &dummyCtx{ stores: map[string]store.KVStore{}, events: map[string][]event.Event{}, protoEvents: map[string][]transaction.Msg{}, + header: header.Info{}, + execMode: transaction.ExecModeFinalize, + gasConfig: gas.GasConfig{}, + gasMeter: nil, + } + + return TestContext{ + Context: context.WithValue(context.Background(), dummyKey{}, dummy), + } +} + +// WithHeaderInfo sets the header on a testing ctx and returns the updated ctx. +func (t TestContext) WithHeaderInfo(info header.Info) TestContext { + dummy := unwrap(t.Context) + dummy.header = info + + return TestContext{ + Context: context.WithValue(t.Context, dummyKey{}, dummy), } +} + +// WithExecMode sets the exec mode on a testing ctx and returns the updated ctx. +func (t TestContext) WithExecMode(mode transaction.ExecMode) TestContext { + dummy := unwrap(t.Context) + dummy.execMode = mode - ctx := context.WithValue(context.Background(), dummyKey{}, dummy) - return ctx + return TestContext{ + Context: context.WithValue(t.Context, dummyKey{}, dummy), + } +} + +// WithGas sets the gas config and meter on a testing ctx and returns the updated ctx. +func (t TestContext) WithGas(gasConfig gas.GasConfig, gasMeter gas.Meter) TestContext { + dummy := unwrap(t.Context) + dummy.gasConfig = gasConfig + dummy.gasMeter = gasMeter + + return TestContext{ + Context: context.WithValue(t.Context, dummyKey{}, dummy), + } } type dummyCtx struct { @@ -28,6 +72,12 @@ type dummyCtx struct { events map[string][]event.Event // maps proto events emitted by the actor. protoEvents map[string][]transaction.Msg + + header header.Info + execMode transaction.ExecMode + + gasMeter gas.Meter + gasConfig gas.GasConfig } func unwrap(ctx context.Context) *dummyCtx { diff --git a/core/testing/environment.go b/core/testing/environment.go new file mode 100644 index 000000000000..a89bbdb78f2d --- /dev/null +++ b/core/testing/environment.go @@ -0,0 +1,65 @@ +package coretesting + +import ( + "context" + + appmodulev2 "cosmossdk.io/core/appmodule/v2" + corecontext "cosmossdk.io/core/context" + corelog "cosmossdk.io/core/log" + "cosmossdk.io/core/router" + "cosmossdk.io/core/store" +) + +type TestEnvironmentConfig struct { + ModuleName string + Logger corelog.Logger + MsgRouter router.Service + QueryRouter router.Service +} + +type TestEnvironment struct { + appmodulev2.Environment + + testEventService TestEventService + testHeaderService TestHeaderService +} + +func NewTestEnvironment(cfg TestEnvironmentConfig) (TestContext, TestEnvironment) { + ctx := Context() + + testEventService := NewTestEventService(ctx, cfg.ModuleName) + testHeaderService := TestHeaderService{} + + env := TestEnvironment{ + Environment: appmodulev2.Environment{ + Logger: cfg.Logger, + BranchService: nil, + EventService: testEventService, + GasService: TestGasService{}, + HeaderService: testHeaderService, + QueryRouterService: cfg.QueryRouter, + MsgRouterService: cfg.MsgRouter, + TransactionService: TestTransactionService{}, + KVStoreService: KVStoreService(ctx, cfg.ModuleName), + MemStoreService: nil, + }, + testEventService: testEventService, + testHeaderService: testHeaderService, + } + + // set internal context to point to environment + ctx.Context = context.WithValue(ctx.Context, corecontext.EnvironmentContextKey, env.Environment) + return ctx, env +} + +func (env TestEnvironment) EventService() TestEventService { + return env.testEventService +} + +func (env TestEnvironment) KVStoreService() store.KVStoreService { + return env.Environment.KVStoreService +} + +func (env TestEnvironment) HeaderService() TestHeaderService { + return env.testHeaderService +} diff --git a/core/testing/event.go b/core/testing/event.go index 97385280fdda..d4f61aa2c850 100644 --- a/core/testing/event.go +++ b/core/testing/event.go @@ -7,29 +7,29 @@ import ( "cosmossdk.io/core/transaction" ) -var _ event.Service = (*MemEventsService)(nil) +var _ event.Service = &TestEventService{} -// EventsService attaches an event service to the context. +type TestEventService struct { + moduleName string +} + +// NewTestEventService attaches an event service to the context. // Adding an existing module will reset the events. -func EventsService(ctx context.Context, moduleName string) MemEventsService { +func NewTestEventService(ctx context.Context, moduleName string) TestEventService { unwrap(ctx).events[moduleName] = nil unwrap(ctx).protoEvents[moduleName] = nil - return MemEventsService{moduleName: moduleName} -} - -type MemEventsService struct { - moduleName string + return TestEventService{moduleName: moduleName} } -func (e MemEventsService) EventManager(ctx context.Context) event.Manager { +func (e TestEventService) EventManager(ctx context.Context) event.Manager { return eventManager{moduleName: e.moduleName, ctx: unwrap(ctx)} } -func (e MemEventsService) GetEvents(ctx context.Context) []event.Event { +func (e TestEventService) GetEvents(ctx context.Context) []event.Event { return unwrap(ctx).events[e.moduleName] } -func (e MemEventsService) GetProtoEvents(ctx context.Context) []transaction.Msg { +func (e TestEventService) GetProtoEvents(ctx context.Context) []transaction.Msg { return unwrap(ctx).protoEvents[e.moduleName] } diff --git a/core/testing/gas.go b/core/testing/gas.go new file mode 100644 index 000000000000..ba66b45fdfce --- /dev/null +++ b/core/testing/gas.go @@ -0,0 +1,23 @@ +package coretesting + +import ( + "context" + + "cosmossdk.io/core/gas" +) + +var _ gas.Service = &TestGasService{} + +type TestGasService struct{} + +func (m TestGasService) GasMeter(ctx context.Context) gas.Meter { + dummy := unwrap(ctx) + + return dummy.gasMeter +} + +func (m TestGasService) GasConfig(ctx context.Context) gas.GasConfig { + dummy := unwrap(ctx) + + return dummy.gasConfig +} diff --git a/core/testing/header.go b/core/testing/header.go new file mode 100644 index 000000000000..50ee97e3f828 --- /dev/null +++ b/core/testing/header.go @@ -0,0 +1,15 @@ +package coretesting + +import ( + "context" + + "cosmossdk.io/core/header" +) + +var _ header.Service = &TestHeaderService{} + +type TestHeaderService struct{} + +func (e TestHeaderService) HeaderInfo(ctx context.Context) header.Info { + return unwrap(ctx).header +} diff --git a/core/testing/services_test.go b/core/testing/services_test.go index 2f226e6e04c3..969f5fa8190a 100644 --- a/core/testing/services_test.go +++ b/core/testing/services_test.go @@ -6,8 +6,14 @@ import ( ) func TestKVStoreService(t *testing.T) { - ctx := Context() - svc1 := KVStoreService(ctx, "bank") + cfg := TestEnvironmentConfig{ + ModuleName: "bank", + Logger: nil, + MsgRouter: nil, + QueryRouter: nil, + } + ctx, env := NewTestEnvironment(cfg) + svc1 := env.KVStoreService() // must panic t.Run("must panic on invalid ctx", func(t *testing.T) { diff --git a/core/testing/transaction.go b/core/testing/transaction.go new file mode 100644 index 000000000000..689a3c932016 --- /dev/null +++ b/core/testing/transaction.go @@ -0,0 +1,17 @@ +package coretesting + +import ( + "context" + + "cosmossdk.io/core/transaction" +) + +var _ transaction.Service = &TestTransactionService{} + +type TestTransactionService struct{} + +func (m TestTransactionService) ExecMode(ctx context.Context) transaction.ExecMode { + dummy := unwrap(ctx) + + return dummy.execMode +} diff --git a/go.mod b/go.mod index 0cef5be0ed00..6683565ca0b8 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ go 1.23.2 module github.com/cosmos/cosmos-sdk require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/go.sum b/go.sum index f4bd67c5176d..97dae99d0e90 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/proto/cosmos/store/v2/commit_info.proto b/proto/cosmos/store/v2/commit_info.proto new file mode 100644 index 000000000000..18987f34e0ac --- /dev/null +++ b/proto/cosmos/store/v2/commit_info.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package cosmos.store.v2; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cosmossdk.io/store/v2/proof"; + +// CommitInfo defines commit information used by the multi-store when committing +// a version/height. +message CommitInfo { + int64 version = 1; + repeated StoreInfo store_infos = 2; + google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes commit_hash = 4; +} + +// StoreInfo defines store-specific commit information. It contains a reference +// between a store name and the commit ID. +// +message StoreInfo { + string name = 1; + CommitID commit_id = 2; + string structure = 3; +} + +// CommitID defines the commitment information when a specific store is +// committed. +message CommitID { + option (gogoproto.goproto_stringer) = false; + + int64 version = 1; + bytes hash = 2; +} diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/proto/cosmos/tx/v1beta1/tx.proto index 7b78cd6d07e4..322d7ac61463 100644 --- a/proto/cosmos/tx/v1beta1/tx.proto +++ b/proto/cosmos/tx/v1beta1/tx.proto @@ -143,6 +143,41 @@ message TxBody { repeated google.protobuf.Any non_critical_extension_options = 2047; } +// TxBodyCompat is the body of a transaction that all signers sign over. +// This message is used to represent the transaction body before the unordered +// features was added. It is used to support backwards compatibility when user a newer +// client with an older chain. +message TxBodyCompat { + // messages is a list of messages to be executed. The required signers of + // those messages define the number and order of elements in AuthInfo's + // signer_infos and Tx's signatures. Each required signer address is added to + // the list only the first time it occurs. + // By convention, the first required signer (usually from the first message) + // is referred to as the primary signer and pays the fee for the whole + // transaction. + repeated google.protobuf.Any messages = 1; + + // memo is any arbitrary note/comment to be added to the transaction. + // WARNING: in clients, any publicly exposed text should not be called memo, + // but should be called `note` instead (see + // https://github.com/cosmos/cosmos-sdk/issues/9122). + string memo = 2; + + // timeout_height is the block height after which this transaction will not + // be processed by the chain. + uint64 timeout_height = 3; + + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, the transaction will be rejected + repeated google.protobuf.Any extension_options = 1023; + + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, they will be ignored + repeated google.protobuf.Any non_critical_extension_options = 2047; +} + // AuthInfo describes the fee and signer modes that are used to sign a // transaction. message AuthInfo { diff --git a/schema/appdata/mux.go b/schema/appdata/mux.go index 1eab8b69a6fe..c7b60d631717 100644 --- a/schema/appdata/mux.go +++ b/schema/appdata/mux.go @@ -138,8 +138,8 @@ func ListenerMux(listeners ...Listener) Listener { } mux.onBatch = func(batch PacketBatch) error { - for _, listener := range listeners { - err := batch.apply(&listener) //nolint:gosec // aliasing is safe here + for i := range listeners { + err := batch.apply(&listeners[i]) if err != nil { return err } diff --git a/scripts/build/protobuf.mk b/scripts/build/protobuf.mk index 25d98b3f9538..7bcd7f60dbc3 100644 --- a/scripts/build/protobuf.mk +++ b/scripts/build/protobuf.mk @@ -1,4 +1,4 @@ -protoVer=0.15.2 +protoVer=0.15.3 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) diff --git a/scripts/init-simapp-v2.sh b/scripts/init-simapp-v2.sh index 3ad1eedc41b1..71d167001fec 100755 --- a/scripts/init-simapp-v2.sh +++ b/scripts/init-simapp-v2.sh @@ -11,7 +11,6 @@ $SIMD_BIN config set client keyring-backend test $SIMD_BIN config set client keyring-default-keyname alice $SIMD_BIN config set app rest.enable true $SIMD_BIN config set app telemetry.prometheus-retention-time 600 -$SIMD_BIN config set app store.options.sc-type iavl-v2 sed -i '' 's/timeout_commit = "5s"/timeout_commit = "1s"/' "$SIMD_HOME"/config/config.toml sed -i '' 's/prometheus = false/prometheus = true/' "$SIMD_HOME"/config/config.toml @@ -19,7 +18,7 @@ $SIMD_BIN keys add alice --indiscreet $SIMD_BIN keys add bob --indiscreet aliases="" for i in $(seq 10); do - alias=$(dd if=/dev/urandom bs=16 count=24 2> /dev/null | base32 | head -c 32) + alias=$(dd if=/dev/urandom bs=16 count=24 2> /dev/null | base64 | head -c 32) $SIMD_BIN keys add "$alias" --indiscreet aliases="$aliases $alias" done diff --git a/server/v2/api/grpcgateway/doc.go b/server/v2/api/grpcgateway/doc.go new file mode 100644 index 000000000000..cbdce577f2fc --- /dev/null +++ b/server/v2/api/grpcgateway/doc.go @@ -0,0 +1,11 @@ +// Package grpcgateway provides a custom http mux that utilizes the global gogoproto registry to match +// grpc gateway requests to query handlers. POST requests with JSON bodies and GET requests with query params are supported. +// Wildcard endpoints (i.e. foo/bar/{baz}), as well as catch-all endpoints (i.e. foo/bar/{baz=**} are supported. Using +// header `x-cosmos-block-height` allows you to specify a height for the query. +// +// The URL matching logic is achieved by building regular expressions from the gateway HTTP annotations. These regular expressions +// are then used to match against incoming requests to the HTTP server. +// +// In cases where the custom http mux is unable to handle the query (i.e. no match found), the request will fall back to the +// ServeMux from github.com/grpc-ecosystem/grpc-gateway/runtime. +package grpcgateway diff --git a/server/v2/api/grpcgateway/interceptor.go b/server/v2/api/grpcgateway/interceptor.go index 7119d452a9b9..ee8fc598ca0b 100644 --- a/server/v2/api/grpcgateway/interceptor.go +++ b/server/v2/api/grpcgateway/interceptor.go @@ -1,12 +1,19 @@ package grpcgateway import ( + "bytes" + "errors" + "io" "net/http" + "reflect" + "regexp" "strconv" "strings" gogoproto "github.com/cosmos/gogoproto/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "github.com/mitchellh/mapstructure" "google.golang.org/genproto/googleapis/api/annotations" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -18,18 +25,27 @@ import ( "cosmossdk.io/server/v2/appmanager" ) +const MaxBodySize = 1 << 20 // 1 MB + var _ http.Handler = &gatewayInterceptor[transaction.Tx]{} +// queryMetadata holds information related to handling gateway queries. +type queryMetadata struct { + // queryInputProtoName is the proto name of the query's input type. + queryInputProtoName string + // wildcardKeyNames are the wildcard key names from the query's HTTP annotation. + // for example /foo/bar/{baz}/{qux} would produce []string{"baz", "qux"} + // this is used for building the query's parameter map. + wildcardKeyNames []string +} + // gatewayInterceptor handles routing grpc-gateway queries to the app manager's query router. type gatewayInterceptor[T transaction.Tx] struct { logger log.Logger // gateway is the fallback grpc gateway mux handler. gateway *runtime.ServeMux - // customEndpointMapping is a mapping of custom GET options on proto RPC handlers, to the fully qualified method name. - // - // example: /cosmos/bank/v1beta1/denoms_metadata -> cosmos.bank.v1beta1.Query.DenomsMetadata - customEndpointMapping map[string]string + matcher uriMatcher // appManager is used to route queries to the application. appManager appmanager.AppManager[T] @@ -41,69 +57,145 @@ func newGatewayInterceptor[T transaction.Tx](logger log.Logger, gateway *runtime if err != nil { return nil, err } + // convert the mapping to regular expressions for URL matching. + wildcardMatchers, simpleMatchers := createRegexMapping(logger, getMapping) + matcher := uriMatcher{ + wildcardURIMatchers: wildcardMatchers, + simpleMatchers: simpleMatchers, + } return &gatewayInterceptor[T]{ - logger: logger, - gateway: gateway, - customEndpointMapping: getMapping, - appManager: am, + logger: logger, + gateway: gateway, + matcher: matcher, + appManager: am, }, nil } -// ServeHTTP implements the http.Handler interface. This function will attempt to match http requests to the -// interceptors internal mapping of http annotations to query request type names. -// If no match can be made, it falls back to the runtime gateway server mux. +// ServeHTTP implements the http.Handler interface. This method will attempt to match request URIs to its internal mapping +// of gateway HTTP annotations. If no match can be made, it falls back to the runtime gateway server mux. func (g *gatewayInterceptor[T]) ServeHTTP(writer http.ResponseWriter, request *http.Request) { g.logger.Debug("received grpc-gateway request", "request_uri", request.RequestURI) - match := matchURL(request.URL, g.customEndpointMapping) + match := g.matcher.matchURL(request.URL) if match == nil { // no match cases fall back to gateway mux. g.gateway.ServeHTTP(writer, request) return } + g.logger.Debug("matched request", "query_input", match.QueryInputName) - _, out := runtime.MarshalerForRequest(g.gateway, request) - var msg gogoproto.Message - var err error + in, out := runtime.MarshalerForRequest(g.gateway, request) + + // extract the proto message type. + msgType := gogoproto.MessageType(match.QueryInputName) + msg, ok := reflect.New(msgType.Elem()).Interface().(gogoproto.Message) + if !ok { + runtime.HTTPError(request.Context(), g.gateway, out, writer, request, status.Errorf(codes.Internal, "unable to to create gogoproto message from query input name %s", match.QueryInputName)) + return + } + + // msg population based on http method. + var inputMsg gogoproto.Message + var err error switch request.Method { - case http.MethodPost: - msg, err = createMessageFromJSON(match, request) case http.MethodGet: - msg, err = createMessage(match) + inputMsg, err = g.createMessageFromGetRequest(request, msg, match.Params) + case http.MethodPost: + inputMsg, err = g.createMessageFromPostRequest(in, request, msg) default: - runtime.DefaultHTTPProtoErrorHandler(request.Context(), g.gateway, out, writer, request, status.Error(codes.Unimplemented, "HTTP method must be POST or GET")) + runtime.HTTPError(request.Context(), g.gateway, out, writer, request, status.Error(codes.InvalidArgument, "HTTP method was not POST or GET")) return } if err != nil { - runtime.DefaultHTTPProtoErrorHandler(request.Context(), g.gateway, out, writer, request, err) + // the errors returned from the message creation methods return status errors. no need to make one here. + runtime.HTTPError(request.Context(), g.gateway, out, writer, request, err) return } - // extract block height header + // get the height from the header. var height uint64 heightStr := request.Header.Get(GRPCBlockHeightHeader) - if heightStr != "" { + heightStr = strings.Trim(heightStr, `\"`) + if heightStr != "" && heightStr != "latest" { height, err = strconv.ParseUint(heightStr, 10, 64) if err != nil { - err = status.Errorf(codes.InvalidArgument, "invalid height: %s", heightStr) - runtime.DefaultHTTPProtoErrorHandler(request.Context(), g.gateway, out, writer, request, err) + runtime.HTTPError(request.Context(), g.gateway, out, writer, request, status.Errorf(codes.InvalidArgument, "invalid height in header: %s", heightStr)) return } } - query, err := g.appManager.Query(request.Context(), height, msg) + responseMsg, err := g.appManager.Query(request.Context(), height, inputMsg) if err != nil { // if we couldn't find a handler for this request, just fall back to the gateway mux. if strings.Contains(err.Error(), "no handler") { g.gateway.ServeHTTP(writer, request) } else { // for all other errors, we just return the error. - runtime.DefaultHTTPProtoErrorHandler(request.Context(), g.gateway, out, writer, request, err) + runtime.HTTPError(request.Context(), g.gateway, out, writer, request, err) } return } + // for no errors, we forward the response. - runtime.ForwardResponseMessage(request.Context(), g.gateway, out, writer, request, query) + runtime.ForwardResponseMessage(request.Context(), g.gateway, out, writer, request, responseMsg) +} + +func (g *gatewayInterceptor[T]) createMessageFromPostRequest(marshaler runtime.Marshaler, req *http.Request, input gogoproto.Message) (gogoproto.Message, error) { + if req.ContentLength > MaxBodySize { + return nil, status.Errorf(codes.InvalidArgument, "request body too large: %d bytes, max=%d", req.ContentLength, MaxBodySize) + } + + // this block of code ensures that the body can be re-read. this is needed as if the query fails in the + // app's query handler, we need to pass the request back to the canonical gateway, which needs to be able to + // read the body again. + bodyBytes, err := io.ReadAll(req.Body) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "%v", err) + } + req.Body = io.NopCloser(bytes.NewReader(bodyBytes)) + + if err = marshaler.NewDecoder(bytes.NewReader(bodyBytes)).Decode(input); err != nil && !errors.Is(err, io.EOF) { + return nil, status.Errorf(codes.InvalidArgument, "%v", err) + } + + return input, nil +} + +func (g *gatewayInterceptor[T]) createMessageFromGetRequest(req *http.Request, input gogoproto.Message, wildcardValues map[string]string) (gogoproto.Message, error) { + // decode the path wildcards into the message. + decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ + Result: input, + TagName: "json", + WeaklyTypedInput: true, + }) + if err != nil { + return nil, status.Error(codes.Internal, "failed to create message decoder") + } + if err := decoder.Decode(wildcardValues); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + if err = req.ParseForm(); err != nil { + return nil, status.Errorf(codes.InvalidArgument, "%v", err) + } + + filter := filterFromPathParams(wildcardValues) + err = runtime.PopulateQueryParameters(input, req.Form, filter) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "%v", err) + } + + return input, err +} + +func filterFromPathParams(pathParams map[string]string) *utilities.DoubleArray { + var prefixPaths [][]string + + for k := range pathParams { + prefixPaths = append(prefixPaths, []string{k}) + } + + return utilities.NewDoubleArray(prefixPaths) } // getHTTPGetAnnotationMapping returns a mapping of RPC Method HTTP GET annotation to the RPC Handler's Request Input type full name. @@ -115,31 +207,74 @@ func getHTTPGetAnnotationMapping() (map[string]string, error) { return nil, err } - httpGets := make(map[string]string) + annotationToQueryInputName := make(map[string]string) protoFiles.RangeFiles(func(fd protoreflect.FileDescriptor) bool { for i := 0; i < fd.Services().Len(); i++ { serviceDesc := fd.Services().Get(i) for j := 0; j < serviceDesc.Methods().Len(); j++ { methodDesc := serviceDesc.Methods().Get(j) - - httpAnnotation := proto.GetExtension(methodDesc.Options(), annotations.E_Http) - if httpAnnotation == nil { + httpExtension := proto.GetExtension(methodDesc.Options(), annotations.E_Http) + if httpExtension == nil { continue } - httpRule, ok := httpAnnotation.(*annotations.HttpRule) + httpRule, ok := httpExtension.(*annotations.HttpRule) if !ok || httpRule == nil { continue } - if httpRule.GetGet() == "" { - continue + queryInputName := string(methodDesc.Input().FullName()) + httpRules := append(httpRule.GetAdditionalBindings(), httpRule) + for _, rule := range httpRules { + if httpAnnotation := rule.GetGet(); httpAnnotation != "" { + annotationToQueryInputName[httpAnnotation] = queryInputName + } + if httpAnnotation := rule.GetPost(); httpAnnotation != "" { + annotationToQueryInputName[httpAnnotation] = queryInputName + } } - - httpGets[httpRule.GetGet()] = string(methodDesc.Input().FullName()) } } return true }) + return annotationToQueryInputName, nil +} - return httpGets, nil +// createRegexMapping converts the annotationMapping (HTTP annotation -> query input type name) to a +// map of regular expressions for that HTTP annotation pattern, to queryMetadata. +func createRegexMapping(logger log.Logger, annotationMapping map[string]string) (map[*regexp.Regexp]queryMetadata, map[string]queryMetadata) { + wildcardMatchers := make(map[*regexp.Regexp]queryMetadata) + // seen patterns is a map of URI patterns to annotations. for simple queries (no wildcards) the annotation is used + // for the key. + seenPatterns := make(map[string]string) + simpleMatchers := make(map[string]queryMetadata) + + for annotation, queryInputName := range annotationMapping { + pattern, wildcardNames := patternToRegex(annotation) + if len(wildcardNames) == 0 { + if otherAnnotation, ok := seenPatterns[annotation]; ok { + // TODO: eventually we want this to error, but there is currently a duplicate in the protobuf. + // see: https://github.com/cosmos/cosmos-sdk/issues/23281 + logger.Warn("duplicate HTTP annotation found", "annotation1", annotation, "annotation2", otherAnnotation, "query_input_name", queryInputName) + } + simpleMatchers[annotation] = queryMetadata{ + queryInputProtoName: queryInputName, + wildcardKeyNames: nil, + } + seenPatterns[annotation] = annotation + } else { + reg := regexp.MustCompile(pattern) + if otherAnnotation, ok := seenPatterns[pattern]; ok { + // TODO: eventually we want this to error, but there is currently a duplicate in the protobuf. + // see: https://github.com/cosmos/cosmos-sdk/issues/23281 + logger.Warn("duplicate HTTP annotation found", "annotation1", annotation, "annotation2", otherAnnotation, "query_input_name", queryInputName) + } + wildcardMatchers[reg] = queryMetadata{ + queryInputProtoName: queryInputName, + wildcardKeyNames: wildcardNames, + } + seenPatterns[pattern] = annotation + + } + } + return wildcardMatchers, simpleMatchers } diff --git a/server/v2/api/grpcgateway/interceptor_test.go b/server/v2/api/grpcgateway/interceptor_test.go new file mode 100644 index 000000000000..80512f2c21df --- /dev/null +++ b/server/v2/api/grpcgateway/interceptor_test.go @@ -0,0 +1,313 @@ +package grpcgateway + +import ( + "bytes" + "encoding/json" + "net/http" + "net/http/httptest" + "testing" + + gogoproto "github.com/cosmos/gogoproto/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "cosmossdk.io/core/transaction" + "cosmossdk.io/log" +) + +func Test_createRegexMapping(t *testing.T) { + tests := []struct { + name string + annotations map[string]string + expectedRegex int + expectedSimple int + wantWarn bool + }{ + { + name: "no annotations should not warn", + }, + { + name: "expected correct amount of regex and simple matchers", + annotations: map[string]string{ + "/foo/bar/baz": "", + "/foo/{bar}/baz": "", + "/foo/bar/bell": "", + }, + expectedRegex: 1, + expectedSimple: 2, + }, + { + name: "different annotations should not warn", + annotations: map[string]string{ + "/foo/bar/{baz}": "", + "/crypto/{currency}": "", + }, + expectedRegex: 2, + }, + { + name: "duplicate annotations should warn", + annotations: map[string]string{ + "/hello/{world}": "", + "/hello/{developers}": "", + }, + expectedRegex: 2, + wantWarn: true, + }, + } + buf := bytes.NewBuffer(nil) + logger := log.NewLogger(buf) + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + regex, simple := createRegexMapping(logger, tt.annotations) + if tt.wantWarn { + require.NotEmpty(t, buf.String()) + } else { + require.Empty(t, buf.String()) + } + require.Equal(t, tt.expectedRegex, len(regex)) + require.Equal(t, tt.expectedSimple, len(simple)) + }) + } +} + +func TestCreateMessageFromGetRequest(t *testing.T) { + gogoproto.RegisterType(&DummyProto{}, dummyProtoName) + + testCases := []struct { + name string + request func() *http.Request + wildcardValues map[string]string + expected *DummyProto + wantErr bool + errCode codes.Code + }{ + { + name: "simple wildcard + query params", + request: func() *http.Request { + // GET with query params: ?bar=true&baz=42&denoms=atom&denoms=osmo + // Also nested pagination params: page.limit=100, page.nest.foo=999 + req := httptest.NewRequest( + http.MethodGet, + "/dummy?bar=true&baz=42&denoms=atom&denoms=osmo&page.limit=100&page.nest.foo=999", + nil, + ) + return req + }, + wildcardValues: map[string]string{ + "foo": "wildFooValue", // from path wildcard e.g. /dummy/{foo} + }, + expected: &DummyProto{ + Foo: "wildFooValue", + Bar: true, + Baz: 42, + Denoms: []string{"atom", "osmo"}, + Page: &Pagination{ + Limit: 100, + Nest: &Nested{ + Foo: 999, + }, + }, + }, + wantErr: false, + }, + { + name: "invalid integer in query param", + request: func() *http.Request { + req := httptest.NewRequest( + http.MethodGet, + "/dummy?baz=notanint", + nil, + ) + return req + }, + wildcardValues: map[string]string{}, + expected: &DummyProto{}, // won't get populated + wantErr: true, + errCode: codes.InvalidArgument, + }, + { + name: "no query params, but wildcard set", + request: func() *http.Request { + // No query params. Only the wildcard. + req := httptest.NewRequest( + http.MethodGet, + "/dummy", + nil, + ) + return req + }, + wildcardValues: map[string]string{ + "foo": "barFromWildcard", + }, + expected: &DummyProto{ + Foo: "barFromWildcard", + }, + wantErr: false, + }, + } + + // We only need a minimal gatewayInterceptor instance to call createMessageFromGetRequest, + // so it's fine to leave most fields nil for this unit test. + g := &gatewayInterceptor[transaction.Tx]{} + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + req := tc.request() + + inputMsg := &DummyProto{} + gotMsg, err := g.createMessageFromGetRequest( + req, + inputMsg, + tc.wildcardValues, + ) + + if tc.wantErr { + require.Error(t, err, "expected error but got none") + st, ok := status.FromError(err) + if ok && tc.errCode != codes.OK { + require.Equal(t, tc.errCode, st.Code()) + } + } else { + require.NoError(t, err, "unexpected error") + require.Equal(t, tc.expected, gotMsg, "message contents do not match expected") + } + }) + } +} + +func TestCreateMessageFromPostRequest(t *testing.T) { + gogoproto.RegisterType(&DummyProto{}, dummyProtoName) + gogoproto.RegisterType(&Pagination{}, "pagination") + gogoproto.RegisterType(&Nested{}, "nested") + + testCases := []struct { + name string + body any + wantErr bool + errCode codes.Code + expected *DummyProto + }{ + { + name: "valid JSON body with nested fields", + body: map[string]any{ + "foo": "postFoo", + "bar": true, + "baz": 42, + "denoms": []string{"atom", "osmo"}, + "page": map[string]any{ + "limit": 100, + "nest": map[string]any{ + "foo": 999, + }, + }, + }, + wantErr: false, + expected: &DummyProto{ + Foo: "postFoo", + Bar: true, + Baz: 42, + Denoms: []string{"atom", "osmo"}, + Page: &Pagination{ + Limit: 100, + Nest: &Nested{ + Foo: 999, + }, + }, + }, + }, + { + name: "invalid JSON structure", + // Provide a broken JSON string: + body: `{"foo": "bad json", "extra": "not closed"`, + wantErr: true, + errCode: codes.InvalidArgument, + }, + { + name: "empty JSON object", + body: map[string]any{}, + wantErr: false, + expected: &DummyProto{}, // all fields remain zeroed + }, + } + + g := &gatewayInterceptor[transaction.Tx]{} + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + var reqBody []byte + switch typedBody := tc.body.(type) { + case string: + // This might be invalid JSON we intentionally want to test + reqBody = []byte(typedBody) + default: + // Marshal the given any into JSON + b, err := json.Marshal(typedBody) + require.NoError(t, err, "failed to marshal test body to JSON") + reqBody = b + } + + req := httptest.NewRequest(http.MethodPost, "/dummy", bytes.NewReader(reqBody)) + + inputMsg := &DummyProto{} + gotMsg, err := g.createMessageFromPostRequest( + &runtime.JSONPb{}, // JSONPb marshaler + req, + inputMsg, + ) + + if tc.wantErr { + require.Error(t, err, "expected an error but got none") + // Optionally verify the gRPC status code + st, ok := status.FromError(err) + if ok && tc.errCode != codes.OK { + require.Equal(t, tc.errCode, st.Code()) + } + } else { + require.NoError(t, err, "did not expect an error") + require.Equal(t, tc.expected, gotMsg) + } + }) + } +} + +/* +--- Testing Types --- +*/ +type Nested struct { + Foo int32 `protobuf:"varint,1,opt,name=foo,proto3" json:"foo,omitempty"` +} + +func (n Nested) Reset() {} + +func (n Nested) String() string { return "" } + +func (n Nested) ProtoMessage() {} + +type Pagination struct { + Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` + Nest *Nested `protobuf:"bytes,2,opt,name=nest,proto3" json:"nest,omitempty"` +} + +func (p Pagination) Reset() {} + +func (p Pagination) String() string { return "" } + +func (p Pagination) ProtoMessage() {} + +const dummyProtoName = "dummy" + +type DummyProto struct { + Foo string `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty"` + Bar bool `protobuf:"varint,2,opt,name=bar,proto3" json:"bar,omitempty"` + Baz int32 `protobuf:"varint,3,opt,name=baz,proto3" json:"baz,omitempty"` + Denoms []string `protobuf:"bytes,4,rep,name=denoms,proto3" json:"denoms,omitempty"` + Page *Pagination `protobuf:"bytes,5,opt,name=page,proto3" json:"page,omitempty"` +} + +func (d DummyProto) Reset() {} + +func (d DummyProto) String() string { return dummyProtoName } + +func (d DummyProto) ProtoMessage() {} diff --git a/server/v2/api/grpcgateway/server.go b/server/v2/api/grpcgateway/server.go index 2aec6cad6387..59fb1b2ff1aa 100644 --- a/server/v2/api/grpcgateway/server.go +++ b/server/v2/api/grpcgateway/server.go @@ -59,7 +59,7 @@ func New[T transaction.Tx]( // marshaled in unary requests. runtime.WithProtoErrorHandler(runtime.DefaultHTTPProtoErrorHandler), - // Custom header matcher for mapping request headers to + // Custom header uriMatcher for mapping request headers to // GRPC metadata runtime.WithIncomingHeaderMatcher(CustomGRPCHeaderMatcher), ), diff --git a/server/v2/api/grpcgateway/uri.go b/server/v2/api/grpcgateway/uri.go index 6531447cf889..f5ebc25668fa 100644 --- a/server/v2/api/grpcgateway/uri.go +++ b/server/v2/api/grpcgateway/uri.go @@ -1,86 +1,65 @@ package grpcgateway import ( - "io" - "net/http" "net/url" - "reflect" "regexp" "strings" - - "github.com/cosmos/gogoproto/jsonpb" - gogoproto "github.com/cosmos/gogoproto/proto" - "github.com/mitchellh/mapstructure" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) -const maxBodySize = 1 << 20 // 1 MB +// uriMatcher provides functionality to match HTTP request URIs. +type uriMatcher struct { + // wildcardURIMatchers are used for complex URIs that involve wildcards (i.e. /foo/{bar}/baz) + wildcardURIMatchers map[*regexp.Regexp]queryMetadata + // simpleMatchers are used for simple URI's that have no wildcards (i.e. /foo/bar/baz). + simpleMatchers map[string]queryMetadata +} // uriMatch contains information related to a URI match. type uriMatch struct { // QueryInputName is the fully qualified name of the proto input type of the query rpc method. QueryInputName string - // Params are any wildcard/query params found in the request. + // Params are any wildcard params found in the request. // - // example: - // - foo/bar/{baz} - foo/bar/qux -> {baz: qux} - // - foo/bar?baz=qux - foo/bar -> {baz: qux} + // example: /foo/bar/{baz} -> /foo/bar/hello = {"baz": "hello"} Params map[string]string } -// HasParams reports whether the uriMatch has any params. -func (uri uriMatch) HasParams() bool { - return len(uri.Params) > 0 -} - // matchURL attempts to find a match for the given URL. // NOTE: if no match is found, nil is returned. -func matchURL(u *url.URL, getPatternToQueryInputName map[string]string) *uriMatch { +func (m uriMatcher) matchURL(u *url.URL) *uriMatch { uriPath := strings.TrimRight(u.Path, "/") - queryParams := u.Query() - params := make(map[string]string) - for key, vals := range queryParams { - if len(vals) > 0 { - // url.Values contains a slice for the values as you are able to specify a key multiple times in URL. - // example: https://localhost:9090/do/something?color=red&color=blue&color=green - // We will just take the first value in the slice. - params[key] = vals[0] - } - } - // for simple cases where there are no wildcards, we can just do a map lookup. - if inputName, ok := getPatternToQueryInputName[uriPath]; ok { + // see if we can get a simple match first. + if qmd, ok := m.simpleMatchers[uriPath]; ok { return &uriMatch{ - QueryInputName: inputName, + QueryInputName: qmd.queryInputProtoName, Params: params, } } - // attempt to find a match in the pattern map. - for getPattern, queryInputName := range getPatternToQueryInputName { - getPattern = strings.TrimRight(getPattern, "/") - - regexPattern, wildcardNames := patternToRegex(getPattern) - - regex := regexp.MustCompile(regexPattern) - matches := regex.FindStringSubmatch(uriPath) - - if len(matches) > 1 { - // first match is the full string, subsequent matches are capture groups - for i, name := range wildcardNames { + // try the complex matchers. + for reg, qmd := range m.wildcardURIMatchers { + matches := reg.FindStringSubmatch(uriPath) + switch { + case len(matches) == 1: + return &uriMatch{ + QueryInputName: qmd.queryInputProtoName, + Params: params, + } + case len(matches) > 1: + // first match is the URI, subsequent matches are the wild card values. + for i, name := range qmd.wildcardKeyNames { params[name] = matches[i+1] } return &uriMatch{ - QueryInputName: queryInputName, + QueryInputName: qmd.queryInputProtoName, Params: params, } } } - return nil } @@ -110,78 +89,3 @@ func patternToRegex(pattern string) (string, []string) { return "^" + escaped + "$", wildcardNames } - -// createMessageFromJSON creates a message from the uriMatch given the JSON body in the http request. -func createMessageFromJSON(match *uriMatch, r *http.Request) (gogoproto.Message, error) { - requestType := gogoproto.MessageType(match.QueryInputName) - if requestType == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request type") - } - - msg, ok := reflect.New(requestType.Elem()).Interface().(gogoproto.Message) - if !ok { - return nil, status.Error(codes.Internal, "failed to cast to proto message") - } - - defer r.Body.Close() - limitedReader := io.LimitReader(r.Body, maxBodySize) - err := jsonpb.Unmarshal(limitedReader, msg) - if err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - return msg, nil -} - -// createMessage creates a message from the given uriMatch. If the match has params, the message will be populated -// with the value of those params. Otherwise, an empty message is returned. -func createMessage(match *uriMatch) (gogoproto.Message, error) { - requestType := gogoproto.MessageType(match.QueryInputName) - if requestType == nil { - return nil, status.Error(codes.InvalidArgument, "unknown request type") - } - - msg, ok := reflect.New(requestType.Elem()).Interface().(gogoproto.Message) - if !ok { - return nil, status.Error(codes.Internal, "failed to create message instance") - } - - // if the uri match has params, we need to populate the message with the values of those params. - if match.HasParams() { - // convert flat params map to nested structure - nestedParams := make(map[string]any) - for key, value := range match.Params { - parts := strings.Split(key, ".") - current := nestedParams - - // step through nested levels - for i, part := range parts { - if i == len(parts)-1 { - // Last part - set the value - current[part] = value - } else { - // continue nestedness - if _, exists := current[part]; !exists { - current[part] = make(map[string]any) - } - current = current[part].(map[string]any) - } - } - } - - // Configure decoder to handle the nested structure - decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ - Result: msg, - TagName: "json", // Use json tags as they're simpler - WeaklyTypedInput: true, - }) - if err != nil { - return nil, status.Error(codes.Internal, "failed to create message instance") - } - - if err := decoder.Decode(nestedParams); err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - } - return msg, nil -} diff --git a/server/v2/api/grpcgateway/uri_test.go b/server/v2/api/grpcgateway/uri_test.go index 4bb74c39e40e..24d51fd59e54 100644 --- a/server/v2/api/grpcgateway/uri_test.go +++ b/server/v2/api/grpcgateway/uri_test.go @@ -1,15 +1,14 @@ package grpcgateway import ( - "bytes" - "encoding/json" - "io" - "net/http" "net/url" + "os" + "regexp" "testing" - gogoproto "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" + + "cosmossdk.io/log" ) func TestMatchURI(t *testing.T) { @@ -26,16 +25,22 @@ func TestMatchURI(t *testing.T) { expected: &uriMatch{QueryInputName: "query.Bank", Params: map[string]string{}}, }, { - name: "match with query parameters", - uri: "https://localhost:8080/foo/bar?baz=qux", - mapping: map[string]string{"/foo/bar": "query.Bank"}, - expected: &uriMatch{QueryInputName: "query.Bank", Params: map[string]string{"baz": "qux"}}, + name: "match with wildcard similar to simple match - simple", + uri: "https://localhost:8080/bank/supply/latest", + mapping: map[string]string{ + "/bank/supply/{height}": "queryBankHeight", + "/bank/supply/latest": "queryBankLatest", + }, + expected: &uriMatch{QueryInputName: "queryBankLatest", Params: map[string]string{}}, }, { - name: "match with multiple query parameters", - uri: "https://localhost:8080/foo/bar?baz=qux&foo=/msg.type.bank.send", - mapping: map[string]string{"/foo/bar": "query.Bank"}, - expected: &uriMatch{QueryInputName: "query.Bank", Params: map[string]string{"baz": "qux", "foo": "/msg.type.bank.send"}}, + name: "match with wildcard similar to simple match - wildcard", + uri: "https://localhost:8080/bank/supply/52", + mapping: map[string]string{ + "/bank/supply/{height}": "queryBankHeight", + "/bank/supply/latest": "queryBankLatest", + }, + expected: &uriMatch{QueryInputName: "queryBankHeight", Params: map[string]string{"height": "52"}}, }, { name: "wildcard match at the end", @@ -81,183 +86,86 @@ func TestMatchURI(t *testing.T) { }, } + logger := log.NewLogger(os.Stdout) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { u, err := url.Parse(tc.uri) require.NoError(t, err) - actual := matchURL(u, tc.mapping) + + regexpMatchers, simpleMatchers := createRegexMapping(logger, tc.mapping) + matcher := uriMatcher{ + wildcardURIMatchers: regexpMatchers, + simpleMatchers: simpleMatchers, + } + + actual := matcher.matchURL(u) require.Equal(t, tc.expected, actual) }) } } -func TestURIMatch_HasParams(t *testing.T) { - u := uriMatch{Params: map[string]string{"foo": "bar"}} - require.True(t, u.HasParams()) - - u = uriMatch{} - require.False(t, u.HasParams()) -} - -type Nested struct { - Foo int `protobuf:"varint,1,opt,name=foo,proto3" json:"foo,omitempty"` -} - -type Pagination struct { - Limit int `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` - Nest *Nested `protobuf:"bytes,2,opt,name=nest,proto3" json:"nest,omitempty"` -} - -const dummyProtoName = "dummy" - -type DummyProto struct { - Foo string `protobuf:"bytes,1,opt,name=foo,proto3" json:"foo,omitempty"` - Bar bool `protobuf:"varint,2,opt,name=bar,proto3" json:"bar,omitempty"` - Baz int `protobuf:"varint,3,opt,name=baz,proto3" json:"baz,omitempty"` - Page *Pagination `protobuf:"bytes,4,opt,name=page,proto3" json:"page,omitempty"` -} - -func (d DummyProto) Reset() {} - -func (d DummyProto) String() string { return dummyProtoName } - -func (d DummyProto) ProtoMessage() {} - -func TestCreateMessage(t *testing.T) { - gogoproto.RegisterType(&DummyProto{}, dummyProtoName) - - testCases := []struct { - name string - uri uriMatch - expected gogoproto.Message - expErr bool +func Test_patternToRegex(t *testing.T) { + tests := []struct { + name string + pattern string + wildcards []string + wildcardValues []string + shouldMatch string + shouldNotMatch []string }{ { - name: "simple, empty message", - uri: uriMatch{QueryInputName: dummyProtoName}, - expected: &DummyProto{}, + name: "simple match, no wildcards", + pattern: "/foo/bar/baz", + shouldMatch: "/foo/bar/baz", + shouldNotMatch: []string{"/foo/bar", "/foo", "/foo/bar/baz/boo"}, }, { - name: "message with params", - uri: uriMatch{ - QueryInputName: dummyProtoName, - Params: map[string]string{"foo": "blah", "bar": "true", "baz": "1352"}, - }, - expected: &DummyProto{ - Foo: "blah", - Bar: true, - Baz: 1352, - }, + name: "match with wildcard", + pattern: "/foo/bar/{baz}", + wildcards: []string{"baz"}, + shouldMatch: "/foo/bar/hello", + wildcardValues: []string{"hello"}, + shouldNotMatch: []string{"/foo/bar", "/foo/bar/baz/boo"}, }, { - name: "message with nested params", - uri: uriMatch{ - QueryInputName: dummyProtoName, - Params: map[string]string{"foo": "blah", "bar": "true", "baz": "1352", "page.limit": "3"}, - }, - expected: &DummyProto{ - Foo: "blah", - Bar: true, - Baz: 1352, - Page: &Pagination{Limit: 3}, - }, + name: "match with multiple wildcards", + pattern: "/foo/{bar}/{baz}/meow", + wildcards: []string{"bar", "baz"}, + shouldMatch: "/foo/hello/world/meow", + wildcardValues: []string{"hello", "world"}, + shouldNotMatch: []string{"/foo/bar/baz/boo", "/foo/bar/baz"}, }, { - name: "message with multi nested params", - uri: uriMatch{ - QueryInputName: dummyProtoName, - Params: map[string]string{"foo": "blah", "bar": "true", "baz": "1352", "page.limit": "3", "page.nest.foo": "5"}, - }, - expected: &DummyProto{ - Foo: "blah", - Bar: true, - Baz: 1352, - Page: &Pagination{Limit: 3, Nest: &Nested{Foo: 5}}, - }, - }, - { - name: "invalid params should error out", - uri: uriMatch{ - QueryInputName: dummyProtoName, - Params: map[string]string{"foo": "blah", "bar": "235235", "baz": "true"}, - }, - expErr: true, - }, - { - name: "unknown input type", - uri: uriMatch{ - QueryInputName: "foobar", - }, - expErr: true, + name: "match catch-all wildcard", + pattern: `/foo/bar/{baz=**}`, + wildcards: []string{"baz"}, + shouldMatch: `/foo/bar/this/is/a/long/wildcard`, + wildcardValues: []string{"this/is/a/long/wildcard"}, + shouldNotMatch: []string{"/foo/bar", "/foo", "/foo/baz/bar/long/wild/card"}, }, } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - actual, err := createMessage(&tc.uri) - if tc.expErr { - require.Error(t, err) - } else { - require.NoError(t, err) - require.Equal(t, tc.expected, actual) + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + regString, wildcards := patternToRegex(tt.pattern) + // should produce the same wildcard keys + require.Equal(t, tt.wildcards, wildcards) + reg := regexp.MustCompile(regString) + + // handle the "should match" case. + matches := reg.FindStringSubmatch(tt.shouldMatch) + require.True(t, len(matches) > 0) // there should always be a match. + // when matches > 1, this means we got wildcard values to handle. the test should have wildcard values. + if len(matches) > 1 { + require.Greater(t, len(tt.wildcardValues), 0) + } + // matches[0] is the URL, everything else should be those wildcard values. + if len(tt.wildcardValues) > 0 { + require.Equal(t, matches[1:], tt.wildcardValues) } - }) - } -} -func TestCreateMessageFromJson(t *testing.T) { - gogoproto.RegisterType(&DummyProto{}, dummyProtoName) - testCases := []struct { - name string - uri uriMatch - request func() *http.Request - expected gogoproto.Message - expErr bool - }{ - { - name: "simple, empty message", - uri: uriMatch{QueryInputName: dummyProtoName}, - request: func() *http.Request { - return &http.Request{Body: io.NopCloser(bytes.NewReader([]byte("{}")))} - }, - expected: &DummyProto{}, - }, - { - name: "message with json input", - uri: uriMatch{QueryInputName: dummyProtoName}, - request: func() *http.Request { - d := DummyProto{ - Foo: "hello", - Bar: true, - Baz: 320, - } - bz, err := json.Marshal(d) - require.NoError(t, err) - return &http.Request{Body: io.NopCloser(bytes.NewReader(bz))} - }, - expected: &DummyProto{ - Foo: "hello", - Bar: true, - Baz: 320, - }, - }, - { - name: "message with invalid json", - uri: uriMatch{QueryInputName: dummyProtoName}, - request: func() *http.Request { - return &http.Request{Body: io.NopCloser(bytes.NewReader([]byte(`{"foo":12,dfi3}"`)))} - }, - expErr: true, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - actual, err := createMessageFromJSON(&tc.uri, tc.request()) - if tc.expErr { - require.Error(t, err) - } else { - require.NoError(t, err) - require.Equal(t, tc.expected, actual) + // should never match these. + for _, notMatch := range tt.shouldNotMatch { + require.Len(t, reg.FindStringSubmatch(notMatch), 0) } }) } diff --git a/server/v2/cometbft/abci_test.go b/server/v2/cometbft/abci_test.go index 780e50b5027d..e6bf1b26191c 100644 --- a/server/v2/cometbft/abci_test.go +++ b/server/v2/cometbft/abci_test.go @@ -913,7 +913,7 @@ func assertStoreLatestVersion(t *testing.T, store types.Store, target uint64) { require.Equal(t, target, version) commitInfo, err := store.GetStateCommitment().GetCommitInfo(version) require.NoError(t, err) - require.Equal(t, target, commitInfo.Version) + require.Equal(t, target, uint64(commitInfo.Version)) } func TestOptimisticExecution(t *testing.T) { diff --git a/server/v2/cometbft/go.mod b/server/v2/cometbft/go.mod index 403db51ea8cd..cdc1b02790b2 100644 --- a/server/v2/cometbft/go.mod +++ b/server/v2/cometbft/go.mod @@ -14,7 +14,7 @@ replace ( ) require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/errors v1.0.1 diff --git a/server/v2/cometbft/go.sum b/server/v2/cometbft/go.sum index aabfa399b529..2ed39a7af4a5 100644 --- a/server/v2/cometbft/go.sum +++ b/server/v2/cometbft/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/server/v2/cometbft/grpc.go b/server/v2/cometbft/grpc.go index 65a368b03a92..c25c2a8cd1bd 100644 --- a/server/v2/cometbft/grpc.go +++ b/server/v2/cometbft/grpc.go @@ -524,7 +524,7 @@ func (c *consensus[T]) maybeHandleExternalServices(ctx context.Context, req *abc // Handle tx service if strings.HasPrefix(req.Path, "/cosmos.tx.v1beta1.Service") { - rpcClient, _ := client.NewClientFromNode(c.cfg.AppTomlConfig.Address) + rpcClient, _ := client.NewClientFromNode(c.cfg.ConfigTomlConfig.RPC.ListenAddress) txConfig := authtx.NewTxConfig( c.appCodecs.AppCodec, diff --git a/server/v2/cometbft/internal/mock/mock_store.go b/server/v2/cometbft/internal/mock/mock_store.go index 8cb4542ac41e..7097aea83211 100644 --- a/server/v2/cometbft/internal/mock/mock_store.go +++ b/server/v2/cometbft/internal/mock/mock_store.go @@ -37,7 +37,7 @@ func (s *MockStore) GetLatestVersion() (uint64, error) { return 0, err } - return lastCommitID.Version, nil + return uint64(lastCommitID.Version), nil } func (s *MockStore) StateLatest() (uint64, corestore.ReaderMap, error) { @@ -99,7 +99,7 @@ func (s *MockStore) LastCommitID() (proof.CommitID, error) { v, err := s.GetStateCommitment().GetLatestVersion() bz := sha256.Sum256([]byte{}) return proof.CommitID{ - Version: v, + Version: int64(v), Hash: bz[:], }, err } diff --git a/server/v2/cometbft/query.go b/server/v2/cometbft/query.go index 0bdb9e40f060..ac8e0927bd81 100644 --- a/server/v2/cometbft/query.go +++ b/server/v2/cometbft/query.go @@ -29,6 +29,7 @@ func (c *consensus[T]) handleQueryP2P(path []string) (*abci.QueryResponse, error return c.idPeerFilter(arg) } } + return &abci.QueryResponse{}, nil } return nil, errorsmod.Wrap(cometerrors.ErrUnknownRequest, "expected second parameter to be 'filter'") diff --git a/server/v2/server.go b/server/v2/server.go index 9f4f3ee66e58..6036be1508cf 100644 --- a/server/v2/server.go +++ b/server/v2/server.go @@ -101,8 +101,15 @@ func (s *Server[T]) Start(ctx context.Context) error { }() } - if err := <-resCh; err != nil { - return fmt.Errorf("failed to start servers: %w", err) + for i := 0; i < len(s.components); i++ { + select { + case err := <-resCh: + if err != nil { + return fmt.Errorf("failed to start servers: %w", err) + } + case <-ctx.Done(): + return nil + } } <-ctx.Done() diff --git a/simapp/v2/app_config.go b/simapp/v2/app_config.go index 0681354b549e..84ed2f8fb643 100644 --- a/simapp/v2/app_config.go +++ b/simapp/v2/app_config.go @@ -37,8 +37,6 @@ import ( _ "cosmossdk.io/x/bank" // import for side-effects banktypes "cosmossdk.io/x/bank/types" _ "cosmossdk.io/x/bank/v2" // import for side-effects - bankv2types "cosmossdk.io/x/bank/v2/types" - bankmodulev2 "cosmossdk.io/x/bank/v2/types/module" _ "cosmossdk.io/x/circuit" // import for side-effects circuittypes "cosmossdk.io/x/circuit/types" _ "cosmossdk.io/x/consensus" // import for side-effects @@ -156,7 +154,7 @@ var ( accounts.ModuleName, authtypes.ModuleName, banktypes.ModuleName, - bankv2types.ModuleName, + // bankv2types.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, @@ -297,10 +295,10 @@ var ( Name: epochstypes.ModuleName, Config: appconfig.WrapAny(&epochsmodulev1.Module{}), }, - { - Name: bankv2types.ModuleName, - Config: appconfig.WrapAny(&bankmodulev2.Module{}), - }, + // { + // Name: bankv2types.ModuleName, + // Config: appconfig.WrapAny(&bankmodulev2.Module{}), + // }, }, } ) diff --git a/simapp/v2/go.mod b/simapp/v2/go.mod index 93641d336268..a3a655c5ed9c 100644 --- a/simapp/v2/go.mod +++ b/simapp/v2/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/simapp/v2 go 1.23.4 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/client/v2 v2.0.0-beta.6 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 diff --git a/simapp/v2/go.sum b/simapp/v2/go.sum index 0afec6f2f66f..d0bf9646e365 100644 --- a/simapp/v2/go.sum +++ b/simapp/v2/go.sum @@ -192,8 +192,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/simapp/v2/simdv2/cmd/testnet.go b/simapp/v2/simdv2/cmd/testnet.go index 9453a117b54f..1b280b7161b3 100644 --- a/simapp/v2/simdv2/cmd/testnet.go +++ b/simapp/v2/simdv2/cmd/testnet.go @@ -26,7 +26,6 @@ import ( "cosmossdk.io/server/v2/cometbft" "cosmossdk.io/server/v2/store" banktypes "cosmossdk.io/x/bank/types" - bankv2types "cosmossdk.io/x/bank/v2/types" stakingtypes "cosmossdk.io/x/staking/types" "github.com/cosmos/cosmos-sdk/client" @@ -423,13 +422,6 @@ func initGenFiles[T transaction.Tx]( } appGenState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankGenState) - var bankV2GenState bankv2types.GenesisState - clientCtx.Codec.MustUnmarshalJSON(appGenState[bankv2types.ModuleName], &bankV2GenState) - if len(bankV2GenState.Balances) == 0 { - bankV2GenState = getBankV2GenesisFromV1(bankGenState) - } - appGenState[bankv2types.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankV2GenState) - appGenStateJSON, err := json.MarshalIndent(appGenState, "", " ") if err != nil { return err @@ -532,16 +524,3 @@ func writeFile(name, dir string, contents []byte) error { return os.WriteFile(file, contents, 0o600) } - -// getBankV2GenesisFromV1 clones bank/v1 state to bank/v2 -// since we not migrate yet -// TODO: Remove -func getBankV2GenesisFromV1(v1GenesisState banktypes.GenesisState) bankv2types.GenesisState { - var v2GenesisState bankv2types.GenesisState - for _, balance := range v1GenesisState.Balances { - v2Balance := bankv2types.Balance(balance) - v2GenesisState.Balances = append(v2GenesisState.Balances, v2Balance) - v2GenesisState.Supply = v2GenesisState.Supply.Add(balance.Coins...) - } - return v2GenesisState -} diff --git a/simapp/v2/upgrades.go b/simapp/v2/upgrades.go index 2145196fa86d..20643c129749 100644 --- a/simapp/v2/upgrades.go +++ b/simapp/v2/upgrades.go @@ -6,10 +6,7 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/store" "cosmossdk.io/runtime/v2" - "cosmossdk.io/x/accounts" bankv2types "cosmossdk.io/x/bank/v2/types" - epochstypes "cosmossdk.io/x/epochs/types" - protocolpooltypes "cosmossdk.io/x/protocolpool/types" upgradetypes "cosmossdk.io/x/upgrade/types" ) @@ -37,12 +34,8 @@ func (app *SimApp[T]) RegisterUpgradeHandlers() { if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := store.StoreUpgrades{ Added: []string{ - accounts.StoreKey, - protocolpooltypes.StoreKey, - epochstypes.StoreKey, bankv2types.ModuleName, }, - Deleted: []string{"crisis"}, // The SDK discontinued the crisis module in v0.52.0 } app.SetStoreLoader(runtime.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) diff --git a/store/cache/cache.go b/store/cache/cache.go index 748eae8c422b..787e34da20ea 100644 --- a/store/cache/cache.go +++ b/store/cache/cache.go @@ -84,9 +84,7 @@ func (cmgr *CommitKVStoreCacheManager) Reset() { // Clear the map. // Please note that we are purposefully using the map clearing idiom. // See https://github.com/cosmos/cosmos-sdk/issues/6681. - for key := range cmgr.caches { - delete(cmgr.caches, key) - } + clear(cmgr.caches) } // CacheWrap implements the CacheWrapper interface diff --git a/store/v2/CHANGELOG.md b/store/v2/CHANGELOG.md index 82c6488d3709..27c96ed198b2 100644 --- a/store/v2/CHANGELOG.md +++ b/store/v2/CHANGELOG.md @@ -25,8 +25,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -### API Breaking +## [v2.0.0-beta.2](https://github.com/cosmos/cosmos-sdk/releases/tag/store/v2.0.0-beta.2) +* [#22336](https://github.com/cosmos/cosmos-sdk/pull/22336) Finish migration manager. * [#23157](https://github.com/cosmos/cosmos-sdk/pull/23157) Remove support for RocksDB. ## [v2.0.0-beta.1](https://github.com/cosmos/cosmos-sdk/releases/tag/store/v2.0.0-beta.1) diff --git a/store/v2/commitment/iavl/exporter.go b/store/v2/commitment/iavl/exporter.go index 20f00d1a1722..7d7c1a5b75fc 100644 --- a/store/v2/commitment/iavl/exporter.go +++ b/store/v2/commitment/iavl/exporter.go @@ -38,3 +38,16 @@ func (e *Exporter) Close() error { return nil } + +// EmptyExporter is a Exporter for an empty tree. +type EmptyExporter struct{} + +// Next returns ExportDone. +func (e *EmptyExporter) Next() (*snapshotstypes.SnapshotIAVLItem, error) { + return nil, commitment.ErrorExportDone +} + +// Close does nothing. +func (e *EmptyExporter) Close() error { + return nil +} diff --git a/store/v2/commitment/iavl/tree.go b/store/v2/commitment/iavl/tree.go index 1769bc45126e..9b7d1641ab68 100644 --- a/store/v2/commitment/iavl/tree.go +++ b/store/v2/commitment/iavl/tree.go @@ -1,6 +1,7 @@ package iavl import ( + "errors" "fmt" "github.com/cosmos/iavl" @@ -21,6 +22,8 @@ var ( // IavlTree is a wrapper around iavl.MutableTree. type IavlTree struct { tree *iavl.MutableTree + // it is only used for new store key during the migration process. + initialVersion uint64 } // NewIavlTree creates a new IavlTree instance. @@ -65,6 +68,17 @@ func (t *IavlTree) WorkingHash() []byte { // LoadVersion loads the state at the given version. func (t *IavlTree) LoadVersion(version uint64) error { + if t.initialVersion > 0 { + // If the initial version is set and the tree is empty, + // we don't need to load the version. + latestVersion, err := t.tree.GetLatestVersion() + if err != nil { + return err + } + if latestVersion == 0 { + return nil + } + } _, err := t.tree.LoadVersion(int64(version)) return err } @@ -150,6 +164,7 @@ func (t *IavlTree) GetLatestVersion() (uint64, error) { // SetInitialVersion sets the initial version of the database. func (t *IavlTree) SetInitialVersion(version uint64) error { t.tree.SetInitialVersion(version) + t.initialVersion = version return nil } @@ -169,6 +184,9 @@ func (t *IavlTree) PausePruning(pause bool) { // Export exports the tree exporter at the given version. func (t *IavlTree) Export(version uint64) (commitment.Exporter, error) { + if version < t.initialVersion { + return nil, errors.New("version is less than the initial version") + } tree, err := t.tree.GetImmutable(int64(version)) if err != nil { return nil, err diff --git a/store/v2/commitment/metadata.go b/store/v2/commitment/metadata.go index a054acf26e89..62ae4a3d1655 100644 --- a/store/v2/commitment/metadata.go +++ b/store/v2/commitment/metadata.go @@ -1,19 +1,20 @@ package commitment import ( - "bytes" "errors" "fmt" + gogotypes "github.com/cosmos/gogoproto/types" + corestore "cosmossdk.io/core/store" "cosmossdk.io/store/v2/internal/encoding" "cosmossdk.io/store/v2/proof" ) const ( - commitInfoKeyFmt = "c/%d" // c/ - latestVersionKey = "c/latest" - removedStoreKeyPrefix = "c/removed/" // c/removed// + commitInfoKeyFmt = "s/%d" // s/ + latestVersionKey = "s/latest" + removedStoreKeyPrefix = "s/removed/" // s/removed// ) // MetadataStore is a store for metadata related to the commitment store. @@ -39,21 +40,20 @@ func (m *MetadataStore) GetLatestVersion() (uint64, error) { return 0, nil } - version, _, err := encoding.DecodeUvarint(value) - if err != nil { + var latestVersion int64 + if err := gogotypes.StdInt64Unmarshal(&latestVersion, value); err != nil { return 0, err } - return version, nil + return uint64(latestVersion), nil } func (m *MetadataStore) setLatestVersion(version uint64) error { - var buf bytes.Buffer - buf.Grow(encoding.EncodeUvarintSize(version)) - if err := encoding.EncodeUvarint(&buf, version); err != nil { + bz, err := gogotypes.StdInt64Marshal(int64(version)) // convert uint64 to int64 is safe since there will be no overflow or underflow + if err != nil { return err } - return m.kv.Set([]byte(latestVersionKey), buf.Bytes()) + return m.kv.Set([]byte(latestVersionKey), bz) } // GetCommitInfo returns the commit info for the given version. @@ -72,6 +72,10 @@ func (m *MetadataStore) GetCommitInfo(version uint64) (*proof.CommitInfo, error) return nil, err } + if err := migrateStoreInfo(cInfo); err != nil { + return nil, err + } + return cInfo, nil } @@ -94,12 +98,11 @@ func (m *MetadataStore) flushCommitInfo(version uint64, cInfo *proof.CommitInfo) return err } - var buf bytes.Buffer - buf.Grow(encoding.EncodeUvarintSize(version)) - if err := encoding.EncodeUvarint(&buf, version); err != nil { + bz, err := gogotypes.StdInt64Marshal(int64(version)) // convert uint64 to int64 is safe since there will be no overflow or underflow + if err != nil { return err } - if err := batch.Set([]byte(latestVersionKey), buf.Bytes()); err != nil { + if err := batch.Set([]byte(latestVersionKey), bz); err != nil { return err } @@ -172,3 +175,23 @@ func (m *MetadataStore) deleteCommitInfo(version uint64) error { cInfoKey := []byte(fmt.Sprintf(commitInfoKeyFmt, version)) return m.kv.Delete(cInfoKey) } + +// when in migration mode, we need to add new fields to the store info +// this will only be the case for the storev1 to storev2 migration +func migrateStoreInfo(cInfo *proof.CommitInfo) error { + for _, storeInfo := range cInfo.StoreInfos { + if storeInfo.Structure == "" { + storeInfo.Structure = "iavl" + } + } + + if cInfo.CommitHash == nil { + commitHash, _, err := cInfo.GetStoreProof([]byte{}) + if err != nil { + return err + } + + cInfo.CommitHash = commitHash + } + return nil +} diff --git a/store/v2/commitment/store.go b/store/v2/commitment/store.go index 757fb45851c1..08c254b1992d 100644 --- a/store/v2/commitment/store.go +++ b/store/v2/commitment/store.go @@ -229,7 +229,7 @@ func (c *CommitStore) Commit(version uint64) (*proof.CommitInfo, error) { if internal.IsMemoryStoreKey(storeKey) { continue } - si := &proof.StoreInfo{Name: []byte(storeKey)} + si := &proof.StoreInfo{Name: storeKey} storeInfos = append(storeInfos, si) if tree.IsConcurrentSafe() { @@ -248,9 +248,13 @@ func (c *CommitStore) Commit(version uint64) (*proof.CommitInfo, error) { } } + // convert storeInfos to []proof.StoreInfo + sideref := make([]*proof.StoreInfo, 0, len(c.multiTrees)) + sideref = append(sideref, storeInfos...) + cInfo := &proof.CommitInfo{ - Version: version, - StoreInfos: storeInfos, + Version: int64(version), + StoreInfos: sideref, } if err := eg.Wait(); err != nil { @@ -272,8 +276,8 @@ func (c *CommitStore) commit(tree Tree, si *proof.StoreInfo, expected uint64) er if v != expected { return fmt.Errorf("commit version %d does not match the target version %d", v, expected) } - si.CommitID = &proof.CommitID{ - Version: v, + si.CommitId = &proof.CommitID{ + Version: int64(v), Hash: h, } return nil @@ -596,18 +600,17 @@ func (c *CommitStore) GetCommitInfo(version uint64) (*proof.CommitInfo, error) { if v != version { return nil, fmt.Errorf("tree version %d does not match the target version %d", v, version) } - bz := []byte(storeKey) storeInfos = append(storeInfos, &proof.StoreInfo{ - Name: bz, - CommitID: &proof.CommitID{ - Version: v, + Name: storeKey, + CommitId: &proof.CommitID{ + Version: int64(v), Hash: tree.Hash(), }, }) } ci = &proof.CommitInfo{ - Version: version, + Version: int64(version), StoreInfos: storeInfos, } return ci, nil diff --git a/store/v2/commitment/store_test_suite.go b/store/v2/commitment/store_test_suite.go index 76d1029a74a9..955b743058a7 100644 --- a/store/v2/commitment/store_test_suite.go +++ b/store/v2/commitment/store_test_suite.go @@ -1,9 +1,9 @@ package commitment import ( - "bytes" "fmt" "io" + "strings" "github.com/stretchr/testify/suite" @@ -134,7 +134,7 @@ func (s *CommitStoreTestSuite) TestStore_Snapshotter() { for _, storeInfo := range targetCommitInfo.StoreInfos { matched := false for _, latestStoreInfo := range cInfo.StoreInfos { - if bytes.Equal(storeInfo.Name, latestStoreInfo.Name) { + if strings.EqualFold(storeInfo.Name, latestStoreInfo.Name) { s.Require().Equal(latestStoreInfo.GetHash(), storeInfo.GetHash()) matched = true } @@ -176,7 +176,7 @@ func (s *CommitStoreTestSuite) TestStore_LoadVersion() { for i := uint64(1); i <= latestVersion; i++ { commitInfo, _ := targetStore.GetCommitInfo(i) s.Require().NotNil(commitInfo) - s.Require().Equal(i, commitInfo.Version) + s.Require().Equal(i, uint64(commitInfo.Version)) } // rollback to a previous version diff --git a/store/v2/go.mod b/store/v2/go.mod index a75aadc81a94..dcb57635f47c 100644 --- a/store/v2/go.mod +++ b/store/v2/go.mod @@ -20,6 +20,7 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d go.uber.org/mock v0.5.0 golang.org/x/sync v0.10.0 + google.golang.org/protobuf v1.36.2 ) require ( @@ -71,6 +72,5 @@ require ( golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect - google.golang.org/protobuf v1.36.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/store/v2/migration/manager.go b/store/v2/migration/manager.go index 5365e8eb6a11..18bf6d4c9b7a 100644 --- a/store/v2/migration/manager.go +++ b/store/v2/migration/manager.go @@ -200,11 +200,8 @@ func (m *Manager) Sync() error { } // Close closes the manager. It should be called after the migration is done. -// It will close the db and notify the snapshotsManager that the migration is done. +// It will notify the snapshotsManager that the migration is done. func (m *Manager) Close() error { - if err := m.db.Close(); err != nil { - return fmt.Errorf("failed to close db: %w", err) - } if m.stateCommitment != nil { m.snapshotsManager.EndMigration(m.stateCommitment) } diff --git a/store/v2/migration/manager_test.go b/store/v2/migration/manager_test.go index 103b3244b650..f5382ac33011 100644 --- a/store/v2/migration/manager_test.go +++ b/store/v2/migration/manager_test.go @@ -70,7 +70,6 @@ func TestMigrateState(t *testing.T) { // expecting error for conflicting process, since Migrate trigger snapshotter create migration, // which start a snapshot process already. _, err = m.snapshotsManager.Create(toVersion - 1) - fmt.Println(1) require.Error(t, err) // check the migrated state diff --git a/store/v2/proof/commit_info.go b/store/v2/proof/commit_info.go index 0ca52bd8dd87..b42b401ae61d 100644 --- a/store/v2/proof/commit_info.go +++ b/store/v2/proof/commit_info.go @@ -1,42 +1,13 @@ package proof import ( - "bytes" "fmt" "sort" - "time" - - "cosmossdk.io/store/v2/internal/encoding" -) - -type ( - // CommitInfo defines commit information used by the multi-store when committing - // a version/height. - CommitInfo struct { - Version uint64 - StoreInfos []*StoreInfo - Timestamp time.Time - CommitHash []byte - } - - // StoreInfo defines store-specific commit information. It contains a reference - // between a store name/key and the commit ID. - StoreInfo struct { - Name []byte - CommitID *CommitID - Structure string - } - - // CommitID defines the commitment information when a specific store is - // committed. - CommitID struct { - Version uint64 - Hash []byte - } + "strings" ) func (si StoreInfo) GetHash() []byte { - return si.CommitID.Hash + return si.CommitId.Hash } // Hash returns the root hash of all committed stores represented by CommitInfo, @@ -57,8 +28,8 @@ func (ci *CommitInfo) Hash() []byte { // GetStoreCommitID returns the CommitID for the given store key. func (ci *CommitInfo) GetStoreCommitID(storeKey []byte) *CommitID { for _, si := range ci.StoreInfos { - if bytes.Equal(si.Name, storeKey) { - return si.CommitID + if strings.EqualFold(si.Name, string(storeKey)) { + return si.CommitId } } return &CommitID{} @@ -69,7 +40,7 @@ func (ci *CommitInfo) GetStoreCommitID(storeKey []byte) *CommitID { // store based on lexographical ordering will be proved. func (ci *CommitInfo) GetStoreProof(storeKey []byte) ([]byte, *CommitmentOp, error) { sort.Slice(ci.StoreInfos, func(i, j int) bool { - return bytes.Compare(ci.StoreInfos[i].Name, ci.StoreInfos[j].Name) < 0 + return strings.Compare(ci.StoreInfos[i].Name, ci.StoreInfos[j].Name) < 0 }) isEmpty := len(storeKey) == 0 @@ -77,11 +48,11 @@ func (ci *CommitInfo) GetStoreProof(storeKey []byte) ([]byte, *CommitmentOp, err leaves := make([][]byte, len(ci.StoreInfos)) for i, si := range ci.StoreInfos { var err error - leaves[i], err = LeafHash(si.Name, si.GetHash()) + leaves[i], err = LeafHash([]byte(si.Name), si.GetHash()) if err != nil { return nil, nil, err } - if !isEmpty && bytes.Equal(si.Name, storeKey) { + if !isEmpty && strings.EqualFold(si.Name, string(storeKey)) { index = i } } @@ -99,111 +70,6 @@ func (ci *CommitInfo) GetStoreProof(storeKey []byte) ([]byte, *CommitmentOp, err return rootHash, &commitmentOp, nil } -// encodedSize returns the encoded size of CommitInfo for preallocation in Marshal. -func (ci *CommitInfo) encodedSize() int { - size := encoding.EncodeUvarintSize(ci.Version) - size += encoding.EncodeVarintSize(ci.Timestamp.UnixNano()) - size += encoding.EncodeUvarintSize(uint64(len(ci.StoreInfos))) - for _, storeInfo := range ci.StoreInfos { - size += encoding.EncodeBytesSize(storeInfo.Name) - size += encoding.EncodeBytesSize(storeInfo.CommitID.Hash) - size += encoding.EncodeBytesSize([]byte(storeInfo.Structure)) - } - return size -} - -// Marshal returns the encoded byte representation of CommitInfo. -// NOTE: CommitInfo is encoded as follows: -// - version (uvarint) -// - timestamp (varint) -// - number of stores (uvarint) -// - for each store: -// - store name (bytes) -// - store hash (bytes) -// - store commit structure (bytes) -func (ci *CommitInfo) Marshal() ([]byte, error) { - var buf bytes.Buffer - buf.Grow(ci.encodedSize()) - - if err := encoding.EncodeUvarint(&buf, ci.Version); err != nil { - return nil, err - } - if err := encoding.EncodeVarint(&buf, ci.Timestamp.UnixNano()); err != nil { - return nil, err - } - if err := encoding.EncodeUvarint(&buf, uint64(len(ci.StoreInfos))); err != nil { - return nil, err - } - for _, si := range ci.StoreInfos { - if err := encoding.EncodeBytes(&buf, si.Name); err != nil { - return nil, err - } - if err := encoding.EncodeBytes(&buf, si.CommitID.Hash); err != nil { - return nil, err - } - if err := encoding.EncodeBytes(&buf, []byte(si.Structure)); err != nil { - return nil, err - } - } - - return buf.Bytes(), nil -} - -// Unmarshal unmarshals the encoded byte representation of CommitInfo. -func (ci *CommitInfo) Unmarshal(buf []byte) error { - // Version - version, n, err := encoding.DecodeUvarint(buf) - if err != nil { - return err - } - buf = buf[n:] - ci.Version = version - // Timestamp - timestamp, n, err := encoding.DecodeVarint(buf) - if err != nil { - return err - } - buf = buf[n:] - ci.Timestamp = time.Unix(timestamp/int64(time.Second), timestamp%int64(time.Second)) - // StoreInfos - storeInfosLen, n, err := encoding.DecodeUvarint(buf) - if err != nil { - return err - } - buf = buf[n:] - ci.StoreInfos = make([]*StoreInfo, storeInfosLen) - for i := 0; i < int(storeInfosLen); i++ { - ci.StoreInfos[i] = &StoreInfo{} - // Name - name, n, err := encoding.DecodeBytes(buf) - if err != nil { - return err - } - buf = buf[n:] - ci.StoreInfos[i].Name = name - // CommitID - hash, n, err := encoding.DecodeBytes(buf) - if err != nil { - return err - } - buf = buf[n:] - // Structure - structure, n, err := encoding.DecodeBytes(buf) - if err != nil { - return err - } - buf = buf[n:] - ci.StoreInfos[i].Structure = string(structure) - - ci.StoreInfos[i].CommitID = &CommitID{ - Hash: hash, - Version: ci.Version, - } - } - - return nil -} - func (ci *CommitInfo) CommitID() *CommitID { return &CommitID{ Version: ci.Version, @@ -211,13 +77,6 @@ func (ci *CommitInfo) CommitID() *CommitID { } } -func (ci *CommitInfo) GetVersion() uint64 { - if ci != nil { - return ci.Version - } - return 0 -} - func (cid *CommitID) String() string { return fmt.Sprintf("CommitID{%v:%X}", cid.Hash, cid.Version) } diff --git a/store/v2/proof/commit_info.pb.go b/store/v2/proof/commit_info.pb.go new file mode 100644 index 000000000000..26811186fd4c --- /dev/null +++ b/store/v2/proof/commit_info.pb.go @@ -0,0 +1,975 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/store/v2/commit_info.proto + +package proof + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// CommitInfo defines commit information used by the multi-store when committing +// a version/height. +type CommitInfo struct { + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + StoreInfos []*StoreInfo `protobuf:"bytes,2,rep,name=store_infos,json=storeInfos,proto3" json:"store_infos,omitempty"` + Timestamp time.Time `protobuf:"bytes,3,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + CommitHash []byte `protobuf:"bytes,4,opt,name=commit_hash,json=commitHash,proto3" json:"commit_hash,omitempty"` +} + +func (m *CommitInfo) Reset() { *m = CommitInfo{} } +func (m *CommitInfo) String() string { return proto.CompactTextString(m) } +func (*CommitInfo) ProtoMessage() {} +func (*CommitInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_fae1fdc51331137e, []int{0} +} +func (m *CommitInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommitInfo.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 *CommitInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitInfo.Merge(m, src) +} +func (m *CommitInfo) XXX_Size() int { + return m.Size() +} +func (m *CommitInfo) XXX_DiscardUnknown() { + xxx_messageInfo_CommitInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitInfo proto.InternalMessageInfo + +func (m *CommitInfo) GetVersion() int64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *CommitInfo) GetStoreInfos() []*StoreInfo { + if m != nil { + return m.StoreInfos + } + return nil +} + +func (m *CommitInfo) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + +func (m *CommitInfo) GetCommitHash() []byte { + if m != nil { + return m.CommitHash + } + return nil +} + +// StoreInfo defines store-specific commit information. It contains a reference +// between a store name and the commit ID. +type StoreInfo struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + CommitId *CommitID `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` + Structure string `protobuf:"bytes,3,opt,name=structure,proto3" json:"structure,omitempty"` +} + +func (m *StoreInfo) Reset() { *m = StoreInfo{} } +func (m *StoreInfo) String() string { return proto.CompactTextString(m) } +func (*StoreInfo) ProtoMessage() {} +func (*StoreInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_fae1fdc51331137e, []int{1} +} +func (m *StoreInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreInfo.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 *StoreInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreInfo.Merge(m, src) +} +func (m *StoreInfo) XXX_Size() int { + return m.Size() +} +func (m *StoreInfo) XXX_DiscardUnknown() { + xxx_messageInfo_StoreInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreInfo proto.InternalMessageInfo + +func (m *StoreInfo) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *StoreInfo) GetCommitId() *CommitID { + if m != nil { + return m.CommitId + } + return nil +} + +func (m *StoreInfo) GetStructure() string { + if m != nil { + return m.Structure + } + return "" +} + +// CommitID defines the commitment information when a specific store is +// committed. +type CommitID struct { + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (m *CommitID) Reset() { *m = CommitID{} } +func (*CommitID) ProtoMessage() {} +func (*CommitID) Descriptor() ([]byte, []int) { + return fileDescriptor_fae1fdc51331137e, []int{2} +} +func (m *CommitID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommitID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommitID.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 *CommitID) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitID.Merge(m, src) +} +func (m *CommitID) XXX_Size() int { + return m.Size() +} +func (m *CommitID) XXX_DiscardUnknown() { + xxx_messageInfo_CommitID.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitID proto.InternalMessageInfo + +func (m *CommitID) GetVersion() int64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *CommitID) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func init() { + proto.RegisterType((*CommitInfo)(nil), "cosmos.store.v2.CommitInfo") + proto.RegisterType((*StoreInfo)(nil), "cosmos.store.v2.StoreInfo") + proto.RegisterType((*CommitID)(nil), "cosmos.store.v2.CommitID") +} + +func init() { proto.RegisterFile("cosmos/store/v2/commit_info.proto", fileDescriptor_fae1fdc51331137e) } + +var fileDescriptor_fae1fdc51331137e = []byte{ + // 355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x31, 0x4f, 0xc2, 0x50, + 0x10, 0xc7, 0xfb, 0xa0, 0x51, 0x7a, 0x98, 0x98, 0xbc, 0x38, 0x54, 0x34, 0x6d, 0x65, 0x62, 0x7a, + 0x4d, 0x30, 0x3a, 0x68, 0xe2, 0x80, 0x0e, 0xb2, 0x56, 0x27, 0x17, 0x53, 0xa0, 0x2d, 0x8d, 0xb6, + 0x47, 0xfa, 0x5e, 0xf9, 0x1c, 0x8c, 0x8e, 0x7e, 0x1c, 0x46, 0x46, 0x27, 0x35, 0xf0, 0x45, 0x0c, + 0xf7, 0x28, 0x24, 0x9a, 0xb8, 0xfd, 0xdf, 0xf5, 0x7f, 0x77, 0xbf, 0xfb, 0xa7, 0x70, 0x36, 0x44, + 0x99, 0xa1, 0xf4, 0xa5, 0xc2, 0x22, 0xf2, 0xa7, 0x5d, 0x7f, 0x88, 0x59, 0x96, 0xaa, 0xe7, 0x34, + 0x8f, 0x51, 0x4c, 0x0a, 0x54, 0xc8, 0x0f, 0xb5, 0x45, 0x90, 0x45, 0x4c, 0xbb, 0xad, 0xa3, 0x04, + 0x13, 0xa4, 0x6f, 0xfe, 0x5a, 0x69, 0x5b, 0xcb, 0x4d, 0x10, 0x93, 0xd7, 0xc8, 0xa7, 0xd7, 0xa0, + 0x8c, 0x7d, 0x95, 0x66, 0x91, 0x54, 0x61, 0x36, 0xd1, 0x86, 0xf6, 0x9c, 0x01, 0xdc, 0xd2, 0xf4, + 0x7e, 0x1e, 0x23, 0xb7, 0x61, 0x7f, 0x1a, 0x15, 0x32, 0xc5, 0xdc, 0x66, 0x1e, 0xeb, 0xd4, 0x83, + 0xea, 0xc9, 0xaf, 0xa1, 0x49, 0xbb, 0x08, 0x42, 0xda, 0x35, 0xaf, 0xde, 0x69, 0x76, 0x5b, 0xe2, + 0x17, 0x86, 0x78, 0x58, 0x8b, 0xf5, 0xa8, 0x00, 0x64, 0x25, 0x25, 0xef, 0x81, 0xb5, 0x5d, 0x6c, + 0xd7, 0x3d, 0x46, 0xad, 0x1a, 0x4d, 0x54, 0x68, 0xe2, 0xb1, 0x72, 0xf4, 0x1a, 0xf3, 0x4f, 0xd7, + 0x98, 0x7d, 0xb9, 0x2c, 0xd8, 0xb5, 0x71, 0x17, 0x9a, 0x9b, 0x18, 0xc6, 0xa1, 0x1c, 0xdb, 0xa6, + 0xc7, 0x3a, 0x07, 0x01, 0xe8, 0xd2, 0x7d, 0x28, 0xc7, 0xed, 0x12, 0xac, 0xed, 0x76, 0xce, 0xc1, + 0xcc, 0xc3, 0x2c, 0xa2, 0x2b, 0xac, 0x80, 0x34, 0xbf, 0x04, 0xab, 0x0a, 0x72, 0x64, 0xd7, 0x88, + 0xe2, 0xf8, 0xcf, 0x01, 0x9b, 0x30, 0xee, 0x82, 0x86, 0xf6, 0xf6, 0x47, 0xfc, 0x14, 0x2c, 0xa9, + 0x8a, 0x72, 0xa8, 0xca, 0x22, 0x22, 0x7a, 0x2b, 0xd8, 0x15, 0xda, 0x37, 0xd0, 0xa8, 0x7a, 0xfe, + 0x89, 0x8f, 0x83, 0x49, 0xd8, 0x35, 0xc2, 0x26, 0x7d, 0x65, 0xbe, 0xbd, 0xbb, 0x46, 0xef, 0x62, + 0xbe, 0x74, 0xd8, 0x62, 0xe9, 0xb0, 0xef, 0xa5, 0xc3, 0x66, 0x2b, 0xc7, 0x58, 0xac, 0x1c, 0xe3, + 0x63, 0xe5, 0x18, 0x4f, 0x27, 0x9a, 0x4d, 0x8e, 0x5e, 0x44, 0x8a, 0xbb, 0x9f, 0x61, 0x52, 0x20, + 0xc6, 0x83, 0x3d, 0xca, 0xed, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0x18, 0xd0, 0x41, 0xbe, 0x2c, + 0x02, 0x00, 0x00, +} + +func (m *CommitInfo) 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 *CommitInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CommitHash) > 0 { + i -= len(m.CommitHash) + copy(dAtA[i:], m.CommitHash) + i = encodeVarintCommitInfo(dAtA, i, uint64(len(m.CommitHash))) + i-- + dAtA[i] = 0x22 + } + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintCommitInfo(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + if len(m.StoreInfos) > 0 { + for iNdEx := len(m.StoreInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StoreInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommitInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Version != 0 { + i = encodeVarintCommitInfo(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *StoreInfo) 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 *StoreInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Structure) > 0 { + i -= len(m.Structure) + copy(dAtA[i:], m.Structure) + i = encodeVarintCommitInfo(dAtA, i, uint64(len(m.Structure))) + i-- + dAtA[i] = 0x1a + } + if m.CommitId != nil { + { + size, err := m.CommitId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommitInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCommitInfo(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CommitID) 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 *CommitID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintCommitInfo(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } + if m.Version != 0 { + i = encodeVarintCommitInfo(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintCommitInfo(dAtA []byte, offset int, v uint64) int { + offset -= sovCommitInfo(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CommitInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != 0 { + n += 1 + sovCommitInfo(uint64(m.Version)) + } + if len(m.StoreInfos) > 0 { + for _, e := range m.StoreInfos { + l = e.Size() + n += 1 + l + sovCommitInfo(uint64(l)) + } + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovCommitInfo(uint64(l)) + l = len(m.CommitHash) + if l > 0 { + n += 1 + l + sovCommitInfo(uint64(l)) + } + return n +} + +func (m *StoreInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCommitInfo(uint64(l)) + } + if m.CommitId != nil { + l = m.CommitId.Size() + n += 1 + l + sovCommitInfo(uint64(l)) + } + l = len(m.Structure) + if l > 0 { + n += 1 + l + sovCommitInfo(uint64(l)) + } + return n +} + +func (m *CommitID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != 0 { + n += 1 + sovCommitInfo(uint64(m.Version)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovCommitInfo(uint64(l)) + } + return n +} + +func sovCommitInfo(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCommitInfo(x uint64) (n int) { + return sovCommitInfo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CommitInfo) 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 ErrIntOverflowCommitInfo + } + 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: CommitInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StoreInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StoreInfos = append(m.StoreInfos, &StoreInfo{}) + if err := m.StoreInfos[len(m.StoreInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CommitHash = append(m.CommitHash[:0], dAtA[iNdEx:postIndex]...) + if m.CommitHash == nil { + m.CommitHash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommitInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommitInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreInfo) 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 ErrIntOverflowCommitInfo + } + 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: StoreInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CommitId == nil { + m.CommitId = &CommitID{} + } + if err := m.CommitId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Structure", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Structure = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommitInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommitInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommitID) 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 ErrIntOverflowCommitInfo + } + 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: CommitID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommitInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommitInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCommitInfo(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, ErrIntOverflowCommitInfo + } + 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, ErrIntOverflowCommitInfo + } + 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, ErrIntOverflowCommitInfo + } + 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, ErrInvalidLengthCommitInfo + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCommitInfo + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCommitInfo + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCommitInfo = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCommitInfo = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCommitInfo = fmt.Errorf("proto: unexpected end of group") +) diff --git a/store/v2/proof/commit_info_test.go b/store/v2/proof/commit_info_test.go index 1c0221fe6360..61f4f48412ab 100644 --- a/store/v2/proof/commit_info_test.go +++ b/store/v2/proof/commit_info_test.go @@ -13,27 +13,27 @@ func TestGetStoreProof(t *testing.T) { storeInfos []*StoreInfo }{ {[]*StoreInfo{ - {[]byte("key1"), &CommitID{1, []byte("value1")}, "iavl"}, + {("key1"), &CommitID{1, []byte("value1")}, "iavl"}, }}, {[]*StoreInfo{ - {[]byte("key2"), &CommitID{1, []byte("value2")}, "iavl"}, - {[]byte("key1"), &CommitID{1, []byte("value1")}, "iavl"}, + {("key2"), &CommitID{1, []byte("value2")}, "iavl"}, + {("key1"), &CommitID{1, []byte("value1")}, "iavl"}, }}, {[]*StoreInfo{ - {[]byte("key3"), &CommitID{1, []byte("value3")}, "iavl"}, - {[]byte("key2"), &CommitID{1, []byte("value2")}, "iavl"}, - {[]byte("key1"), &CommitID{1, []byte("value1")}, "iavl"}, + {("key3"), &CommitID{1, []byte("value3")}, "iavl"}, + {("key2"), &CommitID{1, []byte("value2")}, "iavl"}, + {("key1"), &CommitID{1, []byte("value1")}, "iavl"}, }}, {[]*StoreInfo{ - {[]byte("key2"), &CommitID{1, []byte("value2")}, "iavl"}, - {[]byte("key1"), &CommitID{1, []byte("value1")}, "iavl"}, - {[]byte("key3"), &CommitID{1, []byte("value3")}, "iavl"}, + {("key2"), &CommitID{1, []byte("value2")}, "iavl"}, + {("key1"), &CommitID{1, []byte("value1")}, "iavl"}, + {("key3"), &CommitID{1, []byte("value3")}, "iavl"}, }}, {[]*StoreInfo{ - {[]byte("key4"), &CommitID{1, []byte("value4")}, "iavl"}, - {[]byte("key1"), &CommitID{1, []byte("value1")}, "iavl"}, - {[]byte("key3"), &CommitID{1, []byte("value3")}, "iavl"}, - {[]byte("key2"), &CommitID{1, []byte("value2")}, "iavl"}, + {("key4"), &CommitID{1, []byte("value4")}, "iavl"}, + {("key1"), &CommitID{1, []byte("value1")}, "iavl"}, + {("key3"), &CommitID{1, []byte("value3")}, "iavl"}, + {("key2"), &CommitID{1, []byte("value2")}, "iavl"}, }}, } @@ -47,13 +47,13 @@ func TestGetStoreProof(t *testing.T) { } commitHash := ci.Hash() // make sure the store infos are sorted - require.Equal(t, ci.StoreInfos[0].Name, []byte("key1")) + require.Equal(t, ci.StoreInfos[0].Name, "key1") for _, si := range tc.storeInfos { // get the proof - _, proof, err := ci.GetStoreProof(si.Name) + _, proof, err := ci.GetStoreProof([]byte(si.Name)) require.NoError(t, err, "test case %d", i) // verify the proof - expRoots, err := proof.Run([][]byte{si.CommitID.Hash}) + expRoots, err := proof.Run([][]byte{si.CommitId.Hash}) require.NoError(t, err, "test case %d", i) require.Equal(t, commitHash, expRoots[0], "test case %d", i) diff --git a/store/v2/proof/v1/types/commit_info.pb.go b/store/v2/proof/v1/types/commit_info.pb.go new file mode 100644 index 000000000000..aa3c6788690f --- /dev/null +++ b/store/v2/proof/v1/types/commit_info.pb.go @@ -0,0 +1,859 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/store/v1beta1/commit_info.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +// CommitInfo defines commit information used by the multi-store when committing +// a version/height. +type CommitInfo struct { + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + StoreInfos []StoreInfo `protobuf:"bytes,2,rep,name=store_infos,json=storeInfos,proto3" json:"store_infos"` + Timestamp time.Time `protobuf:"bytes,3,opt,name=timestamp,proto3,stdtime" json:"timestamp"` +} + +func (m *CommitInfo) Reset() { *m = CommitInfo{} } +func (m *CommitInfo) String() string { return proto.CompactTextString(m) } +func (*CommitInfo) ProtoMessage() {} +func (*CommitInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_5f8c656cdef8c524, []int{0} +} +func (m *CommitInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommitInfo.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 *CommitInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitInfo.Merge(m, src) +} +func (m *CommitInfo) XXX_Size() int { + return m.Size() +} +func (m *CommitInfo) XXX_DiscardUnknown() { + xxx_messageInfo_CommitInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitInfo proto.InternalMessageInfo + +func (m *CommitInfo) GetVersion() int64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *CommitInfo) GetStoreInfos() []StoreInfo { + if m != nil { + return m.StoreInfos + } + return nil +} + +func (m *CommitInfo) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + +// StoreInfo defines store-specific commit information. It contains a reference +// between a store name and the commit ID. +type StoreInfo struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + CommitId CommitID `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id"` +} + +func (m *StoreInfo) Reset() { *m = StoreInfo{} } +func (m *StoreInfo) String() string { return proto.CompactTextString(m) } +func (*StoreInfo) ProtoMessage() {} +func (*StoreInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_5f8c656cdef8c524, []int{1} +} +func (m *StoreInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StoreInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StoreInfo.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 *StoreInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_StoreInfo.Merge(m, src) +} +func (m *StoreInfo) XXX_Size() int { + return m.Size() +} +func (m *StoreInfo) XXX_DiscardUnknown() { + xxx_messageInfo_StoreInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_StoreInfo proto.InternalMessageInfo + +func (m *StoreInfo) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *StoreInfo) GetCommitId() CommitID { + if m != nil { + return m.CommitId + } + return CommitID{} +} + +// CommitID defines the commitment information when a specific store is +// committed. +type CommitID struct { + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` +} + +func (m *CommitID) Reset() { *m = CommitID{} } +func (*CommitID) ProtoMessage() {} +func (m *CommitID) String() string { + return fmt.Sprintf("CommitID{%v:%X}", m.Hash, m.Version) +} +func (*CommitID) Descriptor() ([]byte, []int) { + return fileDescriptor_5f8c656cdef8c524, []int{2} +} +func (m *CommitID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommitID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommitID.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 *CommitID) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitID.Merge(m, src) +} +func (m *CommitID) XXX_Size() int { + return m.Size() +} +func (m *CommitID) XXX_DiscardUnknown() { + xxx_messageInfo_CommitID.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitID proto.InternalMessageInfo + +func (m *CommitID) GetVersion() int64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *CommitID) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + + + +var fileDescriptor_5f8c656cdef8c524 = []byte{ + // 336 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xb1, 0x4e, 0xf2, 0x50, + 0x14, 0xc7, 0x7b, 0xa1, 0xf9, 0x3e, 0x7a, 0x70, 0xba, 0x61, 0x68, 0x18, 0x6e, 0x09, 0x83, 0x61, + 0xba, 0x0d, 0xb8, 0x39, 0x98, 0x58, 0x8d, 0x09, 0x6b, 0x75, 0x72, 0x31, 0x2d, 0x5c, 0x4a, 0xa3, + 0xed, 0x21, 0xdc, 0x2b, 0x89, 0x6f, 0xc1, 0xe8, 0xe8, 0x33, 0xf8, 0x14, 0x8c, 0x8c, 0x4e, 0x6a, + 0xe0, 0x45, 0x4c, 0x4f, 0x5b, 0x5c, 0x88, 0xdb, 0x39, 0xed, 0xef, 0x9c, 0xff, 0xaf, 0xa7, 0x70, + 0x3a, 0x41, 0x9d, 0xa1, 0xf6, 0xb5, 0xc1, 0xa5, 0xf2, 0x57, 0xc3, 0x58, 0x99, 0x68, 0xe8, 0x4f, + 0x30, 0xcb, 0x52, 0xf3, 0x90, 0xe6, 0x33, 0x94, 0x8b, 0x25, 0x1a, 0xe4, 0x9d, 0x92, 0x93, 0xc4, + 0xc9, 0x8a, 0xeb, 0x76, 0x12, 0x4c, 0x90, 0x00, 0xbf, 0xa8, 0x4a, 0xb6, 0xeb, 0x25, 0x88, 0xc9, + 0x93, 0xf2, 0xa9, 0x8b, 0x9f, 0x67, 0xbe, 0x49, 0x33, 0xa5, 0x4d, 0x94, 0x2d, 0x4a, 0xa0, 0xff, + 0xce, 0x00, 0xae, 0x28, 0x62, 0x9c, 0xcf, 0x90, 0xbb, 0xf0, 0x7f, 0xa5, 0x96, 0x3a, 0xc5, 0xdc, + 0x65, 0x3d, 0x36, 0x68, 0x86, 0x75, 0xcb, 0x6f, 0xa0, 0x4d, 0x81, 0x64, 0xa2, 0xdd, 0x46, 0xaf, + 0x39, 0x68, 0x8f, 0x3c, 0x79, 0xcc, 0x45, 0xde, 0x16, 0x5d, 0xb1, 0x2f, 0xb0, 0x37, 0x9f, 0x9e, + 0x15, 0x82, 0xae, 0x1f, 0x68, 0x1e, 0x80, 0x73, 0x70, 0x70, 0x9b, 0x3d, 0x36, 0x68, 0x8f, 0xba, + 0xb2, 0xb4, 0x94, 0xb5, 0xa5, 0xbc, 0xab, 0x89, 0xa0, 0x55, 0x2c, 0x58, 0x7f, 0x79, 0x2c, 0xfc, + 0x1d, 0xeb, 0xc7, 0xe0, 0x1c, 0x22, 0x38, 0x07, 0x3b, 0x8f, 0x32, 0x45, 0xbe, 0x4e, 0x48, 0x35, + 0xbf, 0x04, 0xa7, 0xbe, 0xdb, 0xd4, 0x6d, 0x50, 0x88, 0x38, 0xae, 0x5a, 0x7d, 0xfb, 0x75, 0x65, + 0xda, 0x2a, 0xc7, 0xc6, 0xd3, 0xfe, 0x05, 0xb4, 0xea, 0x77, 0x7f, 0x5c, 0x85, 0x83, 0x3d, 0x8f, + 0xf4, 0x9c, 0x32, 0x4e, 0x42, 0xaa, 0xcf, 0xed, 0xd7, 0x37, 0xcf, 0x0a, 0x46, 0x9b, 0x9d, 0x60, + 0xdb, 0x9d, 0x60, 0xdf, 0x3b, 0xc1, 0xd6, 0x7b, 0x61, 0x6d, 0xf7, 0xc2, 0xfa, 0xd8, 0x0b, 0xeb, + 0xde, 0x2d, 0x45, 0xf4, 0xf4, 0x51, 0xa6, 0x58, 0xfd, 0x6d, 0xf3, 0xb2, 0x50, 0x3a, 0xfe, 0x47, + 0x07, 0x38, 0xfb, 0x09, 0x00, 0x00, 0xff, 0xff, 0x67, 0xb7, 0x0d, 0x59, 0x0a, 0x02, 0x00, 0x00, +} + +func (m *CommitInfo) 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 *CommitInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintCommitInfo(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + if len(m.StoreInfos) > 0 { + for iNdEx := len(m.StoreInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StoreInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommitInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Version != 0 { + i = encodeVarintCommitInfo(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *StoreInfo) 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 *StoreInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StoreInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.CommitId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCommitInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintCommitInfo(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CommitID) 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 *CommitID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintCommitInfo(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } + if m.Version != 0 { + i = encodeVarintCommitInfo(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintCommitInfo(dAtA []byte, offset int, v uint64) int { + offset -= sovCommitInfo(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CommitInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != 0 { + n += 1 + sovCommitInfo(uint64(m.Version)) + } + if len(m.StoreInfos) > 0 { + for _, e := range m.StoreInfos { + l = e.Size() + n += 1 + l + sovCommitInfo(uint64(l)) + } + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovCommitInfo(uint64(l)) + return n +} + +func (m *StoreInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovCommitInfo(uint64(l)) + } + l = m.CommitId.Size() + n += 1 + l + sovCommitInfo(uint64(l)) + return n +} + +func (m *CommitID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Version != 0 { + n += 1 + sovCommitInfo(uint64(m.Version)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovCommitInfo(uint64(l)) + } + return n +} + +func sovCommitInfo(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCommitInfo(x uint64) (n int) { + return sovCommitInfo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CommitInfo) 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 ErrIntOverflowCommitInfo + } + 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: CommitInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StoreInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StoreInfos = append(m.StoreInfos, StoreInfo{}) + if err := m.StoreInfos[len(m.StoreInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommitInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommitInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoreInfo) 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 ErrIntOverflowCommitInfo + } + 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: StoreInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoreInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitId", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommitId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommitInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommitInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommitID) 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 ErrIntOverflowCommitInfo + } + 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: CommitID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommitInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCommitInfo + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCommitInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommitInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCommitInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCommitInfo(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, ErrIntOverflowCommitInfo + } + 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, ErrIntOverflowCommitInfo + } + 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, ErrIntOverflowCommitInfo + } + 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, ErrInvalidLengthCommitInfo + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCommitInfo + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCommitInfo + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCommitInfo = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCommitInfo = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCommitInfo = fmt.Errorf("proto: unexpected end of group") +) diff --git a/store/v2/root/factory.go b/store/v2/root/factory.go index b568792641ad..fb90c575e783 100644 --- a/store/v2/root/factory.go +++ b/store/v2/root/factory.go @@ -16,7 +16,9 @@ import ( "cosmossdk.io/store/v2/db" "cosmossdk.io/store/v2/internal" "cosmossdk.io/store/v2/metrics" + "cosmossdk.io/store/v2/migration" "cosmossdk.io/store/v2/pruning" + "cosmossdk.io/store/v2/snapshots" ) type ( @@ -28,6 +30,8 @@ const ( SCTypeIavlV2 SCType = "iavl-v2" ) +const storePrefixTpl = "s/k:%s/" // s/k: + // Options are the options for creating a root store. type Options struct { SCType SCType `mapstructure:"sc-type" toml:"sc-type" comment:"State commitment database type. Currently we support: \"iavl\" and \"iavl-v2\""` @@ -86,7 +90,7 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { return nil, fmt.Errorf("tried to construct a root store with no store keys specified but no commit info found for version %d", latestVersion) } for _, si := range lastCommitInfo.StoreInfos { - opts.StoreKeys = append(opts.StoreKeys, string(si.Name)) + opts.StoreKeys = append(opts.StoreKeys, si.Name) } } removedStoreKeys, err := metadata.GetRemovedStoreKeys(latestVersion) @@ -94,13 +98,13 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { return nil, err } - newTreeFn := func(key string) (commitment.Tree, error) { + newTreeFn := func(key string, scType SCType) (commitment.Tree, error) { if internal.IsMemoryStoreKey(key) { return mem.New(), nil } else { - switch storeOpts.SCType { + switch scType { case SCTypeIavl: - return iavl.NewIavlTree(db.NewPrefixDB(opts.SCRawDB, []byte(key)), opts.Logger, storeOpts.IavlConfig), nil + return iavl.NewIavlTree(db.NewPrefixDB(opts.SCRawDB, []byte(fmt.Sprintf(storePrefixTpl, key))), opts.Logger, storeOpts.IavlConfig), nil case SCTypeIavlV2: dir := fmt.Sprintf("%s/data/iavl-v2/%s", opts.RootDir, key) return iavlv2.NewTree(opts.Options.IavlV2Config, iavl_v2.SqliteDbOptions{Path: dir}, opts.Logger) @@ -110,17 +114,37 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { } } + // check if we need to migrate the store + isMigrating := false + scType := storeOpts.SCType + + if scType != SCTypeIavl { + isMigrating = true // need to migrate + scType = SCTypeIavl // only support iavl v1 for migration + } + trees := make(map[string]commitment.Tree, len(opts.StoreKeys)) for _, key := range opts.StoreKeys { - tree, err := newTreeFn(key) + tree, err := newTreeFn(key, scType) if err != nil { return nil, err } + if isMigrating { + v, err := tree.GetLatestVersion() + if err != nil { + return nil, err + } + if v == 0 && latestVersion > 0 { + if err := tree.SetInitialVersion(latestVersion + 1); err != nil { + return nil, err + } + } + } trees[key] = tree } oldTrees := make(map[string]commitment.Tree, len(opts.StoreKeys)) for _, key := range removedStoreKeys { - tree, err := newTreeFn(string(key)) + tree, err := newTreeFn(string(key), scType) if err != nil { return nil, err } @@ -132,6 +156,31 @@ func CreateRootStore(opts *FactoryOptions) (store.RootStore, error) { return nil, err } + var mm *migration.Manager + if isMigrating { + snapshotDB, err := snapshots.NewStore(fmt.Sprintf("%s/data/snapshots/store.db", opts.RootDir)) + if err != nil { + return nil, err + } + snapshotMgr := snapshots.NewManager(snapshotDB, snapshots.SnapshotOptions{}, sc, nil, opts.Logger) + var newSC *commitment.CommitStore + if scType != storeOpts.SCType { + newTrees := make(map[string]commitment.Tree, len(opts.StoreKeys)) + for _, key := range opts.StoreKeys { + tree, err := newTreeFn(key, storeOpts.SCType) + if err != nil { + return nil, err + } + newTrees[key] = tree + } + newSC, err = commitment.NewCommitStore(newTrees, nil, opts.SCRawDB, opts.Logger) + if err != nil { + return nil, err + } + } + mm = migration.NewManager(opts.SCRawDB, snapshotMgr, newSC, opts.Logger) + } + pm := pruning.NewManager(sc, storeOpts.SCPruningOption) - return New(opts.SCRawDB, opts.Logger, sc, pm, nil, metrics.NoOpMetrics{}) + return New(opts.SCRawDB, opts.Logger, sc, pm, mm, metrics.NoOpMetrics{}) } diff --git a/store/v2/root/factory_test.go b/store/v2/root/factory_test.go index 1da5e4309ab8..031ccd0adfa1 100644 --- a/store/v2/root/factory_test.go +++ b/store/v2/root/factory_test.go @@ -3,8 +3,10 @@ package root import ( "testing" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" + corestore "cosmossdk.io/core/store" coretesting "cosmossdk.io/core/testing" "cosmossdk.io/store/v2/db" ) @@ -26,4 +28,19 @@ func TestFactory(t *testing.T) { f, err = CreateRootStore(&fop) require.NoError(t, err) require.NotNil(t, f) + + require.NoError(t, setLatestVersion(fop.SCRawDB, 1)) + fop.Options.SCType = SCTypeIavl + f, err = CreateRootStore(&fop) + require.NoError(t, err) + require.NotNil(t, f) + require.False(t, f.(*Store).isMigrating) +} + +func setLatestVersion(db corestore.KVStoreWithBatch, version int64) error { + bz, err := gogotypes.StdInt64Marshal(version) + if err != nil { + panic(err) + } + return db.Set([]byte("s/latest"), bz) } diff --git a/store/v2/root/store.go b/store/v2/root/store.go index 3104260d11b3..c0d06420a7c6 100644 --- a/store/v2/root/store.go +++ b/store/v2/root/store.go @@ -152,7 +152,7 @@ func (s *Store) LastCommitID() (proof.CommitID, error) { // if the latest version is 0, we return a CommitID with version 0 and a hash of an empty byte slice bz := sha256.Sum256([]byte{}) - return proof.CommitID{Version: latestVersion, Hash: bz[:]}, nil + return proof.CommitID{Version: int64(latestVersion), Hash: bz[:]}, nil } // GetLatestVersion returns the latest version based on the latest internal @@ -164,7 +164,7 @@ func (s *Store) GetLatestVersion() (uint64, error) { return 0, err } - return lastCommitID.Version, nil + return uint64(lastCommitID.Version), nil } func (s *Store) Query(storeKey []byte, version uint64, key []byte, prove bool) (store.QueryResult, error) { @@ -312,13 +312,13 @@ func (s *Store) Commit(cs *corestore.Changeset) ([]byte, error) { } s.logger.Warn(fmt.Sprintf("commit version %d write=%s commit=%s", cs.Version, writeDur, time.Since(st))) - if cInfo.Version != cs.Version { + if cInfo.Version != int64(cs.Version) { return nil, fmt.Errorf("commit version mismatch: got %d, expected %d", cInfo.Version, cs.Version) } s.lastCommitInfo = cInfo // signal to the pruning manager that the commit is done - if err := s.pruningManager.ResumePruning(s.lastCommitInfo.Version); err != nil { + if err := s.pruningManager.ResumePruning(uint64(s.lastCommitInfo.Version)); err != nil { s.logger.Error("failed to signal commit done to pruning manager", "err", err) } @@ -344,7 +344,7 @@ func (s *Store) startMigration() { version := s.lastCommitInfo.Version s.logger.Info("starting migration", "version", version) mtx.Unlock() - if err := s.migrationManager.Start(version, s.chChangeset, s.chDone); err != nil { + if err := s.migrationManager.Start(uint64(version), s.chChangeset, s.chDone); err != nil { s.logger.Error("failed to start migration", "err", err) } }() @@ -358,16 +358,16 @@ func (s *Store) handleMigration(cs *corestore.Changeset) error { if s.isMigrating { // if the migration manager has already migrated to the version, close the // channels and replace the state commitment - if s.migrationManager.GetMigratedVersion() == s.lastCommitInfo.Version { + if s.migrationManager.GetMigratedVersion() == uint64(s.lastCommitInfo.Version) { close(s.chDone) close(s.chChangeset) s.isMigrating = false - // close the old state commitment and replace it with the new one - if err := s.stateCommitment.Close(); err != nil { - return fmt.Errorf("failed to close the old SC store: %w", err) - } newStateCommitment := s.migrationManager.GetStateCommitment() if newStateCommitment != nil { + // close the old state commitment and replace it with the new one + if err := s.stateCommitment.Close(); err != nil { + return fmt.Errorf("failed to close the old SC store: %w", err) + } s.stateCommitment = newStateCommitment } if err := s.migrationManager.Close(); err != nil { @@ -376,7 +376,7 @@ func (s *Store) handleMigration(cs *corestore.Changeset) error { s.logger.Info("migration completed", "version", s.lastCommitInfo.Version) } else { // queue the next changeset to the migration manager - s.chChangeset <- &migration.VersionedChangeset{Version: s.lastCommitInfo.Version + 1, Changeset: cs} + s.chChangeset <- &migration.VersionedChangeset{Version: uint64(s.lastCommitInfo.Version + 1), Changeset: cs} } } return nil diff --git a/tests/go.mod b/tests/go.mod index c0e7107c1bce..880f707593f9 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -3,7 +3,7 @@ module github.com/cosmos/cosmos-sdk/tests go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 diff --git a/tests/go.sum b/tests/go.sum index 6806c7bc057a..b83fdb3809b6 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -192,8 +192,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/tests/integration/baseapp/block_gas_test.go b/tests/integration/baseapp/block_gas_test.go index 97086e20db0f..73b3057897db 100644 --- a/tests/integration/baseapp/block_gas_test.go +++ b/tests/integration/baseapp/block_gas_test.go @@ -172,7 +172,7 @@ func TestBaseApp_BlockGas(t *testing.T) { require.Equal(t, []byte("ok"), okValue) } // check block gas is always consumed - baseGas := uint64(39205) // baseGas is the gas consumed before tx msg + baseGas := uint64(39075) // baseGas is the gas consumed before tx msg expGasConsumed := addUint64Saturating(tc.gasToConsume, baseGas) if expGasConsumed > uint64(simtestutil.DefaultConsensusParams.Block.MaxGas) { // capped by gasLimit diff --git a/tests/systemtests/bank_test.go b/tests/systemtests/bank_test.go index c5c45bca6d63..5dfb98c32fef 100644 --- a/tests/systemtests/bank_test.go +++ b/tests/systemtests/bank_test.go @@ -263,7 +263,7 @@ func TestBankGRPCQueries(t *testing.T) { "error when querying supply with height greater than block height", supplyUrl, map[string]string{ - blockHeightHeader: fmt.Sprintf("%d", blockHeight+5), + blockHeightHeader: fmt.Sprintf("%d", blockHeight+5000), }, http.StatusBadRequest, "invalid height", diff --git a/tests/systemtests/bankv2_test.go b/tests/systemtests/bankv2_test.go index cc7145f8741f..9d4d60914a5b 100644 --- a/tests/systemtests/bankv2_test.go +++ b/tests/systemtests/bankv2_test.go @@ -13,6 +13,8 @@ import ( ) func TestBankV2SendTxCmd(t *testing.T) { + // bankv2 was removed from simapp + t.Skip() // scenario: test bank send command // given a running chain diff --git a/tests/systemtests/distribution_test.go b/tests/systemtests/distribution_test.go index 0cc381786d32..73114ee83193 100644 --- a/tests/systemtests/distribution_test.go +++ b/tests/systemtests/distribution_test.go @@ -179,21 +179,20 @@ func TestDistrValidatorGRPCQueries(t *testing.T) { // test validator slashes grpc endpoint slashURL := baseurl + `/cosmos/distribution/v1beta1/validators/%s/slashes` - invalidStartingHeightOutput := `{"code":3, "message":"1 error(s) decoding:\n\n* cannot parse 'starting_height' as uint: strconv.ParseUint: parsing \"-3\": invalid syntax", "details":[]}` - invalidEndingHeightOutput := `{"code":3, "message":"1 error(s) decoding:\n\n* cannot parse 'ending_height' as uint: strconv.ParseUint: parsing \"-3\": invalid syntax", "details":[]}` + invalidHeightOutput := `{"code":"NUMBER", "details":[], "message":"strconv.ParseUint: parsing \"NUMBER\": invalid syntax"}` slashTestCases := []systest.RestTestCase{ { Name: "invalid start height", Url: fmt.Sprintf(slashURL+`?starting_height=%s&ending_height=%s`, valOperAddr, "-3", "3"), ExpCode: http.StatusBadRequest, - ExpOut: invalidStartingHeightOutput, + ExpOut: invalidHeightOutput, }, { Name: "invalid end height", Url: fmt.Sprintf(slashURL+`?starting_height=%s&ending_height=%s`, valOperAddr, "1", "-3"), ExpCode: http.StatusBadRequest, - ExpOut: invalidEndingHeightOutput, + ExpOut: invalidHeightOutput, }, { Name: "valid request get slashes", diff --git a/tests/systemtests/upgrade_test.go b/tests/systemtests/upgrade_test.go index 81e2b93f5d61..cc2f8497ecff 100644 --- a/tests/systemtests/upgrade_test.go +++ b/tests/systemtests/upgrade_test.go @@ -37,7 +37,7 @@ func TestChainUpgrade(t *testing.T) { const ( upgradeHeight int64 = 22 - upgradeName = "v052-to-v054" // must match UpgradeName in simapp/upgrades.go + upgradeName = "v052-to-v2" // must match UpgradeName in simapp/upgrades.go ) systest.Sut.StartChain(t, fmt.Sprintf("--comet.halt-height=%d", upgradeHeight+1)) diff --git a/testutil/queryclient/queryclient.go b/testutil/queryclient/queryclient.go new file mode 100644 index 000000000000..8502fcb5d5bd --- /dev/null +++ b/testutil/queryclient/queryclient.go @@ -0,0 +1,131 @@ +package queryclient + +import ( + "context" + "fmt" + + abci "github.com/cometbft/cometbft/api/cometbft/abci/v1" + gogogrpc "github.com/cosmos/gogoproto/grpc" + "google.golang.org/grpc" + "google.golang.org/grpc/encoding" + + "github.com/cosmos/cosmos-sdk/client/grpc/reflection" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" +) + +var ( + _ gogogrpc.ClientConn = &QueryHelper{} + _ gogogrpc.Server = &QueryHelper{} +) + +// QueryHelper is a test utility for building a query client from a proto interface registry. +type QueryHelper struct { + cdc encoding.Codec + routes map[string]GRPCQueryHandler +} + +func NewQueryHelper(interfaceRegistry codectypes.InterfaceRegistry) *QueryHelper { + // instantiate the codec + cdc := codec.NewProtoCodec(interfaceRegistry).GRPCCodec() + // Once we have an interface registry, we can register the interface + // registry reflection gRPC service. + + qh := &QueryHelper{ + cdc: cdc, + routes: map[string]GRPCQueryHandler{}, + } + + reflection.RegisterReflectionServiceServer(qh, reflection.NewReflectionServiceServer(interfaceRegistry)) + + return qh +} + +// Invoke implements the grpc ClientConn.Invoke method +func (q *QueryHelper) Invoke(ctx context.Context, method string, args, reply interface{}, _ ...grpc.CallOption) error { + querier := q.Route(method) + if querier == nil { + return fmt.Errorf("handler not found for %s", method) + } + reqBz, err := q.cdc.Marshal(args) + if err != nil { + return err + } + + res, err := querier(ctx, &abci.QueryRequest{Data: reqBz}) + if err != nil { + return err + } + + err = q.cdc.Unmarshal(res.Value, reply) + if err != nil { + return err + } + + return nil +} + +// NewStream implements the grpc ClientConn.NewStream method +func (q *QueryHelper) NewStream(context.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error) { + panic("not implemented") +} + +// GRPCQueryHandler defines a function type which handles ABCI Query requests +// using gRPC +type GRPCQueryHandler = func(ctx context.Context, req *abci.QueryRequest) (*abci.QueryResponse, error) + +// Route returns the GRPCQueryHandler for a given query route path or nil +// if not found +func (q *QueryHelper) Route(path string) GRPCQueryHandler { + handler, found := q.routes[path] + if !found { + return nil + } + return handler +} + +// RegisterService implements the gRPC Server.RegisterService method. sd is a gRPC +// service description, handler is an object which implements that gRPC service/ +// +// This functions PANICS: +// - if a protobuf service is registered twice. +func (q *QueryHelper) RegisterService(sd *grpc.ServiceDesc, handler interface{}) { + // adds a top-level query handler based on the gRPC service name + for _, method := range sd.Methods { + q.registerABCIQueryHandler(sd, method, handler) + } +} + +func (q *QueryHelper) registerABCIQueryHandler(sd *grpc.ServiceDesc, method grpc.MethodDesc, handler interface{}) { + fqName := fmt.Sprintf("/%s/%s", sd.ServiceName, method.MethodName) + methodHandler := method.Handler + + _, found := q.routes[fqName] + if found { + panic(fmt.Sprintf("handler for %s already registered", fqName)) + } + + q.routes[fqName] = func(ctx context.Context, req *abci.QueryRequest) (*abci.QueryResponse, error) { + // call the method handler from the service description with the handler object, + // a wrapped sdk.Context with proto-unmarshaled data from the ABCI request data + res, err := methodHandler(handler, ctx, func(i interface{}) error { + return q.cdc.Unmarshal(req.Data, i) + }, nil) + if err != nil { + return nil, err + } + + // proto marshal the result bytes + var resBytes []byte + resBytes, err = q.cdc.Marshal(res) + if err != nil { + return nil, err + } + + // return the result bytes as the response value + return &abci.QueryResponse{ + Height: req.Height, + Value: resBytes, + }, nil + } +} diff --git a/testutil/sims/state_helpers.go b/testutil/sims/state_helpers.go index 8e229891c7e7..53385e2c81d8 100644 --- a/testutil/sims/state_helpers.go +++ b/testutil/sims/state_helpers.go @@ -42,6 +42,23 @@ func AppStateFn( addressCodec, validatorCodec address.Codec, modules []module.AppModuleSimulation, genesisState map[string]json.RawMessage, +) simtypes.AppStateFn { + return AppStateFnWithExtendedCbs(cdc, addressCodec, validatorCodec, modules, genesisState, nil, nil) +} + +// AppStateFnWithExtendedCbs returns the initial application state using a genesis or the simulation parameters. +// It panics if the user provides files for both of them. +// If a file is not given for the genesis or the sim params, it creates a randomized one. +// genesisState is the default genesis state of the whole app. +// moduleStateCb is the callback function to access moduleState. +// postRawStateCb is the callback function to extend rawState. +func AppStateFnWithExtendedCbs( + cdc codec.JSONCodec, + addressCodec, validatorCodec address.Codec, + modules []module.AppModuleSimulation, + genesisState map[string]json.RawMessage, + moduleStateCb func(moduleName string, genesisState interface{}), + postRawStateCb func(rawState map[string]json.RawMessage), ) simtypes.AppStateFn { return func( r *rand.Rand, @@ -143,9 +160,17 @@ func AppStateFn( stakingtypes.ModuleName: stakingState, testutil.BankModuleName: bankState, } { + if moduleStateCb != nil { + moduleStateCb(name, state) + } rawState[name] = cdc.MustMarshalJSON(state) } + // extend state from callback function + if postRawStateCb != nil { + postRawStateCb(rawState) + } + // replace appstate appState, err = json.Marshal(rawState) if err != nil { diff --git a/tools/benchmark/go.mod b/tools/benchmark/go.mod index f19d0d30b0b6..135240856eac 100644 --- a/tools/benchmark/go.mod +++ b/tools/benchmark/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/tools/benchmark go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 cosmossdk.io/log v1.5.0 diff --git a/tools/benchmark/go.sum b/tools/benchmark/go.sum index 15ccfaeaa5fa..508a4b3ee729 100644 --- a/tools/benchmark/go.sum +++ b/tools/benchmark/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go index 5037f2c605d6..dd948ddaafe6 100644 --- a/types/tx/tx.pb.go +++ b/types/tx/tx.pb.go @@ -473,6 +473,105 @@ func (m *TxBody) GetNonCriticalExtensionOptions() []*any.Any { return nil } +// TxBodyCompat is the body of a transaction that all signers sign over. +// This message is used to represent the transaction body before the unordered +// features was added. It is used to support backwards compatibility when user a newer +// client with an older chain. +type TxBodyCompat struct { + // messages is a list of messages to be executed. The required signers of + // those messages define the number and order of elements in AuthInfo's + // signer_infos and Tx's signatures. Each required signer address is added to + // the list only the first time it occurs. + // By convention, the first required signer (usually from the first message) + // is referred to as the primary signer and pays the fee for the whole + // transaction. + Messages []*any.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + // memo is any arbitrary note/comment to be added to the transaction. + // WARNING: in clients, any publicly exposed text should not be called memo, + // but should be called `note` instead (see + // https://github.com/cosmos/cosmos-sdk/issues/9122). + Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` + // timeout_height is the block height after which this transaction will not + // be processed by the chain. + TimeoutHeight uint64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, the transaction will be rejected + ExtensionOptions []*any.Any `protobuf:"bytes,1023,rep,name=extension_options,json=extensionOptions,proto3" json:"extension_options,omitempty"` + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, they will be ignored + NonCriticalExtensionOptions []*any.Any `protobuf:"bytes,2047,rep,name=non_critical_extension_options,json=nonCriticalExtensionOptions,proto3" json:"non_critical_extension_options,omitempty"` +} + +func (m *TxBodyCompat) Reset() { *m = TxBodyCompat{} } +func (m *TxBodyCompat) String() string { return proto.CompactTextString(m) } +func (*TxBodyCompat) ProtoMessage() {} +func (*TxBodyCompat) Descriptor() ([]byte, []int) { + return fileDescriptor_96d1575ffde80842, []int{5} +} +func (m *TxBodyCompat) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TxBodyCompat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TxBodyCompat.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 *TxBodyCompat) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxBodyCompat.Merge(m, src) +} +func (m *TxBodyCompat) XXX_Size() int { + return m.Size() +} +func (m *TxBodyCompat) XXX_DiscardUnknown() { + xxx_messageInfo_TxBodyCompat.DiscardUnknown(m) +} + +var xxx_messageInfo_TxBodyCompat proto.InternalMessageInfo + +func (m *TxBodyCompat) GetMessages() []*any.Any { + if m != nil { + return m.Messages + } + return nil +} + +func (m *TxBodyCompat) GetMemo() string { + if m != nil { + return m.Memo + } + return "" +} + +func (m *TxBodyCompat) GetTimeoutHeight() uint64 { + if m != nil { + return m.TimeoutHeight + } + return 0 +} + +func (m *TxBodyCompat) GetExtensionOptions() []*any.Any { + if m != nil { + return m.ExtensionOptions + } + return nil +} + +func (m *TxBodyCompat) GetNonCriticalExtensionOptions() []*any.Any { + if m != nil { + return m.NonCriticalExtensionOptions + } + return nil +} + // AuthInfo describes the fee and signer modes that are used to sign a // transaction. type AuthInfo struct { @@ -497,7 +596,7 @@ func (m *AuthInfo) Reset() { *m = AuthInfo{} } func (m *AuthInfo) String() string { return proto.CompactTextString(m) } func (*AuthInfo) ProtoMessage() {} func (*AuthInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{5} + return fileDescriptor_96d1575ffde80842, []int{6} } func (m *AuthInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -568,7 +667,7 @@ func (m *SignerInfo) Reset() { *m = SignerInfo{} } func (m *SignerInfo) String() string { return proto.CompactTextString(m) } func (*SignerInfo) ProtoMessage() {} func (*SignerInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{6} + return fileDescriptor_96d1575ffde80842, []int{7} } func (m *SignerInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -634,7 +733,7 @@ func (m *ModeInfo) Reset() { *m = ModeInfo{} } func (m *ModeInfo) String() string { return proto.CompactTextString(m) } func (*ModeInfo) ProtoMessage() {} func (*ModeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{7} + return fileDescriptor_96d1575ffde80842, []int{8} } func (m *ModeInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -720,7 +819,7 @@ func (m *ModeInfo_Single) Reset() { *m = ModeInfo_Single{} } func (m *ModeInfo_Single) String() string { return proto.CompactTextString(m) } func (*ModeInfo_Single) ProtoMessage() {} func (*ModeInfo_Single) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{7, 0} + return fileDescriptor_96d1575ffde80842, []int{8, 0} } func (m *ModeInfo_Single) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -769,7 +868,7 @@ func (m *ModeInfo_Multi) Reset() { *m = ModeInfo_Multi{} } func (m *ModeInfo_Multi) String() string { return proto.CompactTextString(m) } func (*ModeInfo_Multi) ProtoMessage() {} func (*ModeInfo_Multi) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{7, 1} + return fileDescriptor_96d1575ffde80842, []int{8, 1} } func (m *ModeInfo_Multi) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -837,7 +936,7 @@ func (m *Fee) Reset() { *m = Fee{} } func (m *Fee) String() string { return proto.CompactTextString(m) } func (*Fee) ProtoMessage() {} func (*Fee) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{8} + return fileDescriptor_96d1575ffde80842, []int{9} } func (m *Fee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -908,7 +1007,7 @@ func (m *Tip) Reset() { *m = Tip{} } func (m *Tip) String() string { return proto.CompactTextString(m) } func (*Tip) ProtoMessage() {} func (*Tip) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{9} + return fileDescriptor_96d1575ffde80842, []int{10} } func (m *Tip) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -974,7 +1073,7 @@ func (m *AuxSignerData) Reset() { *m = AuxSignerData{} } func (m *AuxSignerData) String() string { return proto.CompactTextString(m) } func (*AuxSignerData) ProtoMessage() {} func (*AuxSignerData) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{10} + return fileDescriptor_96d1575ffde80842, []int{11} } func (m *AuxSignerData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1037,6 +1136,7 @@ func init() { proto.RegisterType((*SignDoc)(nil), "cosmos.tx.v1beta1.SignDoc") proto.RegisterType((*SignDocDirectAux)(nil), "cosmos.tx.v1beta1.SignDocDirectAux") proto.RegisterType((*TxBody)(nil), "cosmos.tx.v1beta1.TxBody") + proto.RegisterType((*TxBodyCompat)(nil), "cosmos.tx.v1beta1.TxBodyCompat") proto.RegisterType((*AuthInfo)(nil), "cosmos.tx.v1beta1.AuthInfo") proto.RegisterType((*SignerInfo)(nil), "cosmos.tx.v1beta1.SignerInfo") proto.RegisterType((*ModeInfo)(nil), "cosmos.tx.v1beta1.ModeInfo") @@ -1050,79 +1150,81 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) } var fileDescriptor_96d1575ffde80842 = []byte{ - // 1147 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0x8f, 0xe3, 0x24, 0x9b, 0xbc, 0xee, 0xb6, 0xbb, 0x43, 0x8b, 0xb2, 0x29, 0xcd, 0x2e, 0xa9, - 0x0a, 0x51, 0xc5, 0xda, 0xed, 0x16, 0x41, 0xa9, 0x10, 0x25, 0x69, 0xa9, 0x5a, 0x95, 0x82, 0xf0, - 0xee, 0xa9, 0x17, 0x6b, 0x62, 0xcf, 0x3a, 0xa3, 0xc6, 0x33, 0xc6, 0x33, 0x86, 0xf8, 0xc8, 0x05, - 0x4e, 0x48, 0x15, 0x17, 0x24, 0x3e, 0x01, 0xe2, 0xd4, 0x43, 0x25, 0xbe, 0x42, 0xb9, 0x55, 0x3d, - 0x21, 0x0e, 0x6d, 0xd5, 0x3d, 0xf4, 0x63, 0x80, 0x3c, 0x1e, 0x7b, 0xb7, 0xdd, 0x34, 0x0b, 0x02, - 0x89, 0x4b, 0xe4, 0x79, 0xf3, 0x7b, 0x6f, 0x7e, 0xef, 0x7f, 0xa0, 0xe3, 0x71, 0x11, 0x72, 0x61, - 0xcb, 0xa9, 0xfd, 0xd5, 0xf9, 0x11, 0x91, 0xf8, 0xbc, 0x2d, 0xa7, 0x56, 0x14, 0x73, 0xc9, 0xd1, - 0x4a, 0x7e, 0x67, 0xc9, 0xa9, 0xa5, 0xef, 0x3a, 0xab, 0xb9, 0xc8, 0x55, 0x00, 0x5b, 0xdf, 0xab, - 0x43, 0x67, 0x05, 0x87, 0x94, 0x71, 0x5b, 0xfd, 0x6a, 0xd1, 0xf1, 0x80, 0x07, 0x3c, 0x87, 0x66, - 0x5f, 0x5a, 0xba, 0xa1, 0x9f, 0xf4, 0xe2, 0x34, 0x92, 0xdc, 0x0e, 0x93, 0x89, 0xa4, 0x82, 0x06, - 0xe5, 0xfb, 0x85, 0x40, 0xc3, 0xbb, 0x1a, 0x3e, 0xc2, 0x82, 0x94, 0x18, 0x8f, 0x53, 0xa6, 0xef, - 0xdf, 0xde, 0xf3, 0x40, 0xd0, 0x80, 0x51, 0xb6, 0x67, 0x49, 0x9f, 0x35, 0x70, 0x35, 0xe0, 0x3c, - 0x98, 0x10, 0x5b, 0x9d, 0x46, 0xc9, 0x8e, 0x8d, 0x59, 0xaa, 0xaf, 0xd6, 0x5e, 0xbe, 0x92, 0x34, - 0x24, 0x42, 0xe2, 0x30, 0xca, 0x01, 0xbd, 0xef, 0x0d, 0xa8, 0x6e, 0x4f, 0xd1, 0x06, 0xd4, 0x46, - 0xdc, 0x4f, 0xdb, 0xc6, 0xba, 0xd1, 0x3f, 0xb2, 0xb9, 0x6a, 0x1d, 0x08, 0x90, 0xb5, 0x3d, 0x1d, - 0x72, 0x3f, 0x75, 0x14, 0x0c, 0x5d, 0x84, 0x16, 0x4e, 0xe4, 0xd8, 0xa5, 0x6c, 0x87, 0xb7, 0xab, - 0x4a, 0xe7, 0xe4, 0x0c, 0x9d, 0x41, 0x22, 0xc7, 0x37, 0xd8, 0x0e, 0x77, 0x9a, 0x58, 0x7f, 0xa1, - 0x2e, 0x40, 0x46, 0x1e, 0xcb, 0x24, 0x26, 0xa2, 0x6d, 0xae, 0x9b, 0xfd, 0x45, 0x67, 0x9f, 0xa4, - 0xc7, 0xa0, 0xbe, 0x3d, 0x75, 0xf0, 0xd7, 0xe8, 0x14, 0x40, 0xf6, 0x94, 0x3b, 0x4a, 0x25, 0x11, - 0x8a, 0xd7, 0xa2, 0xd3, 0xca, 0x24, 0xc3, 0x4c, 0x80, 0xde, 0x82, 0x63, 0x25, 0x03, 0x8d, 0xa9, - 0x2a, 0xcc, 0x52, 0xf1, 0x54, 0x8e, 0x3b, 0xec, 0xbd, 0x1f, 0x0c, 0x58, 0xd8, 0xa2, 0x01, 0xbb, - 0xca, 0xbd, 0xff, 0xea, 0xc9, 0x55, 0x68, 0x7a, 0x63, 0x4c, 0x99, 0x4b, 0xfd, 0xb6, 0xb9, 0x6e, - 0xf4, 0x5b, 0xce, 0x82, 0x3a, 0xdf, 0xf0, 0xd1, 0x19, 0x38, 0x8a, 0x3d, 0x8f, 0x27, 0x4c, 0xba, - 0x2c, 0x09, 0x47, 0x24, 0x6e, 0xd7, 0xd6, 0x8d, 0x7e, 0xcd, 0x59, 0xd2, 0xd2, 0xcf, 0x94, 0xb0, - 0xf7, 0x5d, 0x15, 0x96, 0x35, 0xa9, 0xab, 0x34, 0x26, 0x9e, 0x1c, 0x24, 0xd3, 0xc3, 0xd8, 0x5d, - 0x00, 0x88, 0x92, 0xd1, 0x84, 0x7a, 0xee, 0x1d, 0x92, 0xea, 0x9c, 0x1c, 0xb7, 0xf2, 0xf4, 0x5b, - 0x45, 0xfa, 0xad, 0x01, 0x4b, 0x9d, 0x56, 0x8e, 0xbb, 0x49, 0xd2, 0x7f, 0x4f, 0x15, 0x75, 0xa0, - 0x29, 0xc8, 0x97, 0x09, 0x61, 0x1e, 0x69, 0xd7, 0x15, 0xa0, 0x3c, 0xa3, 0x77, 0xc0, 0x94, 0x34, - 0x6a, 0x37, 0x14, 0x97, 0xd7, 0x67, 0xd5, 0x14, 0x8d, 0x86, 0xd5, 0xb6, 0xe1, 0x64, 0xb0, 0x4b, - 0xaf, 0x3d, 0xba, 0xbf, 0x71, 0x2c, 0xc7, 0x6c, 0x08, 0xff, 0xce, 0xfa, 0x39, 0xeb, 0xdd, 0xf7, - 0x7a, 0xdf, 0x9a, 0xd0, 0xc8, 0x2b, 0x0f, 0x9d, 0x83, 0x66, 0x48, 0x84, 0xc0, 0x81, 0xf2, 0xde, - 0x7c, 0xa5, 0x7b, 0x25, 0x0a, 0x21, 0xa8, 0x85, 0x24, 0xcc, 0x0b, 0xb4, 0xe5, 0xa8, 0xef, 0xcc, - 0xad, 0xac, 0x05, 0x78, 0x22, 0xdd, 0x31, 0xa1, 0xc1, 0x58, 0x2a, 0xbf, 0x6b, 0xce, 0x92, 0x96, - 0x5e, 0x57, 0x42, 0xf4, 0x06, 0xb4, 0x12, 0xc6, 0x63, 0x9f, 0xc4, 0xc4, 0x57, 0x8e, 0x37, 0x9d, - 0x3d, 0x01, 0xfa, 0x02, 0x56, 0x0a, 0x23, 0x65, 0x3f, 0x29, 0xef, 0x8f, 0x6c, 0x76, 0x0e, 0x70, - 0xda, 0x2e, 0x10, 0xc3, 0xe6, 0x83, 0xc7, 0x6b, 0xc6, 0xdd, 0x27, 0x6b, 0x86, 0xb3, 0xac, 0xd5, - 0xcb, 0x3b, 0x34, 0x84, 0x15, 0x32, 0x95, 0x84, 0x09, 0xca, 0x99, 0xcb, 0x23, 0x49, 0x39, 0x13, - 0xed, 0x3f, 0x17, 0xe6, 0xf8, 0xb9, 0x5c, 0xe2, 0x3f, 0xcf, 0xe1, 0xe8, 0x36, 0x74, 0x19, 0x67, - 0xae, 0x17, 0x53, 0x49, 0x3d, 0x3c, 0x71, 0x67, 0x18, 0x3c, 0x36, 0xc7, 0xe0, 0x49, 0xc6, 0xd9, - 0x15, 0xad, 0xfb, 0xc9, 0x4b, 0xb6, 0x7b, 0xbf, 0x1a, 0xd0, 0x2c, 0xda, 0x19, 0x7d, 0x0c, 0x8b, - 0x59, 0x0b, 0x91, 0x58, 0xf5, 0x42, 0x91, 0x8e, 0x53, 0x33, 0x32, 0xbc, 0xa5, 0x60, 0x6a, 0x06, - 0x1c, 0x11, 0xe5, 0xb7, 0x40, 0x7d, 0x30, 0x77, 0x08, 0xd1, 0x65, 0x3a, 0xab, 0x34, 0xae, 0x11, - 0xe2, 0x64, 0x10, 0x74, 0x39, 0x2f, 0x22, 0x73, 0x6e, 0x11, 0x9d, 0xf8, 0xe3, 0x60, 0xed, 0xe8, - 0xba, 0xea, 0xfd, 0x68, 0x00, 0xec, 0xd1, 0x78, 0xa9, 0x4f, 0x8c, 0xbf, 0xd7, 0x27, 0x17, 0xa1, - 0x15, 0x72, 0x9f, 0x1c, 0x36, 0xef, 0x6e, 0x71, 0x9f, 0xe4, 0xf3, 0x2e, 0xd4, 0x5f, 0x2f, 0xf4, - 0x87, 0xf9, 0x62, 0x7f, 0xf4, 0x9e, 0x56, 0xa1, 0x59, 0xa8, 0xa0, 0x0f, 0xa1, 0x21, 0x28, 0x0b, - 0x26, 0x44, 0x73, 0xea, 0xcd, 0xb1, 0x6f, 0x6d, 0x29, 0xe4, 0xf5, 0x8a, 0xa3, 0x75, 0xd0, 0x07, - 0x50, 0x57, 0xdb, 0x45, 0x93, 0x7b, 0x73, 0x9e, 0xf2, 0xad, 0x0c, 0x78, 0xbd, 0xe2, 0xe4, 0x1a, - 0x9d, 0x01, 0x34, 0x72, 0x73, 0xe8, 0x7d, 0xa8, 0x65, 0xbc, 0x15, 0x81, 0xa3, 0x9b, 0xa7, 0xf7, - 0xd9, 0x28, 0xf6, 0xcd, 0xfe, 0xb4, 0x66, 0xf6, 0x1c, 0xa5, 0xd0, 0xb9, 0x6b, 0x40, 0x5d, 0x59, - 0x45, 0x37, 0xa1, 0x39, 0xa2, 0x12, 0xc7, 0x31, 0x2e, 0x62, 0x6b, 0x17, 0x66, 0xf2, 0xad, 0x68, - 0x95, 0x4b, 0xb0, 0xb0, 0x75, 0x85, 0x87, 0x11, 0xf6, 0xe4, 0x90, 0xca, 0x41, 0xa6, 0xe6, 0x94, - 0x06, 0xd0, 0x25, 0x80, 0x32, 0xea, 0xd9, 0xac, 0x35, 0x0f, 0x0b, 0x7b, 0xab, 0x08, 0xbb, 0x18, - 0xd6, 0xc1, 0x14, 0x49, 0xd8, 0xfb, 0xa6, 0x0a, 0xe6, 0x35, 0x42, 0x50, 0x0a, 0x0d, 0x1c, 0x66, - 0x63, 0x4b, 0xd7, 0x6a, 0xb9, 0xe1, 0xb2, 0xe5, 0xbb, 0x8f, 0x0a, 0x65, 0xc3, 0x6b, 0x0f, 0x1e, - 0xaf, 0x55, 0x7e, 0x79, 0xb2, 0xd6, 0x0f, 0xa8, 0x1c, 0x27, 0x23, 0xcb, 0xe3, 0xa1, 0x5d, 0x2c, - 0xf6, 0xb2, 0xc2, 0x6c, 0x99, 0x46, 0x44, 0x28, 0x05, 0xf1, 0xd3, 0xf3, 0x7b, 0x67, 0x17, 0x27, - 0x24, 0xc0, 0x5e, 0xea, 0x66, 0xeb, 0x5b, 0xfc, 0xfc, 0xfc, 0xde, 0x59, 0xc3, 0xd1, 0x0f, 0xa2, - 0x93, 0xd0, 0x0a, 0xb0, 0x70, 0x27, 0x34, 0xa4, 0x52, 0xa5, 0xa7, 0xe6, 0x34, 0x03, 0x2c, 0x3e, - 0xcd, 0xce, 0xc8, 0x82, 0x7a, 0x84, 0x53, 0x12, 0xe7, 0xd3, 0x77, 0xd8, 0x7e, 0x74, 0x7f, 0xe3, - 0xb8, 0x66, 0x36, 0xf0, 0xfd, 0x98, 0x08, 0xb1, 0x25, 0x63, 0xca, 0x02, 0x27, 0x87, 0xa1, 0x4d, - 0x58, 0x08, 0x62, 0xcc, 0xa4, 0x1e, 0xc7, 0xf3, 0x34, 0x0a, 0x60, 0xef, 0x37, 0x03, 0xcc, 0x6d, - 0x1a, 0xfd, 0x9f, 0x31, 0x38, 0x07, 0x0d, 0x49, 0xa3, 0x88, 0xc4, 0xf9, 0x2c, 0x9e, 0xc3, 0x5a, - 0xe3, 0x2e, 0x9d, 0x78, 0x34, 0xab, 0xa3, 0x7b, 0xbb, 0x06, 0x2c, 0x0d, 0x92, 0x69, 0xde, 0xcf, - 0x57, 0xb1, 0xc4, 0x59, 0x44, 0x70, 0x6e, 0x41, 0x15, 0xdc, 0xdc, 0x88, 0x68, 0x20, 0xfa, 0x08, - 0x9a, 0x59, 0x45, 0xbb, 0x3e, 0xf7, 0x74, 0xc3, 0x9c, 0x7e, 0xc5, 0xec, 0xda, 0xbf, 0x81, 0x9d, - 0x05, 0xa1, 0xff, 0x28, 0x14, 0x8d, 0x62, 0xfe, 0xc3, 0x46, 0x41, 0xcb, 0x60, 0x0a, 0x1a, 0xa8, - 0xd4, 0x2d, 0x3a, 0xd9, 0xe7, 0xcc, 0xad, 0x37, 0xbc, 0xfc, 0xe0, 0x59, 0xd7, 0x78, 0xf8, 0xac, - 0x6b, 0x3c, 0x7d, 0xd6, 0x35, 0xee, 0xee, 0x76, 0x2b, 0x0f, 0x77, 0xbb, 0x95, 0xdf, 0x77, 0xbb, - 0x95, 0xdb, 0x67, 0x0e, 0x4f, 0x88, 0x2d, 0xa7, 0xa3, 0x86, 0x1a, 0x64, 0x17, 0xfe, 0x0a, 0x00, - 0x00, 0xff, 0xff, 0x72, 0x63, 0x4f, 0x0e, 0x05, 0x0b, 0x00, 0x00, + // 1170 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x8f, 0x14, 0xc5, + 0x17, 0xdf, 0x9e, 0x9e, 0x99, 0x9d, 0x79, 0xcc, 0xc2, 0x6e, 0x7d, 0xe1, 0x9b, 0xd9, 0x41, 0x66, + 0xd7, 0x21, 0xe8, 0x84, 0xb8, 0xdd, 0xb0, 0x18, 0x45, 0x62, 0xc4, 0x19, 0x90, 0x40, 0x10, 0x8d, + 0xbd, 0x7b, 0xe2, 0xd2, 0xa9, 0xe9, 0xae, 0xed, 0xa9, 0x30, 0x5d, 0xd5, 0x76, 0x55, 0xeb, 0xf4, + 0xd1, 0x8b, 0x9e, 0x4c, 0x88, 0x17, 0x13, 0xfd, 0x07, 0x8c, 0x27, 0x0e, 0x24, 0xfe, 0x0b, 0x78, + 0x23, 0x9c, 0x8c, 0x07, 0x20, 0xec, 0x81, 0x3f, 0x43, 0xd3, 0xd5, 0xd5, 0xbd, 0x0b, 0x0c, 0xb3, + 0x1a, 0x8d, 0x7a, 0xe9, 0x74, 0xbd, 0xfa, 0xbc, 0x57, 0x9f, 0x7a, 0xaf, 0xde, 0x0f, 0xe8, 0x78, + 0x5c, 0x84, 0x5c, 0xd8, 0x72, 0x6a, 0x7f, 0x76, 0x76, 0x44, 0x24, 0x3e, 0x6b, 0xcb, 0xa9, 0x15, + 0xc5, 0x5c, 0x72, 0xb4, 0x92, 0xef, 0x59, 0x72, 0x6a, 0xe9, 0xbd, 0xce, 0x6a, 0x2e, 0x72, 0x15, + 0xc0, 0xd6, 0xfb, 0x6a, 0xd1, 0x59, 0xc1, 0x21, 0x65, 0xdc, 0x56, 0x5f, 0x2d, 0x3a, 0x1a, 0xf0, + 0x80, 0xe7, 0xd0, 0xec, 0x4f, 0x4b, 0x37, 0xf4, 0x91, 0x5e, 0x9c, 0x46, 0x92, 0xdb, 0x61, 0x32, + 0x91, 0x54, 0xd0, 0xa0, 0x3c, 0xbf, 0x10, 0x68, 0x78, 0x57, 0xc3, 0x47, 0x58, 0x90, 0x12, 0xe3, + 0x71, 0xca, 0xf4, 0xfe, 0xeb, 0x7b, 0x37, 0x10, 0x34, 0x60, 0x94, 0xed, 0x59, 0xd2, 0x6b, 0x0d, + 0x5c, 0x0d, 0x38, 0x0f, 0x26, 0xc4, 0x56, 0xab, 0x51, 0xb2, 0x63, 0x63, 0x96, 0xea, 0xad, 0xb5, + 0xe7, 0xb7, 0x24, 0x0d, 0x89, 0x90, 0x38, 0x8c, 0x72, 0x40, 0xef, 0x6b, 0x03, 0x2a, 0xdb, 0x53, + 0xb4, 0x01, 0xd5, 0x11, 0xf7, 0xd3, 0xb6, 0xb1, 0x6e, 0xf4, 0x0f, 0x6d, 0xae, 0x5a, 0x2f, 0x38, + 0xc8, 0xda, 0x9e, 0x0e, 0xb9, 0x9f, 0x3a, 0x0a, 0x86, 0xce, 0x43, 0x13, 0x27, 0x72, 0xec, 0x52, + 0xb6, 0xc3, 0xdb, 0x15, 0xa5, 0x73, 0x7c, 0x86, 0xce, 0x20, 0x91, 0xe3, 0x6b, 0x6c, 0x87, 0x3b, + 0x0d, 0xac, 0xff, 0x50, 0x17, 0x20, 0x23, 0x8f, 0x65, 0x12, 0x13, 0xd1, 0x36, 0xd7, 0xcd, 0x7e, + 0xcb, 0xd9, 0x27, 0xe9, 0x31, 0xa8, 0x6d, 0x4f, 0x1d, 0xfc, 0x39, 0x3a, 0x01, 0x90, 0x1d, 0xe5, + 0x8e, 0x52, 0x49, 0x84, 0xe2, 0xd5, 0x72, 0x9a, 0x99, 0x64, 0x98, 0x09, 0xd0, 0x6b, 0x70, 0xa4, + 0x64, 0xa0, 0x31, 0x15, 0x85, 0x59, 0x2a, 0x8e, 0xca, 0x71, 0x07, 0x9d, 0xf7, 0x8d, 0x01, 0x8b, + 0x5b, 0x34, 0x60, 0x97, 0xb9, 0xf7, 0x77, 0x1d, 0xb9, 0x0a, 0x0d, 0x6f, 0x8c, 0x29, 0x73, 0xa9, + 0xdf, 0x36, 0xd7, 0x8d, 0x7e, 0xd3, 0x59, 0x54, 0xeb, 0x6b, 0x3e, 0x3a, 0x05, 0x87, 0xb1, 0xe7, + 0xf1, 0x84, 0x49, 0x97, 0x25, 0xe1, 0x88, 0xc4, 0xed, 0xea, 0xba, 0xd1, 0xaf, 0x3a, 0x4b, 0x5a, + 0xfa, 0x91, 0x12, 0xf6, 0xbe, 0xaa, 0xc0, 0xb2, 0x26, 0x75, 0x99, 0xc6, 0xc4, 0x93, 0x83, 0x64, + 0x7a, 0x10, 0xbb, 0x73, 0x00, 0x51, 0x32, 0x9a, 0x50, 0xcf, 0xbd, 0x45, 0x52, 0x1d, 0x93, 0xa3, + 0x56, 0x1e, 0x7e, 0xab, 0x08, 0xbf, 0x35, 0x60, 0xa9, 0xd3, 0xcc, 0x71, 0xd7, 0x49, 0xfa, 0xd7, + 0xa9, 0xa2, 0x0e, 0x34, 0x04, 0xf9, 0x34, 0x21, 0xcc, 0x23, 0xed, 0x9a, 0x02, 0x94, 0x6b, 0xf4, + 0x06, 0x98, 0x92, 0x46, 0xed, 0xba, 0xe2, 0xf2, 0xff, 0x59, 0x6f, 0x8a, 0x46, 0xc3, 0x4a, 0xdb, + 0x70, 0x32, 0xd8, 0x85, 0xff, 0x3d, 0xb8, 0xbb, 0x71, 0x24, 0xc7, 0x6c, 0x08, 0xff, 0xd6, 0xfa, + 0x19, 0xeb, 0xcd, 0xb7, 0x7a, 0x5f, 0x9a, 0x50, 0xcf, 0x5f, 0x1e, 0x3a, 0x03, 0x8d, 0x90, 0x08, + 0x81, 0x03, 0x75, 0x7b, 0xf3, 0xa5, 0xd7, 0x2b, 0x51, 0x08, 0x41, 0x35, 0x24, 0x61, 0xfe, 0x40, + 0x9b, 0x8e, 0xfa, 0xcf, 0xae, 0x95, 0xa5, 0x00, 0x4f, 0xa4, 0x3b, 0x26, 0x34, 0x18, 0x4b, 0x75, + 0xef, 0xaa, 0xb3, 0xa4, 0xa5, 0x57, 0x95, 0x10, 0xbd, 0x02, 0xcd, 0x84, 0xf1, 0xd8, 0x27, 0x31, + 0xf1, 0xd5, 0xc5, 0x1b, 0xce, 0x9e, 0x00, 0x7d, 0x02, 0x2b, 0x85, 0x91, 0x32, 0x9f, 0xd4, 0xed, + 0x0f, 0x6d, 0x76, 0x5e, 0xe0, 0xb4, 0x5d, 0x20, 0x86, 0x8d, 0x7b, 0x0f, 0xd7, 0x8c, 0xdb, 0x8f, + 0xd6, 0x0c, 0x67, 0x59, 0xab, 0x97, 0x7b, 0x68, 0x08, 0x2b, 0x64, 0x2a, 0x09, 0x13, 0x94, 0x33, + 0x97, 0x47, 0x92, 0x72, 0x26, 0xda, 0xbf, 0x2d, 0xce, 0xb9, 0xe7, 0x72, 0x89, 0xff, 0x38, 0x87, + 0xa3, 0x9b, 0xd0, 0x65, 0x9c, 0xb9, 0x5e, 0x4c, 0x25, 0xf5, 0xf0, 0xc4, 0x9d, 0x61, 0xf0, 0xc8, + 0x1c, 0x83, 0xc7, 0x19, 0x67, 0x97, 0xb4, 0xee, 0x07, 0xcf, 0xd9, 0xee, 0x7d, 0x5f, 0x81, 0x56, + 0x1e, 0x88, 0x4b, 0x3c, 0x8c, 0xb0, 0xfc, 0x67, 0xc3, 0xf1, 0x5f, 0xf7, 0xce, 0x4f, 0x06, 0x34, + 0x8a, 0x62, 0x87, 0xde, 0x87, 0x56, 0x56, 0x60, 0x48, 0xac, 0x2a, 0x45, 0xe1, 0x9d, 0x13, 0x33, + 0xde, 0xff, 0x96, 0x82, 0xa9, 0x0a, 0x79, 0x48, 0x94, 0xff, 0x02, 0xf5, 0xc1, 0xdc, 0x21, 0x44, + 0x27, 0xf1, 0xac, 0xc4, 0xb9, 0x42, 0x88, 0x93, 0x41, 0xd0, 0xc5, 0x3c, 0xc5, 0xcc, 0xb9, 0x29, + 0x76, 0xec, 0xd7, 0x17, 0x33, 0x4b, 0x67, 0x5d, 0xef, 0x5b, 0x03, 0x60, 0x8f, 0xc6, 0x73, 0x55, + 0xc4, 0xf8, 0x63, 0x55, 0xe4, 0x3c, 0x34, 0x43, 0xee, 0x93, 0x83, 0xba, 0xc1, 0x0d, 0xee, 0x93, + 0xbc, 0x1b, 0x84, 0xfa, 0xef, 0x99, 0xea, 0x61, 0x3e, 0x5b, 0x3d, 0x7a, 0x8f, 0x2b, 0xd0, 0x28, + 0x54, 0xd0, 0xbb, 0x50, 0x17, 0x94, 0x05, 0x13, 0xa2, 0x39, 0xf5, 0xe6, 0xd8, 0xb7, 0xb6, 0x14, + 0xf2, 0xea, 0x82, 0xa3, 0x75, 0xd0, 0x3b, 0x50, 0x53, 0xbd, 0x57, 0x93, 0x7b, 0x75, 0x9e, 0xf2, + 0x8d, 0x0c, 0x78, 0x75, 0xc1, 0xc9, 0x35, 0x3a, 0x03, 0xa8, 0xe7, 0xe6, 0xd0, 0xdb, 0x50, 0xcd, + 0x78, 0x2b, 0x02, 0x87, 0x37, 0x4f, 0xee, 0xb3, 0x51, 0x74, 0xe3, 0xfd, 0x61, 0xcd, 0xec, 0x39, + 0x4a, 0xa1, 0x73, 0xdb, 0x80, 0x9a, 0xb2, 0x8a, 0xae, 0x43, 0x63, 0x44, 0x25, 0x8e, 0x63, 0x5c, + 0xf8, 0xd6, 0x2e, 0xcc, 0xe4, 0x33, 0x83, 0x55, 0x8e, 0x08, 0x85, 0x2d, 0x95, 0x6d, 0x9e, 0x1c, + 0x52, 0x39, 0xc8, 0xd4, 0x9c, 0xd2, 0x00, 0xba, 0x00, 0x50, 0x7a, 0x3d, 0xeb, 0x44, 0xe6, 0x41, + 0x6e, 0x6f, 0x16, 0x6e, 0x17, 0xc3, 0x1a, 0x98, 0x22, 0x09, 0x7b, 0x5f, 0x54, 0xc0, 0xbc, 0x42, + 0x08, 0x4a, 0xa1, 0x8e, 0xc3, 0xac, 0xa8, 0xeb, 0xb7, 0x5a, 0xf6, 0xff, 0x6c, 0x34, 0xd9, 0x47, + 0x85, 0xb2, 0xe1, 0x95, 0x7b, 0x0f, 0xd7, 0x16, 0x7e, 0x7c, 0xb4, 0xd6, 0x0f, 0xa8, 0x1c, 0x27, + 0x23, 0xcb, 0xe3, 0xa1, 0x5d, 0x8c, 0x3d, 0xe5, 0x0b, 0xb3, 0x65, 0x1a, 0x11, 0xa1, 0x14, 0xc4, + 0x77, 0x4f, 0xef, 0x9c, 0x6e, 0x4d, 0x48, 0x80, 0xbd, 0xd4, 0xcd, 0x86, 0x1b, 0xf1, 0xc3, 0xd3, + 0x3b, 0xa7, 0x0d, 0x47, 0x1f, 0x88, 0x8e, 0x43, 0x33, 0xc0, 0xc2, 0x9d, 0xd0, 0x90, 0x4a, 0x15, + 0x9e, 0xaa, 0xd3, 0x08, 0xb0, 0xf8, 0x30, 0x5b, 0x23, 0x0b, 0x6a, 0x11, 0x4e, 0x49, 0x9c, 0xf7, + 0xa6, 0x61, 0xfb, 0xc1, 0xdd, 0x8d, 0xa3, 0x9a, 0xd9, 0xc0, 0xf7, 0x63, 0x22, 0xc4, 0x96, 0x8c, + 0x29, 0x0b, 0x9c, 0x1c, 0x86, 0x36, 0x61, 0x31, 0x88, 0x31, 0x93, 0xba, 0x59, 0xcd, 0xd3, 0x28, + 0x80, 0xbd, 0x9f, 0x0d, 0x30, 0xb7, 0x69, 0xf4, 0x6f, 0xfa, 0xe0, 0x0c, 0xd4, 0x25, 0x8d, 0x22, + 0x12, 0xe7, 0xa5, 0x71, 0x0e, 0x6b, 0x8d, 0xbb, 0x70, 0xec, 0xc1, 0xac, 0x8c, 0xee, 0xed, 0x1a, + 0xb0, 0x34, 0x48, 0xa6, 0x79, 0x3e, 0x5f, 0xc6, 0x12, 0x67, 0x1e, 0xc1, 0xb9, 0x05, 0xf5, 0xe0, + 0xe6, 0x7a, 0x44, 0x03, 0xd1, 0x7b, 0xd0, 0xc8, 0x5e, 0xb4, 0xeb, 0x73, 0x4f, 0x27, 0xcc, 0xc9, + 0x97, 0xd4, 0xae, 0xfd, 0xf3, 0x89, 0xb3, 0x28, 0xf4, 0x18, 0x55, 0x24, 0x8a, 0xf9, 0x27, 0x13, + 0x05, 0x2d, 0x83, 0x29, 0x68, 0xa0, 0x42, 0xd7, 0x72, 0xb2, 0xdf, 0x99, 0x33, 0xc1, 0xf0, 0xe2, + 0xbd, 0x27, 0x5d, 0xe3, 0xfe, 0x93, 0xae, 0xf1, 0xf8, 0x49, 0xd7, 0xb8, 0xbd, 0xdb, 0x5d, 0xb8, + 0xbf, 0xdb, 0x5d, 0xf8, 0x65, 0xb7, 0xbb, 0x70, 0xf3, 0xd4, 0xc1, 0x01, 0xb1, 0xe5, 0x74, 0x54, + 0x57, 0x85, 0xec, 0xdc, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x58, 0xe5, 0xd5, 0x23, 0x0c, + 0x00, 0x00, } func (m *Tx) Marshal() (dAtA []byte, err error) { @@ -1448,6 +1550,87 @@ func (m *TxBody) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TxBodyCompat) 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 *TxBodyCompat) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TxBodyCompat) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NonCriticalExtensionOptions) > 0 { + for iNdEx := len(m.NonCriticalExtensionOptions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NonCriticalExtensionOptions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x7f + i-- + dAtA[i] = 0xfa + } + } + if len(m.ExtensionOptions) > 0 { + for iNdEx := len(m.ExtensionOptions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ExtensionOptions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3f + i-- + dAtA[i] = 0xfa + } + } + if m.TimeoutHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TimeoutHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Memo) > 0 { + i -= len(m.Memo) + copy(dAtA[i:], m.Memo) + i = encodeVarintTx(dAtA, i, uint64(len(m.Memo))) + i-- + dAtA[i] = 0x12 + } + if len(m.Messages) > 0 { + for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *AuthInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2019,6 +2202,40 @@ func (m *TxBody) Size() (n int) { return n } +func (m *TxBodyCompat) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Memo) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TimeoutHeight != 0 { + n += 1 + sovTx(uint64(m.TimeoutHeight)) + } + if len(m.ExtensionOptions) > 0 { + for _, e := range m.ExtensionOptions { + l = e.Size() + n += 2 + l + sovTx(uint64(l)) + } + } + if len(m.NonCriticalExtensionOptions) > 0 { + for _, e := range m.NonCriticalExtensionOptions { + l = e.Size() + n += 2 + l + sovTx(uint64(l)) + } + } + return n +} + func (m *AuthInfo) Size() (n int) { if m == nil { return 0 @@ -3162,6 +3379,209 @@ func (m *TxBody) Unmarshal(dAtA []byte) error { } return nil } +func (m *TxBodyCompat) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TxBodyCompat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxBodyCompat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Messages = append(m.Messages, &any.Any{}) + if err := m.Messages[len(m.Messages)-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 Memo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Memo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) + } + m.TimeoutHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 1023: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExtensionOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExtensionOptions = append(m.ExtensionOptions, &any.Any{}) + if err := m.ExtensionOptions[len(m.ExtensionOptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2047: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NonCriticalExtensionOptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NonCriticalExtensionOptions = append(m.NonCriticalExtensionOptions, &any.Any{}) + if err := m.NonCriticalExtensionOptions[len(m.NonCriticalExtensionOptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *AuthInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/accounts/defaults/base/go.mod b/x/accounts/defaults/base/go.mod index f976be1ba062..e581deed874d 100644 --- a/x/accounts/defaults/base/go.mod +++ b/x/accounts/defaults/base/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/accounts/defaults/base go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 diff --git a/x/accounts/defaults/base/go.sum b/x/accounts/defaults/base/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/accounts/defaults/base/go.sum +++ b/x/accounts/defaults/base/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/accounts/defaults/lockup/go.mod b/x/accounts/defaults/lockup/go.mod index 8375527e052c..b04ad2a71db6 100644 --- a/x/accounts/defaults/lockup/go.mod +++ b/x/accounts/defaults/lockup/go.mod @@ -28,7 +28,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.1-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/api v0.8.0 // indirect + cosmossdk.io/api v0.8.1 // indirect cosmossdk.io/core/testing v0.0.1 // indirect cosmossdk.io/depinject v1.1.0 // indirect cosmossdk.io/errors v1.0.1 diff --git a/x/accounts/defaults/lockup/go.sum b/x/accounts/defaults/lockup/go.sum index 896b7e061f4b..42e34c2ba53c 100644 --- a/x/accounts/defaults/lockup/go.sum +++ b/x/accounts/defaults/lockup/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/accounts/defaults/multisig/go.mod b/x/accounts/defaults/multisig/go.mod index f1ac991e8b28..15dc81c3c532 100644 --- a/x/accounts/defaults/multisig/go.mod +++ b/x/accounts/defaults/multisig/go.mod @@ -18,7 +18,7 @@ require ( require ( buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.1-20241120201313-68e42a58b301.1 // indirect buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1 // indirect - cosmossdk.io/api v0.8.0 // indirect + cosmossdk.io/api v0.8.1 // indirect cosmossdk.io/core/testing v0.0.1 // indirect cosmossdk.io/depinject v1.1.0 // indirect cosmossdk.io/errors v1.0.1 // indirect diff --git a/x/accounts/defaults/multisig/go.sum b/x/accounts/defaults/multisig/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/accounts/defaults/multisig/go.sum +++ b/x/accounts/defaults/multisig/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 77590393886f..41fbb29b3cd4 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/accounts go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/accounts/go.sum b/x/accounts/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go index f4e403b4f812..d8dcc5edb311 100644 --- a/x/auth/tx/builder.go +++ b/x/auth/tx/builder.go @@ -114,14 +114,26 @@ func (w *builder) getTx() (*gogoTxWrapper, error) { if err != nil { return nil, fmt.Errorf("unable to convert messages: %w", err) } - body := &txv1beta1.TxBody{ - Messages: anyMsgs, - Memo: w.memo, - TimeoutHeight: w.timeoutHeight, - TimeoutTimestamp: timestamppb.New(w.timeoutTimestamp), - Unordered: w.unordered, - ExtensionOptions: intoAnyV2(w.extensionOptions), - NonCriticalExtensionOptions: intoAnyV2(w.nonCriticalExtensionOptions), + + var body proto.Message + if !w.unordered && (w.timeoutTimestamp.IsZero() || w.timeoutTimestamp.Unix() == 0) { + body = &txv1beta1.TxBodyCompat{ + Messages: anyMsgs, + Memo: w.memo, + TimeoutHeight: w.timeoutHeight, + ExtensionOptions: intoAnyV2(w.extensionOptions), + NonCriticalExtensionOptions: intoAnyV2(w.nonCriticalExtensionOptions), + } + } else { + body = &txv1beta1.TxBody{ + Messages: anyMsgs, + Memo: w.memo, + TimeoutHeight: w.timeoutHeight, + TimeoutTimestamp: timestamppb.New(w.timeoutTimestamp), + Unordered: w.unordered, + ExtensionOptions: intoAnyV2(w.extensionOptions), + NonCriticalExtensionOptions: intoAnyV2(w.nonCriticalExtensionOptions), + } } fee, err := w.getFee() diff --git a/x/authz/go.mod b/x/authz/go.mod index a6f6f2a40441..fa939d2265f1 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/authz go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 diff --git a/x/authz/go.sum b/x/authz/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/bank/go.mod b/x/bank/go.mod index e687027ff9f7..3b547a720097 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -3,12 +3,12 @@ module cosmossdk.io/x/bank go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.5.0 // indirect + cosmossdk.io/log v1.5.0 cosmossdk.io/math v1.5.0 cosmossdk.io/store v1.10.0-rc.1 github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect @@ -165,7 +165,10 @@ require ( golang.org/x/arch v0.12.0 // indirect ) -replace github.com/cosmos/cosmos-sdk => ../../. +replace ( + cosmossdk.io/core/testing => ../../core/testing + github.com/cosmos/cosmos-sdk => ../../. +) // TODO remove post spinning out all modules replace cosmossdk.io/x/staking => ../staking diff --git a/x/bank/go.sum b/x/bank/go.sum index d826e2fe666e..1d05f906c880 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -4,14 +4,12 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= cosmossdk.io/core v1.0.0/go.mod h1:mKIp3RkoEmtqdEdFHxHwWAULRe+79gfdOvmArrLDbDc= -cosmossdk.io/core/testing v0.0.1 h1:gYCTaftcRrz+HoNXmK7r9KgbG1jgBJ8pNzm/Pa/erFQ= -cosmossdk.io/core/testing v0.0.1/go.mod h1:2VDNz/25qtxgPa0+j8LW5e8Ev/xObqoJA7QuJS9/wIQ= cosmossdk.io/depinject v1.1.0 h1:wLan7LG35VM7Yo6ov0jId3RHWCGRhe8E8bsuARorl5E= cosmossdk.io/depinject v1.1.0/go.mod h1:kkI5H9jCGHeKeYWXTqYdruogYrEeWvBQCw1Pj4/eCFI= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index 30643a543ac5..9560645cb94a 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - gocontext "context" "fmt" "time" @@ -84,7 +83,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() { for _, tc := range testCases { suite.Run(tc.name, func() { - res, err := queryClient.Balance(gocontext.Background(), tc.req) + res, err := queryClient.Balance(ctx, tc.req) if tc.expectErrMsg == "" { suite.Require().NoError(err) suite.Require().NotNil(res) @@ -102,7 +101,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() { func (suite *KeeperTestSuite) TestQueryAllBalances() { ctx, queryClient := suite.ctx, suite.queryClient _, _, addr := testdata.KeyTestPubAddr() - _, err := queryClient.AllBalances(gocontext.Background(), &types.QueryAllBalancesRequest{}) + _, err := queryClient.AllBalances(ctx, &types.QueryAllBalancesRequest{}) suite.Require().Error(err) addrStr, err := suite.addrCdc.BytesToString(addr) @@ -114,7 +113,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { CountTotal: false, } req := types.NewQueryAllBalancesRequest(addrStr, pageReq, false) - res, err := queryClient.AllBalances(gocontext.Background(), req) + res, err := queryClient.AllBalances(ctx, req) suite.Require().NoError(err) suite.Require().NotNil(res) suite.True(res.Balances.IsZero()) @@ -132,7 +131,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { addIBCMetadata(ctx, suite.bankKeeper) - res, err = queryClient.AllBalances(gocontext.Background(), req) + res, err = queryClient.AllBalances(ctx, req) suite.Require().NoError(err) suite.Require().NotNil(res) suite.Equal(1, res.Balances.Len()) @@ -148,7 +147,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { } req = types.NewQueryAllBalancesRequest(addrStr, pageReq, true) testFunc := func() { - res, err = queryClient.AllBalances(gocontext.Background(), req) + res, err = queryClient.AllBalances(ctx, req) } suite.Require().NotPanics(testFunc, "AllBalances with resolve denom + incomplete metadata") suite.Require().NoError(err) @@ -163,7 +162,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { CountTotal: true, } req = types.NewQueryAllBalancesRequest(addrStr, pageReq, false) - res, err = queryClient.AllBalances(gocontext.Background(), req) + res, err = queryClient.AllBalances(ctx, req) suite.Require().NoError(err) suite.Equal(1, res.Balances.Len()) suite.Equal(fooCoins.Denom, res.Balances[0].Denom) @@ -178,7 +177,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { CountTotal: true, } req = types.NewQueryAllBalancesRequest(addrStr, pageReq, false) - res, err = queryClient.AllBalances(gocontext.Background(), req) + res, err = queryClient.AllBalances(ctx, req) suite.Require().NoError(err) suite.Equal(1, res.Balances.Len()) suite.Equal(ibcCoins.Denom, res.Balances[0].Denom) @@ -190,7 +189,7 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { CountTotal: true, } req = types.NewQueryAllBalancesRequest(addrStr, pageReq, true) - res, err = queryClient.AllBalances(gocontext.Background(), req) + res, err = queryClient.AllBalances(ctx, req) suite.Require().NoError(err) suite.Equal(1, res.Balances.Len()) suite.Equal(ibcPath+"/"+ibcBaseDenom, res.Balances[0].Denom) @@ -202,9 +201,9 @@ func (suite *KeeperTestSuite) TestSpendableBalances() { addrStr, err := suite.addrCdc.BytesToString(addr) suite.Require().NoError(err) - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx ctx = ctx.WithHeaderInfo(header.Info{Time: time.Now()}) - queryClient := suite.mockQueryClient(ctx) + queryClient := suite.queryClient _, err = queryClient.SpendableBalances(ctx, &types.QuerySpendableBalancesRequest{}) suite.Require().Error(err) @@ -226,12 +225,14 @@ func (suite *KeeperTestSuite) TestSpendableBalances() { fooCoins := newFooCoin(50) barCoins := newBarCoin(30) + currentBlockTime := suite.env.HeaderService().HeaderInfo(ctx).Time + origCoins := sdk.NewCoins(fooCoins, barCoins) vacc, err := vestingtypes.NewContinuousVestingAccount( acc, sdk.NewCoins(fooCoins), - ctx.HeaderInfo().Time.Unix(), - ctx.HeaderInfo().Time.Add(time.Hour).Unix(), + currentBlockTime.Unix(), + currentBlockTime.Add(time.Hour).Unix(), ) suite.Require().NoError(err) @@ -239,8 +240,8 @@ func (suite *KeeperTestSuite) TestSpendableBalances() { suite.Require().NoError(testutil.FundAccount(suite.ctx, suite.bankKeeper, addr, origCoins)) // move time forward for some tokens to vest - ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(30 * time.Minute)}) - queryClient = suite.mockQueryClient(ctx) + ctx = ctx.WithHeaderInfo(header.Info{Time: currentBlockTime.Add(30 * time.Minute)}) + queryClient = suite.queryClient suite.mockSpendableCoins(ctx, vacc) res, err = queryClient.SpendableBalances(ctx, req) @@ -254,10 +255,10 @@ func (suite *KeeperTestSuite) TestSpendableBalances() { func (suite *KeeperTestSuite) TestSpendableBalanceByDenom() { _, _, addr := testdata.KeyTestPubAddr() + ctx := suite.ctx - ctx := sdk.UnwrapSDKContext(suite.ctx) ctx = ctx.WithHeaderInfo(header.Info{Time: time.Now()}) - queryClient := suite.mockQueryClient(ctx) + queryClient := suite.queryClient _, err := queryClient.SpendableBalanceByDenom(ctx, &types.QuerySpendableBalanceByDenomRequest{}) suite.Require().Error(err) @@ -277,12 +278,14 @@ func (suite *KeeperTestSuite) TestSpendableBalanceByDenom() { fooCoins := newFooCoin(100) barCoins := newBarCoin(30) + currentBlockTime := suite.env.HeaderService().HeaderInfo(ctx).Time + origCoins := sdk.NewCoins(fooCoins, barCoins) vacc, err := vestingtypes.NewContinuousVestingAccount( acc, sdk.NewCoins(fooCoins), - ctx.HeaderInfo().Time.Unix(), - ctx.HeaderInfo().Time.Add(time.Hour).Unix(), + currentBlockTime.Unix(), + currentBlockTime.Add(time.Hour).Unix(), ) suite.Require().NoError(err) @@ -290,8 +293,8 @@ func (suite *KeeperTestSuite) TestSpendableBalanceByDenom() { suite.Require().NoError(testutil.FundAccount(suite.ctx, suite.bankKeeper, addr, origCoins)) // move time forward for half of the tokens to vest - ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(30 * time.Minute)}) - queryClient = suite.mockQueryClient(ctx) + ctx = ctx.WithHeaderInfo(header.Info{Time: currentBlockTime.Add(30 * time.Minute)}) + queryClient = suite.queryClient // check fooCoins first, it has some vested and some vesting suite.mockSpendableCoins(ctx, vacc) @@ -311,7 +314,7 @@ func (suite *KeeperTestSuite) TestSpendableBalanceByDenom() { func (suite *KeeperTestSuite) TestQueryTotalSupply() { ctx, queryClient := suite.ctx, suite.queryClient - res, err := queryClient.TotalSupply(gocontext.Background(), &types.QueryTotalSupplyRequest{}) + res, err := queryClient.TotalSupply(ctx, &types.QueryTotalSupplyRequest{}) suite.Require().NoError(err) suite.Require().NotNil(res) genesisSupply := res.Supply @@ -320,7 +323,7 @@ func (suite *KeeperTestSuite) TestQueryTotalSupply() { suite.mockMintCoins(mintAcc) suite.Require().NoError(suite.bankKeeper.MintCoins(ctx, types.MintModuleName, testCoins)) - res, err = queryClient.TotalSupply(gocontext.Background(), &types.QueryTotalSupplyRequest{}) + res, err = queryClient.TotalSupply(ctx, &types.QueryTotalSupplyRequest{}) suite.Require().NoError(err) suite.Require().NotNil(res) @@ -339,32 +342,33 @@ func (suite *KeeperTestSuite) TestQueryTotalSupplyOf() { suite.mockMintCoins(mintAcc) suite.Require().NoError(suite.bankKeeper.MintCoins(ctx, types.MintModuleName, expectedTotalSupply)) - _, err := queryClient.SupplyOf(gocontext.Background(), &types.QuerySupplyOfRequest{}) + _, err := queryClient.SupplyOf(ctx, &types.QuerySupplyOfRequest{}) suite.Require().Error(err) - res, err := queryClient.SupplyOf(gocontext.Background(), &types.QuerySupplyOfRequest{Denom: test1Supply.Denom}) + res, err := queryClient.SupplyOf(ctx, &types.QuerySupplyOfRequest{Denom: test1Supply.Denom}) suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(test1Supply, res.Amount) // total supply bogus denom - res, err = queryClient.SupplyOf(gocontext.Background(), &types.QuerySupplyOfRequest{Denom: "bogus"}) + res, err = queryClient.SupplyOf(ctx, &types.QuerySupplyOfRequest{Denom: "bogus"}) suite.Require().NoError(err) suite.Require().NotNil(res) suite.Require().Equal(sdk.NewInt64Coin("bogus", 0), res.Amount) } func (suite *KeeperTestSuite) TestQueryParams() { - res, err := suite.queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) + ctx, queryClient := suite.ctx, suite.queryClient + res, err := queryClient.Params(ctx, &types.QueryParamsRequest{}) suite.Require().NoError(err) suite.Require().NotNil(res) - suite.Require().Equal(suite.bankKeeper.GetParams(suite.ctx), res.GetParams()) + suite.Require().Equal(suite.bankKeeper.GetParams(ctx), res.GetParams()) } func (suite *KeeperTestSuite) TestQueryDenomsMetadata() { var ( req *types.QueryDenomsMetadataRequest - expMetadata = []types.Metadata(nil) + expMetadata []types.Metadata ) testCases := []struct { @@ -781,7 +785,7 @@ func (suite *KeeperTestSuite) TestGRPCDenomOwners() { for name, tc := range testCases { suite.Run(name, func() { - resp, err := suite.queryClient.DenomOwners(gocontext.Background(), tc.req) + resp, err := suite.queryClient.DenomOwners(suite.ctx, tc.req) if tc.expPass { suite.NoError(err) suite.NotNil(resp) @@ -913,7 +917,7 @@ func (suite *KeeperTestSuite) TestQuerySendEnabled() { for _, tc := range tests { suite.Run(tc.name, func() { - resp, err := suite.queryClient.SendEnabled(gocontext.Background(), tc.req) + resp, err := suite.queryClient.SendEnabled(ctx, tc.req) suite.Require().NoError(err) if !suite.Assert().Equal(tc.exp, resp) { if !suite.Assert().Len(resp.SendEnabled, len(tc.exp.SendEnabled)) { @@ -1019,7 +1023,7 @@ func (suite *KeeperTestSuite) TestGRPCDenomOwnersByQuery() { for name, tc := range testCases { suite.Run(name, func() { - resp, err := suite.queryClient.DenomOwnersByQuery(gocontext.Background(), tc.req) + resp, err := suite.queryClient.DenomOwnersByQuery(suite.ctx, tc.req) if tc.expPass { suite.NoError(err) suite.NotNil(resp) diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index f4dc7eb9767c..284129e3eeed 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -18,16 +18,16 @@ import ( "cosmossdk.io/core/header" coretesting "cosmossdk.io/core/testing" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/bank/keeper" banktestutil "cosmossdk.io/x/bank/testutil" banktypes "cosmossdk.io/x/bank/types" - "github.com/cosmos/cosmos-sdk/baseapp" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" + "github.com/cosmos/cosmos-sdk/testutil/queryclient" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" @@ -133,7 +133,8 @@ func addIncompleteMetadata(ctx context.Context, k keeper.BaseKeeper) { type KeeperTestSuite struct { suite.Suite - ctx context.Context + ctx coretesting.TestContext + env coretesting.TestEnvironment bankKeeper keeper.BaseKeeper addrCdc address.Codec authKeeper *banktestutil.MockAccountKeeper @@ -149,12 +150,16 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *KeeperTestSuite) SetupTest() { - key := storetypes.NewKVStoreKey(banktypes.StoreKey) - testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) - ctx := testCtx.Ctx.WithHeaderInfo(header.Info{Time: time.Now()}) encCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}) + testEnironmentConfig := coretesting.TestEnvironmentConfig{ + ModuleName: banktypes.ModuleName, + Logger: log.NewNopLogger(), + MsgRouter: nil, + QueryRouter: nil, + } - env := runtime.NewEnvironment(runtime.NewKVStoreService(key), coretesting.NewNopLogger()) + ctx, env := coretesting.NewTestEnvironment(testEnironmentConfig) + ctx = ctx.WithHeaderInfo(header.Info{Time: time.Now()}) ac := codectestutil.CodecOptions{}.GetAddressCodec() addr, err := ac.BytesToString(accAddrs[4]) @@ -170,7 +175,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.authKeeper = authKeeper suite.addrCdc = ac suite.bankKeeper = keeper.NewBaseKeeper( - env, + env.Environment, encCfg.Codec, suite.authKeeper, map[string]bool{addr: true}, @@ -181,21 +186,14 @@ func (suite *KeeperTestSuite) SetupTest() { DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, })) - banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) - - queryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry) + queryHelper := queryclient.NewQueryHelper(encCfg.InterfaceRegistry) banktypes.RegisterQueryServer(queryHelper, suite.bankKeeper) - queryClient := banktypes.NewQueryClient(queryHelper) + banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) - suite.queryClient = queryClient + suite.queryClient = banktypes.NewQueryClient(queryHelper) suite.msgServer = keeper.NewMsgServerImpl(suite.bankKeeper) suite.encCfg = encCfg -} - -func (suite *KeeperTestSuite) mockQueryClient(ctx sdk.Context) banktypes.QueryClient { - queryHelper := baseapp.NewQueryServerTestHelper(ctx, suite.encCfg.InterfaceRegistry) - banktypes.RegisterQueryServer(queryHelper, suite.bankKeeper) - return banktypes.NewQueryClient(queryHelper) + suite.env = env } func (suite *KeeperTestSuite) mockMintCoins(moduleAcc *authtypes.ModuleAccount) { @@ -241,7 +239,7 @@ func (suite *KeeperTestSuite) mockValidateBalance(acc sdk.AccountI) { suite.authKeeper.EXPECT().GetAccount(suite.ctx, acc.GetAddress()).Return(acc) } -func (suite *KeeperTestSuite) mockSpendableCoins(ctx sdk.Context, acc sdk.AccountI) { +func (suite *KeeperTestSuite) mockSpendableCoins(ctx context.Context, acc sdk.AccountI) { suite.authKeeper.EXPECT().GetAccount(ctx, acc.GetAddress()).Return(acc) } @@ -1410,21 +1408,24 @@ func (suite *KeeperTestSuite) TestMsgSendEvents() { }, } - ctx := sdk.UnwrapSDKContext(suite.ctx) + events := suite.env.EventService().GetEvents(suite.ctx) // events are shifted due to the funding account events - events := ctx.EventManager().Events() require.Equal(8, len(events)) require.Equal(event1.Type, events[7].Type) - attrs, err := event1.Attributes() + attrs1, err := event1.Attributes() + require.NoError(err) + + attrs, err := events[7].Attributes() require.NoError(err) - for i := range attrs { - require.Equal(attrs[i].Key, events[7].Attributes[i].Key) - require.Equal(attrs[i].Value, events[7].Attributes[i].Value) + + for i := range attrs1 { + require.Equal(attrs1[i].Key, attrs[i].Key) + require.Equal(attrs1[i].Value, attrs[i].Value) } } func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx require := suite.Require() acc0 := authtypes.NewBaseAccountWithAddress(accAddrs[0]) @@ -1452,7 +1453,7 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { suite.authKeeper.EXPECT().GetAccount(suite.ctx, accAddrs[0]).Return(acc0) require.Error(suite.bankKeeper.InputOutputCoins(ctx, input, outputs)) - events := ctx.EventManager().ABCIEvents() + events := suite.env.EventService().GetEvents(suite.ctx) require.Equal(0, len(events)) // Set addr's coins but not accAddrs[1]'s coins @@ -1462,7 +1463,7 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { suite.mockInputOutputCoins([]sdk.AccountI{acc0}, accAddrs[2:4]) require.NoError(suite.bankKeeper.InputOutputCoins(ctx, input, outputs)) - events = ctx.EventManager().ABCIEvents() + events = suite.env.EventService().GetEvents(suite.ctx) require.Equal(10, len(events)) // 10 events because account funding causes extra minting + coin_spent + coin_recv events // Set addr's coins and accAddrs[1]'s coins @@ -1477,7 +1478,7 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { suite.mockInputOutputCoins([]sdk.AccountI{acc0}, accAddrs[2:4]) require.NoError(suite.bankKeeper.InputOutputCoins(ctx, input, outputs)) - events = ctx.EventManager().ABCIEvents() + events = suite.env.EventService().GetEvents(suite.ctx) require.Equal(25, len(events)) // 25 due to account funding + coin_spent + coin_recv events event1 := coreevent.Event{ @@ -1506,21 +1507,29 @@ func (suite *KeeperTestSuite) TestMsgMultiSendEvents() { require.Equal(event1.Type, events[22].Type) attrs1, err := event1.Attributes() require.NoError(err) + + attrs, err := events[22].Attributes() + require.NoError(err) + for i := range attrs1 { - require.Equal(attrs1[i].Key, events[22].Attributes[i].Key) - require.Equal(attrs1[i].Value, events[22].Attributes[i].Value) + require.Equal(attrs1[i].Key, attrs[i].Key) + require.Equal(attrs1[i].Value, attrs[i].Value) } require.Equal(event2.Type, events[24].Type) attrs2, err := event2.Attributes() require.NoError(err) + + attrs, err = events[24].Attributes() + require.NoError(err) + for i := range attrs2 { - require.Equal(attrs2[i].Key, events[24].Attributes[i].Key) - require.Equal(attrs2[i].Value, events[24].Attributes[i].Value) + require.Equal(attrs2[i].Key, attrs[i].Key) + require.Equal(attrs2[i].Value, attrs[i].Value) } } func (suite *KeeperTestSuite) TestSpendableCoins() { - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx require := suite.Require() now := time.Now() endTime := now.Add(24 * time.Hour) @@ -1560,7 +1569,7 @@ func (suite *KeeperTestSuite) TestSpendableCoins() { suite.Require().NoError(err) // Go back to the suite's context since mockFundAccount uses that; FundAccount would fail for bad mocking otherwise. - ctx = sdk.UnwrapSDKContext(suite.ctx) + ctx = suite.ctx suite.mockFundAccount(accAddrs[2]) require.NoError(banktestutil.FundAccount(ctx, suite.bankKeeper, accAddrs[2], balanceCoins2)) suite.mockSpendableCoins(ctx, vacc2) @@ -1576,7 +1585,7 @@ func (suite *KeeperTestSuite) TestSpendableCoins() { } func (suite *KeeperTestSuite) TestVestingAccountSend() { - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx require := suite.Require() now := time.Now() endTime := now.Add(24 * time.Hour) @@ -1606,7 +1615,7 @@ func (suite *KeeperTestSuite) TestVestingAccountSend() { } func (suite *KeeperTestSuite) TestPeriodicVestingAccountSend() { - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx require := suite.Require() now := time.Now() origCoins := sdk.NewCoins(sdk.NewInt64Coin("stake", 100)) @@ -1641,7 +1650,7 @@ func (suite *KeeperTestSuite) TestPeriodicVestingAccountSend() { } func (suite *KeeperTestSuite) TestVestingAccountReceive() { - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx require := suite.Require() now := time.Now() endTime := now.Add(24 * time.Hour) @@ -1674,7 +1683,7 @@ func (suite *KeeperTestSuite) TestVestingAccountReceive() { } func (suite *KeeperTestSuite) TestPeriodicVestingAccountReceive() { - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx require := suite.Require() now := time.Now() @@ -1712,7 +1721,7 @@ func (suite *KeeperTestSuite) TestPeriodicVestingAccountReceive() { } func (suite *KeeperTestSuite) TestDelegateCoins() { - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx require := suite.Require() now := time.Now() endTime := now.Add(24 * time.Hour) @@ -1722,7 +1731,7 @@ func (suite *KeeperTestSuite) TestDelegateCoins() { acc0 := authtypes.NewBaseAccountWithAddress(accAddrs[0]) acc1 := authtypes.NewBaseAccountWithAddress(accAddrs[1]) - vacc, err := vesting.NewContinuousVestingAccount(acc0, origCoins, ctx.HeaderInfo().Time.Unix(), endTime.Unix()) + vacc, err := vesting.NewContinuousVestingAccount(acc0, origCoins, suite.env.HeaderService().HeaderInfo(suite.ctx).Time.Unix(), endTime.Unix()) suite.Require().NoError(err) suite.mockFundAccount(accAddrs[0]) @@ -1770,7 +1779,7 @@ func (suite *KeeperTestSuite) TestDelegateCoins_Invalid() { } func (suite *KeeperTestSuite) TestUndelegateCoins() { - ctx := sdk.UnwrapSDKContext(suite.ctx) + ctx := suite.ctx require := suite.Require() now := time.Now() endTime := now.Add(24 * time.Hour) @@ -1780,7 +1789,7 @@ func (suite *KeeperTestSuite) TestUndelegateCoins() { acc0 := authtypes.NewBaseAccountWithAddress(accAddrs[0]) acc1 := authtypes.NewBaseAccountWithAddress(accAddrs[1]) - vacc, err := vesting.NewContinuousVestingAccount(acc0, origCoins, ctx.BlockHeader().Time.Unix(), endTime.Unix()) + vacc, err := vesting.NewContinuousVestingAccount(acc0, origCoins, suite.env.HeaderService().HeaderInfo(ctx).Time.Unix(), endTime.Unix()) suite.Require().NoError(err) suite.mockFundAccount(accAddrs[0]) @@ -1938,34 +1947,36 @@ func (suite *KeeperTestSuite) TestBalanceTrackingEvents() { balances := make(map[string]sdk.Coins) - ctx := sdk.UnwrapSDKContext(suite.ctx) + events := suite.env.EventService().GetEvents(suite.ctx) - for _, e := range ctx.EventManager().ABCIEvents() { + for _, e := range events { + attributes, err := e.Attributes() + suite.Require().NoError(err) switch e.Type { case banktypes.EventTypeCoinBurn: - burnedCoins, err := sdk.ParseCoinsNormalized(e.Attributes[1].Value) + burnedCoins, err := sdk.ParseCoinsNormalized(attributes[1].Value) require.NoError(err) supply = supply.Sub(burnedCoins...) case banktypes.EventTypeCoinMint: - mintedCoins, err := sdk.ParseCoinsNormalized(e.Attributes[1].Value) + mintedCoins, err := sdk.ParseCoinsNormalized(attributes[1].Value) require.NoError(err) supply = supply.Add(mintedCoins...) case banktypes.EventTypeCoinSpent: - coinsSpent, err := sdk.ParseCoinsNormalized(e.Attributes[1].Value) + coinsSpent, err := sdk.ParseCoinsNormalized(attributes[1].Value) require.NoError(err) - _, err = suite.addrCdc.StringToBytes(e.Attributes[0].Value) + _, err = suite.addrCdc.StringToBytes(attributes[0].Value) require.NoError(err) - balances[e.Attributes[0].Value] = balances[e.Attributes[0].Value].Sub(coinsSpent...) + balances[attributes[0].Value] = balances[attributes[0].Value].Sub(coinsSpent...) case banktypes.EventTypeCoinReceived: - coinsRecv, err := sdk.ParseCoinsNormalized(e.Attributes[1].Value) + coinsRecv, err := sdk.ParseCoinsNormalized(attributes[1].Value) require.NoError(err) - _, err = suite.addrCdc.StringToBytes(e.Attributes[0].Value) + _, err = suite.addrCdc.StringToBytes(attributes[0].Value) require.NoError(err) - balances[e.Attributes[0].Value] = balances[e.Attributes[0].Value].Add(coinsRecv...) + balances[attributes[0].Value] = balances[attributes[0].Value].Add(coinsRecv...) } } diff --git a/x/bank/types/restrictions_test.go b/x/bank/types/restrictions_test.go index 9f0813b2ab64..bddd05161026 100644 --- a/x/bank/types/restrictions_test.go +++ b/x/bank/types/restrictions_test.go @@ -83,7 +83,7 @@ func (s *MintingRestrictionTestHelper) TestActual(t *testing.T, tp *MintingRestr } else { require.NotNil(t, actual, "resulting MintingRestrictionFn") s.Calls = s.Calls[:0] - err := actual(sdk.Context{}, tp.Coins) + err := actual(context.Background(), tp.Coins) if len(tp.ExpErr) != 0 { assert.EqualError(t, err, tp.ExpErr, "composite MintingRestrictionFn output error") } else { @@ -389,7 +389,7 @@ func TestComposeMintingRestrictions(t *testing.T) { func TestNoOpMintingRestrictionFn(t *testing.T) { var err error testFunc := func() { - err = types.NoOpMintingRestrictionFn(sdk.Context{}, sdk.Coins{}) + err = types.NoOpMintingRestrictionFn(context.Background(), sdk.Coins{}) } require.NotPanics(t, testFunc, "NoOpMintingRestrictionFn") assert.NoError(t, err, "NoOpSendRestrictionFn error") @@ -483,7 +483,7 @@ func (s *SendRestrictionTestHelper) TestActual(t *testing.T, tp *SendRestriction } else { require.NotNil(t, actual, "resulting SendRestrictionFn") s.Calls = s.Calls[:0] - addr, err := actual(sdk.Context{}, tp.FromAddr, tp.ToAddr, tp.Coins) + addr, err := actual(context.Background(), tp.FromAddr, tp.ToAddr, tp.Coins) if len(tp.ExpErr) != 0 { assert.EqualError(t, err, tp.ExpErr, "composite SendRestrictionFn output error") } else { @@ -912,7 +912,7 @@ func TestNoOpSendRestrictionFn(t *testing.T) { var addr sdk.AccAddress var err error testFunc := func() { - addr, err = types.NoOpSendRestrictionFn(sdk.Context{}, sdk.AccAddress("first_addr"), expAddr, sdk.Coins{}) + addr, err = types.NoOpSendRestrictionFn(context.Background(), sdk.AccAddress("first_addr"), expAddr, sdk.Coins{}) } require.NotPanics(t, testFunc, "NoOpSendRestrictionFn") assert.NoError(t, err, "NoOpSendRestrictionFn error") diff --git a/x/bank/types/send_authorization_test.go b/x/bank/types/send_authorization_test.go index bb12f5d2a5f7..8f84eb45bc76 100644 --- a/x/bank/types/send_authorization_test.go +++ b/x/bank/types/send_authorization_test.go @@ -1,22 +1,18 @@ package types_test import ( - "context" "fmt" "testing" "github.com/stretchr/testify/require" - appmodulev2 "cosmossdk.io/core/appmodule/v2" - corecontext "cosmossdk.io/core/context" coregas "cosmossdk.io/core/gas" - coreheader "cosmossdk.io/core/header" + coretesting "cosmossdk.io/core/testing" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/bank/types" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" - "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -29,35 +25,23 @@ var ( unknownAddrStr = "cosmos1ta047h6lw4hxkmn0wah97h6lta0sml880l" ) -type headerService struct{} - -func (h headerService) HeaderInfo(ctx context.Context) coreheader.Info { - return sdk.UnwrapSDKContext(ctx).HeaderInfo() -} - -type mockGasService struct { - coregas.Service -} - -func (m mockGasService) GasMeter(ctx context.Context) coregas.Meter { - return mockGasMeter{} -} - type mockGasMeter struct { coregas.Meter } -func (m mockGasMeter) Consume(amount coregas.Gas, descriptor string) error { +func (m mockGasMeter) Consume(_ coregas.Gas, _ string) error { return nil } func TestSendAuthorization(t *testing.T) { ac := codectestutil.CodecOptions{}.GetAddressCodec() - sdkCtx := testutil.DefaultContextWithDB(t, storetypes.NewKVStoreKey(types.StoreKey), storetypes.NewTransientStoreKey("transient_test")).Ctx.WithHeaderInfo(coreheader.Info{}) - ctx := context.WithValue(sdkCtx.Context(), corecontext.EnvironmentContextKey, appmodulev2.Environment{ - HeaderService: headerService{}, - GasService: mockGasService{}, - }) + cfg := coretesting.TestEnvironmentConfig{ + ModuleName: "bank", + Logger: log.NewNopLogger(), + } + + ctx, _ := coretesting.NewTestEnvironment(cfg) + ctx = ctx.WithGas(coregas.GasConfig{}, mockGasMeter{}) allowList := make([]sdk.AccAddress, 1) allowList[0] = toAddr diff --git a/x/bank/v2/keeper/handlers.go b/x/bank/v2/keeper/handlers.go index e998aceecb72..fcd883e948da 100644 --- a/x/bank/v2/keeper/handlers.go +++ b/x/bank/v2/keeper/handlers.go @@ -9,6 +9,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + appmodulev2 "cosmossdk.io/core/appmodule/v2" errorsmod "cosmossdk.io/errors" "cosmossdk.io/x/bank/v2/types" @@ -25,7 +26,20 @@ func NewHandlers(k *Keeper) handlers { return handlers{k} } -// UpdateParams updates the parameters of the bank/v2 module. +// RegisterMsgHandlers registers the message handlers to the router. +func (h handlers) RegisterMsgHandlers(router appmodulev2.MsgRouter) { + appmodulev2.RegisterMsgHandler(router, h.MsgUpdateParams) + appmodulev2.RegisterMsgHandler(router, h.MsgSend) + appmodulev2.RegisterMsgHandler(router, h.MsgMint) +} + +// RegisterQueryHandlers registers the query handlers to the router. +func (h handlers) RegisterQueryHandlers(router appmodulev2.QueryRouter) { + appmodulev2.RegisterMsgHandler(router, h.QueryParams) + appmodulev2.RegisterMsgHandler(router, h.QueryBalance) +} + +// MsgUpdateParams updates the parameters of the bank/v2 module. func (h handlers) MsgUpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { authorityBytes, err := h.addressCodec.StringToBytes(msg.Authority) if err != nil { diff --git a/x/bank/v2/module.go b/x/bank/v2/module.go index c59c6403b8be..720353d47dc5 100644 --- a/x/bank/v2/module.go +++ b/x/bank/v2/module.go @@ -97,18 +97,13 @@ func (am AppModule) ExportGenesis(ctx context.Context) (json.RawMessage, error) // RegisterMsgHandlers registers the message handlers for the bank module. func (am AppModule) RegisterMsgHandlers(router appmodulev2.MsgRouter) { handlers := keeper.NewHandlers(am.keeper) - - appmodulev2.RegisterMsgHandler(router, handlers.MsgUpdateParams) - appmodulev2.RegisterMsgHandler(router, handlers.MsgSend) - appmodulev2.RegisterMsgHandler(router, handlers.MsgMint) + handlers.RegisterMsgHandlers(router) } // RegisterQueryHandlers registers the query handlers for the bank module. func (am AppModule) RegisterQueryHandlers(router appmodulev2.QueryRouter) { handlers := keeper.NewHandlers(am.keeper) - - appmodulev2.RegisterMsgHandler(router, handlers.QueryParams) - appmodulev2.RegisterMsgHandler(router, handlers.QueryBalance) + handlers.RegisterQueryHandlers(router) } // GetTxCmd returns the root tx command for the bank/v2 module. diff --git a/x/circuit/go.mod b/x/circuit/go.mod index e0c752ccc6b4..96a5f1dfc1bb 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/circuit go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/circuit/go.sum b/x/circuit/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/consensus/go.mod b/x/consensus/go.mod index 264135864705..5538fdc50fc5 100644 --- a/x/consensus/go.mod +++ b/x/consensus/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/consensus go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/consensus/go.sum b/x/consensus/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/consensus/go.sum +++ b/x/consensus/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index a217e3cf93e1..420dda7e3119 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/distribution go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/distribution/go.sum b/x/distribution/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/epochs/go.mod b/x/epochs/go.mod index 584a8993ee5e..2bab18c12958 100644 --- a/x/epochs/go.mod +++ b/x/epochs/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/epochs go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/epochs/go.sum b/x/epochs/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/epochs/go.sum +++ b/x/epochs/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 4c259b026d7c..22afb700ad05 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/evidence go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 2945032711d1..ef0d80a70dc0 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/feegrant go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 66d3016cf667..56ff7abbab1d 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/gov/go.mod b/x/gov/go.mod index a8df4ff04c9f..08694766649e 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/gov go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/client/v2 v2.0.0-beta.6 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 diff --git a/x/gov/go.sum b/x/gov/go.sum index 66d3016cf667..56ff7abbab1d 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/group/go.mod b/x/group/go.mod index ca62647f38cd..9294abdbe98e 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/group go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/client/v2 v2.0.0-beta.6 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 diff --git a/x/group/go.sum b/x/group/go.sum index d672c7e75362..b08a94cb0f76 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/mint/go.mod b/x/mint/go.mod index 0690e9087b3c..1b47f6e77be6 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/mint go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/mint/go.sum b/x/mint/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/nft/go.mod b/x/nft/go.mod index 51b230f864aa..823d388ef38b 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/nft go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/core v1.0.0 cosmossdk.io/depinject v1.1.0 cosmossdk.io/errors v1.0.1 diff --git a/x/nft/go.sum b/x/nft/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 89d2c4a8fbb8..3434d726b724 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/protocolpool go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 732b72df1fef..d4c0b996b259 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/slashing go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 72d75a740a2f..5b76dafe2d26 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/staking/go.mod b/x/staking/go.mod index 4c3945372850..f7067347b8e9 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/staking go 1.23.2 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/collections v1.0.0 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 diff --git a/x/staking/go.sum b/x/staking/go.sum index d826e2fe666e..8e26d39795e6 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -4,8 +4,8 @@ buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88e buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.1-20240130113600-88ef6483f90f.1/go.mod h1:GB5hdNJd6cahKmHcLArJo5wnV9TeZGMSz7ysK4YLvag= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/upgrade/CHANGELOG.md b/x/upgrade/CHANGELOG.md index 1886aedd8f67..4e0521d3443a 100644 --- a/x/upgrade/CHANGELOG.md +++ b/x/upgrade/CHANGELOG.md @@ -25,6 +25,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Bug Fixes +* (x/upgrade) [#23179](https://github.com/cosmos/cosmos-sdk/pull/23179) Register missing implementation for SoftwareUpgradeProposal to avoid no concrete type registered for type URL /cosmos.upgrade.v1beta1.SoftwareUpgradeProposal against interface *v1beta1.Content error. + ## [v0.2.0-rc.1](https://github.com/cosmos/cosmos-sdk/releases/tag/x/upgrade/v0.2.0-rc.1) - 2024-12-18 ### Improvements diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index 01a4c7e3ec60..209c5545fd33 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/upgrade go 1.23.3 require ( - cosmossdk.io/api v0.8.0 + cosmossdk.io/api v0.8.1 cosmossdk.io/core v1.0.0 cosmossdk.io/core/testing v0.0.1 cosmossdk.io/depinject v1.1.0 @@ -11,6 +11,7 @@ require ( cosmossdk.io/log v1.5.0 cosmossdk.io/store v1.10.0-rc.1 cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a + cosmossdk.io/x/tx v1.0.0 github.com/cometbft/cometbft v1.0.0 github.com/cometbft/cometbft/api v1.0.0 github.com/cosmos/cosmos-proto v1.0.0-beta.5 @@ -46,7 +47,6 @@ require ( cosmossdk.io/schema v1.0.0 // indirect cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91 // indirect cosmossdk.io/x/staking v0.0.0-00010101000000-000000000000 // indirect - cosmossdk.io/x/tx v1.0.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index e1c26c0d007e..07a4d55e302f 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -192,8 +192,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.8.0 h1:E5Xifxu/3mPTLF79si9fyq4rR0wagubeVNmOz5duTUo= -cosmossdk.io/api v0.8.0/go.mod h1:hgJ83P0ZUu0rS1SZoVM6abk6ADOkiM259BVVlYtAPP0= +cosmossdk.io/api v0.8.1 h1:jQxx7CgUZDfgbPhPak41hW8TZzqfj06YxNI1WOulOo4= +cosmossdk.io/api v0.8.1/go.mod h1:8Q+Je1bFwsNTCMe6qigVDDyrNmFYa7ttvG96tN/oKGw= cosmossdk.io/collections v1.0.0 h1:YCYIe/pIMtc1iLDD0OrVdfWCnIkpwdy7k9NSQpaR5mg= cosmossdk.io/collections v1.0.0/go.mod h1:mFfLxnYT1fV+B3Lx9GLap1qxmffIPqQCND4xBExerps= cosmossdk.io/core v1.0.0 h1:e7XBbISOytLBOXMVwpRPixThXqEkeLGlg8no/qpgS8U= diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index 0ab589acf313..abfd8a85600b 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -3,6 +3,7 @@ package types import ( "cosmossdk.io/core/registry" coretransaction "cosmossdk.io/core/transaction" + "cosmossdk.io/x/gov/types/v1beta1" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -23,6 +24,9 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) { &MsgSoftwareUpgrade{}, &MsgCancelUpgrade{}, ) - + registrar.RegisterImplementations( + (*v1beta1.Content)(nil), + &SoftwareUpgradeProposal{}, + ) msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc) } diff --git a/x/upgrade/types/codec_test.go b/x/upgrade/types/codec_test.go new file mode 100644 index 000000000000..27198d1d12bf --- /dev/null +++ b/x/upgrade/types/codec_test.go @@ -0,0 +1,33 @@ +package types + +import ( + "testing" + + proto "github.com/cosmos/gogoproto/proto" + gogoprotoany "github.com/cosmos/gogoproto/types/any" + "github.com/stretchr/testify/require" + + "cosmossdk.io/x/gov/types/v1beta1" + "cosmossdk.io/x/tx/signing" + + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" + "github.com/cosmos/cosmos-sdk/codec/types" +) + +func TestInterfaceRegistrationOfContent(t *testing.T) { + opts := codectestutil.CodecOptions{} + registrar, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signing.Options{ + AddressCodec: opts.GetAddressCodec(), + ValidatorAddressCodec: opts.GetValidatorCodec(), + }, + }) + require.NoError(t, err) + RegisterInterfaces(registrar) + val := &gogoprotoany.Any{ + TypeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + Value: []byte{}, + } + require.NoError(t, registrar.UnpackAny(val, new(v1beta1.Content))) +} diff --git a/x/upgrade/types/proposal.go b/x/upgrade/types/proposal.go new file mode 100644 index 000000000000..0df833c9f73f --- /dev/null +++ b/x/upgrade/types/proposal.go @@ -0,0 +1,21 @@ +package types + +import ( + "cosmossdk.io/x/gov/types" + "cosmossdk.io/x/gov/types/v1beta1" +) + +// GetTitle returns the proposal title +func (sp *SoftwareUpgradeProposal) GetTitle() string { return sp.Title } + +// GetDescription returns the proposal description +func (sp *SoftwareUpgradeProposal) GetDescription() string { return sp.Description } + +// ProposalRoute returns the proposal router key +func (sp *SoftwareUpgradeProposal) ProposalRoute() string { return types.RouterKey } + +// ProposalType is "Text" +func (sp *SoftwareUpgradeProposal) ProposalType() string { return v1beta1.ProposalTypeText } + +// ValidateBasic validates the content's title and description of the proposal +func (sp *SoftwareUpgradeProposal) ValidateBasic() error { return v1beta1.ValidateAbstract(sp) }