diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 20630a137610..4df554bf371a 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-latest steps: - - uses: actions/stale@v8 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-pr-message: "This pull request has been automatically marked as stale because it has not had diff --git a/CHANGELOG.md b/CHANGELOG.md index b70bc577eb90..1f2c93f1862b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements * (client/keys) [#18663](https://github.com/cosmos/cosmos-sdk/pull/18663) Improve ` keys add` by displaying mnemonic discreetly on an alternate screen and adding `--indiscreet` option to disable it. +* (telemetry) [#18646] (https://github.com/cosmos/cosmos-sdk/pull/18646) Enable statsd and dogstatsd telemetry sinks * (types) [#18440](https://github.com/cosmos/cosmos-sdk/pull/18440) Add `AmountOfNoValidation` to `sdk.DecCoins`. * (x/gov) [#18025](https://github.com/cosmos/cosmos-sdk/pull/18025) Improve ` q gov proposer` by querying directly a proposal instead of tx events. It is an alias of `q gov proposal` as the proposer is a field of the proposal. * (client) [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503) Add `client.Context{}.WithAddressCodec`, `WithValidatorAddressCodec`, `WithConsensusAddressCodec` to provide address codecs to the client context. See the [UPGRADING.md](./UPGRADING.md) for more details. @@ -85,6 +86,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) [#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 diff --git a/api/cosmos/accounts/v1/query.pulsar.go b/api/cosmos/accounts/v1/query.pulsar.go index 2b96442b683f..d4a0ff1370d1 100644 --- a/api/cosmos/accounts/v1/query.pulsar.go +++ b/api/cosmos/accounts/v1/query.pulsar.go @@ -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, + 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, 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, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, + 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, 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, + 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, - 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, + 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() } diff --git a/api/cosmos/accounts/v1/tx.pulsar.go b/api/cosmos/accounts/v1/tx.pulsar.go index d9f80bfe3d5e..13444ee0405c 100644 --- a/api/cosmos/accounts/v1/tx.pulsar.go +++ b/api/cosmos/accounts/v1/tx.pulsar.go @@ -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() } diff --git a/baseapp/internal/protocompat/protocompat.go b/baseapp/internal/protocompat/protocompat.go index 8e85ea6cede0..4bd24f6c2ff2 100644 --- a/baseapp/internal/protocompat/protocompat.go +++ b/baseapp/internal/protocompat/protocompat.go @@ -6,6 +6,7 @@ import ( "reflect" gogoproto "github.com/cosmos/gogoproto/proto" + "github.com/golang/protobuf/proto" // nolint: staticcheck // needed because gogoproto.Merge does not work consistently. See NOTE: comments. "google.golang.org/grpc" proto2 "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" @@ -125,14 +126,18 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B } resp, err := method.Handler(handler, ctx, func(msg any) error { // merge! ref: https://github.com/cosmos/cosmos-sdk/issues/18003 - gogoproto.Merge(msg.(gogoproto.Message), inReq) + // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but + // using proto.Merge with gogo messages seems to work fine. + proto.Merge(msg.(gogoproto.Message), inReq) return nil }, nil) if err != nil { return err } // merge resp, ref: https://github.com/cosmos/cosmos-sdk/issues/18003 - gogoproto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) + // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but + // using proto.Merge with gogo messages seems to work fine. + proto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) return nil }, nil } @@ -165,14 +170,19 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B // we can just call the handler after making a copy of the message, for safety reasons. resp, err := method.Handler(handler, ctx, func(msg any) error { // ref: https://github.com/cosmos/cosmos-sdk/issues/18003 - gogoproto.Merge(msg.(gogoproto.Message), m) + asGogoProto := msg.(gogoproto.Message) + // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but + // using proto.Merge with gogo messages seems to work fine. + proto.Merge(asGogoProto, m) return nil }, nil) if err != nil { return err } // merge on the resp, ref: https://github.com/cosmos/cosmos-sdk/issues/18003 - gogoproto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) + // NOTE: using gogoproto.Merge will fail for some reason unknown to me, but + // using proto.Merge with gogo messages seems to work fine. + proto.Merge(outResp.(gogoproto.Message), resp.(gogoproto.Message)) return nil default: panic("unreachable") diff --git a/client/v2/README.md b/client/v2/README.md index 96c5359ff62a..5830667f644b 100644 --- a/client/v2/README.md +++ b/client/v2/README.md @@ -37,7 +37,7 @@ It is possible to customize the generation of transactions and queries by defini Here are the steps to use AutoCLI: 1. Ensure your app's modules implements the `appmodule.AppModule` interface. -2. (optional) Configure how behave `autocli` command generation, by implementing the `func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions` method on the module. +2. (optional) Configure how to behave as `autocli` command generation, by implementing the `func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions` method on the module. 3. Use the `autocli.AppOptions` struct to specify the modules you defined. If you are using `depinject` / app v2, it can automatically create an instance of `autocli.AppOptions` based on your app's configuration. 4. Use the `EnhanceRootCommand()` method provided by `autocli` to add the CLI commands for the specified modules to your root command. @@ -211,7 +211,7 @@ https://github.com/cosmos/cosmos-sdk/blob/main/client/grpc/cmtservice/autocli.go ## Summary -`autocli` let you generate CLI to your Cosmos SDK-based applications without any cobra boilerplate. It allows you to easily generate CLI commands and flags from your protobuf messages, and provides many options for customising the behavior of your CLI application. +`autocli` lets you generate CLI to your Cosmos SDK-based applications without any cobra boilerplate. It allows you to easily generate CLI commands and flags from your protobuf messages, and provides many options for customising the behavior of your CLI application. To further enhance your CLI experience with Cosmos SDK-based blockchains, you can use `hubl`. `hubl` is a tool that allows you to query any Cosmos SDK-based blockchain using the new AutoCLI feature of the Cosmos SDK. With `hubl`, you can easily configure a new chain and query modules with just a few simple commands. diff --git a/client/v2/go.mod b/client/v2/go.mod index a655a071eb13..9d1d8482265a 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -33,7 +33,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -148,11 +150,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect diff --git a/client/v2/go.sum b/client/v2/go.sum index 22db67429f87..1213f3b7daff 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/codec/unknownproto/unknown_fields.go b/codec/unknownproto/unknown_fields.go index 9dda4e629b4b..5fa80001c0fe 100644 --- a/codec/unknownproto/unknown_fields.go +++ b/codec/unknownproto/unknown_fields.go @@ -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 } diff --git a/crypto/keys/secp256k1/keys.pb.go b/crypto/keys/secp256k1/keys.pb.go index 283455d0aa75..24ab774e36d4 100644 --- a/crypto/keys/secp256k1/keys.pb.go +++ b/crypto/keys/secp256k1/keys.pb.go @@ -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. diff --git a/docs/architecture/adr-050-sign-mode-textual-annex2.md b/docs/architecture/adr-050-sign-mode-textual-annex2.md index 9bd0f3f47430..e27981047415 100644 --- a/docs/architecture/adr-050-sign-mode-textual-annex2.md +++ b/docs/architecture/adr-050-sign-mode-textual-annex2.md @@ -25,7 +25,7 @@ Unicode text within the transaction. `SIGN_MODE_TEXTUAL` renders to an abstract representation, leaving it up to device-specific software how to present this representation given the -capabilities, limitations, and conventions of the deivce. +capabilities, limitations, and conventions of the device. We offer the following normative guidance: @@ -77,7 +77,7 @@ in many languages: * All other ASCII control characters, plus non-ASCII Unicode code points, are shown as either: - * `\u` followed by 4 uppercase hex chacters for code points + * `\u` followed by 4 uppercase hex characters for code points in the basic multilingual plane (BMP). * `\U` followed by 8 uppercase hex characters for other code points. @@ -116,7 +116,7 @@ Indent Text 0 ">tricky key4<: note the leading space in the presentation" 0 "introducing an aggregate" 1 "key5: false" -1 "key6: a very long line of text, please coöperate and break into multiple lines." +1 "key6: a very long line of text, please cooperate and break into multiple lines." 1 "Can we do further nesting?" 2 "You bet we can!" ``` diff --git a/docs/architecture/adr-061-liquid-staking.md b/docs/architecture/adr-061-liquid-staking.md index fcfeda0d3ed2..81ce2f48575d 100644 --- a/docs/architecture/adr-061-liquid-staking.md +++ b/docs/architecture/adr-061-liquid-staking.md @@ -20,7 +20,7 @@ As both Proof of Stake and blockchain use cases have matured, this design has ag The most important deficiency of the legacy staking design is that it composes poorly with on chain protocols for trading, lending, derivatives that are referred to collectively as DeFi. The legacy staking implementation starves these applications of liquidity by increasing the risk free rate adaptively. It basically makes DeFi and staking security somewhat incompatible. -The Osmosis team has adopted the idea of Superfluid and Interfluid staking where assets that are participating in DeFi appliactions can also be used in proof of stake. This requires tight integration with an enshrined set of DeFi applications and thus is unsuitable for the Cosmos SDK. +The Osmosis team has adopted the idea of Superfluid and Interfluid staking where assets that are participating in DeFi applications can also be used in proof of stake. This requires tight integration with an enshrined set of DeFi applications and thus is unsuitable for the Cosmos SDK. It's also important to note that Interchain Accounts are available in the default IBC implementation and can be used to [rehypothecate](https://www.investopedia.com/terms/h/hypothecation.asp#toc-what-is-rehypothecation) delegations. Thus liquid staking is already possible and these changes merely improve the UX of liquid staking. Centralized exchanges also rehypothecate staked assets, posing challenges for decentralization. This ADR takes the position that adoption of in-protocol liquid staking is the preferable outcome and provides new levers to incentivize decentralization of stake. diff --git a/docs/architecture/adr-063-core-module-api.md b/docs/architecture/adr-063-core-module-api.md index 743dd5fee539..0b9b7436acf9 100644 --- a/docs/architecture/adr-063-core-module-api.md +++ b/docs/architecture/adr-063-core-module-api.md @@ -282,7 +282,7 @@ type HasGenesis interface { #### Pre Blockers -Modules that have functionality that runs before BeginBlock and should implement the has `HasPreBlocker` interfaces: +Modules that have functionality that runs before BeginBlock and should implement the `HasPreBlocker` interfaces: ```go type HasPreBlocker interface { @@ -294,7 +294,7 @@ type HasPreBlocker interface { #### Begin and End Blockers Modules that have functionality that runs before transactions (begin blockers) or after transactions -(end blockers) should implement the has `HasBeginBlocker` and/or `HasEndBlocker` interfaces: +(end blockers) should implement the `HasBeginBlocker` and/or `HasEndBlocker` interfaces: ```go type HasBeginBlocker interface { @@ -452,7 +452,7 @@ func ProvideApp(config *foomodulev2.Module, evtSvc event.EventService, db orm.Mo The `core` module will define a static integer var, `cosmossdk.io/core.RuntimeCompatibilityVersion`, which is a minor version indicator of the core module that is accessible at runtime. Correct runtime module implementations should check this compatibility version and return an error if the current `RuntimeCompatibilityVersion` is higher -than the version of the core API that this runtime version can support. When new features are adding to the `core` +than the version of the core API that this runtime version can support. When new features are added to the `core` module API that runtime modules are required to support, this version should be incremented. ### Runtime Modules diff --git a/docs/architecture/adr-064-abci-2.0.md b/docs/architecture/adr-064-abci-2.0.md index c0dc7f746e81..80383f83d5d2 100644 --- a/docs/architecture/adr-064-abci-2.0.md +++ b/docs/architecture/adr-064-abci-2.0.md @@ -25,7 +25,7 @@ includes `ExtendVote`, `VerifyVoteExtension` and `FinalizeBlock`. ABCI 2.0 continues the promised updates from ABCI++, specifically three additional ABCI methods that the application can implement in order to gain further control, insight and customization of the consensus process, unlocking many novel use-cases -that previously not possible. We describe these three new methods below: +that were previously not possible. We describe these three new methods below: ### `ExtendVote` diff --git a/docs/architecture/adr-067-simulator-v2.md b/docs/architecture/adr-067-simulator-v2.md index 9398aaef601b..ae27f01e24bb 100644 --- a/docs/architecture/adr-067-simulator-v2.md +++ b/docs/architecture/adr-067-simulator-v2.md @@ -137,7 +137,7 @@ func (s *Simulator) SimulateBlock() { } ``` -Note, some application do not define or need their own app-side mempool, so we +Note, some applications do not define or need their own app-side mempool, so we propose that `SelectTxs` mimic CometBFT and just return FIFO-ordered transactions from an ad-hoc simulator mempool. In the case where an application does define its own mempool, it will simply ignore what is provided in `RequestPrepareProposal`. @@ -162,7 +162,7 @@ set of validity predicates, i.e. invariant checkers, that will be executed befor and after each block. This will allow for the application to assert that certain state invariants are held before and after each block. Note, as a consequence of this, we propose to remove the existing notion of invariants from module production -execution paths and deprecate their usage all together. +execution paths and deprecate their usage altogether. ```go type Manager struct { diff --git a/docs/architecture/adr-069-gov-improvements.md b/docs/architecture/adr-069-gov-improvements.md index d87ae571d2c6..17f7f31841e2 100644 --- a/docs/architecture/adr-069-gov-improvements.md +++ b/docs/architecture/adr-069-gov-improvements.md @@ -19,7 +19,7 @@ Those two types are, namely: multiple choice proposals and optimistic proposals. ## Context `x/gov` is the center of Cosmos governance, and has already been improved from its first version `v1beta1`, with a second version [`v1`][5]. -This second iteration on gov unlocked many possibilities by letting governance proposals contain any number of proposals. +This second iteration of gov unlocked many possibilities by letting governance proposals contain any number of proposals. The last addition of gov has been expedited proposals (proposals that have a shorter voting period and a higher quorum, approval threshold). The community requested ([1], [4]) two additional proposals for improving governance choices. Those proposals would be useful when having protocol decisions made on specific choices or simplifying regular proposals that do not require high community involvement. @@ -66,7 +66,7 @@ Voter can only vote NO on the proposal. If the NO threshold is reached, the opti Two governance parameters will be in added [`v1.Params`][5] to support optimistic proposals: ```protobuf -// optimistic_authorized_addreses is an optional governance parameter that limits the authorized accounts than can submit optimisitc proposals +// optimistic_authorized_addreses is an optional governance parameter that limits the authorized accounts that can submit optimistic proposals repeated string optimistic_authorized_addreses = 17 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // Optimistic rejected threshold defines at which percentage of NO votes, the optimistic proposal should fail and be converted to a standard proposal. @@ -77,8 +77,8 @@ string optimistic_rejected_threshold = 18 [(cosmos_proto.scalar) = "cosmos.Dec"] A multiple choice proposal is a proposal where the voting options can be defined by the proposer. -The number of voting option will be limited to a maximum of 4. -A new vote option `SPAM` will be added and distinguished of those voting options. `SPAM` will be used to mark a proposal as spam and is explained further below. +The number of voting options will be limited to a maximum of 4. +A new vote option `SPAM` will be added and distinguished from those voting options. `SPAM` will be used to mark a proposal as spam and is explained further below. Multiple choice proposals, contrary to any other proposal type, cannot have messages to execute. They are only text proposals. diff --git a/docs/spec/SPEC_MODULE.md b/docs/spec/SPEC_MODULE.md index 1b5e5d5dc65f..275d17a5c42e 100644 --- a/docs/spec/SPEC_MODULE.md +++ b/docs/spec/SPEC_MODULE.md @@ -24,7 +24,7 @@ specifications for modules. The following list is nonbinding and all sections ar * `# {Module Name}` - overview of the module * `## Concepts` - describe specialized concepts and definitions used throughout the spec -* `## State` - specify and describe structures expected to marshalled into the store, and their keys +* `## State` - specify and describe structures expected to be marshalled into the store, and their keys * `## State Transitions` - standard state transition operations triggered by hooks, messages, etc. * `## Messages` - specify message structure(s) and expected state machine behaviour(s) * `## Begin Block` - specify any begin-block operations diff --git a/docs/spec/SPEC_STANDARD.md b/docs/spec/SPEC_STANDARD.md index 3608b3654c0b..f6dc07b852f5 100644 --- a/docs/spec/SPEC_STANDARD.md +++ b/docs/spec/SPEC_STANDARD.md @@ -42,7 +42,7 @@ This section should include an assumptions sub-section if any, the mandatory pro This is the main section of the document, and should contain protocol documentation, design rationale, required references, and technical details where appropriate. The section may have any or all of the following sub-sections, as appropriate to the particular specification. The API sub-section is especially encouraged when appropriate. -* *API* - A detailed description of the features's API. +* *API* - A detailed description of the feature's API. * *Technical Details* - All technical details including syntax, diagrams, semantics, protocols, data structures, algorithms, and pseudocode as appropriate. The technical specification should be detailed enough such that separate correct implementations of the specification without knowledge of each other are compatible. * *Backwards Compatibility* - A discussion of compatibility (or lack thereof) with previous feature or protocol versions. * *Known Issues* - A list of known issues. This sub-section is specially important for specifications of already in-use features. diff --git a/docs/spec/store/README.md b/docs/spec/store/README.md index c53d69c67d03..d9d35e7d465c 100644 --- a/docs/spec/store/README.md +++ b/docs/spec/store/README.md @@ -29,7 +29,7 @@ with, which also provides the basis of most state storage and commitment operati is the `KVStore`. The `KVStore` interface provides basic CRUD abilities and prefix-based iteration, including reverse iteration. -Typically, each module has it's own dedicated `KVStore` instance, which it can +Typically, each module has its own dedicated `KVStore` instance, which it can get access to via the `sdk.Context` and the use of a pointer-based named key -- `KVStoreKey`. The `KVStoreKey` provides pseudo-OCAP. How a exactly a `KVStoreKey` maps to a `KVStore` will be illustrated below through the `CommitMultiStore`. @@ -42,7 +42,7 @@ until `Commit()` is called on the `CommitMultiStore`. ### `CommitMultiStore` -The `CommitMultiStore` interface exposes the the top-level interface that is used +The `CommitMultiStore` interface exposes the top-level interface that is used to manage state commitment and storage by an SDK application and abstracts the concept of multiple `KVStore`s which are used by multiple modules. Specifically, it supports the following high-level primitives: @@ -53,7 +53,7 @@ it supports the following high-level primitives: * Allows for loading state storage at a particular height/version in the past to provide current head and historical queries. * Provides the ability to rollback state to a previous height/version. -* Provides the ability to to load state storage at a particular height/version +* Provides the ability to load state storage at a particular height/version while also performing store upgrades, which are used during live hard-fork application state migrations. * Provides the ability to commit all current accumulated state to disk and performs diff --git a/go.mod b/go.mod index e4dffdd8127c..8be52f8a8be2 100644 --- a/go.mod +++ b/go.mod @@ -68,8 +68,10 @@ require ( require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/bufbuild/protocompile v0.6.0 // indirect @@ -156,10 +158,12 @@ require ( gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index b71ccb40e507..e00d156f07e1 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto b/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto index 098448d61809..20203e13af4f 100644 --- a/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto +++ b/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto @@ -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 { diff --git a/proto/cosmos/accounts/testing/counter/v1/counter.proto b/proto/cosmos/accounts/testing/counter/v1/counter.proto index 560e66ebb81d..1985757e1a61 100644 --- a/proto/cosmos/accounts/testing/counter/v1/counter.proto +++ b/proto/cosmos/accounts/testing/counter/v1/counter.proto @@ -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. diff --git a/proto/cosmos/accounts/testing/rotation/v1/partial.proto b/proto/cosmos/accounts/testing/rotation/v1/partial.proto index 9e41d94a06a4..46fc2f4fb82f 100644 --- a/proto/cosmos/accounts/testing/rotation/v1/partial.proto +++ b/proto/cosmos/accounts/testing/rotation/v1/partial.proto @@ -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. diff --git a/proto/cosmos/accounts/v1/query.proto b/proto/cosmos/accounts/v1/query.proto index c6bcee86fa3b..d2b5d55ccfae 100644 --- a/proto/cosmos/accounts/v1/query.proto +++ b/proto/cosmos/accounts/v1/query.proto @@ -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. diff --git a/proto/cosmos/accounts/v1/tx.proto b/proto/cosmos/accounts/v1/tx.proto index 2ab9000871d8..0e5460ece817 100644 --- a/proto/cosmos/accounts/v1/tx.proto +++ b/proto/cosmos/accounts/v1/tx.proto @@ -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 --------- diff --git a/server/config/toml.go b/server/config/toml.go index e5bbf26f8877..179bf511796c 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -121,6 +121,17 @@ global-labels = [{{ range $k, $v := .Telemetry.GlobalLabels }} ["{{index $v 0 }}", "{{ index $v 1}}"],{{ end }} ] +# MetricsSink defines the type of metrics sink to use. +metrics-sink = "{{ .Telemetry.MetricsSink }}" + +# StatsdAddr defines the address of a statsd server to send metrics to. +# Only utilized if MetricsSink is set to "statsd" or "dogstatsd". +statsd-addr = "{{ .Telemetry.StatsdAddr }}" + +# DatadogHostname defines the hostname to use when emitting metrics to +# Datadog. Only utilized if MetricsSink is set to "dogstatsd". +datadog-hostname = "{{ .Telemetry.DatadogHostname }}" + ############################################################################### ### API Configuration ### ############################################################################### diff --git a/simapp/app.go b/simapp/app.go index 5ab2391eb763..4bffaaa09a7a 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -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), diff --git a/simapp/go.mod b/simapp/go.mod index e93789f0034e..65a2cf9e10c4 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -57,7 +57,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/aws/aws-sdk-go v1.45.25 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -194,12 +196,14 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/simapp/go.sum b/simapp/go.sum index eb5efa28f501..714d4ce12200 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -213,6 +213,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/simapp/gomod2nix.toml b/simapp/gomod2nix.toml index a24e15eb87c5..59373847d419 100644 --- a/simapp/gomod2nix.toml +++ b/simapp/gomod2nix.toml @@ -50,9 +50,15 @@ schema = 3 version = "v1.2.0" hash = "sha256-emQlH+RQpESoFCzpHS38fEhs1SLjotxNPlRK4B5Aybs=" replaced = "github.com/cosmos/keyring" + [mod."github.com/DataDog/datadog-go"] + version = "v4.8.3+incompatible" + hash = "sha256-9KvlVQdgyJ1ulDa6wkLb0ACdjc+R0U91hdb7nxodrA0=" [mod."github.com/DataDog/zstd"] version = "v1.5.5" hash = "sha256-tSw0aq0pPyroZtQYYb9lWOtPVNaQOt8skYQ4TMXGvAQ=" + [mod."github.com/Microsoft/go-winio"] + version = "v0.6.0" + hash = "sha256-TQ0AvXZfuT3PDnb4p/h5zmyT8m9VPcwxlXMJuVD6ltE=" [mod."github.com/aws/aws-sdk-go"] version = "v1.45.25" hash = "sha256-ZzeU4WSHm5shDqGnK2mXC2p18NyAO+hKZHP7l1KR69k=" @@ -489,6 +495,9 @@ schema = 3 [mod."golang.org/x/exp"] version = "v0.0.0-20231127185646-65229373498e" hash = "sha256-GmQxMsgz6rZ/O7d4uFif6A/BpDfCqM7WpciDggDSv8I=" + [mod."golang.org/x/mod"] + version = "v0.14.0" + hash = "sha256-sx3hWp5l99DBfIrn821ohfoBwvaITSHMWbzPvX0btLM=" [mod."golang.org/x/net"] version = "v0.19.0" hash = "sha256-3M5rKEvJx4cO/q+06cGjR5sxF5JpnUWY0+fQttrWdT4=" @@ -507,6 +516,9 @@ schema = 3 [mod."golang.org/x/text"] version = "v0.14.0" hash = "sha256-yh3B0tom1RfzQBf1RNmfdNWF1PtiqxV41jW1GVS6JAg=" + [mod."golang.org/x/tools"] + version = "v0.16.0" + hash = "sha256-uVAW8zkeyMvPaWjXjyvq+DCfuA348YtwCrXzNROs7EQ=" [mod."golang.org/x/xerrors"] version = "v0.0.0-20231012003039-104605ab7028" hash = "sha256-IsFTm5WZQ6W1ZDF8WOP+6xiOAc7pIq8r9Afvkjp3PRQ=" diff --git a/store/CHANGELOG.md b/store/CHANGELOG.md index a7f32502c7ce..819a735ac08e 100644 --- a/store/CHANGELOG.md +++ b/store/CHANGELOG.md @@ -33,6 +33,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#17158](https://github.com/cosmos/cosmos-sdk/pull/17158) Start the goroutine after need to create a snapshot. +### Bug fixes + +* [#18651](https://github.com/cosmos/cosmos-sdk/pull/18651) Propagate iavl.MutableTree.Remove errors firstly to the caller instead of returning a synthesized error firstly. + ## [v1.0.0-alpha.1](https://github.com/cosmos/cosmos-sdk/releases/tag/store%2Fv1.0.0-alpha.1) - 2023-07-11 @@ -54,7 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes -* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propogate the Snapshotter's failure to the caller, (it will create a empty snapshot silently before). +* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propagate the Snapshotter's failure to the caller, (it will create a empty snapshot silently before). ## [v0.1.0-alpha.1](https://github.com/cosmos/cosmos-sdk/releases/tag/store%2Fv0.1.0-alpha.1) - 2023-03-17 diff --git a/store/commitment/iavl/tree.go b/store/commitment/iavl/tree.go index 419240b5b365..dc559152c171 100644 --- a/store/commitment/iavl/tree.go +++ b/store/commitment/iavl/tree.go @@ -29,10 +29,13 @@ func NewIavlTree(db dbm.DB, logger log.Logger, cfg *Config) *IavlTree { // Remove removes the given key from the tree. func (t *IavlTree) Remove(key []byte) error { _, res, err := t.tree.Remove(key) + if err != nil { + return err + } if !res { return fmt.Errorf("key %x not found", key) } - return err + return nil } // Set sets the given key-value pair in the tree. @@ -72,6 +75,12 @@ func (t *IavlTree) GetLatestVersion() uint64 { return uint64(t.tree.Version()) } +// SetInitialVersion sets the initial version of the database. +func (t *IavlTree) SetInitialVersion(version uint64) error { + t.tree.SetInitialVersion(version) + return nil +} + // Prune prunes all versions up to and including the provided version. func (t *IavlTree) Prune(version uint64) error { return t.tree.DeleteVersionsTo(int64(version)) diff --git a/store/commitment/store.go b/store/commitment/store.go index ad391b1df3a2..1a716ac15f43 100644 --- a/store/commitment/store.go +++ b/store/commitment/store.go @@ -116,6 +116,16 @@ func (c *CommitStore) Commit() ([]store.StoreInfo, error) { return storeInfos, nil } +func (c *CommitStore) SetInitialVersion(version uint64) error { + for _, tree := range c.multiTrees { + if err := tree.SetInitialVersion(version); err != nil { + return err + } + } + + return nil +} + func (c *CommitStore) GetProof(storeKey string, version uint64, key []byte) (*ics23.CommitmentProof, error) { tree, ok := c.multiTrees[storeKey] if !ok { diff --git a/store/commitment/tree.go b/store/commitment/tree.go index 67acffdf3099..7e41e03e5baa 100644 --- a/store/commitment/tree.go +++ b/store/commitment/tree.go @@ -20,6 +20,7 @@ type Tree interface { WorkingHash() []byte LoadVersion(version uint64) error Commit() ([]byte, error) + SetInitialVersion(version uint64) error GetProof(version uint64, key []byte) (*ics23.CommitmentProof, error) Prune(version uint64) error Export(version uint64) (Exporter, error) diff --git a/store/database.go b/store/database.go index 498e815a8a6d..992dd3db4684 100644 --- a/store/database.go +++ b/store/database.go @@ -72,6 +72,7 @@ type Committer interface { GetLatestVersion() (uint64, error) LoadVersion(targetVersion uint64) error Commit() ([]StoreInfo, error) + SetInitialVersion(version uint64) error GetProof(storeKey string, version uint64, key []byte) (*ics23.CommitmentProof, error) // Prune attempts to prune all versions up to and including the provided diff --git a/store/root/store.go b/store/root/store.go index 453b81b0a0a9..17397af684fd 100644 --- a/store/root/store.go +++ b/store/root/store.go @@ -116,11 +116,7 @@ func (s *Store) SetMetrics(m metrics.Metrics) { func (s *Store) SetInitialVersion(v uint64) error { s.initialVersion = v - // TODO(bez): Call SetInitialVersion on s.stateCommitment. - // - // Ref: https://github.com/cosmos/cosmos-sdk/issues/18597 - - return nil + return s.stateCommitment.SetInitialVersion(v) } // GetSCStore returns the store's state commitment (SC) backend. diff --git a/telemetry/metrics.go b/telemetry/metrics.go index 81708343aa0a..812ff0abdbd2 100644 --- a/telemetry/metrics.go +++ b/telemetry/metrics.go @@ -4,9 +4,11 @@ import ( "bytes" "encoding/json" "fmt" + "net/http" "time" "github.com/hashicorp/go-metrics" + "github.com/hashicorp/go-metrics/datadog" metricsprom "github.com/hashicorp/go-metrics/prometheus" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/expfmt" @@ -21,8 +23,17 @@ const ( FormatDefault = "" FormatPrometheus = "prometheus" FormatText = "text" + + MetricSinkInMem = "mem" + MetricSinkStatsd = "statsd" + MetricSinkDogsStatsd = "dogstatsd" ) +// DisplayableSink is an interface that defines a method for displaying metrics. +type DisplayableSink interface { + DisplayMetrics(resp http.ResponseWriter, req *http.Request) (any, error) +} + // Config defines the configuration options for application telemetry. type Config struct { // Prefixed with keys to separate services @@ -52,6 +63,17 @@ type Config struct { // Example: // [["chain_id", "cosmoshub-1"]] GlobalLabels [][]string `mapstructure:"global-labels"` + + // MetricsSink defines the type of metrics backend to use. + MetricsSink string `mapstructure:"type" default:"mem"` + + // StatsdAddr defines the address of a statsd server to send metrics to. + // Only utilized if MetricsSink is set to "statsd" or "dogstatsd". + StatsdAddr string `mapstructure:"statsd-addr"` + + // DatadogHostname defines the hostname to use when emitting metrics to + // Datadog. Only utilized if MetricsSink is set to "dogstatsd". + DatadogHostname string `mapstructure:"datadog-hostname"` } // Metrics defines a wrapper around application telemetry functionality. It allows @@ -60,7 +82,7 @@ type Config struct { // by the operator. In addition to the sinks, when a process gets a SIGUSR1, a // dump of formatted recent metrics will be sent to STDERR. type Metrics struct { - memSink *metrics.InmemSink + sink metrics.MetricSink prometheusEnabled bool } @@ -81,7 +103,6 @@ func New(cfg Config) (_ *Metrics, rerr error) { for i, gl := range cfg.GlobalLabels { parsedGlobalLabels[i] = NewLabel(gl[0], gl[1]) } - globalLabels = parsedGlobalLabels } @@ -89,16 +110,32 @@ func New(cfg Config) (_ *Metrics, rerr error) { metricsConf.EnableHostname = cfg.EnableHostname metricsConf.EnableHostnameLabel = cfg.EnableHostnameLabel - memSink := metrics.NewInmemSink(10*time.Second, time.Minute) - inMemSig := metrics.DefaultInmemSignal(memSink) - defer func() { - if rerr != nil { - inMemSig.Stop() - } - }() + var ( + sink metrics.MetricSink + err error + ) + switch cfg.MetricsSink { + case MetricSinkStatsd: + sink, err = metrics.NewStatsdSink(cfg.StatsdAddr) + case MetricSinkDogsStatsd: + sink, err = datadog.NewDogStatsdSink(cfg.StatsdAddr, cfg.DatadogHostname) + default: + memSink := metrics.NewInmemSink(10*time.Second, time.Minute) + sink = memSink + inMemSig := metrics.DefaultInmemSignal(memSink) + defer func() { + if rerr != nil { + inMemSig.Stop() + } + }() + } + + if err != nil { + return nil, err + } - m := &Metrics{memSink: memSink} - fanout := metrics.FanoutSink{memSink} + m := &Metrics{sink: sink} + fanout := metrics.FanoutSink{sink} if cfg.PrometheusRetentionTime > 0 { m.prometheusEnabled = true @@ -140,6 +177,8 @@ func (m *Metrics) Gather(format string) (GatherResponse, error) { } } +// gatherPrometheus collects Prometheus metrics and returns a GatherResponse. +// If Prometheus metrics are not enabled, it returns an error. func (m *Metrics) gatherPrometheus() (GatherResponse, error) { if !m.prometheusEnabled { return GatherResponse{}, fmt.Errorf("prometheus metrics are not enabled") @@ -154,6 +193,7 @@ func (m *Metrics) gatherPrometheus() (GatherResponse, error) { defer buf.Reset() e := expfmt.NewEncoder(buf, expfmt.FmtText) + for _, mf := range metricsFamilies { if err := e.Encode(mf); err != nil { return GatherResponse{}, fmt.Errorf("failed to encode prometheus metrics: %w", err) @@ -163,8 +203,14 @@ func (m *Metrics) gatherPrometheus() (GatherResponse, error) { return GatherResponse{ContentType: string(expfmt.FmtText), Metrics: buf.Bytes()}, nil } +// gatherGeneric collects generic metrics and returns a GatherResponse. func (m *Metrics) gatherGeneric() (GatherResponse, error) { - summary, err := m.memSink.DisplayMetrics(nil, nil) + gm, ok := m.sink.(DisplayableSink) + if !ok { + return GatherResponse{}, fmt.Errorf("non in-memory metrics sink does not support generic format") + } + + summary, err := gm.DisplayMetrics(nil, nil) if err != nil { return GatherResponse{}, fmt.Errorf("failed to gather in-memory metrics: %w", err) } diff --git a/telemetry/metrics_test.go b/telemetry/metrics_test.go index 2d57fdf5b5b4..1ce1103529c8 100644 --- a/telemetry/metrics_test.go +++ b/telemetry/metrics_test.go @@ -19,6 +19,7 @@ func TestMetrics_Disabled(t *testing.T) { func TestMetrics_InMem(t *testing.T) { m, err := New(Config{ + MetricsSink: MetricSinkInMem, Enabled: true, EnableHostname: false, ServiceName: "test", @@ -42,6 +43,7 @@ func TestMetrics_InMem(t *testing.T) { func TestMetrics_Prom(t *testing.T) { m, err := New(Config{ + MetricsSink: MetricSinkInMem, Enabled: true, EnableHostname: false, ServiceName: "test", diff --git a/tests/e2e/accounts/account_abstraction_test.go b/tests/e2e/accounts/account_abstraction_test.go index 0b0802ffb551..6ccfc5b571eb 100644 --- a/tests/e2e/accounts/account_abstraction_test.go +++ b/tests/e2e/accounts/account_abstraction_test.go @@ -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) { diff --git a/tests/e2e/accounts/setup_test.go b/tests/e2e/accounts/setup_test.go deleted file mode 100644 index d0588f6825b1..000000000000 --- a/tests/e2e/accounts/setup_test.go +++ /dev/null @@ -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 -} diff --git a/tests/go.mod b/tests/go.mod index 699cfa4475ac..03ddf926150d 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -59,7 +59,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/aws/aws-sdk-go v1.45.25 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -190,12 +192,14 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/tests/go.sum b/tests/go.sum index ac62698e1820..af59b4359e8e 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -213,6 +213,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/tests/starship/tests/go.mod b/tests/starship/tests/go.mod index 95cdea79caae..001db2556974 100644 --- a/tests/starship/tests/go.mod +++ b/tests/starship/tests/go.mod @@ -77,7 +77,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/aws/aws-sdk-go v1.45.25 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -216,12 +218,14 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/tests/starship/tests/go.sum b/tests/starship/tests/go.sum index f8f254e597c2..d7cf0fd9f717 100644 --- a/tests/starship/tests/go.sum +++ b/tests/starship/tests/go.sum @@ -213,6 +213,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/tools/confix/cmd/view.go b/tools/confix/cmd/view.go index bab2116c0453..0c845ce88015 100644 --- a/tools/confix/cmd/view.go +++ b/tools/confix/cmd/view.go @@ -12,7 +12,7 @@ import ( ) func ViewCommand() *cobra.Command { - flagOutputFomat := "output-format" + flagOutputFormat := "output-format" cmd := &cobra.Command{ Use: "view [config]", @@ -31,7 +31,7 @@ func ViewCommand() *cobra.Command { return err } - if format, _ := cmd.Flags().GetString(flagOutputFomat); format == "toml" { + if format, _ := cmd.Flags().GetString(flagOutputFormat); format == "toml" { cmd.Println(string(file)) return nil } @@ -48,7 +48,7 @@ func ViewCommand() *cobra.Command { } // output flag - cmd.Flags().String(flagOutputFomat, "toml", "Output format (json|toml)") + cmd.Flags().String(flagOutputFormat, "toml", "Output format (json|toml)") return cmd } diff --git a/tools/confix/data/v0.50-app.toml b/tools/confix/data/v0.50-app.toml index 08c8fd408c61..75f587576ea5 100644 --- a/tools/confix/data/v0.50-app.toml +++ b/tools/confix/data/v0.50-app.toml @@ -108,6 +108,17 @@ prometheus-retention-time = 0 # [["chain_id", "cosmoshub-1"]] global-labels = [] +# MetricsSink defines the type of metrics sink to use. +metrics-sink = "mem" + +# StatsdAddr defines the address of a statsd server to send metrics to. +# Only utilized if MetricsSink is set to "statsd" or "dogstatsd". +statsd-addr = "" + +# DatadogHostname defines the hostname to use when emitting metrics to +# Datadog. Only utilized if MetricsSink is set to "dogstatsd". +datadog-hostname = "" + ############################################################################### ### API Configuration ### ############################################################################### diff --git a/tools/confix/data/v0.51-app.toml b/tools/confix/data/v0.51-app.toml index df90516dc7fc..918d2238ed3b 100644 --- a/tools/confix/data/v0.51-app.toml +++ b/tools/confix/data/v0.51-app.toml @@ -108,6 +108,17 @@ prometheus-retention-time = 0 # [["chain_id", "cosmoshub-1"]] global-labels = [] +# MetricsSink defines the type of metrics sink to use. +metrics-sink = "mem" + +# StatsdAddr defines the address of a statsd server to send metrics to. +# Only utilized if MetricsSink is set to "statsd" or "dogstatsd". +statsd-addr = "" + +# DatadogHostname defines the hostname to use when emitting metrics to +# Datadog. Only utilized if MetricsSink is set to "dogstatsd". +datadog-hostname = "" + ############################################################################### ### API Configuration ### ############################################################################### diff --git a/types/mempool/priority_nonce_spec.md b/types/mempool/priority_nonce_spec.md index cc24fa1daeb8..ae271e5d6237 100644 --- a/types/mempool/priority_nonce_spec.md +++ b/types/mempool/priority_nonce_spec.md @@ -143,4 +143,4 @@ graph TD Mempool order: [10, 15, 30, 8, 20, 6, 4, 2, 90] -This case shows how the mempool handles a more complex graph with more priority edges between senders. Again we also demonstrate an idiosyncrasy of this nonce/priroity ordering scheme, tx(priority=90) is selected last because it is gated behind tx(priority=2) by nonce ordering. +This case shows how the mempool handles a more complex graph with more priority edges between senders. Again we also demonstrate an idiosyncrasy of this nonce/priority ordering scheme, tx(priority=90) is selected last because it is gated behind tx(priority=2) by nonce ordering. diff --git a/x/accounts/account_test.go b/x/accounts/account_test.go index a984c14e6b39..6d6834b90fa7 100644 --- a/x/accounts/account_test.go +++ b/x/accounts/account_test.go @@ -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 }) } diff --git a/x/accounts/accountstd/exports.go b/x/accounts/accountstd/exports.go index f05191bf8ed5..c29272e6d65a 100644 --- a/x/accounts/accountstd/exports.go +++ b/x/accounts/accountstd/exports.go @@ -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 { diff --git a/x/accounts/cli/cli.go b/x/accounts/cli/cli.go index 7e40ec7af5e6..ed7de6d51618 100644 --- a/x/accounts/cli/cli.go +++ b/x/accounts/cli/cli.go @@ -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 - } - } - if msgSchema == nil { - return "", fmt.Errorf("handler for message type %s not found", msgTypeURL) - } - anyMsg := new(anypb.Any) - err := proto.Unmarshal(protoBytes, anyMsg) - if err != nil { - return "", 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) +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) } - jsonBytes, err := protojson.Marshal(msg) + 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 string(jsonBytes), nil + return codectypes.NewAnyWithValue(msg) } diff --git a/x/accounts/genesis_test.go b/x/accounts/genesis_test.go index 1edafbf5a833..561c14694f50 100644 --- a/x/accounts/genesis_test.go +++ b/x/accounts/genesis_test.go @@ -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) } diff --git a/x/accounts/go.mod b/x/accounts/go.mod index 3ab99296e9f5..934f0b88122d 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -28,7 +28,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -137,11 +139,13 @@ require ( go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect diff --git a/x/accounts/go.sum b/x/accounts/go.sum index 8ed649c577f3..36e8ebf63c58 100644 --- a/x/accounts/go.sum +++ b/x/accounts/go.sum @@ -61,9 +61,13 @@ github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwR github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -844,6 +848,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1067,6 +1073,8 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/x/accounts/interfaces/account_abstraction/v1/interface.pb.go b/x/accounts/interfaces/account_abstraction/v1/interface.pb.go new file mode 100644 index 000000000000..ee4fb356ee69 --- /dev/null +++ b/x/accounts/interfaces/account_abstraction/v1/interface.pb.go @@ -0,0 +1,1671 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/accounts/interfaces/account_abstraction/v1/interface.proto + +package v1 + +import ( + v1 "cosmossdk.io/x/accounts/v1" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" + 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 + +// MsgAuthenticate is a message that an x/account account abstraction implementer +// must handle to authenticate a state transition. +type MsgAuthenticate struct { + // bundler defines the address of the bundler that sent the operation. + // NOTE: in case the operation was sent directly by the user, this field will reflect + // the user address. + Bundler string `protobuf:"bytes,1,opt,name=bundler,proto3" json:"bundler,omitempty"` + // user_operation is the operation that the user is trying to perform. + // it also contains authentication information. + UserOperation *v1.UserOperation `protobuf:"bytes,2,opt,name=user_operation,json=userOperation,proto3" json:"user_operation,omitempty"` +} + +func (m *MsgAuthenticate) Reset() { *m = MsgAuthenticate{} } +func (m *MsgAuthenticate) String() string { return proto.CompactTextString(m) } +func (*MsgAuthenticate) ProtoMessage() {} +func (*MsgAuthenticate) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{0} +} +func (m *MsgAuthenticate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAuthenticate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAuthenticate.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 *MsgAuthenticate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAuthenticate.Merge(m, src) +} +func (m *MsgAuthenticate) XXX_Size() int { + return m.Size() +} +func (m *MsgAuthenticate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAuthenticate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAuthenticate proto.InternalMessageInfo + +func (m *MsgAuthenticate) GetBundler() string { + if m != nil { + return m.Bundler + } + return "" +} + +func (m *MsgAuthenticate) GetUserOperation() *v1.UserOperation { + if m != nil { + return m.UserOperation + } + return nil +} + +// MsgAuthenticateResponse is the response to MsgAuthenticate. +// The authentication either fails or succeeds, this is why +// there are no auxiliary fields to the response. +type MsgAuthenticateResponse struct { +} + +func (m *MsgAuthenticateResponse) Reset() { *m = MsgAuthenticateResponse{} } +func (m *MsgAuthenticateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAuthenticateResponse) ProtoMessage() {} +func (*MsgAuthenticateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{1} +} +func (m *MsgAuthenticateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAuthenticateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAuthenticateResponse.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 *MsgAuthenticateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAuthenticateResponse.Merge(m, src) +} +func (m *MsgAuthenticateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAuthenticateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAuthenticateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAuthenticateResponse proto.InternalMessageInfo + +// MsgPayBundler is a message that an x/account account abstraction implementer +// can optionally implement in case it wants to further refine control over +// the bundler payment messages. +// The account must ensure the caller of this message is the x/accounts module itself. +type MsgPayBundler struct { + // bundler is the address of the bundler. + // NOTE: in case the operation was sent directly by the user, this field will + // reflect the user address. + Bundler string `protobuf:"bytes,1,opt,name=bundler,proto3" json:"bundler,omitempty"` + // bundler_payment_messages are the messages that the operation sender will execute. + // The account can modify the messages as it sees fit. + BundlerPaymentMessages []*types.Any `protobuf:"bytes,2,rep,name=bundler_payment_messages,json=bundlerPaymentMessages,proto3" json:"bundler_payment_messages,omitempty"` +} + +func (m *MsgPayBundler) Reset() { *m = MsgPayBundler{} } +func (m *MsgPayBundler) String() string { return proto.CompactTextString(m) } +func (*MsgPayBundler) ProtoMessage() {} +func (*MsgPayBundler) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{2} +} +func (m *MsgPayBundler) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPayBundler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPayBundler.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 *MsgPayBundler) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPayBundler.Merge(m, src) +} +func (m *MsgPayBundler) XXX_Size() int { + return m.Size() +} +func (m *MsgPayBundler) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPayBundler.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPayBundler proto.InternalMessageInfo + +func (m *MsgPayBundler) GetBundler() string { + if m != nil { + return m.Bundler + } + return "" +} + +func (m *MsgPayBundler) GetBundlerPaymentMessages() []*types.Any { + if m != nil { + return m.BundlerPaymentMessages + } + return nil +} + +// MsgPayBundlerResponse is the response to MsgPayBundler. +type MsgPayBundlerResponse struct { + // bundler_payment_messages_response are the messages that the bundler will pay for. + BundlerPaymentMessagesResponse []*types.Any `protobuf:"bytes,1,rep,name=bundler_payment_messages_response,json=bundlerPaymentMessagesResponse,proto3" json:"bundler_payment_messages_response,omitempty"` +} + +func (m *MsgPayBundlerResponse) Reset() { *m = MsgPayBundlerResponse{} } +func (m *MsgPayBundlerResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPayBundlerResponse) ProtoMessage() {} +func (*MsgPayBundlerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{3} +} +func (m *MsgPayBundlerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPayBundlerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPayBundlerResponse.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 *MsgPayBundlerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPayBundlerResponse.Merge(m, src) +} +func (m *MsgPayBundlerResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPayBundlerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPayBundlerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPayBundlerResponse proto.InternalMessageInfo + +func (m *MsgPayBundlerResponse) GetBundlerPaymentMessagesResponse() []*types.Any { + if m != nil { + return m.BundlerPaymentMessagesResponse + } + return nil +} + +// MsgExecute is a message that an x/account account abstraction implementer +// can optionally implement in case it wants to further refine control over +// the execution messages. It can be used to extend the execution flow, possibly +// block certain messages, or modify them. +// The account must ensure the caller of this message is the x/accounts module itself. +type MsgExecute struct { + // bundler is the address of the bundler. + // NOTE: in case the operation was sent directly by the user, this field will + // reflect the user address. + Bundler string `protobuf:"bytes,1,opt,name=bundler,proto3" json:"bundler,omitempty"` + // execution_messages are the messages that the operation sender will execute. + // The account can modify the messages as it sees fit. + ExecutionMessages []*types.Any `protobuf:"bytes,2,rep,name=execution_messages,json=executionMessages,proto3" json:"execution_messages,omitempty"` +} + +func (m *MsgExecute) Reset() { *m = MsgExecute{} } +func (m *MsgExecute) String() string { return proto.CompactTextString(m) } +func (*MsgExecute) ProtoMessage() {} +func (*MsgExecute) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{4} +} +func (m *MsgExecute) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecute.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 *MsgExecute) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecute.Merge(m, src) +} +func (m *MsgExecute) XXX_Size() int { + return m.Size() +} +func (m *MsgExecute) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecute.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecute proto.InternalMessageInfo + +func (m *MsgExecute) GetBundler() string { + if m != nil { + return m.Bundler + } + return "" +} + +func (m *MsgExecute) GetExecutionMessages() []*types.Any { + if m != nil { + return m.ExecutionMessages + } + return nil +} + +// MsgExecuteResponse is the response to MsgExecute. +type MsgExecuteResponse struct { + // execution_messages_response are the messages that the operation sender will execute. + ExecutionMessagesResponse []*types.Any `protobuf:"bytes,1,rep,name=execution_messages_response,json=executionMessagesResponse,proto3" json:"execution_messages_response,omitempty"` +} + +func (m *MsgExecuteResponse) Reset() { *m = MsgExecuteResponse{} } +func (m *MsgExecuteResponse) String() string { return proto.CompactTextString(m) } +func (*MsgExecuteResponse) ProtoMessage() {} +func (*MsgExecuteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{5} +} +func (m *MsgExecuteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecuteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecuteResponse.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 *MsgExecuteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecuteResponse.Merge(m, src) +} +func (m *MsgExecuteResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgExecuteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecuteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecuteResponse proto.InternalMessageInfo + +func (m *MsgExecuteResponse) GetExecutionMessagesResponse() []*types.Any { + if m != nil { + return m.ExecutionMessagesResponse + } + return nil +} + +// QueryAuthenticationMethods is a query that an x/account account abstraction implementer +// must handle to return the authentication methods that the account supports. +type QueryAuthenticationMethods struct { +} + +func (m *QueryAuthenticationMethods) Reset() { *m = QueryAuthenticationMethods{} } +func (m *QueryAuthenticationMethods) String() string { return proto.CompactTextString(m) } +func (*QueryAuthenticationMethods) ProtoMessage() {} +func (*QueryAuthenticationMethods) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{6} +} +func (m *QueryAuthenticationMethods) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuthenticationMethods) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuthenticationMethods.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 *QueryAuthenticationMethods) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuthenticationMethods.Merge(m, src) +} +func (m *QueryAuthenticationMethods) XXX_Size() int { + return m.Size() +} +func (m *QueryAuthenticationMethods) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuthenticationMethods.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuthenticationMethods proto.InternalMessageInfo + +// QueryAuthenticationMethodsResponse is the response to QueryAuthenticationMethods. +type QueryAuthenticationMethodsResponse struct { + // authentication_methods are the authentication methods that the account supports. + AuthenticationMethods []string `protobuf:"bytes,1,rep,name=authentication_methods,json=authenticationMethods,proto3" json:"authentication_methods,omitempty"` +} + +func (m *QueryAuthenticationMethodsResponse) Reset() { *m = QueryAuthenticationMethodsResponse{} } +func (m *QueryAuthenticationMethodsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAuthenticationMethodsResponse) ProtoMessage() {} +func (*QueryAuthenticationMethodsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56b360422260e9d1, []int{7} +} +func (m *QueryAuthenticationMethodsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAuthenticationMethodsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAuthenticationMethodsResponse.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 *QueryAuthenticationMethodsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAuthenticationMethodsResponse.Merge(m, src) +} +func (m *QueryAuthenticationMethodsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAuthenticationMethodsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAuthenticationMethodsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAuthenticationMethodsResponse proto.InternalMessageInfo + +func (m *QueryAuthenticationMethodsResponse) GetAuthenticationMethods() []string { + if m != nil { + return m.AuthenticationMethods + } + return nil +} + +func init() { + proto.RegisterType((*MsgAuthenticate)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgAuthenticate") + proto.RegisterType((*MsgAuthenticateResponse)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgAuthenticateResponse") + proto.RegisterType((*MsgPayBundler)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgPayBundler") + proto.RegisterType((*MsgPayBundlerResponse)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgPayBundlerResponse") + proto.RegisterType((*MsgExecute)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgExecute") + proto.RegisterType((*MsgExecuteResponse)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.MsgExecuteResponse") + proto.RegisterType((*QueryAuthenticationMethods)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.QueryAuthenticationMethods") + proto.RegisterType((*QueryAuthenticationMethodsResponse)(nil), "cosmos.accounts.interfaces.account_abstraction.v1.QueryAuthenticationMethodsResponse") +} + +func init() { + proto.RegisterFile("cosmos/accounts/interfaces/account_abstraction/v1/interface.proto", fileDescriptor_56b360422260e9d1) +} + +var fileDescriptor_56b360422260e9d1 = []byte{ + // 438 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x3d, 0x6f, 0xd3, 0x40, + 0x18, 0xc7, 0xe3, 0x22, 0x81, 0xfa, 0x54, 0x05, 0x61, 0xd1, 0xe2, 0x04, 0x64, 0xa5, 0x9e, 0x32, + 0xa0, 0xb3, 0x5c, 0xc4, 0xc0, 0x98, 0x22, 0x24, 0x96, 0x40, 0x31, 0xb0, 0xc0, 0x60, 0x5d, 0x9c, + 0xa7, 0xae, 0x69, 0x73, 0x17, 0xdd, 0x73, 0x67, 0xc5, 0xdf, 0x82, 0x8f, 0xc5, 0xd8, 0x91, 0x11, + 0x25, 0x5f, 0x04, 0xe1, 0xb7, 0xb4, 0xa9, 0x53, 0xa5, 0x9b, 0xcf, 0xfe, 0x3d, 0xff, 0x97, 0x3b, + 0x1f, 0x0c, 0x63, 0x49, 0x53, 0x49, 0x3e, 0x8f, 0x63, 0x69, 0x84, 0x26, 0x3f, 0x15, 0x1a, 0xd5, + 0x19, 0x8f, 0xb1, 0x79, 0x17, 0xf1, 0x31, 0x69, 0xc5, 0x63, 0x9d, 0x4a, 0xe1, 0x67, 0xc1, 0x8a, + 0x60, 0x33, 0x25, 0xb5, 0xb4, 0x83, 0x52, 0x82, 0xd5, 0x12, 0x6c, 0x25, 0xc1, 0x5a, 0x24, 0x58, + 0x16, 0xf4, 0xba, 0x89, 0x94, 0xc9, 0x25, 0xfa, 0x85, 0xc0, 0xd8, 0x9c, 0xf9, 0x5c, 0xe4, 0xa5, + 0x5a, 0xef, 0xd5, 0x7a, 0xa0, 0x2c, 0x68, 0x0b, 0x52, 0xd2, 0x9e, 0x81, 0x27, 0x23, 0x4a, 0x86, + 0x46, 0x9f, 0xa3, 0xd0, 0x69, 0xcc, 0x35, 0xda, 0x0e, 0x3c, 0x1a, 0x1b, 0x31, 0xb9, 0x44, 0xe5, + 0x58, 0x7d, 0x6b, 0xb0, 0x1b, 0xd6, 0x4b, 0xfb, 0x03, 0x3c, 0x36, 0x84, 0x2a, 0x92, 0x33, 0x54, + 0xfc, 0xbf, 0x88, 0xb3, 0xd3, 0xb7, 0x06, 0x7b, 0xc7, 0x47, 0x6c, 0xbd, 0x41, 0x16, 0xb0, 0x6f, + 0x84, 0xea, 0x53, 0x0d, 0x86, 0xfb, 0xe6, 0xfa, 0xd2, 0xeb, 0xc2, 0xf3, 0x35, 0xdb, 0x10, 0x69, + 0x26, 0x05, 0xa1, 0x97, 0xc3, 0xfe, 0x88, 0x92, 0x53, 0x9e, 0x9f, 0x54, 0xae, 0x9b, 0xf3, 0x7c, + 0x04, 0xa7, 0x7a, 0x8c, 0x66, 0x3c, 0x9f, 0xa2, 0xd0, 0xd1, 0x14, 0x89, 0x78, 0x82, 0xe4, 0xec, + 0xf4, 0x1f, 0x0c, 0xf6, 0x8e, 0x9f, 0xb1, 0x72, 0xa3, 0x58, 0xbd, 0x51, 0x6c, 0x28, 0xf2, 0xf0, + 0xb0, 0x9a, 0x3a, 0x2d, 0x87, 0x46, 0xd5, 0x8c, 0x37, 0x87, 0x83, 0x1b, 0xd6, 0x75, 0x26, 0x3b, + 0x82, 0xa3, 0x4d, 0x46, 0x91, 0xaa, 0x20, 0xc7, 0xba, 0xc3, 0xd1, 0x6d, 0x77, 0x6c, 0x4a, 0x5f, + 0x00, 0x8c, 0x28, 0x79, 0x3f, 0xc7, 0xd8, 0xdc, 0x79, 0x02, 0xef, 0xc0, 0xc6, 0x02, 0x4a, 0xa5, + 0xd8, 0xae, 0xeb, 0xd3, 0x86, 0x6f, 0x6a, 0xfe, 0x04, 0x7b, 0x65, 0xd6, 0x74, 0xfc, 0x0a, 0x2f, + 0x6e, 0x4b, 0x6f, 0xd7, 0xae, 0x7b, 0xcb, 0xa3, 0x29, 0xf6, 0x12, 0x7a, 0x9f, 0x0d, 0xaa, 0xfc, + 0xda, 0x51, 0x17, 0x98, 0x3e, 0x97, 0x13, 0xf2, 0x7e, 0x80, 0xb7, 0xf9, 0x6b, 0x93, 0xec, 0x0d, + 0x1c, 0xf2, 0x1b, 0x40, 0x34, 0x2d, 0x89, 0x22, 0xd4, 0x6e, 0x78, 0xc0, 0xdb, 0xc6, 0x4f, 0xbe, + 0xfc, 0x5e, 0xb8, 0xd6, 0xd5, 0xc2, 0xb5, 0xfe, 0x2e, 0x5c, 0xeb, 0xd7, 0xd2, 0xed, 0x5c, 0x2d, + 0xdd, 0xce, 0x9f, 0xa5, 0xdb, 0xf9, 0xfe, 0xb6, 0xfc, 0x5d, 0x69, 0x72, 0xc1, 0x52, 0xe9, 0xcf, + 0xef, 0x71, 0x77, 0xc7, 0x0f, 0x8b, 0xe2, 0xaf, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x78, 0x97, + 0xe4, 0x0c, 0xf7, 0x03, 0x00, 0x00, +} + +func (m *MsgAuthenticate) 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 *MsgAuthenticate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAuthenticate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.UserOperation != nil { + { + size, err := m.UserOperation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Bundler) > 0 { + i -= len(m.Bundler) + copy(dAtA[i:], m.Bundler) + i = encodeVarintInterface(dAtA, i, uint64(len(m.Bundler))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAuthenticateResponse) 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 *MsgAuthenticateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAuthenticateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgPayBundler) 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 *MsgPayBundler) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPayBundler) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BundlerPaymentMessages) > 0 { + for iNdEx := len(m.BundlerPaymentMessages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BundlerPaymentMessages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Bundler) > 0 { + i -= len(m.Bundler) + copy(dAtA[i:], m.Bundler) + i = encodeVarintInterface(dAtA, i, uint64(len(m.Bundler))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPayBundlerResponse) 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 *MsgPayBundlerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPayBundlerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BundlerPaymentMessagesResponse) > 0 { + for iNdEx := len(m.BundlerPaymentMessagesResponse) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BundlerPaymentMessagesResponse[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgExecute) 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 *MsgExecute) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ExecutionMessages) > 0 { + for iNdEx := len(m.ExecutionMessages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ExecutionMessages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Bundler) > 0 { + i -= len(m.Bundler) + copy(dAtA[i:], m.Bundler) + i = encodeVarintInterface(dAtA, i, uint64(len(m.Bundler))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExecuteResponse) 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 *MsgExecuteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecuteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ExecutionMessagesResponse) > 0 { + for iNdEx := len(m.ExecutionMessagesResponse) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ExecutionMessagesResponse[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintInterface(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAuthenticationMethods) 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 *QueryAuthenticationMethods) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthenticationMethods) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAuthenticationMethodsResponse) 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 *QueryAuthenticationMethodsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthenticationMethodsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AuthenticationMethods) > 0 { + for iNdEx := len(m.AuthenticationMethods) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AuthenticationMethods[iNdEx]) + copy(dAtA[i:], m.AuthenticationMethods[iNdEx]) + i = encodeVarintInterface(dAtA, i, uint64(len(m.AuthenticationMethods[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintInterface(dAtA []byte, offset int, v uint64) int { + offset -= sovInterface(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgAuthenticate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bundler) + if l > 0 { + n += 1 + l + sovInterface(uint64(l)) + } + if m.UserOperation != nil { + l = m.UserOperation.Size() + n += 1 + l + sovInterface(uint64(l)) + } + return n +} + +func (m *MsgAuthenticateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgPayBundler) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bundler) + if l > 0 { + n += 1 + l + sovInterface(uint64(l)) + } + if len(m.BundlerPaymentMessages) > 0 { + for _, e := range m.BundlerPaymentMessages { + l = e.Size() + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func (m *MsgPayBundlerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BundlerPaymentMessagesResponse) > 0 { + for _, e := range m.BundlerPaymentMessagesResponse { + l = e.Size() + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func (m *MsgExecute) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Bundler) + if l > 0 { + n += 1 + l + sovInterface(uint64(l)) + } + if len(m.ExecutionMessages) > 0 { + for _, e := range m.ExecutionMessages { + l = e.Size() + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func (m *MsgExecuteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ExecutionMessagesResponse) > 0 { + for _, e := range m.ExecutionMessagesResponse { + l = e.Size() + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func (m *QueryAuthenticationMethods) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAuthenticationMethodsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AuthenticationMethods) > 0 { + for _, s := range m.AuthenticationMethods { + l = len(s) + n += 1 + l + sovInterface(uint64(l)) + } + } + return n +} + +func sovInterface(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozInterface(x uint64) (n int) { + return sovInterface(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgAuthenticate) 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 ErrIntOverflowInterface + } + 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: MsgAuthenticate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAuthenticate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bundler", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bundler = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserOperation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UserOperation == nil { + m.UserOperation = &v1.UserOperation{} + } + if err := m.UserOperation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAuthenticateResponse) 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 ErrIntOverflowInterface + } + 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: MsgAuthenticateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAuthenticateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPayBundler) 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 ErrIntOverflowInterface + } + 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: MsgPayBundler: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPayBundler: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bundler", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bundler = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundlerPaymentMessages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BundlerPaymentMessages = append(m.BundlerPaymentMessages, &types.Any{}) + if err := m.BundlerPaymentMessages[len(m.BundlerPaymentMessages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPayBundlerResponse) 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 ErrIntOverflowInterface + } + 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: MsgPayBundlerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPayBundlerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundlerPaymentMessagesResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BundlerPaymentMessagesResponse = append(m.BundlerPaymentMessagesResponse, &types.Any{}) + if err := m.BundlerPaymentMessagesResponse[len(m.BundlerPaymentMessagesResponse)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecute) 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 ErrIntOverflowInterface + } + 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: MsgExecute: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecute: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bundler", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bundler = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecutionMessages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExecutionMessages = append(m.ExecutionMessages, &types.Any{}) + if err := m.ExecutionMessages[len(m.ExecutionMessages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecuteResponse) 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 ErrIntOverflowInterface + } + 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: MsgExecuteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecuteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecutionMessagesResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExecutionMessagesResponse = append(m.ExecutionMessagesResponse, &types.Any{}) + if err := m.ExecutionMessagesResponse[len(m.ExecutionMessagesResponse)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAuthenticationMethods) 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 ErrIntOverflowInterface + } + 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: QueryAuthenticationMethods: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuthenticationMethods: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAuthenticationMethodsResponse) 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 ErrIntOverflowInterface + } + 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: QueryAuthenticationMethodsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAuthenticationMethodsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthenticationMethods", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowInterface + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthInterface + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthInterface + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthenticationMethods = append(m.AuthenticationMethods, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipInterface(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthInterface + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipInterface(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, ErrIntOverflowInterface + } + 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, ErrIntOverflowInterface + } + 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, ErrIntOverflowInterface + } + 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, ErrInvalidLengthInterface + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupInterface + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthInterface + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthInterface = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowInterface = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupInterface = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/accounts/internal/implementation/account_test.go b/x/accounts/internal/implementation/account_test.go index 7654ea1d261c..938b98820043 100644 --- a/x/accounts/internal/implementation/account_test.go +++ b/x/accounts/internal/implementation/account_test.go @@ -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 }) } diff --git a/x/accounts/internal/implementation/api_builder.go b/x/accounts/internal/implementation/api_builder.go index ee8344b86c1a..bd6e408215ea 100644 --- a/x/accounts/internal/implementation/api_builder.go +++ b/x/accounts/internal/implementation/api_builder.go @@ -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() } diff --git a/x/accounts/internal/implementation/api_builder_test.go b/x/accounts/internal/implementation/api_builder_test.go index 8382ea8b8b69..acad2af651db 100644 --- a/x/accounts/internal/implementation/api_builder_test.go +++ b/x/accounts/internal/implementation/api_builder_test.go @@ -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) } diff --git a/x/accounts/internal/implementation/context.go b/x/accounts/internal/implementation/context.go index 7f14a73d04ce..838a7593a754 100644 --- a/x/accounts/internal/implementation/context.go +++ b/x/accounts/internal/implementation/context.go @@ -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) diff --git a/x/accounts/internal/implementation/context_test.go b/x/accounts/internal/implementation/context_test.go index 327445fb7623..0eddb63ddbfa 100644 --- a/x/accounts/internal/implementation/context_test.go +++ b/x/accounts/internal/implementation/context_test.go @@ -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)) } diff --git a/x/accounts/internal/implementation/encoding.go b/x/accounts/internal/implementation/encoding.go new file mode 100644 index 000000000000..93e096ab0cb8 --- /dev/null +++ b/x/accounts/internal/implementation/encoding.go @@ -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) +} diff --git a/x/accounts/internal/implementation/implementation.go b/x/accounts/internal/implementation/implementation.go index 9587afdb0fb8..f1410c97a979 100644 --- a/x/accounts/internal/implementation/implementation.go +++ b/x/accounts/internal/implementation/implementation.go @@ -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. diff --git a/x/accounts/internal/implementation/implementation_test.go b/x/accounts/internal/implementation/implementation_test.go index 7b42fd8b53ea..1aeb5ddd2025 100644 --- a/x/accounts/internal/implementation/implementation_test.go +++ b/x/accounts/internal/implementation/implementation_test.go @@ -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}) - 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") + _, err := impl.Query(ctx, &types.Int32Value{Value: 1}) require.ErrorIs(t, err, errInvalidMessage) - require.ErrorContains(t, err, "expected protoreflect.Message") }) } diff --git a/x/accounts/internal/implementation/proto_util.go b/x/accounts/internal/implementation/proto_util.go deleted file mode 100644 index caf89a4af2dc..000000000000 --- a/x/accounts/internal/implementation/proto_util.go +++ /dev/null @@ -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, - }) -} diff --git a/x/accounts/internal/implementation/protoaccount.go b/x/accounts/internal/implementation/protoaccount.go index 23b0145f39e9..299e48eb6263 100644 --- a/x/accounts/internal/implementation/protoaccount.go +++ b/x/accounts/internal/implementation/protoaccount.go @@ -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, - } - jsonUnmarshaler := protojson.UnmarshalOptions{ - DiscardUnknown: true, + if _, ok := (interface{}(msg)).(proto.Message); ok { + panic("protov2 messages are not supported") } - 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)) }, } } diff --git a/x/accounts/keeper.go b/x/accounts/keeper.go index 913f4d5fd549..18f91628a295 100644 --- a/x/accounts/keeper.go +++ b/x/accounts/keeper.go @@ -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()) + } + } } diff --git a/x/accounts/keeper_account_abstraction.go b/x/accounts/keeper_account_abstraction.go index 5971a24fc5a2..88b1f1da7351 100644 --- a/x/accounts/keeper_account_abstraction.go +++ b/x/accounts/keeper_account_abstraction.go @@ -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 { diff --git a/x/accounts/keeper_test.go b/x/accounts/keeper_test.go index 6535d99a9783..baf3f7250def 100644 --- a/x/accounts/keeper_test.go +++ b/x/accounts/keeper_test.go @@ -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)) }) } diff --git a/x/accounts/msg_server.go b/x/accounts/msg_server.go index 04cf4963c42e..20357ba3e27b 100644 --- a/x/accounts/msg_server.go +++ b/x/accounts/msg_server.go @@ -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 } diff --git a/x/accounts/msg_server_test.go b/x/accounts/msg_server_test.go index a55536b900a4..1b96e415247c 100644 --- a/x/accounts/msg_server_test.go +++ b/x/accounts/msg_server_test.go @@ -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) diff --git a/x/accounts/query_server.go b/x/accounts/query_server.go index ac05596e1f7f..cd5930fa808a 100644 --- a/x/accounts/query_server.go +++ b/x/accounts/query_server.go @@ -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 } diff --git a/x/accounts/query_server_test.go b/x/accounts/query_server_test.go index 6b091918cede..6ff2ee30bcc3 100644 --- a/x/accounts/query_server_test.go +++ b/x/accounts/query_server_test.go @@ -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) - require.NoError(t, err) - - resp, err := respAnyPB.UnmarshalNew() + resp, err := implementation.UnpackAnyRaw(queryResp.Response) require.NoError(t, err) - require.Equal(t, "10", resp.(*wrapperspb.StringValue).Value) + require.Equal(t, "10", resp.(*types.StringValue).Value) } diff --git a/x/accounts/testing/account_abstraction/full.go b/x/accounts/testing/account_abstraction/full.go index 64d61874770f..e4f08fbc5d9a 100644 --- a/x/accounts/testing/account_abstraction/full.go +++ b/x/accounts/testing/account_abstraction/full.go @@ -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 diff --git a/x/accounts/testing/account_abstraction/minimal.go b/x/accounts/testing/account_abstraction/minimal.go index 7be41619f6be..3a194370d1d3 100644 --- a/x/accounts/testing/account_abstraction/minimal.go +++ b/x/accounts/testing/account_abstraction/minimal.go @@ -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" ) diff --git a/x/accounts/testing/counter/counter.go b/x/accounts/testing/counter/counter.go index 8e83d18a6e7c..7e6acf0b826d 100644 --- a/x/accounts/testing/counter/counter.go +++ b/x/accounts/testing/counter/counter.go @@ -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 ( diff --git a/x/accounts/testing/counter/v1/counter.pb.go b/x/accounts/testing/counter/v1/counter.pb.go new file mode 100644 index 000000000000..cf9f06c5ef9a --- /dev/null +++ b/x/accounts/testing/counter/v1/counter.pb.go @@ -0,0 +1,1018 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/accounts/testing/counter/v1/counter.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 defines a message which initializes the counter with a given amount. +type MsgInit struct { + // initial_value is the initial amount to set the counter to. + InitialValue uint64 `protobuf:"varint,1,opt,name=initial_value,json=initialValue,proto3" json:"initial_value,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_21c9320877186411, []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) GetInitialValue() uint64 { + if m != nil { + return m.InitialValue + } + return 0 +} + +// MsgInitResponse defines the MsgInit response type. +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_21c9320877186411, []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 + +// MsgIncreaseCounter defines a message which increases the counter by a given amount. +type MsgIncreaseCounter struct { + // amount is the amount to increase the counter by. + Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *MsgIncreaseCounter) Reset() { *m = MsgIncreaseCounter{} } +func (m *MsgIncreaseCounter) String() string { return proto.CompactTextString(m) } +func (*MsgIncreaseCounter) ProtoMessage() {} +func (*MsgIncreaseCounter) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{2} +} +func (m *MsgIncreaseCounter) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIncreaseCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIncreaseCounter.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 *MsgIncreaseCounter) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIncreaseCounter.Merge(m, src) +} +func (m *MsgIncreaseCounter) XXX_Size() int { + return m.Size() +} +func (m *MsgIncreaseCounter) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIncreaseCounter.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIncreaseCounter proto.InternalMessageInfo + +func (m *MsgIncreaseCounter) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +// MsgIncreaseCounterResponse defines the MsgIncreaseCounter response type. +// Returns the new counter value. +type MsgIncreaseCounterResponse struct { + // new_amount defines the new counter value after the increase. + NewAmount uint64 `protobuf:"varint,1,opt,name=new_amount,json=newAmount,proto3" json:"new_amount,omitempty"` +} + +func (m *MsgIncreaseCounterResponse) Reset() { *m = MsgIncreaseCounterResponse{} } +func (m *MsgIncreaseCounterResponse) String() string { return proto.CompactTextString(m) } +func (*MsgIncreaseCounterResponse) ProtoMessage() {} +func (*MsgIncreaseCounterResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{3} +} +func (m *MsgIncreaseCounterResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIncreaseCounterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIncreaseCounterResponse.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 *MsgIncreaseCounterResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIncreaseCounterResponse.Merge(m, src) +} +func (m *MsgIncreaseCounterResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgIncreaseCounterResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIncreaseCounterResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIncreaseCounterResponse proto.InternalMessageInfo + +func (m *MsgIncreaseCounterResponse) GetNewAmount() uint64 { + if m != nil { + return m.NewAmount + } + return 0 +} + +// QueryCounterRequest is used to query the counter value. +type QueryCounterRequest struct { +} + +func (m *QueryCounterRequest) Reset() { *m = QueryCounterRequest{} } +func (m *QueryCounterRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCounterRequest) ProtoMessage() {} +func (*QueryCounterRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{4} +} +func (m *QueryCounterRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCounterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCounterRequest.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 *QueryCounterRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCounterRequest.Merge(m, src) +} +func (m *QueryCounterRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCounterRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCounterRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCounterRequest proto.InternalMessageInfo + +// QueryCounterResponse returns the counter value. +type QueryCounterResponse struct { + // value defines the value of the counter. + Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *QueryCounterResponse) Reset() { *m = QueryCounterResponse{} } +func (m *QueryCounterResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCounterResponse) ProtoMessage() {} +func (*QueryCounterResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_21c9320877186411, []int{5} +} +func (m *QueryCounterResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCounterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCounterResponse.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 *QueryCounterResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCounterResponse.Merge(m, src) +} +func (m *QueryCounterResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCounterResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCounterResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCounterResponse proto.InternalMessageInfo + +func (m *QueryCounterResponse) GetValue() uint64 { + if m != nil { + return m.Value + } + return 0 +} + +func init() { + proto.RegisterType((*MsgInit)(nil), "cosmos.accounts.testing.counter.v1.MsgInit") + proto.RegisterType((*MsgInitResponse)(nil), "cosmos.accounts.testing.counter.v1.MsgInitResponse") + proto.RegisterType((*MsgIncreaseCounter)(nil), "cosmos.accounts.testing.counter.v1.MsgIncreaseCounter") + proto.RegisterType((*MsgIncreaseCounterResponse)(nil), "cosmos.accounts.testing.counter.v1.MsgIncreaseCounterResponse") + proto.RegisterType((*QueryCounterRequest)(nil), "cosmos.accounts.testing.counter.v1.QueryCounterRequest") + proto.RegisterType((*QueryCounterResponse)(nil), "cosmos.accounts.testing.counter.v1.QueryCounterResponse") +} + +func init() { + proto.RegisterFile("cosmos/accounts/testing/counter/v1/counter.proto", fileDescriptor_21c9320877186411) +} + +var fileDescriptor_21c9320877186411 = []byte{ + // 264 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0xd6, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0x29, 0xd6, 0x2f, 0x49, 0x2d, 0x2e, + 0xc9, 0xcc, 0x4b, 0xd7, 0x07, 0x73, 0x53, 0x8b, 0xf4, 0xcb, 0x0c, 0x61, 0x4c, 0xbd, 0x82, 0xa2, + 0xfc, 0x92, 0x7c, 0x21, 0x25, 0x88, 0x0e, 0x3d, 0x98, 0x0e, 0x3d, 0xa8, 0x0e, 0x3d, 0x98, 0xb2, + 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x76, 0xdf, 0xe2, 0x74, 0xcf, 0xbc, 0xcc, 0x12, 0x21, 0x65, 0x2e, + 0xde, 0xcc, 0xbc, 0xcc, 0x92, 0xcc, 0xc4, 0x9c, 0xf8, 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0x96, 0x20, 0x1e, 0xa8, 0x60, 0x18, 0x48, 0x4c, 0x49, 0x90, 0x8b, 0x1f, 0xaa, + 0x3e, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0x49, 0x87, 0x4b, 0x08, 0x2c, 0x94, 0x5c, + 0x94, 0x9a, 0x58, 0x9c, 0xea, 0x0c, 0x31, 0x5b, 0x48, 0x8c, 0x8b, 0x2d, 0x31, 0x17, 0xc4, 0x86, + 0x1a, 0x03, 0xe5, 0x29, 0x59, 0x73, 0x49, 0x61, 0xaa, 0x86, 0x99, 0x25, 0x24, 0xcb, 0xc5, 0x95, + 0x97, 0x5a, 0x1e, 0x8f, 0xa2, 0x93, 0x33, 0x2f, 0xb5, 0xdc, 0x11, 0xa2, 0x59, 0x94, 0x4b, 0x38, + 0xb0, 0x34, 0xb5, 0xa8, 0x12, 0xae, 0xad, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x49, 0x87, 0x4b, 0x04, + 0x55, 0x18, 0x6a, 0x9a, 0x08, 0x17, 0x2b, 0xb2, 0x4f, 0x20, 0x1c, 0x27, 0x97, 0x13, 0x8f, 0xe4, + 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, + 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x82, 0x04, 0x58, 0x71, 0x4a, 0xb6, 0x5e, 0x66, + 0xbe, 0x7e, 0x05, 0xbe, 0xa0, 0x4e, 0x62, 0x03, 0x87, 0xb1, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, + 0x5e, 0xe6, 0x3d, 0x27, 0x97, 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 m.InitialValue != 0 { + i = encodeVarintCounter(dAtA, i, uint64(m.InitialValue)) + i-- + dAtA[i] = 0x8 + } + 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 *MsgIncreaseCounter) 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 *MsgIncreaseCounter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIncreaseCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintCounter(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgIncreaseCounterResponse) 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 *MsgIncreaseCounterResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIncreaseCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NewAmount != 0 { + i = encodeVarintCounter(dAtA, i, uint64(m.NewAmount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryCounterRequest) 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 *QueryCounterRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCounterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryCounterResponse) 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 *QueryCounterResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != 0 { + i = encodeVarintCounter(dAtA, i, uint64(m.Value)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintCounter(dAtA []byte, offset int, v uint64) int { + offset -= sovCounter(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 + if m.InitialValue != 0 { + n += 1 + sovCounter(uint64(m.InitialValue)) + } + return n +} + +func (m *MsgInitResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgIncreaseCounter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Amount != 0 { + n += 1 + sovCounter(uint64(m.Amount)) + } + return n +} + +func (m *MsgIncreaseCounterResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NewAmount != 0 { + n += 1 + sovCounter(uint64(m.NewAmount)) + } + return n +} + +func (m *QueryCounterRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryCounterResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != 0 { + n += 1 + sovCounter(uint64(m.Value)) + } + return n +} + +func sovCounter(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCounter(x uint64) (n int) { + return sovCounter(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 ErrIntOverflowCounter + } + 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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialValue", wireType) + } + m.InitialValue = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitialValue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + 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 ErrIntOverflowCounter + } + 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 := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgIncreaseCounter) 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 ErrIntOverflowCounter + } + 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: MsgIncreaseCounter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIncreaseCounter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgIncreaseCounterResponse) 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 ErrIntOverflowCounter + } + 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: MsgIncreaseCounterResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIncreaseCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewAmount", wireType) + } + m.NewAmount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NewAmount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCounterRequest) 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 ErrIntOverflowCounter + } + 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: QueryCounterRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCounterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCounterResponse) 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 ErrIntOverflowCounter + } + 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: QueryCounterResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCounter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCounter(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCounter + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCounter(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, ErrIntOverflowCounter + } + 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, ErrIntOverflowCounter + } + 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, ErrIntOverflowCounter + } + 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, ErrInvalidLengthCounter + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCounter + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCounter + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCounter = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCounter = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCounter = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/accounts/testing/rotation/v1/partial.pb.go b/x/accounts/testing/rotation/v1/partial.pb.go new file mode 100644 index 000000000000..52a71ffd11df --- /dev/null +++ b/x/accounts/testing/rotation/v1/partial.pb.go @@ -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") +) diff --git a/x/accounts/utils_test.go b/x/accounts/utils_test.go index fa8655431ec4..68adc2d94c6e 100644 --- a/x/accounts/utils_test.go +++ b/x/accounts/utils_test.go @@ -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) } } diff --git a/x/accounts/v1/query.pb.go b/x/accounts/v1/query.pb.go index 27e89b235762..5e65ffc45f9a 100644 --- a/x/accounts/v1/query.pb.go +++ b/x/accounts/v1/query.pb.go @@ -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: diff --git a/x/accounts/v1/tx.pb.go b/x/accounts/v1/tx.pb.go index 44b955a2d593..ac2797d4dbc9 100644 --- a/x/accounts/v1/tx.pb.go +++ b/x/accounts/v1/tx.pb.go @@ -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: diff --git a/x/auth/go.mod b/x/auth/go.mod index bdc078caf5a3..8ed249be9431 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -39,7 +39,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -147,11 +149,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/auth/go.sum b/x/auth/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/auth/go.sum +++ b/x/auth/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/authz/go.mod b/x/authz/go.mod index 2d52375f418d..256ebf31e9b5 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -36,7 +36,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -149,11 +151,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/authz/go.sum b/x/authz/go.sum index aaef3457b5c5..d6abe50e00c6 100644 --- a/x/authz/go.sum +++ b/x/authz/go.sum @@ -63,6 +63,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/bank/go.mod b/x/bank/go.mod index abb13644bec5..2867a0f711fc 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -33,7 +33,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -143,11 +145,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/bank/go.sum b/x/bank/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 570a522a3a7f..51847c2fbb9c 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -29,7 +29,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -143,11 +145,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 67d04aac6653..14450b77b5a9 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -32,15 +32,15 @@ require ( gotest.tools/v3 v3.5.1 ) -require golang.org/x/sync v0.5.0 // indirect - require ( cosmossdk.io/x/auth v0.0.0-00010101000000-000000000000 cosmossdk.io/x/tx v0.12.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -148,10 +148,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect + golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index 3bd104895d3a..33330302d770 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -34,7 +34,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect @@ -146,11 +148,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index a1027caeaf0b..8e2c583bc4ea 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -36,7 +36,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -149,11 +151,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 22db67429f87..1213f3b7daff 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/gov/go.mod b/x/gov/go.mod index 7fdc44a1720b..720111feb6be 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -39,7 +39,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -148,11 +150,13 @@ require ( go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/gov/go.sum b/x/gov/go.sum index aaef3457b5c5..d6abe50e00c6 100644 --- a/x/gov/go.sum +++ b/x/gov/go.sum @@ -63,6 +63,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/group/go.mod b/x/group/go.mod index e23bfbc86056..6298ea39c3b6 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -41,7 +41,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -151,11 +153,13 @@ require ( go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/group/go.sum b/x/group/go.sum index 0b7cafe7fd58..e1650e78d808 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -63,6 +63,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/mint/go.mod b/x/mint/go.mod index a6af35cb15f6..250d46e78c78 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -31,7 +31,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -144,11 +146,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/mint/go.sum b/x/mint/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/nft/go.mod b/x/nft/go.mod index 31601ea70d76..1f5f38c5716e 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -31,7 +31,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -144,11 +146,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/nft/go.sum b/x/nft/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/params/go.mod b/x/params/go.mod index af55a1eedce2..b74b1e5131d1 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -34,7 +34,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -144,11 +146,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/x/params/go.sum b/x/params/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 0f0404a4a881..69d9cf956671 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -34,7 +34,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -147,11 +149,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 519d41cac365..c32d917a4943 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -38,7 +38,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -149,11 +151,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/staking/go.mod b/x/staking/go.mod index 73ba2adbaa21..385606736067 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -40,7 +40,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect @@ -149,11 +151,13 @@ require ( go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/x/staking/go.sum b/x/staking/go.sum index 66b22fcc52de..c1177d4e941a 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -65,6 +65,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/x/staking/types/authz.go b/x/staking/types/authz.go index cacf5e225dbb..d3c7425d6ade 100644 --- a/x/staking/types/authz.go +++ b/x/staking/types/authz.go @@ -164,14 +164,24 @@ func validateAllowAndDenyValidators(allowed, denied []sdk.ValAddress) ([]string, allowedValidators := make([]string, len(allowed)) if len(allowed) > 0 { + foundAllowedValidators := make(map[string]bool, len(allowed)) for i, validator := range allowed { + if foundAllowedValidators[validator.String()] { + return nil, nil, sdkerrors.ErrInvalidRequest.Wrapf("duplicate allowed validator address: %s", validator.String()) + } + foundAllowedValidators[validator.String()] = true allowedValidators[i] = validator.String() } return allowedValidators, nil, nil } deniedValidators := make([]string, len(denied)) + foundDeniedValidators := make(map[string]bool, len(denied)) for i, validator := range denied { + if foundDeniedValidators[validator.String()] { + return nil, nil, sdkerrors.ErrInvalidRequest.Wrapf("duplicate denied validator address: %s", validator.String()) + } + foundDeniedValidators[validator.String()] = true deniedValidators[i] = validator.String() } diff --git a/x/staking/types/authz_test.go b/x/staking/types/authz_test.go index 8ef9a9b3868e..fa6185293ec5 100644 --- a/x/staking/types/authz_test.go +++ b/x/staking/types/authz_test.go @@ -42,6 +42,14 @@ func TestAuthzAuthorizations(t *testing.T) { _, err = stakingtypes.NewStakeAuthorization([]sdk.ValAddress{val1, val2}, []sdk.ValAddress{val1}, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE, &coin100) require.Error(t, err) + // error duplicate allow list + _, err = stakingtypes.NewStakeAuthorization([]sdk.ValAddress{val1, val1}, []sdk.ValAddress{}, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE, &coin100) + require.ErrorContains(t, err, "duplicate allowed validator address") + + // error duplicate denied list + _, err = stakingtypes.NewStakeAuthorization([]sdk.ValAddress{}, []sdk.ValAddress{val1, val1}, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_DELEGATE, &coin100) + require.ErrorContains(t, err, "duplicate denied validator address") + // verify MethodName undelAuth, _ := stakingtypes.NewStakeAuthorization([]sdk.ValAddress{val1, val2}, []sdk.ValAddress{}, stakingtypes.AuthorizationType_AUTHORIZATION_TYPE_UNDELEGATE, &coin100) require.Equal(t, undelAuth.MsgTypeURL(), sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{})) diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index b52b1bcac712..06513126a4e0 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -44,7 +44,9 @@ require ( filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect + github.com/DataDog/datadog-go v4.8.3+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/aws/aws-sdk-go v1.45.25 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect @@ -167,12 +169,14 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/term v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index ed846f9a7108..d55545a5efe8 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -217,6 +217,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q= +github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=