feat(accounts): use gogoproto API instead of protov2. (#18653)
Co-authored-by: unknown unknown <unknown@unknown> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
833547f2aa
commit
112f6cbdae
@ -84,7 +84,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (simulation) [#17911](https://github.com/cosmos/cosmos-sdk/pull/17911) Fix all problems with executing command `make test-sim-custom-genesis-fast` for simulation test.
|
||||
* (simulation) [#18196](https://github.com/cosmos/cosmos-sdk/pull/18196) Fix the problem of `validator set is empty after InitGenesis` in simulation test.
|
||||
* (baseapp) [#18551](https://github.com/cosmos/cosmos-sdk/pull/18551) Fix SelectTxForProposal the calculation method of tx bytes size is inconsistent with CometBFT
|
||||
* (baseapp) [#18653](https://github.com/cosmos/cosmos-sdk/pull/18654) Fixes an issue in which gogoproto.Merge does not work with gogoproto messages with custom types.
|
||||
* (baseapp) [#18654](https://github.com/cosmos/cosmos-sdk/pull/18654) Fixes an issue in which gogoproto.Merge does not work with gogoproto messages with custom types.
|
||||
|
||||
### API Breaking Changes
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoiface "google.golang.org/protobuf/runtime/protoiface"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
anypb "google.golang.org/protobuf/types/known/anypb"
|
||||
io "io"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
@ -96,8 +97,8 @@ func (x *fastReflection_AccountQueryRequest) Range(f func(protoreflect.FieldDesc
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(x.Request) != 0 {
|
||||
value := protoreflect.ValueOfBytes(x.Request)
|
||||
if x.Request != nil {
|
||||
value := protoreflect.ValueOfMessage(x.Request.ProtoReflect())
|
||||
if !f(fd_AccountQueryRequest_request, value) {
|
||||
return
|
||||
}
|
||||
@ -120,7 +121,7 @@ func (x *fastReflection_AccountQueryRequest) Has(fd protoreflect.FieldDescriptor
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.target":
|
||||
return x.Target != ""
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.request":
|
||||
return len(x.Request) != 0
|
||||
return x.Request != nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest"))
|
||||
@ -162,7 +163,7 @@ func (x *fastReflection_AccountQueryRequest) Get(descriptor protoreflect.FieldDe
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.request":
|
||||
value := x.Request
|
||||
return protoreflect.ValueOfBytes(value)
|
||||
return protoreflect.ValueOfMessage(value.ProtoReflect())
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest"))
|
||||
@ -186,7 +187,7 @@ func (x *fastReflection_AccountQueryRequest) Set(fd protoreflect.FieldDescriptor
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.target":
|
||||
x.Target = value.Interface().(string)
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.request":
|
||||
x.Request = value.Bytes()
|
||||
x.Request = value.Message().Interface().(*anypb.Any)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest"))
|
||||
@ -207,10 +208,13 @@ func (x *fastReflection_AccountQueryRequest) Set(fd protoreflect.FieldDescriptor
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_AccountQueryRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.request":
|
||||
if x.Request == nil {
|
||||
x.Request = new(anypb.Any)
|
||||
}
|
||||
return protoreflect.ValueOfMessage(x.Request.ProtoReflect())
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.target":
|
||||
panic(fmt.Errorf("field target of message cosmos.accounts.v1.AccountQueryRequest is not mutable"))
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.request":
|
||||
panic(fmt.Errorf("field request of message cosmos.accounts.v1.AccountQueryRequest is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest"))
|
||||
@ -227,7 +231,8 @@ func (x *fastReflection_AccountQueryRequest) NewField(fd protoreflect.FieldDescr
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.target":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "cosmos.accounts.v1.AccountQueryRequest.request":
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
m := new(anypb.Any)
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryRequest"))
|
||||
@ -301,8 +306,8 @@ func (x *fastReflection_AccountQueryRequest) ProtoMethods() *protoiface.Methods
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
l = len(x.Request)
|
||||
if l > 0 {
|
||||
if x.Request != nil {
|
||||
l = options.Size(x.Request)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
@ -334,10 +339,17 @@ func (x *fastReflection_AccountQueryRequest) ProtoMethods() *protoiface.Methods
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.Request) > 0 {
|
||||
i -= len(x.Request)
|
||||
copy(dAtA[i:], x.Request)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Request)))
|
||||
if x.Request != nil {
|
||||
encoded, err := options.Marshal(x.Request)
|
||||
if err != nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, err
|
||||
}
|
||||
i -= len(encoded)
|
||||
copy(dAtA[i:], encoded)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -433,7 +445,7 @@ func (x *fastReflection_AccountQueryRequest) ProtoMethods() *protoiface.Methods
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Request", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
@ -443,24 +455,26 @@ func (x *fastReflection_AccountQueryRequest) ProtoMethods() *protoiface.Methods
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Request = append(x.Request[:0], dAtA[iNdEx:postIndex]...)
|
||||
if x.Request == nil {
|
||||
x.Request = []byte{}
|
||||
x.Request = &anypb.Any{}
|
||||
}
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Request); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -574,8 +588,8 @@ func (x *fastReflection_AccountQueryResponse) Interface() protoreflect.ProtoMess
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_AccountQueryResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if len(x.Response) != 0 {
|
||||
value := protoreflect.ValueOfBytes(x.Response)
|
||||
if x.Response != nil {
|
||||
value := protoreflect.ValueOfMessage(x.Response.ProtoReflect())
|
||||
if !f(fd_AccountQueryResponse_response, value) {
|
||||
return
|
||||
}
|
||||
@ -596,7 +610,7 @@ func (x *fastReflection_AccountQueryResponse) Range(f func(protoreflect.FieldDes
|
||||
func (x *fastReflection_AccountQueryResponse) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.AccountQueryResponse.response":
|
||||
return len(x.Response) != 0
|
||||
return x.Response != nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse"))
|
||||
@ -633,7 +647,7 @@ func (x *fastReflection_AccountQueryResponse) Get(descriptor protoreflect.FieldD
|
||||
switch descriptor.FullName() {
|
||||
case "cosmos.accounts.v1.AccountQueryResponse.response":
|
||||
value := x.Response
|
||||
return protoreflect.ValueOfBytes(value)
|
||||
return protoreflect.ValueOfMessage(value.ProtoReflect())
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse"))
|
||||
@ -655,7 +669,7 @@ func (x *fastReflection_AccountQueryResponse) Get(descriptor protoreflect.FieldD
|
||||
func (x *fastReflection_AccountQueryResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.AccountQueryResponse.response":
|
||||
x.Response = value.Bytes()
|
||||
x.Response = value.Message().Interface().(*anypb.Any)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse"))
|
||||
@ -677,7 +691,10 @@ func (x *fastReflection_AccountQueryResponse) Set(fd protoreflect.FieldDescripto
|
||||
func (x *fastReflection_AccountQueryResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.AccountQueryResponse.response":
|
||||
panic(fmt.Errorf("field response of message cosmos.accounts.v1.AccountQueryResponse is not mutable"))
|
||||
if x.Response == nil {
|
||||
x.Response = new(anypb.Any)
|
||||
}
|
||||
return protoreflect.ValueOfMessage(x.Response.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse"))
|
||||
@ -692,7 +709,8 @@ func (x *fastReflection_AccountQueryResponse) Mutable(fd protoreflect.FieldDescr
|
||||
func (x *fastReflection_AccountQueryResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.AccountQueryResponse.response":
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
m := new(anypb.Any)
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.AccountQueryResponse"))
|
||||
@ -762,8 +780,8 @@ func (x *fastReflection_AccountQueryResponse) ProtoMethods() *protoiface.Methods
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
l = len(x.Response)
|
||||
if l > 0 {
|
||||
if x.Response != nil {
|
||||
l = options.Size(x.Response)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
@ -795,10 +813,17 @@ func (x *fastReflection_AccountQueryResponse) ProtoMethods() *protoiface.Methods
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.Response) > 0 {
|
||||
i -= len(x.Response)
|
||||
copy(dAtA[i:], x.Response)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Response)))
|
||||
if x.Response != nil {
|
||||
encoded, err := options.Marshal(x.Response)
|
||||
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
|
||||
}
|
||||
@ -855,7 +880,7 @@ func (x *fastReflection_AccountQueryResponse) ProtoMethods() *protoiface.Methods
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Response", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
@ -865,24 +890,26 @@ func (x *fastReflection_AccountQueryResponse) ProtoMethods() *protoiface.Methods
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Response = append(x.Response[:0], dAtA[iNdEx:postIndex]...)
|
||||
if x.Response == nil {
|
||||
x.Response = []byte{}
|
||||
x.Response = &anypb.Any{}
|
||||
}
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Response); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -3397,7 +3424,7 @@ type AccountQueryRequest struct {
|
||||
// target defines the account to be queried.
|
||||
Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
|
||||
// request defines the query message being sent to the account.
|
||||
Request []byte `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
|
||||
Request *anypb.Any `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AccountQueryRequest) Reset() {
|
||||
@ -3427,7 +3454,7 @@ func (x *AccountQueryRequest) GetTarget() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AccountQueryRequest) GetRequest() []byte {
|
||||
func (x *AccountQueryRequest) GetRequest() *anypb.Any {
|
||||
if x != nil {
|
||||
return x.Request
|
||||
}
|
||||
@ -3441,7 +3468,7 @@ type AccountQueryResponse struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// response defines the query response of the account.
|
||||
Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
|
||||
Response *anypb.Any `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AccountQueryResponse) Reset() {
|
||||
@ -3464,7 +3491,7 @@ func (*AccountQueryResponse) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_accounts_v1_query_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *AccountQueryResponse) GetResponse() []byte {
|
||||
func (x *AccountQueryResponse) GetResponse() *anypb.Any {
|
||||
if x != nil {
|
||||
return x.Response
|
||||
}
|
||||
@ -3691,76 +3718,80 @@ var file_cosmos_accounts_v1_query_proto_rawDesc = []byte{
|
||||
0x0a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x12, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x2e, 0x76, 0x31, 0x22, 0x47, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51,
|
||||
0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74,
|
||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72,
|
||||
0x67, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x32, 0x0a,
|
||||
0x14, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x32, 0x0a, 0x0d, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79,
|
||||
0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0xc8, 0x02, 0x0a, 0x0e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0b, 0x69, 0x6e, 0x69, 0x74,
|
||||
0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x53,
|
||||
0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x55, 0x0a, 0x10, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65,
|
||||
0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x0f, 0x65, 0x78, 0x65,
|
||||
0x63, 0x75, 0x74, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x51, 0x0a, 0x0e,
|
||||
0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x03,
|
||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63,
|
||||
0x73, 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,
|
||||
0x5d, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2e,
|
||||
0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x48,
|
||||
0x0a, 0x14, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 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, 0x08,
|
||||
0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x0d, 0x53, 0x63, 0x68, 0x65,
|
||||
0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0xc8, 0x02, 0x0a,
|
||||
0x0e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x4b, 0x0a, 0x0b, 0x69, 0x6e, 0x69, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72,
|
||||
0x52, 0x0d, 0x71, 0x75, 0x65, 0x72, 0x79, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x1a,
|
||||
0x3f, 0x0a, 0x07, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x2e, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
|
||||
0x22, 0x38, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x32, 0xa1, 0x02, 0x0a, 0x05, 0x51,
|
||||
0x75, 0x65, 0x72, 0x79, 0x12, 0x63, 0x0a, 0x0c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51,
|
||||
0x75, 0x65, 0x72, 0x79, 0x12, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x06, 0x53, 0x63, 0x68,
|
||||
0x65, 0x6d, 0x61, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
|
||||
0x52, 0x0a, 0x69, 0x6e, 0x69, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x55, 0x0a, 0x10,
|
||||
0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73,
|
||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
|
||||
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65,
|
||||
0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x0b,
|
||||
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x26, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c,
|
||||
0x65, 0x72, 0x52, 0x0f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c,
|
||||
0x65, 0x72, 0x73, 0x12, 0x51, 0x0a, 0x0e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x68, 0x61, 0x6e,
|
||||
0x64, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xbe,
|
||||
0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79,
|
||||
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 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, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12,
|
||||
0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e,
|
||||
0x56, 0x31, 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
|
||||
0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e,
|
||||
0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x0d, 0x71, 0x75, 0x65, 0x72, 0x79, 0x48, 0x61,
|
||||
0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x1a, 0x3f, 0x0a, 0x07, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65,
|
||||
0x72, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x38, 0x0a, 0x13, 0x41, 0x63, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21,
|
||||
0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70,
|
||||
0x65, 0x32, 0xa1, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x63, 0x0a, 0x0c, 0x41,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x27, 0x2e, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
||||
0x12, 0x51, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x21, 0x2e, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e,
|
||||
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79,
|
||||
0x70, 0x65, 0x12, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54,
|
||||
0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xbe, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31,
|
||||
0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e,
|
||||
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, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02,
|
||||
0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02,
|
||||
0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73,
|
||||
0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
|
||||
0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -3784,22 +3815,25 @@ var file_cosmos_accounts_v1_query_proto_goTypes = []interface{}{
|
||||
(*AccountTypeRequest)(nil), // 4: cosmos.accounts.v1.AccountTypeRequest
|
||||
(*AccountTypeResponse)(nil), // 5: cosmos.accounts.v1.AccountTypeResponse
|
||||
(*SchemaResponse_Handler)(nil), // 6: cosmos.accounts.v1.SchemaResponse.Handler
|
||||
(*anypb.Any)(nil), // 7: google.protobuf.Any
|
||||
}
|
||||
var file_cosmos_accounts_v1_query_proto_depIdxs = []int32{
|
||||
6, // 0: cosmos.accounts.v1.SchemaResponse.init_schema:type_name -> cosmos.accounts.v1.SchemaResponse.Handler
|
||||
6, // 1: cosmos.accounts.v1.SchemaResponse.execute_handlers:type_name -> cosmos.accounts.v1.SchemaResponse.Handler
|
||||
6, // 2: cosmos.accounts.v1.SchemaResponse.query_handlers:type_name -> cosmos.accounts.v1.SchemaResponse.Handler
|
||||
0, // 3: cosmos.accounts.v1.Query.AccountQuery:input_type -> cosmos.accounts.v1.AccountQueryRequest
|
||||
2, // 4: cosmos.accounts.v1.Query.Schema:input_type -> cosmos.accounts.v1.SchemaRequest
|
||||
4, // 5: cosmos.accounts.v1.Query.AccountType:input_type -> cosmos.accounts.v1.AccountTypeRequest
|
||||
1, // 6: cosmos.accounts.v1.Query.AccountQuery:output_type -> cosmos.accounts.v1.AccountQueryResponse
|
||||
3, // 7: cosmos.accounts.v1.Query.Schema:output_type -> cosmos.accounts.v1.SchemaResponse
|
||||
5, // 8: cosmos.accounts.v1.Query.AccountType:output_type -> cosmos.accounts.v1.AccountTypeResponse
|
||||
6, // [6:9] is the sub-list for method output_type
|
||||
3, // [3:6] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
7, // 0: cosmos.accounts.v1.AccountQueryRequest.request:type_name -> google.protobuf.Any
|
||||
7, // 1: cosmos.accounts.v1.AccountQueryResponse.response:type_name -> google.protobuf.Any
|
||||
6, // 2: cosmos.accounts.v1.SchemaResponse.init_schema:type_name -> cosmos.accounts.v1.SchemaResponse.Handler
|
||||
6, // 3: cosmos.accounts.v1.SchemaResponse.execute_handlers:type_name -> cosmos.accounts.v1.SchemaResponse.Handler
|
||||
6, // 4: cosmos.accounts.v1.SchemaResponse.query_handlers:type_name -> cosmos.accounts.v1.SchemaResponse.Handler
|
||||
0, // 5: cosmos.accounts.v1.Query.AccountQuery:input_type -> cosmos.accounts.v1.AccountQueryRequest
|
||||
2, // 6: cosmos.accounts.v1.Query.Schema:input_type -> cosmos.accounts.v1.SchemaRequest
|
||||
4, // 7: cosmos.accounts.v1.Query.AccountType:input_type -> cosmos.accounts.v1.AccountTypeRequest
|
||||
1, // 8: cosmos.accounts.v1.Query.AccountQuery:output_type -> cosmos.accounts.v1.AccountQueryResponse
|
||||
3, // 9: cosmos.accounts.v1.Query.Schema:output_type -> cosmos.accounts.v1.SchemaResponse
|
||||
5, // 10: cosmos.accounts.v1.Query.AccountType:output_type -> cosmos.accounts.v1.AccountTypeResponse
|
||||
8, // [8:11] is the sub-list for method output_type
|
||||
5, // [5:8] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_cosmos_accounts_v1_query_proto_init() }
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoiface "google.golang.org/protobuf/runtime/protoiface"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
anypb "google.golang.org/protobuf/types/known/anypb"
|
||||
io "io"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
@ -105,8 +106,8 @@ func (x *fastReflection_MsgInit) Range(f func(protoreflect.FieldDescriptor, prot
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(x.Message) != 0 {
|
||||
value := protoreflect.ValueOfBytes(x.Message)
|
||||
if x.Message != nil {
|
||||
value := protoreflect.ValueOfMessage(x.Message.ProtoReflect())
|
||||
if !f(fd_MsgInit_message, value) {
|
||||
return
|
||||
}
|
||||
@ -131,7 +132,7 @@ func (x *fastReflection_MsgInit) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
case "cosmos.accounts.v1.MsgInit.account_type":
|
||||
return x.AccountType != ""
|
||||
case "cosmos.accounts.v1.MsgInit.message":
|
||||
return len(x.Message) != 0
|
||||
return x.Message != nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit"))
|
||||
@ -178,7 +179,7 @@ func (x *fastReflection_MsgInit) Get(descriptor protoreflect.FieldDescriptor) pr
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "cosmos.accounts.v1.MsgInit.message":
|
||||
value := x.Message
|
||||
return protoreflect.ValueOfBytes(value)
|
||||
return protoreflect.ValueOfMessage(value.ProtoReflect())
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit"))
|
||||
@ -204,7 +205,7 @@ func (x *fastReflection_MsgInit) Set(fd protoreflect.FieldDescriptor, value prot
|
||||
case "cosmos.accounts.v1.MsgInit.account_type":
|
||||
x.AccountType = value.Interface().(string)
|
||||
case "cosmos.accounts.v1.MsgInit.message":
|
||||
x.Message = value.Bytes()
|
||||
x.Message = value.Message().Interface().(*anypb.Any)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit"))
|
||||
@ -225,12 +226,15 @@ func (x *fastReflection_MsgInit) Set(fd protoreflect.FieldDescriptor, value prot
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_MsgInit) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.MsgInit.message":
|
||||
if x.Message == nil {
|
||||
x.Message = new(anypb.Any)
|
||||
}
|
||||
return protoreflect.ValueOfMessage(x.Message.ProtoReflect())
|
||||
case "cosmos.accounts.v1.MsgInit.sender":
|
||||
panic(fmt.Errorf("field sender of message cosmos.accounts.v1.MsgInit is not mutable"))
|
||||
case "cosmos.accounts.v1.MsgInit.account_type":
|
||||
panic(fmt.Errorf("field account_type of message cosmos.accounts.v1.MsgInit is not mutable"))
|
||||
case "cosmos.accounts.v1.MsgInit.message":
|
||||
panic(fmt.Errorf("field message of message cosmos.accounts.v1.MsgInit is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit"))
|
||||
@ -249,7 +253,8 @@ func (x *fastReflection_MsgInit) NewField(fd protoreflect.FieldDescriptor) proto
|
||||
case "cosmos.accounts.v1.MsgInit.account_type":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "cosmos.accounts.v1.MsgInit.message":
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
m := new(anypb.Any)
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInit"))
|
||||
@ -327,8 +332,8 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods {
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
l = len(x.Message)
|
||||
if l > 0 {
|
||||
if x.Message != nil {
|
||||
l = options.Size(x.Message)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
@ -360,10 +365,17 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.Message) > 0 {
|
||||
i -= len(x.Message)
|
||||
copy(dAtA[i:], x.Message)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Message)))
|
||||
if x.Message != nil {
|
||||
encoded, err := options.Marshal(x.Message)
|
||||
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
|
||||
}
|
||||
@ -498,7 +510,7 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods {
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Message", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
@ -508,24 +520,26 @@ func (x *fastReflection_MsgInit) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Message = append(x.Message[:0], dAtA[iNdEx:postIndex]...)
|
||||
if x.Message == nil {
|
||||
x.Message = []byte{}
|
||||
x.Message = &anypb.Any{}
|
||||
}
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Message); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -647,8 +661,8 @@ func (x *fastReflection_MsgInitResponse) Range(f func(protoreflect.FieldDescript
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(x.Response) != 0 {
|
||||
value := protoreflect.ValueOfBytes(x.Response)
|
||||
if x.Response != nil {
|
||||
value := protoreflect.ValueOfMessage(x.Response.ProtoReflect())
|
||||
if !f(fd_MsgInitResponse_response, value) {
|
||||
return
|
||||
}
|
||||
@ -671,7 +685,7 @@ func (x *fastReflection_MsgInitResponse) Has(fd protoreflect.FieldDescriptor) bo
|
||||
case "cosmos.accounts.v1.MsgInitResponse.account_address":
|
||||
return x.AccountAddress != ""
|
||||
case "cosmos.accounts.v1.MsgInitResponse.response":
|
||||
return len(x.Response) != 0
|
||||
return x.Response != nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse"))
|
||||
@ -713,7 +727,7 @@ func (x *fastReflection_MsgInitResponse) Get(descriptor protoreflect.FieldDescri
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "cosmos.accounts.v1.MsgInitResponse.response":
|
||||
value := x.Response
|
||||
return protoreflect.ValueOfBytes(value)
|
||||
return protoreflect.ValueOfMessage(value.ProtoReflect())
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse"))
|
||||
@ -737,7 +751,7 @@ func (x *fastReflection_MsgInitResponse) Set(fd protoreflect.FieldDescriptor, va
|
||||
case "cosmos.accounts.v1.MsgInitResponse.account_address":
|
||||
x.AccountAddress = value.Interface().(string)
|
||||
case "cosmos.accounts.v1.MsgInitResponse.response":
|
||||
x.Response = value.Bytes()
|
||||
x.Response = value.Message().Interface().(*anypb.Any)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse"))
|
||||
@ -758,10 +772,13 @@ func (x *fastReflection_MsgInitResponse) Set(fd protoreflect.FieldDescriptor, va
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_MsgInitResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.MsgInitResponse.response":
|
||||
if x.Response == nil {
|
||||
x.Response = new(anypb.Any)
|
||||
}
|
||||
return protoreflect.ValueOfMessage(x.Response.ProtoReflect())
|
||||
case "cosmos.accounts.v1.MsgInitResponse.account_address":
|
||||
panic(fmt.Errorf("field account_address of message cosmos.accounts.v1.MsgInitResponse is not mutable"))
|
||||
case "cosmos.accounts.v1.MsgInitResponse.response":
|
||||
panic(fmt.Errorf("field response of message cosmos.accounts.v1.MsgInitResponse is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse"))
|
||||
@ -778,7 +795,8 @@ func (x *fastReflection_MsgInitResponse) NewField(fd protoreflect.FieldDescripto
|
||||
case "cosmos.accounts.v1.MsgInitResponse.account_address":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "cosmos.accounts.v1.MsgInitResponse.response":
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
m := new(anypb.Any)
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgInitResponse"))
|
||||
@ -852,8 +870,8 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods {
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
l = len(x.Response)
|
||||
if l > 0 {
|
||||
if x.Response != nil {
|
||||
l = options.Size(x.Response)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
@ -885,10 +903,17 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.Response) > 0 {
|
||||
i -= len(x.Response)
|
||||
copy(dAtA[i:], x.Response)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Response)))
|
||||
if x.Response != nil {
|
||||
encoded, err := options.Marshal(x.Response)
|
||||
if err != nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, err
|
||||
}
|
||||
i -= len(encoded)
|
||||
copy(dAtA[i:], encoded)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -984,7 +1009,7 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods {
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Response", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
@ -994,24 +1019,26 @@ func (x *fastReflection_MsgInitResponse) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Response = append(x.Response[:0], dAtA[iNdEx:postIndex]...)
|
||||
if x.Response == nil {
|
||||
x.Response = []byte{}
|
||||
x.Response = &anypb.Any{}
|
||||
}
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Response); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -1141,8 +1168,8 @@ func (x *fastReflection_MsgExecute) Range(f func(protoreflect.FieldDescriptor, p
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(x.Message) != 0 {
|
||||
value := protoreflect.ValueOfBytes(x.Message)
|
||||
if x.Message != nil {
|
||||
value := protoreflect.ValueOfMessage(x.Message.ProtoReflect())
|
||||
if !f(fd_MsgExecute_message, value) {
|
||||
return
|
||||
}
|
||||
@ -1167,7 +1194,7 @@ func (x *fastReflection_MsgExecute) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
case "cosmos.accounts.v1.MsgExecute.target":
|
||||
return x.Target != ""
|
||||
case "cosmos.accounts.v1.MsgExecute.message":
|
||||
return len(x.Message) != 0
|
||||
return x.Message != nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute"))
|
||||
@ -1214,7 +1241,7 @@ func (x *fastReflection_MsgExecute) Get(descriptor protoreflect.FieldDescriptor)
|
||||
return protoreflect.ValueOfString(value)
|
||||
case "cosmos.accounts.v1.MsgExecute.message":
|
||||
value := x.Message
|
||||
return protoreflect.ValueOfBytes(value)
|
||||
return protoreflect.ValueOfMessage(value.ProtoReflect())
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute"))
|
||||
@ -1240,7 +1267,7 @@ func (x *fastReflection_MsgExecute) Set(fd protoreflect.FieldDescriptor, value p
|
||||
case "cosmos.accounts.v1.MsgExecute.target":
|
||||
x.Target = value.Interface().(string)
|
||||
case "cosmos.accounts.v1.MsgExecute.message":
|
||||
x.Message = value.Bytes()
|
||||
x.Message = value.Message().Interface().(*anypb.Any)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute"))
|
||||
@ -1261,12 +1288,15 @@ func (x *fastReflection_MsgExecute) Set(fd protoreflect.FieldDescriptor, value p
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_MsgExecute) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.MsgExecute.message":
|
||||
if x.Message == nil {
|
||||
x.Message = new(anypb.Any)
|
||||
}
|
||||
return protoreflect.ValueOfMessage(x.Message.ProtoReflect())
|
||||
case "cosmos.accounts.v1.MsgExecute.sender":
|
||||
panic(fmt.Errorf("field sender of message cosmos.accounts.v1.MsgExecute is not mutable"))
|
||||
case "cosmos.accounts.v1.MsgExecute.target":
|
||||
panic(fmt.Errorf("field target of message cosmos.accounts.v1.MsgExecute is not mutable"))
|
||||
case "cosmos.accounts.v1.MsgExecute.message":
|
||||
panic(fmt.Errorf("field message of message cosmos.accounts.v1.MsgExecute is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute"))
|
||||
@ -1285,7 +1315,8 @@ func (x *fastReflection_MsgExecute) NewField(fd protoreflect.FieldDescriptor) pr
|
||||
case "cosmos.accounts.v1.MsgExecute.target":
|
||||
return protoreflect.ValueOfString("")
|
||||
case "cosmos.accounts.v1.MsgExecute.message":
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
m := new(anypb.Any)
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecute"))
|
||||
@ -1363,8 +1394,8 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods {
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
l = len(x.Message)
|
||||
if l > 0 {
|
||||
if x.Message != nil {
|
||||
l = options.Size(x.Message)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
@ -1396,10 +1427,17 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.Message) > 0 {
|
||||
i -= len(x.Message)
|
||||
copy(dAtA[i:], x.Message)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Message)))
|
||||
if x.Message != nil {
|
||||
encoded, err := options.Marshal(x.Message)
|
||||
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
|
||||
}
|
||||
@ -1534,7 +1572,7 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods {
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Message", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
@ -1544,24 +1582,26 @@ func (x *fastReflection_MsgExecute) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Message = append(x.Message[:0], dAtA[iNdEx:postIndex]...)
|
||||
if x.Message == nil {
|
||||
x.Message = []byte{}
|
||||
x.Message = &anypb.Any{}
|
||||
}
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Message); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -1675,8 +1715,8 @@ func (x *fastReflection_MsgExecuteResponse) Interface() protoreflect.ProtoMessag
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_MsgExecuteResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if len(x.Response) != 0 {
|
||||
value := protoreflect.ValueOfBytes(x.Response)
|
||||
if x.Response != nil {
|
||||
value := protoreflect.ValueOfMessage(x.Response.ProtoReflect())
|
||||
if !f(fd_MsgExecuteResponse_response, value) {
|
||||
return
|
||||
}
|
||||
@ -1697,7 +1737,7 @@ func (x *fastReflection_MsgExecuteResponse) Range(f func(protoreflect.FieldDescr
|
||||
func (x *fastReflection_MsgExecuteResponse) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.MsgExecuteResponse.response":
|
||||
return len(x.Response) != 0
|
||||
return x.Response != nil
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse"))
|
||||
@ -1734,7 +1774,7 @@ func (x *fastReflection_MsgExecuteResponse) Get(descriptor protoreflect.FieldDes
|
||||
switch descriptor.FullName() {
|
||||
case "cosmos.accounts.v1.MsgExecuteResponse.response":
|
||||
value := x.Response
|
||||
return protoreflect.ValueOfBytes(value)
|
||||
return protoreflect.ValueOfMessage(value.ProtoReflect())
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse"))
|
||||
@ -1756,7 +1796,7 @@ func (x *fastReflection_MsgExecuteResponse) Get(descriptor protoreflect.FieldDes
|
||||
func (x *fastReflection_MsgExecuteResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.MsgExecuteResponse.response":
|
||||
x.Response = value.Bytes()
|
||||
x.Response = value.Message().Interface().(*anypb.Any)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse"))
|
||||
@ -1778,7 +1818,10 @@ func (x *fastReflection_MsgExecuteResponse) Set(fd protoreflect.FieldDescriptor,
|
||||
func (x *fastReflection_MsgExecuteResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.MsgExecuteResponse.response":
|
||||
panic(fmt.Errorf("field response of message cosmos.accounts.v1.MsgExecuteResponse is not mutable"))
|
||||
if x.Response == nil {
|
||||
x.Response = new(anypb.Any)
|
||||
}
|
||||
return protoreflect.ValueOfMessage(x.Response.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse"))
|
||||
@ -1793,7 +1836,8 @@ func (x *fastReflection_MsgExecuteResponse) Mutable(fd protoreflect.FieldDescrip
|
||||
func (x *fastReflection_MsgExecuteResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
case "cosmos.accounts.v1.MsgExecuteResponse.response":
|
||||
return protoreflect.ValueOfBytes(nil)
|
||||
m := new(anypb.Any)
|
||||
return protoreflect.ValueOfMessage(m.ProtoReflect())
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.accounts.v1.MsgExecuteResponse"))
|
||||
@ -1863,8 +1907,8 @@ func (x *fastReflection_MsgExecuteResponse) ProtoMethods() *protoiface.Methods {
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
l = len(x.Response)
|
||||
if l > 0 {
|
||||
if x.Response != nil {
|
||||
l = options.Size(x.Response)
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
@ -1896,10 +1940,17 @@ func (x *fastReflection_MsgExecuteResponse) ProtoMethods() *protoiface.Methods {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.Response) > 0 {
|
||||
i -= len(x.Response)
|
||||
copy(dAtA[i:], x.Response)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Response)))
|
||||
if x.Response != nil {
|
||||
encoded, err := options.Marshal(x.Response)
|
||||
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
|
||||
}
|
||||
@ -1956,7 +2007,7 @@ func (x *fastReflection_MsgExecuteResponse) ProtoMethods() *protoiface.Methods {
|
||||
if wireType != 2 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Response", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
@ -1966,24 +2017,26 @@ func (x *fastReflection_MsgExecuteResponse) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
x.Response = append(x.Response[:0], dAtA[iNdEx:postIndex]...)
|
||||
if x.Response == nil {
|
||||
x.Response = []byte{}
|
||||
x.Response = &anypb.Any{}
|
||||
}
|
||||
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Response); err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -3096,10 +3149,8 @@ type MsgInit struct {
|
||||
Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// account_type is the type of the account to be created.
|
||||
AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"`
|
||||
// message is the message to be sent to the account, it's up to the account
|
||||
// implementation to decide what encoding format should be used to interpret
|
||||
// this message.
|
||||
Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
// message is the message to be sent to the account.
|
||||
Message *anypb.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MsgInit) Reset() {
|
||||
@ -3136,7 +3187,7 @@ func (x *MsgInit) GetAccountType() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MsgInit) GetMessage() []byte {
|
||||
func (x *MsgInit) GetMessage() *anypb.Any {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
@ -3152,7 +3203,7 @@ type MsgInitResponse struct {
|
||||
// account_address is the address of the newly created account.
|
||||
AccountAddress string `protobuf:"bytes,1,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"`
|
||||
// response is the response returned by the account implementation.
|
||||
Response []byte `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
|
||||
Response *anypb.Any `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MsgInitResponse) Reset() {
|
||||
@ -3182,7 +3233,7 @@ func (x *MsgInitResponse) GetAccountAddress() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MsgInitResponse) GetResponse() []byte {
|
||||
func (x *MsgInitResponse) GetResponse() *anypb.Any {
|
||||
if x != nil {
|
||||
return x.Response
|
||||
}
|
||||
@ -3199,8 +3250,8 @@ type MsgExecute struct {
|
||||
Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// target is the address of the account to be executed.
|
||||
Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
|
||||
// message is the message to be sent to the account, it's up to the account
|
||||
Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
// message is the message to be sent to the account.
|
||||
Message *anypb.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MsgExecute) Reset() {
|
||||
@ -3237,7 +3288,7 @@ func (x *MsgExecute) GetTarget() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MsgExecute) GetMessage() []byte {
|
||||
func (x *MsgExecute) GetMessage() *anypb.Any {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
@ -3251,7 +3302,7 @@ type MsgExecuteResponse struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// response is the response returned by the account implementation.
|
||||
Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
|
||||
Response *anypb.Any `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MsgExecuteResponse) Reset() {
|
||||
@ -3274,7 +3325,7 @@ func (*MsgExecuteResponse) Descriptor() ([]byte, []int) {
|
||||
return file_cosmos_accounts_v1_tx_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *MsgExecuteResponse) GetResponse() []byte {
|
||||
func (x *MsgExecuteResponse) GetResponse() *anypb.Any {
|
||||
if x != nil {
|
||||
return x.Response
|
||||
}
|
||||
@ -3371,76 +3422,84 @@ var file_cosmos_accounts_v1_tx_proto_rawDesc = []byte{
|
||||
0x0a, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x63,
|
||||
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76,
|
||||
0x31, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31,
|
||||
0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6b, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x49,
|
||||
0x6e, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x18,
|
||||
0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73,
|
||||
0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x56, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||
0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x63, 0x0a,
|
||||
0x0a, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73,
|
||||
0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e,
|
||||
0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64,
|
||||
0x65, 0x72, 0x22, 0x30, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7d, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75,
|
||||
0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x6e, 0x64,
|
||||
0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x75, 0x6e, 0x64, 0x6c,
|
||||
0x65, 0x72, 0x12, 0x41, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
|
||||
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, 0x1a, 0x17, 0x63, 0x6f,
|
||||
0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x5f, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x22, 0x81, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x2e, 0x0a, 0x07, 0x6d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 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, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a,
|
||||
0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x6c, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x49, 0x6e,
|
||||
0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x72, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x79, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63,
|
||||
0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x74,
|
||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72,
|
||||
0x67, 0x65, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 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, 0x07, 0x6d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72,
|
||||
0x22, 0x46, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 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, 0x08,
|
||||
0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7d, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x45,
|
||||
0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62,
|
||||
0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x55, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f,
|
||||
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07,
|
||||
0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x22, 0x63, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x45, 0x78,
|
||||
0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73,
|
||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
|
||||
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72,
|
||||
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x62, 0x75, 0x6e, 0x64,
|
||||
0x6c, 0x65, 0x72, 0x22, 0x63, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74,
|
||||
0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x47, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x8e, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67,
|
||||
0x12, 0x48, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x8e, 0x02, 0x0a,
|
||||
0x03, 0x4d, 0x73, 0x67, 0x12, 0x48, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x1b, 0x2e, 0x63,
|
||||
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d,
|
||||
0x73, 0x67, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51,
|
||||
0x0a, 0x07, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d,
|
||||
0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d,
|
||||
0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x63, 0x0a, 0x0d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64,
|
||||
0x6c, 0x65, 0x12, 0x24, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75,
|
||||
0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73,
|
||||
0x67, 0x49, 0x6e, 0x69, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x49, 0x6e,
|
||||
0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x07, 0x45, 0x78,
|
||||
0x65, 0x63, 0x75, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78,
|
||||
0x65, 0x63, 0x75, 0x74, 0x65, 0x1a, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78,
|
||||
0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a,
|
||||
0x0d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x24,
|
||||
0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75,
|
||||
0x6e, 0x64, 0x6c, 0x65, 0x1a, 0x2c, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x65,
|
||||
0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbb, 0x01, 0x0a, 0x16, 0x63, 0x6f,
|
||||
0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
|
||||
0x2e, 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, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x76, 0x31, 0xa2,
|
||||
0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x43, 0x6f, 0x73,
|
||||
0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2,
|
||||
0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
|
||||
0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x63, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x67, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbb, 0x01,
|
||||
0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x50, 0x01, 0x5a, 0x2e, 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, 0x76, 0x31, 0x3b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x12, 0x43, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02,
|
||||
0x12, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73,
|
||||
0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x63, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41,
|
||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -3463,23 +3522,28 @@ var file_cosmos_accounts_v1_tx_proto_goTypes = []interface{}{
|
||||
(*MsgExecuteResponse)(nil), // 3: cosmos.accounts.v1.MsgExecuteResponse
|
||||
(*MsgExecuteBundle)(nil), // 4: cosmos.accounts.v1.MsgExecuteBundle
|
||||
(*MsgExecuteBundleResponse)(nil), // 5: cosmos.accounts.v1.MsgExecuteBundleResponse
|
||||
(*UserOperation)(nil), // 6: cosmos.accounts.v1.UserOperation
|
||||
(*UserOperationResponse)(nil), // 7: cosmos.accounts.v1.UserOperationResponse
|
||||
(*anypb.Any)(nil), // 6: google.protobuf.Any
|
||||
(*UserOperation)(nil), // 7: cosmos.accounts.v1.UserOperation
|
||||
(*UserOperationResponse)(nil), // 8: cosmos.accounts.v1.UserOperationResponse
|
||||
}
|
||||
var file_cosmos_accounts_v1_tx_proto_depIdxs = []int32{
|
||||
6, // 0: cosmos.accounts.v1.MsgExecuteBundle.operations:type_name -> cosmos.accounts.v1.UserOperation
|
||||
7, // 1: cosmos.accounts.v1.MsgExecuteBundleResponse.responses:type_name -> cosmos.accounts.v1.UserOperationResponse
|
||||
0, // 2: cosmos.accounts.v1.Msg.Init:input_type -> cosmos.accounts.v1.MsgInit
|
||||
2, // 3: cosmos.accounts.v1.Msg.Execute:input_type -> cosmos.accounts.v1.MsgExecute
|
||||
4, // 4: cosmos.accounts.v1.Msg.ExecuteBundle:input_type -> cosmos.accounts.v1.MsgExecuteBundle
|
||||
1, // 5: cosmos.accounts.v1.Msg.Init:output_type -> cosmos.accounts.v1.MsgInitResponse
|
||||
3, // 6: cosmos.accounts.v1.Msg.Execute:output_type -> cosmos.accounts.v1.MsgExecuteResponse
|
||||
5, // 7: cosmos.accounts.v1.Msg.ExecuteBundle:output_type -> cosmos.accounts.v1.MsgExecuteBundleResponse
|
||||
5, // [5:8] is the sub-list for method output_type
|
||||
2, // [2:5] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
6, // 0: cosmos.accounts.v1.MsgInit.message:type_name -> google.protobuf.Any
|
||||
6, // 1: cosmos.accounts.v1.MsgInitResponse.response:type_name -> google.protobuf.Any
|
||||
6, // 2: cosmos.accounts.v1.MsgExecute.message:type_name -> google.protobuf.Any
|
||||
6, // 3: cosmos.accounts.v1.MsgExecuteResponse.response:type_name -> google.protobuf.Any
|
||||
7, // 4: cosmos.accounts.v1.MsgExecuteBundle.operations:type_name -> cosmos.accounts.v1.UserOperation
|
||||
8, // 5: cosmos.accounts.v1.MsgExecuteBundleResponse.responses:type_name -> cosmos.accounts.v1.UserOperationResponse
|
||||
0, // 6: cosmos.accounts.v1.Msg.Init:input_type -> cosmos.accounts.v1.MsgInit
|
||||
2, // 7: cosmos.accounts.v1.Msg.Execute:input_type -> cosmos.accounts.v1.MsgExecute
|
||||
4, // 8: cosmos.accounts.v1.Msg.ExecuteBundle:input_type -> cosmos.accounts.v1.MsgExecuteBundle
|
||||
1, // 9: cosmos.accounts.v1.Msg.Init:output_type -> cosmos.accounts.v1.MsgInitResponse
|
||||
3, // 10: cosmos.accounts.v1.Msg.Execute:output_type -> cosmos.accounts.v1.MsgExecuteResponse
|
||||
5, // 11: cosmos.accounts.v1.Msg.ExecuteBundle:output_type -> cosmos.accounts.v1.MsgExecuteBundleResponse
|
||||
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_accounts_v1_tx_proto_init() }
|
||||
|
||||
@ -44,12 +44,7 @@ func RejectUnknownFields(bz []byte, msg proto.Message, allowUnknownNonCriticals
|
||||
return hasUnknownNonCriticals, nil
|
||||
}
|
||||
|
||||
desc, ok := msg.(descriptorIface)
|
||||
if !ok {
|
||||
return hasUnknownNonCriticals, fmt.Errorf("%T does not have a Descriptor() method", msg)
|
||||
}
|
||||
|
||||
fieldDescProtoFromTagNum, _, err := getDescriptorInfo(desc, msg)
|
||||
fieldDescProtoFromTagNum, _, err := getDescriptorInfo(msg)
|
||||
if err != nil {
|
||||
return hasUnknownNonCriticals, err
|
||||
}
|
||||
@ -345,7 +340,11 @@ func unnestDesc(mdescs []*descriptorpb.DescriptorProto, indices []int) *descript
|
||||
|
||||
// Invoking descriptorpb.ForMessage(proto.Message.(Descriptor).Descriptor()) is incredibly slow
|
||||
// for every single message, thus the need for a hand-rolled custom version that's performant and cacheable.
|
||||
func extractFileDescMessageDesc(desc descriptorIface) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto, error) {
|
||||
func extractFileDescMessageDesc(msg proto.Message) (*descriptorpb.FileDescriptorProto, *descriptorpb.DescriptorProto, error) {
|
||||
desc, ok := msg.(descriptorIface)
|
||||
if !ok {
|
||||
return nil, nil, fmt.Errorf("%T does not have a Descriptor() method", msg)
|
||||
}
|
||||
gzippedPb, indices := desc.Descriptor()
|
||||
|
||||
protoFileToDescMu.RLock()
|
||||
@ -391,7 +390,8 @@ var (
|
||||
)
|
||||
|
||||
// getDescriptorInfo retrieves the mapping of field numbers to their respective field descriptors.
|
||||
func getDescriptorInfo(desc descriptorIface, msg proto.Message) (map[int32]*descriptorpb.FieldDescriptorProto, *descriptorpb.DescriptorProto, error) {
|
||||
func getDescriptorInfo(msg proto.Message) (map[int32]*descriptorpb.FieldDescriptorProto, *descriptorpb.DescriptorProto, error) {
|
||||
// we immediately check if the desc is present in the desc
|
||||
key := reflect.ValueOf(msg).Type()
|
||||
|
||||
descprotoCacheMu.RLock()
|
||||
@ -403,7 +403,7 @@ func getDescriptorInfo(desc descriptorIface, msg proto.Message) (map[int32]*desc
|
||||
}
|
||||
|
||||
// Now compute and cache the index.
|
||||
_, md, err := extractFileDescMessageDesc(desc)
|
||||
_, md, err := extractFileDescMessageDesc(msg)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
@ -5,14 +5,12 @@ package secp256k1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
|
||||
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
@ -5,6 +5,8 @@ package cosmos.accounts.interfaces.account_abstraction.v1;
|
||||
import "google/protobuf/any.proto";
|
||||
import "cosmos/accounts/v1/account_abstraction.proto";
|
||||
|
||||
option go_package = "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1";
|
||||
|
||||
// MsgAuthenticate is a message that an x/account account abstraction implementer
|
||||
// must handle to authenticate a state transition.
|
||||
message MsgAuthenticate {
|
||||
|
||||
@ -2,6 +2,8 @@ syntax = "proto3";
|
||||
|
||||
package cosmos.accounts.testing.counter.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/accounts/testing/counter/v1";
|
||||
|
||||
// MsgInit defines a message which initializes the counter with a given amount.
|
||||
message MsgInit {
|
||||
// initial_value is the initial amount to set the counter to.
|
||||
|
||||
@ -2,6 +2,8 @@ syntax = "proto3";
|
||||
|
||||
package cosmos.accounts.testing.rotation.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/accounts/testing/rotation/v1";
|
||||
|
||||
// MsgInit is the init message used to create a new account
|
||||
// abstraction implementation that we use for testing, this account
|
||||
// also allows for rotating the public key.
|
||||
|
||||
@ -4,6 +4,8 @@ package cosmos.accounts.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/accounts/v1";
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
// Query defines the Query service for the x/accounts module.
|
||||
service Query {
|
||||
// AccountQuery runs an account query.
|
||||
@ -19,13 +21,13 @@ message AccountQueryRequest {
|
||||
// target defines the account to be queried.
|
||||
string target = 1;
|
||||
// request defines the query message being sent to the account.
|
||||
bytes request = 2;
|
||||
google.protobuf.Any request = 2;
|
||||
}
|
||||
|
||||
// AccountQueryResponse is the response type for the Query/AccountQuery RPC method.
|
||||
message AccountQueryResponse {
|
||||
// response defines the query response of the account.
|
||||
bytes response = 1;
|
||||
google.protobuf.Any response = 1;
|
||||
}
|
||||
|
||||
// SchemaResponse is the response type for the Query/Schema RPC method.
|
||||
|
||||
@ -4,6 +4,7 @@ package cosmos.accounts.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/accounts/v1";
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "cosmos/accounts/v1/account_abstraction.proto";
|
||||
|
||||
@ -30,10 +31,8 @@ message MsgInit {
|
||||
string sender = 1;
|
||||
// account_type is the type of the account to be created.
|
||||
string account_type = 2;
|
||||
// message is the message to be sent to the account, it's up to the account
|
||||
// implementation to decide what encoding format should be used to interpret
|
||||
// this message.
|
||||
bytes message = 3;
|
||||
// message is the message to be sent to the account.
|
||||
google.protobuf.Any message = 3;
|
||||
}
|
||||
|
||||
// MsgInitResponse defines the Create response type for the Msg/Create RPC method.
|
||||
@ -41,7 +40,7 @@ message MsgInitResponse {
|
||||
// account_address is the address of the newly created account.
|
||||
string account_address = 1;
|
||||
// response is the response returned by the account implementation.
|
||||
bytes response = 2;
|
||||
google.protobuf.Any response = 2;
|
||||
}
|
||||
|
||||
// MsgExecute defines the Execute request type for the Msg/Execute RPC method.
|
||||
@ -51,14 +50,14 @@ message MsgExecute {
|
||||
string sender = 1;
|
||||
// target is the address of the account to be executed.
|
||||
string target = 2;
|
||||
// message is the message to be sent to the account, it's up to the account
|
||||
bytes message = 3;
|
||||
// message is the message to be sent to the account.
|
||||
google.protobuf.Any message = 3;
|
||||
}
|
||||
|
||||
// MsgExecuteResponse defines the Execute response type for the Msg/Execute RPC method.
|
||||
message MsgExecuteResponse {
|
||||
// response is the response returned by the account implementation.
|
||||
bytes response = 1;
|
||||
google.protobuf.Any response = 1;
|
||||
}
|
||||
|
||||
// -------- Account Abstraction ---------
|
||||
|
||||
@ -287,9 +287,10 @@ func NewSimApp(
|
||||
runtime.EventService{},
|
||||
runtime.BranchService{},
|
||||
app.AuthKeeper.AddressCodec(),
|
||||
appCodec.InterfaceRegistry().SigningContext(),
|
||||
appCodec,
|
||||
app.MsgServiceRouter(),
|
||||
app.GRPCQueryRouter(),
|
||||
appCodec.InterfaceRegistry(),
|
||||
accountstd.AddAccount("counter", counter.NewAccount),
|
||||
accountstd.AddAccount("aa_minimal", account_abstraction.NewMinimalAbstractedAccount),
|
||||
accountstd.AddAccount("aa_full", account_abstraction.NewFullAbstractedAccount),
|
||||
|
||||
@ -6,22 +6,19 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
rotationv1 "cosmossdk.io/api/cosmos/accounts/testing/rotation/v1"
|
||||
accountsv1 "cosmossdk.io/api/cosmos/accounts/v1"
|
||||
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
|
||||
v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
|
||||
nftv1beta1 "cosmossdk.io/api/cosmos/nft/v1beta1"
|
||||
stakingv1beta1 "cosmossdk.io/api/cosmos/staking/v1beta1"
|
||||
"cosmossdk.io/simapp"
|
||||
"cosmossdk.io/x/accounts"
|
||||
rotationv1 "cosmossdk.io/x/accounts/testing/rotation/v1"
|
||||
accountsv1 "cosmossdk.io/x/accounts/v1"
|
||||
"cosmossdk.io/x/bank/testutil"
|
||||
banktypes "cosmossdk.io/x/bank/types"
|
||||
"cosmossdk.io/x/nft"
|
||||
"github.com/cosmos/cosmos-proto/anyutil"
|
||||
stakingtypes "cosmossdk.io/x/staking/types"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -70,13 +67,13 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationMethod: "secp256k1",
|
||||
AuthenticationData: []byte("signature"),
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaAddrStr,
|
||||
ToAddress: bundlerAddrStr,
|
||||
Amount: coins(t, "1stake"), // the sender is the AA, so it has the coins and wants to pay the bundler for the gas
|
||||
}),
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaAddrStr,
|
||||
ToAddress: aliceAddrStr,
|
||||
Amount: coins(t, "2000stake"), // as the real action the sender wants to send coins to alice
|
||||
@ -103,13 +100,13 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationMethod: "secp256k1",
|
||||
AuthenticationData: []byte("signature"),
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: bundlerAddrStr, // abstracted account tries to send money from bundler to itself.
|
||||
ToAddress: aaAddrStr,
|
||||
Amount: coins(t, "1stake"),
|
||||
}),
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaAddrStr,
|
||||
ToAddress: aliceAddrStr,
|
||||
Amount: coins(t, "2000stake"), // as the real action the sender wants to send coins to alice
|
||||
@ -130,13 +127,13 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationMethod: "secp256k1",
|
||||
AuthenticationData: []byte("signature"),
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaAddrStr,
|
||||
ToAddress: bundlerAddrStr,
|
||||
Amount: coins(t, "1stake"),
|
||||
}),
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aliceAddrStr, // abstracted account attempts to send money from alice to itself
|
||||
ToAddress: aaAddrStr,
|
||||
Amount: coins(t, "2000stake"),
|
||||
@ -159,13 +156,13 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationMethod: "invalid",
|
||||
AuthenticationData: []byte("signature"),
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaAddrStr,
|
||||
ToAddress: bundlerAddrStr,
|
||||
Amount: coins(t, "1stake"),
|
||||
}),
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aliceAddrStr, // abstracted account attempts to send money from alice to itself
|
||||
ToAddress: aaAddrStr,
|
||||
Amount: coins(t, "2000stake"),
|
||||
@ -189,13 +186,13 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationMethod: "secp256k1",
|
||||
AuthenticationData: []byte("signature"),
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaAddrStr,
|
||||
ToAddress: bundlerAddrStr,
|
||||
Amount: coins(t, "1atom"), // abstracted account does not have enough money to pay the bundler, since it does not hold atom
|
||||
}),
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aliceAddrStr, // abstracted account attempts to send money from alice to itself
|
||||
ToAddress: aaAddrStr,
|
||||
Amount: coins(t, "2000stake"),
|
||||
@ -218,13 +215,13 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationMethod: "secp256k1",
|
||||
AuthenticationData: []byte("signature"),
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaAddrStr,
|
||||
ToAddress: bundlerAddrStr,
|
||||
Amount: coins(t, "1stake"),
|
||||
}),
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaAddrStr,
|
||||
ToAddress: aliceAddrStr,
|
||||
Amount: coins(t, "2000atom"), // abstracted account does not have enough money to pay alice, since it does not hold atom
|
||||
@ -247,13 +244,13 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationMethod: "secp256k1",
|
||||
AuthenticationData: []byte("signature"),
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaFullAddrStr,
|
||||
ToAddress: bundlerAddrStr,
|
||||
Amount: coins(t, "1stake"), // we expect this to fail since the account is implement in such a way not to allow bank sends.
|
||||
}),
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaFullAddrStr,
|
||||
ToAddress: aliceAddrStr,
|
||||
Amount: coins(t, "2000stake"),
|
||||
@ -273,7 +270,7 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: nil,
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &stakingv1beta1.MsgDelegate{
|
||||
ExecutionMessages: intoAny(t, &stakingtypes.MsgDelegate{
|
||||
DelegatorAddress: aaFullAddrStr,
|
||||
ValidatorAddress: "some-validator",
|
||||
Amount: coins(t, "2000stake")[0],
|
||||
@ -300,14 +297,14 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
AuthenticationMethod: "secp256k1",
|
||||
AuthenticationData: []byte("signature"),
|
||||
AuthenticationGasLimit: 10000,
|
||||
BundlerPaymentMessages: intoAny(t, &nftv1beta1.MsgSend{
|
||||
BundlerPaymentMessages: intoAny(t, &nft.MsgSend{
|
||||
ClassId: "omega-rare",
|
||||
Id: "the-most-rare",
|
||||
Sender: aaFullAddrStr,
|
||||
Receiver: bundlerAddrStr,
|
||||
}),
|
||||
BundlerPaymentGasLimit: 50000,
|
||||
ExecutionMessages: intoAny(t, &bankv1beta1.MsgSend{
|
||||
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
|
||||
FromAddress: aaFullAddrStr,
|
||||
ToAddress: aliceAddrStr,
|
||||
Amount: coins(t, "2000stake"),
|
||||
@ -318,28 +315,21 @@ func TestAccountAbstraction(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func intoAny(t *testing.T, msgs ...proto.Message) (anys []*anypb.Any) {
|
||||
func intoAny(t *testing.T, msgs ...gogoproto.Message) (anys []*codectypes.Any) {
|
||||
t.Helper()
|
||||
for _, msg := range msgs {
|
||||
any, err := anyutil.New(msg)
|
||||
any, err := codectypes.NewAnyWithValue(msg)
|
||||
require.NoError(t, err)
|
||||
anys = append(anys, any)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func coins(t *testing.T, s string) []*v1beta1.Coin {
|
||||
func coins(t *testing.T, s string) sdk.Coins {
|
||||
t.Helper()
|
||||
coins, err := sdk.ParseCoinsNormalized(s)
|
||||
require.NoError(t, err)
|
||||
coinsv2 := make([]*v1beta1.Coin, len(coins))
|
||||
for i, coin := range coins {
|
||||
coinsv2[i] = &v1beta1.Coin{
|
||||
Denom: coin.Denom,
|
||||
Amount: coin.Amount.String(),
|
||||
}
|
||||
}
|
||||
return coinsv2
|
||||
return coins
|
||||
}
|
||||
|
||||
func balanceIs(t *testing.T, ctx context.Context, app *simapp.SimApp, addr sdk.AccAddress, s string) {
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
package accounts
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"cosmossdk.io/simapp"
|
||||
)
|
||||
|
||||
func setupApp(t *testing.T) *simapp.SimApp {
|
||||
t.Helper()
|
||||
app := simapp.Setup(t, false)
|
||||
return app
|
||||
}
|
||||
@ -4,8 +4,7 @@ import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
"github.com/cosmos/gogoproto/types"
|
||||
|
||||
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
|
||||
basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
|
||||
@ -27,32 +26,32 @@ type TestAccount struct {
|
||||
}
|
||||
|
||||
func (t TestAccount) RegisterInitHandler(builder *implementation.InitBuilder) {
|
||||
implementation.RegisterInitHandler(builder, func(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
|
||||
implementation.RegisterInitHandler(builder, func(ctx context.Context, _ *types.Empty) (*types.Empty, error) {
|
||||
// we also force a module call here to test things work as expected.
|
||||
_, err := implementation.QueryModule[bankv1beta1.QueryBalanceResponse](ctx, &bankv1beta1.QueryBalanceRequest{
|
||||
Address: string(implementation.Whoami(ctx)),
|
||||
Denom: "atom",
|
||||
})
|
||||
return &emptypb.Empty{}, err
|
||||
return &types.Empty{}, err
|
||||
})
|
||||
}
|
||||
|
||||
func (t TestAccount) RegisterExecuteHandlers(builder *implementation.ExecuteBuilder) {
|
||||
implementation.RegisterExecuteHandler(builder, func(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, nil
|
||||
implementation.RegisterExecuteHandler(builder, func(_ context.Context, _ *types.Empty) (*types.Empty, error) {
|
||||
return &types.Empty{}, nil
|
||||
})
|
||||
|
||||
implementation.RegisterExecuteHandler(builder, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.UInt64Value, error) {
|
||||
implementation.RegisterExecuteHandler(builder, func(_ context.Context, req *types.StringValue) (*types.UInt64Value, error) {
|
||||
value, err := strconv.ParseUint(req.Value, 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return wrapperspb.UInt64(value), nil
|
||||
return &types.UInt64Value{Value: value}, nil
|
||||
})
|
||||
|
||||
// this is for intermodule comms testing, we simulate a bank send
|
||||
implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *wrapperspb.Int64Value) (*emptypb.Empty, error) {
|
||||
implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *types.Int64Value) (*types.Empty, error) {
|
||||
resp, err := implementation.ExecModule[bankv1beta1.MsgSendResponse](ctx, &bankv1beta1.MsgSend{
|
||||
FromAddress: string(implementation.Whoami(ctx)),
|
||||
ToAddress: "recipient",
|
||||
@ -70,27 +69,27 @@ func (t TestAccount) RegisterExecuteHandlers(builder *implementation.ExecuteBuil
|
||||
panic("nil response") // should never happen
|
||||
}
|
||||
|
||||
return &emptypb.Empty{}, nil
|
||||
return &types.Empty{}, nil
|
||||
})
|
||||
|
||||
// genesis testing
|
||||
implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *wrapperspb.UInt64Value) (*emptypb.Empty, error) {
|
||||
return new(emptypb.Empty), t.Counter.Set(ctx, req.Value)
|
||||
implementation.RegisterExecuteHandler(builder, func(ctx context.Context, req *types.UInt64Value) (*types.Empty, error) {
|
||||
return &types.Empty{}, t.Counter.Set(ctx, req.Value)
|
||||
})
|
||||
}
|
||||
|
||||
func (t TestAccount) RegisterQueryHandlers(builder *implementation.QueryBuilder) {
|
||||
implementation.RegisterQueryHandler(builder, func(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, nil
|
||||
implementation.RegisterQueryHandler(builder, func(_ context.Context, _ *types.Empty) (*types.Empty, error) {
|
||||
return &types.Empty{}, nil
|
||||
})
|
||||
|
||||
implementation.RegisterQueryHandler(builder, func(_ context.Context, req *wrapperspb.UInt64Value) (*wrapperspb.StringValue, error) {
|
||||
return wrapperspb.String(strconv.FormatUint(req.Value, 10)), nil
|
||||
implementation.RegisterQueryHandler(builder, func(_ context.Context, req *types.UInt64Value) (*types.StringValue, error) {
|
||||
return &types.StringValue{Value: strconv.FormatUint(req.Value, 10)}, nil
|
||||
})
|
||||
|
||||
// test intermodule comms, we simulate someone is sending the account a request for the accounts balance
|
||||
// of a given denom.
|
||||
implementation.RegisterQueryHandler(builder, func(ctx context.Context, req *wrapperspb.StringValue) (*wrapperspb.Int64Value, error) {
|
||||
implementation.RegisterQueryHandler(builder, func(ctx context.Context, req *types.StringValue) (*types.Int64Value, error) {
|
||||
resp, err := implementation.QueryModule[bankv1beta1.QueryBalanceResponse](ctx, &bankv1beta1.QueryBalanceRequest{
|
||||
Address: string(implementation.Whoami(ctx)),
|
||||
Denom: req.Value,
|
||||
@ -103,16 +102,16 @@ func (t TestAccount) RegisterQueryHandlers(builder *implementation.QueryBuilder)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return wrapperspb.Int64(amt), nil
|
||||
return &types.Int64Value{Value: amt}, nil
|
||||
})
|
||||
|
||||
// genesis testing; DoubleValue does not make sense as a request type for this query, but empty is already taken
|
||||
// and this is only used for testing.
|
||||
implementation.RegisterQueryHandler(builder, func(ctx context.Context, _ *wrapperspb.DoubleValue) (*wrapperspb.UInt64Value, error) {
|
||||
implementation.RegisterQueryHandler(builder, func(ctx context.Context, _ *types.DoubleValue) (*types.UInt64Value, error) {
|
||||
v, err := t.Counter.Peek(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &wrapperspb.UInt64Value{Value: v}, nil
|
||||
return &types.UInt64Value{Value: v}, nil
|
||||
})
|
||||
}
|
||||
|
||||
@ -6,9 +6,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
@ -35,7 +32,7 @@ type AccountCreatorFunc = implementation.AccountCreatorFunc
|
||||
type Dependencies = implementation.Dependencies
|
||||
|
||||
func RegisterExecuteHandler[
|
||||
Req any, ProtoReq implementation.ProtoMsg[Req], Resp any, ProtoResp implementation.ProtoMsg[Resp],
|
||||
Req any, ProtoReq implementation.ProtoMsgG[Req], Resp any, ProtoResp implementation.ProtoMsgG[Resp],
|
||||
](router *ExecuteBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error),
|
||||
) {
|
||||
implementation.RegisterExecuteHandler(router, handler)
|
||||
@ -43,7 +40,7 @@ func RegisterExecuteHandler[
|
||||
|
||||
// RegisterQueryHandler registers a query handler for a smart account that uses protobuf.
|
||||
func RegisterQueryHandler[
|
||||
Req any, ProtoReq implementation.ProtoMsg[Req], Resp any, ProtoResp implementation.ProtoMsg[Resp],
|
||||
Req any, ProtoReq implementation.ProtoMsgG[Req], Resp any, ProtoResp implementation.ProtoMsgG[Resp],
|
||||
](router *QueryBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error),
|
||||
) {
|
||||
implementation.RegisterQueryHandler(router, handler)
|
||||
@ -51,7 +48,7 @@ func RegisterQueryHandler[
|
||||
|
||||
// RegisterInitHandler registers an initialisation handler for a smart account that uses protobuf.
|
||||
func RegisterInitHandler[
|
||||
Req any, ProtoReq implementation.ProtoMsg[Req], Resp any, ProtoResp implementation.ProtoMsg[Resp],
|
||||
Req any, ProtoReq implementation.ProtoMsgG[Req], Resp any, ProtoResp implementation.ProtoMsgG[Resp],
|
||||
](router *InitBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error),
|
||||
) {
|
||||
implementation.RegisterInitHandler(router, handler)
|
||||
@ -59,7 +56,10 @@ func RegisterInitHandler[
|
||||
|
||||
// AddAccount is a helper function to add a smart account to the list of smart accounts.
|
||||
func AddAccount[A Interface](name string, constructor func(deps Dependencies) (A, error)) AccountCreatorFunc {
|
||||
return implementation.AddAccount(name, constructor)
|
||||
return func(deps implementation.Dependencies) (string, implementation.Account, error) {
|
||||
acc, err := constructor(deps)
|
||||
return name, acc, err
|
||||
}
|
||||
}
|
||||
|
||||
// Whoami returns the address of the account being invoked.
|
||||
@ -78,34 +78,34 @@ func SenderIsAccountsModule(ctx context.Context) bool {
|
||||
}
|
||||
|
||||
// ExecModule can be used to execute a message towards a module.
|
||||
func ExecModule[Resp any, RespProto implementation.ProtoMsg[Resp], Req any, ReqProto implementation.ProtoMsg[Req]](ctx context.Context, msg ReqProto) (RespProto, error) {
|
||||
func ExecModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) {
|
||||
return implementation.ExecModule[Resp, RespProto, Req, ReqProto](ctx, msg)
|
||||
}
|
||||
|
||||
func ExecModuleUntyped(ctx context.Context, msg proto.Message) (proto.Message, error) {
|
||||
func ExecModuleUntyped(ctx context.Context, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) {
|
||||
return implementation.ExecModuleUntyped(ctx, msg)
|
||||
}
|
||||
|
||||
// QueryModule can be used by an account to execute a module query.
|
||||
func QueryModule[Resp any, RespProto implementation.ProtoMsg[Resp], Req any, ReqProto implementation.ProtoMsg[Req]](ctx context.Context, req ReqProto) (RespProto, error) {
|
||||
func QueryModule[Resp any, RespProto implementation.ProtoMsgG[Resp], Req any, ReqProto implementation.ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) {
|
||||
return implementation.QueryModule[Resp, RespProto, Req, ReqProto](ctx, req)
|
||||
}
|
||||
|
||||
// UnpackAny unpacks a protobuf Any message generically.
|
||||
func UnpackAny[Msg any, ProtoMsg implementation.ProtoMsg[Msg]](any *anypb.Any) (*Msg, error) {
|
||||
func UnpackAny[Msg any, ProtoMsg implementation.ProtoMsgG[Msg]](any *implementation.Any) (*Msg, error) {
|
||||
return implementation.UnpackAny[Msg, ProtoMsg](any)
|
||||
}
|
||||
|
||||
// PackAny packs a protobuf Any message generically.
|
||||
func PackAny(msg proto.Message) (*anypb.Any, error) {
|
||||
func PackAny(msg implementation.ProtoMsg) (*implementation.Any, error) {
|
||||
return implementation.PackAny(msg)
|
||||
}
|
||||
|
||||
// ExecModuleAnys can be used to execute a list of messages towards a module
|
||||
// when those messages are packed in Any messages. The function returns a list
|
||||
// of responses packed in Any messages.
|
||||
func ExecModuleAnys(ctx context.Context, msgs []*anypb.Any) ([]*anypb.Any, error) {
|
||||
responses := make([]*anypb.Any, len(msgs))
|
||||
func ExecModuleAnys(ctx context.Context, msgs []*implementation.Any) ([]*implementation.Any, error) {
|
||||
responses := make([]*implementation.Any, len(msgs))
|
||||
for i, msg := range msgs {
|
||||
concreteMessage, err := implementation.UnpackAnyRaw(msg)
|
||||
if err != nil {
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/cosmos/gogoproto/jsonpb"
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
"github.com/spf13/cobra"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
v1 "cosmossdk.io/x/accounts/v1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
)
|
||||
|
||||
func TxCmd(name string) *cobra.Command {
|
||||
@ -140,12 +140,7 @@ func GetQueryAccountCmd() *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
jsonResp, err := handlerResponseJSONBytes(schema.QueryHandlers, args[1], res.Response)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintString(jsonResp)
|
||||
return clientCtx.PrintProto(res)
|
||||
},
|
||||
}
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
@ -165,7 +160,7 @@ func getSchemaForAccount(clientCtx client.Context, addr string) (*v1.SchemaRespo
|
||||
})
|
||||
}
|
||||
|
||||
func handlerMsgBytes(handlersSchema []*v1.SchemaResponse_Handler, msgTypeURL, msgString string) ([]byte, error) {
|
||||
func handlerMsgBytes(handlersSchema []*v1.SchemaResponse_Handler, msgTypeURL, msgString string) (*codectypes.Any, error) {
|
||||
var msgSchema *v1.SchemaResponse_Handler
|
||||
for _, handler := range handlersSchema {
|
||||
if handler.Request == msgTypeURL {
|
||||
@ -176,64 +171,18 @@ func handlerMsgBytes(handlersSchema []*v1.SchemaResponse_Handler, msgTypeURL, ms
|
||||
if msgSchema == nil {
|
||||
return nil, fmt.Errorf("handler for message type %s not found", msgTypeURL)
|
||||
}
|
||||
msgBytes, err := encodeJSONToProto(msgSchema.Request, msgString)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return proto.MarshalOptions{Deterministic: true}.Marshal(&anypb.Any{
|
||||
TypeUrl: "/" + msgTypeURL,
|
||||
Value: msgBytes,
|
||||
})
|
||||
return encodeJSONToProto(msgSchema.Request, msgString)
|
||||
}
|
||||
|
||||
func handlerResponseJSONBytes(handlerSchema []*v1.SchemaResponse_Handler, msgTypeURL string, protoBytes []byte) (string, error) {
|
||||
var msgSchema *v1.SchemaResponse_Handler
|
||||
for _, handler := range handlerSchema {
|
||||
if handler.Request == msgTypeURL {
|
||||
msgSchema = handler
|
||||
break
|
||||
}
|
||||
func encodeJSONToProto(name, jsonMsg string) (*codectypes.Any, error) {
|
||||
impl := gogoproto.MessageType(name)
|
||||
if impl == nil {
|
||||
return nil, fmt.Errorf("message type %s not found", name)
|
||||
}
|
||||
if msgSchema == nil {
|
||||
return "", fmt.Errorf("handler for message type %s not found", msgTypeURL)
|
||||
}
|
||||
anyMsg := new(anypb.Any)
|
||||
err := proto.Unmarshal(protoBytes, anyMsg)
|
||||
msg := reflect.New(impl.Elem()).Interface().(gogoproto.Message)
|
||||
err := jsonpb.Unmarshal(bytes.NewBufferString(jsonMsg), msg)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, fmt.Errorf("provided message is not valid %s: %w", jsonMsg, err)
|
||||
}
|
||||
return decodeProtoToJSON(msgSchema.Response, anyMsg.Value)
|
||||
}
|
||||
|
||||
func encodeJSONToProto(name, jsonMsg string) ([]byte, error) {
|
||||
jsonBytes := []byte(jsonMsg)
|
||||
impl, err := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(name))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
msg := impl.New().Interface()
|
||||
err = protojson.Unmarshal(jsonBytes, msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return proto.Marshal(msg)
|
||||
}
|
||||
|
||||
func decodeProtoToJSON(name string, protoBytes []byte) (string, error) {
|
||||
impl, err := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(name))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
msg := impl.New().Interface()
|
||||
err = proto.UnmarshalOptions{}.Unmarshal(protoBytes, msg)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf(
|
||||
"%w: unable to unmarshal protobytes in message '%s', message name: %s",
|
||||
err, protoBytes, name)
|
||||
}
|
||||
jsonBytes, err := protojson.Marshal(msg)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(jsonBytes), nil
|
||||
return codectypes.NewAnyWithValue(msg)
|
||||
}
|
||||
|
||||
@ -4,30 +4,31 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
"cosmossdk.io/collections/colltest"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
)
|
||||
|
||||
func TestGenesis(t *testing.T) {
|
||||
k, ctx := newKeeper(t, implementation.AddAccount("test", NewTestAccount))
|
||||
k.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { return nil })
|
||||
k, ctx := newKeeper(t, func(deps implementation.Dependencies) (string, implementation.Account, error) {
|
||||
acc, err := NewTestAccount(deps)
|
||||
return "test", acc, err
|
||||
})
|
||||
k.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { return nil })
|
||||
// we init two accounts of the same type
|
||||
|
||||
// we set counter to 10
|
||||
_, addr1, err := k.Init(ctx, "test", []byte("sender"), &emptypb.Empty{})
|
||||
_, addr1, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{})
|
||||
require.NoError(t, err)
|
||||
_, err = k.Execute(ctx, addr1, []byte("sender"), &wrapperspb.UInt64Value{Value: 10})
|
||||
_, err = k.Execute(ctx, addr1, []byte("sender"), &types.UInt64Value{Value: 10})
|
||||
require.NoError(t, err)
|
||||
|
||||
// we set counter to 20
|
||||
_, addr2, err := k.Init(ctx, "test", []byte("sender"), &emptypb.Empty{})
|
||||
_, addr2, err := k.Init(ctx, "test", []byte("sender"), &types.Empty{})
|
||||
require.NoError(t, err)
|
||||
_, err = k.Execute(ctx, addr2, []byte("sender"), &wrapperspb.UInt64Value{Value: 20})
|
||||
_, err = k.Execute(ctx, addr2, []byte("sender"), &types.UInt64Value{Value: 20})
|
||||
require.NoError(t, err)
|
||||
|
||||
// export state
|
||||
@ -41,11 +42,11 @@ func TestGenesis(t *testing.T) {
|
||||
|
||||
// if genesis import went fine, we should be able to query the accounts
|
||||
// and get the expected values.
|
||||
resp, err := k.Query(ctx, addr1, &wrapperspb.DoubleValue{})
|
||||
resp, err := k.Query(ctx, addr1, &types.DoubleValue{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &wrapperspb.UInt64Value{Value: 10}, resp)
|
||||
require.Equal(t, &types.UInt64Value{Value: 10}, resp)
|
||||
|
||||
resp, err = k.Query(ctx, addr2, &wrapperspb.DoubleValue{})
|
||||
resp, err = k.Query(ctx, addr2, &types.DoubleValue{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &wrapperspb.UInt64Value{Value: 20}, resp)
|
||||
require.Equal(t, &types.UInt64Value{Value: 20}, resp)
|
||||
}
|
||||
|
||||
1671
x/accounts/interfaces/account_abstraction/v1/interface.pb.go
Normal file
1671
x/accounts/interfaces/account_abstraction/v1/interface.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,8 +3,7 @@ package implementation
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
"github.com/cosmos/gogoproto/types"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
)
|
||||
@ -26,31 +25,31 @@ type TestAccount struct {
|
||||
}
|
||||
|
||||
func (TestAccount) RegisterInitHandler(builder *InitBuilder) {
|
||||
RegisterInitHandler(builder, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) {
|
||||
return &wrapperspb.StringValue{Value: req.Value + "init-echo"}, nil
|
||||
RegisterInitHandler(builder, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) {
|
||||
return &types.StringValue{Value: req.Value + "init-echo"}, nil
|
||||
})
|
||||
}
|
||||
|
||||
func (t TestAccount) RegisterExecuteHandlers(builder *ExecuteBuilder) {
|
||||
RegisterExecuteHandler(builder, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) {
|
||||
return &wrapperspb.StringValue{Value: req.Value + "execute-echo"}, nil
|
||||
RegisterExecuteHandler(builder, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) {
|
||||
return &types.StringValue{Value: req.Value + "execute-echo"}, nil
|
||||
})
|
||||
|
||||
RegisterExecuteHandler(builder, func(_ context.Context, req *wrapperspb.BytesValue) (*wrapperspb.BytesValue, error) {
|
||||
return &wrapperspb.BytesValue{Value: append(req.Value, "bytes-execute-echo"...)}, nil
|
||||
RegisterExecuteHandler(builder, func(_ context.Context, req *types.BytesValue) (*types.BytesValue, error) {
|
||||
return &types.BytesValue{Value: append(req.Value, "bytes-execute-echo"...)}, nil
|
||||
})
|
||||
|
||||
// State tester
|
||||
RegisterExecuteHandler(builder, func(ctx context.Context, req *wrapperspb.UInt64Value) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, t.Item.Set(ctx, req.Value)
|
||||
RegisterExecuteHandler(builder, func(ctx context.Context, req *types.UInt64Value) (*types.Empty, error) {
|
||||
return &types.Empty{}, t.Item.Set(ctx, req.Value)
|
||||
})
|
||||
}
|
||||
|
||||
func (t TestAccount) RegisterQueryHandlers(builder *QueryBuilder) {
|
||||
RegisterQueryHandler(builder, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) {
|
||||
return &wrapperspb.StringValue{Value: req.Value + "query-echo"}, nil
|
||||
RegisterQueryHandler(builder, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) {
|
||||
return &types.StringValue{Value: req.Value + "query-echo"}, nil
|
||||
})
|
||||
RegisterQueryHandler(builder, func(_ context.Context, req *wrapperspb.BytesValue) (*wrapperspb.BytesValue, error) {
|
||||
return &wrapperspb.BytesValue{Value: append(req.Value, "bytes-query-echo"...)}, nil
|
||||
RegisterQueryHandler(builder, func(_ context.Context, req *types.BytesValue) (*types.BytesValue, error) {
|
||||
return &types.BytesValue{Value: append(req.Value, "bytes-query-echo"...)}, nil
|
||||
})
|
||||
}
|
||||
|
||||
@ -4,18 +4,12 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
)
|
||||
|
||||
var (
|
||||
errNoInitHandler = errors.New("no init handler")
|
||||
errNoExecuteHandler = errors.New("account does not accept messages")
|
||||
errInvalidMessage = errors.New("invalid message")
|
||||
|
||||
protov2MarshalOpts = proto.MarshalOptions{Deterministic: true}
|
||||
)
|
||||
|
||||
// NewInitBuilder creates a new InitBuilder instance.
|
||||
@ -28,7 +22,7 @@ type InitBuilder struct {
|
||||
// handler is the handler function that will be called when the smart account is initialized.
|
||||
// Although the function here is defined to take an any, the smart account will work
|
||||
// with a typed version of it.
|
||||
handler func(ctx context.Context, initRequest any) (initResponse any, err error)
|
||||
handler func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error)
|
||||
|
||||
// schema is the schema of the message that will be passed to the handler function.
|
||||
schema HandlerSchema
|
||||
@ -36,7 +30,7 @@ type InitBuilder struct {
|
||||
|
||||
// makeHandler returns the handler function that will be called when the smart account is initialized.
|
||||
// It returns an error if no handler was registered.
|
||||
func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest any) (initResponse any, err error), error) {
|
||||
func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error), error) {
|
||||
if i.handler == nil {
|
||||
return nil, errNoInitHandler
|
||||
}
|
||||
@ -46,7 +40,7 @@ func (i *InitBuilder) makeHandler() (func(ctx context.Context, initRequest any)
|
||||
// NewExecuteBuilder creates a new ExecuteBuilder instance.
|
||||
func NewExecuteBuilder() *ExecuteBuilder {
|
||||
return &ExecuteBuilder{
|
||||
handlers: make(map[string]func(ctx context.Context, executeRequest any) (executeResponse any, err error)),
|
||||
handlers: make(map[string]func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error)),
|
||||
handlersSchema: make(map[string]HandlerSchema),
|
||||
}
|
||||
}
|
||||
@ -55,7 +49,7 @@ func NewExecuteBuilder() *ExecuteBuilder {
|
||||
// to a handler function for a specific account.
|
||||
type ExecuteBuilder struct {
|
||||
// handlers is a map of handler functions that will be called when the smart account is executed.
|
||||
handlers map[string]func(ctx context.Context, executeRequest any) (executeResponse any, err error)
|
||||
handlers map[string]func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error)
|
||||
|
||||
// handlersSchema is a map of schemas for the messages that will be passed to the handler functions
|
||||
// and the messages that will be returned by the handler functions.
|
||||
@ -65,18 +59,10 @@ type ExecuteBuilder struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (r *ExecuteBuilder) getMessageName(msg any) (string, error) {
|
||||
protoMsg, ok := msg.(protoreflect.ProtoMessage)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("%w: expected protoreflect.Message, got %T", errInvalidMessage, msg)
|
||||
}
|
||||
return string(protoMsg.ProtoReflect().Descriptor().FullName()), nil
|
||||
}
|
||||
|
||||
func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest any) (executeResponse any, err error), error) {
|
||||
func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error), error) {
|
||||
// if no handler is registered it's fine, it means the account will not be accepting execution or query messages.
|
||||
if len(r.handlers) == 0 {
|
||||
return func(ctx context.Context, _ any) (_ any, err error) {
|
||||
return func(ctx context.Context, _ ProtoMsg) (_ ProtoMsg, err error) {
|
||||
return nil, errNoExecuteHandler
|
||||
}, nil
|
||||
}
|
||||
@ -86,11 +72,8 @@ func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest
|
||||
}
|
||||
|
||||
// build the real execution handler
|
||||
return func(ctx context.Context, executeRequest any) (executeResponse any, err error) {
|
||||
messageName, err := r.getMessageName(executeRequest)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: unable to get message name", err)
|
||||
}
|
||||
return func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) {
|
||||
messageName := MessageName(executeRequest)
|
||||
handler, ok := r.handlers[messageName]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: no handler for message %s", errInvalidMessage, messageName)
|
||||
@ -99,42 +82,6 @@ func (r *ExecuteBuilder) makeHandler() (func(ctx context.Context, executeRequest
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *ExecuteBuilder) makeRequestDecoder() func(requestBytes []byte) (any, error) {
|
||||
return func(requestBytes []byte) (any, error) {
|
||||
anyPB := new(anypb.Any)
|
||||
err := proto.Unmarshal(requestBytes, anyPB)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
msg, err := anyPB.UnmarshalNew()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// we do not check if it is part of a valid message set as an account can handle
|
||||
// and the handler will do so.
|
||||
return msg, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (r *ExecuteBuilder) makeResponseEncoder() func(executeResponse any) ([]byte, error) {
|
||||
return func(executeResponse any) ([]byte, error) {
|
||||
executeResponsePB, ok := executeResponse.(protoreflect.ProtoMessage)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: expected protoreflect.Message, got %T", errInvalidMessage, executeResponse)
|
||||
}
|
||||
anyPB, err := anypb.New(executeResponsePB)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// we do not check if it is part of an account's valid response message set
|
||||
// as make handler will never allow for an invalid response to be returned.
|
||||
return protov2MarshalOpts.Marshal(anyPB)
|
||||
}
|
||||
}
|
||||
|
||||
// NewQueryBuilder creates a new QueryBuilder instance.
|
||||
func NewQueryBuilder() *QueryBuilder {
|
||||
return &QueryBuilder{
|
||||
@ -149,7 +96,7 @@ type QueryBuilder struct {
|
||||
er *ExecuteBuilder
|
||||
}
|
||||
|
||||
func (r *QueryBuilder) makeHandler() (func(ctx context.Context, queryRequest any) (queryResponse any, err error), error) {
|
||||
func (r *QueryBuilder) makeHandler() (func(ctx context.Context, queryRequest ProtoMsg) (queryResponse ProtoMsg, err error), error) {
|
||||
return r.er.makeHandler()
|
||||
}
|
||||
|
||||
|
||||
@ -4,14 +4,14 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
)
|
||||
|
||||
func TestRouterDoubleRegistration(t *testing.T) {
|
||||
router := NewExecuteBuilder()
|
||||
RegisterExecuteHandler(router, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { return nil, nil })
|
||||
RegisterExecuteHandler(router, func(_ context.Context, req *wrapperspb.StringValue) (*wrapperspb.StringValue, error) { return nil, nil })
|
||||
RegisterExecuteHandler(router, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) { return nil, nil })
|
||||
RegisterExecuteHandler(router, func(_ context.Context, req *types.StringValue) (*types.StringValue, error) { return nil, nil })
|
||||
|
||||
_, err := router.makeHandler()
|
||||
require.ErrorContains(t, err, "already registered")
|
||||
@ -28,8 +28,8 @@ func TestEmptyQueryExecuteHandler(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
_, err = qh(ctx, &wrapperspb.StringValue{})
|
||||
_, err = qh(ctx, &types.StringValue{})
|
||||
require.ErrorIs(t, err, errNoExecuteHandler)
|
||||
_, err = eh(ctx, &wrapperspb.StringValue{})
|
||||
_, err = eh(ctx, &types.StringValue{})
|
||||
require.ErrorIs(t, err, errNoExecuteHandler)
|
||||
}
|
||||
|
||||
@ -3,8 +3,6 @@ package implementation
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/x/accounts/internal/prefixstore"
|
||||
@ -13,9 +11,9 @@ import (
|
||||
var AccountStatePrefix = collections.NewPrefix(255)
|
||||
|
||||
type (
|
||||
ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg proto.Message) (proto.Message, error)
|
||||
ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp proto.Message) error
|
||||
ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp proto.Message) error
|
||||
ModuleExecUntypedFunc = func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error)
|
||||
ModuleExecFunc = func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error
|
||||
ModuleQueryFunc = func(ctx context.Context, queryReq, queryResp ProtoMsg) error
|
||||
)
|
||||
|
||||
type contextKey struct{}
|
||||
@ -58,7 +56,7 @@ func MakeAccountContext(
|
||||
}
|
||||
|
||||
// ExecModuleUntyped can be used to execute a message towards a module, when the response type is unknown.
|
||||
func ExecModuleUntyped(ctx context.Context, msg proto.Message) (proto.Message, error) {
|
||||
func ExecModuleUntyped(ctx context.Context, msg ProtoMsg) (ProtoMsg, error) {
|
||||
// get sender
|
||||
v := ctx.Value(contextKey{}).(contextValue)
|
||||
|
||||
@ -71,7 +69,7 @@ func ExecModuleUntyped(ctx context.Context, msg proto.Message) (proto.Message, e
|
||||
}
|
||||
|
||||
// ExecModule can be used to execute a message towards a module.
|
||||
func ExecModule[Resp any, RespProto ProtoMsg[Resp], Req any, ReqProto ProtoMsg[Req]](ctx context.Context, msg ReqProto) (RespProto, error) {
|
||||
func ExecModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, msg ReqProto) (RespProto, error) {
|
||||
// get sender
|
||||
v := ctx.Value(contextKey{}).(contextValue)
|
||||
|
||||
@ -86,7 +84,7 @@ func ExecModule[Resp any, RespProto ProtoMsg[Resp], Req any, ReqProto ProtoMsg[R
|
||||
}
|
||||
|
||||
// QueryModule can be used by an account to execute a module query.
|
||||
func QueryModule[Resp any, RespProto ProtoMsg[Resp], Req any, ReqProto ProtoMsg[Req]](ctx context.Context, req ReqProto) (RespProto, error) {
|
||||
func QueryModule[Resp any, RespProto ProtoMsgG[Resp], Req any, ReqProto ProtoMsgG[Req]](ctx context.Context, req ReqProto) (RespProto, error) {
|
||||
// we do not need to check the sender in a query because it is not a state transition.
|
||||
// we also unwrap the original context.
|
||||
v := ctx.Value(contextKey{}).(contextValue)
|
||||
|
||||
@ -4,9 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/collections/colltest"
|
||||
@ -28,10 +27,10 @@ func TestMakeAccountContext(t *testing.T) {
|
||||
ta, err := NewTestAccount(sb)
|
||||
require.NoError(t, err)
|
||||
|
||||
impl, err := NewImplementation(ta)
|
||||
impl, err := newImplementation(sb, ta)
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = impl.Execute(accountCtx, &wrapperspb.UInt64Value{Value: 1000})
|
||||
_, err = impl.Execute(accountCtx, &types.UInt64Value{Value: 1000})
|
||||
require.NoError(t, err)
|
||||
|
||||
// we want to ensure that the account wrote in the correct prefix.
|
||||
@ -44,36 +43,36 @@ func TestMakeAccountContext(t *testing.T) {
|
||||
require.Equal(t, []byte{0, 0, 0, 0, 0, 0, 3, 232}, value)
|
||||
|
||||
// ensure calling ExecModule works
|
||||
accountCtx = MakeAccountContext(originalContext, storeService, []byte("legit-exec-module"), []byte("invoker"), func(ctx context.Context, sender []byte, msg, msgResp proto.Message) error {
|
||||
accountCtx = MakeAccountContext(originalContext, storeService, []byte("legit-exec-module"), []byte("invoker"), func(ctx context.Context, sender []byte, msg, msgResp ProtoMsg) error {
|
||||
// ensure we unwrapped the context when invoking a module call
|
||||
require.Equal(t, originalContext, ctx)
|
||||
proto.Merge(msgResp, &wrapperspb.StringValue{Value: "module exec was called"})
|
||||
Merge(msgResp, &types.StringValue{Value: "module exec was called"})
|
||||
return nil
|
||||
}, nil, nil)
|
||||
|
||||
resp, err := ExecModule[wrapperspb.StringValue](accountCtx, &wrapperspb.UInt64Value{Value: 1000})
|
||||
resp, err := ExecModule[types.StringValue](accountCtx, &types.UInt64Value{Value: 1000})
|
||||
require.NoError(t, err)
|
||||
require.True(t, proto.Equal(wrapperspb.String("module exec was called"), resp))
|
||||
require.True(t, Equal(&types.StringValue{Value: "module exec was called"}, resp))
|
||||
|
||||
// ensure calling ExecModuleUntyped works
|
||||
accountCtx = MakeAccountContext(originalContext, storeService, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg proto.Message) (proto.Message, error) {
|
||||
accountCtx = MakeAccountContext(originalContext, storeService, []byte("legit-exec-module-untyped"), []byte("invoker"), nil, func(ctx context.Context, sender []byte, msg ProtoMsg) (ProtoMsg, error) {
|
||||
require.Equal(t, originalContext, ctx)
|
||||
return &wrapperspb.StringValue{Value: "module exec untyped was called"}, nil
|
||||
return &types.StringValue{Value: "module exec untyped was called"}, nil
|
||||
}, nil)
|
||||
|
||||
respUntyped, err := ExecModuleUntyped(accountCtx, &wrapperspb.UInt64Value{Value: 1000})
|
||||
respUntyped, err := ExecModuleUntyped(accountCtx, &types.UInt64Value{Value: 1000})
|
||||
require.NoError(t, err)
|
||||
require.True(t, proto.Equal(wrapperspb.String("module exec untyped was called"), respUntyped))
|
||||
require.True(t, Equal(&types.StringValue{Value: "module exec untyped was called"}, respUntyped))
|
||||
|
||||
// ensure calling QueryModule works, also by setting everything else communication related to nil
|
||||
// we can guarantee that exec paths do not impact query paths.
|
||||
accountCtx = MakeAccountContext(originalContext, storeService, nil, nil, nil, nil, func(ctx context.Context, req, resp proto.Message) error {
|
||||
accountCtx = MakeAccountContext(originalContext, storeService, nil, nil, nil, nil, func(ctx context.Context, req, resp ProtoMsg) error {
|
||||
require.Equal(t, originalContext, ctx)
|
||||
proto.Merge(resp, wrapperspb.String("module query was called"))
|
||||
Merge(resp, &types.StringValue{Value: "module query was called"})
|
||||
return nil
|
||||
})
|
||||
|
||||
resp, err = QueryModule[wrapperspb.StringValue](accountCtx, &wrapperspb.UInt64Value{Value: 1000})
|
||||
resp, err = QueryModule[types.StringValue](accountCtx, &types.UInt64Value{Value: 1000})
|
||||
require.NoError(t, err)
|
||||
require.True(t, proto.Equal(wrapperspb.String("module query was called"), resp))
|
||||
require.True(t, Equal(&types.StringValue{Value: "module query was called"}, resp))
|
||||
}
|
||||
|
||||
59
x/accounts/internal/implementation/encoding.go
Normal file
59
x/accounts/internal/implementation/encoding.go
Normal file
@ -0,0 +1,59 @@
|
||||
package implementation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
)
|
||||
|
||||
type Any = codectypes.Any
|
||||
|
||||
func FindMessageByName(name string) (ProtoMsg, error) {
|
||||
typ := proto.MessageType(name)
|
||||
if typ == nil {
|
||||
return nil, fmt.Errorf("no message type found for %s", name)
|
||||
}
|
||||
return reflect.New(typ.Elem()).Interface().(ProtoMsg), nil
|
||||
}
|
||||
|
||||
func MessageName(msg ProtoMsg) string {
|
||||
return proto.MessageName(msg)
|
||||
}
|
||||
|
||||
// PackAny packs a proto message into an anypb.Any.
|
||||
func PackAny(msg ProtoMsg) (*Any, error) {
|
||||
return codectypes.NewAnyWithValue(msg)
|
||||
}
|
||||
|
||||
// UnpackAny unpacks an anypb.Any into a proto message.
|
||||
func UnpackAny[T any, PT ProtoMsgG[T]](anyPB *Any) (PT, error) {
|
||||
to := new(T)
|
||||
return to, UnpackAnyTo(anyPB, PT(to))
|
||||
}
|
||||
|
||||
func UnpackAnyTo(anyPB *Any, to ProtoMsg) error {
|
||||
return proto.Unmarshal(anyPB.Value, to)
|
||||
}
|
||||
|
||||
func UnpackAnyRaw(anyPB *Any) (proto.Message, error) {
|
||||
split := strings.Split(anyPB.TypeUrl, "/")
|
||||
name := split[len(split)-1]
|
||||
typ := proto.MessageType(name)
|
||||
if typ == nil {
|
||||
return nil, fmt.Errorf("no message type found for %s", name)
|
||||
}
|
||||
to := reflect.New(typ.Elem()).Interface().(proto.Message)
|
||||
return to, UnpackAnyTo(anyPB, to)
|
||||
}
|
||||
|
||||
func Merge(a, b ProtoMsg) {
|
||||
proto.Merge(a, b)
|
||||
}
|
||||
|
||||
func Equal(a, b ProtoMsg) bool {
|
||||
return proto.Equal(a, b)
|
||||
}
|
||||
@ -15,24 +15,7 @@ type Dependencies struct {
|
||||
}
|
||||
|
||||
// AccountCreatorFunc is a function that creates an account.
|
||||
type AccountCreatorFunc = func(deps Dependencies) (string, Implementation, error)
|
||||
|
||||
// AddAccount is a helper function to add a smart account to the list of smart accounts.
|
||||
// It returns a function that given an Account implementer, returns the name of the account
|
||||
// and the Implementation instance.
|
||||
func AddAccount[A Account](name string, constructor func(deps Dependencies) (A, error)) func(deps Dependencies) (string, Implementation, error) {
|
||||
return func(deps Dependencies) (string, Implementation, error) {
|
||||
acc, err := constructor(deps)
|
||||
if err != nil {
|
||||
return "", Implementation{}, err
|
||||
}
|
||||
impl, err := NewImplementation(acc)
|
||||
if err != nil {
|
||||
return "", Implementation{}, err
|
||||
}
|
||||
return name, impl, nil
|
||||
}
|
||||
}
|
||||
type AccountCreatorFunc = func(deps Dependencies) (string, Account, error)
|
||||
|
||||
// MakeAccountsMap creates a map of account names to account implementations
|
||||
// from a list of account creator functions.
|
||||
@ -44,27 +27,25 @@ func MakeAccountsMap(addressCodec address.Codec, accounts []AccountCreatorFunc)
|
||||
SchemaBuilder: stateSchemaBuilder,
|
||||
AddressCodec: addressCodec,
|
||||
}
|
||||
name, impl, err := makeAccount(deps)
|
||||
name, accountInterface, err := makeAccount(deps)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create account %s: %w", name, err)
|
||||
}
|
||||
if _, ok := accountsMap[name]; ok {
|
||||
return nil, fmt.Errorf("account %s is already registered", name)
|
||||
}
|
||||
// build schema
|
||||
schema, err := stateSchemaBuilder.Build()
|
||||
impl, err := newImplementation(stateSchemaBuilder, accountInterface)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to build schema for account %s: %w", name, err)
|
||||
return nil, fmt.Errorf("failed to create implementation for account %s: %w", name, err)
|
||||
}
|
||||
impl.CollectionsSchema = schema
|
||||
accountsMap[name] = impl
|
||||
}
|
||||
|
||||
return accountsMap, nil
|
||||
}
|
||||
|
||||
// NewImplementation creates a new Implementation instance given an Account implementer.
|
||||
func NewImplementation(account Account) (Implementation, error) {
|
||||
// newImplementation creates a new Implementation instance given an Account implementer.
|
||||
func newImplementation(schemaBuilder *collections.SchemaBuilder, account Account) (Implementation, error) {
|
||||
// make init handler
|
||||
ir := NewInitBuilder()
|
||||
account.RegisterInitHandler(ir)
|
||||
@ -88,18 +69,20 @@ func NewImplementation(account Account) (Implementation, error) {
|
||||
if err != nil {
|
||||
return Implementation{}, err
|
||||
}
|
||||
|
||||
// build schema
|
||||
schema, err := schemaBuilder.Build()
|
||||
if err != nil {
|
||||
return Implementation{}, err
|
||||
}
|
||||
return Implementation{
|
||||
Init: initHandler,
|
||||
Execute: executeHandler,
|
||||
Query: queryHandler,
|
||||
CollectionsSchema: collections.Schema{},
|
||||
CollectionsSchema: schema,
|
||||
InitHandlerSchema: ir.schema,
|
||||
QueryHandlersSchema: qr.er.handlersSchema,
|
||||
ExecuteHandlersSchema: er.handlersSchema,
|
||||
DecodeExecuteRequest: er.makeRequestDecoder(),
|
||||
EncodeExecuteResponse: er.makeResponseEncoder(),
|
||||
DecodeQueryRequest: qr.er.makeRequestDecoder(),
|
||||
EncodeQueryResponse: qr.er.makeResponseEncoder(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -107,11 +90,11 @@ func NewImplementation(account Account) (Implementation, error) {
|
||||
// and non-generic implementation usable by the x/accounts module.
|
||||
type Implementation struct {
|
||||
// Init defines the initialisation handler for the smart account.
|
||||
Init func(ctx context.Context, msg any) (resp any, err error)
|
||||
Init func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error)
|
||||
// Execute defines the execution handler for the smart account.
|
||||
Execute func(ctx context.Context, msg any) (resp any, err error)
|
||||
Execute func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error)
|
||||
// Query defines the query handler for the smart account.
|
||||
Query func(ctx context.Context, msg any) (resp any, err error)
|
||||
Query func(ctx context.Context, msg ProtoMsg) (resp ProtoMsg, err error)
|
||||
// CollectionsSchema represents the state schema.
|
||||
CollectionsSchema collections.Schema
|
||||
// InitHandlerSchema represents the init handler schema.
|
||||
@ -120,18 +103,6 @@ type Implementation struct {
|
||||
QueryHandlersSchema map[string]HandlerSchema
|
||||
// ExecuteHandlersSchema is the schema of the execute handlers.
|
||||
ExecuteHandlersSchema map[string]HandlerSchema
|
||||
|
||||
// TODO: remove these fields and use the schemas instead
|
||||
|
||||
// DecodeExecuteRequest decodes an execute request coming from the message server.
|
||||
DecodeExecuteRequest func([]byte) (any, error)
|
||||
// EncodeExecuteResponse encodes an execute response to be sent back from the message server.
|
||||
EncodeExecuteResponse func(any) ([]byte, error)
|
||||
|
||||
// DecodeQueryRequest decodes a query request coming from the message server.
|
||||
DecodeQueryRequest func([]byte) (any, error)
|
||||
// EncodeQueryResponse encodes a query response to be sent back from the message server.
|
||||
EncodeQueryResponse func(any) ([]byte, error)
|
||||
}
|
||||
|
||||
// MessageSchema defines the schema of a message.
|
||||
@ -139,18 +110,8 @@ type Implementation struct {
|
||||
type MessageSchema struct {
|
||||
// Name identifies the message name, this must be queriable from some reflection service.
|
||||
Name string
|
||||
// TxDecode decodes into the message from transaction bytes.
|
||||
// CONSENSUS SAFE: can be used in state machine logic.
|
||||
TxDecode func([]byte) (any, error)
|
||||
// TxEncode encodes the message into transaction bytes.
|
||||
// CONSENSUS SAFE: can be used in state machine logic.
|
||||
TxEncode func(any) ([]byte, error)
|
||||
// HumanDecode decodes into the message from human-readable bytes.
|
||||
// CONSENSUS UNSAFE: can be used only from clients, not state machine logic.
|
||||
HumanDecode func([]byte) (any, error)
|
||||
// HumanEncode encodes the message into human-readable bytes.
|
||||
// CONSENSUS UNSAFE: can be used only from clients, not state machine logic.
|
||||
HumanEncode func(any) ([]byte, error)
|
||||
// New is used to create a new message instance for the schema.
|
||||
New func() ProtoMsg
|
||||
}
|
||||
|
||||
// HandlerSchema defines the schema of a handler.
|
||||
|
||||
@ -4,117 +4,56 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
)
|
||||
|
||||
func TestImplementation(t *testing.T) {
|
||||
impl, err := NewImplementation(TestAccount{})
|
||||
impl, err := newImplementation(collections.NewSchemaBuilderFromAccessor(OpenKVStore), TestAccount{})
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
t.Run("execute ok", func(t *testing.T) {
|
||||
resp, err := impl.Execute(ctx, &wrapperspb.StringValue{Value: "test"})
|
||||
resp, err := impl.Execute(ctx, &types.StringValue{Value: "test"})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "testexecute-echo", resp.(*wrapperspb.StringValue).Value)
|
||||
require.Equal(t, "testexecute-echo", resp.(*types.StringValue).Value)
|
||||
|
||||
resp, err = impl.Execute(ctx, &wrapperspb.BytesValue{Value: []byte("test")})
|
||||
resp, err = impl.Execute(ctx, &types.BytesValue{Value: []byte("test")})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "testbytes-execute-echo", string(resp.(*wrapperspb.BytesValue).Value))
|
||||
require.Equal(t, "testbytes-execute-echo", string(resp.(*types.BytesValue).Value))
|
||||
})
|
||||
|
||||
t.Run("execute - unknown message", func(t *testing.T) {
|
||||
_, err := impl.Execute(ctx, &wrapperspb.Int32Value{Value: 1})
|
||||
_, err := impl.Execute(ctx, &types.Int32Value{Value: 1})
|
||||
require.ErrorIs(t, err, errInvalidMessage)
|
||||
})
|
||||
|
||||
t.Run("init ok", func(t *testing.T) {
|
||||
resp, err := impl.Init(ctx, &wrapperspb.StringValue{Value: "test"})
|
||||
resp, err := impl.Init(ctx, &types.StringValue{Value: "test"})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "testinit-echo", resp.(*wrapperspb.StringValue).Value)
|
||||
require.Equal(t, "testinit-echo", resp.(*types.StringValue).Value)
|
||||
})
|
||||
|
||||
t.Run("init - unknown message", func(t *testing.T) {
|
||||
_, err := impl.Init(ctx, &wrapperspb.Int32Value{Value: 1})
|
||||
_, err := impl.Init(ctx, &types.Int32Value{Value: 1})
|
||||
require.ErrorIs(t, err, errInvalidMessage)
|
||||
})
|
||||
|
||||
t.Run("query ok", func(t *testing.T) {
|
||||
resp, err := impl.Query(ctx, &wrapperspb.StringValue{Value: "test"})
|
||||
resp, err := impl.Query(ctx, &types.StringValue{Value: "test"})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "testquery-echo", resp.(*wrapperspb.StringValue).Value)
|
||||
require.Equal(t, "testquery-echo", resp.(*types.StringValue).Value)
|
||||
|
||||
resp, err = impl.Query(ctx, &wrapperspb.BytesValue{Value: []byte("test")})
|
||||
resp, err = impl.Query(ctx, &types.BytesValue{Value: []byte("test")})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "testbytes-query-echo", string(resp.(*wrapperspb.BytesValue).Value))
|
||||
require.Equal(t, "testbytes-query-echo", string(resp.(*types.BytesValue).Value))
|
||||
})
|
||||
|
||||
t.Run("query - unknown message", func(t *testing.T) {
|
||||
_, err := impl.Query(ctx, &wrapperspb.Int32Value{Value: 1})
|
||||
_, err := impl.Query(ctx, &types.Int32Value{Value: 1})
|
||||
require.ErrorIs(t, err, errInvalidMessage)
|
||||
})
|
||||
|
||||
t.Run("all - not a protobuf message", func(t *testing.T) {
|
||||
_, err := impl.Execute(ctx, "test")
|
||||
require.ErrorIs(t, err, errInvalidMessage)
|
||||
_, err = impl.Query(ctx, "test")
|
||||
require.ErrorIs(t, err, errInvalidMessage)
|
||||
_, err = impl.Init(ctx, "test")
|
||||
require.ErrorIs(t, err, errInvalidMessage)
|
||||
})
|
||||
|
||||
// schemas
|
||||
t.Run("decode init request - ok", func(t *testing.T) {
|
||||
want := &wrapperspb.StringValue{Value: "test"}
|
||||
req, err := impl.InitHandlerSchema.ResponseSchema.TxEncode(want)
|
||||
require.NoError(t, err)
|
||||
|
||||
got, err := impl.InitHandlerSchema.RequestSchema.TxDecode(req)
|
||||
require.NoError(t, err)
|
||||
require.True(t, proto.Equal(want, got.(protoreflect.ProtoMessage)))
|
||||
})
|
||||
|
||||
t.Run("encode init response - ok", func(t *testing.T) {
|
||||
want := &wrapperspb.StringValue{Value: "test"}
|
||||
|
||||
gotBytes, err := impl.InitHandlerSchema.ResponseSchema.TxEncode(want)
|
||||
require.NoError(t, err)
|
||||
|
||||
wantBytes, err := proto.Marshal(want)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, wantBytes, gotBytes)
|
||||
})
|
||||
|
||||
t.Run("decode execute request - ok", func(t *testing.T) {
|
||||
wantReq := &wrapperspb.StringValue{Value: "test"}
|
||||
anyBPReq, err := anypb.New(wantReq)
|
||||
require.NoError(t, err)
|
||||
reqBytes, err := proto.Marshal(anyBPReq)
|
||||
require.NoError(t, err)
|
||||
gotReq, err := impl.DecodeExecuteRequest(reqBytes)
|
||||
require.NoError(t, err)
|
||||
require.True(t, proto.Equal(wantReq, gotReq.(protoreflect.ProtoMessage)))
|
||||
})
|
||||
|
||||
t.Run("encode execute response - ok", func(t *testing.T) {
|
||||
resp := &wrapperspb.StringValue{Value: "test"}
|
||||
gotRespBytes, err := impl.EncodeExecuteResponse(resp)
|
||||
require.NoError(t, err)
|
||||
anyPBResp, err := anypb.New(resp)
|
||||
require.NoError(t, err)
|
||||
wantRespBytes, err := proto.Marshal(anyPBResp)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, wantRespBytes, gotRespBytes)
|
||||
})
|
||||
|
||||
t.Run("encode execute response - not a protobuf message", func(t *testing.T) {
|
||||
_, err := impl.EncodeExecuteResponse("test")
|
||||
require.ErrorIs(t, err, errInvalidMessage)
|
||||
require.ErrorContains(t, err, "expected protoreflect.Message")
|
||||
})
|
||||
}
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
package implementation
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-proto/anyutil"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
)
|
||||
|
||||
// PackAny packs a proto message into an anypb.Any.
|
||||
func PackAny(msg proto.Message) (*anypb.Any, error) {
|
||||
anyPB := new(anypb.Any)
|
||||
return anyPB, anyutil.MarshalFrom(anyPB, msg, proto.MarshalOptions{Deterministic: true})
|
||||
}
|
||||
|
||||
// UnpackAny unpacks an anypb.Any into a proto message.
|
||||
func UnpackAny[T any, PT ProtoMsg[T]](anyPB *anypb.Any) (PT, error) {
|
||||
to := new(T)
|
||||
return to, UnpackAnyTo(anyPB, PT(to))
|
||||
}
|
||||
|
||||
func UnpackAnyTo(anyPB *anypb.Any, to proto.Message) error {
|
||||
return anypb.UnmarshalTo(anyPB, to, proto.UnmarshalOptions{
|
||||
DiscardUnknown: true,
|
||||
})
|
||||
}
|
||||
|
||||
func UnpackAnyRaw(anyPB *anypb.Any) (proto.Message, error) {
|
||||
return anypb.UnmarshalNew(anyPB, proto.UnmarshalOptions{
|
||||
DiscardUnknown: true,
|
||||
})
|
||||
}
|
||||
@ -4,27 +4,26 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
)
|
||||
|
||||
// ProtoMsg is a generic interface for protobuf messages.
|
||||
type ProtoMsg[T any] interface {
|
||||
type ProtoMsg = protoiface.MessageV1
|
||||
|
||||
// ProtoMsgG is a generic interface for protobuf messages.
|
||||
type ProtoMsgG[T any] interface {
|
||||
*T
|
||||
protoreflect.ProtoMessage
|
||||
protoiface.MessageV1
|
||||
}
|
||||
|
||||
// RegisterInitHandler registers an initialisation handler for a smart account that uses protobuf.
|
||||
func RegisterInitHandler[
|
||||
Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp],
|
||||
Req any, ProtoReq ProtoMsgG[Req], Resp any, ProtoResp ProtoMsgG[Resp],
|
||||
](router *InitBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error),
|
||||
) {
|
||||
reqName := ProtoReq(new(Req)).ProtoReflect().Descriptor().FullName()
|
||||
reqName := MessageName(ProtoReq(new(Req)))
|
||||
|
||||
router.handler = func(ctx context.Context, initRequest any) (initResponse any, err error) {
|
||||
router.handler = func(ctx context.Context, initRequest ProtoMsg) (initResponse ProtoMsg, err error) {
|
||||
concrete, ok := initRequest.(ProtoReq)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, reqName, initRequest)
|
||||
@ -40,17 +39,17 @@ func RegisterInitHandler[
|
||||
|
||||
// RegisterExecuteHandler registers an execution handler for a smart account that uses protobuf.
|
||||
func RegisterExecuteHandler[
|
||||
Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp],
|
||||
Req any, ProtoReq ProtoMsgG[Req], Resp any, ProtoResp ProtoMsgG[Resp],
|
||||
](router *ExecuteBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error),
|
||||
) {
|
||||
reqName := ProtoReq(new(Req)).ProtoReflect().Descriptor().FullName()
|
||||
reqName := MessageName(ProtoReq(new(Req)))
|
||||
// check if not registered already
|
||||
if _, ok := router.handlers[string(reqName)]; ok {
|
||||
if _, ok := router.handlers[reqName]; ok {
|
||||
router.err = fmt.Errorf("handler already registered for message %s", reqName)
|
||||
return
|
||||
}
|
||||
|
||||
router.handlers[string(reqName)] = func(ctx context.Context, executeRequest any) (executeResponse any, err error) {
|
||||
router.handlers[reqName] = func(ctx context.Context, executeRequest ProtoMsg) (executeResponse ProtoMsg, err error) {
|
||||
concrete, ok := executeRequest.(ProtoReq)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, reqName, executeRequest)
|
||||
@ -58,7 +57,7 @@ func RegisterExecuteHandler[
|
||||
return handler(ctx, concrete)
|
||||
}
|
||||
|
||||
router.handlersSchema[string(reqName)] = HandlerSchema{
|
||||
router.handlersSchema[reqName] = HandlerSchema{
|
||||
RequestSchema: *NewProtoMessageSchema[Req, ProtoReq](),
|
||||
ResponseSchema: *NewProtoMessageSchema[Resp, ProtoResp](),
|
||||
}
|
||||
@ -66,50 +65,21 @@ func RegisterExecuteHandler[
|
||||
|
||||
// RegisterQueryHandler registers a query handler for a smart account that uses protobuf.
|
||||
func RegisterQueryHandler[
|
||||
Req any, ProtoReq ProtoMsg[Req], Resp any, ProtoResp ProtoMsg[Resp],
|
||||
Req any, ProtoReq ProtoMsgG[Req], Resp any, ProtoResp ProtoMsgG[Resp],
|
||||
](router *QueryBuilder, handler func(ctx context.Context, req ProtoReq) (ProtoResp, error),
|
||||
) {
|
||||
RegisterExecuteHandler(router.er, handler)
|
||||
}
|
||||
|
||||
func NewProtoMessageSchema[T any, PT ProtoMsg[T]]() *MessageSchema {
|
||||
func NewProtoMessageSchema[T any, PT ProtoMsgG[T]]() *MessageSchema {
|
||||
msg := PT(new(T))
|
||||
marshaler := proto.MarshalOptions{Deterministic: true}
|
||||
unmarshaler := proto.UnmarshalOptions{DiscardUnknown: true} // TODO: safe to discard unknown? or should reject?
|
||||
jsonMarshaler := protojson.MarshalOptions{
|
||||
Multiline: true,
|
||||
Indent: " ",
|
||||
UseProtoNames: true,
|
||||
if _, ok := (interface{}(msg)).(proto.Message); ok {
|
||||
panic("protov2 messages are not supported")
|
||||
}
|
||||
jsonUnmarshaler := protojson.UnmarshalOptions{
|
||||
DiscardUnknown: true,
|
||||
}
|
||||
|
||||
return &MessageSchema{
|
||||
Name: string(msg.ProtoReflect().Descriptor().FullName()),
|
||||
TxDecode: func(bytes []byte) (any, error) {
|
||||
obj := PT(new(T))
|
||||
err := unmarshaler.Unmarshal(bytes, obj)
|
||||
return obj, err
|
||||
},
|
||||
TxEncode: func(a any) ([]byte, error) {
|
||||
concrete, ok := a.(PT)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, msg.ProtoReflect().Descriptor().FullName(), a)
|
||||
}
|
||||
return marshaler.Marshal(concrete)
|
||||
},
|
||||
HumanDecode: func(bytes []byte) (any, error) {
|
||||
obj := PT(new(T))
|
||||
err := jsonUnmarshaler.Unmarshal(bytes, obj)
|
||||
return obj, err
|
||||
},
|
||||
HumanEncode: func(a any) ([]byte, error) {
|
||||
concrete, ok := a.(PT)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: wanted %s, got %T", errInvalidMessage, msg.ProtoReflect().Descriptor().FullName(), a)
|
||||
}
|
||||
return jsonMarshaler.Marshal(concrete)
|
||||
Name: MessageName(msg),
|
||||
New: func() ProtoMsg {
|
||||
return PT(new(T))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,11 +8,8 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/address"
|
||||
@ -21,8 +18,6 @@ import (
|
||||
"cosmossdk.io/core/store"
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
|
||||
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -44,24 +39,29 @@ var (
|
||||
// It returns the handler given the message name, if multiple handlers are returned, then
|
||||
// it is up to the caller to choose which one to call.
|
||||
type QueryRouter interface {
|
||||
HybridHandlerByRequestName(name string) []func(ctx context.Context, req, resp protoiface.MessageV1) error
|
||||
HybridHandlerByRequestName(name string) []func(ctx context.Context, req, resp implementation.ProtoMsg) error
|
||||
}
|
||||
|
||||
// MsgRouter represents a router which can be used to route messages to the correct module.
|
||||
type MsgRouter interface {
|
||||
HybridHandlerByMsgName(msgName string) func(ctx context.Context, req, resp protoiface.MessageV1) error
|
||||
HybridHandlerByMsgName(msgName string) func(ctx context.Context, req, resp implementation.ProtoMsg) error
|
||||
ResponseNameByRequestName(name string) string
|
||||
}
|
||||
|
||||
// SignerProvider defines an interface used to get the expected sender from a message.
|
||||
type SignerProvider interface {
|
||||
// GetSigners returns the signers of the message.
|
||||
GetSigners(msg proto.Message) ([][]byte, error)
|
||||
// GetMsgV1Signers returns the signers of the message.
|
||||
GetMsgV1Signers(msg gogoproto.Message) ([][]byte, proto.Message, error)
|
||||
}
|
||||
|
||||
// BranchExecutor defines an interface used to execute ops in a branch.
|
||||
type BranchExecutor = branch.Service
|
||||
|
||||
type InterfaceRegistry interface {
|
||||
RegisterInterface(name string, iface any, impls ...gogoproto.Message)
|
||||
RegisterImplementations(iface any, impls ...gogoproto.Message)
|
||||
}
|
||||
|
||||
func NewKeeper(
|
||||
ss store.KVStoreService,
|
||||
es event.Service,
|
||||
@ -70,6 +70,7 @@ func NewKeeper(
|
||||
signerProvider SignerProvider,
|
||||
execRouter MsgRouter,
|
||||
queryRouter QueryRouter,
|
||||
ir InterfaceRegistry,
|
||||
accounts ...accountstd.AccountCreatorFunc,
|
||||
) (Keeper, error) {
|
||||
sb := collections.NewSchemaBuilder(ss)
|
||||
@ -97,6 +98,7 @@ func NewKeeper(
|
||||
if err != nil {
|
||||
return Keeper{}, err
|
||||
}
|
||||
registerToInterfaceRegistry(ir, keeper.accounts)
|
||||
return keeper, nil
|
||||
}
|
||||
|
||||
@ -133,8 +135,8 @@ func (k Keeper) Init(
|
||||
ctx context.Context,
|
||||
accountType string,
|
||||
creator []byte,
|
||||
initRequest any,
|
||||
) (any, []byte, error) {
|
||||
initRequest implementation.ProtoMsg,
|
||||
) (implementation.ProtoMsg, []byte, error) {
|
||||
impl, err := k.getImplementation(accountType)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@ -175,8 +177,8 @@ func (k Keeper) Execute(
|
||||
ctx context.Context,
|
||||
accountAddr []byte,
|
||||
sender []byte,
|
||||
execRequest any,
|
||||
) (any, error) {
|
||||
execRequest implementation.ProtoMsg,
|
||||
) (implementation.ProtoMsg, error) {
|
||||
// get account type
|
||||
accountType, err := k.AccountsByType.Get(ctx, accountAddr)
|
||||
if err != nil {
|
||||
@ -201,8 +203,8 @@ func (k Keeper) Execute(
|
||||
func (k Keeper) Query(
|
||||
ctx context.Context,
|
||||
accountAddr []byte,
|
||||
queryRequest any,
|
||||
) (any, error) {
|
||||
queryRequest implementation.ProtoMsg,
|
||||
) (implementation.ProtoMsg, error) {
|
||||
// get account type
|
||||
accountType, err := k.AccountsByType.Get(ctx, accountAddr)
|
||||
if err != nil {
|
||||
@ -259,22 +261,22 @@ func (k Keeper) makeAccountContext(ctx context.Context, accountAddr, sender []by
|
||||
k.storeService,
|
||||
accountAddr,
|
||||
nil,
|
||||
func(ctx context.Context, sender []byte, msg, msgResp proto.Message) error {
|
||||
func(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error {
|
||||
return fmt.Errorf("cannot execute in query context")
|
||||
},
|
||||
func(ctx context.Context, sender []byte, msg proto.Message) (proto.Message, error) {
|
||||
func(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) {
|
||||
return nil, fmt.Errorf("cannot execute in query context")
|
||||
},
|
||||
k.queryModule,
|
||||
)
|
||||
}
|
||||
|
||||
// sendAnyMessages it a helper function that executes untyped anypb.Any messages
|
||||
// sendAnyMessages it a helper function that executes untyped codectypes.Any messages
|
||||
// The messages must all belong to a module.
|
||||
func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages []*anypb.Any) ([]*anypb.Any, error) {
|
||||
anyResponses := make([]*anypb.Any, len(anyMessages))
|
||||
func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages []*implementation.Any) ([]*implementation.Any, error) {
|
||||
anyResponses := make([]*implementation.Any, len(anyMessages))
|
||||
for i := range anyMessages {
|
||||
msg, err := anyMessages[i].UnmarshalNew()
|
||||
msg, err := implementation.UnpackAnyRaw(anyMessages[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -293,19 +295,18 @@ func (k Keeper) sendAnyMessages(ctx context.Context, sender []byte, anyMessages
|
||||
|
||||
// sendModuleMessageUntyped can be used to send a message towards a module.
|
||||
// It should be used when the response type is not known by the caller.
|
||||
func (k Keeper) sendModuleMessageUntyped(ctx context.Context, sender []byte, msg proto.Message) (proto.Message, error) {
|
||||
func (k Keeper) sendModuleMessageUntyped(ctx context.Context, sender []byte, msg implementation.ProtoMsg) (implementation.ProtoMsg, error) {
|
||||
// we need to fetch the response type from the request message type.
|
||||
// this is because the response type is not known.
|
||||
respName := k.msgRouter.ResponseNameByRequestName(string(msg.ProtoReflect().Descriptor().FullName()))
|
||||
respName := k.msgRouter.ResponseNameByRequestName(implementation.MessageName(msg))
|
||||
if respName == "" {
|
||||
return nil, fmt.Errorf("could not find response type for message %T", msg)
|
||||
}
|
||||
// get response type
|
||||
respType, err := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(respName))
|
||||
resp, err := implementation.FindMessageByName(respName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp := respType.New().Interface()
|
||||
// send the message
|
||||
return resp, k.sendModuleMessage(ctx, sender, msg, resp)
|
||||
}
|
||||
@ -313,9 +314,9 @@ func (k Keeper) sendModuleMessageUntyped(ctx context.Context, sender []byte, msg
|
||||
// sendModuleMessage can be used to send a message towards a module. It expects the
|
||||
// response type to be known by the caller. It will also assert the sender has the right
|
||||
// is not trying to impersonate another account.
|
||||
func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgResp proto.Message) error {
|
||||
func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgResp implementation.ProtoMsg) error {
|
||||
// do sender assertions.
|
||||
wantSenders, err := k.signerProvider.GetSigners(msg)
|
||||
wantSenders, _, err := k.signerProvider.GetMsgV1Signers(msg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot get signers: %w", err)
|
||||
}
|
||||
@ -325,21 +326,19 @@ func (k Keeper) sendModuleMessage(ctx context.Context, sender []byte, msg, msgRe
|
||||
if !bytes.Equal(sender, wantSenders[0]) {
|
||||
return fmt.Errorf("%w: sender does not match expected sender", ErrUnauthorized)
|
||||
}
|
||||
msgV1, msgRespV1 := msg.(protoiface.MessageV1), msgResp.(protoiface.MessageV1)
|
||||
messageName := getMessageName(msgV1)
|
||||
messageName := implementation.MessageName(msg)
|
||||
handler := k.msgRouter.HybridHandlerByMsgName(messageName)
|
||||
if handler == nil {
|
||||
return fmt.Errorf("unknown message: %s", messageName)
|
||||
}
|
||||
return handler(ctx, msgV1, msgRespV1)
|
||||
return handler(ctx, msg, msgResp)
|
||||
}
|
||||
|
||||
// queryModule is the entrypoint for an account to query a module.
|
||||
// It will try to find the query handler for the given query and execute it.
|
||||
// If multiple query handlers are found, it will return an error.
|
||||
func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp proto.Message) error {
|
||||
queryReqV1, queryRespV1 := queryReq.(protoiface.MessageV1), queryResp.(protoiface.MessageV1)
|
||||
queryName := getMessageName(queryReqV1)
|
||||
func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp implementation.ProtoMsg) error {
|
||||
queryName := implementation.MessageName(queryReq)
|
||||
handlers := k.queryRouter.HybridHandlerByRequestName(queryName)
|
||||
if len(handlers) == 0 {
|
||||
return fmt.Errorf("unknown query: %s", queryName)
|
||||
@ -347,9 +346,32 @@ func (k Keeper) queryModule(ctx context.Context, queryReq, queryResp proto.Messa
|
||||
if len(handlers) > 1 {
|
||||
return fmt.Errorf("multiple handlers for query: %s", queryName)
|
||||
}
|
||||
return handlers[0](ctx, queryReqV1, queryRespV1)
|
||||
return handlers[0](ctx, queryReq, queryResp)
|
||||
}
|
||||
|
||||
func getMessageName(msg protoiface.MessageV1) string {
|
||||
return codectypes.MsgTypeURL(msg)[1:]
|
||||
const msgInterfaceName = "cosmos.accounts.Msg.v1"
|
||||
|
||||
// creates a new interface type which is a alias of the proto message interface to avoid conflicts with sdk.Msg
|
||||
type msgInterface implementation.ProtoMsg
|
||||
|
||||
var msgInterfaceType = (*msgInterface)(nil)
|
||||
|
||||
// registerToInterfaceRegistry registers all the interfaces of the accounts to the
|
||||
// global interface registry. This is required for the SDK to correctly decode
|
||||
// the google.Protobuf.Any used in x/accounts.
|
||||
func registerToInterfaceRegistry(ir InterfaceRegistry, accMap map[string]implementation.Implementation) {
|
||||
ir.RegisterInterface(msgInterfaceName, msgInterfaceType)
|
||||
|
||||
for _, acc := range accMap {
|
||||
// register init
|
||||
ir.RegisterImplementations(msgInterfaceType, acc.InitHandlerSchema.RequestSchema.New(), acc.InitHandlerSchema.ResponseSchema.New())
|
||||
// register exec
|
||||
for _, exec := range acc.ExecuteHandlersSchema {
|
||||
ir.RegisterImplementations(msgInterfaceType, exec.RequestSchema.New(), exec.ResponseSchema.New())
|
||||
}
|
||||
// register query
|
||||
for _, query := range acc.QueryHandlersSchema {
|
||||
ir.RegisterImplementations(msgInterfaceType, query.RequestSchema.New(), query.ResponseSchema.New())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,11 +5,9 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
|
||||
account_abstractionv1 "cosmossdk.io/api/cosmos/accounts/interfaces/account_abstraction/v1"
|
||||
accountsv1 "cosmossdk.io/api/cosmos/accounts/v1"
|
||||
account_abstractionv1 "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
v1 "cosmossdk.io/x/accounts/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -25,9 +23,9 @@ var (
|
||||
func (k Keeper) ExecuteUserOperation(
|
||||
ctx context.Context,
|
||||
bundler string,
|
||||
op *accountsv1.UserOperation,
|
||||
) *accountsv1.UserOperationResponse {
|
||||
resp := &accountsv1.UserOperationResponse{}
|
||||
op *v1.UserOperation,
|
||||
) *v1.UserOperationResponse {
|
||||
resp := &v1.UserOperationResponse{}
|
||||
|
||||
// authenticate
|
||||
authGas, err := k.Authenticate(ctx, bundler, op)
|
||||
@ -66,7 +64,7 @@ func (k Keeper) ExecuteUserOperation(
|
||||
func (k Keeper) Authenticate(
|
||||
ctx context.Context,
|
||||
bundler string,
|
||||
op *accountsv1.UserOperation,
|
||||
op *v1.UserOperation,
|
||||
) (gasUsed uint64, err error) {
|
||||
// authenticate
|
||||
gasUsed, err = k.branchExecutor.ExecuteWithGasLimit(ctx, op.AuthenticationGasLimit, func(ctx context.Context) error {
|
||||
@ -82,7 +80,7 @@ func (k Keeper) Authenticate(
|
||||
func (k Keeper) authenticate(
|
||||
ctx context.Context,
|
||||
bundler string,
|
||||
op *accountsv1.UserOperation,
|
||||
op *v1.UserOperation,
|
||||
) error {
|
||||
senderAddr, err := k.addressCodec.StringToBytes(op.Sender)
|
||||
if err != nil {
|
||||
@ -106,8 +104,8 @@ func (k Keeper) authenticate(
|
||||
func (k Keeper) OpExecuteMessages(
|
||||
ctx context.Context,
|
||||
bundler string,
|
||||
op *accountsv1.UserOperation,
|
||||
) (gasUsed uint64, responses []*anypb.Any, err error) {
|
||||
op *v1.UserOperation,
|
||||
) (gasUsed uint64, responses []*implementation.Any, err error) {
|
||||
// execute messages, the real operation intent
|
||||
gasUsed, err = k.branchExecutor.ExecuteWithGasLimit(ctx, op.ExecutionGasLimit, func(ctx context.Context) error {
|
||||
responses, err = k.opExecuteMessages(ctx, bundler, op)
|
||||
@ -122,8 +120,8 @@ func (k Keeper) OpExecuteMessages(
|
||||
func (k Keeper) opExecuteMessages(
|
||||
ctx context.Context,
|
||||
bundler string,
|
||||
op *accountsv1.UserOperation,
|
||||
) (messagesResponse []*anypb.Any, err error) {
|
||||
op *v1.UserOperation,
|
||||
) (messagesResponse []*implementation.Any, err error) {
|
||||
senderAddr, err := k.addressCodec.StringToBytes(op.Sender)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -159,8 +157,8 @@ func (k Keeper) opExecuteMessages(
|
||||
func (k Keeper) PayBundler(
|
||||
ctx context.Context,
|
||||
bundler string,
|
||||
op *accountsv1.UserOperation,
|
||||
) (gasUsed uint64, responses []*anypb.Any, err error) {
|
||||
op *v1.UserOperation,
|
||||
) (gasUsed uint64, responses []*implementation.Any, err error) {
|
||||
// pay bundler
|
||||
gasUsed, err = k.branchExecutor.ExecuteWithGasLimit(ctx, op.BundlerPaymentGasLimit, func(ctx context.Context) error {
|
||||
responses, err = k.payBundler(ctx, bundler, op)
|
||||
@ -175,8 +173,8 @@ func (k Keeper) PayBundler(
|
||||
func (k Keeper) payBundler(
|
||||
ctx context.Context,
|
||||
bundler string,
|
||||
op *accountsv1.UserOperation,
|
||||
) (paymentResponses []*anypb.Any, err error) {
|
||||
op *v1.UserOperation,
|
||||
) (paymentResponses []*implementation.Any, err error) {
|
||||
// if messages are empty, then there is nothing to do
|
||||
if len(op.BundlerPaymentMessages) == 0 {
|
||||
return nil, nil
|
||||
@ -209,7 +207,7 @@ func (k Keeper) payBundler(
|
||||
|
||||
// parsePayBundlerResponse parses the bundler response as any into a slice of
|
||||
// responses on payment messages.
|
||||
func parsePayBundlerResponse(resp any) ([]*anypb.Any, error) {
|
||||
func parsePayBundlerResponse(resp any) ([]*implementation.Any, error) {
|
||||
payBundlerResp, ok := resp.(*account_abstractionv1.MsgPayBundlerResponse)
|
||||
// this means the account does not properly implement account abstraction.
|
||||
if payBundlerResp == nil {
|
||||
@ -223,7 +221,7 @@ func parsePayBundlerResponse(resp any) ([]*anypb.Any, error) {
|
||||
|
||||
// parseExecuteResponse parses the execute response as any into a slice of
|
||||
// responses on execution messages.
|
||||
func parseExecuteResponse(resp any) ([]*anypb.Any, error) {
|
||||
func parseExecuteResponse(resp any) ([]*implementation.Any, error) {
|
||||
executeResp, ok := resp.(*account_abstractionv1.MsgExecuteResponse)
|
||||
// this means the account does not properly implement account abstraction.
|
||||
if executeResp == nil {
|
||||
|
||||
@ -4,20 +4,20 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
|
||||
basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
)
|
||||
|
||||
func TestKeeper_Init(t *testing.T) {
|
||||
m, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount))
|
||||
m.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error {
|
||||
m.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error {
|
||||
_, ok := req.(*bankv1beta1.QueryBalanceRequest)
|
||||
require.True(t, ok)
|
||||
_, ok = resp.(*bankv1beta1.QueryBalanceResponse)
|
||||
@ -28,9 +28,9 @@ func TestKeeper_Init(t *testing.T) {
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
sender := []byte("sender")
|
||||
|
||||
resp, addr, err := m.Init(ctx, "test", sender, &emptypb.Empty{})
|
||||
resp, addr, err := m.Init(ctx, "test", sender, &types.Empty{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &emptypb.Empty{}, resp)
|
||||
require.Equal(t, &types.Empty{}, resp)
|
||||
require.NotNil(t, addr)
|
||||
|
||||
// ensure acc number was increased.
|
||||
@ -45,33 +45,33 @@ func TestKeeper_Init(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("unknown account type", func(t *testing.T) {
|
||||
_, _, err := m.Init(ctx, "unknown", []byte("sender"), &emptypb.Empty{})
|
||||
_, _, err := m.Init(ctx, "unknown", []byte("sender"), &types.Empty{})
|
||||
require.ErrorIs(t, err, errAccountTypeNotFound)
|
||||
})
|
||||
}
|
||||
|
||||
func TestKeeper_Execute(t *testing.T) {
|
||||
m, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount))
|
||||
m.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error { return nil })
|
||||
m.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { return nil })
|
||||
|
||||
// create account
|
||||
sender := []byte("sender")
|
||||
_, accAddr, err := m.Init(ctx, "test", sender, &emptypb.Empty{})
|
||||
_, accAddr, err := m.Init(ctx, "test", sender, &types.Empty{})
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
resp, err := m.Execute(ctx, accAddr, sender, &emptypb.Empty{})
|
||||
resp, err := m.Execute(ctx, accAddr, sender, &types.Empty{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &emptypb.Empty{}, resp)
|
||||
require.Equal(t, &types.Empty{}, resp)
|
||||
})
|
||||
|
||||
t.Run("unknown account", func(t *testing.T) {
|
||||
_, err := m.Execute(ctx, []byte("unknown"), sender, &emptypb.Empty{})
|
||||
_, err := m.Execute(ctx, []byte("unknown"), sender, &types.Empty{})
|
||||
require.ErrorIs(t, err, collections.ErrNotFound)
|
||||
})
|
||||
|
||||
t.Run("exec module", func(t *testing.T) {
|
||||
m.msgRouter = mockExec(func(ctx context.Context, msg, msgResp proto.Message) error {
|
||||
m.msgRouter = mockExec(func(ctx context.Context, msg, msgResp implementation.ProtoMsg) error {
|
||||
concrete, ok := msg.(*bankv1beta1.MsgSend)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, concrete.ToAddress, "recipient")
|
||||
@ -80,43 +80,43 @@ func TestKeeper_Execute(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
|
||||
m.signerProvider = mockSigner(func(msg proto.Message) ([]byte, error) {
|
||||
m.signerProvider = mockSigner(func(msg implementation.ProtoMsg) ([]byte, error) {
|
||||
require.Equal(t, msg.(*bankv1beta1.MsgSend).FromAddress, string(accAddr))
|
||||
return accAddr, nil
|
||||
})
|
||||
|
||||
resp, err := m.Execute(ctx, accAddr, sender, &wrapperspb.Int64Value{Value: 1000})
|
||||
resp, err := m.Execute(ctx, accAddr, sender, &types.Int64Value{Value: 1000})
|
||||
require.NoError(t, err)
|
||||
require.True(t, proto.Equal(&emptypb.Empty{}, resp.(proto.Message)))
|
||||
require.True(t, implementation.Equal(&types.Empty{}, resp))
|
||||
})
|
||||
}
|
||||
|
||||
func TestKeeper_Query(t *testing.T) {
|
||||
m, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount))
|
||||
m.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error {
|
||||
m.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error {
|
||||
return nil
|
||||
})
|
||||
|
||||
// create account
|
||||
sender := []byte("sender")
|
||||
_, accAddr, err := m.Init(ctx, "test", sender, &emptypb.Empty{})
|
||||
_, accAddr, err := m.Init(ctx, "test", sender, &types.Empty{})
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Run("ok", func(t *testing.T) {
|
||||
resp, err := m.Query(ctx, accAddr, &emptypb.Empty{})
|
||||
resp, err := m.Query(ctx, accAddr, &types.Empty{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, &emptypb.Empty{}, resp)
|
||||
require.Equal(t, &types.Empty{}, resp)
|
||||
})
|
||||
|
||||
t.Run("unknown account", func(t *testing.T) {
|
||||
_, err := m.Query(ctx, []byte("unknown"), &emptypb.Empty{})
|
||||
_, err := m.Query(ctx, []byte("unknown"), &types.Empty{})
|
||||
require.ErrorIs(t, err, collections.ErrNotFound)
|
||||
})
|
||||
|
||||
t.Run("query module", func(t *testing.T) {
|
||||
// we inject the module query function, which accepts only a specific type of message
|
||||
// we force the response
|
||||
m.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error {
|
||||
m.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error {
|
||||
concrete, ok := req.(*bankv1beta1.QueryBalanceRequest)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, string(accAddr), concrete.Address)
|
||||
@ -125,12 +125,12 @@ func TestKeeper_Query(t *testing.T) {
|
||||
Denom: "atom",
|
||||
Amount: "1000",
|
||||
}}
|
||||
proto.Merge(resp, copyResp)
|
||||
proto.Merge(resp.(proto.Message), copyResp)
|
||||
return nil
|
||||
})
|
||||
|
||||
resp, err := m.Query(ctx, accAddr, wrapperspb.String("atom"))
|
||||
resp, err := m.Query(ctx, accAddr, &types.StringValue{Value: "atom"})
|
||||
require.NoError(t, err)
|
||||
require.True(t, proto.Equal(wrapperspb.Int64(1000), resp.(proto.Message)))
|
||||
require.True(t, implementation.Equal(&types.Int64Value{Value: 1000}, resp))
|
||||
})
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"cosmossdk.io/core/event"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
v1 "cosmossdk.io/x/accounts/v1"
|
||||
)
|
||||
|
||||
@ -26,13 +27,8 @@ func (m msgServer) Init(ctx context.Context, request *v1.MsgInit) (*v1.MsgInitRe
|
||||
return nil, err
|
||||
}
|
||||
|
||||
impl, err := m.k.getImplementation(request.AccountType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// decode message bytes into the concrete boxed message type
|
||||
msg, err := impl.InitHandlerSchema.RequestSchema.TxDecode(request.Message)
|
||||
msg, err := implementation.UnpackAnyRaw(request.Message)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -43,12 +39,6 @@ func (m msgServer) Init(ctx context.Context, request *v1.MsgInit) (*v1.MsgInitRe
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// encode the response
|
||||
respBytes, err := impl.InitHandlerSchema.ResponseSchema.TxEncode(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// encode the address
|
||||
accAddrString, err := m.k.addressCodec.BytesToString(accAddr)
|
||||
if err != nil {
|
||||
@ -67,9 +57,14 @@ func (m msgServer) Init(ctx context.Context, request *v1.MsgInit) (*v1.MsgInitRe
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
anyResp, err := implementation.PackAny(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.MsgInitResponse{
|
||||
AccountAddress: accAddrString,
|
||||
Response: respBytes,
|
||||
Response: anyResp,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -85,20 +80,8 @@ func (m msgServer) Execute(ctx context.Context, execute *v1.MsgExecute) (*v1.Msg
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// get account type
|
||||
accType, err := m.k.AccountsByType.Get(ctx, targetAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// get the implementation
|
||||
impl, err := m.k.getImplementation(accType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// decode message bytes into the concrete boxed message type
|
||||
req, err := impl.DecodeExecuteRequest(execute.Message)
|
||||
req, err := implementation.UnpackAnyRaw(execute.Message)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -110,13 +93,12 @@ func (m msgServer) Execute(ctx context.Context, execute *v1.MsgExecute) (*v1.Msg
|
||||
}
|
||||
|
||||
// encode the response
|
||||
respBytes, err := impl.EncodeExecuteResponse(resp)
|
||||
respAny, err := implementation.PackAny(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.MsgExecuteResponse{
|
||||
Response: respBytes,
|
||||
Response: respAny,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@ -6,28 +6,28 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
v1 "cosmossdk.io/x/accounts/v1"
|
||||
)
|
||||
|
||||
func TestMsgServer(t *testing.T) {
|
||||
k, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount))
|
||||
k.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error {
|
||||
k.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error {
|
||||
_, ok := req.(*bankv1beta1.QueryBalanceRequest)
|
||||
require.True(t, ok)
|
||||
proto.Merge(resp, &bankv1beta1.QueryBalanceResponse{})
|
||||
proto.Merge(resp.(proto.Message), &bankv1beta1.QueryBalanceResponse{})
|
||||
return nil
|
||||
})
|
||||
|
||||
s := NewMsgServer(k)
|
||||
|
||||
// create
|
||||
initMsg, err := proto.Marshal(&emptypb.Empty{})
|
||||
initMsg, err := implementation.PackAny(&emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
|
||||
initResp, err := s.Init(ctx, &v1.MsgInit{
|
||||
@ -42,16 +42,13 @@ func TestMsgServer(t *testing.T) {
|
||||
executeMsg := &wrapperspb.StringValue{
|
||||
Value: "10",
|
||||
}
|
||||
executeMsgAny, err := anypb.New(executeMsg)
|
||||
require.NoError(t, err)
|
||||
|
||||
executeMsgBytes, err := proto.Marshal(executeMsgAny)
|
||||
executeMsgAny, err := implementation.PackAny(executeMsg)
|
||||
require.NoError(t, err)
|
||||
|
||||
execResp, err := s.Execute(ctx, &v1.MsgExecute{
|
||||
Sender: "sender",
|
||||
Target: initResp.AccountAddress,
|
||||
Message: executeMsgBytes,
|
||||
Message: executeMsgAny,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, execResp)
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
v1 "cosmossdk.io/x/accounts/v1"
|
||||
)
|
||||
|
||||
@ -24,20 +25,8 @@ func (q queryServer) AccountQuery(ctx context.Context, request *v1.AccountQueryR
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// get acc type
|
||||
accType, err := q.k.AccountsByType.Get(ctx, targetAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// get impl
|
||||
impl, err := q.k.getImplementation(accType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// decode req into boxed concrete type
|
||||
queryReq, err := impl.DecodeQueryRequest(request.Request)
|
||||
queryReq, err := implementation.UnpackAnyRaw(request.Request)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -48,13 +37,13 @@ func (q queryServer) AccountQuery(ctx context.Context, request *v1.AccountQueryR
|
||||
}
|
||||
|
||||
// encode response
|
||||
respBytes, err := impl.EncodeQueryResponse(resp)
|
||||
respAny, err := implementation.PackAny(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.AccountQueryResponse{
|
||||
Response: respBytes,
|
||||
Response: respAny,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@ -4,19 +4,19 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
"cosmossdk.io/x/accounts/internal/implementation"
|
||||
v1 "cosmossdk.io/x/accounts/v1"
|
||||
)
|
||||
|
||||
func TestQueryServer(t *testing.T) {
|
||||
k, ctx := newKeeper(t, accountstd.AddAccount("test", NewTestAccount))
|
||||
k.queryRouter = mockQuery(func(ctx context.Context, req, resp proto.Message) error {
|
||||
k.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error {
|
||||
return nil
|
||||
})
|
||||
|
||||
@ -24,7 +24,7 @@ func TestQueryServer(t *testing.T) {
|
||||
qs := NewQueryServer(k)
|
||||
|
||||
// create
|
||||
initMsg, err := proto.Marshal(&emptypb.Empty{})
|
||||
initMsg, err := implementation.PackAny(&emptypb.Empty{})
|
||||
require.NoError(t, err)
|
||||
|
||||
initResp, err := ms.Init(ctx, &v1.MsgInit{
|
||||
@ -36,24 +36,17 @@ func TestQueryServer(t *testing.T) {
|
||||
|
||||
// query
|
||||
req := &wrapperspb.UInt64Value{Value: 10}
|
||||
anypbReq, err := anypb.New(req)
|
||||
require.NoError(t, err)
|
||||
|
||||
anypbReqBytes, err := proto.Marshal(anypbReq)
|
||||
anypbReq, err := implementation.PackAny(req)
|
||||
require.NoError(t, err)
|
||||
|
||||
queryResp, err := qs.AccountQuery(ctx, &v1.AccountQueryRequest{
|
||||
Target: initResp.AccountAddress,
|
||||
Request: anypbReqBytes,
|
||||
Request: anypbReq,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
respAnyPB := &anypb.Any{}
|
||||
err = proto.Unmarshal(queryResp.Response, respAnyPB)
|
||||
resp, err := implementation.UnpackAnyRaw(queryResp.Response)
|
||||
require.NoError(t, err)
|
||||
|
||||
resp, err := respAnyPB.UnmarshalNew()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, "10", resp.(*wrapperspb.StringValue).Value)
|
||||
require.Equal(t, "10", resp.(*types.StringValue).Value)
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
account_abstractionv1 "cosmossdk.io/api/cosmos/accounts/interfaces/account_abstraction/v1"
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
account_abstractionv1 "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1"
|
||||
)
|
||||
|
||||
// FullAbstractedAccount is an account abstraction that implements
|
||||
|
||||
@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
account_abstractionv1 "cosmossdk.io/api/cosmos/accounts/interfaces/account_abstraction/v1"
|
||||
rotationv1 "cosmossdk.io/api/cosmos/accounts/testing/rotation/v1"
|
||||
"cosmossdk.io/api/cosmos/crypto/secp256k1"
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
account_abstractionv1 "cosmossdk.io/x/accounts/interfaces/account_abstraction/v1"
|
||||
rotationv1 "cosmossdk.io/x/accounts/testing/rotation/v1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
@ -5,9 +5,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
counterv1 "cosmossdk.io/api/cosmos/accounts/testing/counter/v1"
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/x/accounts/accountstd"
|
||||
counterv1 "cosmossdk.io/x/accounts/testing/counter/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
1018
x/accounts/testing/counter/v1/counter.pb.go
Normal file
1018
x/accounts/testing/counter/v1/counter.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
740
x/accounts/testing/rotation/v1/partial.pb.go
Normal file
740
x/accounts/testing/rotation/v1/partial.pb.go
Normal file
@ -0,0 +1,740 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: cosmos/accounts/testing/rotation/v1/partial.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
// MsgInit is the init message used to create a new account
|
||||
// abstraction implementation that we use for testing, this account
|
||||
// also allows for rotating the public key.
|
||||
type MsgInit struct {
|
||||
PubKeyBytes []byte `protobuf:"bytes,1,opt,name=pub_key_bytes,json=pubKeyBytes,proto3" json:"pub_key_bytes,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgInit) Reset() { *m = MsgInit{} }
|
||||
func (m *MsgInit) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgInit) ProtoMessage() {}
|
||||
func (*MsgInit) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_825607d6750dcaf0, []int{0}
|
||||
}
|
||||
func (m *MsgInit) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgInit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgInit.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 *MsgInit) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgInit.Merge(m, src)
|
||||
}
|
||||
func (m *MsgInit) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgInit) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgInit.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgInit proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgInit) GetPubKeyBytes() []byte {
|
||||
if m != nil {
|
||||
return m.PubKeyBytes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MsgInitResponse is the init message response.
|
||||
type MsgInitResponse struct {
|
||||
}
|
||||
|
||||
func (m *MsgInitResponse) Reset() { *m = MsgInitResponse{} }
|
||||
func (m *MsgInitResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgInitResponse) ProtoMessage() {}
|
||||
func (*MsgInitResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_825607d6750dcaf0, []int{1}
|
||||
}
|
||||
func (m *MsgInitResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgInitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgInitResponse.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 *MsgInitResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgInitResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgInitResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgInitResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgInitResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgInitResponse proto.InternalMessageInfo
|
||||
|
||||
// MsgRotatePubKey is the message used to swap the public key
|
||||
// of the account.
|
||||
type MsgRotatePubKey struct {
|
||||
NewPubKeyBytes []byte `protobuf:"bytes,1,opt,name=new_pub_key_bytes,json=newPubKeyBytes,proto3" json:"new_pub_key_bytes,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgRotatePubKey) Reset() { *m = MsgRotatePubKey{} }
|
||||
func (m *MsgRotatePubKey) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgRotatePubKey) ProtoMessage() {}
|
||||
func (*MsgRotatePubKey) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_825607d6750dcaf0, []int{2}
|
||||
}
|
||||
func (m *MsgRotatePubKey) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgRotatePubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgRotatePubKey.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 *MsgRotatePubKey) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgRotatePubKey.Merge(m, src)
|
||||
}
|
||||
func (m *MsgRotatePubKey) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgRotatePubKey) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgRotatePubKey.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgRotatePubKey proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgRotatePubKey) GetNewPubKeyBytes() []byte {
|
||||
if m != nil {
|
||||
return m.NewPubKeyBytes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MsgRotatePubKeyResponse is the MsgRotatePubKey response.
|
||||
type MsgRotatePubKeyResponse struct {
|
||||
}
|
||||
|
||||
func (m *MsgRotatePubKeyResponse) Reset() { *m = MsgRotatePubKeyResponse{} }
|
||||
func (m *MsgRotatePubKeyResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgRotatePubKeyResponse) ProtoMessage() {}
|
||||
func (*MsgRotatePubKeyResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_825607d6750dcaf0, []int{3}
|
||||
}
|
||||
func (m *MsgRotatePubKeyResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgRotatePubKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgRotatePubKeyResponse.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 *MsgRotatePubKeyResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgRotatePubKeyResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgRotatePubKeyResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgRotatePubKeyResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgRotatePubKeyResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgRotatePubKeyResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgInit)(nil), "cosmos.accounts.testing.rotation.v1.MsgInit")
|
||||
proto.RegisterType((*MsgInitResponse)(nil), "cosmos.accounts.testing.rotation.v1.MsgInitResponse")
|
||||
proto.RegisterType((*MsgRotatePubKey)(nil), "cosmos.accounts.testing.rotation.v1.MsgRotatePubKey")
|
||||
proto.RegisterType((*MsgRotatePubKeyResponse)(nil), "cosmos.accounts.testing.rotation.v1.MsgRotatePubKeyResponse")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("cosmos/accounts/testing/rotation/v1/partial.proto", fileDescriptor_825607d6750dcaf0)
|
||||
}
|
||||
|
||||
var fileDescriptor_825607d6750dcaf0 = []byte{
|
||||
// 234 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0x2f, 0xce,
|
||||
0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e,
|
||||
0xc9, 0xcc, 0x4b, 0xd7, 0x2f, 0xca, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, 0xd4,
|
||||
0x2f, 0x48, 0x2c, 0x2a, 0xc9, 0x4c, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x86,
|
||||
0x68, 0xd1, 0x83, 0x69, 0xd1, 0x83, 0x6a, 0xd1, 0x83, 0x69, 0xd1, 0x2b, 0x33, 0x54, 0xd2, 0xe5,
|
||||
0x62, 0xf7, 0x2d, 0x4e, 0xf7, 0xcc, 0xcb, 0x2c, 0x11, 0x52, 0xe2, 0xe2, 0x2d, 0x28, 0x4d, 0x8a,
|
||||
0xcf, 0x4e, 0xad, 0x8c, 0x4f, 0xaa, 0x2c, 0x49, 0x2d, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09,
|
||||
0xe2, 0x2e, 0x28, 0x4d, 0xf2, 0x4e, 0xad, 0x74, 0x02, 0x09, 0x29, 0x09, 0x72, 0xf1, 0x43, 0x95,
|
||||
0x07, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x2a, 0xd9, 0x80, 0x85, 0x82, 0x40, 0x66, 0xa6,
|
||||
0x06, 0x80, 0x95, 0x0a, 0x69, 0x72, 0x09, 0xe6, 0xa5, 0x96, 0xc7, 0x63, 0x33, 0x8d, 0x2f, 0x2f,
|
||||
0xb5, 0x3c, 0x00, 0xc9, 0x40, 0x49, 0x2e, 0x71, 0x34, 0xdd, 0x30, 0x83, 0x9d, 0x5c, 0x4f, 0x3c,
|
||||
0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e,
|
||||
0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x1b, 0xe2, 0xb3, 0xe2, 0x94, 0x6c, 0xbd,
|
||||
0xcc, 0x7c, 0xfd, 0x0a, 0xbc, 0x81, 0x92, 0xc4, 0x06, 0x0e, 0x0d, 0x63, 0x40, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x81, 0xbb, 0x18, 0xec, 0x42, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *MsgInit) 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 *MsgInit) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgInit) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.PubKeyBytes) > 0 {
|
||||
i -= len(m.PubKeyBytes)
|
||||
copy(dAtA[i:], m.PubKeyBytes)
|
||||
i = encodeVarintPartial(dAtA, i, uint64(len(m.PubKeyBytes)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgInitResponse) 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 *MsgInitResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgInitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgRotatePubKey) 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 *MsgRotatePubKey) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgRotatePubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.NewPubKeyBytes) > 0 {
|
||||
i -= len(m.NewPubKeyBytes)
|
||||
copy(dAtA[i:], m.NewPubKeyBytes)
|
||||
i = encodeVarintPartial(dAtA, i, uint64(len(m.NewPubKeyBytes)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgRotatePubKeyResponse) 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 *MsgRotatePubKeyResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgRotatePubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintPartial(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovPartial(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *MsgInit) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.PubKeyBytes)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovPartial(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgInitResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgRotatePubKey) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.NewPubKeyBytes)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovPartial(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgRotatePubKeyResponse) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
return n
|
||||
}
|
||||
|
||||
func sovPartial(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozPartial(x uint64) (n int) {
|
||||
return sovPartial(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *MsgInit) 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 ErrIntOverflowPartial
|
||||
}
|
||||
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: MsgInit: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgInit: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field PubKeyBytes", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPartial
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthPartial
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthPartial
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.PubKeyBytes = append(m.PubKeyBytes[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.PubKeyBytes == nil {
|
||||
m.PubKeyBytes = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipPartial(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthPartial
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgInitResponse) 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 ErrIntOverflowPartial
|
||||
}
|
||||
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: MsgInitResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgInitResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipPartial(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthPartial
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgRotatePubKey) 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 ErrIntOverflowPartial
|
||||
}
|
||||
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: MsgRotatePubKey: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgRotatePubKey: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field NewPubKeyBytes", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowPartial
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthPartial
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthPartial
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.NewPubKeyBytes = append(m.NewPubKeyBytes[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.NewPubKeyBytes == nil {
|
||||
m.NewPubKeyBytes = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipPartial(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthPartial
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgRotatePubKeyResponse) 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 ErrIntOverflowPartial
|
||||
}
|
||||
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: MsgRotatePubKeyResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgRotatePubKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipPartial(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthPartial
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipPartial(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
depth := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowPartial
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowPartial
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowPartial
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthPartial
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupPartial
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthPartial
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthPartial = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowPartial = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupPartial = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
gogoproto "github.com/cosmos/gogoproto/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
@ -35,43 +36,51 @@ func (e eventService) EmitNonConsensus(ctx context.Context, event protoiface.Mes
|
||||
|
||||
func (e eventService) EventManager(ctx context.Context) event.Manager { return e }
|
||||
|
||||
var _ InterfaceRegistry = (*interfaceRegistry)(nil)
|
||||
|
||||
type interfaceRegistry struct{}
|
||||
|
||||
func (i interfaceRegistry) RegisterInterface(string, any, ...gogoproto.Message) {}
|
||||
|
||||
func (i interfaceRegistry) RegisterImplementations(any, ...gogoproto.Message) {}
|
||||
|
||||
func newKeeper(t *testing.T, accounts ...implementation.AccountCreatorFunc) (Keeper, context.Context) {
|
||||
t.Helper()
|
||||
ss, ctx := colltest.MockStore()
|
||||
m, err := NewKeeper(ss, eventService{}, nil, addressCodec{}, nil, nil, nil, accounts...)
|
||||
m, err := NewKeeper(ss, eventService{}, nil, addressCodec{}, nil, nil, nil, interfaceRegistry{}, accounts...)
|
||||
require.NoError(t, err)
|
||||
return m, ctx
|
||||
}
|
||||
|
||||
var _ QueryRouter = (*mockQuery)(nil)
|
||||
|
||||
type mockQuery func(ctx context.Context, req, resp proto.Message) error
|
||||
type mockQuery func(ctx context.Context, req, resp implementation.ProtoMsg) error
|
||||
|
||||
func (m mockQuery) HybridHandlerByRequestName(_ string) []func(ctx context.Context, req, resp protoiface.MessageV1) error {
|
||||
func (m mockQuery) HybridHandlerByRequestName(_ string) []func(ctx context.Context, req, resp implementation.ProtoMsg) error {
|
||||
return []func(ctx context.Context, req, resp protoiface.MessageV1) error{func(ctx context.Context, req, resp protoiface.MessageV1) error {
|
||||
return m(ctx, req.(proto.Message), resp.(proto.Message))
|
||||
return m(ctx, req, resp)
|
||||
}}
|
||||
}
|
||||
|
||||
var _ SignerProvider = (*mockSigner)(nil)
|
||||
|
||||
type mockSigner func(msg proto.Message) ([]byte, error)
|
||||
type mockSigner func(msg implementation.ProtoMsg) ([]byte, error)
|
||||
|
||||
func (m mockSigner) GetSigners(msg proto.Message) ([][]byte, error) {
|
||||
func (m mockSigner) GetMsgV1Signers(msg gogoproto.Message) ([][]byte, proto.Message, error) {
|
||||
s, err := m(msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
return [][]byte{s}, nil
|
||||
return [][]byte{s}, nil, nil
|
||||
}
|
||||
|
||||
var _ MsgRouter = (*mockExec)(nil)
|
||||
|
||||
type mockExec func(ctx context.Context, msg, msgResp proto.Message) error
|
||||
type mockExec func(ctx context.Context, msg, msgResp implementation.ProtoMsg) error
|
||||
|
||||
func (m mockExec) HybridHandlerByMsgName(_ string) func(ctx context.Context, req, resp protoiface.MessageV1) error {
|
||||
return func(ctx context.Context, req, resp protoiface.MessageV1) error {
|
||||
return m(ctx, req.(proto.Message), resp.(proto.Message))
|
||||
return m(ctx, req, resp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ package v1
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
types "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
grpc1 "github.com/cosmos/gogoproto/grpc"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
@ -32,7 +33,7 @@ type AccountQueryRequest struct {
|
||||
// target defines the account to be queried.
|
||||
Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
|
||||
// request defines the query message being sent to the account.
|
||||
Request []byte `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
|
||||
Request *types.Any `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
|
||||
}
|
||||
|
||||
func (m *AccountQueryRequest) Reset() { *m = AccountQueryRequest{} }
|
||||
@ -75,7 +76,7 @@ func (m *AccountQueryRequest) GetTarget() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *AccountQueryRequest) GetRequest() []byte {
|
||||
func (m *AccountQueryRequest) GetRequest() *types.Any {
|
||||
if m != nil {
|
||||
return m.Request
|
||||
}
|
||||
@ -85,7 +86,7 @@ func (m *AccountQueryRequest) GetRequest() []byte {
|
||||
// AccountQueryResponse is the response type for the Query/AccountQuery RPC method.
|
||||
type AccountQueryResponse struct {
|
||||
// response defines the query response of the account.
|
||||
Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
|
||||
Response *types.Any `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
|
||||
}
|
||||
|
||||
func (m *AccountQueryResponse) Reset() { *m = AccountQueryResponse{} }
|
||||
@ -121,7 +122,7 @@ func (m *AccountQueryResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_AccountQueryResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *AccountQueryResponse) GetResponse() []byte {
|
||||
func (m *AccountQueryResponse) GetResponse() *types.Any {
|
||||
if m != nil {
|
||||
return m.Response
|
||||
}
|
||||
@ -400,34 +401,36 @@ func init() {
|
||||
func init() { proto.RegisterFile("cosmos/accounts/v1/query.proto", fileDescriptor_16ad14c22e3080d2) }
|
||||
|
||||
var fileDescriptor_16ad14c22e3080d2 = []byte{
|
||||
// 420 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcd, 0xce, 0xd2, 0x40,
|
||||
0x14, 0x6d, 0x4b, 0x04, 0xbd, 0x2d, 0x68, 0x46, 0x63, 0x9a, 0x2e, 0x1a, 0xe8, 0x42, 0x88, 0x8b,
|
||||
0x69, 0xa8, 0x2e, 0xdc, 0x19, 0xdc, 0x68, 0xe2, 0x8a, 0xaa, 0x1b, 0x37, 0x58, 0xdb, 0x89, 0x10,
|
||||
0xa5, 0x2d, 0x9d, 0x29, 0x81, 0xb7, 0xf0, 0x15, 0x7c, 0x1b, 0x96, 0x2c, 0x5d, 0x7e, 0x81, 0x17,
|
||||
0xf9, 0xc2, 0xfc, 0x40, 0xc9, 0x47, 0x68, 0xd8, 0xcd, 0x99, 0x7b, 0xef, 0xb9, 0x73, 0xcf, 0xb9,
|
||||
0x03, 0x6e, 0x9c, 0xd1, 0x79, 0x46, 0xfd, 0x28, 0x8e, 0xb3, 0x32, 0x65, 0xd4, 0x5f, 0x0e, 0xfd,
|
||||
0x45, 0x49, 0x8a, 0x35, 0xce, 0x8b, 0x8c, 0x65, 0x08, 0x89, 0x38, 0x56, 0x71, 0xbc, 0x1c, 0x7a,
|
||||
0x1f, 0xe1, 0xf9, 0x48, 0xc0, 0xf1, 0x21, 0x33, 0x24, 0x8b, 0x92, 0x50, 0x86, 0x5e, 0x42, 0x93,
|
||||
0x45, 0xc5, 0x2f, 0xc2, 0x6c, 0xbd, 0xab, 0x0f, 0x9e, 0x84, 0x12, 0x21, 0x1b, 0x5a, 0x85, 0x48,
|
||||
0xb1, 0x8d, 0xae, 0x3e, 0xb0, 0x42, 0x05, 0xbd, 0x00, 0x5e, 0x9c, 0x13, 0xd1, 0x3c, 0x4b, 0x29,
|
||||
0x41, 0x0e, 0x3c, 0x2e, 0xe4, 0x99, 0x73, 0x59, 0xe1, 0x11, 0x7b, 0x01, 0xb4, 0xbf, 0xc4, 0x53,
|
||||
0x32, 0x8f, 0x54, 0xdb, 0x1e, 0x58, 0xf2, 0x71, 0x13, 0xb6, 0xce, 0x89, 0x6c, 0x6e, 0xca, 0xbb,
|
||||
0xaf, 0xeb, 0x9c, 0x78, 0x1b, 0x03, 0x3a, 0xaa, 0x48, 0xb6, 0xf8, 0x0c, 0xe6, 0x2c, 0x9d, 0xb1,
|
||||
0x09, 0xe5, 0xd7, 0xbc, 0xc8, 0x0c, 0x5e, 0xe3, 0x87, 0xd3, 0xe2, 0xf3, 0x42, 0xfc, 0x29, 0x4a,
|
||||
0x93, 0x3f, 0xa4, 0x08, 0xe1, 0x50, 0x2e, 0x62, 0xe8, 0x1b, 0x3c, 0x23, 0x2b, 0x12, 0x97, 0x8c,
|
||||
0x4c, 0xa6, 0x22, 0x4c, 0x6d, 0xa3, 0xdb, 0xb8, 0x91, 0xf1, 0xa9, 0xe4, 0x90, 0x98, 0xa2, 0x31,
|
||||
0x74, 0xb8, 0x15, 0x27, 0xd2, 0xc6, 0xcd, 0xa4, 0x6d, 0xce, 0xa0, 0x28, 0x9d, 0xf7, 0xd0, 0x92,
|
||||
0xe7, 0xaa, 0x2d, 0x42, 0x32, 0x05, 0xcf, 0xe4, 0x37, 0x78, 0xe8, 0x24, 0x3f, 0x06, 0x34, 0x3a,
|
||||
0x29, 0xab, 0x3c, 0xb0, 0xa1, 0x15, 0x25, 0x49, 0x41, 0x28, 0x55, 0x5c, 0x12, 0x7a, 0xef, 0x8e,
|
||||
0xbb, 0x22, 0xf2, 0xa5, 0xfc, 0xf5, 0xa6, 0x05, 0xff, 0x0c, 0x78, 0xc4, 0xd7, 0x02, 0xc5, 0x60,
|
||||
0x55, 0xd7, 0x04, 0xf5, 0x2f, 0xcd, 0x7f, 0x61, 0x23, 0x9d, 0x41, 0x7d, 0xa2, 0x1c, 0x4b, 0x43,
|
||||
0x63, 0x68, 0x4a, 0x37, 0x7b, 0xd7, 0xe4, 0x15, 0xc4, 0x5e, 0xbd, 0x03, 0x9e, 0x86, 0x7e, 0x80,
|
||||
0x59, 0x99, 0x1d, 0xbd, 0xba, 0xf2, 0x9a, 0x8a, 0x98, 0x4e, 0xbf, 0x36, 0x4f, 0x75, 0xf8, 0xf0,
|
||||
0x76, 0xb3, 0x73, 0xf5, 0xed, 0xce, 0xd5, 0xef, 0x76, 0xae, 0xfe, 0x77, 0xef, 0x6a, 0xdb, 0xbd,
|
||||
0xab, 0xfd, 0xdf, 0xbb, 0xda, 0x77, 0x47, 0x70, 0xd0, 0xe4, 0x37, 0x9e, 0x65, 0xfe, 0xaa, 0xfa,
|
||||
0xbf, 0x7f, 0x36, 0xf9, 0xd7, 0x7e, 0x73, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xba, 0x54, 0xa3, 0xf0,
|
||||
0xfc, 0x03, 0x00, 0x00,
|
||||
// 453 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xbf, 0x8e, 0xd3, 0x40,
|
||||
0x10, 0xc6, 0x6d, 0x9f, 0x48, 0x60, 0x7c, 0x77, 0xa0, 0xe5, 0x84, 0x8c, 0x0b, 0x2b, 0xe7, 0x82,
|
||||
0x8b, 0x28, 0xd6, 0x5c, 0xa0, 0xa0, 0x43, 0xa1, 0x3a, 0x89, 0x2a, 0x06, 0x1a, 0x24, 0x14, 0x7c,
|
||||
0xf6, 0x92, 0x8b, 0xb8, 0x78, 0x1d, 0xef, 0x3a, 0x8a, 0xdf, 0x82, 0x57, 0xe0, 0x6d, 0x52, 0xa6,
|
||||
0xa4, 0x44, 0xc9, 0x8b, 0xa0, 0xec, 0x9f, 0xd8, 0x11, 0x21, 0x56, 0x3a, 0xcf, 0xce, 0xb7, 0xbf,
|
||||
0xd9, 0x99, 0x6f, 0x12, 0xf0, 0x62, 0xca, 0x26, 0x94, 0x05, 0x51, 0x1c, 0xd3, 0x22, 0xe5, 0x2c,
|
||||
0x98, 0x5d, 0x07, 0xd3, 0x82, 0xe4, 0x25, 0xce, 0x72, 0xca, 0x29, 0x42, 0x32, 0x8f, 0x75, 0x1e,
|
||||
0xcf, 0xae, 0xdd, 0xe7, 0x23, 0x4a, 0x47, 0xf7, 0x24, 0x10, 0x8a, 0xdb, 0xe2, 0x7b, 0x10, 0xa5,
|
||||
0x4a, 0xee, 0x7f, 0x85, 0xa7, 0x7d, 0xa9, 0x1c, 0x6c, 0x20, 0x21, 0x99, 0x16, 0x84, 0x71, 0xf4,
|
||||
0x0c, 0x5a, 0x3c, 0xca, 0x47, 0x84, 0x3b, 0x66, 0xc7, 0xec, 0x3e, 0x0a, 0x55, 0x84, 0x30, 0xb4,
|
||||
0x73, 0x29, 0x71, 0xac, 0x8e, 0xd9, 0xb5, 0x7b, 0x17, 0x58, 0xb2, 0xb1, 0x66, 0xe3, 0x7e, 0x5a,
|
||||
0x86, 0x5a, 0xe4, 0xdf, 0xc0, 0xc5, 0x2e, 0x9e, 0x65, 0x34, 0x65, 0x04, 0xbd, 0x82, 0x87, 0xb9,
|
||||
0xfa, 0x16, 0x15, 0xfe, 0x07, 0xda, 0xaa, 0xfc, 0x1e, 0x9c, 0x7d, 0x8c, 0xef, 0xc8, 0x24, 0xd2,
|
||||
0x4f, 0xbc, 0x84, 0x53, 0xd5, 0xe3, 0x90, 0x97, 0x19, 0x51, 0x0f, 0xb5, 0xd5, 0xd9, 0xa7, 0x32,
|
||||
0x23, 0xfe, 0xc2, 0x82, 0x73, 0x7d, 0x49, 0x15, 0xfe, 0x00, 0xf6, 0x38, 0x1d, 0xf3, 0x21, 0x13,
|
||||
0xc7, 0xaa, 0xf6, 0x4b, 0xfc, 0xef, 0xd0, 0xf0, 0xee, 0x45, 0x7c, 0x13, 0xa5, 0xc9, 0x3d, 0xc9,
|
||||
0x43, 0xd8, 0x5c, 0x97, 0x39, 0xf4, 0x19, 0x9e, 0x90, 0x39, 0x89, 0x0b, 0x4e, 0x86, 0x77, 0x32,
|
||||
0xcd, 0x1c, 0xab, 0x73, 0x72, 0x24, 0xf1, 0xb1, 0x62, 0xa8, 0x98, 0xa1, 0x01, 0x9c, 0x0b, 0x47,
|
||||
0x2b, 0xe8, 0xc9, 0xd1, 0xd0, 0x33, 0x41, 0xd0, 0x48, 0xf7, 0x1d, 0xb4, 0xd5, 0x37, 0x72, 0x2a,
|
||||
0x0b, 0xe5, 0xc8, 0x74, 0x88, 0xdc, 0x9a, 0x29, 0x96, 0x48, 0x55, 0xe3, 0xc7, 0x80, 0xfa, 0xd5,
|
||||
0x64, 0xb5, 0x07, 0x0e, 0xb4, 0xa3, 0x24, 0xc9, 0x09, 0x63, 0x9a, 0xa5, 0x42, 0xff, 0xed, 0x76,
|
||||
0xaf, 0xa4, 0x5e, 0x8d, 0xbf, 0xd9, 0xb4, 0xde, 0x2f, 0x0b, 0x1e, 0x88, 0x65, 0x41, 0x31, 0x9c,
|
||||
0xd6, 0x97, 0x07, 0x5d, 0xed, 0xeb, 0x7f, 0xcf, 0xf6, 0xba, 0xdd, 0x66, 0xa1, 0x6a, 0xcb, 0x40,
|
||||
0x03, 0x68, 0x29, 0x37, 0x2f, 0x0f, 0x8d, 0x57, 0x82, 0xfd, 0x66, 0x07, 0x7c, 0x03, 0x7d, 0x03,
|
||||
0xbb, 0xd6, 0x3b, 0x7a, 0x71, 0xe0, 0x35, 0xb5, 0x61, 0xba, 0x57, 0x8d, 0x3a, 0x5d, 0xe1, 0xfd,
|
||||
0x9b, 0xc5, 0xca, 0x33, 0x97, 0x2b, 0xcf, 0xfc, 0xb3, 0xf2, 0xcc, 0x9f, 0x6b, 0xcf, 0x58, 0xae,
|
||||
0x3d, 0xe3, 0xf7, 0xda, 0x33, 0xbe, 0xb8, 0x92, 0xc1, 0x92, 0x1f, 0x78, 0x4c, 0x83, 0x79, 0xfd,
|
||||
0x6f, 0xe2, 0xb6, 0x25, 0x7e, 0x5a, 0xaf, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x95, 0x18, 0x10,
|
||||
0x13, 0x43, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -608,10 +611,15 @@ func (m *AccountQueryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Request) > 0 {
|
||||
i -= len(m.Request)
|
||||
copy(dAtA[i:], m.Request)
|
||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.Request)))
|
||||
if m.Request != nil {
|
||||
{
|
||||
size, err := m.Request.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintQuery(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -645,10 +653,15 @@ func (m *AccountQueryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Response) > 0 {
|
||||
i -= len(m.Response)
|
||||
copy(dAtA[i:], m.Response)
|
||||
i = encodeVarintQuery(dAtA, i, uint64(len(m.Response)))
|
||||
if m.Response != nil {
|
||||
{
|
||||
size, err := m.Response.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintQuery(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
@ -866,8 +879,8 @@ func (m *AccountQueryRequest) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
l = len(m.Request)
|
||||
if l > 0 {
|
||||
if m.Request != nil {
|
||||
l = m.Request.Size()
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
return n
|
||||
@ -879,8 +892,8 @@ func (m *AccountQueryResponse) Size() (n int) {
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Response)
|
||||
if l > 0 {
|
||||
if m.Response != nil {
|
||||
l = m.Response.Size()
|
||||
n += 1 + l + sovQuery(uint64(l))
|
||||
}
|
||||
return n
|
||||
@ -1038,7 +1051,7 @@ func (m *AccountQueryRequest) Unmarshal(dAtA []byte) error {
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
@ -1048,24 +1061,26 @@ func (m *AccountQueryRequest) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Request = append(m.Request[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Request == nil {
|
||||
m.Request = []byte{}
|
||||
m.Request = &types.Any{}
|
||||
}
|
||||
if err := m.Request.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -1122,7 +1137,7 @@ func (m *AccountQueryResponse) Unmarshal(dAtA []byte) error {
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowQuery
|
||||
@ -1132,24 +1147,26 @@ func (m *AccountQueryResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthQuery
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Response = append(m.Response[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Response == nil {
|
||||
m.Response = []byte{}
|
||||
m.Response = &types.Any{}
|
||||
}
|
||||
if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
|
||||
@ -6,6 +6,7 @@ package v1
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
types "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
|
||||
grpc1 "github.com/cosmos/gogoproto/grpc"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
@ -34,10 +35,8 @@ type MsgInit struct {
|
||||
Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// account_type is the type of the account to be created.
|
||||
AccountType string `protobuf:"bytes,2,opt,name=account_type,json=accountType,proto3" json:"account_type,omitempty"`
|
||||
// message is the message to be sent to the account, it's up to the account
|
||||
// implementation to decide what encoding format should be used to interpret
|
||||
// this message.
|
||||
Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
// message is the message to be sent to the account.
|
||||
Message *types.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgInit) Reset() { *m = MsgInit{} }
|
||||
@ -87,7 +86,7 @@ func (m *MsgInit) GetAccountType() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgInit) GetMessage() []byte {
|
||||
func (m *MsgInit) GetMessage() *types.Any {
|
||||
if m != nil {
|
||||
return m.Message
|
||||
}
|
||||
@ -99,7 +98,7 @@ type MsgInitResponse struct {
|
||||
// account_address is the address of the newly created account.
|
||||
AccountAddress string `protobuf:"bytes,1,opt,name=account_address,json=accountAddress,proto3" json:"account_address,omitempty"`
|
||||
// response is the response returned by the account implementation.
|
||||
Response []byte `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
|
||||
Response *types.Any `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgInitResponse) Reset() { *m = MsgInitResponse{} }
|
||||
@ -142,7 +141,7 @@ func (m *MsgInitResponse) GetAccountAddress() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgInitResponse) GetResponse() []byte {
|
||||
func (m *MsgInitResponse) GetResponse() *types.Any {
|
||||
if m != nil {
|
||||
return m.Response
|
||||
}
|
||||
@ -155,8 +154,8 @@ type MsgExecute struct {
|
||||
Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
// target is the address of the account to be executed.
|
||||
Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
|
||||
// message is the message to be sent to the account, it's up to the account
|
||||
Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
// message is the message to be sent to the account.
|
||||
Message *types.Any `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgExecute) Reset() { *m = MsgExecute{} }
|
||||
@ -206,7 +205,7 @@ func (m *MsgExecute) GetTarget() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgExecute) GetMessage() []byte {
|
||||
func (m *MsgExecute) GetMessage() *types.Any {
|
||||
if m != nil {
|
||||
return m.Message
|
||||
}
|
||||
@ -216,7 +215,7 @@ func (m *MsgExecute) GetMessage() []byte {
|
||||
// MsgExecuteResponse defines the Execute response type for the Msg/Execute RPC method.
|
||||
type MsgExecuteResponse struct {
|
||||
// response is the response returned by the account implementation.
|
||||
Response []byte `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
|
||||
Response *types.Any `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgExecuteResponse) Reset() { *m = MsgExecuteResponse{} }
|
||||
@ -252,7 +251,7 @@ func (m *MsgExecuteResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgExecuteResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgExecuteResponse) GetResponse() []byte {
|
||||
func (m *MsgExecuteResponse) GetResponse() *types.Any {
|
||||
if m != nil {
|
||||
return m.Response
|
||||
}
|
||||
@ -373,36 +372,38 @@ func init() {
|
||||
func init() { proto.RegisterFile("cosmos/accounts/v1/tx.proto", fileDescriptor_29c2b6d8a13d4189) }
|
||||
|
||||
var fileDescriptor_29c2b6d8a13d4189 = []byte{
|
||||
// 460 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x6f, 0xd3, 0x30,
|
||||
0x14, 0xaf, 0x5b, 0x68, 0xd9, 0x6b, 0x61, 0xc8, 0x87, 0x11, 0x79, 0x52, 0xd4, 0x05, 0x04, 0x65,
|
||||
0x9a, 0x12, 0x36, 0x38, 0xed, 0xb6, 0x49, 0x08, 0x38, 0x54, 0x88, 0x08, 0x38, 0x70, 0x41, 0xa9,
|
||||
0x63, 0x45, 0xd5, 0x48, 0x1c, 0xf9, 0xb9, 0x53, 0x77, 0x40, 0x42, 0x7c, 0x00, 0xc4, 0x47, 0xd9,
|
||||
0xc7, 0xe0, 0xb8, 0x23, 0x47, 0xd4, 0x1e, 0xf6, 0x35, 0x50, 0x12, 0x3b, 0x2d, 0x63, 0xeb, 0x76,
|
||||
0xcb, 0x7b, 0xef, 0xf7, 0xcf, 0x7e, 0x31, 0x6c, 0x72, 0x89, 0xa9, 0xc4, 0x20, 0xe2, 0x5c, 0x4e,
|
||||
0x32, 0x8d, 0xc1, 0xf1, 0x6e, 0xa0, 0xa7, 0x7e, 0xae, 0xa4, 0x96, 0x94, 0x56, 0x43, 0xdf, 0x0e,
|
||||
0xfd, 0xe3, 0x5d, 0xf6, 0xc0, 0x10, 0x52, 0x4c, 0x0a, 0x6c, 0x8a, 0x49, 0x05, 0x66, 0x3b, 0x97,
|
||||
0x28, 0x99, 0xef, 0xcf, 0xd1, 0x08, 0xb5, 0x8a, 0xb8, 0x1e, 0xcb, 0xac, 0x42, 0x7b, 0x47, 0xd0,
|
||||
0x19, 0x62, 0xf2, 0x26, 0x1b, 0x6b, 0xba, 0x01, 0x6d, 0x14, 0x59, 0x2c, 0x94, 0x43, 0xfa, 0x64,
|
||||
0xb0, 0x16, 0x9a, 0x8a, 0x6e, 0x41, 0xcf, 0xf2, 0xf5, 0x49, 0x2e, 0x9c, 0x66, 0x39, 0xed, 0x9a,
|
||||
0xde, 0xfb, 0x93, 0x5c, 0x50, 0x07, 0x3a, 0xa9, 0x40, 0x8c, 0x12, 0xe1, 0xb4, 0xfa, 0x64, 0xd0,
|
||||
0x0b, 0x6d, 0xb9, 0xdf, 0xfd, 0x7e, 0x7e, 0xba, 0x6d, 0x94, 0xbc, 0x8f, 0xb0, 0x6e, 0xcc, 0x42,
|
||||
0x81, 0xb9, 0xcc, 0x50, 0xd0, 0x27, 0xb0, 0x5e, 0x87, 0x8b, 0x63, 0x25, 0x10, 0x8d, 0xfb, 0x3d,
|
||||
0xd3, 0x3e, 0xa8, 0xba, 0x94, 0xc1, 0x1d, 0x65, 0x48, 0x65, 0x82, 0x5e, 0x58, 0xd7, 0x1e, 0x07,
|
||||
0x18, 0x62, 0xf2, 0x72, 0x2a, 0xf8, 0x44, 0x8b, 0x2b, 0xcf, 0xb1, 0x01, 0x6d, 0x1d, 0xa9, 0x44,
|
||||
0x68, 0x73, 0x02, 0x53, 0xdd, 0x34, 0xfc, 0x33, 0xa0, 0x0b, 0x93, 0x3a, 0xff, 0x72, 0x2c, 0x72,
|
||||
0x21, 0xd6, 0x57, 0xb8, 0xbf, 0x60, 0x1c, 0x4e, 0xb2, 0xf8, 0x4b, 0x79, 0x53, 0xa3, 0xf2, 0xcb,
|
||||
0xa6, 0xb3, 0x25, 0x3d, 0x00, 0x90, 0xb9, 0x50, 0x51, 0xb1, 0x1c, 0x74, 0x9a, 0xfd, 0xd6, 0xa0,
|
||||
0xbb, 0xb7, 0xe5, 0xff, 0xbf, 0x79, 0xff, 0x03, 0x0a, 0xf5, 0xd6, 0x22, 0xc3, 0x25, 0xd2, 0x7e,
|
||||
0xaf, 0xc8, 0x6b, 0x05, 0x3d, 0x0e, 0xce, 0x45, 0xfb, 0x3a, 0xf6, 0x2b, 0x58, 0xb3, 0x31, 0x8b,
|
||||
0x0b, 0x2f, 0xbc, 0x9e, 0x5e, 0xef, 0x65, 0x18, 0xe1, 0x82, 0xbb, 0xf7, 0xa3, 0x09, 0xad, 0x21,
|
||||
0x26, 0xf4, 0x35, 0xdc, 0x2a, 0x7f, 0xa2, 0xcd, 0xcb, 0x54, 0xcc, 0xd2, 0xd9, 0xc3, 0x15, 0xc3,
|
||||
0x3a, 0xda, 0x3b, 0xe8, 0xd8, 0x4d, 0xba, 0x57, 0xe0, 0xcd, 0x9c, 0x3d, 0x5e, 0x3d, 0xaf, 0x25,
|
||||
0x39, 0xdc, 0xfd, 0x77, 0x0b, 0x8f, 0x56, 0x13, 0x2b, 0x14, 0xdb, 0xb9, 0x09, 0xca, 0x9a, 0xb0,
|
||||
0xdb, 0xdf, 0xce, 0x4f, 0xb7, 0xc9, 0xe1, 0x8b, 0x5f, 0x33, 0x97, 0x9c, 0xcd, 0x5c, 0xf2, 0x67,
|
||||
0xe6, 0x92, 0x9f, 0x73, 0xb7, 0x71, 0x36, 0x77, 0x1b, 0xbf, 0xe7, 0x6e, 0xe3, 0x13, 0xab, 0xd4,
|
||||
0x30, 0x3e, 0xf2, 0xc7, 0x32, 0x98, 0x2e, 0x3f, 0xd0, 0x51, 0xbb, 0x7c, 0x8d, 0xcf, 0xff, 0x06,
|
||||
0x00, 0x00, 0xff, 0xff, 0x02, 0x12, 0x2a, 0x01, 0x07, 0x04, 0x00, 0x00,
|
||||
// 491 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcb, 0x6e, 0xd3, 0x40,
|
||||
0x14, 0xcd, 0x24, 0x90, 0xd0, 0x9b, 0x42, 0xd1, 0x08, 0x15, 0xe3, 0x4a, 0x56, 0x1a, 0x10, 0x84,
|
||||
0xaa, 0x1a, 0xd3, 0xc0, 0xaa, 0xbb, 0x54, 0xe2, 0xb5, 0x88, 0x10, 0x16, 0x6c, 0xd8, 0x20, 0xc7,
|
||||
0x1e, 0x46, 0x11, 0x89, 0xc7, 0xf2, 0x9d, 0x54, 0xf1, 0x02, 0x09, 0xf8, 0x00, 0xc4, 0xa7, 0xf4,
|
||||
0x33, 0x58, 0x76, 0xc9, 0x12, 0x25, 0x8b, 0xfe, 0x06, 0xb2, 0x3d, 0xe3, 0x04, 0x68, 0x42, 0xa5,
|
||||
0xee, 0x3c, 0x73, 0xce, 0x3d, 0x0f, 0xcd, 0x35, 0xec, 0x04, 0x12, 0xc7, 0x12, 0x5d, 0x3f, 0x08,
|
||||
0xe4, 0x24, 0x52, 0xe8, 0x1e, 0x1f, 0xb8, 0x6a, 0xca, 0xe2, 0x44, 0x2a, 0x49, 0x69, 0x01, 0x32,
|
||||
0x03, 0xb2, 0xe3, 0x03, 0xfb, 0x8e, 0x90, 0x52, 0x8c, 0xb8, 0x9b, 0x33, 0x06, 0x93, 0x0f, 0xae,
|
||||
0x1f, 0xa5, 0x05, 0xdd, 0xbe, 0xad, 0xb5, 0xc6, 0x28, 0x32, 0x99, 0x31, 0x0a, 0x0d, 0xec, 0x9f,
|
||||
0x63, 0xa2, 0xbf, 0xdf, 0xfb, 0x03, 0x54, 0x89, 0x1f, 0xa8, 0xa1, 0x8c, 0x0a, 0x76, 0xfb, 0x0b,
|
||||
0x81, 0x46, 0x1f, 0xc5, 0xcb, 0x68, 0xa8, 0xe8, 0x36, 0xd4, 0x91, 0x47, 0x21, 0x4f, 0x2c, 0xd2,
|
||||
0x22, 0x9d, 0x0d, 0x4f, 0x9f, 0xe8, 0x2e, 0x6c, 0x1a, 0x01, 0x95, 0xc6, 0xdc, 0xaa, 0xe6, 0x68,
|
||||
0x53, 0xdf, 0xbd, 0x49, 0x63, 0x4e, 0x19, 0x34, 0xc6, 0x1c, 0xd1, 0x17, 0xdc, 0xaa, 0xb5, 0x48,
|
||||
0xa7, 0xd9, 0xbd, 0xc5, 0x8a, 0xe8, 0xcc, 0x44, 0x67, 0xbd, 0x28, 0xf5, 0x0c, 0xe9, 0xb0, 0xf9,
|
||||
0xf5, 0xec, 0x64, 0x4f, 0xeb, 0xb7, 0x47, 0xb0, 0xa5, 0x23, 0x78, 0x1c, 0x63, 0x19, 0x21, 0xa7,
|
||||
0x0f, 0x60, 0xab, 0xcc, 0x1c, 0x86, 0x09, 0x47, 0xd4, 0x99, 0x6e, 0xe8, 0xeb, 0x5e, 0x71, 0x4b,
|
||||
0x1f, 0xc1, 0xb5, 0x44, 0x0f, 0xe5, 0xb9, 0x56, 0x39, 0x97, 0xac, 0x76, 0x0a, 0xd0, 0x47, 0xf1,
|
||||
0x74, 0xca, 0x83, 0x89, 0xe2, 0x2b, 0x3b, 0x6f, 0x43, 0x5d, 0xf9, 0x89, 0xe0, 0x4a, 0xb7, 0xd5,
|
||||
0xa7, 0xcb, 0x15, 0x7d, 0x06, 0x74, 0x61, 0x5d, 0x76, 0x5d, 0xae, 0x40, 0x2e, 0x54, 0xe1, 0x13,
|
||||
0xdc, 0x5c, 0xe8, 0x1c, 0x4d, 0xa2, 0x70, 0xc4, 0xa9, 0x05, 0x8d, 0x41, 0xfe, 0x65, 0x9a, 0x98,
|
||||
0x23, 0xed, 0x01, 0xc8, 0x98, 0x27, 0x7e, 0xf6, 0xea, 0x68, 0x55, 0x5b, 0xb5, 0x4e, 0xb3, 0xbb,
|
||||
0xcb, 0xfe, 0xdd, 0x36, 0xf6, 0x16, 0x79, 0xf2, 0xca, 0x30, 0xbd, 0xa5, 0xa1, 0xc3, 0xcd, 0xac,
|
||||
0x85, 0x11, 0x6c, 0x07, 0x60, 0xfd, 0x6d, 0x5f, 0x96, 0x79, 0x0e, 0x1b, 0x26, 0x66, 0xf6, 0x64,
|
||||
0x99, 0xd7, 0xc3, 0xff, 0x7b, 0xe9, 0x09, 0x6f, 0x31, 0xdb, 0xfd, 0x56, 0x85, 0x5a, 0x1f, 0x05,
|
||||
0x7d, 0x01, 0x57, 0xf2, 0xe5, 0xdc, 0x39, 0x4f, 0x45, 0xaf, 0x8d, 0x7d, 0x77, 0x0d, 0x58, 0x46,
|
||||
0x7b, 0x0d, 0x0d, 0xf3, 0xea, 0xce, 0x0a, 0xbe, 0xc6, 0xed, 0xfb, 0xeb, 0xf1, 0x52, 0x32, 0x80,
|
||||
0xeb, 0x7f, 0xbe, 0xc2, 0xbd, 0xf5, 0x83, 0x05, 0xcb, 0xde, 0xbf, 0x08, 0xcb, 0x98, 0xd8, 0x57,
|
||||
0x3f, 0x9f, 0x9d, 0xec, 0x91, 0xa3, 0x27, 0x3f, 0x66, 0x0e, 0x39, 0x9d, 0x39, 0xe4, 0xd7, 0xcc,
|
||||
0x21, 0xdf, 0xe7, 0x4e, 0xe5, 0x74, 0xee, 0x54, 0x7e, 0xce, 0x9d, 0xca, 0x3b, 0xbb, 0x50, 0xc3,
|
||||
0xf0, 0x23, 0x1b, 0x4a, 0x77, 0xba, 0xfc, 0xe7, 0x0f, 0xea, 0xf9, 0x0a, 0x3d, 0xfe, 0x1d, 0x00,
|
||||
0x00, 0xff, 0xff, 0x38, 0x4c, 0xe4, 0x12, 0x7b, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -585,10 +586,15 @@ func (m *MsgInit) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Message) > 0 {
|
||||
i -= len(m.Message)
|
||||
copy(dAtA[i:], m.Message)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Message)))
|
||||
if m.Message != nil {
|
||||
{
|
||||
size, err := m.Message.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
@ -629,10 +635,15 @@ func (m *MsgInitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Response) > 0 {
|
||||
i -= len(m.Response)
|
||||
copy(dAtA[i:], m.Response)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Response)))
|
||||
if m.Response != nil {
|
||||
{
|
||||
size, err := m.Response.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
@ -666,10 +677,15 @@ func (m *MsgExecute) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Message) > 0 {
|
||||
i -= len(m.Message)
|
||||
copy(dAtA[i:], m.Message)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Message)))
|
||||
if m.Message != nil {
|
||||
{
|
||||
size, err := m.Message.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
@ -710,10 +726,15 @@ func (m *MsgExecuteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Response) > 0 {
|
||||
i -= len(m.Response)
|
||||
copy(dAtA[i:], m.Response)
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.Response)))
|
||||
if m.Response != nil {
|
||||
{
|
||||
size, err := m.Response.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintTx(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
@ -826,8 +847,8 @@ func (m *MsgInit) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Message)
|
||||
if l > 0 {
|
||||
if m.Message != nil {
|
||||
l = m.Message.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
@ -843,8 +864,8 @@ func (m *MsgInitResponse) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Response)
|
||||
if l > 0 {
|
||||
if m.Response != nil {
|
||||
l = m.Response.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
@ -864,8 +885,8 @@ func (m *MsgExecute) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
l = len(m.Message)
|
||||
if l > 0 {
|
||||
if m.Message != nil {
|
||||
l = m.Message.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
@ -877,8 +898,8 @@ func (m *MsgExecuteResponse) Size() (n int) {
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Response)
|
||||
if l > 0 {
|
||||
if m.Response != nil {
|
||||
l = m.Response.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
return n
|
||||
@ -1021,7 +1042,7 @@ func (m *MsgInit) Unmarshal(dAtA []byte) error {
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
@ -1031,24 +1052,26 @@ func (m *MsgInit) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Message == nil {
|
||||
m.Message = []byte{}
|
||||
m.Message = &types.Any{}
|
||||
}
|
||||
if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -1137,7 +1160,7 @@ func (m *MsgInitResponse) Unmarshal(dAtA []byte) error {
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
@ -1147,24 +1170,26 @@ func (m *MsgInitResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Response = append(m.Response[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Response == nil {
|
||||
m.Response = []byte{}
|
||||
m.Response = &types.Any{}
|
||||
}
|
||||
if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -1285,7 +1310,7 @@ func (m *MsgExecute) Unmarshal(dAtA []byte) error {
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
@ -1295,24 +1320,26 @@ func (m *MsgExecute) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Message == nil {
|
||||
m.Message = []byte{}
|
||||
m.Message = &types.Any{}
|
||||
}
|
||||
if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
@ -1369,7 +1396,7 @@ func (m *MsgExecuteResponse) Unmarshal(dAtA []byte) error {
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
@ -1379,24 +1406,26 @@ func (m *MsgExecuteResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Response = append(m.Response[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.Response == nil {
|
||||
m.Response = []byte{}
|
||||
m.Response = &types.Any{}
|
||||
}
|
||||
if err := m.Response.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user