From 07c0aa73e0aa3c9eae6f8c7f243a1d3c3dbefcce Mon Sep 17 00:00:00 2001 From: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:02:29 +0530 Subject: [PATCH] feat: Add non atomic multimsg (#19350) --- api/cosmos/auth/v1beta1/tx.pulsar.go | 1858 ++++++++++++++++- api/cosmos/auth/v1beta1/tx_grpc.pb.go | 41 +- simapp/app.go | 7 +- simapp/app_config.go | 1 + simapp/app_di.go | 2 +- .../auth/keeper/msg_server_test.go | 287 +++ .../bank/keeper/deterministic_test.go | 10 +- .../distribution/keeper/msg_server_test.go | 4 +- .../evidence/keeper/infraction_test.go | 4 +- tests/integration/example/example_test.go | 19 +- tests/integration/gov/keeper/keeper_test.go | 4 +- .../slashing/keeper/keeper_test.go | 2 +- .../integration/staking/keeper/common_test.go | 4 +- .../staking/keeper/deterministic_test.go | 4 +- tests/sims/nft/app_config.go | 2 +- x/accounts/depinject.go | 2 +- .../internal/implementation/implementation.go | 2 +- x/accounts/keeper.go | 27 +- x/accounts/keeper_test.go | 18 +- x/accounts/utils_test.go | 16 +- .../ante/testutil/expected_keepers_mocks.go | 52 + x/auth/ante/testutil_test.go | 7 +- x/auth/depinject.go | 12 +- x/auth/keeper/deterministic_test.go | 28 +- x/auth/keeper/keeper.go | 44 +- x/auth/keeper/keeper_test.go | 18 +- x/auth/keeper/msg_server.go | 32 + x/auth/module.go | 4 +- x/auth/proto/cosmos/auth/v1beta1/tx.proto | 24 + x/auth/testutil/app_config.go | 2 +- x/auth/testutil/expected_keepers_mocks.go | 23 +- x/auth/types/codec.go | 1 + x/auth/types/expected_keepers.go | 3 + x/auth/types/msgs.go | 20 + x/auth/types/tx.pb.go | 742 ++++++- .../testutil/expected_keepers_mocks.go | 53 + x/auth/vesting/types/expected_keepers.go | 6 + x/auth/vesting/types/vesting_account_test.go | 9 +- x/bank/testutil/expected_keepers_mocks.go | 14 - .../migrations/v4/migrate_funds_test.go | 14 +- x/group/migrations/v2/migrate_test.go | 3 +- 41 files changed, 3229 insertions(+), 196 deletions(-) create mode 100644 tests/integration/auth/keeper/msg_server_test.go create mode 100644 x/auth/types/msgs.go diff --git a/api/cosmos/auth/v1beta1/tx.pulsar.go b/api/cosmos/auth/v1beta1/tx.pulsar.go index 4a364ba532ff..6e9de52a99fd 100644 --- a/api/cosmos/auth/v1beta1/tx.pulsar.go +++ b/api/cosmos/auth/v1beta1/tx.pulsar.go @@ -11,6 +11,7 @@ import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" io "io" reflect "reflect" sync "sync" @@ -871,6 +872,1557 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var _ protoreflect.List = (*_MsgNonAtomicExec_2_list)(nil) + +type _MsgNonAtomicExec_2_list struct { + list *[]*anypb.Any +} + +func (x *_MsgNonAtomicExec_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgNonAtomicExec_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgNonAtomicExec_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*anypb.Any) + (*x.list)[i] = concreteValue +} + +func (x *_MsgNonAtomicExec_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*anypb.Any) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgNonAtomicExec_2_list) AppendMutable() protoreflect.Value { + v := new(anypb.Any) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgNonAtomicExec_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgNonAtomicExec_2_list) NewElement() protoreflect.Value { + v := new(anypb.Any) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgNonAtomicExec_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgNonAtomicExec protoreflect.MessageDescriptor + fd_MsgNonAtomicExec_signer protoreflect.FieldDescriptor + fd_MsgNonAtomicExec_msgs protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_auth_v1beta1_tx_proto_init() + md_MsgNonAtomicExec = File_cosmos_auth_v1beta1_tx_proto.Messages().ByName("MsgNonAtomicExec") + fd_MsgNonAtomicExec_signer = md_MsgNonAtomicExec.Fields().ByName("signer") + fd_MsgNonAtomicExec_msgs = md_MsgNonAtomicExec.Fields().ByName("msgs") +} + +var _ protoreflect.Message = (*fastReflection_MsgNonAtomicExec)(nil) + +type fastReflection_MsgNonAtomicExec MsgNonAtomicExec + +func (x *MsgNonAtomicExec) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgNonAtomicExec)(x) +} + +func (x *MsgNonAtomicExec) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgNonAtomicExec_messageType fastReflection_MsgNonAtomicExec_messageType +var _ protoreflect.MessageType = fastReflection_MsgNonAtomicExec_messageType{} + +type fastReflection_MsgNonAtomicExec_messageType struct{} + +func (x fastReflection_MsgNonAtomicExec_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgNonAtomicExec)(nil) +} +func (x fastReflection_MsgNonAtomicExec_messageType) New() protoreflect.Message { + return new(fastReflection_MsgNonAtomicExec) +} +func (x fastReflection_MsgNonAtomicExec_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgNonAtomicExec +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgNonAtomicExec) Descriptor() protoreflect.MessageDescriptor { + return md_MsgNonAtomicExec +} + +// 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_MsgNonAtomicExec) Type() protoreflect.MessageType { + return _fastReflection_MsgNonAtomicExec_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgNonAtomicExec) New() protoreflect.Message { + return new(fastReflection_MsgNonAtomicExec) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgNonAtomicExec) Interface() protoreflect.ProtoMessage { + return (*MsgNonAtomicExec)(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_MsgNonAtomicExec) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Signer != "" { + value := protoreflect.ValueOfString(x.Signer) + if !f(fd_MsgNonAtomicExec_signer, value) { + return + } + } + if len(x.Msgs) != 0 { + value := protoreflect.ValueOfList(&_MsgNonAtomicExec_2_list{list: &x.Msgs}) + if !f(fd_MsgNonAtomicExec_msgs, 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_MsgNonAtomicExec) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExec.signer": + return x.Signer != "" + case "cosmos.auth.v1beta1.MsgNonAtomicExec.msgs": + return len(x.Msgs) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExec")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExec 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_MsgNonAtomicExec) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExec.signer": + x.Signer = "" + case "cosmos.auth.v1beta1.MsgNonAtomicExec.msgs": + x.Msgs = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExec")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExec 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_MsgNonAtomicExec) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExec.signer": + value := x.Signer + return protoreflect.ValueOfString(value) + case "cosmos.auth.v1beta1.MsgNonAtomicExec.msgs": + if len(x.Msgs) == 0 { + return protoreflect.ValueOfList(&_MsgNonAtomicExec_2_list{}) + } + listValue := &_MsgNonAtomicExec_2_list{list: &x.Msgs} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExec")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExec 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_MsgNonAtomicExec) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExec.signer": + x.Signer = value.Interface().(string) + case "cosmos.auth.v1beta1.MsgNonAtomicExec.msgs": + lv := value.List() + clv := lv.(*_MsgNonAtomicExec_2_list) + x.Msgs = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExec")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExec 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_MsgNonAtomicExec) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExec.msgs": + if x.Msgs == nil { + x.Msgs = []*anypb.Any{} + } + value := &_MsgNonAtomicExec_2_list{list: &x.Msgs} + return protoreflect.ValueOfList(value) + case "cosmos.auth.v1beta1.MsgNonAtomicExec.signer": + panic(fmt.Errorf("field signer of message cosmos.auth.v1beta1.MsgNonAtomicExec is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExec")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExec 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_MsgNonAtomicExec) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExec.signer": + return protoreflect.ValueOfString("") + case "cosmos.auth.v1beta1.MsgNonAtomicExec.msgs": + list := []*anypb.Any{} + return protoreflect.ValueOfList(&_MsgNonAtomicExec_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExec")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExec 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_MsgNonAtomicExec) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.auth.v1beta1.MsgNonAtomicExec", 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_MsgNonAtomicExec) 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_MsgNonAtomicExec) 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_MsgNonAtomicExec) 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_MsgNonAtomicExec) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgNonAtomicExec) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Signer) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Msgs) > 0 { + for _, e := range x.Msgs { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgNonAtomicExec) + 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.Msgs) > 0 { + for iNdEx := len(x.Msgs) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Msgs[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.Signer) > 0 { + i -= len(x.Signer) + copy(dAtA[i:], x.Signer) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgNonAtomicExec) + 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: MsgNonAtomicExec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgNonAtomicExec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Msgs", 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.Msgs = append(x.Msgs, &anypb.Any{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Msgs[len(x.Msgs)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_NonAtomicExecResult protoreflect.MessageDescriptor + fd_NonAtomicExecResult_error protoreflect.FieldDescriptor + fd_NonAtomicExecResult_resp protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_auth_v1beta1_tx_proto_init() + md_NonAtomicExecResult = File_cosmos_auth_v1beta1_tx_proto.Messages().ByName("NonAtomicExecResult") + fd_NonAtomicExecResult_error = md_NonAtomicExecResult.Fields().ByName("error") + fd_NonAtomicExecResult_resp = md_NonAtomicExecResult.Fields().ByName("resp") +} + +var _ protoreflect.Message = (*fastReflection_NonAtomicExecResult)(nil) + +type fastReflection_NonAtomicExecResult NonAtomicExecResult + +func (x *NonAtomicExecResult) ProtoReflect() protoreflect.Message { + return (*fastReflection_NonAtomicExecResult)(x) +} + +func (x *NonAtomicExecResult) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_NonAtomicExecResult_messageType fastReflection_NonAtomicExecResult_messageType +var _ protoreflect.MessageType = fastReflection_NonAtomicExecResult_messageType{} + +type fastReflection_NonAtomicExecResult_messageType struct{} + +func (x fastReflection_NonAtomicExecResult_messageType) Zero() protoreflect.Message { + return (*fastReflection_NonAtomicExecResult)(nil) +} +func (x fastReflection_NonAtomicExecResult_messageType) New() protoreflect.Message { + return new(fastReflection_NonAtomicExecResult) +} +func (x fastReflection_NonAtomicExecResult_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_NonAtomicExecResult +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_NonAtomicExecResult) Descriptor() protoreflect.MessageDescriptor { + return md_NonAtomicExecResult +} + +// 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_NonAtomicExecResult) Type() protoreflect.MessageType { + return _fastReflection_NonAtomicExecResult_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_NonAtomicExecResult) New() protoreflect.Message { + return new(fastReflection_NonAtomicExecResult) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_NonAtomicExecResult) Interface() protoreflect.ProtoMessage { + return (*NonAtomicExecResult)(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_NonAtomicExecResult) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Error != "" { + value := protoreflect.ValueOfString(x.Error) + if !f(fd_NonAtomicExecResult_error, value) { + return + } + } + if x.Resp != nil { + value := protoreflect.ValueOfMessage(x.Resp.ProtoReflect()) + if !f(fd_NonAtomicExecResult_resp, 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_NonAtomicExecResult) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.auth.v1beta1.NonAtomicExecResult.error": + return x.Error != "" + case "cosmos.auth.v1beta1.NonAtomicExecResult.resp": + return x.Resp != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.NonAtomicExecResult")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.NonAtomicExecResult 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_NonAtomicExecResult) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.NonAtomicExecResult.error": + x.Error = "" + case "cosmos.auth.v1beta1.NonAtomicExecResult.resp": + x.Resp = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.NonAtomicExecResult")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.NonAtomicExecResult 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_NonAtomicExecResult) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.auth.v1beta1.NonAtomicExecResult.error": + value := x.Error + return protoreflect.ValueOfString(value) + case "cosmos.auth.v1beta1.NonAtomicExecResult.resp": + value := x.Resp + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.NonAtomicExecResult")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.NonAtomicExecResult 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_NonAtomicExecResult) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.NonAtomicExecResult.error": + x.Error = value.Interface().(string) + case "cosmos.auth.v1beta1.NonAtomicExecResult.resp": + x.Resp = value.Message().Interface().(*anypb.Any) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.NonAtomicExecResult")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.NonAtomicExecResult 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_NonAtomicExecResult) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.NonAtomicExecResult.resp": + if x.Resp == nil { + x.Resp = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.Resp.ProtoReflect()) + case "cosmos.auth.v1beta1.NonAtomicExecResult.error": + panic(fmt.Errorf("field error of message cosmos.auth.v1beta1.NonAtomicExecResult is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.NonAtomicExecResult")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.NonAtomicExecResult 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_NonAtomicExecResult) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.NonAtomicExecResult.error": + return protoreflect.ValueOfString("") + case "cosmos.auth.v1beta1.NonAtomicExecResult.resp": + m := new(anypb.Any) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.NonAtomicExecResult")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.NonAtomicExecResult 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_NonAtomicExecResult) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.auth.v1beta1.NonAtomicExecResult", 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_NonAtomicExecResult) 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_NonAtomicExecResult) 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_NonAtomicExecResult) 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_NonAtomicExecResult) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*NonAtomicExecResult) + 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.Error) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Resp != nil { + l = options.Size(x.Resp) + 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().(*NonAtomicExecResult) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Resp != nil { + encoded, err := options.Marshal(x.Resp) + 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.Error) > 0 { + i -= len(x.Error) + copy(dAtA[i:], x.Error) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Error))) + 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().(*NonAtomicExecResult) + 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: NonAtomicExecResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: NonAtomicExecResult: 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 Error", 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.Error = 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 Resp", 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.Resp == nil { + x.Resp = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Resp); 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 = (*_MsgNonAtomicExecResponse_1_list)(nil) + +type _MsgNonAtomicExecResponse_1_list struct { + list *[]*NonAtomicExecResult +} + +func (x *_MsgNonAtomicExecResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgNonAtomicExecResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgNonAtomicExecResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*NonAtomicExecResult) + (*x.list)[i] = concreteValue +} + +func (x *_MsgNonAtomicExecResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*NonAtomicExecResult) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgNonAtomicExecResponse_1_list) AppendMutable() protoreflect.Value { + v := new(NonAtomicExecResult) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgNonAtomicExecResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgNonAtomicExecResponse_1_list) NewElement() protoreflect.Value { + v := new(NonAtomicExecResult) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgNonAtomicExecResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgNonAtomicExecResponse protoreflect.MessageDescriptor + fd_MsgNonAtomicExecResponse_results protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_auth_v1beta1_tx_proto_init() + md_MsgNonAtomicExecResponse = File_cosmos_auth_v1beta1_tx_proto.Messages().ByName("MsgNonAtomicExecResponse") + fd_MsgNonAtomicExecResponse_results = md_MsgNonAtomicExecResponse.Fields().ByName("results") +} + +var _ protoreflect.Message = (*fastReflection_MsgNonAtomicExecResponse)(nil) + +type fastReflection_MsgNonAtomicExecResponse MsgNonAtomicExecResponse + +func (x *MsgNonAtomicExecResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgNonAtomicExecResponse)(x) +} + +func (x *MsgNonAtomicExecResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgNonAtomicExecResponse_messageType fastReflection_MsgNonAtomicExecResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgNonAtomicExecResponse_messageType{} + +type fastReflection_MsgNonAtomicExecResponse_messageType struct{} + +func (x fastReflection_MsgNonAtomicExecResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgNonAtomicExecResponse)(nil) +} +func (x fastReflection_MsgNonAtomicExecResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgNonAtomicExecResponse) +} +func (x fastReflection_MsgNonAtomicExecResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgNonAtomicExecResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgNonAtomicExecResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgNonAtomicExecResponse +} + +// 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_MsgNonAtomicExecResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgNonAtomicExecResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgNonAtomicExecResponse) New() protoreflect.Message { + return new(fastReflection_MsgNonAtomicExecResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgNonAtomicExecResponse) Interface() protoreflect.ProtoMessage { + return (*MsgNonAtomicExecResponse)(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_MsgNonAtomicExecResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Results) != 0 { + value := protoreflect.ValueOfList(&_MsgNonAtomicExecResponse_1_list{list: &x.Results}) + if !f(fd_MsgNonAtomicExecResponse_results, 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_MsgNonAtomicExecResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExecResponse.results": + return len(x.Results) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExecResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExecResponse 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_MsgNonAtomicExecResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExecResponse.results": + x.Results = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExecResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExecResponse 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_MsgNonAtomicExecResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExecResponse.results": + if len(x.Results) == 0 { + return protoreflect.ValueOfList(&_MsgNonAtomicExecResponse_1_list{}) + } + listValue := &_MsgNonAtomicExecResponse_1_list{list: &x.Results} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExecResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExecResponse 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_MsgNonAtomicExecResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExecResponse.results": + lv := value.List() + clv := lv.(*_MsgNonAtomicExecResponse_1_list) + x.Results = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExecResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExecResponse 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_MsgNonAtomicExecResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExecResponse.results": + if x.Results == nil { + x.Results = []*NonAtomicExecResult{} + } + value := &_MsgNonAtomicExecResponse_1_list{list: &x.Results} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExecResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExecResponse 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_MsgNonAtomicExecResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgNonAtomicExecResponse.results": + list := []*NonAtomicExecResult{} + return protoreflect.ValueOfList(&_MsgNonAtomicExecResponse_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgNonAtomicExecResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgNonAtomicExecResponse 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_MsgNonAtomicExecResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.auth.v1beta1.MsgNonAtomicExecResponse", 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_MsgNonAtomicExecResponse) 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_MsgNonAtomicExecResponse) 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_MsgNonAtomicExecResponse) 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_MsgNonAtomicExecResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgNonAtomicExecResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Results) > 0 { + for _, e := range x.Results { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if 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().(*MsgNonAtomicExecResponse) + 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.Results) > 0 { + for iNdEx := len(x.Results) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Results[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgNonAtomicExecResponse) + 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: MsgNonAtomicExecResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgNonAtomicExecResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Results = append(x.Results, &NonAtomicExecResult{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Results[len(x.Results)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + 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 @@ -964,6 +2516,131 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_cosmos_auth_v1beta1_tx_proto_rawDescGZIP(), []int{1} } +// MsgNonAtomicExec defines the Msg/NonAtomicExec request type. +type MsgNonAtomicExec struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Msgs []*anypb.Any `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` +} + +func (x *MsgNonAtomicExec) Reset() { + *x = MsgNonAtomicExec{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgNonAtomicExec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgNonAtomicExec) ProtoMessage() {} + +// Deprecated: Use MsgNonAtomicExec.ProtoReflect.Descriptor instead. +func (*MsgNonAtomicExec) Descriptor() ([]byte, []int) { + return file_cosmos_auth_v1beta1_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgNonAtomicExec) GetSigner() string { + if x != nil { + return x.Signer + } + return "" +} + +func (x *MsgNonAtomicExec) GetMsgs() []*anypb.Any { + if x != nil { + return x.Msgs + } + return nil +} + +// NonAtomicExecResult defines the response structure for executing a +// MsgNonAtomicExec. +type NonAtomicExecResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + Resp *anypb.Any `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"` +} + +func (x *NonAtomicExecResult) Reset() { + *x = NonAtomicExecResult{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NonAtomicExecResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NonAtomicExecResult) ProtoMessage() {} + +// Deprecated: Use NonAtomicExecResult.ProtoReflect.Descriptor instead. +func (*NonAtomicExecResult) Descriptor() ([]byte, []int) { + return file_cosmos_auth_v1beta1_tx_proto_rawDescGZIP(), []int{3} +} + +func (x *NonAtomicExecResult) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *NonAtomicExecResult) GetResp() *anypb.Any { + if x != nil { + return x.Resp + } + return nil +} + +// MsgNonAtomicExecResponse defines the response of MsgNonAtomicExec. +type MsgNonAtomicExecResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Results []*NonAtomicExecResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (x *MsgNonAtomicExecResponse) Reset() { + *x = MsgNonAtomicExecResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgNonAtomicExecResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgNonAtomicExecResponse) ProtoMessage() {} + +// Deprecated: Use MsgNonAtomicExecResponse.ProtoReflect.Descriptor instead. +func (*MsgNonAtomicExecResponse) Descriptor() ([]byte, []int) { + return file_cosmos_auth_v1beta1_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgNonAtomicExecResponse) GetResults() []*NonAtomicExecResult { + if x != nil { + return x.Results + } + return nil +} + var File_cosmos_auth_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_auth_v1beta1_tx_proto_rawDesc = []byte{ @@ -971,47 +2648,77 @@ var file_cosmos_auth_v1beta1_tx_proto_rawDesc = []byte{ 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, - 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, - 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0xbf, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 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, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3e, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x34, 0x82, 0xe7, - 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, - 0x21, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x61, 0x75, - 0x74, 0x68, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x70, 0x0a, - 0x03, 0x4d, 0x73, 0x67, 0x12, 0x62, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, + 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, + 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x01, 0x0a, 0x0f, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 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, 0x09, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x34, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x21, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, + 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x98, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, + 0x4e, 0x6f, 0x6e, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x45, 0x78, 0x65, 0x63, 0x12, 0x30, 0x0a, + 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, + 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, + 0x45, 0x0a, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x18, 0x02, 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, 0x42, 0x1b, 0xca, 0xb4, 0x2d, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x52, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, + 0x6e, 0x65, 0x72, 0x22, 0x55, 0x0a, 0x13, 0x4e, 0x6f, 0x6e, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, + 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x12, 0x28, 0x0a, 0x04, 0x72, 0x65, 0x73, 0x70, 0x18, 0x02, 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, 0x04, 0x72, 0x65, 0x73, 0x70, 0x22, 0x5e, 0x0a, 0x18, 0x4d, 0x73, + 0x67, 0x4e, 0x6f, 0x6e, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4e, 0x6f, + 0x6e, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0xd7, 0x01, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x62, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0d, 0x4e, 0x6f, 0x6e, 0x41, 0x74, 0x6f, + 0x6d, 0x69, 0x63, 0x45, 0x78, 0x65, 0x63, 0x12, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x4e, 0x6f, 0x6e, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x45, 0x78, 0x65, 0x63, 0x1a, 0x2d, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4e, 0x6f, 0x6e, 0x41, 0x74, 0x6f, 0x6d, 0x69, + 0x63, 0x45, 0x78, 0x65, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, + 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, - 0xc2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x75, 0x74, - 0x68, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, - 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, - 0x74, 0x68, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x3b, 0x61, 0x75, 0x74, 0x68, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, + 0x43, 0x41, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x75, 0x74, + 0x68, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, + 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x75, 0x74, 0x68, 0x5c, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x75, 0x74, 0x68, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -1026,21 +2733,30 @@ func file_cosmos_auth_v1beta1_tx_proto_rawDescGZIP() []byte { return file_cosmos_auth_v1beta1_tx_proto_rawDescData } -var file_cosmos_auth_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cosmos_auth_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_cosmos_auth_v1beta1_tx_proto_goTypes = []interface{}{ - (*MsgUpdateParams)(nil), // 0: cosmos.auth.v1beta1.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 1: cosmos.auth.v1beta1.MsgUpdateParamsResponse - (*Params)(nil), // 2: cosmos.auth.v1beta1.Params + (*MsgUpdateParams)(nil), // 0: cosmos.auth.v1beta1.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: cosmos.auth.v1beta1.MsgUpdateParamsResponse + (*MsgNonAtomicExec)(nil), // 2: cosmos.auth.v1beta1.MsgNonAtomicExec + (*NonAtomicExecResult)(nil), // 3: cosmos.auth.v1beta1.NonAtomicExecResult + (*MsgNonAtomicExecResponse)(nil), // 4: cosmos.auth.v1beta1.MsgNonAtomicExecResponse + (*Params)(nil), // 5: cosmos.auth.v1beta1.Params + (*anypb.Any)(nil), // 6: google.protobuf.Any } var file_cosmos_auth_v1beta1_tx_proto_depIdxs = []int32{ - 2, // 0: cosmos.auth.v1beta1.MsgUpdateParams.params:type_name -> cosmos.auth.v1beta1.Params - 0, // 1: cosmos.auth.v1beta1.Msg.UpdateParams:input_type -> cosmos.auth.v1beta1.MsgUpdateParams - 1, // 2: cosmos.auth.v1beta1.Msg.UpdateParams:output_type -> cosmos.auth.v1beta1.MsgUpdateParamsResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 5, // 0: cosmos.auth.v1beta1.MsgUpdateParams.params:type_name -> cosmos.auth.v1beta1.Params + 6, // 1: cosmos.auth.v1beta1.MsgNonAtomicExec.msgs:type_name -> google.protobuf.Any + 6, // 2: cosmos.auth.v1beta1.NonAtomicExecResult.resp:type_name -> google.protobuf.Any + 3, // 3: cosmos.auth.v1beta1.MsgNonAtomicExecResponse.results:type_name -> cosmos.auth.v1beta1.NonAtomicExecResult + 0, // 4: cosmos.auth.v1beta1.Msg.UpdateParams:input_type -> cosmos.auth.v1beta1.MsgUpdateParams + 2, // 5: cosmos.auth.v1beta1.Msg.NonAtomicExec:input_type -> cosmos.auth.v1beta1.MsgNonAtomicExec + 1, // 6: cosmos.auth.v1beta1.Msg.UpdateParams:output_type -> cosmos.auth.v1beta1.MsgUpdateParamsResponse + 4, // 7: cosmos.auth.v1beta1.Msg.NonAtomicExec:output_type -> cosmos.auth.v1beta1.MsgNonAtomicExecResponse + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_cosmos_auth_v1beta1_tx_proto_init() } @@ -1074,6 +2790,42 @@ func file_cosmos_auth_v1beta1_tx_proto_init() { return nil } } + file_cosmos_auth_v1beta1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgNonAtomicExec); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_auth_v1beta1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NonAtomicExecResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cosmos_auth_v1beta1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgNonAtomicExecResponse); 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{ @@ -1081,7 +2833,7 @@ func file_cosmos_auth_v1beta1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cosmos_auth_v1beta1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 5, NumExtensions: 0, NumServices: 1, }, diff --git a/api/cosmos/auth/v1beta1/tx_grpc.pb.go b/api/cosmos/auth/v1beta1/tx_grpc.pb.go index f6330fcec421..c079d602fb3f 100644 --- a/api/cosmos/auth/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/auth/v1beta1/tx_grpc.pb.go @@ -19,7 +19,8 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Msg_UpdateParams_FullMethodName = "/cosmos.auth.v1beta1.Msg/UpdateParams" + Msg_UpdateParams_FullMethodName = "/cosmos.auth.v1beta1.Msg/UpdateParams" + Msg_NonAtomicExec_FullMethodName = "/cosmos.auth.v1beta1.Msg/NonAtomicExec" ) // MsgClient is the client API for Msg service. @@ -31,6 +32,8 @@ type MsgClient interface { // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // NonAtomicExec allows users to submit multiple messages for non-atomic execution. + NonAtomicExec(ctx context.Context, in *MsgNonAtomicExec, opts ...grpc.CallOption) (*MsgNonAtomicExecResponse, error) } type msgClient struct { @@ -50,6 +53,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) NonAtomicExec(ctx context.Context, in *MsgNonAtomicExec, opts ...grpc.CallOption) (*MsgNonAtomicExecResponse, error) { + out := new(MsgNonAtomicExecResponse) + err := c.cc.Invoke(ctx, Msg_NonAtomicExec_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -59,6 +71,8 @@ type MsgServer interface { // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // NonAtomicExec allows users to submit multiple messages for non-atomic execution. + NonAtomicExec(context.Context, *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) mustEmbedUnimplementedMsgServer() } @@ -69,6 +83,9 @@ type UnimplementedMsgServer struct { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (UnimplementedMsgServer) NonAtomicExec(context.Context, *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NonAtomicExec not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -100,6 +117,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_NonAtomicExec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgNonAtomicExec) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).NonAtomicExec(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_NonAtomicExec_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).NonAtomicExec(ctx, req.(*MsgNonAtomicExec)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -111,6 +146,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "NonAtomicExec", + Handler: _Msg_NonAtomicExec_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/auth/v1beta1/tx.proto", diff --git a/simapp/app.go b/simapp/app.go index 1c077ed7fb21..ea359a1a1ddb 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -289,7 +289,6 @@ func NewSimApp( appCodec, runtime.NewEnvironment(runtime.NewKVStoreService(keys[accounts.StoreKey]), logger), signingCtx.AddressCodec(), - appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter(), appCodec.InterfaceRegistry(), @@ -309,7 +308,7 @@ func NewSimApp( } app.AccountsKeeper = accountsKeeper - app.AuthKeeper = authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), logger), appCodec, authtypes.ProtoBaseAccount, maccPerms, signingCtx.AddressCodec(), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AccountsKeeper) + app.AuthKeeper = authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), logger), appCodec, authtypes.ProtoBaseAccount, accountsKeeper, maccPerms, signingCtx.AddressCodec(), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String()) app.BankKeeper = bankkeeper.NewBaseKeeper( runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), logger), @@ -431,7 +430,7 @@ func NewSimApp( app.ModuleManager = module.NewManager( genutil.NewAppModule(appCodec, app.AuthKeeper, app.StakingKeeper, app, txConfig, genutiltypes.DefaultMessageValidator), accounts.NewAppModule(appCodec, app.AccountsKeeper), - auth.NewAppModule(appCodec, app.AuthKeeper, authsims.RandomGenesisAccounts), + auth.NewAppModule(appCodec, app.AuthKeeper, app.AccountsKeeper, authsims.RandomGenesisAccounts), vesting.NewAppModule(app.AuthKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AuthKeeper), feegrantmodule.NewAppModule(appCodec, app.AuthKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), @@ -523,7 +522,7 @@ func NewSimApp( // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, authsims.RandomGenesisAccounts), + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, app.AccountsKeeper, authsims.RandomGenesisAccounts), } app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) diff --git a/simapp/app_config.go b/simapp/app_config.go index 95d978c7a6cc..1ac042beaa76 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -31,6 +31,7 @@ import ( vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" "cosmossdk.io/depinject/appconfig" "cosmossdk.io/x/accounts" + _ "cosmossdk.io/x/accounts" // import for side-effects _ "cosmossdk.io/x/auth/tx/config" // import for side-effects authtypes "cosmossdk.io/x/auth/types" _ "cosmossdk.io/x/auth/vesting" // import for side-effects diff --git a/simapp/app_di.go b/simapp/app_di.go index b223e8e4f797..2630778ebbc2 100644 --- a/simapp/app_di.go +++ b/simapp/app_di.go @@ -260,7 +260,7 @@ func NewSimApp( // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, authsims.RandomGenesisAccounts), + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AuthKeeper, &app.AccountsKeeper, authsims.RandomGenesisAccounts), } app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) diff --git a/tests/integration/auth/keeper/msg_server_test.go b/tests/integration/auth/keeper/msg_server_test.go new file mode 100644 index 000000000000..b7ae43e00c1d --- /dev/null +++ b/tests/integration/auth/keeper/msg_server_test.go @@ -0,0 +1,287 @@ +package keeper_test + +import ( + "context" + "strings" + "testing" + + "gotest.tools/v3/assert" + + signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/log" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/accounts" + baseaccount "cosmossdk.io/x/accounts/defaults/base" + "cosmossdk.io/x/auth" + authkeeper "cosmossdk.io/x/auth/keeper" + authsims "cosmossdk.io/x/auth/simulation" + "cosmossdk.io/x/auth/types" + authtypes "cosmossdk.io/x/auth/types" + "cosmossdk.io/x/bank" + "cosmossdk.io/x/bank/keeper" + bankkeeper "cosmossdk.io/x/bank/keeper" + "cosmossdk.io/x/bank/testutil" + banktypes "cosmossdk.io/x/bank/types" + minttypes "cosmossdk.io/x/mint/types" + "cosmossdk.io/x/tx/signing" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/testutil/integration" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" +) + +type fixture struct { + app *integration.App + + cdc codec.Codec + ctx sdk.Context + + authKeeper authkeeper.AccountKeeper + accountsKeeper accounts.Keeper + bankKeeper bankkeeper.Keeper +} + +var _ signing.SignModeHandler = directHandler{} + +type directHandler struct{} + +func (s directHandler) Mode() signingv1beta1.SignMode { + return signingv1beta1.SignMode_SIGN_MODE_DIRECT +} + +func (s directHandler) GetSignBytes(_ context.Context, _ signing.SignerData, _ signing.TxData) ([]byte, error) { + panic("not implemented") +} + +func initFixture(t *testing.T) *fixture { + t.Helper() + keys := storetypes.NewKVStoreKeys( + authtypes.StoreKey, banktypes.StoreKey, accounts.StoreKey, + ) + encodingCfg := moduletestutil.MakeTestEncodingConfig(codectestutil.CodecOptions{}, auth.AppModule{}, bank.AppModule{}, accounts.AppModule{}) + cdc := encodingCfg.Codec + + logger := log.NewTestLogger(t) + cms := integration.CreateMultiStore(keys, logger) + + newCtx := sdk.NewContext(cms, true, logger) + + router := baseapp.NewMsgServiceRouter() + router.SetInterfaceRegistry(cdc.InterfaceRegistry()) + queryRouter := baseapp.NewGRPCQueryRouter() + queryRouter.SetInterfaceRegistry(cdc.InterfaceRegistry()) + + handler := directHandler{} + account := baseaccount.NewAccount("base", signing.NewHandlerMap(handler)) + accountsKeeper, err := accounts.NewKeeper( + cdc, + runtime.NewEnvironment(runtime.NewKVStoreService(keys[accounts.StoreKey]), log.NewNopLogger()), + addresscodec.NewBech32Codec("cosmos"), + router, + queryRouter, + cdc.InterfaceRegistry(), + account, + ) + assert.NilError(t, err) + + authority := authtypes.NewModuleAddress("gov") + + authKeeper := authkeeper.NewAccountKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), + cdc, + authtypes.ProtoBaseAccount, + accountsKeeper, + map[string][]string{minttypes.ModuleName: {authtypes.Minter}}, + addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), + sdk.Bech32MainPrefix, + authority.String(), + ) + + blockedAddresses := map[string]bool{ + authKeeper.GetAuthority(): false, + } + bankKeeper := keeper.NewBaseKeeper( + runtime.NewEnvironment(runtime.NewKVStoreService(keys[banktypes.StoreKey]), log.NewNopLogger()), + cdc, + authKeeper, + blockedAddresses, + authority.String(), + ) + + params := banktypes.DefaultParams() + assert.NilError(t, bankKeeper.SetParams(newCtx, params)) + + accountsModule := accounts.NewAppModule(cdc, accountsKeeper) + authModule := auth.NewAppModule(cdc, authKeeper, accountsKeeper, authsims.RandomGenesisAccounts) + bankModule := bank.NewAppModule(cdc, bankKeeper, authKeeper) + + integrationApp := integration.NewIntegrationApp(newCtx, logger, keys, cdc, + encodingCfg.InterfaceRegistry.SigningContext().AddressCodec(), + encodingCfg.InterfaceRegistry.SigningContext().ValidatorAddressCodec(), + map[string]appmodule.AppModule{ + accounts.ModuleName: accountsModule, + authtypes.ModuleName: authModule, + banktypes.ModuleName: bankModule, + }) + + authtypes.RegisterInterfaces(cdc.InterfaceRegistry()) + banktypes.RegisterInterfaces(cdc.InterfaceRegistry()) + + authtypes.RegisterMsgServer(integrationApp.MsgServiceRouter(), authkeeper.NewMsgServerImpl(authKeeper)) + authtypes.RegisterQueryServer(integrationApp.QueryHelper(), authkeeper.NewQueryServer(authKeeper)) + + banktypes.RegisterMsgServer(router, bankkeeper.NewMsgServerImpl(bankKeeper)) + + return &fixture{ + app: integrationApp, + cdc: cdc, + ctx: newCtx, + accountsKeeper: accountsKeeper, + authKeeper: authKeeper, + bankKeeper: bankKeeper, + } +} + +func TestAsyncExec(t *testing.T) { + t.Parallel() + f := initFixture(t) + + addrs := simtestutil.CreateIncrementalAccounts(2) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10))) + + assert.NilError(t, testutil.FundAccount(f.ctx, f.bankKeeper, addrs[0], sdk.NewCoins(sdk.NewInt64Coin("stake", 50)))) + + msg := &banktypes.MsgSend{ + FromAddress: addrs[0].String(), + ToAddress: addrs[1].String(), + Amount: coins, + } + msg2 := &banktypes.MsgSend{ + FromAddress: addrs[1].String(), + ToAddress: addrs[0].String(), + Amount: coins, + } + failingMsg := &banktypes.MsgSend{ + FromAddress: addrs[0].String(), + ToAddress: addrs[1].String(), + Amount: sdk.NewCoins(sdk.NewCoin("stake", sdkmath.ZeroInt())), // No amount specified + } + + msgAny, err := codectypes.NewAnyWithValue(msg) + assert.NilError(t, err) + + msgAny2, err := codectypes.NewAnyWithValue(msg2) + assert.NilError(t, err) + + failingMsgAny, err := codectypes.NewAnyWithValue(failingMsg) + assert.NilError(t, err) + + testCases := []struct { + name string + req *types.MsgNonAtomicExec + expectErr bool + expErrMsg string + }{ + { + name: "empty signer address", + req: &types.MsgNonAtomicExec{ + Signer: "", + Msgs: []*codectypes.Any{}, + }, + expectErr: true, + expErrMsg: "empty signer address string is not allowed", + }, + { + name: "invalid signer address", + req: &types.MsgNonAtomicExec{ + Signer: "invalid", + Msgs: []*codectypes.Any{}, + }, + expectErr: true, + expErrMsg: "invalid signer address", + }, + { + name: "empty msgs", + req: &types.MsgNonAtomicExec{ + Signer: addrs[0].String(), + Msgs: []*codectypes.Any{}, + }, + expectErr: true, + expErrMsg: "messages cannot be empty", + }, + { + name: "valid msg", + req: &types.MsgNonAtomicExec{ + Signer: addrs[0].String(), + Msgs: []*codectypes.Any{msgAny}, + }, + expectErr: false, + }, + { + name: "multiple messages being executed", + req: &types.MsgNonAtomicExec{ + Signer: addrs[0].String(), + Msgs: []*codectypes.Any{msgAny, msgAny}, + }, + expectErr: false, + }, + { + name: "multiple messages with different signers", + req: &types.MsgNonAtomicExec{ + Signer: addrs[0].String(), + Msgs: []*codectypes.Any{msgAny, msgAny2}, + }, + expectErr: false, + expErrMsg: "unauthorized: sender does not match expected sender", + }, + { + name: "multi msg with one failing being executed", + req: &types.MsgNonAtomicExec{ + Signer: addrs[0].String(), + Msgs: []*codectypes.Any{msgAny, failingMsgAny}, + }, + expectErr: false, + expErrMsg: "invalid coins", + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + res, err := f.app.RunMsg( + tc.req, + integration.WithAutomaticFinalizeBlock(), + integration.WithAutomaticCommit(), + ) + if tc.expectErr { + assert.ErrorContains(t, err, tc.expErrMsg) + } else { + assert.NilError(t, err) + assert.Assert(t, res != nil) + + // check the result + result := authtypes.MsgNonAtomicExecResponse{} + err = f.cdc.Unmarshal(res.Value, &result) + assert.NilError(t, err) + + if tc.expErrMsg != "" { + for _, res := range result.Results { + if res.Error != "" { + assert.Assert(t, strings.Contains(res.Error, tc.expErrMsg)) + } + continue + } + } + } + }) + } +} diff --git a/tests/integration/bank/keeper/deterministic_test.go b/tests/integration/bank/keeper/deterministic_test.go index ec399463c11d..2f126d5ab386 100644 --- a/tests/integration/bank/keeper/deterministic_test.go +++ b/tests/integration/bank/keeper/deterministic_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + "github.com/golang/mock/gomock" "gotest.tools/v3/assert" "pgregory.net/rapid" @@ -13,6 +14,7 @@ import ( "cosmossdk.io/x/auth" authkeeper "cosmossdk.io/x/auth/keeper" authsims "cosmossdk.io/x/auth/simulation" + authtestutil "cosmossdk.io/x/auth/testutil" _ "cosmossdk.io/x/auth/tx/config" authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" @@ -78,15 +80,19 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { minttypes.ModuleName: {authtypes.Minter}, } + // gomock initializations + ctrl := gomock.NewController(t) + acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl) + accountKeeper := authkeeper.NewAccountKeeper( runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authority.String(), - nil, ) blockedAddresses := map[string]bool{ @@ -101,7 +107,7 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { authority.String(), ) - authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) integrationApp := integration.NewIntegrationApp(newCtx, logger, keys, cdc, diff --git a/tests/integration/distribution/keeper/msg_server_test.go b/tests/integration/distribution/keeper/msg_server_test.go index 386e5edab56a..cd2d89333f0d 100644 --- a/tests/integration/distribution/keeper/msg_server_test.go +++ b/tests/integration/distribution/keeper/msg_server_test.go @@ -95,11 +95,11 @@ func initFixture(t *testing.T) *fixture { runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authority.String(), - acctsModKeeper, ) blockedAddresses := map[string]bool{ @@ -122,7 +122,7 @@ func initFixture(t *testing.T) *fixture { cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[distrtypes.StoreKey]), logger), accountKeeper, bankKeeper, stakingKeeper, poolKeeper, distrtypes.ModuleName, authority.String(), ) - authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) distrModule := distribution.NewAppModule(cdc, distrKeeper, accountKeeper, bankKeeper, stakingKeeper, poolKeeper) diff --git a/tests/integration/evidence/keeper/infraction_test.go b/tests/integration/evidence/keeper/infraction_test.go index d0b890abe627..62b3a6362d76 100644 --- a/tests/integration/evidence/keeper/infraction_test.go +++ b/tests/integration/evidence/keeper/infraction_test.go @@ -115,11 +115,11 @@ func initFixture(tb testing.TB) *fixture { runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authority.String(), - acctsModKeeper, ) blockedAddresses := map[string]bool{ @@ -144,7 +144,7 @@ func initFixture(tb testing.TB) *fixture { router = router.AddRoute(evidencetypes.RouteEquivocation, testEquivocationHandler(evidenceKeeper)) evidenceKeeper.SetRouter(router) - authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) slashingModule := slashing.NewAppModule(cdc, slashingKeeper, accountKeeper, bankKeeper, stakingKeeper, cdc.InterfaceRegistry()) diff --git a/tests/integration/example/example_test.go b/tests/integration/example/example_test.go index b995e00b18c4..bc87760e114b 100644 --- a/tests/integration/example/example_test.go +++ b/tests/integration/example/example_test.go @@ -3,7 +3,9 @@ package integration_test import ( "fmt" "io" + "testing" + "github.com/golang/mock/gomock" "github.com/google/go-cmp/cmp" "cosmossdk.io/core/appmodule" @@ -12,6 +14,7 @@ import ( "cosmossdk.io/x/auth" authkeeper "cosmossdk.io/x/auth/keeper" authsims "cosmossdk.io/x/auth/simulation" + authtestutil "cosmossdk.io/x/auth/testutil" authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/mint" mintkeeper "cosmossdk.io/x/mint/keeper" @@ -42,19 +45,23 @@ func Example() { cms := integration.CreateMultiStore(keys, logger) newCtx := sdk.NewContext(cms, true, logger) + // gomock initializations + ctrl := gomock.NewController(&testing.T{}) + acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl) + accountKeeper := authkeeper.NewAccountKeeper( runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), encodingCfg.Codec, authtypes.ProtoBaseAccount, + acctsModKeeper, map[string][]string{minttypes.ModuleName: {authtypes.Minter}}, addresscodec.NewBech32Codec("cosmos"), "cosmos", authority, - nil, ) // subspace is nil because we don't test params (which is legacy anyway) - authModule := auth.NewAppModule(encodingCfg.Codec, accountKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(encodingCfg.Codec, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) // here bankkeeper and staking keeper is nil because we are not testing them // subspace is nil because we don't test params (which is legacy anyway) @@ -134,19 +141,23 @@ func Example_oneModule() { cms := integration.CreateMultiStore(keys, logger) newCtx := sdk.NewContext(cms, true, logger) + // gomock initializations + ctrl := gomock.NewController(&testing.T{}) + acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl) + accountKeeper := authkeeper.NewAccountKeeper( runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), encodingCfg.Codec, authtypes.ProtoBaseAccount, + acctsModKeeper, map[string][]string{minttypes.ModuleName: {authtypes.Minter}}, addresscodec.NewBech32Codec("cosmos"), "cosmos", authority, - nil, ) // subspace is nil because we don't test params (which is legacy anyway) - authModule := auth.NewAppModule(encodingCfg.Codec, accountKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(encodingCfg.Codec, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) // create the application and register all the modules from the previous step integrationApp := integration.NewIntegrationApp( diff --git a/tests/integration/gov/keeper/keeper_test.go b/tests/integration/gov/keeper/keeper_test.go index 426e80037dde..55d3b2154c33 100644 --- a/tests/integration/gov/keeper/keeper_test.go +++ b/tests/integration/gov/keeper/keeper_test.go @@ -82,11 +82,11 @@ func initFixture(tb testing.TB) *fixture { runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authority.String(), - acctsModKeeper, ) blockedAddresses := map[string]bool{ @@ -132,7 +132,7 @@ func initFixture(tb testing.TB) *fixture { err = govKeeper.Params.Set(newCtx, v1.DefaultParams()) assert.NilError(tb, err) - authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) govModule := gov.NewAppModule(cdc, govKeeper, accountKeeper, bankKeeper, poolKeeper) diff --git a/tests/integration/slashing/keeper/keeper_test.go b/tests/integration/slashing/keeper/keeper_test.go index 09fec08e575e..a9c325ab348e 100644 --- a/tests/integration/slashing/keeper/keeper_test.go +++ b/tests/integration/slashing/keeper/keeper_test.go @@ -83,11 +83,11 @@ func initFixture(tb testing.TB) *fixture { runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authority.String(), - acctsModKeeper, ) blockedAddresses := map[string]bool{ diff --git a/tests/integration/staking/keeper/common_test.go b/tests/integration/staking/keeper/common_test.go index c67341031eb1..35b9f6300966 100644 --- a/tests/integration/staking/keeper/common_test.go +++ b/tests/integration/staking/keeper/common_test.go @@ -132,11 +132,11 @@ func initFixture(tb testing.TB) *fixture { runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authority.String(), - acctsModKeeper, ) blockedAddresses := map[string]bool{ @@ -152,7 +152,7 @@ func initFixture(tb testing.TB) *fixture { stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[types.StoreKey]), log.NewNopLogger()), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr)) - authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) diff --git a/tests/integration/staking/keeper/deterministic_test.go b/tests/integration/staking/keeper/deterministic_test.go index 3c90367d4025..12182e992d66 100644 --- a/tests/integration/staking/keeper/deterministic_test.go +++ b/tests/integration/staking/keeper/deterministic_test.go @@ -96,11 +96,11 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, addresscodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authority.String(), - acctsModKeeper, ) blockedAddresses := map[string]bool{ @@ -116,7 +116,7 @@ func initDeterministicFixture(t *testing.T) *deterministicFixture { stakingKeeper := stakingkeeper.NewKeeper(cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), log.NewNopLogger()), accountKeeper, bankKeeper, authority.String(), addresscodec.NewBech32Codec(sdk.Bech32PrefixValAddr), addresscodec.NewBech32Codec(sdk.Bech32PrefixConsAddr)) - authModule := auth.NewAppModule(cdc, accountKeeper, authsims.RandomGenesisAccounts) + authModule := auth.NewAppModule(cdc, accountKeeper, acctsModKeeper, authsims.RandomGenesisAccounts) bankModule := bank.NewAppModule(cdc, bankKeeper, accountKeeper) stakingModule := staking.NewAppModule(cdc, stakingKeeper, accountKeeper, bankKeeper) diff --git a/tests/sims/nft/app_config.go b/tests/sims/nft/app_config.go index 156056fe4bdf..52edcb502b93 100644 --- a/tests/sims/nft/app_config.go +++ b/tests/sims/nft/app_config.go @@ -1,7 +1,7 @@ package nft import ( - _ "cosmossdk.io/x/accounts" + _ "cosmossdk.io/x/accounts" // import as blank for app wiring _ "cosmossdk.io/x/auth" // import as blank for app wiring _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring _ "cosmossdk.io/x/bank" // import as blank for app wiring diff --git a/x/accounts/depinject.go b/x/accounts/depinject.go index 8714d98ba1d9..5f322b74c0ee 100644 --- a/x/accounts/depinject.go +++ b/x/accounts/depinject.go @@ -62,7 +62,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { handler := directHandler{} account := baseaccount.NewAccount("base", signing.NewHandlerMap(handler)) accountskeeper, err := NewKeeper( - in.Cdc, in.Environment, in.AddressCodec, in.Cdc, + in.Cdc, in.Environment, in.AddressCodec, in.ExecRouter, in.QueryRouter, in.Registry, account, ) if err != nil { diff --git a/x/accounts/internal/implementation/implementation.go b/x/accounts/internal/implementation/implementation.go index cb55359d04a7..47457af718d1 100644 --- a/x/accounts/internal/implementation/implementation.go +++ b/x/accounts/internal/implementation/implementation.go @@ -30,7 +30,7 @@ type AccountCreatorFunc = func(deps Dependencies) (string, Account, error) // MakeAccountsMap creates a map of account names to account implementations // from a list of account creator functions. func MakeAccountsMap( - cdc codec.BinaryCodec, + cdc codec.Codec, addressCodec address.Codec, env appmodule.Environment, accounts []AccountCreatorFunc, diff --git a/x/accounts/keeper.go b/x/accounts/keeper.go index 667f6c19a742..676130fe6437 100644 --- a/x/accounts/keeper.go +++ b/x/accounts/keeper.go @@ -8,8 +8,6 @@ import ( "errors" "fmt" - gogoproto "github.com/cosmos/gogoproto/proto" - "google.golang.org/protobuf/proto" "google.golang.org/protobuf/runtime/protoiface" "cosmossdk.io/collections" @@ -50,22 +48,15 @@ type MsgRouter interface { ResponseNameByMsgName(name string) string } -// SignerProvider defines an interface used to get the expected sender from a message. -type SignerProvider interface { - // GetMsgV1Signers returns the signers of the message. - GetMsgV1Signers(msg gogoproto.Message) ([][]byte, proto.Message, error) -} - type InterfaceRegistry interface { RegisterInterface(name string, iface any, impls ...protoiface.MessageV1) RegisterImplementations(iface any, impls ...protoiface.MessageV1) } func NewKeeper( - cdc codec.BinaryCodec, + cdc codec.Codec, env appmodule.Environment, addressCodec address.Codec, - signerProvider SignerProvider, execRouter MsgRouter, queryRouter QueryRouter, ir InterfaceRegistry, @@ -76,7 +67,7 @@ func NewKeeper( environment: env, addressCodec: addressCodec, msgRouter: execRouter, - signerProvider: signerProvider, + codec: cdc, queryRouter: queryRouter, makeSendCoinsMsg: defaultCoinsTransferMsgFunc(addressCodec), Schema: collections.Schema{}, @@ -103,8 +94,8 @@ type Keeper struct { // deps coming from the runtime environment appmodule.Environment addressCodec address.Codec - msgRouter MsgRouter // todo use env - signerProvider SignerProvider + codec codec.Codec + msgRouter MsgRouter // todo use env queryRouter QueryRouter // todo use env makeSendCoinsMsg coinsTransferMsgFunc @@ -302,7 +293,7 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountNumber uint64, ac sender, funds, k.sendModuleMessage, - k.sendModuleMessageUntyped, + k.SendModuleMessageUntyped, k.queryModule, ) } @@ -336,7 +327,7 @@ func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages if err != nil { return nil, err } - resp, err := k.sendModuleMessageUntyped(ctx, sender, msg) + resp, err := k.SendModuleMessageUntyped(ctx, sender, msg) if err != nil { return nil, fmt.Errorf("failed to execute message %d: %s", i, err.Error()) } @@ -349,9 +340,9 @@ func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages return anyResponses, nil } -// sendModuleMessageUntyped can be used to send a message towards a module. +// SendModuleMessageUntyped can be used to send a message towards a module. // It should be used when the response type is not known by the caller. -func (k Keeper) sendModuleMessageUntyped(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { +func (k Keeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) { // we need to fetch the response type from the request message type. // this is because the response type is not known. respName := k.msgRouter.ResponseNameByMsgName(implementation.MessageName(msg)) @@ -372,7 +363,7 @@ func (k Keeper) sendModuleMessageUntyped(ctx context.Context, sender []byte, msg // is not trying to impersonate another account. func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error { // do sender assertions. - wantSenders, _, err := k.signerProvider.GetMsgV1Signers(msg) + wantSenders, _, err := k.codec.GetMsgV1Signers(msg) if err != nil { return fmt.Errorf("cannot get signers: %w", err) } diff --git a/x/accounts/keeper_test.go b/x/accounts/keeper_test.go index be02ccb27502..27642680ae8f 100644 --- a/x/accounts/keeper_test.go +++ b/x/accounts/keeper_test.go @@ -80,14 +80,18 @@ func TestKeeper_Execute(t *testing.T) { return nil }) - m.signerProvider = mockSigner(func(msg implementation.ProtoMsg) ([]byte, error) { - require.Equal(t, msg.(*bankv1beta1.MsgSend).FromAddress, string(accAddr)) - return accAddr, nil - }) + m.msgRouter = mockExec(func(ctx context.Context, msg, msgResp implementation.ProtoMsg) error { + concrete, ok := msg.(*bankv1beta1.MsgSend) + require.True(t, ok) + require.Equal(t, concrete.FromAddress, string(accAddr)) + _, ok = msgResp.(*bankv1beta1.MsgSendResponse) + require.True(t, ok) - resp, err := m.Execute(ctx, accAddr, sender, &types.Int64Value{Value: 1000}, nil) - require.NoError(t, err) - require.True(t, implementation.Equal(&types.Empty{}, resp)) + resp, err := m.Execute(ctx, accAddr, sender, &types.Int64Value{Value: 1000}, nil) + require.NoError(t, err) + require.True(t, implementation.Equal(&types.Empty{}, resp)) + return nil + }) }) } diff --git a/x/accounts/utils_test.go b/x/accounts/utils_test.go index 0fec9839686d..d9966acd7a0d 100644 --- a/x/accounts/utils_test.go +++ b/x/accounts/utils_test.go @@ -4,9 +4,7 @@ import ( "context" "testing" - gogoproto "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" "google.golang.org/protobuf/runtime/protoiface" "cosmossdk.io/collections/colltest" @@ -48,7 +46,7 @@ func newKeeper(t *testing.T, accounts ...implementation.AccountCreatorFunc) (Kee ss, ctx := colltest.MockStore() env := runtime.NewEnvironment(ss, log.NewNopLogger()) env.EventService = eventService{} - m, err := NewKeeper(nil, env, addressCodec{}, nil, nil, nil, interfaceRegistry{}, accounts...) + m, err := NewKeeper(nil, env, addressCodec{}, nil, nil, interfaceRegistry{}, accounts...) require.NoError(t, err) return m, ctx } @@ -63,18 +61,6 @@ func (m mockQuery) HybridHandlerByRequestName(_ string) []func(ctx context.Conte }} } -var _ SignerProvider = (*mockSigner)(nil) - -type mockSigner func(msg implementation.ProtoMsg) ([]byte, error) - -func (m mockSigner) GetMsgV1Signers(msg gogoproto.Message) ([][]byte, proto.Message, error) { - s, err := m(msg) - if err != nil { - return nil, nil, err - } - return [][]byte{s}, nil, nil -} - var _ MsgRouter = (*mockExec)(nil) type mockExec func(ctx context.Context, msg, msgResp implementation.ProtoMsg) error diff --git a/x/auth/ante/testutil/expected_keepers_mocks.go b/x/auth/ante/testutil/expected_keepers_mocks.go index 091ae6477359..ebe73dfecac7 100644 --- a/x/auth/ante/testutil/expected_keepers_mocks.go +++ b/x/auth/ante/testutil/expected_keepers_mocks.go @@ -9,11 +9,49 @@ import ( reflect "reflect" address "cosmossdk.io/core/address" + appmodule "cosmossdk.io/core/appmodule" types "cosmossdk.io/x/auth/types" types0 "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" ) +// MockHasEnvironment is a mock of HasEnvironment interface. +type MockHasEnvironment struct { + ctrl *gomock.Controller + recorder *MockHasEnvironmentMockRecorder +} + +// MockHasEnvironmentMockRecorder is the mock recorder for MockHasEnvironment. +type MockHasEnvironmentMockRecorder struct { + mock *MockHasEnvironment +} + +// NewMockHasEnvironment creates a new mock instance. +func NewMockHasEnvironment(ctrl *gomock.Controller) *MockHasEnvironment { + mock := &MockHasEnvironment{ctrl: ctrl} + mock.recorder = &MockHasEnvironmentMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockHasEnvironment) EXPECT() *MockHasEnvironmentMockRecorder { + return m.recorder +} + +// Environment mocks base method. +func (m *MockHasEnvironment) Environment() appmodule.Environment { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Environment") + ret0, _ := ret[0].(appmodule.Environment) + return ret0 +} + +// Environment indicates an expected call of Environment. +func (mr *MockHasEnvironmentMockRecorder) Environment() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Environment", reflect.TypeOf((*MockHasEnvironment)(nil).Environment)) +} + // MockAccountKeeper is a mock of AccountKeeper interface. type MockAccountKeeper struct { ctrl *gomock.Controller @@ -51,6 +89,20 @@ func (mr *MockAccountKeeperMockRecorder) AddressCodec() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddressCodec", reflect.TypeOf((*MockAccountKeeper)(nil).AddressCodec)) } +// Environment mocks base method. +func (m *MockAccountKeeper) Environment() appmodule.Environment { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Environment") + ret0, _ := ret[0].(appmodule.Environment) + return ret0 +} + +// Environment indicates an expected call of Environment. +func (mr *MockAccountKeeperMockRecorder) Environment() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Environment", reflect.TypeOf((*MockAccountKeeper)(nil).Environment)) +} + // GetAccount mocks base method. func (m *MockAccountKeeper) GetAccount(ctx context.Context, addr types0.AccAddress) types0.AccountI { m.ctrl.T.Helper() diff --git a/x/auth/ante/testutil_test.go b/x/auth/ante/testutil_test.go index 85ff7257dbcb..d002ecb77049 100644 --- a/x/auth/ante/testutil_test.go +++ b/x/auth/ante/testutil_test.go @@ -51,6 +51,7 @@ type AnteTestSuite struct { txBuilder client.TxBuilder accountKeeper keeper.AccountKeeper bankKeeper *authtestutil.MockBankKeeper + acctsModKeeper *authtestutil.MockAccountsModKeeper txBankKeeper *txtestutil.MockBankKeeper feeGrantKeeper *antetestutil.MockFeegrantKeeper encCfg moduletestutil.TestEncodingConfig @@ -60,10 +61,12 @@ type AnteTestSuite struct { func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite { t.Helper() suite := &AnteTestSuite{} + // gomock initializations ctrl := gomock.NewController(t) suite.bankKeeper = authtestutil.NewMockBankKeeper(ctrl) suite.txBankKeeper = txtestutil.NewMockBankKeeper(ctrl) suite.feeGrantKeeper = antetestutil.NewMockFeegrantKeeper(ctrl) + suite.acctsModKeeper = authtestutil.NewMockAccountsModKeeper(ctrl) key := storetypes.NewKVStoreKey(types.StoreKey) testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) @@ -80,8 +83,8 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite { } suite.accountKeeper = keeper.NewAccountKeeper( - runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()), suite.encCfg.Codec, types.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec("cosmos"), - sdk.Bech32MainPrefix, types.NewModuleAddress("gov").String(), nil, + runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger()), suite.encCfg.Codec, types.ProtoBaseAccount, suite.acctsModKeeper, maccPerms, authcodec.NewBech32Codec("cosmos"), + sdk.Bech32MainPrefix, types.NewModuleAddress("gov").String(), ) suite.accountKeeper.GetModuleAccount(suite.ctx, types.FeeCollectorName) err := suite.accountKeeper.Params.Set(suite.ctx, types.DefaultParams()) diff --git a/x/auth/depinject.go b/x/auth/depinject.go index d8f4ca497f84..834912a4de30 100644 --- a/x/auth/depinject.go +++ b/x/auth/depinject.go @@ -27,11 +27,11 @@ func init() { type ModuleInputs struct { depinject.In - AccountsModKeeper types.AccountsModKeeper - Config *modulev1.Module - Environment appmodule.Environment - Cdc codec.Codec + Config *modulev1.Module + Environment appmodule.Environment + Cdc codec.Codec + AccountsModKeeper types.AccountsModKeeper AddressCodec address.Codec RandomGenesisAccountsFn types.RandomGenesisAccountsFn `optional:"true"` @@ -70,8 +70,8 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { panic(err) } - k := keeper.NewAccountKeeper(in.Environment, in.Cdc, in.AccountI, maccPerms, in.AddressCodec, in.Config.Bech32Prefix, auth, in.AccountsModKeeper) - m := NewAppModule(in.Cdc, k, in.RandomGenesisAccountsFn) + k := keeper.NewAccountKeeper(in.Environment, in.Cdc, in.AccountI, in.AccountsModKeeper, maccPerms, in.AddressCodec, in.Config.Bech32Prefix, auth) + m := NewAppModule(in.Cdc, k, in.AccountsModKeeper, in.RandomGenesisAccountsFn) return ModuleOutputs{AccountKeeper: k, Module: m} } diff --git a/x/auth/keeper/deterministic_test.go b/x/auth/keeper/deterministic_test.go index f6f7657f50b7..c04b4da279b3 100644 --- a/x/auth/keeper/deterministic_test.go +++ b/x/auth/keeper/deterministic_test.go @@ -6,6 +6,7 @@ import ( "sync/atomic" "testing" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" "pgregory.net/rapid" @@ -16,6 +17,7 @@ import ( "cosmossdk.io/x/auth" authcodec "cosmossdk.io/x/auth/codec" "cosmossdk.io/x/auth/keeper" + authtestutil "cosmossdk.io/x/auth/testutil" "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -33,13 +35,14 @@ type DeterministicTestSuite struct { accountNumberLanes uint64 - key *storetypes.KVStoreKey - environment appmodule.Environment - ctx sdk.Context - queryClient types.QueryClient - accountKeeper keeper.AccountKeeper - encCfg moduletestutil.TestEncodingConfig - maccPerms map[string][]string + key *storetypes.KVStoreKey + environment appmodule.Environment + ctx sdk.Context + queryClient types.QueryClient + accountKeeper keeper.AccountKeeper + acctsModKeeper *authtestutil.MockAccountsModKeeper + encCfg moduletestutil.TestEncodingConfig + maccPerms map[string][]string } var ( @@ -62,6 +65,11 @@ func (suite *DeterministicTestSuite) SetupTest() { testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) suite.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{}) + // gomock initializations + ctrl := gomock.NewController(suite.T()) + acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl) + suite.acctsModKeeper = acctsModKeeper + maccPerms := map[string][]string{ "fee_collector": nil, "mint": {"minter"}, @@ -75,11 +83,11 @@ func (suite *DeterministicTestSuite) SetupTest() { env, suite.encCfg.Codec, types.ProtoBaseAccount, + suite.acctsModKeeper, maccPerms, authcodec.NewBech32Codec("cosmos"), "cosmos", types.NewModuleAddress("gov").String(), - nil, ) queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.encCfg.InterfaceRegistry) @@ -296,11 +304,11 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccounts() { suite.environment, suite.encCfg.Codec, types.ProtoBaseAccount, + suite.acctsModKeeper, maccPerms, authcodec.NewBech32Codec("cosmos"), "cosmos", types.NewModuleAddress("gov").String(), - nil, ) suite.setModuleAccounts(suite.ctx, ak, maccs) @@ -344,11 +352,11 @@ func (suite *DeterministicTestSuite) TestGRPCQueryModuleAccountByName() { suite.environment, suite.encCfg.Codec, types.ProtoBaseAccount, + suite.acctsModKeeper, maccPerms, authcodec.NewBech32Codec("cosmos"), "cosmos", types.NewModuleAddress("gov").String(), - nil, ) suite.setModuleAccounts(suite.ctx, ak, []string{mName}) diff --git a/x/auth/keeper/keeper.go b/x/auth/keeper/keeper.go index 1991bae32bf4..1474acbe9eb1 100644 --- a/x/auth/keeper/keeper.go +++ b/x/auth/keeper/keeper.go @@ -14,6 +14,7 @@ import ( "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -115,8 +116,8 @@ var _ AccountKeeperI = &AccountKeeper{} // and don't have to fit into any predefined structure. This auth module does not use account permissions internally, though other modules // may use auth.Keeper to access the accounts permissions map. func NewAccountKeeper( - env appmodule.Environment, cdc codec.BinaryCodec, proto func() sdk.AccountI, - maccPerms map[string][]string, ac address.Codec, bech32Prefix, authority string, accountsModKeeper types.AccountsModKeeper, + env appmodule.Environment, cdc codec.BinaryCodec, proto func() sdk.AccountI, accountsModKeeper types.AccountsModKeeper, + maccPerms map[string][]string, ac address.Codec, bech32Prefix, authority string, ) AccountKeeper { permAddrs := make(map[string]types.PermissionsForAddress) for name, perms := range maccPerms { @@ -131,12 +132,12 @@ func NewAccountKeeper( environment: env, proto: proto, cdc: cdc, + AccountsModKeeper: accountsModKeeper, permAddrs: permAddrs, authority: authority, Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), AccountNumber: collections.NewSequence(sb, types.GlobalAccountNumberKey, "account_number"), Accounts: collections.NewIndexedMap(sb, types.AddressStoreKeyPrefix, "accounts", sdk.AccAddressKey, codec.CollInterfaceValue[sdk.AccountI](cdc), NewAccountIndexes(sb)), - AccountsModKeeper: accountsModKeeper, } schema, err := sb.Build() if err != nil { @@ -281,6 +282,43 @@ func (ak AccountKeeper) GetParams(ctx context.Context) (params types.Params) { return params } +func (ak AccountKeeper) NonAtomicMsgsExec(ctx context.Context, signer sdk.AccAddress, msgs []sdk.Msg) ([]*types.NonAtomicExecResult, error) { + msgResponses := make([]*types.NonAtomicExecResult, 0, len(msgs)) + + for _, msg := range msgs { + if m, ok := msg.(sdk.HasValidateBasic); ok { + if err := m.ValidateBasic(); err != nil { + value := &types.NonAtomicExecResult{Error: err.Error()} + msgResponses = append(msgResponses, value) + continue + } + } + + if err := ak.environment.BranchService.Execute(ctx, func(ctx context.Context) error { + result, err := ak.AccountsModKeeper.SendModuleMessageUntyped(ctx, signer, msg) + if err != nil { + // If an error occurs during message execution, append error response + response := &types.NonAtomicExecResult{Resp: nil, Error: err.Error()} + msgResponses = append(msgResponses, response) + } else { + resp, err := codectypes.NewAnyWithValue(result) + if err != nil { + response := &types.NonAtomicExecResult{Resp: nil, Error: err.Error()} + msgResponses = append(msgResponses, response) + } + response := &types.NonAtomicExecResult{Resp: resp, Error: ""} + msgResponses = append(msgResponses, response) + } + + return nil + }); err != nil { + return nil, err + } + } + + return msgResponses, nil +} + // Environment returns the module's environment. func (ak AccountKeeper) Environment() appmodule.Environment { return ak.environment diff --git a/x/auth/keeper/keeper_test.go b/x/auth/keeper/keeper_test.go index 78267c01d3ca..579556b8739c 100644 --- a/x/auth/keeper/keeper_test.go +++ b/x/auth/keeper/keeper_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -12,6 +13,7 @@ import ( "cosmossdk.io/x/auth" authcodec "cosmossdk.io/x/auth/codec" "cosmossdk.io/x/auth/keeper" + authtestutil "cosmossdk.io/x/auth/testutil" "cosmossdk.io/x/auth/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -40,10 +42,11 @@ type KeeperTestSuite struct { ctx sdk.Context - queryClient types.QueryClient - accountKeeper keeper.AccountKeeper - msgServer types.MsgServer - encCfg moduletestutil.TestEncodingConfig + queryClient types.QueryClient + accountKeeper keeper.AccountKeeper + acctsModKeeper *authtestutil.MockAccountsModKeeper + msgServer types.MsgServer + encCfg moduletestutil.TestEncodingConfig } func (suite *KeeperTestSuite) SetupTest() { @@ -55,6 +58,11 @@ func (suite *KeeperTestSuite) SetupTest() { testCtx := testutil.DefaultContextWithDB(suite.T(), key, storetypes.NewTransientStoreKey("transient_test")) suite.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{}) + // gomock initializations + ctrl := gomock.NewController(suite.T()) + acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl) + suite.acctsModKeeper = acctsModKeeper + maccPerms := map[string][]string{ "fee_collector": nil, "mint": {"minter"}, @@ -68,11 +76,11 @@ func (suite *KeeperTestSuite) SetupTest() { env, suite.encCfg.Codec, types.ProtoBaseAccount, + acctsModKeeper, maccPerms, authcodec.NewBech32Codec("cosmos"), "cosmos", types.NewModuleAddress("gov").String(), - nil, ) suite.msgServer = keeper.NewMsgServerImpl(suite.accountKeeper) queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.encCfg.InterfaceRegistry) diff --git a/x/auth/keeper/msg_server.go b/x/auth/keeper/msg_server.go index c66785af36c4..50e3a65b5c39 100644 --- a/x/auth/keeper/msg_server.go +++ b/x/auth/keeper/msg_server.go @@ -2,9 +2,12 @@ package keeper import ( "context" + "errors" "fmt" "cosmossdk.io/x/auth/types" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var _ types.MsgServer = msgServer{} @@ -20,6 +23,35 @@ func NewMsgServerImpl(ak AccountKeeper) types.MsgServer { } } +func (ms msgServer) NonAtomicExec(goCtx context.Context, msg *types.MsgNonAtomicExec) (*types.MsgNonAtomicExecResponse, error) { + if msg.Signer == "" { + return nil, errors.New("empty signer address string is not allowed") + } + + signer, err := ms.ak.AddressCodec().StringToBytes(msg.Signer) + if err != nil { + return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid signer address: %s", err) + } + + if len(msg.Msgs) == 0 { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("messages cannot be empty") + } + + msgs, err := msg.GetMessages() + if err != nil { + return nil, err + } + + results, err := ms.ak.NonAtomicMsgsExec(goCtx, signer, msgs) + if err != nil { + return nil, err + } + + return &types.MsgNonAtomicExecResponse{ + Results: results, + }, nil +} + func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if ms.ak.authority != msg.Authority { return nil, fmt.Errorf( diff --git a/x/auth/module.go b/x/auth/module.go index 9adf511a096e..8459fd4aa610 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -40,6 +40,7 @@ var ( type AppModule struct { accountKeeper keeper.AccountKeeper randGenAccountsFn types.RandomGenesisAccountsFn + accountsModKeeper types.AccountsModKeeper cdc codec.Codec } @@ -47,10 +48,11 @@ type AppModule struct { func (am AppModule) IsAppModule() {} // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, accountKeeper keeper.AccountKeeper, randGenAccountsFn types.RandomGenesisAccountsFn) AppModule { +func NewAppModule(cdc codec.Codec, accountKeeper keeper.AccountKeeper, ak types.AccountsModKeeper, randGenAccountsFn types.RandomGenesisAccountsFn) AppModule { return AppModule{ accountKeeper: accountKeeper, randGenAccountsFn: randGenAccountsFn, + accountsModKeeper: ak, cdc: cdc, } } diff --git a/x/auth/proto/cosmos/auth/v1beta1/tx.proto b/x/auth/proto/cosmos/auth/v1beta1/tx.proto index 4089d047be56..172525f1d251 100644 --- a/x/auth/proto/cosmos/auth/v1beta1/tx.proto +++ b/x/auth/proto/cosmos/auth/v1beta1/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package cosmos.auth.v1beta1; import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; @@ -18,6 +19,9 @@ service Msg { // // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // NonAtomicExec allows users to submit multiple messages for non-atomic execution. + rpc NonAtomicExec(MsgNonAtomicExec) returns (MsgNonAtomicExecResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -41,3 +45,23 @@ message MsgUpdateParams { // // Since: cosmos-sdk 0.47 message MsgUpdateParamsResponse {} + +// MsgNonAtomicExec defines the Msg/NonAtomicExec request type. +message MsgNonAtomicExec { + option (cosmos.msg.v1.signer) = "signer"; + + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "cosmos.base.v1beta1.Msg"]; +} + +// NonAtomicExecResult defines the response structure for executing a +// MsgNonAtomicExec. +message NonAtomicExecResult { + string error = 1; + google.protobuf.Any resp = 2; +} + +// MsgNonAtomicExecResponse defines the response of MsgNonAtomicExec. +message MsgNonAtomicExecResponse { + repeated NonAtomicExecResult results = 1; +} diff --git a/x/auth/testutil/app_config.go b/x/auth/testutil/app_config.go index f72850c4bf1a..d7ddcd09c3ff 100644 --- a/x/auth/testutil/app_config.go +++ b/x/auth/testutil/app_config.go @@ -3,7 +3,7 @@ package testutil import ( _ "cosmossdk.io/x/accounts" // import as blank for app wiring _ "cosmossdk.io/x/auth" // import as blank for app wiring - _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring + _ "cosmossdk.io/x/auth/tx/config" // import as blank for app wiring`` _ "cosmossdk.io/x/auth/vesting" // import as blank for app wiring _ "cosmossdk.io/x/bank" // import as blank for app wiring _ "cosmossdk.io/x/staking" // import as blank for app wiring diff --git a/x/auth/testutil/expected_keepers_mocks.go b/x/auth/testutil/expected_keepers_mocks.go index 2604271001d9..8d4b1f2891be 100644 --- a/x/auth/testutil/expected_keepers_mocks.go +++ b/x/auth/testutil/expected_keepers_mocks.go @@ -10,6 +10,7 @@ import ( types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" + protoiface "google.golang.org/protobuf/runtime/protoiface" ) // MockBankKeeper is a mock of BankKeeper interface. @@ -82,7 +83,6 @@ func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAd return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } - // MockAccountsModKeeper is a mock of AccountsModKeeper interface. type MockAccountsModKeeper struct { ctrl *gomock.Controller @@ -107,17 +107,30 @@ func (m *MockAccountsModKeeper) EXPECT() *MockAccountsModKeeperMockRecorder { } // IsAccountsModuleAccount mocks base method. -func (m *MockAccountsModKeeper) IsAccountsModuleAccount(ctx context.Context, addr []byte) bool { +func (m *MockAccountsModKeeper) IsAccountsModuleAccount(ctx context.Context, accountAddr []byte) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsAccountsModuleAccount", ctx, addr) + ret := m.ctrl.Call(m, "IsAccountsModuleAccount", ctx, accountAddr) ret0, _ := ret[0].(bool) return ret0 } // IsAccountsModuleAccount indicates an expected call of IsAccountsModuleAccount. -func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, addr interface{}) *gomock.Call { +func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, accountAddr interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).IsAccountsModuleAccount), ctx, addr) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).IsAccountsModuleAccount), ctx, accountAddr) } +// SendModuleMessageUntyped mocks base method. +func (m *MockAccountsModKeeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendModuleMessageUntyped", ctx, sender, msg) + ret0, _ := ret[0].(protoiface.MessageV1) + ret1, _ := ret[1].(error) + return ret0, ret1 +} +// SendModuleMessageUntyped indicates an expected call of SendModuleMessageUntyped. +func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessageUntyped(ctx, sender, msg interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessageUntyped", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessageUntyped), ctx, sender, msg) +} diff --git a/x/auth/types/codec.go b/x/auth/types/codec.go index 685d9eb85dc5..08accef30af9 100644 --- a/x/auth/types/codec.go +++ b/x/auth/types/codec.go @@ -58,5 +58,6 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) { registrar.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateParams{}, + &MsgNonAtomicExec{}, ) } diff --git a/x/auth/types/expected_keepers.go b/x/auth/types/expected_keepers.go index f7821d91251b..10f3cc4f3331 100644 --- a/x/auth/types/expected_keepers.go +++ b/x/auth/types/expected_keepers.go @@ -3,6 +3,8 @@ package types import ( "context" + "google.golang.org/protobuf/runtime/protoiface" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -15,5 +17,6 @@ type BankKeeper interface { // AccountsModKeeper defines the contract for x/accounts APIs type AccountsModKeeper interface { + SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) IsAccountsModuleAccount(ctx context.Context, accountAddr []byte) bool } diff --git a/x/auth/types/msgs.go b/x/auth/types/msgs.go new file mode 100644 index 000000000000..6900aab97713 --- /dev/null +++ b/x/auth/types/msgs.go @@ -0,0 +1,20 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// GetMessages returns the cache values from the MsgNonAtomicExec.Msgs if present. +func (msg MsgNonAtomicExec) GetMessages() ([]sdk.Msg, error) { + msgs := make([]sdk.Msg, len(msg.Msgs)) + for i, msgAny := range msg.Msgs { + msg, ok := msgAny.GetCachedValue().(sdk.Msg) + if !ok { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("messages contains %T which is not a sdk.Msg", msgAny) + } + msgs[i] = msg + } + + return msgs, nil +} diff --git a/x/auth/types/tx.pb.go b/x/auth/types/tx.pb.go index 1bda98a785f8..960a79d6585b 100644 --- a/x/auth/types/tx.pb.go +++ b/x/auth/types/tx.pb.go @@ -7,6 +7,7 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -130,36 +131,203 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgNonAtomicExec defines the Msg/NonAtomicExec request type. +type MsgNonAtomicExec struct { + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Msgs []*types.Any `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` +} + +func (m *MsgNonAtomicExec) Reset() { *m = MsgNonAtomicExec{} } +func (m *MsgNonAtomicExec) String() string { return proto.CompactTextString(m) } +func (*MsgNonAtomicExec) ProtoMessage() {} +func (*MsgNonAtomicExec) Descriptor() ([]byte, []int) { + return fileDescriptor_c2d62bd9c4c212e5, []int{2} +} +func (m *MsgNonAtomicExec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgNonAtomicExec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgNonAtomicExec.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 *MsgNonAtomicExec) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgNonAtomicExec.Merge(m, src) +} +func (m *MsgNonAtomicExec) XXX_Size() int { + return m.Size() +} +func (m *MsgNonAtomicExec) XXX_DiscardUnknown() { + xxx_messageInfo_MsgNonAtomicExec.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgNonAtomicExec proto.InternalMessageInfo + +func (m *MsgNonAtomicExec) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgNonAtomicExec) GetMsgs() []*types.Any { + if m != nil { + return m.Msgs + } + return nil +} + +// NonAtomicExecResult defines the response structure for executing a +// MsgNonAtomicExec. +type NonAtomicExecResult struct { + Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + Resp *types.Any `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"` +} + +func (m *NonAtomicExecResult) Reset() { *m = NonAtomicExecResult{} } +func (m *NonAtomicExecResult) String() string { return proto.CompactTextString(m) } +func (*NonAtomicExecResult) ProtoMessage() {} +func (*NonAtomicExecResult) Descriptor() ([]byte, []int) { + return fileDescriptor_c2d62bd9c4c212e5, []int{3} +} +func (m *NonAtomicExecResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NonAtomicExecResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NonAtomicExecResult.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 *NonAtomicExecResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonAtomicExecResult.Merge(m, src) +} +func (m *NonAtomicExecResult) XXX_Size() int { + return m.Size() +} +func (m *NonAtomicExecResult) XXX_DiscardUnknown() { + xxx_messageInfo_NonAtomicExecResult.DiscardUnknown(m) +} + +var xxx_messageInfo_NonAtomicExecResult proto.InternalMessageInfo + +func (m *NonAtomicExecResult) GetError() string { + if m != nil { + return m.Error + } + return "" +} + +func (m *NonAtomicExecResult) GetResp() *types.Any { + if m != nil { + return m.Resp + } + return nil +} + +// MsgNonAtomicExecResponse defines the response of MsgNonAtomicExec. +type MsgNonAtomicExecResponse struct { + Results []*NonAtomicExecResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (m *MsgNonAtomicExecResponse) Reset() { *m = MsgNonAtomicExecResponse{} } +func (m *MsgNonAtomicExecResponse) String() string { return proto.CompactTextString(m) } +func (*MsgNonAtomicExecResponse) ProtoMessage() {} +func (*MsgNonAtomicExecResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c2d62bd9c4c212e5, []int{4} +} +func (m *MsgNonAtomicExecResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgNonAtomicExecResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgNonAtomicExecResponse.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 *MsgNonAtomicExecResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgNonAtomicExecResponse.Merge(m, src) +} +func (m *MsgNonAtomicExecResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgNonAtomicExecResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgNonAtomicExecResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgNonAtomicExecResponse proto.InternalMessageInfo + +func (m *MsgNonAtomicExecResponse) GetResults() []*NonAtomicExecResult { + if m != nil { + return m.Results + } + return nil +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.auth.v1beta1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.auth.v1beta1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgNonAtomicExec)(nil), "cosmos.auth.v1beta1.MsgNonAtomicExec") + proto.RegisterType((*NonAtomicExecResult)(nil), "cosmos.auth.v1beta1.NonAtomicExecResult") + proto.RegisterType((*MsgNonAtomicExecResponse)(nil), "cosmos.auth.v1beta1.MsgNonAtomicExecResponse") } func init() { proto.RegisterFile("cosmos/auth/v1beta1/tx.proto", fileDescriptor_c2d62bd9c4c212e5) } var fileDescriptor_c2d62bd9c4c212e5 = []byte{ - // 336 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2c, 0x2d, 0xc9, 0xd0, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, - 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc8, 0xea, 0x81, 0x64, 0xf5, - 0xa0, 0xb2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x79, 0x7d, 0x10, 0x0b, 0xa2, 0x54, 0x4a, - 0x12, 0xa2, 0x34, 0x1e, 0x22, 0x01, 0xd5, 0x07, 0x91, 0x12, 0x87, 0xda, 0x91, 0x5b, 0x9c, 0xae, - 0x5f, 0x66, 0x08, 0xa2, 0xa0, 0x12, 0x82, 0x89, 0xb9, 0x99, 0x79, 0xf9, 0xfa, 0x60, 0x12, 0x2a, - 0x24, 0x87, 0xcd, 0x3d, 0x60, 0xeb, 0xc1, 0xf2, 0x4a, 0xfb, 0x19, 0xb9, 0xf8, 0x7d, 0x8b, 0xd3, - 0x43, 0x0b, 0x52, 0x12, 0x4b, 0x52, 0x03, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x85, 0xcc, 0xb8, 0x38, - 0x41, 0x2a, 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x9d, 0x24, 0x2e, - 0x6d, 0xd1, 0x15, 0x81, 0x3a, 0xc2, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x38, 0xb8, 0xa4, 0x28, - 0x33, 0x2f, 0x3d, 0x08, 0xa1, 0x54, 0xc8, 0x8e, 0x8b, 0xad, 0x00, 0x6c, 0x82, 0x04, 0x93, 0x02, - 0xa3, 0x06, 0xb7, 0x91, 0xb4, 0x1e, 0x16, 0xef, 0xea, 0x41, 0x2c, 0x71, 0xe2, 0x3c, 0x71, 0x4f, - 0x9e, 0x61, 0xc5, 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x50, 0x5d, 0x56, 0x26, 0x4d, 0xcf, 0x37, 0x68, - 0x21, 0xcc, 0xeb, 0x7a, 0xbe, 0x41, 0x4b, 0x11, 0x62, 0x82, 0x6e, 0x71, 0x4a, 0xb6, 0x7e, 0x05, - 0xc4, 0x13, 0x68, 0xae, 0x55, 0x92, 0xe4, 0x12, 0x47, 0x13, 0x0a, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, - 0x2b, 0x4e, 0x35, 0x2a, 0xe0, 0x62, 0xf6, 0x2d, 0x4e, 0x17, 0x4a, 0xe2, 0xe2, 0x41, 0xf1, 0x9f, - 0x0a, 0x56, 0x77, 0xa1, 0x19, 0x22, 0xa5, 0x43, 0x8c, 0x2a, 0x98, 0x55, 0x52, 0xac, 0x0d, 0x20, - 0xaf, 0x38, 0x19, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, - 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x14, 0x34, 0x3e, - 0x8b, 0x53, 0xb2, 0xf5, 0x32, 0xf3, 0x61, 0x7e, 0x29, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, - 0x47, 0x85, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x09, 0xbc, 0x34, 0x3c, 0x02, 0x00, 0x00, + // 520 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x31, 0x6f, 0xd3, 0x40, + 0x18, 0xcd, 0xd1, 0x36, 0x28, 0x17, 0x10, 0xe0, 0x46, 0x6a, 0x9a, 0x22, 0x53, 0x22, 0x90, 0xa2, + 0x88, 0x9c, 0x49, 0x8a, 0x18, 0x3a, 0x20, 0xc5, 0x52, 0xc7, 0x20, 0x64, 0xd4, 0x85, 0x01, 0x64, + 0xc7, 0xc7, 0x61, 0xb5, 0xf6, 0x59, 0xf7, 0x5d, 0xaa, 0x64, 0x43, 0x8c, 0x4c, 0x8c, 0xfc, 0x04, + 0xc6, 0x0c, 0xdd, 0x59, 0x2b, 0xa6, 0x8a, 0x05, 0x26, 0x84, 0x92, 0x21, 0x7f, 0x03, 0xf9, 0xee, + 0xdc, 0x2a, 0x91, 0x51, 0xbb, 0xd8, 0xbe, 0x7b, 0xef, 0xfb, 0xbe, 0xf7, 0xee, 0x9d, 0xf1, 0xfd, + 0x21, 0x87, 0x98, 0x83, 0xe3, 0x8f, 0xe4, 0x07, 0xe7, 0xa4, 0x1b, 0x50, 0xe9, 0x77, 0x1d, 0x39, + 0x26, 0xa9, 0xe0, 0x92, 0x5b, 0x9b, 0x1a, 0x25, 0x19, 0x4a, 0x0c, 0xda, 0xa8, 0x31, 0xce, 0xb8, + 0xc2, 0x9d, 0xec, 0x4b, 0x53, 0x1b, 0xdb, 0x8c, 0x73, 0x76, 0x4c, 0x1d, 0xb5, 0x0a, 0x46, 0xef, + 0x1d, 0x3f, 0x99, 0xe4, 0x90, 0xee, 0xf2, 0x4e, 0xd7, 0x98, 0x96, 0x1a, 0xda, 0x32, 0xe3, 0x63, + 0x60, 0xce, 0x49, 0x37, 0x7b, 0x19, 0xe0, 0x9e, 0x1f, 0x47, 0x09, 0x77, 0xd4, 0xd3, 0x6c, 0xd9, + 0x45, 0x52, 0x95, 0x32, 0x85, 0x37, 0xbf, 0x23, 0x7c, 0x67, 0x00, 0xec, 0x30, 0x0d, 0x7d, 0x49, + 0x5f, 0xf9, 0xc2, 0x8f, 0xc1, 0x7a, 0x8e, 0x2b, 0x19, 0x83, 0x8b, 0x48, 0x4e, 0xea, 0x68, 0x17, + 0xb5, 0x2a, 0x6e, 0xfd, 0xe7, 0x69, 0xa7, 0x66, 0x44, 0xf4, 0xc3, 0x50, 0x50, 0x80, 0xd7, 0x52, + 0x44, 0x09, 0xf3, 0x2e, 0xa9, 0xd6, 0x0b, 0x5c, 0x4e, 0x55, 0x87, 0xfa, 0x8d, 0x5d, 0xd4, 0xaa, + 0xf6, 0x76, 0x48, 0xc1, 0x49, 0x10, 0x3d, 0xc4, 0xad, 0x9c, 0xfd, 0x79, 0x50, 0xfa, 0xb6, 0x98, + 0xb6, 0x91, 0x67, 0xaa, 0xf6, 0x9f, 0x7d, 0x5a, 0x4c, 0xdb, 0x97, 0xfd, 0x3e, 0x2f, 0xa6, 0xed, + 0x87, 0xba, 0x43, 0x07, 0xc2, 0x23, 0x67, 0xac, 0x4d, 0xac, 0xa8, 0x6d, 0x6e, 0xe3, 0xad, 0x95, + 0x2d, 0x8f, 0x42, 0xca, 0x13, 0xa0, 0xcd, 0xaf, 0x08, 0xdf, 0x1d, 0x00, 0x7b, 0xc9, 0x93, 0xbe, + 0xe4, 0x71, 0x34, 0x3c, 0x18, 0xd3, 0xa1, 0xf5, 0x14, 0x97, 0x21, 0x62, 0x09, 0x15, 0x57, 0x5a, + 0x33, 0x3c, 0xeb, 0x00, 0xaf, 0xc7, 0xc0, 0x32, 0x57, 0x6b, 0xad, 0x6a, 0xaf, 0x46, 0x74, 0x68, + 0x24, 0x0f, 0x8d, 0xf4, 0x93, 0x89, 0xbb, 0xf3, 0xe3, 0xb4, 0x63, 0x72, 0x21, 0x81, 0x0f, 0xf4, + 0xc2, 0xee, 0x00, 0x98, 0xa7, 0xca, 0xf7, 0xab, 0x99, 0x3d, 0xd3, 0xb3, 0x79, 0x88, 0x37, 0x97, + 0x64, 0x79, 0x14, 0x46, 0xc7, 0xd2, 0xaa, 0xe1, 0x0d, 0x2a, 0x04, 0x37, 0xda, 0x3c, 0xbd, 0xb0, + 0x5a, 0x78, 0x5d, 0x50, 0x48, 0xcd, 0xb1, 0x16, 0x0a, 0xf0, 0x14, 0xa3, 0xf9, 0x16, 0xd7, 0x57, + 0x0d, 0xe7, 0xa7, 0x61, 0xb9, 0xf8, 0xa6, 0x50, 0x53, 0xa0, 0x8e, 0x94, 0x93, 0x56, 0x61, 0x3e, + 0x05, 0xb2, 0xbc, 0xbc, 0xb0, 0xf7, 0x0b, 0xe1, 0xb5, 0x01, 0x30, 0x2b, 0xc0, 0xb7, 0x96, 0xae, + 0xcc, 0xa3, 0xc2, 0x56, 0x2b, 0xb9, 0x34, 0x9e, 0x5c, 0x87, 0x75, 0xa1, 0x97, 0xe2, 0xdb, 0xcb, + 0xc9, 0x3d, 0xfe, 0x5f, 0xf9, 0x12, 0xad, 0xd1, 0xb9, 0x16, 0x2d, 0x1f, 0xd3, 0xd8, 0xf8, 0x98, + 0x5d, 0x42, 0x77, 0xef, 0x6c, 0x66, 0xa3, 0xf3, 0x99, 0x8d, 0xfe, 0xce, 0x6c, 0xf4, 0x65, 0x6e, + 0x97, 0xce, 0xe7, 0x76, 0xe9, 0xf7, 0xdc, 0x2e, 0xbd, 0x31, 0x7f, 0x22, 0x84, 0x47, 0x24, 0xe2, + 0xf9, 0x2d, 0x94, 0x93, 0x94, 0x42, 0x50, 0x56, 0x11, 0xec, 0xfd, 0x0b, 0x00, 0x00, 0xff, 0xff, + 0xa1, 0x5a, 0xf2, 0x18, 0x11, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -179,6 +347,8 @@ type MsgClient interface { // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // NonAtomicExec allows users to submit multiple messages for non-atomic execution. + NonAtomicExec(ctx context.Context, in *MsgNonAtomicExec, opts ...grpc.CallOption) (*MsgNonAtomicExecResponse, error) } type msgClient struct { @@ -198,6 +368,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) NonAtomicExec(ctx context.Context, in *MsgNonAtomicExec, opts ...grpc.CallOption) (*MsgNonAtomicExecResponse, error) { + out := new(MsgNonAtomicExecResponse) + err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Msg/NonAtomicExec", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a (governance) operation for updating the x/auth module @@ -205,6 +384,8 @@ type MsgServer interface { // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // NonAtomicExec allows users to submit multiple messages for non-atomic execution. + NonAtomicExec(context.Context, *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -214,6 +395,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) NonAtomicExec(ctx context.Context, req *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NonAtomicExec not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -237,6 +421,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_NonAtomicExec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgNonAtomicExec) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).NonAtomicExec(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.auth.v1beta1.Msg/NonAtomicExec", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).NonAtomicExec(ctx, req.(*MsgNonAtomicExec)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.auth.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -245,6 +447,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "NonAtomicExec", + Handler: _Msg_NonAtomicExec_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/auth/v1beta1/tx.proto", @@ -313,6 +519,129 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgNonAtomicExec) 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 *MsgNonAtomicExec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgNonAtomicExec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Msgs) > 0 { + for iNdEx := len(m.Msgs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Msgs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NonAtomicExecResult) 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 *NonAtomicExecResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NonAtomicExecResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Resp != nil { + { + size, err := m.Resp.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintTx(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgNonAtomicExecResponse) 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 *MsgNonAtomicExecResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgNonAtomicExecResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Results) > 0 { + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -348,6 +677,57 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgNonAtomicExec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Msgs) > 0 { + for _, e := range m.Msgs { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *NonAtomicExecResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Error) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Resp != nil { + l = m.Resp.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgNonAtomicExecResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -519,6 +899,324 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgNonAtomicExec) 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: MsgNonAtomicExec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgNonAtomicExec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msgs", 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.Msgs = append(m.Msgs, &types.Any{}) + if err := m.Msgs[len(m.Msgs)-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 *NonAtomicExecResult) 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: NonAtomicExecResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NonAtomicExecResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", 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.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Resp == nil { + m.Resp = &types.Any{} + } + if err := m.Resp.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 *MsgNonAtomicExecResponse) 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: MsgNonAtomicExecResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgNonAtomicExecResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) + } + 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.Results = append(m.Results, &NonAtomicExecResult{}) + if err := m.Results[len(m.Results)-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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/auth/vesting/testutil/expected_keepers_mocks.go b/x/auth/vesting/testutil/expected_keepers_mocks.go index 1df8f8ebbf2b..e7ff4c4d66ec 100644 --- a/x/auth/vesting/testutil/expected_keepers_mocks.go +++ b/x/auth/vesting/testutil/expected_keepers_mocks.go @@ -10,6 +10,7 @@ import ( types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" + protoiface "google.golang.org/protobuf/runtime/protoiface" ) // MockBankKeeper is a mock of BankKeeper interface. @@ -81,3 +82,55 @@ func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt inter mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoins", reflect.TypeOf((*MockBankKeeper)(nil).SendCoins), ctx, fromAddr, toAddr, amt) } + +// MockAccountsModKeeper is a mock of AccountsModKeeper interface. +type MockAccountsModKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountsModKeeperMockRecorder +} + +// MockAccountsModKeeperMockRecorder is the mock recorder for MockAccountsModKeeper. +type MockAccountsModKeeperMockRecorder struct { + mock *MockAccountsModKeeper +} + +// NewMockAccountsModKeeper creates a new mock instance. +func NewMockAccountsModKeeper(ctrl *gomock.Controller) *MockAccountsModKeeper { + mock := &MockAccountsModKeeper{ctrl: ctrl} + mock.recorder = &MockAccountsModKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountsModKeeper) EXPECT() *MockAccountsModKeeperMockRecorder { + return m.recorder +} + +// IsAccountsModuleAccount mocks base method. +func (m *MockAccountsModKeeper) IsAccountsModuleAccount(ctx context.Context, accountAddr []byte) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsAccountsModuleAccount", ctx, accountAddr) + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsAccountsModuleAccount indicates an expected call of IsAccountsModuleAccount. +func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, accountAddr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).IsAccountsModuleAccount), ctx, accountAddr) +} + +// SendModuleMessageUntyped mocks base method. +func (m *MockAccountsModKeeper) SendModuleMessageUntyped(ctx context.Context, sender []byte, msg protoiface.MessageV1) (protoiface.MessageV1, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendModuleMessageUntyped", ctx, sender, msg) + ret0, _ := ret[0].(protoiface.MessageV1) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SendModuleMessageUntyped indicates an expected call of SendModuleMessageUntyped. +func (mr *MockAccountsModKeeperMockRecorder) SendModuleMessageUntyped(ctx, sender, msg interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendModuleMessageUntyped", reflect.TypeOf((*MockAccountsModKeeper)(nil).SendModuleMessageUntyped), ctx, sender, msg) +} diff --git a/x/auth/vesting/types/expected_keepers.go b/x/auth/vesting/types/expected_keepers.go index 59172579de02..d52848119f5e 100644 --- a/x/auth/vesting/types/expected_keepers.go +++ b/x/auth/vesting/types/expected_keepers.go @@ -3,6 +3,8 @@ package types import ( context "context" + "cosmossdk.io/x/auth/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -13,3 +15,7 @@ type BankKeeper interface { SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error BlockedAddr(addr sdk.AccAddress) bool } + +type AccountsModKeeper interface { + types.AccountsModKeeper +} diff --git a/x/auth/vesting/types/vesting_account_test.go b/x/auth/vesting/types/vesting_account_test.go index 350bba50bec2..18459338da7c 100644 --- a/x/auth/vesting/types/vesting_account_test.go +++ b/x/auth/vesting/types/vesting_account_test.go @@ -4,6 +4,7 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -14,6 +15,7 @@ import ( "cosmossdk.io/x/auth/keeper" authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/auth/vesting" + vestingtestutil "cosmossdk.io/x/auth/vesting/testutil" "cosmossdk.io/x/auth/vesting/types" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" @@ -46,6 +48,10 @@ func (s *VestingAccountTestSuite) SetupTest() { testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) s.ctx = testCtx.Ctx.WithHeaderInfo(header.Info{}) + // gomock initializations + ctrl := gomock.NewController(&testing.T{}) + acctsModKeeper := vestingtestutil.NewMockAccountsModKeeper(ctrl) + maccPerms := map[string][]string{ "fee_collector": nil, "mint": {"minter"}, @@ -59,10 +65,11 @@ func (s *VestingAccountTestSuite) SetupTest() { env, encCfg.Codec, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, authcodec.NewBech32Codec("cosmos"), "cosmos", - authtypes.NewModuleAddress("gov").String(), nil, + authtypes.NewModuleAddress("gov").String(), ) } diff --git a/x/bank/testutil/expected_keepers_mocks.go b/x/bank/testutil/expected_keepers_mocks.go index 0b3ded8ec673..058c4e2d7e36 100644 --- a/x/bank/testutil/expected_keepers_mocks.go +++ b/x/bank/testutil/expected_keepers_mocks.go @@ -216,17 +216,3 @@ func (mr *MockAccountKeeperMockRecorder) ValidatePermissions(macc interface{}) * mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatePermissions", reflect.TypeOf((*MockAccountKeeper)(nil).ValidatePermissions), macc) } - -// IsAccountsModuleAccount mocks base method. -func (m *MockAccountKeeper) IsAccountsModuleAccount(ctx context.Context, addr []byte) bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsAccountsModuleAccount", ctx, addr) - ret0, _ := ret[0].(bool) - return ret0 -} - -// IsAccountsModuleAccount indicates an expected call of IsAccountsModuleAccount. -func (mr *MockAccountKeeperMockRecorder) IsAccountsModuleAccount(ctx, addr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountKeeper)(nil).IsAccountsModuleAccount), ctx, addr) -} diff --git a/x/distribution/migrations/v4/migrate_funds_test.go b/x/distribution/migrations/v4/migrate_funds_test.go index 43516921b4cd..470fc3cd07cc 100644 --- a/x/distribution/migrations/v4/migrate_funds_test.go +++ b/x/distribution/migrations/v4/migrate_funds_test.go @@ -10,6 +10,7 @@ import ( storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/auth" authkeeper "cosmossdk.io/x/auth/keeper" + authtestutil "cosmossdk.io/x/auth/testutil" authtypes "cosmossdk.io/x/auth/types" "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" @@ -46,16 +47,22 @@ func TestFundsMigration(t *testing.T) { authority, err := addressCodec.BytesToString(authtypes.NewModuleAddress("gov")) require.NoError(t, err) + // gomock initializations + ctrl := gomock.NewController(t) + acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl) + stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) + poolKeeper := distrtestutil.NewMockPoolKeeper(ctrl) + // create account keeper accountKeeper := authkeeper.NewAccountKeeper( runtime.NewEnvironment(runtime.NewKVStoreService(keys[authtypes.StoreKey]), log.NewNopLogger()), encCfg.Codec, authtypes.ProtoBaseAccount, + acctsModKeeper, maccPerms, addressCodec, sdk.Bech32MainPrefix, authority, - nil, ) // create bank keeper @@ -67,11 +74,6 @@ func TestFundsMigration(t *testing.T) { authority, ) - // gomock initializations - ctrl := gomock.NewController(t) - stakingKeeper := distrtestutil.NewMockStakingKeeper(ctrl) - poolKeeper := distrtestutil.NewMockPoolKeeper(ctrl) - // create distribution keeper distrKeeper := keeper.NewKeeper( encCfg.Codec, diff --git a/x/group/migrations/v2/migrate_test.go b/x/group/migrations/v2/migrate_test.go index 942a47ca097a..1530dfba75ec 100644 --- a/x/group/migrations/v2/migrate_test.go +++ b/x/group/migrations/v2/migrate_test.go @@ -103,10 +103,11 @@ func createOldPolicyAccount(ctx sdk.Context, storeKey storetypes.StoreKey, cdc c if err != nil { return nil, nil, err } + // gomock initializations ctrl := gomock.NewController(&testing.T{}) acctsModKeeper := authtestutil.NewMockAccountsModKeeper(ctrl) - accountKeeper := authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(storeKey.(*storetypes.KVStoreKey)), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, nil, addressCodec, sdk.Bech32MainPrefix, authorityStrAddr, acctsModKeeper) + accountKeeper := authkeeper.NewAccountKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(storeKey.(*storetypes.KVStoreKey)), log.NewNopLogger()), cdc, authtypes.ProtoBaseAccount, acctsModKeeper, nil, addressCodec, sdk.Bech32MainPrefix, authorityStrAddr) oldPolicyAccounts := make([]*authtypes.ModuleAccount, len(policies)) for i, policyAddr := range policies {