fix(client/v2): improve message parsing by replacing proto.Merge with cloneMessage (backport #24722) (#24818)
Co-authored-by: julienrbrt <julien@rbrt.fr> Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io> Co-authored-by: Aaron <aaronc@users.noreply.github.com>
This commit is contained in:
parent
c92ff3ab78
commit
1834f4ccd9
@ -34,6 +34,12 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
# Changelog
|
||||
|
||||
## [v2.0.0-beta.11](https://github.com/cosmos/cosmos-sdk/tree/client/v2.0.0-beta.11) - 2025-05-30
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* [#24722](https://github.com/cosmos/cosmos-sdk/pull/24722) Fix msg parsing in when no pulsar file is present.
|
||||
|
||||
## [v2.0.0-beta.9](https://github.com/cosmos/cosmos-sdk/tree/client/v2.0.0-beta.9) - 2025-04-24
|
||||
|
||||
### Features
|
||||
@ -42,7 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
|
||||
### Improvements
|
||||
|
||||
* [#22890](https://github.com/cosmos/cosmos-sdk/pull/22890) Added support for flattening inner message fields in autocli as positional arguments.
|
||||
* [#22890](https://github.com/cosmos/cosmos-sdk/pull/22890) Added support for flattening inner message fields in autocli as positional arguments.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
@ -1,2 +1,6 @@
|
||||
codegen:
|
||||
@(cd internal; buf generate)
|
||||
@(cd internal; buf generate --template testpbpulsar/buf.gen.yaml)
|
||||
@(cd internal; buf generate --template testpbgogo/buf.gen.yaml)
|
||||
@(cd internal/testpbgogo; rm *_grpc.pb.go; rm *.pulsar.go)
|
||||
@(cd internal; mv github.com/cosmos/cosmos-sdk/client/v2/internal/testpbgogo/* testpbgogo)
|
||||
@(cd internal; rm -r github.com)
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/gogoproto/proto"
|
||||
"github.com/spf13/cobra"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
@ -15,7 +16,8 @@ import (
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
reflectionv2alpha1 "cosmossdk.io/api/cosmos/base/reflection/v2alpha1"
|
||||
"cosmossdk.io/client/v2/autocli/flag"
|
||||
"cosmossdk.io/client/v2/internal/testpb"
|
||||
"cosmossdk.io/client/v2/internal/testpbgogo"
|
||||
testpb "cosmossdk.io/client/v2/internal/testpbpulsar"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
@ -23,6 +25,7 @@ import (
|
||||
sdkkeyring "github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/types/msgservice"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
@ -57,6 +60,7 @@ func initFixture(t *testing.T) *fixture {
|
||||
|
||||
interfaceRegistry := encodingConfig.Codec.InterfaceRegistry()
|
||||
banktypes.RegisterInterfaces(interfaceRegistry)
|
||||
msgservice.RegisterMsgServiceDesc(interfaceRegistry, &testpbgogo.MsgGogoOnly_serviceDesc)
|
||||
|
||||
clientCtx := client.Context{}.
|
||||
WithKeyring(kr).
|
||||
@ -69,10 +73,15 @@ func initFixture(t *testing.T) *fixture {
|
||||
WithChainID("autocli-test")
|
||||
|
||||
conn := &testClientConn{ClientConn: clientConn}
|
||||
|
||||
// using merged registry to get pulsar + gogo files
|
||||
mergedFiles, err := proto.MergedRegistry()
|
||||
assert.NilError(t, err)
|
||||
|
||||
b := &Builder{
|
||||
Builder: flag.Builder{
|
||||
TypeResolver: protoregistry.GlobalTypes,
|
||||
FileResolver: protoregistry.GlobalFiles,
|
||||
FileResolver: mergedFiles,
|
||||
AddressCodec: addresscodec.NewBech32Codec("cosmos"),
|
||||
ValidatorAddressCodec: addresscodec.NewBech32Codec("cosmosvaloper"),
|
||||
ConsensusAddressCodec: addresscodec.NewBech32Codec("cosmosvalcons"),
|
||||
|
||||
@ -161,7 +161,9 @@ func (b *Builder) BuildMsgMethodCommand(descriptor protoreflect.MethodDescriptor
|
||||
// Here we use dynamicpb, to create a proto v1 compatible message.
|
||||
// The SDK codec will handle protov2 -> protov1 (marshal)
|
||||
msg := dynamicpb.NewMessage(input.Descriptor())
|
||||
proto.Merge(msg, input.Interface())
|
||||
if err := cloneMessage(msg, input); err != nil {
|
||||
return fmt.Errorf("failed to clone message: %w", err)
|
||||
}
|
||||
|
||||
return clienttx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
|
||||
}
|
||||
@ -217,7 +219,9 @@ func (b *Builder) handleGovProposal(
|
||||
// Here we use dynamicpb, to create a proto v1 compatible message.
|
||||
// The SDK codec will handle protov2 -> protov1 (marshal)
|
||||
msg := dynamicpb.NewMessage(input.Descriptor())
|
||||
proto.Merge(msg, input.Interface())
|
||||
if err := cloneMessage(msg, input); err != nil {
|
||||
return fmt.Errorf("failed to clone message: %w", err)
|
||||
}
|
||||
|
||||
if err := proposal.SetMsgs([]gogoproto.Message{msg}); err != nil {
|
||||
return fmt.Errorf("failed to set msg in proposal %w", err)
|
||||
@ -225,3 +229,13 @@ func (b *Builder) handleGovProposal(
|
||||
|
||||
return clienttx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposal)
|
||||
}
|
||||
|
||||
// cloneMessage safely copies fields from src message to dst message.
|
||||
// this avoids the proto.Merge issue with field descriptors from different repositories.
|
||||
func cloneMessage(dst, src protoreflect.Message) error {
|
||||
bz, err := proto.Marshal(src.Interface())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return proto.Unmarshal(bz, dst.Interface())
|
||||
}
|
||||
|
||||
@ -15,7 +15,8 @@ import (
|
||||
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
|
||||
"cosmossdk.io/client/v2/internal/testpb"
|
||||
"cosmossdk.io/client/v2/internal/testpbgogo"
|
||||
testpb "cosmossdk.io/client/v2/internal/testpbpulsar"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
)
|
||||
@ -124,6 +125,31 @@ func TestMsg(t *testing.T) {
|
||||
assertNormalizedJSONEqual(t, out.Bytes(), goldenLoad(t, "msg-output.golden"))
|
||||
}
|
||||
|
||||
// TestMsgGogo set same as previous, but the message are only gogoproto generated.
|
||||
// There are no protov2 files registered in the global registry for those types.
|
||||
func TestMsgGogo(t *testing.T) {
|
||||
fixture := initFixture(t)
|
||||
out, err := runCmd(fixture, buildCustomModuleMsgCommand(&autocliv1.ServiceCommandDescriptor{
|
||||
Service: testpbgogo.MsgGogoOnly_serviceDesc.ServiceName, // using gogoproto only test msg
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "Send",
|
||||
Use: "send [a_coin] [str] [flags]",
|
||||
Short: "Send coins from one account to another",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "a_coin"}, {ProtoField: "str"}},
|
||||
// an_address should be automatically added
|
||||
},
|
||||
},
|
||||
}), "send",
|
||||
"1foo", "henlo",
|
||||
"--from", "cosmos1y74p8wyy4enfhfn342njve6cjmj5c8dtl6emdk",
|
||||
"--generate-only",
|
||||
"--output", "json",
|
||||
)
|
||||
assert.NilError(t, err)
|
||||
golden.Assert(t, out.String(), "msg-gogo-output.golden")
|
||||
}
|
||||
|
||||
func TestMsgWithFlattenFields(t *testing.T) {
|
||||
fixture := initFixture(t)
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ import (
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
queryv1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1"
|
||||
basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
|
||||
"cosmossdk.io/client/v2/internal/testpb"
|
||||
testpb "cosmossdk.io/client/v2/internal/testpbpulsar"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
)
|
||||
|
||||
@ -8,7 +8,7 @@ Flags:
|
||||
--a-bool
|
||||
--a-coin cosmos.base.v1beta1.Coin
|
||||
--a-consensus-address account address or key name
|
||||
--a-message testpb.AMessage (json)
|
||||
--a-message testpbpulsar.AMessage (json)
|
||||
--a-validator-address account address or key name
|
||||
--an-address account address or key name
|
||||
--an-enum Enum (unspecified | one | two | five | neg-three) (default unspecified)
|
||||
@ -41,7 +41,7 @@ Flags:
|
||||
--positional2 string
|
||||
--positional3-varargs cosmos.base.v1beta1.Coin (repeated)
|
||||
--shorthand-deprecated-field string
|
||||
--some-messages testpb.AMessage (json) (repeated)
|
||||
--some-messages testpbpulsar.AMessage (json) (repeated)
|
||||
--str string
|
||||
--strings strings
|
||||
--timestamp timestamp (RFC 3339)
|
||||
|
||||
4
client/v2/autocli/testdata/help-echo.golden
vendored
4
client/v2/autocli/testdata/help-echo.golden
vendored
@ -13,7 +13,7 @@ Flags:
|
||||
--a-bool
|
||||
--a-coin cosmos.base.v1beta1.Coin some random coin
|
||||
--a-consensus-address account address or key name
|
||||
--a-message testpb.AMessage (json)
|
||||
--a-message testpbpulsar.AMessage (json)
|
||||
--a-validator-address account address or key name
|
||||
--an-address account address or key name
|
||||
--an-enum Enum (unspecified | one | two | five | neg-three) (default unspecified)
|
||||
@ -42,7 +42,7 @@ Flags:
|
||||
--page-offset uint
|
||||
--page-reverse
|
||||
-s, --shorthand-deprecated-field string (DEPRECATED: bad idea)
|
||||
--some-messages testpb.AMessage (json) (repeated)
|
||||
--some-messages testpbpulsar.AMessage (json) (repeated)
|
||||
--str string
|
||||
--strings strings
|
||||
--timestamp timestamp (RFC 3339)
|
||||
|
||||
2
client/v2/autocli/testdata/help-skip.golden
vendored
2
client/v2/autocli/testdata/help-skip.golden
vendored
@ -1,4 +1,4 @@
|
||||
Querying commands for the testpb.Query service
|
||||
Querying commands for the testpbpulsar.Query service
|
||||
|
||||
Usage:
|
||||
test skipecho [flags]
|
||||
|
||||
@ -6,10 +6,10 @@ Usage:
|
||||
|
||||
Available Commands:
|
||||
completion Generate the autocompletion script for the specified shell
|
||||
deprecatedecho Querying commands for the testpb.Query service
|
||||
deprecatedecho Querying commands for the testpbpulsar.Query service
|
||||
echo echo echos the value provided by the user
|
||||
help Help about any command
|
||||
skipecho Querying commands for the testpb.Query service
|
||||
skipecho Querying commands for the testpbpulsar.Query service
|
||||
|
||||
Flags:
|
||||
-h, --help help for test
|
||||
|
||||
1
client/v2/autocli/testdata/msg-gogo-output.golden
vendored
Normal file
1
client/v2/autocli/testdata/msg-gogo-output.golden
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"body":{"messages":[{"@type":"/testpbgogo.MsgRequestGogoOnly","str":"henlo","a_coin":{"denom":"foo","amount":"1"},"an_address":"cosmos1y74p8wyy4enfhfn342njve6cjmj5c8dtl6emdk","a_validator_address":""}],"memo":"","timeout_height":"0","unordered":false,"timeout_timestamp":null,"extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":[]}
|
||||
@ -9,8 +9,8 @@ deps:
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: cosmos-sdk
|
||||
commit: 05419252bcc241ea8023acf1ed4cadc5
|
||||
digest: shake256:1e54a48c19a8b59d35e0a7efa76402939f515f2d8005df099856f24c37c20a52800308f025abb8cffcd014d437b49707388aaca4865d9d063d8f25d5d4eb77d5
|
||||
commit: 34ac2e8322d44db08830e553ad21b93c
|
||||
digest: shake256:b0dd0de5ef770147002e290a9e9f8de8cc8727cbf932628892fbb9027d5ebec5c2a63c0e340e4ef7af72369ecdf51221dcc385ce2137afaa72532228f6999d74
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: gogo-proto
|
||||
@ -19,15 +19,10 @@ deps:
|
||||
- remote: buf.build
|
||||
owner: googleapis
|
||||
repository: googleapis
|
||||
commit: 7e6f6e774e29406da95bd61cdcdbc8bc
|
||||
digest: shake256:fe43dd2265ea0c07d76bd925eeba612667cf4c948d2ce53d6e367e1b4b3cb5fa69a51e6acb1a6a50d32f894f054a35e6c0406f6808a483f2752e10c866ffbf73
|
||||
commit: 751cbe31638d43a9bfb6162cd2352e67
|
||||
digest: shake256:87f55470d9d124e2d1dedfe0231221f4ed7efbc55bc5268917c678e2d9b9c41573a7f9a557f6d8539044524d9fc5ca8fbb7db05eb81379d168285d76b57eb8a4
|
||||
- remote: buf.build
|
||||
owner: protocolbuffers
|
||||
repository: wellknowntypes
|
||||
commit: 657250e6a39648cbb169d079a60bd9ba
|
||||
digest: shake256:00de25001b8dd2e29d85fc4bcc3ede7aed886d76d67f5e0f7a9b320b90f871d3eb73507d50818d823a0512f3f8db77a11c043685528403e31ff3fef18323a9fb
|
||||
- remote: buf.build
|
||||
owner: tendermint
|
||||
repository: tendermint
|
||||
commit: 33ed361a90514289beabf3189e1d7665
|
||||
digest: shake256:038267e06294714fd883610626554b04a127b576b4e253befb4206cb72d5d3c1eeccacd4b9ec8e3fb891f7c14e1cb0f770c077d2989638995b0a61c85afedb1d
|
||||
commit: 7727a3b7399540398e5736b9916f0faa
|
||||
digest: shake256:74c046f009811965d227acd11bb2c6259bf387759d4230b95405e402a2ed4212d6f4babab690407d07bc81095c3917c4ae9144195ddfb081525c9aec58e51173
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
version: v1
|
||||
deps:
|
||||
- buf.build/cosmos/gogo-proto
|
||||
- buf.build/cosmos/cosmos-sdk
|
||||
- buf.build/cosmos/cosmos-proto
|
||||
- buf.build/protocolbuffers/wellknowntypes
|
||||
lint:
|
||||
use:
|
||||
- STANDARD
|
||||
|
||||
14
client/v2/internal/testpbgogo/buf.gen.yaml
Normal file
14
client/v2/internal/testpbgogo/buf.gen.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
version: v1
|
||||
managed:
|
||||
enabled: true
|
||||
go_package_prefix:
|
||||
default: github.com/cosmos/cosmos-sdk/client/v2/internal
|
||||
except:
|
||||
- buf.build/cosmos/cosmos-proto
|
||||
- buf.build/cosmos/cosmos-sdk
|
||||
override:
|
||||
buf.build/cosmos/gogo-proto: github.com/cosmos/gogoproto
|
||||
plugins:
|
||||
- name: gocosmos
|
||||
out: .
|
||||
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any
|
||||
766
client/v2/internal/testpbgogo/msg.pb.go
Normal file
766
client/v2/internal/testpbgogo/msg.pb.go
Normal file
@ -0,0 +1,766 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: testpbgogo/msg.proto
|
||||
|
||||
package testpbgogo
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-proto"
|
||||
types "github.com/cosmos/cosmos-sdk/types"
|
||||
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
grpc1 "github.com/cosmos/gogoproto/grpc"
|
||||
proto "github.com/cosmos/gogoproto/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
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
|
||||
|
||||
type MsgRequestGogoOnly struct {
|
||||
Str string `protobuf:"bytes,3,opt,name=str,proto3" json:"str,omitempty"`
|
||||
ACoin types.Coin `protobuf:"bytes,18,opt,name=a_coin,json=aCoin,proto3" json:"a_coin"`
|
||||
AnAddress string `protobuf:"bytes,19,opt,name=an_address,json=anAddress,proto3" json:"an_address,omitempty"`
|
||||
AValidatorAddress string `protobuf:"bytes,33,opt,name=a_validator_address,json=aValidatorAddress,proto3" json:"a_validator_address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgRequestGogoOnly) Reset() { *m = MsgRequestGogoOnly{} }
|
||||
func (m *MsgRequestGogoOnly) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgRequestGogoOnly) ProtoMessage() {}
|
||||
func (*MsgRequestGogoOnly) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ee602c0305458bfe, []int{0}
|
||||
}
|
||||
func (m *MsgRequestGogoOnly) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgRequestGogoOnly) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgRequestGogoOnly.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 *MsgRequestGogoOnly) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgRequestGogoOnly.Merge(m, src)
|
||||
}
|
||||
func (m *MsgRequestGogoOnly) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgRequestGogoOnly) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgRequestGogoOnly.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgRequestGogoOnly proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgRequestGogoOnly) GetStr() string {
|
||||
if m != nil {
|
||||
return m.Str
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgRequestGogoOnly) GetACoin() types.Coin {
|
||||
if m != nil {
|
||||
return m.ACoin
|
||||
}
|
||||
return types.Coin{}
|
||||
}
|
||||
|
||||
func (m *MsgRequestGogoOnly) GetAnAddress() string {
|
||||
if m != nil {
|
||||
return m.AnAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgRequestGogoOnly) GetAValidatorAddress() string {
|
||||
if m != nil {
|
||||
return m.AValidatorAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type MsgResponseGoGoOnly struct {
|
||||
Request *MsgRequestGogoOnly `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgResponseGoGoOnly) Reset() { *m = MsgResponseGoGoOnly{} }
|
||||
func (m *MsgResponseGoGoOnly) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgResponseGoGoOnly) ProtoMessage() {}
|
||||
func (*MsgResponseGoGoOnly) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ee602c0305458bfe, []int{1}
|
||||
}
|
||||
func (m *MsgResponseGoGoOnly) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgResponseGoGoOnly) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgResponseGoGoOnly.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 *MsgResponseGoGoOnly) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgResponseGoGoOnly.Merge(m, src)
|
||||
}
|
||||
func (m *MsgResponseGoGoOnly) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgResponseGoGoOnly) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgResponseGoGoOnly.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgResponseGoGoOnly proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgResponseGoGoOnly) GetRequest() *MsgRequestGogoOnly {
|
||||
if m != nil {
|
||||
return m.Request
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgRequestGogoOnly)(nil), "testpbgogo.MsgRequestGogoOnly")
|
||||
proto.RegisterType((*MsgResponseGoGoOnly)(nil), "testpbgogo.MsgResponseGoGoOnly")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("testpbgogo/msg.proto", fileDescriptor_ee602c0305458bfe) }
|
||||
|
||||
var fileDescriptor_ee602c0305458bfe = []byte{
|
||||
// 480 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcd, 0x6e, 0x13, 0x31,
|
||||
0x10, 0xc7, 0xe3, 0xa4, 0x14, 0xea, 0x4a, 0x7c, 0x38, 0x51, 0xd9, 0x46, 0x62, 0x9b, 0xe6, 0x54,
|
||||
0x21, 0xc5, 0x4e, 0x82, 0xf8, 0x50, 0x6f, 0x2c, 0x87, 0x9c, 0xa2, 0x86, 0x6d, 0x85, 0x2a, 0x84,
|
||||
0xb4, 0xf2, 0xee, 0x5a, 0x66, 0x45, 0x62, 0x87, 0xb5, 0xbb, 0x12, 0x57, 0x9e, 0x80, 0x67, 0xe0,
|
||||
0xc8, 0x89, 0x43, 0xc4, 0x33, 0x54, 0x3d, 0x55, 0x3d, 0x71, 0x42, 0x28, 0x39, 0x20, 0xf1, 0x0a,
|
||||
0x5c, 0x90, 0xd7, 0xdb, 0x6c, 0x4a, 0x0f, 0xdc, 0xfc, 0x9f, 0xff, 0xcc, 0xcf, 0x33, 0x63, 0xc3,
|
||||
0x86, 0x66, 0x4a, 0x4f, 0x43, 0x2e, 0xb9, 0x24, 0x13, 0xc5, 0xf1, 0x34, 0x95, 0x5a, 0x22, 0x58,
|
||||
0x46, 0x9b, 0xdb, 0x91, 0x54, 0x13, 0xa9, 0x82, 0xdc, 0x21, 0x56, 0xd8, 0xb4, 0xe6, 0x7d, 0xab,
|
||||
0x4c, 0x21, 0xc9, 0x7a, 0x65, 0x7d, 0xd3, 0x2d, 0x8c, 0x90, 0x2a, 0x46, 0xb2, 0x5e, 0xc8, 0x34,
|
||||
0xed, 0x91, 0x48, 0x26, 0xa2, 0xf0, 0x1b, 0x86, 0x6c, 0x81, 0xe6, 0x64, 0xa3, 0xed, 0x3f, 0x00,
|
||||
0xa2, 0xa1, 0xe2, 0x3e, 0x7b, 0x7f, 0xc2, 0x94, 0x1e, 0x48, 0x2e, 0x0f, 0xc4, 0xf8, 0x03, 0xba,
|
||||
0x0b, 0x6b, 0x4a, 0xa7, 0x4e, 0xad, 0x05, 0xf6, 0x36, 0x7c, 0x73, 0x44, 0x4f, 0xe0, 0x3a, 0x0d,
|
||||
0x0c, 0xce, 0x41, 0x2d, 0xb0, 0xb7, 0xd9, 0xdf, 0xc6, 0x45, 0x5b, 0xe6, 0x3e, 0x5c, 0xdc, 0x87,
|
||||
0x5f, 0xc8, 0x44, 0x78, 0x6b, 0xa7, 0x3f, 0x76, 0x2a, 0xfe, 0x0d, 0x6a, 0x04, 0x7a, 0x0a, 0x21,
|
||||
0x15, 0x01, 0x8d, 0xe3, 0x94, 0x29, 0xe5, 0xd4, 0x0d, 0xd0, 0x73, 0x2e, 0x66, 0x9d, 0x46, 0x51,
|
||||
0xfe, 0xdc, 0x3a, 0x87, 0x3a, 0x4d, 0x04, 0xf7, 0x37, 0xa8, 0x28, 0x02, 0xe8, 0x25, 0xac, 0xd3,
|
||||
0x20, 0xa3, 0xe3, 0x24, 0xa6, 0x5a, 0xa6, 0x4b, 0xc2, 0x6e, 0x4e, 0xd8, 0xbd, 0x98, 0x75, 0x1e,
|
||||
0x14, 0x84, 0x57, 0x97, 0x39, 0x57, 0x51, 0xf7, 0xe8, 0xbf, 0xc6, 0xfe, 0x9d, 0x8f, 0xbf, 0xbe,
|
||||
0x3e, 0x5c, 0x69, 0xa7, 0x7d, 0x00, 0xeb, 0xf9, 0xf0, 0x6a, 0x2a, 0x85, 0x62, 0x03, 0x39, 0xb0,
|
||||
0xd3, 0x3f, 0x83, 0x37, 0x53, 0xbb, 0x10, 0x07, 0xe4, 0xc3, 0xba, 0xb8, 0x7c, 0x1c, 0x7c, 0x7d,
|
||||
0x5d, 0xfe, 0x65, 0x7a, 0x5f, 0xc0, 0xcd, 0xa1, 0xe2, 0xcb, 0x35, 0x06, 0x70, 0xed, 0x90, 0x89,
|
||||
0x18, 0xfd, 0xa7, 0xbe, 0xb9, 0x73, 0xcd, 0xbf, 0xda, 0x51, 0x7b, 0xeb, 0x6c, 0xd6, 0x41, 0x76,
|
||||
0xde, 0x8e, 0x8a, 0xdf, 0xb5, 0xb2, 0x2e, 0x7e, 0xdc, 0xc5, 0x5d, 0xef, 0x1b, 0x38, 0x9d, 0xbb,
|
||||
0xe0, 0x7c, 0xee, 0x82, 0x9f, 0x73, 0x17, 0x7c, 0x5a, 0xb8, 0x95, 0xf3, 0x85, 0x5b, 0xf9, 0xbe,
|
||||
0x70, 0x2b, 0xf0, 0x76, 0x24, 0x27, 0x2b, 0x58, 0xef, 0xd6, 0x50, 0xf1, 0x91, 0x79, 0xf3, 0x11,
|
||||
0x78, 0xbd, 0xcf, 0x13, 0xfd, 0xf6, 0x24, 0xc4, 0x91, 0x9c, 0x14, 0xbf, 0x8b, 0x94, 0x70, 0x12,
|
||||
0x8d, 0x13, 0x26, 0x34, 0xc9, 0xfa, 0x24, 0x11, 0x9a, 0xa5, 0x82, 0x8e, 0x49, 0xc9, 0xf9, 0x5c,
|
||||
0xad, 0x1d, 0x1d, 0x1f, 0x7f, 0xa9, 0xc2, 0xa3, 0x65, 0xe8, 0x6c, 0x55, 0xcc, 0xab, 0x5b, 0xa5,
|
||||
0x78, 0x33, 0x18, 0x79, 0x43, 0xa6, 0x69, 0x4c, 0x35, 0xfd, 0xbd, 0x9a, 0x15, 0xae, 0xe7, 0xdf,
|
||||
0xef, 0xd1, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x1f, 0x21, 0x25, 0x0c, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// MsgGogoOnlyClient is the client API for MsgGogoOnly service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type MsgGogoOnlyClient interface {
|
||||
// Send a request and returns the request as a response.
|
||||
Send(ctx context.Context, in *MsgRequestGogoOnly, opts ...grpc.CallOption) (*MsgResponseGoGoOnly, error)
|
||||
}
|
||||
|
||||
type msgGogoOnlyClient struct {
|
||||
cc grpc1.ClientConn
|
||||
}
|
||||
|
||||
func NewMsgGogoOnlyClient(cc grpc1.ClientConn) MsgGogoOnlyClient {
|
||||
return &msgGogoOnlyClient{cc}
|
||||
}
|
||||
|
||||
func (c *msgGogoOnlyClient) Send(ctx context.Context, in *MsgRequestGogoOnly, opts ...grpc.CallOption) (*MsgResponseGoGoOnly, error) {
|
||||
out := new(MsgResponseGoGoOnly)
|
||||
err := c.cc.Invoke(ctx, "/testpbgogo.MsgGogoOnly/Send", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgGogoOnlyServer is the server API for MsgGogoOnly service.
|
||||
type MsgGogoOnlyServer interface {
|
||||
// Send a request and returns the request as a response.
|
||||
Send(context.Context, *MsgRequestGogoOnly) (*MsgResponseGoGoOnly, error)
|
||||
}
|
||||
|
||||
// UnimplementedMsgGogoOnlyServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedMsgGogoOnlyServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedMsgGogoOnlyServer) Send(ctx context.Context, req *MsgRequestGogoOnly) (*MsgResponseGoGoOnly, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Send not implemented")
|
||||
}
|
||||
|
||||
func RegisterMsgGogoOnlyServer(s grpc1.Server, srv MsgGogoOnlyServer) {
|
||||
s.RegisterService(&_MsgGogoOnly_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _MsgGogoOnly_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgRequestGogoOnly)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgGogoOnlyServer).Send(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/testpbgogo.MsgGogoOnly/Send",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgGogoOnlyServer).Send(ctx, req.(*MsgRequestGogoOnly))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var MsgGogoOnly_serviceDesc = _MsgGogoOnly_serviceDesc
|
||||
var _MsgGogoOnly_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "testpbgogo.MsgGogoOnly",
|
||||
HandlerType: (*MsgGogoOnlyServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Send",
|
||||
Handler: _MsgGogoOnly_Send_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "testpbgogo/msg.proto",
|
||||
}
|
||||
|
||||
func (m *MsgRequestGogoOnly) 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 *MsgRequestGogoOnly) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgRequestGogoOnly) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.AValidatorAddress) > 0 {
|
||||
i -= len(m.AValidatorAddress)
|
||||
copy(dAtA[i:], m.AValidatorAddress)
|
||||
i = encodeVarintMsg(dAtA, i, uint64(len(m.AValidatorAddress)))
|
||||
i--
|
||||
dAtA[i] = 0x2
|
||||
i--
|
||||
dAtA[i] = 0x8a
|
||||
}
|
||||
if len(m.AnAddress) > 0 {
|
||||
i -= len(m.AnAddress)
|
||||
copy(dAtA[i:], m.AnAddress)
|
||||
i = encodeVarintMsg(dAtA, i, uint64(len(m.AnAddress)))
|
||||
i--
|
||||
dAtA[i] = 0x1
|
||||
i--
|
||||
dAtA[i] = 0x9a
|
||||
}
|
||||
{
|
||||
size, err := m.ACoin.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintMsg(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x1
|
||||
i--
|
||||
dAtA[i] = 0x92
|
||||
if len(m.Str) > 0 {
|
||||
i -= len(m.Str)
|
||||
copy(dAtA[i:], m.Str)
|
||||
i = encodeVarintMsg(dAtA, i, uint64(len(m.Str)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgResponseGoGoOnly) 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 *MsgResponseGoGoOnly) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgResponseGoGoOnly) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Request != nil {
|
||||
{
|
||||
size, err := m.Request.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintMsg(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintMsg(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovMsg(v)
|
||||
base := offset
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return base
|
||||
}
|
||||
func (m *MsgRequestGogoOnly) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Str)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovMsg(uint64(l))
|
||||
}
|
||||
l = m.ACoin.Size()
|
||||
n += 2 + l + sovMsg(uint64(l))
|
||||
l = len(m.AnAddress)
|
||||
if l > 0 {
|
||||
n += 2 + l + sovMsg(uint64(l))
|
||||
}
|
||||
l = len(m.AValidatorAddress)
|
||||
if l > 0 {
|
||||
n += 2 + l + sovMsg(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgResponseGoGoOnly) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Request != nil {
|
||||
l = m.Request.Size()
|
||||
n += 1 + l + sovMsg(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovMsg(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
func sozMsg(x uint64) (n int) {
|
||||
return sovMsg(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *MsgRequestGogoOnly) 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 ErrIntOverflowMsg
|
||||
}
|
||||
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: MsgRequestGogoOnly: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgRequestGogoOnly: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Str", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
}
|
||||
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 ErrInvalidLengthMsg
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Str = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 18:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ACoin", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := m.ACoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 19:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AnAddress", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
}
|
||||
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 ErrInvalidLengthMsg
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.AnAddress = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 33:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AValidatorAddress", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
}
|
||||
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 ErrInvalidLengthMsg
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.AValidatorAddress = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMsg(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgResponseGoGoOnly) 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 ErrIntOverflowMsg
|
||||
}
|
||||
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: MsgResponseGoGoOnly: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgResponseGoGoOnly: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMsg
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Request == nil {
|
||||
m.Request = &MsgRequestGogoOnly{}
|
||||
}
|
||||
if err := m.Request.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMsg(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthMsg
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipMsg(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, ErrIntOverflowMsg
|
||||
}
|
||||
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, ErrIntOverflowMsg
|
||||
}
|
||||
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, ErrIntOverflowMsg
|
||||
}
|
||||
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, ErrInvalidLengthMsg
|
||||
}
|
||||
iNdEx += length
|
||||
case 3:
|
||||
depth++
|
||||
case 4:
|
||||
if depth == 0 {
|
||||
return 0, ErrUnexpectedEndOfGroupMsg
|
||||
}
|
||||
depth--
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
if iNdEx < 0 {
|
||||
return 0, ErrInvalidLengthMsg
|
||||
}
|
||||
if depth == 0 {
|
||||
return iNdEx, nil
|
||||
}
|
||||
}
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthMsg = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowMsg = fmt.Errorf("proto: integer overflow")
|
||||
ErrUnexpectedEndOfGroupMsg = fmt.Errorf("proto: unexpected end of group")
|
||||
)
|
||||
28
client/v2/internal/testpbgogo/msg.proto
Normal file
28
client/v2/internal/testpbgogo/msg.proto
Normal file
@ -0,0 +1,28 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package testpbgogo;
|
||||
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
|
||||
service MsgGogoOnly {
|
||||
// Send a request and returns the request as a response.
|
||||
rpc Send(MsgRequestGogoOnly) returns (MsgResponseGoGoOnly) {
|
||||
option (cosmos_proto.method_added_in) = "cosmos-sdk v0.50.0";
|
||||
};
|
||||
}
|
||||
|
||||
message MsgRequestGogoOnly {
|
||||
option (cosmos.msg.v1.signer) = "an_address";
|
||||
|
||||
string str = 3;
|
||||
cosmos.base.v1beta1.Coin a_coin = 18 [(gogoproto.nullable) = false];
|
||||
string an_address = 19 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
string a_validator_address = 33 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"];
|
||||
}
|
||||
|
||||
message MsgResponseGoGoOnly {
|
||||
MsgRequestGogoOnly request = 1;
|
||||
}
|
||||
@ -1,13 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package testpb;
|
||||
package testpbpulsar;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "cosmos/base/query/v1beta1/pagination.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "testpb/query.proto";
|
||||
import "testpbpulsar/query.proto";
|
||||
|
||||
service Msg {
|
||||
// Send a request and returns the request as a response.
|
||||
@ -31,17 +31,17 @@ message MsgRequest {
|
||||
int32 i32 = 7;
|
||||
int64 i64 = 10;
|
||||
bool a_bool = 15;
|
||||
testpb.Enum an_enum = 16;
|
||||
testpb.AMessage a_message = 17;
|
||||
testpbpulsar.Enum an_enum = 16;
|
||||
testpbpulsar.AMessage a_message = 17;
|
||||
cosmos.base.v1beta1.Coin a_coin = 18;
|
||||
string an_address = 19 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
cosmos.base.query.v1beta1.PageRequest page = 20;
|
||||
repeated bool bools = 21;
|
||||
repeated uint32 uints = 22;
|
||||
repeated string strings = 23;
|
||||
repeated testpb.Enum enums = 24;
|
||||
repeated testpbpulsar.Enum enums = 24;
|
||||
repeated google.protobuf.Duration durations = 25;
|
||||
repeated testpb.AMessage some_messages = 26;
|
||||
repeated testpbpulsar.AMessage some_messages = 26;
|
||||
|
||||
int32 positional1 = 27;
|
||||
string positional2 = 28;
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,9 +2,9 @@
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc (unknown)
|
||||
// source: testpb/msg.proto
|
||||
// source: testpbpulsar/msg.proto
|
||||
|
||||
package testpb
|
||||
package testpbpulsar
|
||||
|
||||
import (
|
||||
context "context"
|
||||
@ -19,8 +19,8 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Msg_Send_FullMethodName = "/testpb.Msg/Send"
|
||||
Msg_Clawback_FullMethodName = "/testpb.Msg/Clawback"
|
||||
Msg_Send_FullMethodName = "/testpbpulsar.Msg/Send"
|
||||
Msg_Clawback_FullMethodName = "/testpbpulsar.Msg/Clawback"
|
||||
)
|
||||
|
||||
// MsgClient is the client API for Msg service.
|
||||
@ -131,7 +131,7 @@ func _Msg_Clawback_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "testpb.Msg",
|
||||
ServiceName: "testpbpulsar.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
@ -144,5 +144,5 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "testpb/msg.proto",
|
||||
Metadata: "testpbpulsar/msg.proto",
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package testpb;
|
||||
package testpbpulsar;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,9 +2,9 @@
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc (unknown)
|
||||
// source: testpb/query.proto
|
||||
// source: testpbpulsar/query.proto
|
||||
|
||||
package testpb
|
||||
package testpbpulsar
|
||||
|
||||
import (
|
||||
context "context"
|
||||
@ -19,7 +19,7 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Query_Echo_FullMethodName = "/testpb.Query/Echo"
|
||||
Query_Echo_FullMethodName = "/testpbpulsar.Query/Echo"
|
||||
)
|
||||
|
||||
// QueryClient is the client API for Query service.
|
||||
@ -98,7 +98,7 @@ func _Query_Echo_Handler(srv interface{}, ctx context.Context, dec func(interfac
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "testpb.Query",
|
||||
ServiceName: "testpbpulsar.Query",
|
||||
HandlerType: (*QueryServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
@ -107,5 +107,5 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "testpb/query.proto",
|
||||
Metadata: "testpbpulsar/query.proto",
|
||||
}
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/reflect/protoregistry"
|
||||
|
||||
_ "cosmossdk.io/client/v2/internal/testpb"
|
||||
_ "cosmossdk.io/client/v2/internal/testpbpulsar"
|
||||
)
|
||||
|
||||
func TestIsSupportedVersion(t *testing.T) {
|
||||
@ -29,15 +29,15 @@ func TestIsSupportedVersion(t *testing.T) {
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
messageName: "testpb.Msg.Send",
|
||||
messageName: "testpbpulsar.Msg.Send",
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
messageName: "testpb.Query.Echo",
|
||||
messageName: "testpbpulsar.Query.Echo",
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
messageName: "testpb.Msg.Clawback",
|
||||
messageName: "testpbpulsar.Msg.Clawback",
|
||||
expected: false,
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user