diff --git a/UPGRADING.md b/UPGRADING.md index 0eb853b31303..9c3f9ecd9f3b 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -946,6 +946,55 @@ To find out more please read the [signer field](https://github.com/cosmos/cosmos For ante handler construction via `ante.NewAnteHandler`, the field `ante.HandlerOptions.SignModeHandler` has been updated to `x/tx/signing/HandlerMap` from `x/auth/signing/SignModeHandler`. Callers typically fetch this value from `client.TxConfig.SignModeHandler()` (which is also changed) so this change should be transparent to most users. +##### Account Migration Guide: x/auth to x/accounts + +Users can now migrate accounts from `x/auth` to `x/accounts` using the `auth.MsgMigrateAccount` message. Currently, this migration is only supported for `BaseAccount` due to security considerations. + +###### Migration Process + +The migration process allows an auth BaseAccount to migrate to any kind of x/accounts supported account type, here we will show how to migrate from a legacy x/auth `BaseAccount` to a `x/accounts` `BaseAccount` + +####### Migrating to x/accounts/defaults/base + +To migrate to the `BaseAccount` in `x/accounts`, follow these steps: + +1. Send a `basev1.MsgInit` message. +2. This process allows you to: + - Switch to a new public key + - Reset your sequence number + +> **Important**: If you intend to keep the same public key, ensure you use your current sequence number. + +###### Example: x/auth.MsgMigrateAccount + +Here's an example of the `x/auth.MsgMigrateAccount` message structure: + +```json +{ + "signer": "cosmos1w43tr39v3lzvxz969e4ty9a74rq9nw7563tqvy", + "account_type": "base", + "account_init_msg": { + "@type": "/cosmos.accounts.defaults.base.v1.MsgInit", + "pub_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "AkeoE1z32tlQyE7xpx3v+JE9XJL0trVQBFoDCn0pGl3w" + }, + "init_sequence": "100" + } +} +``` + +**Field Descriptions** + +- `signer`: The address of the account you want to migrate from. +- `account_type`: The new account type you want to migrate to (depends on what's installed on the chain). +- `account_init_msg`: The custom initialization message for the new account. + - `@type`: Specifies the type of account (in this case, x/accounts base account). + - `pub_key`: The public key for the account. You can migrate to a different public key if desired. + - `init_sequence`: The new sequence number for the account. + +> **Warning**: If you're keeping the same public key, make sure to use your current sequence number to prevent potential replay attacks. + #### `x/capability` Capability has been moved to [IBC Go](https://github.com/cosmos/ibc-go). IBC v8 will contain the necessary changes to incorporate the new module location. diff --git a/api/cosmos/accounts/defaults/base/v1/base.pulsar.go b/api/cosmos/accounts/defaults/base/v1/base.pulsar.go index f1136248cde1..bd568f086f2f 100644 --- a/api/cosmos/accounts/defaults/base/v1/base.pulsar.go +++ b/api/cosmos/accounts/defaults/base/v1/base.pulsar.go @@ -14,14 +14,16 @@ import ( ) var ( - md_MsgInit protoreflect.MessageDescriptor - fd_MsgInit_pub_key protoreflect.FieldDescriptor + md_MsgInit protoreflect.MessageDescriptor + fd_MsgInit_pub_key protoreflect.FieldDescriptor + fd_MsgInit_init_sequence protoreflect.FieldDescriptor ) func init() { file_cosmos_accounts_defaults_base_v1_base_proto_init() md_MsgInit = File_cosmos_accounts_defaults_base_v1_base_proto.Messages().ByName("MsgInit") fd_MsgInit_pub_key = md_MsgInit.Fields().ByName("pub_key") + fd_MsgInit_init_sequence = md_MsgInit.Fields().ByName("init_sequence") } var _ protoreflect.Message = (*fastReflection_MsgInit)(nil) @@ -95,6 +97,12 @@ func (x *fastReflection_MsgInit) Range(f func(protoreflect.FieldDescriptor, prot return } } + if x.InitSequence != uint64(0) { + value := protoreflect.ValueOfUint64(x.InitSequence) + if !f(fd_MsgInit_init_sequence, value) { + return + } + } } // Has reports whether a field is populated. @@ -112,6 +120,8 @@ func (x *fastReflection_MsgInit) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": return x.PubKey != nil + case "cosmos.accounts.defaults.base.v1.MsgInit.init_sequence": + return x.InitSequence != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -130,6 +140,8 @@ func (x *fastReflection_MsgInit) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": x.PubKey = nil + case "cosmos.accounts.defaults.base.v1.MsgInit.init_sequence": + x.InitSequence = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -149,6 +161,9 @@ func (x *fastReflection_MsgInit) Get(descriptor protoreflect.FieldDescriptor) pr case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": value := x.PubKey return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "cosmos.accounts.defaults.base.v1.MsgInit.init_sequence": + value := x.InitSequence + return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -171,6 +186,8 @@ func (x *fastReflection_MsgInit) Set(fd protoreflect.FieldDescriptor, value prot switch fd.FullName() { case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": x.PubKey = value.Message().Interface().(*anypb.Any) + case "cosmos.accounts.defaults.base.v1.MsgInit.init_sequence": + x.InitSequence = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -196,6 +213,8 @@ func (x *fastReflection_MsgInit) Mutable(fd protoreflect.FieldDescriptor) protor x.PubKey = new(anypb.Any) } return protoreflect.ValueOfMessage(x.PubKey.ProtoReflect()) + case "cosmos.accounts.defaults.base.v1.MsgInit.init_sequence": + panic(fmt.Errorf("field init_sequence of message cosmos.accounts.defaults.base.v1.MsgInit is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -212,6 +231,8 @@ func (x *fastReflection_MsgInit) NewField(fd protoreflect.FieldDescriptor) proto case "cosmos.accounts.defaults.base.v1.MsgInit.pub_key": m := new(anypb.Any) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "cosmos.accounts.defaults.base.v1.MsgInit.init_sequence": + return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.defaults.base.v1.MsgInit")) @@ -285,6 +306,9 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { l = options.Size(x.PubKey) n += 1 + l + runtime.Sov(uint64(l)) } + if x.InitSequence != 0 { + n += 1 + runtime.Sov(uint64(x.InitSequence)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -314,6 +338,11 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.InitSequence != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.InitSequence)) + i-- + dAtA[i] = 0x10 + } if x.PubKey != nil { encoded, err := options.Marshal(x.PubKey) if err != nil { @@ -413,6 +442,25 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field InitSequence", wireType) + } + x.InitSequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.InitSequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3167,6 +3215,9 @@ type MsgInit struct { // pub_key defines a pubkey for the account arbitrary encapsulated. PubKey *anypb.Any `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + // init_sequence defines the initial sequence of the account. + // Defaults to zero if not set. + InitSequence uint64 `protobuf:"varint,2,opt,name=init_sequence,json=initSequence,proto3" json:"init_sequence,omitempty"` } func (x *MsgInit) Reset() { @@ -3196,6 +3247,13 @@ func (x *MsgInit) GetPubKey() *anypb.Any { return nil } +func (x *MsgInit) GetInitSequence() uint64 { + if x != nil { + return x.InitSequence + } + return 0 +} + // MsgInitResponse is the response returned after base account initialization. // This is empty. type MsgInitResponse struct { @@ -3425,45 +3483,48 @@ var file_cosmos_accounts_defaults_base_v1_base_proto_rawDesc = []byte{ 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 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, 0x22, 0x38, 0x0a, 0x07, 0x4d, 0x73, + 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5d, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x2d, 0x0a, 0x07, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x70, 0x75, - 0x62, 0x4b, 0x65, 0x79, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x53, 0x77, - 0x61, 0x70, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x0b, 0x6e, 0x65, 0x77, 0x5f, - 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x41, 0x6e, 0x79, 0x52, 0x09, 0x6e, 0x65, 0x77, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x17, - 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x33, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x0d, 0x0a, - 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x22, 0x44, 0x0a, 0x13, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, - 0x65, 0x79, 0x42, 0x90, 0x02, 0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x42, 0x61, 0x73, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 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, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x64, 0x65, 0x66, 0x61, 0x75, - 0x6c, 0x74, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x61, 0x73, 0x65, - 0x76, 0x31, 0xa2, 0x02, 0x04, 0x43, 0x41, 0x44, 0x42, 0xaa, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x44, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x20, 0x43, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x44, - 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x2c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, - 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x24, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x3a, 0x3a, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x3a, 0x3a, 0x42, 0x61, 0x73, - 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x62, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x71, + 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x69, 0x6e, 0x69, + 0x74, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, + 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x0a, 0x0d, + 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x34, 0x0a, + 0x0b, 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x6e, 0x65, 0x77, 0x50, 0x75, 0x62, + 0x4b, 0x65, 0x79, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x50, 0x75, + 0x62, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0f, 0x0a, 0x0d, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x33, 0x0a, + 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x75, 0x62, 0x4b, 0x65, + 0x79, 0x22, 0x44, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x70, 0x75, 0x62, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, + 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x42, 0x90, 0x02, 0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, + 0x42, 0x09, 0x42, 0x61, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 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, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, + 0x3b, 0x62, 0x61, 0x73, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x04, 0x43, 0x41, 0x44, 0x42, 0xaa, 0x02, + 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x2e, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x20, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, 0x42, 0x61, 0x73, + 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x2c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, 0x5c, + 0x42, 0x61, 0x73, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x24, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x73, + 0x3a, 0x3a, 0x42, 0x61, 0x73, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/cosmos/auth/v1beta1/accounts.pulsar.go b/api/cosmos/auth/v1beta1/accounts.pulsar.go index 3b794645d037..fbf5ad3c01a4 100644 --- a/api/cosmos/auth/v1beta1/accounts.pulsar.go +++ b/api/cosmos/auth/v1beta1/accounts.pulsar.go @@ -937,7 +937,7 @@ type QueryLegacyAccountResponse struct { // the type wrapped by the any does not need to comply with the // sdk.AccountI interface. Account *anypb.Any `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` - // info represents the account as a BaseAccount, this can return + // base represents the account as a BaseAccount, this can return // nil if the account cannot be represented as a BaseAccount. // This is used in the gRPC QueryAccountInfo method. Base *BaseAccount `protobuf:"bytes,2,opt,name=base,proto3" json:"base,omitempty"` diff --git a/api/cosmos/auth/v1beta1/tx.pulsar.go b/api/cosmos/auth/v1beta1/tx.pulsar.go index 429e8e3e437c..ff90234d44da 100644 --- a/api/cosmos/auth/v1beta1/tx.pulsar.go +++ b/api/cosmos/auth/v1beta1/tx.pulsar.go @@ -2423,6 +2423,1004 @@ func (x *fastReflection_MsgNonAtomicExecResponse) ProtoMethods() *protoiface.Met } } +var ( + md_MsgMigrateAccount protoreflect.MessageDescriptor + fd_MsgMigrateAccount_signer protoreflect.FieldDescriptor + fd_MsgMigrateAccount_account_type protoreflect.FieldDescriptor + fd_MsgMigrateAccount_account_init_msg protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_auth_v1beta1_tx_proto_init() + md_MsgMigrateAccount = File_cosmos_auth_v1beta1_tx_proto.Messages().ByName("MsgMigrateAccount") + fd_MsgMigrateAccount_signer = md_MsgMigrateAccount.Fields().ByName("signer") + fd_MsgMigrateAccount_account_type = md_MsgMigrateAccount.Fields().ByName("account_type") + fd_MsgMigrateAccount_account_init_msg = md_MsgMigrateAccount.Fields().ByName("account_init_msg") +} + +var _ protoreflect.Message = (*fastReflection_MsgMigrateAccount)(nil) + +type fastReflection_MsgMigrateAccount MsgMigrateAccount + +func (x *MsgMigrateAccount) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgMigrateAccount)(x) +} + +func (x *MsgMigrateAccount) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgMigrateAccount_messageType fastReflection_MsgMigrateAccount_messageType +var _ protoreflect.MessageType = fastReflection_MsgMigrateAccount_messageType{} + +type fastReflection_MsgMigrateAccount_messageType struct{} + +func (x fastReflection_MsgMigrateAccount_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgMigrateAccount)(nil) +} +func (x fastReflection_MsgMigrateAccount_messageType) New() protoreflect.Message { + return new(fastReflection_MsgMigrateAccount) +} +func (x fastReflection_MsgMigrateAccount_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMigrateAccount +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgMigrateAccount) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMigrateAccount +} + +// 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_MsgMigrateAccount) Type() protoreflect.MessageType { + return _fastReflection_MsgMigrateAccount_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgMigrateAccount) New() protoreflect.Message { + return new(fastReflection_MsgMigrateAccount) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgMigrateAccount) Interface() protoreflect.ProtoMessage { + return (*MsgMigrateAccount)(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_MsgMigrateAccount) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Signer != "" { + value := protoreflect.ValueOfString(x.Signer) + if !f(fd_MsgMigrateAccount_signer, value) { + return + } + } + if x.AccountType != "" { + value := protoreflect.ValueOfString(x.AccountType) + if !f(fd_MsgMigrateAccount_account_type, value) { + return + } + } + if x.AccountInitMsg != nil { + value := protoreflect.ValueOfMessage(x.AccountInitMsg.ProtoReflect()) + if !f(fd_MsgMigrateAccount_account_init_msg, 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_MsgMigrateAccount) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccount.signer": + return x.Signer != "" + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_type": + return x.AccountType != "" + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_init_msg": + return x.AccountInitMsg != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccount")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccount 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_MsgMigrateAccount) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccount.signer": + x.Signer = "" + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_type": + x.AccountType = "" + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_init_msg": + x.AccountInitMsg = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccount")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccount 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_MsgMigrateAccount) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccount.signer": + value := x.Signer + return protoreflect.ValueOfString(value) + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_type": + value := x.AccountType + return protoreflect.ValueOfString(value) + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_init_msg": + value := x.AccountInitMsg + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccount")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccount 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_MsgMigrateAccount) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccount.signer": + x.Signer = value.Interface().(string) + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_type": + x.AccountType = value.Interface().(string) + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_init_msg": + x.AccountInitMsg = value.Message().Interface().(*anypb.Any) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccount")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccount 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_MsgMigrateAccount) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_init_msg": + if x.AccountInitMsg == nil { + x.AccountInitMsg = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.AccountInitMsg.ProtoReflect()) + case "cosmos.auth.v1beta1.MsgMigrateAccount.signer": + panic(fmt.Errorf("field signer of message cosmos.auth.v1beta1.MsgMigrateAccount is not mutable")) + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_type": + panic(fmt.Errorf("field account_type of message cosmos.auth.v1beta1.MsgMigrateAccount is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccount")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccount 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_MsgMigrateAccount) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccount.signer": + return protoreflect.ValueOfString("") + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_type": + return protoreflect.ValueOfString("") + case "cosmos.auth.v1beta1.MsgMigrateAccount.account_init_msg": + 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.MsgMigrateAccount")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccount 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_MsgMigrateAccount) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.auth.v1beta1.MsgMigrateAccount", 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_MsgMigrateAccount) 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_MsgMigrateAccount) 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_MsgMigrateAccount) 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_MsgMigrateAccount) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgMigrateAccount) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Signer) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.AccountType) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.AccountInitMsg != nil { + l = options.Size(x.AccountInitMsg) + 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().(*MsgMigrateAccount) + 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.AccountInitMsg != nil { + encoded, err := options.Marshal(x.AccountInitMsg) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.AccountType) > 0 { + i -= len(x.AccountType) + copy(dAtA[i:], x.AccountType) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AccountType))) + 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().(*MsgMigrateAccount) + 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: MsgMigrateAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMigrateAccount: 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 AccountType", 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.AccountType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AccountInitMsg", 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.AccountInitMsg == nil { + x.AccountInitMsg = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.AccountInitMsg); 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_MsgMigrateAccountResponse protoreflect.MessageDescriptor + fd_MsgMigrateAccountResponse_init_response protoreflect.FieldDescriptor +) + +func init() { + file_cosmos_auth_v1beta1_tx_proto_init() + md_MsgMigrateAccountResponse = File_cosmos_auth_v1beta1_tx_proto.Messages().ByName("MsgMigrateAccountResponse") + fd_MsgMigrateAccountResponse_init_response = md_MsgMigrateAccountResponse.Fields().ByName("init_response") +} + +var _ protoreflect.Message = (*fastReflection_MsgMigrateAccountResponse)(nil) + +type fastReflection_MsgMigrateAccountResponse MsgMigrateAccountResponse + +func (x *MsgMigrateAccountResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgMigrateAccountResponse)(x) +} + +func (x *MsgMigrateAccountResponse) slowProtoReflect() protoreflect.Message { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[6] + 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_MsgMigrateAccountResponse_messageType fastReflection_MsgMigrateAccountResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgMigrateAccountResponse_messageType{} + +type fastReflection_MsgMigrateAccountResponse_messageType struct{} + +func (x fastReflection_MsgMigrateAccountResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgMigrateAccountResponse)(nil) +} +func (x fastReflection_MsgMigrateAccountResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgMigrateAccountResponse) +} +func (x fastReflection_MsgMigrateAccountResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMigrateAccountResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgMigrateAccountResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgMigrateAccountResponse +} + +// 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_MsgMigrateAccountResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgMigrateAccountResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgMigrateAccountResponse) New() protoreflect.Message { + return new(fastReflection_MsgMigrateAccountResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgMigrateAccountResponse) Interface() protoreflect.ProtoMessage { + return (*MsgMigrateAccountResponse)(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_MsgMigrateAccountResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.InitResponse != nil { + value := protoreflect.ValueOfMessage(x.InitResponse.ProtoReflect()) + if !f(fd_MsgMigrateAccountResponse_init_response, 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_MsgMigrateAccountResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccountResponse.init_response": + return x.InitResponse != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccountResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccountResponse 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_MsgMigrateAccountResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccountResponse.init_response": + x.InitResponse = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccountResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccountResponse 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_MsgMigrateAccountResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccountResponse.init_response": + value := x.InitResponse + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccountResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccountResponse 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_MsgMigrateAccountResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccountResponse.init_response": + x.InitResponse = value.Message().Interface().(*anypb.Any) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccountResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccountResponse 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_MsgMigrateAccountResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccountResponse.init_response": + if x.InitResponse == nil { + x.InitResponse = new(anypb.Any) + } + return protoreflect.ValueOfMessage(x.InitResponse.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.auth.v1beta1.MsgMigrateAccountResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccountResponse 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_MsgMigrateAccountResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "cosmos.auth.v1beta1.MsgMigrateAccountResponse.init_response": + 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.MsgMigrateAccountResponse")) + } + panic(fmt.Errorf("message cosmos.auth.v1beta1.MsgMigrateAccountResponse 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_MsgMigrateAccountResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in cosmos.auth.v1beta1.MsgMigrateAccountResponse", 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_MsgMigrateAccountResponse) 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_MsgMigrateAccountResponse) 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_MsgMigrateAccountResponse) 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_MsgMigrateAccountResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgMigrateAccountResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.InitResponse != nil { + l = options.Size(x.InitResponse) + 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().(*MsgMigrateAccountResponse) + 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.InitResponse != nil { + encoded, err := options.Marshal(x.InitResponse) + 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().(*MsgMigrateAccountResponse) + 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: MsgMigrateAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgMigrateAccountResponse: 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 InitResponse", 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.InitResponse == nil { + x.InitResponse = &anypb.Any{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.InitResponse); 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 @@ -2637,6 +3635,98 @@ func (x *MsgNonAtomicExecResponse) GetResults() []*NonAtomicExecResult { return nil } +// MsgMigrateAccount defines a message which allows users to migrate from BaseAccount +// to other x/accounts types. +type MsgMigrateAccount struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` + AccountInitMsg *anypb.Any `protobuf:"bytes,3,opt,name=account_init_msg,json=accountInitMsg,proto3" json:"account_init_msg,omitempty"` +} + +func (x *MsgMigrateAccount) Reset() { + *x = MsgMigrateAccount{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgMigrateAccount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMigrateAccount) ProtoMessage() {} + +// Deprecated: Use MsgMigrateAccount.ProtoReflect.Descriptor instead. +func (*MsgMigrateAccount) Descriptor() ([]byte, []int) { + return file_cosmos_auth_v1beta1_tx_proto_rawDescGZIP(), []int{5} +} + +func (x *MsgMigrateAccount) GetSigner() string { + if x != nil { + return x.Signer + } + return "" +} + +func (x *MsgMigrateAccount) GetAccountType() string { + if x != nil { + return x.AccountType + } + return "" +} + +func (x *MsgMigrateAccount) GetAccountInitMsg() *anypb.Any { + if x != nil { + return x.AccountInitMsg + } + return nil +} + +// MsgMigrateAccountResponse defines the response given when migrating to +// an x/accounts account. +type MsgMigrateAccountResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // init_response defines the response returned by the x/account account + // initialization. + InitResponse *anypb.Any `protobuf:"bytes,1,opt,name=init_response,json=initResponse,proto3" json:"init_response,omitempty"` +} + +func (x *MsgMigrateAccountResponse) Reset() { + *x = MsgMigrateAccountResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cosmos_auth_v1beta1_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgMigrateAccountResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgMigrateAccountResponse) ProtoMessage() {} + +// Deprecated: Use MsgMigrateAccountResponse.ProtoReflect.Descriptor instead. +func (*MsgMigrateAccountResponse) Descriptor() ([]byte, []int) { + return file_cosmos_auth_v1beta1_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgMigrateAccountResponse) GetInitResponse() *anypb.Any { + if x != nil { + return x.InitResponse + } + return nil +} + var File_cosmos_auth_v1beta1_tx_proto protoreflect.FileDescriptor var file_cosmos_auth_v1beta1_tx_proto_rawDesc = []byte{ @@ -2690,34 +3780,60 @@ var file_cosmos_auth_v1beta1_tx_proto_rawDesc = []byte{ 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, 0xec, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x77, 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, 0x22, 0x13, - 0xca, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, - 0x2e, 0x34, 0x37, 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, 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, + 0x74, 0x73, 0x22, 0xdd, 0x01, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, + 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 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, 0x21, 0x0a, 0x0c, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x3e, 0x0a, + 0x10, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x6d, 0x73, + 0x67, 0x18, 0x03, 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, 0x0e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x69, 0x74, 0x4d, 0x73, 0x67, 0x3a, 0x33, 0x82, + 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x61, 0x75, 0x74, 0x68, + 0x2f, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x56, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x39, 0x0a, 0x0d, 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0c, 0x69, 0x6e, + 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xd6, 0x02, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x77, 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, 0x22, 0x13, 0xca, 0xb4, 0x2d, 0x0f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x20, 0x30, 0x2e, 0x34, 0x37, 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, 0x12, 0x68, 0x0a, 0x0e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, + 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x2e, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 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, } var ( @@ -2732,30 +3848,36 @@ 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, 5) +var file_cosmos_auth_v1beta1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_cosmos_auth_v1beta1_tx_proto_goTypes = []interface{}{ - (*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 + (*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 + (*MsgMigrateAccount)(nil), // 5: cosmos.auth.v1beta1.MsgMigrateAccount + (*MsgMigrateAccountResponse)(nil), // 6: cosmos.auth.v1beta1.MsgMigrateAccountResponse + (*Params)(nil), // 7: cosmos.auth.v1beta1.Params + (*anypb.Any)(nil), // 8: google.protobuf.Any } var file_cosmos_auth_v1beta1_tx_proto_depIdxs = []int32{ - 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 + 7, // 0: cosmos.auth.v1beta1.MsgUpdateParams.params:type_name -> cosmos.auth.v1beta1.Params + 8, // 1: cosmos.auth.v1beta1.MsgNonAtomicExec.msgs:type_name -> google.protobuf.Any + 8, // 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 + 8, // 4: cosmos.auth.v1beta1.MsgMigrateAccount.account_init_msg:type_name -> google.protobuf.Any + 8, // 5: cosmos.auth.v1beta1.MsgMigrateAccountResponse.init_response:type_name -> google.protobuf.Any + 0, // 6: cosmos.auth.v1beta1.Msg.UpdateParams:input_type -> cosmos.auth.v1beta1.MsgUpdateParams + 2, // 7: cosmos.auth.v1beta1.Msg.NonAtomicExec:input_type -> cosmos.auth.v1beta1.MsgNonAtomicExec + 5, // 8: cosmos.auth.v1beta1.Msg.MigrateAccount:input_type -> cosmos.auth.v1beta1.MsgMigrateAccount + 1, // 9: cosmos.auth.v1beta1.Msg.UpdateParams:output_type -> cosmos.auth.v1beta1.MsgUpdateParamsResponse + 4, // 10: cosmos.auth.v1beta1.Msg.NonAtomicExec:output_type -> cosmos.auth.v1beta1.MsgNonAtomicExecResponse + 6, // 11: cosmos.auth.v1beta1.Msg.MigrateAccount:output_type -> cosmos.auth.v1beta1.MsgMigrateAccountResponse + 9, // [9:12] is the sub-list for method output_type + 6, // [6:9] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_cosmos_auth_v1beta1_tx_proto_init() } @@ -2825,6 +3947,30 @@ func file_cosmos_auth_v1beta1_tx_proto_init() { return nil } } + file_cosmos_auth_v1beta1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgMigrateAccount); 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[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgMigrateAccountResponse); 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{ @@ -2832,7 +3978,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: 5, + NumMessages: 7, 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 a43c63082056..ebc4845f4431 100644 --- a/api/cosmos/auth/v1beta1/tx_grpc.pb.go +++ b/api/cosmos/auth/v1beta1/tx_grpc.pb.go @@ -19,8 +19,9 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Msg_UpdateParams_FullMethodName = "/cosmos.auth.v1beta1.Msg/UpdateParams" - Msg_NonAtomicExec_FullMethodName = "/cosmos.auth.v1beta1.Msg/NonAtomicExec" + Msg_UpdateParams_FullMethodName = "/cosmos.auth.v1beta1.Msg/UpdateParams" + Msg_NonAtomicExec_FullMethodName = "/cosmos.auth.v1beta1.Msg/NonAtomicExec" + Msg_MigrateAccount_FullMethodName = "/cosmos.auth.v1beta1.Msg/MigrateAccount" ) // MsgClient is the client API for Msg service. @@ -34,6 +35,8 @@ type MsgClient interface { 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) + // MigrateAccount migrates the account to x/accounts. + MigrateAccount(ctx context.Context, in *MsgMigrateAccount, opts ...grpc.CallOption) (*MsgMigrateAccountResponse, error) } type msgClient struct { @@ -64,6 +67,16 @@ func (c *msgClient) NonAtomicExec(ctx context.Context, in *MsgNonAtomicExec, opt return out, nil } +func (c *msgClient) MigrateAccount(ctx context.Context, in *MsgMigrateAccount, opts ...grpc.CallOption) (*MsgMigrateAccountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgMigrateAccountResponse) + err := c.cc.Invoke(ctx, Msg_MigrateAccount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility. @@ -75,6 +88,8 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // NonAtomicExec allows users to submit multiple messages for non-atomic execution. NonAtomicExec(context.Context, *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) + // MigrateAccount migrates the account to x/accounts. + MigrateAccount(context.Context, *MsgMigrateAccount) (*MsgMigrateAccountResponse, error) mustEmbedUnimplementedMsgServer() } @@ -91,6 +106,9 @@ func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (* func (UnimplementedMsgServer) NonAtomicExec(context.Context, *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NonAtomicExec not implemented") } +func (UnimplementedMsgServer) MigrateAccount(context.Context, *MsgMigrateAccount) (*MsgMigrateAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MigrateAccount not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} func (UnimplementedMsgServer) testEmbeddedByValue() {} @@ -148,6 +166,24 @@ func _Msg_NonAtomicExec_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_MigrateAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMigrateAccount) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MigrateAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_MigrateAccount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MigrateAccount(ctx, req.(*MsgMigrateAccount)) + } + 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) @@ -163,6 +199,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "NonAtomicExec", Handler: _Msg_NonAtomicExec_Handler, }, + { + MethodName: "MigrateAccount", + Handler: _Msg_MigrateAccount_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/auth/v1beta1/tx.proto", diff --git a/proto/cosmos/auth/v1beta1/accounts.proto b/proto/cosmos/auth/v1beta1/accounts.proto index 2e15375c39e4..ade3f897bc27 100644 --- a/proto/cosmos/auth/v1beta1/accounts.proto +++ b/proto/cosmos/auth/v1beta1/accounts.proto @@ -20,7 +20,7 @@ message QueryLegacyAccountResponse { // the type wrapped by the any does not need to comply with the // sdk.AccountI interface. google.protobuf.Any account = 1; - // info represents the account as a BaseAccount, this can return + // base represents the account as a BaseAccount, this can return // nil if the account cannot be represented as a BaseAccount. // This is used in the gRPC QueryAccountInfo method. BaseAccount base = 2; diff --git a/proto/cosmos/auth/v1beta1/tx.proto b/proto/cosmos/auth/v1beta1/tx.proto index bdfac0f171d3..fefe2bc6a05b 100644 --- a/proto/cosmos/auth/v1beta1/tx.proto +++ b/proto/cosmos/auth/v1beta1/tx.proto @@ -22,6 +22,9 @@ service Msg { // NonAtomicExec allows users to submit multiple messages for non-atomic execution. rpc NonAtomicExec(MsgNonAtomicExec) returns (MsgNonAtomicExecResponse); + + // MigrateAccount migrates the account to x/accounts. + rpc MigrateAccount(MsgMigrateAccount) returns (MsgMigrateAccountResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -64,3 +67,22 @@ message NonAtomicExecResult { message MsgNonAtomicExecResponse { repeated NonAtomicExecResult results = 1; } + +// MsgMigrateAccount defines a message which allows users to migrate from BaseAccount +// to other x/accounts types. +message MsgMigrateAccount { + option (amino.name) = "cosmos-sdk/x/auth/MsgMigrateAccount"; + option (cosmos.msg.v1.signer) = "signer"; + + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string account_type = 2; + google.protobuf.Any account_init_msg = 3; +} + +// MsgMigrateAccountResponse defines the response given when migrating to +// an x/accounts account. +message MsgMigrateAccountResponse { + // init_response defines the response returned by the x/account account + // initialization. + google.protobuf.Any init_response = 1; +} \ No newline at end of file diff --git a/tests/integration/auth/keeper/migrate_x_accounts_test.go b/tests/integration/auth/keeper/migrate_x_accounts_test.go new file mode 100644 index 000000000000..452a7e1d9666 --- /dev/null +++ b/tests/integration/auth/keeper/migrate_x_accounts_test.go @@ -0,0 +1,100 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + basev1 "cosmossdk.io/x/accounts/defaults/base/v1" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +func TestMigrateToAccounts(t *testing.T) { + f := initFixture(t, nil) + + // create a module account + modAcc := &authtypes.ModuleAccount{ + BaseAccount: &authtypes.BaseAccount{ + Address: f.mustAddr([]byte("cookies")), + PubKey: nil, + AccountNumber: 0, + Sequence: 0, + }, + Name: "cookies", + Permissions: nil, + } + updatedMod := f.authKeeper.NewAccount(f.ctx, modAcc) + f.authKeeper.SetAccount(f.ctx, updatedMod) + + // create account + msgSrv := authkeeper.NewMsgServerImpl(f.authKeeper) + privKey := secp256k1.GenPrivKey() + addr := sdk.AccAddress(privKey.PubKey().Address()) + + acc := f.authKeeper.NewAccountWithAddress(f.ctx, addr) + require.NoError(t, acc.SetPubKey(privKey.PubKey())) + f.authKeeper.SetAccount(f.ctx, acc) + + t.Run("account does not exist", func(t *testing.T) { + resp, err := msgSrv.MigrateAccount(f.ctx, &authtypes.MsgMigrateAccount{ + Signer: f.mustAddr([]byte("notexist")), + AccountType: "base", + AccountInitMsg: nil, + }) + require.Nil(t, resp) + require.ErrorIs(t, err, sdkerrors.ErrUnknownAddress) + }) + + t.Run("invalid account type", func(t *testing.T) { + resp, err := msgSrv.MigrateAccount(f.ctx, &authtypes.MsgMigrateAccount{ + Signer: f.mustAddr(updatedMod.GetAddress()), + AccountType: "base", + AccountInitMsg: nil, + }) + require.Nil(t, resp) + require.ErrorContains(t, err, "only BaseAccount can be migrated") + }) + + t.Run("success", func(t *testing.T) { + pk, err := codectypes.NewAnyWithValue(privKey.PubKey()) + require.NoError(t, err) + + migrateMsg := &basev1.MsgInit{ + PubKey: pk, + InitSequence: 100, + } + + initMsgAny, err := codectypes.NewAnyWithValue(migrateMsg) + require.NoError(t, err) + + resp, err := msgSrv.MigrateAccount(f.ctx, &authtypes.MsgMigrateAccount{ + Signer: f.mustAddr(addr), + AccountType: "base", + AccountInitMsg: initMsgAny, + }) + require.NoError(t, err) + + // check response semantics. + require.Equal(t, resp.InitResponse.TypeUrl, "/cosmos.accounts.defaults.base.v1.MsgInitResponse") + require.NotNil(t, resp.InitResponse.Value) + + // check the account was removed from x/auth and added to x/accounts + require.Nil(t, f.authKeeper.GetAccount(f.ctx, addr)) + require.True(t, f.accountsKeeper.IsAccountsModuleAccount(f.ctx, addr)) + + // check the init information is correctly propagated. + seq, err := f.accountsKeeper.Query(f.ctx, addr, &basev1.QuerySequence{}) + require.NoError(t, err) + require.Equal(t, migrateMsg.InitSequence, seq.(*basev1.QuerySequenceResponse).Sequence) + + pkResp, err := f.accountsKeeper.Query(f.ctx, addr, &basev1.QueryPubKey{}) + require.NoError(t, err) + require.Equal(t, migrateMsg.PubKey, pkResp.(*basev1.QueryPubKeyResponse).PubKey) + }) +} diff --git a/x/accounts/defaults/base/account.go b/x/accounts/defaults/base/account.go index edeed35c7a3a..2bfd154a62ed 100644 --- a/x/accounts/defaults/base/account.go +++ b/x/accounts/defaults/base/account.go @@ -70,6 +70,12 @@ type Account struct { } func (a Account) Init(ctx context.Context, msg *v1.MsgInit) (*v1.MsgInitResponse, error) { + if msg.InitSequence != 0 { + err := a.Sequence.Set(ctx, msg.InitSequence) + if err != nil { + return nil, err + } + } return &v1.MsgInitResponse{}, a.savePubKey(ctx, msg.PubKey) } @@ -258,6 +264,18 @@ func (a Account) QuerySequence(ctx context.Context, _ *v1.QuerySequence) (*v1.Qu return &v1.QuerySequenceResponse{Sequence: seq}, nil } +func (a Account) QueryPubKey(ctx context.Context, _ *v1.QueryPubKey) (*v1.QueryPubKeyResponse, error) { + pubKey, err := a.loadPubKey(ctx) + if err != nil { + return nil, err + } + anyPubKey, err := codectypes.NewAnyWithValue(pubKey) + if err != nil { + return nil, err + } + return &v1.QueryPubKeyResponse{PubKey: anyPubKey}, nil +} + func (a Account) AuthRetroCompatibility(ctx context.Context, _ *authtypes.QueryLegacyAccount) (*authtypes.QueryLegacyAccountResponse, error) { addr, err := a.addrCodec.BytesToString(accountstd.Whoami(ctx)) if err != nil { @@ -311,5 +329,6 @@ func (a Account) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) { func (a Account) RegisterQueryHandlers(builder *accountstd.QueryBuilder) { accountstd.RegisterQueryHandler(builder, a.QuerySequence) + accountstd.RegisterQueryHandler(builder, a.QueryPubKey) accountstd.RegisterQueryHandler(builder, a.AuthRetroCompatibility) } diff --git a/x/accounts/defaults/base/v1/base.pb.go b/x/accounts/defaults/base/v1/base.pb.go index cc9078c736e1..dd8c44aaff2b 100644 --- a/x/accounts/defaults/base/v1/base.pb.go +++ b/x/accounts/defaults/base/v1/base.pb.go @@ -27,6 +27,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgInit struct { // pub_key defines a pubkey for the account arbitrary encapsulated. PubKey *any.Any `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + // init_sequence defines the initial sequence of the account. + // Defaults to zero if not set. + InitSequence uint64 `protobuf:"varint,2,opt,name=init_sequence,json=initSequence,proto3" json:"init_sequence,omitempty"` } func (m *MsgInit) Reset() { *m = MsgInit{} } @@ -69,6 +72,13 @@ func (m *MsgInit) GetPubKey() *any.Any { return nil } +func (m *MsgInit) GetInitSequence() uint64 { + if m != nil { + return m.InitSequence + } + return 0 +} + // MsgInitResponse is the response returned after base account initialization. // This is empty. type MsgInitResponse struct { @@ -372,26 +382,28 @@ func init() { } var fileDescriptor_7c860870b5ed6dc2 = []byte{ - // 303 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xcf, 0x4a, 0xc3, 0x40, - 0x10, 0xc6, 0x1b, 0x90, 0x56, 0xa7, 0x94, 0x62, 0xb4, 0xa8, 0x3d, 0x2c, 0x65, 0x4f, 0x05, 0x71, - 0x97, 0x5a, 0x0f, 0x5e, 0x2d, 0x7a, 0x10, 0x29, 0x68, 0x7a, 0xf3, 0x52, 0x92, 0x74, 0x1a, 0x4a, - 0xeb, 0x6e, 0xec, 0x66, 0x1b, 0xf3, 0x16, 0x3e, 0x96, 0xc7, 0x1e, 0x3d, 0x4a, 0xf2, 0x22, 0xc2, - 0xe6, 0x0f, 0xf6, 0x20, 0xe8, 0x69, 0x99, 0xe1, 0xf7, 0xfb, 0x06, 0xf6, 0x83, 0x73, 0x5f, 0xaa, - 0x17, 0xa9, 0xb8, 0xeb, 0xfb, 0x52, 0x8b, 0x48, 0xf1, 0x19, 0xce, 0x5d, 0xbd, 0x8a, 0x14, 0xf7, - 0x5c, 0x85, 0x7c, 0x33, 0x30, 0x2f, 0x0b, 0xd7, 0x32, 0x92, 0x76, 0x2f, 0x87, 0x59, 0x09, 0xb3, - 0x12, 0x66, 0x06, 0xda, 0x0c, 0xba, 0x67, 0x81, 0x94, 0xc1, 0x0a, 0xb9, 0xe1, 0x3d, 0x3d, 0xe7, - 0xae, 0x48, 0x72, 0x99, 0x5e, 0x43, 0x63, 0xac, 0x82, 0x7b, 0xb1, 0x88, 0xec, 0x0b, 0x68, 0x84, - 0xda, 0x9b, 0x2e, 0x31, 0x39, 0xb5, 0x7a, 0x56, 0xbf, 0x79, 0x79, 0xcc, 0x72, 0x8f, 0x95, 0x1e, - 0xbb, 0x11, 0x89, 0x53, 0x0f, 0xb5, 0xf7, 0x80, 0x09, 0x3d, 0x84, 0x76, 0x61, 0x3a, 0xa8, 0x42, - 0x29, 0x14, 0xd2, 0x3b, 0x68, 0x8d, 0x55, 0x30, 0x89, 0xdd, 0xf0, 0xd1, 0x30, 0xf6, 0x15, 0x34, - 0x05, 0xc6, 0xd3, 0xbf, 0xc4, 0x1e, 0x08, 0x8c, 0x73, 0x8b, 0x9e, 0x40, 0x67, 0x27, 0xa6, 0xca, - 0x6f, 0x43, 0xeb, 0x49, 0xe3, 0x3a, 0x99, 0xe0, 0xab, 0x46, 0xe1, 0x23, 0x1d, 0x42, 0x67, 0x67, - 0x51, 0x92, 0x76, 0x17, 0xf6, 0x55, 0xb1, 0x33, 0x57, 0xf7, 0x9c, 0x6a, 0xa6, 0x2d, 0x68, 0x1a, - 0xa9, 0xb8, 0x76, 0x0b, 0x47, 0x3f, 0xc6, 0x2a, 0xe1, 0x7f, 0xbf, 0x31, 0x1a, 0x7d, 0xa4, 0xc4, - 0xda, 0xa6, 0xc4, 0xfa, 0x4a, 0x89, 0xf5, 0x9e, 0x91, 0xda, 0x36, 0x23, 0xb5, 0xcf, 0x8c, 0xd4, - 0x9e, 0xfb, 0x79, 0x3d, 0x6a, 0xb6, 0x64, 0x0b, 0xc9, 0xdf, 0x7e, 0xef, 0xd4, 0xab, 0x9b, 0xe4, - 0xe1, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xe1, 0xb2, 0xd8, 0xfe, 0x01, 0x00, 0x00, + // 323 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xc1, 0x4a, 0xf3, 0x40, + 0x10, 0xc7, 0xbb, 0x1f, 0x1f, 0xad, 0x4e, 0x0d, 0xc5, 0x68, 0xb1, 0xf6, 0x10, 0x4a, 0xbc, 0x14, + 0xc4, 0x5d, 0x6a, 0x7d, 0x01, 0x8b, 0x1e, 0x44, 0x0a, 0xda, 0xde, 0x04, 0x29, 0x49, 0x3a, 0x0d, + 0xa1, 0x75, 0x37, 0x76, 0xb3, 0xad, 0x79, 0x0b, 0x1f, 0xcb, 0x63, 0x8f, 0x1e, 0xa5, 0x7d, 0x11, + 0x71, 0x37, 0x09, 0xf6, 0x20, 0xe8, 0x69, 0x99, 0xe1, 0xf7, 0xff, 0xcd, 0xb0, 0x03, 0xa7, 0x81, + 0x90, 0x4f, 0x42, 0x32, 0x2f, 0x08, 0x84, 0xe2, 0x89, 0x64, 0x63, 0x9c, 0x78, 0x6a, 0x96, 0x48, + 0xe6, 0x7b, 0x12, 0xd9, 0xa2, 0xa3, 0x5f, 0x1a, 0xcf, 0x45, 0x22, 0xec, 0x96, 0x81, 0x69, 0x0e, + 0xd3, 0x1c, 0xa6, 0x1a, 0x5a, 0x74, 0x9a, 0xc7, 0xa1, 0x10, 0xe1, 0x0c, 0x99, 0xe6, 0x7d, 0x35, + 0x61, 0x1e, 0x4f, 0x4d, 0xd8, 0x7d, 0x84, 0x4a, 0x5f, 0x86, 0x37, 0x3c, 0x4a, 0xec, 0x33, 0xa8, + 0xc4, 0xca, 0x1f, 0x4d, 0x31, 0x6d, 0x90, 0x16, 0x69, 0x57, 0xcf, 0x0f, 0xa9, 0xc9, 0xd1, 0x3c, + 0x47, 0x2f, 0x79, 0x3a, 0x28, 0xc7, 0xca, 0xbf, 0xc5, 0xd4, 0x3e, 0x01, 0x2b, 0xe2, 0x51, 0x32, + 0x92, 0xf8, 0xac, 0x90, 0x07, 0xd8, 0xf8, 0xd7, 0x22, 0xed, 0xff, 0x83, 0xbd, 0xaf, 0xe6, 0x30, + 0xeb, 0xb9, 0xfb, 0x50, 0xcb, 0xf4, 0x03, 0x94, 0xb1, 0xe0, 0x12, 0xdd, 0x6b, 0xb0, 0xfa, 0x32, + 0x1c, 0x2e, 0xbd, 0xf8, 0xce, 0x88, 0x2e, 0xa0, 0xca, 0x71, 0x39, 0xfa, 0xcd, 0xec, 0x5d, 0x8e, + 0x4b, 0x93, 0x72, 0x8f, 0xa0, 0xbe, 0xa5, 0x29, 0xfc, 0x35, 0xb0, 0xee, 0x15, 0xce, 0xd3, 0x62, + 0x87, 0x2e, 0xd4, 0xb7, 0x1a, 0x39, 0x69, 0x37, 0x61, 0xa7, 0x58, 0x9e, 0xe8, 0xe5, 0x8b, 0xda, + 0xb5, 0xa0, 0xaa, 0x43, 0xd9, 0xb4, 0x2b, 0x38, 0xf8, 0x56, 0x16, 0x86, 0xbf, 0x7d, 0x59, 0xaf, + 0xf7, 0xb6, 0x76, 0xc8, 0x6a, 0xed, 0x90, 0x8f, 0xb5, 0x43, 0x5e, 0x37, 0x4e, 0x69, 0xb5, 0x71, + 0x4a, 0xef, 0x1b, 0xa7, 0xf4, 0xd0, 0x36, 0x37, 0x94, 0xe3, 0x29, 0x8d, 0x04, 0x7b, 0xf9, 0xf9, + 0xf0, 0x7e, 0x59, 0x9b, 0xbb, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x30, 0xaf, 0x2e, 0x20, 0x23, + 0x02, 0x00, 0x00, } func (m *MsgInit) Marshal() (dAtA []byte, err error) { @@ -414,6 +426,11 @@ func (m *MsgInit) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.InitSequence != 0 { + i = encodeVarintBase(dAtA, i, uint64(m.InitSequence)) + i-- + dAtA[i] = 0x10 + } if m.PubKey != nil { { size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) @@ -640,6 +657,9 @@ func (m *MsgInit) Size() (n int) { l = m.PubKey.Size() n += 1 + l + sovBase(uint64(l)) } + if m.InitSequence != 0 { + n += 1 + sovBase(uint64(m.InitSequence)) + } return n } @@ -788,6 +808,25 @@ func (m *MsgInit) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitSequence", wireType) + } + m.InitSequence = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBase + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitSequence |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipBase(dAtA[iNdEx:]) diff --git a/x/accounts/proto/cosmos/accounts/defaults/base/v1/base.proto b/x/accounts/proto/cosmos/accounts/defaults/base/v1/base.proto index 1df7f92b501d..3661c52c6108 100644 --- a/x/accounts/proto/cosmos/accounts/defaults/base/v1/base.proto +++ b/x/accounts/proto/cosmos/accounts/defaults/base/v1/base.proto @@ -10,6 +10,9 @@ import "google/protobuf/any.proto"; message MsgInit { // pub_key defines a pubkey for the account arbitrary encapsulated. google.protobuf.Any pub_key = 1; + // init_sequence defines the initial sequence of the account. + // Defaults to zero if not set. + uint64 init_sequence = 2; } // MsgInitResponse is the response returned after base account initialization. diff --git a/x/auth/CHANGELOG.md b/x/auth/CHANGELOG.md index 51a1eb6ea034..d0b1ca0509bb 100644 --- a/x/auth/CHANGELOG.md +++ b/x/auth/CHANGELOG.md @@ -61,7 +61,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#19093](https://github.com/cosmos/cosmos-sdk/pull/19093) SetPubKeyDecorator was merged into SigVerification, gas consumption is almost halved for a simple tx. * [#19535](https://github.com/cosmos/cosmos-sdk/pull/19535) Remove vesting account creation when the chain is running. The accounts module is required for creating [#vesting accounts](../accounts/defaults/lockup/README.md) on a running chain. * [#21688](https://github.com/cosmos/cosmos-sdk/pull/21688) Allow x/accounts to be queriable from the `AccountInfo` and `Account` gRPC endpoints - +* [#21820](https://github.com/cosmos/cosmos-sdk/pull/21820) Allow x/auth `BaseAccount` to migrate to a `x/accounts` via the new `MsgMigrateAccount`. ### Bug Fixes * [#19148](https://github.com/cosmos/cosmos-sdk/pull/19148) Checks the consumed gas for verifying a multisig pubKey signature during simulation. diff --git a/x/auth/keeper/msg_server.go b/x/auth/keeper/msg_server.go index 84155981bb0b..649e2d4e5efe 100644 --- a/x/auth/keeper/msg_server.go +++ b/x/auth/keeper/msg_server.go @@ -4,7 +4,14 @@ import ( "context" "errors" "fmt" + "reflect" + "strings" + gogoproto "github.com/cosmos/gogoproto/proto" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -68,3 +75,61 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams return &types.MsgUpdateParamsResponse{}, nil } + +func (ms msgServer) MigrateAccount(ctx context.Context, msg *types.MsgMigrateAccount) (*types.MsgMigrateAccountResponse, error) { + signer, err := ms.ak.AddressCodec().StringToBytes(msg.Signer) + if err != nil { + return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid signer address: %s", err) + } + + acc := ms.ak.GetAccount(ctx, signer) + if acc == nil { + return nil, sdkerrors.ErrUnknownAddress.Wrapf("account %s does not exist", signer) + } + + // check if account type is valid or not + _, isBaseAccount := (acc).(*types.BaseAccount) + if !isBaseAccount { + return nil, status.Error(codes.InvalidArgument, "only BaseAccount can be migrated") + } + + // unwrap any msg + initMsg, err := unpackAnyRaw(msg.AccountInitMsg) + if err != nil { + return nil, err + } + + initResp, err := ms.ak.AccountsModKeeper.MigrateLegacyAccount(ctx, signer, acc.GetAccountNumber(), msg.AccountType, initMsg) + if err != nil { + return nil, err + } + + // account is then removed from state + ms.ak.RemoveAccount(ctx, acc) + + initRespAny, err := codectypes.NewAnyWithValue(initResp) + if err != nil { + return nil, err + } + + return &types.MsgMigrateAccountResponse{InitResponse: initRespAny}, nil +} + +func unpackAnyRaw(m *codectypes.Any) (gogoproto.Message, error) { + if m == nil { + return nil, fmt.Errorf("cannot unpack nil any") + } + split := strings.Split(m.TypeUrl, "/") + name := split[len(split)-1] + typ := gogoproto.MessageType(name) + if typ == nil { + return nil, fmt.Errorf("no message type found for %s", name) + } + concreteMsg := reflect.New(typ.Elem()).Interface().(gogoproto.Message) + err := gogoproto.Unmarshal(m.Value, concreteMsg) + if err != nil { + return nil, err + } + + return concreteMsg, nil +} diff --git a/x/auth/testutil/expected_keepers_mocks.go b/x/auth/testutil/expected_keepers_mocks.go index f4e23bcbc06e..e32b234bed54 100644 --- a/x/auth/testutil/expected_keepers_mocks.go +++ b/x/auth/testutil/expected_keepers_mocks.go @@ -134,6 +134,21 @@ func (mr *MockAccountsModKeeperMockRecorder) IsAccountsModuleAccount(ctx, accoun return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAccountsModuleAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).IsAccountsModuleAccount), ctx, accountAddr) } +// MigrateLegacyAccount mocks base method. +func (m *MockAccountsModKeeper) MigrateLegacyAccount(ctx context.Context, addr []byte, accNum uint64, accType string, msg transaction.Msg) (transaction.Msg, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MigrateLegacyAccount", ctx, addr, accNum, accType, msg) + ret0, _ := ret[0].(transaction.Msg) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// MigrateLegacyAccount indicates an expected call of MigrateLegacyAccount. +func (mr *MockAccountsModKeeperMockRecorder) MigrateLegacyAccount(ctx, addr, accNum, accType, msg interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MigrateLegacyAccount", reflect.TypeOf((*MockAccountsModKeeper)(nil).MigrateLegacyAccount), ctx, addr, accNum, accType, msg) +} + // NextAccountNumber mocks base method. func (m *MockAccountsModKeeper) NextAccountNumber(ctx context.Context) (uint64, error) { m.ctrl.T.Helper() diff --git a/x/auth/types/accounts.pb.go b/x/auth/types/accounts.pb.go index 58f078127712..ee8ce1e00e09 100644 --- a/x/auth/types/accounts.pb.go +++ b/x/auth/types/accounts.pb.go @@ -70,7 +70,7 @@ type QueryLegacyAccountResponse struct { // the type wrapped by the any does not need to comply with the // sdk.AccountI interface. Account *any.Any `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` - // info represents the account as a BaseAccount, this can return + // base represents the account as a BaseAccount, this can return // nil if the account cannot be represented as a BaseAccount. // This is used in the gRPC QueryAccountInfo method. Base *BaseAccount `protobuf:"bytes,2,opt,name=base,proto3" json:"base,omitempty"` diff --git a/x/auth/types/codec.go b/x/auth/types/codec.go index 7f429d3b945b..882aaeb7d160 100644 --- a/x/auth/types/codec.go +++ b/x/auth/types/codec.go @@ -59,5 +59,6 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) { registrar.RegisterImplementations((*coretransaction.Msg)(nil), &MsgUpdateParams{}, &MsgNonAtomicExec{}, + &MsgMigrateAccount{}, ) } diff --git a/x/auth/types/expected_keepers.go b/x/auth/types/expected_keepers.go index 8c7ca103858f..6edca889809d 100644 --- a/x/auth/types/expected_keepers.go +++ b/x/auth/types/expected_keepers.go @@ -31,4 +31,13 @@ type AccountsModKeeper interface { // InitAccountNumberSeqUnsafe is use to set accounts module account number with value // of auth module current account number InitAccountNumberSeqUnsafe(ctx context.Context, currentAccNum uint64) error + + // MigrateLegacyAccount migrates the given account to an x/accounts' account. + MigrateLegacyAccount( + ctx context.Context, + addr []byte, // The current address of the account + accNum uint64, // The current account number + accType string, // The account type to migrate to + msg transaction.Msg, // The init msg of the account type we're migrating to + ) (transaction.Msg, error) } diff --git a/x/auth/types/tx.pb.go b/x/auth/types/tx.pb.go index ac7597d04746..8fbc233a8376 100644 --- a/x/auth/types/tx.pb.go +++ b/x/auth/types/tx.pb.go @@ -279,53 +279,172 @@ func (m *MsgNonAtomicExecResponse) GetResults() []*NonAtomicExecResult { return nil } +// MsgMigrateAccount defines a message which allows users to migrate from BaseAccount +// to other x/accounts types. +type MsgMigrateAccount struct { + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"` + AccountInitMsg *any.Any `protobuf:"bytes,3,opt,name=account_init_msg,json=accountInitMsg,proto3" json:"account_init_msg,omitempty"` +} + +func (m *MsgMigrateAccount) Reset() { *m = MsgMigrateAccount{} } +func (m *MsgMigrateAccount) String() string { return proto.CompactTextString(m) } +func (*MsgMigrateAccount) ProtoMessage() {} +func (*MsgMigrateAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_c2d62bd9c4c212e5, []int{5} +} +func (m *MsgMigrateAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMigrateAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMigrateAccount.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 *MsgMigrateAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMigrateAccount.Merge(m, src) +} +func (m *MsgMigrateAccount) XXX_Size() int { + return m.Size() +} +func (m *MsgMigrateAccount) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMigrateAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMigrateAccount proto.InternalMessageInfo + +func (m *MsgMigrateAccount) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func (m *MsgMigrateAccount) GetAccountType() string { + if m != nil { + return m.AccountType + } + return "" +} + +func (m *MsgMigrateAccount) GetAccountInitMsg() *any.Any { + if m != nil { + return m.AccountInitMsg + } + return nil +} + +// MsgMigrateAccountResponse defines the response given when migrating to +// an x/accounts account. +type MsgMigrateAccountResponse struct { + // init_response defines the response returned by the x/account account + // initialization. + InitResponse *any.Any `protobuf:"bytes,1,opt,name=init_response,json=initResponse,proto3" json:"init_response,omitempty"` +} + +func (m *MsgMigrateAccountResponse) Reset() { *m = MsgMigrateAccountResponse{} } +func (m *MsgMigrateAccountResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMigrateAccountResponse) ProtoMessage() {} +func (*MsgMigrateAccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c2d62bd9c4c212e5, []int{6} +} +func (m *MsgMigrateAccountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMigrateAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMigrateAccountResponse.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 *MsgMigrateAccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMigrateAccountResponse.Merge(m, src) +} +func (m *MsgMigrateAccountResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMigrateAccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMigrateAccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMigrateAccountResponse proto.InternalMessageInfo + +func (m *MsgMigrateAccountResponse) GetInitResponse() *any.Any { + if m != nil { + return m.InitResponse + } + 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") + proto.RegisterType((*MsgMigrateAccount)(nil), "cosmos.auth.v1beta1.MsgMigrateAccount") + proto.RegisterType((*MsgMigrateAccountResponse)(nil), "cosmos.auth.v1beta1.MsgMigrateAccountResponse") } func init() { proto.RegisterFile("cosmos/auth/v1beta1/tx.proto", fileDescriptor_c2d62bd9c4c212e5) } var fileDescriptor_c2d62bd9c4c212e5 = []byte{ - // 548 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcf, 0x8f, 0xd2, 0x40, - 0x14, 0x66, 0xdc, 0x1f, 0x86, 0x41, 0xb3, 0x5a, 0x48, 0x16, 0x59, 0x53, 0xb1, 0xd1, 0x04, 0x89, - 0x4c, 0x17, 0x34, 0x9a, 0x70, 0x30, 0x01, 0xb3, 0xf1, 0x84, 0x31, 0x35, 0x7b, 0xf1, 0xa0, 0x29, - 0x30, 0xce, 0x36, 0x6e, 0x3b, 0x4d, 0xdf, 0xb0, 0xc2, 0xcd, 0x78, 0xf4, 0xe4, 0xd1, 0x3f, 0xc1, - 0x23, 0x07, 0xfe, 0x88, 0xcd, 0x9e, 0x36, 0x9c, 0x3c, 0x19, 0x03, 0x07, 0x2e, 0xfe, 0x11, 0xa6, - 0x33, 0x53, 0x09, 0x6c, 0x8d, 0x7b, 0x69, 0x3b, 0xf3, 0x7d, 0xef, 0xbd, 0xef, 0xbd, 0xef, 0x15, - 0xdf, 0xee, 0x71, 0xf0, 0x39, 0xd8, 0xee, 0x40, 0x1c, 0xd9, 0x27, 0xf5, 0x2e, 0x15, 0x6e, 0xdd, - 0x16, 0x43, 0x12, 0x46, 0x5c, 0x70, 0x23, 0xaf, 0x50, 0x12, 0xa3, 0x44, 0xa3, 0xa5, 0x02, 0xe3, - 0x8c, 0x4b, 0xdc, 0x8e, 0xbf, 0x14, 0xb5, 0x74, 0x8b, 0x71, 0xce, 0x8e, 0xa9, 0x2d, 0x4f, 0xdd, - 0xc1, 0x7b, 0xdb, 0x0d, 0x46, 0x09, 0xa4, 0xb2, 0xbc, 0x53, 0x31, 0x3a, 0xa5, 0x82, 0x76, 0x75, - 0x79, 0x1f, 0x98, 0x7d, 0x52, 0x8f, 0x5f, 0x1a, 0xb8, 0xe9, 0xfa, 0x5e, 0xc0, 0x6d, 0xf9, 0xd4, - 0x57, 0x66, 0x9a, 0x54, 0xa9, 0x4c, 0xe2, 0xd6, 0x14, 0xe1, 0x9d, 0x0e, 0xb0, 0xc3, 0xb0, 0xef, - 0x0a, 0xfa, 0xca, 0x8d, 0x5c, 0x1f, 0x8c, 0x27, 0x38, 0x1b, 0x33, 0x78, 0xe4, 0x89, 0x51, 0x11, - 0x95, 0x51, 0x25, 0xdb, 0x2e, 0x4e, 0x27, 0xb5, 0x82, 0x16, 0xd1, 0xea, 0xf7, 0x23, 0x0a, 0xf0, - 0x5a, 0x44, 0x5e, 0xc0, 0x9c, 0x25, 0xd5, 0x78, 0x86, 0xb7, 0x43, 0x99, 0xa1, 0x78, 0xa5, 0x8c, - 0x2a, 0xb9, 0xc6, 0x1e, 0x49, 0x99, 0x04, 0x51, 0x45, 0xda, 0xd9, 0xd3, 0x9f, 0x77, 0x32, 0xdf, - 0x17, 0xe3, 0x2a, 0x72, 0x74, 0x54, 0xf3, 0xc5, 0x74, 0x52, 0xdb, 0x51, 0x21, 0x35, 0xe8, 0x7f, - 0x28, 0xef, 0x93, 0xc7, 0x4f, 0x3f, 0x2f, 0xc6, 0xd5, 0x65, 0x89, 0x2f, 0x8b, 0x71, 0xf5, 0xee, - 0x92, 0x61, 0x0f, 0x55, 0x5f, 0x6b, 0x0d, 0x58, 0x04, 0xef, 0xae, 0x5d, 0x39, 0x14, 0x42, 0x1e, - 0x00, 0x6d, 0xe6, 0x53, 0x6a, 0x58, 0xdf, 0x10, 0xbe, 0xd1, 0x01, 0xf6, 0x92, 0x07, 0x2d, 0xc1, - 0x7d, 0xaf, 0x77, 0x30, 0xa4, 0x3d, 0x63, 0x1f, 0x6f, 0x83, 0xc7, 0x02, 0x1a, 0xfd, 0x77, 0x04, - 0x9a, 0x67, 0x1c, 0xe0, 0x4d, 0x1f, 0x58, 0xdc, 0xfd, 0x46, 0x25, 0xd7, 0x28, 0x10, 0x65, 0x2e, - 0x49, 0xcc, 0x25, 0xad, 0x60, 0xd4, 0xde, 0x3b, 0x9b, 0xd4, 0xb4, 0x7f, 0xa4, 0xeb, 0x02, 0xfd, - 0x3b, 0x96, 0x0e, 0x30, 0x47, 0x86, 0x37, 0x73, 0x71, 0xcf, 0x3a, 0xa7, 0x75, 0x88, 0xf3, 0x2b, - 0xb2, 0x1c, 0x0a, 0x83, 0x63, 0x61, 0x14, 0xf0, 0x16, 0x8d, 0x22, 0xae, 0xb5, 0x39, 0xea, 0x60, - 0x54, 0xf0, 0x66, 0x44, 0x21, 0xd4, 0xe3, 0x4f, 0x15, 0xe0, 0x48, 0x86, 0xf5, 0x16, 0x17, 0xd7, - 0x1b, 0x4e, 0x46, 0x64, 0xb4, 0xf1, 0xd5, 0x48, 0x56, 0x81, 0x22, 0x92, 0x9d, 0x54, 0x52, 0x7d, - 0x4c, 0x91, 0xe5, 0x24, 0x81, 0x8d, 0xdf, 0x08, 0x6f, 0x74, 0x80, 0x19, 0x1f, 0xf1, 0xb5, 0x95, - 0xd5, 0xba, 0x97, 0x9a, 0x6a, 0xcd, 0xac, 0xd2, 0xc3, 0xcb, 0xb0, 0x12, 0xbd, 0x56, 0xfe, 0xec, - 0xa2, 0xa5, 0x06, 0xc5, 0xd7, 0x57, 0xed, 0xbc, 0xff, 0xaf, 0x9c, 0x2b, 0xb4, 0x52, 0xed, 0x52, - 0xb4, 0xa4, 0x76, 0x69, 0xeb, 0x53, 0xbc, 0xc1, 0xed, 0xe7, 0xa7, 0x33, 0x13, 0x9d, 0xcf, 0x4c, - 0xf4, 0x6b, 0x66, 0xa2, 0xaf, 0x73, 0x33, 0x73, 0x3e, 0x37, 0x33, 0x3f, 0xe6, 0x66, 0xe6, 0xcd, - 0x03, 0xe6, 0x89, 0xa3, 0x41, 0x97, 0xf4, 0xb8, 0xaf, 0x7f, 0x62, 0xfb, 0xe2, 0xfe, 0x8a, 0x51, - 0x48, 0xa1, 0xbb, 0x2d, 0x7d, 0x7a, 0xf4, 0x27, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xdf, 0x75, 0x60, - 0x5e, 0x04, 0x00, 0x00, + // 667 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcb, 0x6e, 0xd3, 0x40, + 0x14, 0x8d, 0xfb, 0x42, 0x99, 0xf4, 0xe9, 0x44, 0xaa, 0xeb, 0x22, 0xd3, 0x9a, 0x87, 0x42, 0x45, + 0xc6, 0x7d, 0x20, 0x10, 0x59, 0x54, 0x4a, 0x50, 0x85, 0x58, 0x18, 0x21, 0x43, 0x59, 0xb0, 0xa0, + 0x72, 0x9c, 0x61, 0x6a, 0x51, 0x7b, 0xac, 0x99, 0x49, 0x69, 0x76, 0x88, 0x25, 0x2b, 0x96, 0x7c, + 0x02, 0xcb, 0x2e, 0xfa, 0x11, 0x55, 0x57, 0x55, 0x17, 0x88, 0x0d, 0x08, 0xb5, 0x8b, 0xfe, 0x06, + 0xf2, 0x78, 0xdc, 0xe2, 0xd4, 0x81, 0x88, 0x4d, 0x62, 0xcf, 0x3d, 0xf7, 0xde, 0x73, 0xce, 0xbd, + 0x63, 0x70, 0xdd, 0x23, 0x2c, 0x20, 0xcc, 0x72, 0x3b, 0x7c, 0xdb, 0xda, 0x5d, 0x69, 0x21, 0xee, + 0xae, 0x58, 0x7c, 0x0f, 0x46, 0x94, 0x70, 0xa2, 0x96, 0x93, 0x28, 0x8c, 0xa3, 0x50, 0x46, 0xf5, + 0x0a, 0x26, 0x98, 0x88, 0xb8, 0x15, 0x3f, 0x25, 0x50, 0x7d, 0x0e, 0x13, 0x82, 0x77, 0x90, 0x25, + 0xde, 0x5a, 0x9d, 0xb7, 0x96, 0x1b, 0x76, 0xd3, 0x50, 0x52, 0x65, 0x2b, 0xc9, 0x91, 0x25, 0x93, + 0xd0, 0xac, 0x6c, 0x1f, 0x30, 0x6c, 0xed, 0xae, 0xc4, 0x7f, 0x32, 0x30, 0xe3, 0x06, 0x7e, 0x48, + 0x2c, 0xf1, 0x2b, 0x8f, 0x8c, 0x3c, 0xaa, 0x82, 0x99, 0x88, 0x9b, 0x27, 0x0a, 0x98, 0xb2, 0x19, + 0xde, 0x8c, 0xda, 0x2e, 0x47, 0xcf, 0x5d, 0xea, 0x06, 0x4c, 0x7d, 0x00, 0x8a, 0x31, 0x82, 0x50, + 0x9f, 0x77, 0x35, 0x65, 0x41, 0xa9, 0x16, 0x9b, 0xda, 0xc9, 0x41, 0xad, 0x22, 0x49, 0x34, 0xda, + 0x6d, 0x8a, 0x18, 0x7b, 0xc1, 0xa9, 0x1f, 0x62, 0xe7, 0x12, 0xaa, 0xae, 0x83, 0xb1, 0x48, 0x54, + 0xd0, 0x86, 0x16, 0x94, 0x6a, 0x69, 0x75, 0x1e, 0xe6, 0x38, 0x01, 0x93, 0x26, 0xcd, 0xe2, 0xe1, + 0xcf, 0x1b, 0x85, 0xaf, 0xe7, 0xfb, 0x4b, 0x8a, 0x23, 0xb3, 0xea, 0x4f, 0x4e, 0x0e, 0x6a, 0x53, + 0x49, 0x4a, 0x8d, 0xb5, 0xdf, 0x2d, 0x2c, 0xc3, 0xfb, 0x0f, 0x3f, 0x9e, 0xef, 0x2f, 0x5d, 0xb6, + 0xf8, 0x74, 0xbe, 0xbf, 0xb4, 0x78, 0x89, 0xb0, 0xf6, 0x12, 0x5d, 0x3d, 0x02, 0x4c, 0x08, 0x66, + 0x7b, 0x8e, 0x1c, 0xc4, 0x22, 0x12, 0x32, 0x54, 0x2f, 0xe7, 0xf4, 0x30, 0xbf, 0x28, 0x60, 0xda, + 0x66, 0xf8, 0x19, 0x09, 0x1b, 0x9c, 0x04, 0xbe, 0xb7, 0xb1, 0x87, 0x3c, 0x75, 0x19, 0x8c, 0x31, + 0x1f, 0x87, 0x88, 0xfe, 0xd3, 0x02, 0x89, 0x53, 0x37, 0xc0, 0x48, 0xc0, 0x70, 0xac, 0x7e, 0xb8, + 0x5a, 0x5a, 0xad, 0xc0, 0x64, 0xb8, 0x30, 0x1d, 0x2e, 0x6c, 0x84, 0xdd, 0xe6, 0xfc, 0xd1, 0x41, + 0x4d, 0xce, 0x0f, 0xb6, 0x5c, 0x86, 0x2e, 0x6c, 0xb1, 0x19, 0x76, 0x44, 0x7a, 0xbd, 0x14, 0x6b, + 0x96, 0x35, 0xcd, 0x4d, 0x50, 0xce, 0xd0, 0x72, 0x10, 0xeb, 0xec, 0x70, 0xb5, 0x02, 0x46, 0x11, + 0xa5, 0x44, 0x72, 0x73, 0x92, 0x17, 0xb5, 0x0a, 0x46, 0x28, 0x62, 0x91, 0xb4, 0x3f, 0x97, 0x80, + 0x23, 0x10, 0xe6, 0x1b, 0xa0, 0xf5, 0x0a, 0x4e, 0x2d, 0x52, 0x9b, 0xe0, 0x1a, 0x15, 0x5d, 0x98, + 0xa6, 0x08, 0x25, 0xd5, 0xdc, 0x39, 0xe6, 0xd0, 0x72, 0xd2, 0x44, 0xf3, 0x87, 0x02, 0x66, 0x6c, + 0x86, 0x6d, 0x1f, 0x53, 0x97, 0xa3, 0x86, 0xe7, 0x91, 0x4e, 0xc8, 0xff, 0xc3, 0xd2, 0x45, 0x30, + 0xee, 0x26, 0xc9, 0x5b, 0xbc, 0x1b, 0x21, 0xa1, 0xac, 0xe8, 0x94, 0xe4, 0xd9, 0xcb, 0x6e, 0x84, + 0xd4, 0x75, 0x30, 0x9d, 0x42, 0xfc, 0xd0, 0xe7, 0x5b, 0x01, 0xc3, 0xda, 0xf0, 0x5f, 0x0c, 0x98, + 0x94, 0xe8, 0xa7, 0xa1, 0xcf, 0x6d, 0x86, 0xeb, 0x6b, 0x7f, 0xd8, 0x1d, 0xef, 0xd7, 0xcd, 0xdc, + 0xfd, 0xca, 0x2a, 0x31, 0x5f, 0x81, 0xb9, 0x2b, 0x87, 0x17, 0x06, 0x3e, 0x02, 0x13, 0x82, 0x09, + 0x95, 0x07, 0x42, 0x6d, 0x3f, 0x3a, 0xe3, 0x31, 0x34, 0x4d, 0x5d, 0xfd, 0x36, 0x04, 0x86, 0x6d, + 0x86, 0xd5, 0xf7, 0x60, 0x3c, 0x73, 0x25, 0x6f, 0xe5, 0x8e, 0xa0, 0x67, 0xc9, 0xf5, 0x7b, 0x83, + 0xa0, 0xd2, 0x5e, 0x66, 0xf9, 0xe8, 0xea, 0x55, 0x50, 0x11, 0x98, 0xc8, 0x5e, 0x83, 0xdb, 0xfd, + 0x6a, 0x66, 0x60, 0x7a, 0x6d, 0x20, 0xd8, 0x85, 0x45, 0xdb, 0x60, 0xb2, 0x67, 0x37, 0xee, 0xf4, + 0x2b, 0x90, 0xc5, 0xe9, 0x70, 0x30, 0x5c, 0xda, 0x49, 0x1f, 0xfd, 0x10, 0x7f, 0x63, 0x9a, 0x8f, + 0x0f, 0x4f, 0x0d, 0xe5, 0xf8, 0xd4, 0x50, 0x7e, 0x9d, 0x1a, 0xca, 0xe7, 0x33, 0xa3, 0x70, 0x7c, + 0x66, 0x14, 0xbe, 0x9f, 0x19, 0x85, 0xd7, 0x77, 0xb1, 0xcf, 0xb7, 0x3b, 0x2d, 0xe8, 0x91, 0x40, + 0x7e, 0x66, 0xad, 0xab, 0x1b, 0x10, 0x2f, 0x1f, 0x6b, 0x8d, 0x89, 0xc9, 0xad, 0xfd, 0x0e, 0x00, + 0x00, 0xff, 0xff, 0xc2, 0x24, 0xb6, 0x0e, 0x00, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -345,6 +464,8 @@ type MsgClient interface { 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) + // MigrateAccount migrates the account to x/accounts. + MigrateAccount(ctx context.Context, in *MsgMigrateAccount, opts ...grpc.CallOption) (*MsgMigrateAccountResponse, error) } type msgClient struct { @@ -373,6 +494,15 @@ func (c *msgClient) NonAtomicExec(ctx context.Context, in *MsgNonAtomicExec, opt return out, nil } +func (c *msgClient) MigrateAccount(ctx context.Context, in *MsgMigrateAccount, opts ...grpc.CallOption) (*MsgMigrateAccountResponse, error) { + out := new(MsgMigrateAccountResponse) + err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Msg/MigrateAccount", 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 @@ -380,6 +510,8 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // NonAtomicExec allows users to submit multiple messages for non-atomic execution. NonAtomicExec(context.Context, *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) + // MigrateAccount migrates the account to x/accounts. + MigrateAccount(context.Context, *MsgMigrateAccount) (*MsgMigrateAccountResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -392,6 +524,9 @@ func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateP func (*UnimplementedMsgServer) NonAtomicExec(ctx context.Context, req *MsgNonAtomicExec) (*MsgNonAtomicExecResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NonAtomicExec not implemented") } +func (*UnimplementedMsgServer) MigrateAccount(ctx context.Context, req *MsgMigrateAccount) (*MsgMigrateAccountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MigrateAccount not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -433,6 +568,24 @@ func _Msg_NonAtomicExec_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_MigrateAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMigrateAccount) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MigrateAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.auth.v1beta1.Msg/MigrateAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MigrateAccount(ctx, req.(*MsgMigrateAccount)) + } + return interceptor(ctx, in, info, handler) +} + var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.auth.v1beta1.Msg", @@ -446,6 +599,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "NonAtomicExec", Handler: _Msg_NonAtomicExec_Handler, }, + { + MethodName: "MigrateAccount", + Handler: _Msg_MigrateAccount_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/auth/v1beta1/tx.proto", @@ -637,6 +794,90 @@ func (m *MsgNonAtomicExecResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *MsgMigrateAccount) 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 *MsgMigrateAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AccountInitMsg != nil { + { + size, err := m.AccountInitMsg.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.AccountType) > 0 { + i -= len(m.AccountType) + copy(dAtA[i:], m.AccountType) + i = encodeVarintTx(dAtA, i, uint64(len(m.AccountType))) + 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 *MsgMigrateAccountResponse) 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 *MsgMigrateAccountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InitResponse != nil { + { + size, err := m.InitResponse.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 @@ -723,6 +964,40 @@ func (m *MsgNonAtomicExecResponse) Size() (n int) { return n } +func (m *MsgMigrateAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.AccountType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AccountInitMsg != nil { + l = m.AccountInitMsg.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMigrateAccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.InitResponse != nil { + l = m.InitResponse.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1212,6 +1487,242 @@ func (m *MsgNonAtomicExecResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgMigrateAccount) 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: MsgMigrateAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMigrateAccount: 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 AccountType", 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.AccountType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccountInitMsg", 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.AccountInitMsg == nil { + m.AccountInitMsg = &any.Any{} + } + if err := m.AccountInitMsg.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 *MsgMigrateAccountResponse) 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: MsgMigrateAccountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMigrateAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitResponse", 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.InitResponse == nil { + m.InitResponse = &any.Any{} + } + if err := m.InitResponse.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