feat: custom get signers (#16340)

Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
This commit is contained in:
Matt Kocubinski 2023-06-06 09:20:28 -05:00 committed by GitHub
parent daaffb8495
commit bf6edae9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 483 additions and 961 deletions

View File

@ -7,6 +7,7 @@ import (
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
"cosmossdk.io/x/tx/signing"
"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
@ -176,9 +177,11 @@ func BenchmarkProtoCodecMarshalLengthPrefixed(b *testing.B) {
func TestGetSigners(t *testing.T) {
interfaceRegistry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
AddressCodec: testAddressCodec{},
ValidatorAddressCodec: testAddressCodec{},
ProtoFiles: protoregistry.GlobalFiles,
SigningOptions: signing.Options{
AddressCodec: testAddressCodec{},
ValidatorAddressCodec: testAddressCodec{},
},
ProtoFiles: protoregistry.GlobalFiles,
})
require.NoError(t, err)
cdc := codec.NewProtoCodec(interfaceRegistry)

View File

@ -1,6 +1,7 @@
package testutil
import (
"cosmossdk.io/x/tx/signing"
"github.com/cosmos/gogoproto/proto"
"github.com/cosmos/cosmos-sdk/codec"
@ -27,9 +28,11 @@ func (o CodecOptions) NewInterfaceRegistry() codectypes.InterfaceRegistry {
}
ir, err := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
AddressCodec: address.NewBech32Codec(accAddressPrefix),
ValidatorAddressCodec: address.NewBech32Codec(valAddressPrefix),
ProtoFiles: proto.HybridResolver,
SigningOptions: signing.Options{
AddressCodec: address.NewBech32Codec(accAddressPrefix),
ValidatorAddressCodec: address.NewBech32Codec(valAddressPrefix),
},
})
if err != nil {
panic(err)

View File

@ -9,8 +9,6 @@ import (
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoreflect"
"cosmossdk.io/core/address"
"cosmossdk.io/x/tx/signing"
)
@ -114,9 +112,11 @@ type interfaceMap = map[string]reflect.Type
// NewInterfaceRegistry returns a new InterfaceRegistry
func NewInterfaceRegistry() InterfaceRegistry {
registry, err := NewInterfaceRegistryWithOptions(InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
AddressCodec: failingAddressCodec{},
ValidatorAddressCodec: failingAddressCodec{},
ProtoFiles: proto.HybridResolver,
SigningOptions: signing.Options{
AddressCodec: failingAddressCodec{},
ValidatorAddressCodec: failingAddressCodec{},
},
})
if err != nil {
panic(err)
@ -129,11 +129,8 @@ type InterfaceRegistryOptions struct {
// ProtoFiles is the set of files to use for the registry. It is required.
ProtoFiles signing.ProtoFileResolver
// AddressCodec is the address codec to use for the registry. It is required.
AddressCodec address.Codec
// ValidatorAddressCodec is the validator address codec to use for the registry. It is required.
ValidatorAddressCodec address.Codec
// SigningOptions are the signing options to use for the registry.
SigningOptions signing.Options
}
// NewInterfaceRegistryWithOptions returns a new InterfaceRegistry with the given options.
@ -142,12 +139,8 @@ func NewInterfaceRegistryWithOptions(options InterfaceRegistryOptions) (Interfac
return nil, fmt.Errorf("proto files must be provided")
}
signingCtx, err := signing.NewContext(signing.Options{
FileResolver: options.ProtoFiles,
TypeResolver: nil,
AddressCodec: options.AddressCodec,
ValidatorAddressCodec: options.ValidatorAddressCodec,
})
options.SigningOptions.FileResolver = options.ProtoFiles
signingCtx, err := signing.NewContext(options.SigningOptions)
if err != nil {
return nil, err
}

View File

@ -8,6 +8,7 @@ import (
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"cosmossdk.io/x/tx/signing"
"github.com/cosmos/gogoproto/proto"
"google.golang.org/protobuf/reflect/protodesc"
"google.golang.org/protobuf/reflect/protoregistry"
@ -19,6 +20,7 @@ import (
"cosmossdk.io/core/header"
"cosmossdk.io/core/store"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/baseapp"
@ -60,6 +62,7 @@ func init() {
appmodule.Register(&runtimev1alpha1.Module{},
appmodule.Provide(
ProvideApp,
ProvideInterfaceRegistry,
ProvideKVStoreKey,
ProvideTransientStoreKey,
ProvideMemoryStoreKey,
@ -76,8 +79,7 @@ func init() {
)
}
func ProvideApp() (
codectypes.InterfaceRegistry,
func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) (
codec.Codec,
*codec.LegacyAmino,
*AppBuilder,
@ -98,27 +100,6 @@ func ProvideApp() (
_, _ = fmt.Fprintln(os.Stderr, err.Error())
}
interfaceRegistry, err := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
// using the global prefixes is a temporary solution until we refactor this
// to get the address.Codec's from the container
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
})
if err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, nil, err
}
// validate the signing context to make sure that messages are properly configured
// with cosmos.msg.v1.signer
if err := interfaceRegistry.SigningContext().Validate(); err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, nil, err
}
amino := codec.NewLegacyAmino()
std.RegisterInterfaces(interfaceRegistry)
@ -136,7 +117,7 @@ func ProvideApp() (
}
appBuilder := &AppBuilder{app}
return interfaceRegistry, cdc, amino, appBuilder, cdc, msgServiceRouter, appModule{app}, protoFiles, protoTypes, nil
return cdc, amino, appBuilder, cdc, msgServiceRouter, appModule{app}, protoFiles, protoTypes, nil
}
type AppInputs struct {
@ -176,6 +157,35 @@ func SetupAppBuilder(inputs AppInputs) {
}
}
func ProvideInterfaceRegistry(customGetSigners []signing.CustomGetSigner) (codectypes.InterfaceRegistry, error) {
signingOptions := signing.Options{
// using the global prefixes is a temporary solution until we refactor this
// to get the address.Codec's from the container
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
}
for _, signer := range customGetSigners {
signingOptions.DefineCustomGetSigners(signer.MsgType, signer.Fn)
}
interfaceRegistry, err := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
SigningOptions: signingOptions,
})
if err != nil {
return nil, err
}
err = interfaceRegistry.SigningContext().Validate()
if err != nil {
return nil, err
}
return interfaceRegistry, nil
}
func registerStoreKey(wrapper *AppBuilder, key storetypes.StoreKey) {
wrapper.app.storeKeys = append(wrapper.app.storeKeys, key)
}

View File

@ -10,11 +10,13 @@ import (
"path/filepath"
"cosmossdk.io/log"
"cosmossdk.io/x/tx/signing"
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"github.com/cosmos/cosmos-sdk/codec/address"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
@ -229,11 +231,13 @@ func NewSimApp(
) *SimApp {
interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
SigningOptions: signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
},
})
appCodec := codec.NewProtoCodec(interfaceRegistry)

View File

@ -43,9 +43,9 @@ import (
ed25519types "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
secp256k1types "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
gogo_testpb "github.com/cosmos/cosmos-sdk/tests/integration/aminojson/internal/gogo/testpb"
pulsar_testpb "github.com/cosmos/cosmos-sdk/tests/integration/aminojson/internal/pulsar/testpb"
"github.com/cosmos/cosmos-sdk/tests/integration/rapidgen"
gogo_testpb "github.com/cosmos/cosmos-sdk/tests/integration/tx/internal/gogo/testpb"
pulsar_testpb "github.com/cosmos/cosmos-sdk/tests/integration/tx/internal/pulsar/testpb"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
"github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/bech32"

View File

@ -10,9 +10,10 @@ import (
"github.com/stretchr/testify/require"
"cosmossdk.io/x/tx/signing/aminojson"
"github.com/cosmos/cosmos-sdk/codec"
gogopb "github.com/cosmos/cosmos-sdk/tests/integration/aminojson/internal/gogo/testpb"
pulsarpb "github.com/cosmos/cosmos-sdk/tests/integration/aminojson/internal/pulsar/testpb"
gogopb "github.com/cosmos/cosmos-sdk/tests/integration/tx/internal/gogo/testpb"
pulsarpb "github.com/cosmos/cosmos-sdk/tests/integration/tx/internal/pulsar/testpb"
)
func TestRepeatedFields(t *testing.T) {

View File

@ -0,0 +1,74 @@
package tx
import (
"testing"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"cosmossdk.io/x/tx/signing"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/tests/integration/tx/internal/pulsar/testpb"
"github.com/cosmos/cosmos-sdk/testutil/configurator"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
)
func ProvideCustomGetSigners() signing.CustomGetSigner {
return signing.CustomGetSigner{
MsgType: proto.MessageName(&testpb.TestRepeatedFields{}),
Fn: func(msg proto.Message) ([][]byte, error) {
testMsg := msg.(*testpb.TestRepeatedFields)
// arbitrary logic
signer := testMsg.NullableDontOmitempty[1].Value
return [][]byte{[]byte(signer)}, nil
},
}
}
func TestDefineCustomGetSigners(t *testing.T) {
var interfaceRegistry codectypes.InterfaceRegistry
_, err := simtestutil.SetupAtGenesis(
depinject.Configs(
configurator.NewAppConfig(
configurator.ParamsModule(),
configurator.AuthModule(),
configurator.StakingModule(),
configurator.BankModule(),
configurator.ConsensusModule(),
),
depinject.Supply(log.NewNopLogger()),
depinject.Provide(ProvideCustomGetSigners),
),
&interfaceRegistry,
)
require.NoError(t, err)
require.NotNil(t, interfaceRegistry)
msg := &testpb.TestRepeatedFields{
NullableDontOmitempty: []*testpb.Streng{
{Value: "foo"},
{Value: "bar"},
},
}
signers, err := interfaceRegistry.SigningContext().GetSigners(msg)
require.NoError(t, err)
require.Equal(t, [][]byte{[]byte("bar")}, signers)
// Reset and provider no CustomGetSigners. Consequently, validation will fail and depinject will return an error
_, err = simtestutil.SetupAtGenesis(
depinject.Configs(
configurator.NewAppConfig(
configurator.ParamsModule(),
configurator.AuthModule(),
configurator.StakingModule(),
configurator.BankModule(),
configurator.ConsensusModule(),
),
depinject.Supply(log.NewNopLogger()),
),
&interfaceRegistry,
)
require.ErrorContains(t, err, "use DefineCustomGetSigners")
}

View File

@ -4,12 +4,18 @@
package testpb
import (
context "context"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
_ "github.com/cosmos/cosmos-sdk/types/msgservice"
_ "github.com/cosmos/cosmos-sdk/types/tx/amino"
_ "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"
@ -289,85 +295,128 @@ func (m *IntAsBytes) XXX_DiscardUnknown() {
var xxx_messageInfo_IntAsBytes proto.InternalMessageInfo
type IntAsBothStringAndBytes struct {
IntAsString github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=int_as_string,json=intAsString,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"int_as_string"`
IntAsBytes github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=int_as_bytes,json=intAsBytes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"int_as_bytes"`
}
func (m *IntAsBothStringAndBytes) Reset() { *m = IntAsBothStringAndBytes{} }
func (m *IntAsBothStringAndBytes) String() string { return proto.CompactTextString(m) }
func (*IntAsBothStringAndBytes) ProtoMessage() {}
func (*IntAsBothStringAndBytes) Descriptor() ([]byte, []int) {
return fileDescriptor_41c67e33ca9d1f26, []int{5}
}
func (m *IntAsBothStringAndBytes) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *IntAsBothStringAndBytes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_IntAsBothStringAndBytes.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 *IntAsBothStringAndBytes) XXX_Merge(src proto.Message) {
xxx_messageInfo_IntAsBothStringAndBytes.Merge(m, src)
}
func (m *IntAsBothStringAndBytes) XXX_Size() int {
return m.Size()
}
func (m *IntAsBothStringAndBytes) XXX_DiscardUnknown() {
xxx_messageInfo_IntAsBothStringAndBytes.DiscardUnknown(m)
}
var xxx_messageInfo_IntAsBothStringAndBytes proto.InternalMessageInfo
func init() {
proto.RegisterType((*Streng)(nil), "testpb.streng")
proto.RegisterType((*TestRepeatedFields)(nil), "testpb.TestRepeatedFields")
proto.RegisterType((*TestNullableFields)(nil), "testpb.TestNullableFields")
proto.RegisterType((*IntAsString)(nil), "testpb.IntAsString")
proto.RegisterType((*IntAsBytes)(nil), "testpb.IntAsBytes")
proto.RegisterType((*IntAsBothStringAndBytes)(nil), "testpb.IntAsBothStringAndBytes")
}
func init() { proto.RegisterFile("testpb/test.proto", fileDescriptor_41c67e33ca9d1f26) }
var fileDescriptor_41c67e33ca9d1f26 = []byte{
// 445 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x4d, 0x8b, 0xd3, 0x40,
0x18, 0xce, 0x74, 0x77, 0x0b, 0xfb, 0x76, 0x15, 0x3a, 0x54, 0x37, 0xae, 0x90, 0x5d, 0x72, 0x90,
0x45, 0xd8, 0x04, 0xf4, 0xec, 0xa1, 0x41, 0x84, 0x0a, 0x2a, 0x44, 0x0f, 0xde, 0x42, 0xd2, 0x0c,
0xd9, 0xc1, 0x64, 0x26, 0x76, 0xde, 0x0a, 0xfd, 0x17, 0xfe, 0x0c, 0x8f, 0x1e, 0xfc, 0x11, 0x3d,
0x2e, 0x9e, 0xc4, 0xc3, 0x22, 0x2d, 0xe2, 0xdf, 0x90, 0x64, 0x92, 0x7e, 0xd8, 0x80, 0x20, 0x71,
0x2f, 0x99, 0xbc, 0x1f, 0xf3, 0x3c, 0xcf, 0xfb, 0xf0, 0x26, 0xd0, 0x47, 0xa6, 0x30, 0x8f, 0xdc,
0xe2, 0x70, 0xf2, 0x89, 0x44, 0x49, 0xbb, 0x3a, 0x75, 0x32, 0x48, 0x64, 0x22, 0xcb, 0x94, 0x5b,
0xbc, 0xe9, 0xea, 0x49, 0x3f, 0xcc, 0xb8, 0x90, 0x6e, 0xf9, 0xac, 0x52, 0xf7, 0xc6, 0x52, 0x65,
0x52, 0x05, 0xba, 0x57, 0x07, 0xba, 0x64, 0x5b, 0xd0, 0x55, 0x38, 0x61, 0x22, 0xa1, 0x03, 0x38,
0xf8, 0x10, 0xa6, 0x53, 0x66, 0x92, 0x33, 0x72, 0x7e, 0xe8, 0xeb, 0xc0, 0x9e, 0x77, 0x80, 0xbe,
0x61, 0x0a, 0x7d, 0x96, 0xb3, 0x10, 0x59, 0xfc, 0x8c, 0xb3, 0x34, 0x56, 0xf4, 0x09, 0x50, 0x31,
0x4d, 0xd3, 0x30, 0x4a, 0x59, 0x20, 0x33, 0x8e, 0x2c, 0xcb, 0x71, 0x66, 0x92, 0xb3, 0xbd, 0xf3,
0xde, 0xa3, 0xdb, 0x8e, 0xd6, 0xe7, 0x68, 0x60, 0xbf, 0x5f, 0x77, 0xbe, 0xaa, 0x1b, 0xe9, 0x0b,
0x38, 0x5e, 0x5d, 0x8f, 0xa5, 0xc0, 0x0d, 0x8c, 0x4e, 0x13, 0x86, 0x77, 0xf0, 0xe9, 0xd7, 0xe7,
0x87, 0xc4, 0xbf, 0x53, 0xdf, 0x7a, 0x2a, 0x05, 0xae, 0xe1, 0x9e, 0xc3, 0x5d, 0x21, 0x45, 0xd0,
0xa0, 0x68, 0xaf, 0x11, 0x6d, 0x7f, 0x7e, 0x7d, 0x6a, 0xf8, 0x03, 0x21, 0xc5, 0xcb, 0x1d, 0x69,
0x6f, 0xe1, 0xfe, 0x16, 0xd6, 0x1f, 0xf2, 0xf6, 0x1b, 0x01, 0x0f, 0x0b, 0x40, 0x2d, 0xd1, 0xdc,
0x40, 0xdd, 0x52, 0xb9, 0xb2, 0xb2, 0xae, 0xfe, 0xc5, 0x4a, 0xd2, 0x82, 0x95, 0xa4, 0x55, 0x2b,
0x49, 0xdb, 0x56, 0x92, 0x7f, 0xb5, 0x12, 0xa1, 0x37, 0x12, 0x38, 0x54, 0xaf, 0x71, 0xc2, 0x45,
0x42, 0x19, 0xdc, 0xe2, 0x02, 0x83, 0x50, 0x05, 0xaa, 0x4c, 0xe8, 0x15, 0xf6, 0x86, 0x05, 0xd4,
0xf7, 0xeb, 0xd3, 0x07, 0x09, 0xc7, 0xcb, 0x69, 0xe4, 0x8c, 0x65, 0x56, 0x2d, 0x7f, 0x75, 0x5c,
0xa8, 0xf8, 0x9d, 0x8b, 0xb3, 0x9c, 0x29, 0x67, 0x24, 0xf0, 0xeb, 0x97, 0x0b, 0xa8, 0xbe, 0x8d,
0x91, 0x40, 0x2d, 0xa1, 0xc7, 0xd7, 0x34, 0xf6, 0x7b, 0x80, 0x92, 0xd5, 0x9b, 0x21, 0x53, 0x74,
0x0c, 0x47, 0x15, 0x69, 0x54, 0xc4, 0x25, 0xe7, 0x51, 0x1b, 0x9c, 0xc0, 0x57, 0x24, 0xf6, 0x4f,
0x02, 0xc7, 0x9a, 0x53, 0xe2, 0xa5, 0x96, 0x31, 0x14, 0xb1, 0x16, 0x70, 0x33, 0x53, 0xef, 0xcc,
0xd9, 0xf9, 0x0f, 0x73, 0x7a, 0xe6, 0x7c, 0x61, 0x91, 0xab, 0x85, 0x45, 0x7e, 0x2c, 0x2c, 0xf2,
0x71, 0x69, 0x19, 0x57, 0x4b, 0xcb, 0xf8, 0xb6, 0xb4, 0x8c, 0xa8, 0x5b, 0xfe, 0xa7, 0x1e, 0xff,
0x0e, 0x00, 0x00, 0xff, 0xff, 0xdd, 0xa4, 0x3a, 0xad, 0x08, 0x05, 0x00, 0x00,
// 473 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x6b, 0x13, 0x41,
0x14, 0xdf, 0x69, 0x9b, 0x40, 0x5f, 0xaa, 0x90, 0x21, 0xda, 0xb8, 0xc2, 0xb6, 0xe4, 0x20, 0x45,
0xe8, 0x2e, 0xd6, 0xb3, 0x87, 0x06, 0x29, 0x44, 0xa8, 0xc2, 0xda, 0x83, 0xb7, 0x65, 0x37, 0x19,
0xd6, 0xc1, 0xdd, 0x37, 0x6b, 0xe6, 0xa5, 0x98, 0x9b, 0x1f, 0xc1, 0x8f, 0xe1, 0xd1, 0x83, 0x1f,
0x22, 0xc7, 0xe2, 0x49, 0x3c, 0x14, 0x49, 0x0e, 0x7e, 0x0d, 0x99, 0x9d, 0xdd, 0xb4, 0xb5, 0x41,
0x41, 0x72, 0xd9, 0x79, 0xff, 0xe6, 0xf7, 0xfb, 0xf1, 0xe3, 0xcd, 0x42, 0x9b, 0x84, 0xa6, 0x22,
0x09, 0xcc, 0xe1, 0x17, 0x63, 0x45, 0x8a, 0x37, 0x6d, 0xc9, 0xdd, 0x1d, 0x2a, 0x9d, 0x2b, 0x1d,
0xe4, 0x3a, 0x0d, 0xce, 0x9f, 0x98, 0xc3, 0x0e, 0xb8, 0x9d, 0x54, 0xa5, 0xaa, 0x0c, 0x03, 0x13,
0x55, 0xd5, 0x76, 0x9c, 0x4b, 0x54, 0x41, 0xf9, 0xad, 0x4a, 0x0f, 0x2c, 0x42, 0x64, 0x67, 0x6d,
0x62, 0x5b, 0x3d, 0x0f, 0x9a, 0x9a, 0xc6, 0x02, 0x53, 0xde, 0x81, 0xc6, 0x79, 0x9c, 0x4d, 0x44,
0x97, 0xed, 0xb3, 0x83, 0xed, 0xd0, 0x26, 0xbd, 0xd9, 0x06, 0xf0, 0x33, 0xa1, 0x29, 0x14, 0x85,
0x88, 0x49, 0x8c, 0x4e, 0xa4, 0xc8, 0x46, 0x9a, 0x3f, 0x03, 0x8e, 0x93, 0x2c, 0x8b, 0x93, 0x4c,
0x44, 0x2a, 0x97, 0x24, 0xf2, 0x82, 0xa6, 0x5d, 0xb6, 0xbf, 0x79, 0xd0, 0x3a, 0xba, 0xeb, 0x5b,
0xe1, 0xbe, 0x05, 0x0e, 0xdb, 0xf5, 0xe4, 0xab, 0x7a, 0x90, 0x9f, 0xc2, 0xee, 0xf2, 0xfa, 0x48,
0x21, 0x5d, 0xc3, 0xd8, 0x58, 0x85, 0xd1, 0x6f, 0x7c, 0xfe, 0xf5, 0xe5, 0x31, 0x0b, 0xef, 0xd5,
0xb7, 0x9e, 0x2b, 0xa4, 0x2b, 0xb8, 0x17, 0x70, 0x1f, 0x15, 0x46, 0x2b, 0x14, 0x6d, 0xae, 0x44,
0xdb, 0x9a, 0x5d, 0xee, 0x39, 0x61, 0x07, 0x15, 0xbe, 0xbc, 0x25, 0xed, 0x0d, 0x3c, 0xbc, 0x81,
0xf5, 0x87, 0xbc, 0xad, 0x95, 0x80, 0xdb, 0x06, 0xd0, 0x4a, 0xec, 0x5e, 0x43, 0xbd, 0xa1, 0x72,
0x69, 0x65, 0xdd, 0xfd, 0x87, 0x95, 0x6c, 0x0d, 0x56, 0xb2, 0xb5, 0x5a, 0xc9, 0xd6, 0x6d, 0x25,
0xfb, 0x5f, 0x2b, 0x09, 0x5a, 0x03, 0xa4, 0x63, 0xfd, 0x9a, 0xc6, 0x12, 0x53, 0x2e, 0xe0, 0x8e,
0x44, 0x8a, 0x62, 0x1d, 0xe9, 0xb2, 0x60, 0x57, 0xb8, 0x7f, 0x6c, 0xa0, 0x7e, 0x5c, 0xee, 0x3d,
0x4a, 0x25, 0xbd, 0x9d, 0x24, 0xfe, 0x50, 0xe5, 0xd5, 0xf2, 0x57, 0xc7, 0xa1, 0x1e, 0xbd, 0x0b,
0x68, 0x5a, 0x08, 0xed, 0x0f, 0x90, 0xbe, 0x7d, 0x3d, 0x84, 0xea, 0x6d, 0x0c, 0x90, 0xac, 0x84,
0x96, 0xbc, 0xa2, 0xe9, 0xbd, 0x07, 0x28, 0x59, 0xfb, 0x53, 0x12, 0x9a, 0x0f, 0x61, 0xa7, 0x22,
0x4d, 0x4c, 0x5e, 0x72, 0xee, 0xac, 0x83, 0x13, 0xe4, 0x92, 0xe4, 0x48, 0x40, 0x67, 0x80, 0x24,
0xd2, 0x71, 0x4c, 0x52, 0xe1, 0xd9, 0x07, 0xb3, 0x3f, 0xa7, 0x3a, 0xe5, 0x27, 0x00, 0x26, 0xac,
0x56, 0xc8, 0xad, 0x3d, 0xbc, 0xfd, 0x52, 0xdd, 0xbf, 0xf4, 0x7a, 0x8e, 0xdb, 0xf8, 0x68, 0x28,
0xfb, 0xdd, 0xd9, 0xdc, 0x63, 0x17, 0x73, 0x8f, 0xfd, 0x9c, 0x7b, 0xec, 0xd3, 0xc2, 0x73, 0x2e,
0x16, 0x9e, 0xf3, 0x7d, 0xe1, 0x39, 0x49, 0xb3, 0xfc, 0x4d, 0x3c, 0xfd, 0x1d, 0x00, 0x00, 0xff,
0xff, 0xde, 0xf7, 0xd7, 0x03, 0xa0, 0x04, 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
// IntegrationTxTestMsgClient is the client API for IntegrationTxTestMsg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type IntegrationTxTestMsgClient interface {
TestFields(ctx context.Context, in *TestRepeatedFields, opts ...grpc.CallOption) (*TestRepeatedFields, error)
}
type integrationTxTestMsgClient struct {
cc grpc1.ClientConn
}
func NewIntegrationTxTestMsgClient(cc grpc1.ClientConn) IntegrationTxTestMsgClient {
return &integrationTxTestMsgClient{cc}
}
func (c *integrationTxTestMsgClient) TestFields(ctx context.Context, in *TestRepeatedFields, opts ...grpc.CallOption) (*TestRepeatedFields, error) {
out := new(TestRepeatedFields)
err := c.cc.Invoke(ctx, "/testpb.IntegrationTxTestMsg/TestFields", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// IntegrationTxTestMsgServer is the server API for IntegrationTxTestMsg service.
type IntegrationTxTestMsgServer interface {
TestFields(context.Context, *TestRepeatedFields) (*TestRepeatedFields, error)
}
// UnimplementedIntegrationTxTestMsgServer can be embedded to have forward compatible implementations.
type UnimplementedIntegrationTxTestMsgServer struct {
}
func (*UnimplementedIntegrationTxTestMsgServer) TestFields(ctx context.Context, req *TestRepeatedFields) (*TestRepeatedFields, error) {
return nil, status.Errorf(codes.Unimplemented, "method TestFields not implemented")
}
func RegisterIntegrationTxTestMsgServer(s grpc1.Server, srv IntegrationTxTestMsgServer) {
s.RegisterService(&_IntegrationTxTestMsg_serviceDesc, srv)
}
func _IntegrationTxTestMsg_TestFields_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TestRepeatedFields)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IntegrationTxTestMsgServer).TestFields(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/testpb.IntegrationTxTestMsg/TestFields",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IntegrationTxTestMsgServer).TestFields(ctx, req.(*TestRepeatedFields))
}
return interceptor(ctx, in, info, handler)
}
var _IntegrationTxTestMsg_serviceDesc = grpc.ServiceDesc{
ServiceName: "testpb.IntegrationTxTestMsg",
HandlerType: (*IntegrationTxTestMsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "TestFields",
Handler: _IntegrationTxTestMsg_TestFields_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "testpb/test.proto",
}
func (m *Streng) Marshal() (dAtA []byte, err error) {
@ -612,49 +661,6 @@ func (m *IntAsBytes) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *IntAsBothStringAndBytes) 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 *IntAsBothStringAndBytes) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *IntAsBothStringAndBytes) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
{
size := m.IntAsBytes.Size()
i -= size
if _, err := m.IntAsBytes.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTest(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
{
size := m.IntAsString.Size()
i -= size
if _, err := m.IntAsString.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTest(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintTest(dAtA []byte, offset int, v uint64) int {
offset -= sovTest(v)
base := offset
@ -755,19 +761,6 @@ func (m *IntAsBytes) Size() (n int) {
return n
}
func (m *IntAsBothStringAndBytes) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.IntAsString.Size()
n += 1 + l + sovTest(uint64(l))
l = m.IntAsBytes.Size()
n += 1 + l + sovTest(uint64(l))
return n
}
func sovTest(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -1397,123 +1390,6 @@ func (m *IntAsBytes) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *IntAsBothStringAndBytes) 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 ErrIntOverflowTest
}
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: IntAsBothStringAndBytes: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: IntAsBothStringAndBytes: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field IntAsString", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
}
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 ErrInvalidLengthTest
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTest
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.IntAsString.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field IntAsBytes", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTest
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTest
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.IntAsBytes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTest(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTest
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTest(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0

View File

@ -3,6 +3,7 @@ package testpb
import (
_ "cosmossdk.io/api/amino"
_ "cosmossdk.io/api/cosmos/msg/v1"
fmt "fmt"
_ "github.com/cosmos/cosmos-proto"
runtime "github.com/cosmos/cosmos-proto/runtime"
@ -2857,492 +2858,6 @@ func (x *fastReflection_IntAsBytes) ProtoMethods() *protoiface.Methods {
}
}
var (
md_IntAsBothStringAndBytes protoreflect.MessageDescriptor
fd_IntAsBothStringAndBytes_int_as_string protoreflect.FieldDescriptor
fd_IntAsBothStringAndBytes_int_as_bytes protoreflect.FieldDescriptor
)
func init() {
file_testpb_test_proto_init()
md_IntAsBothStringAndBytes = File_testpb_test_proto.Messages().ByName("IntAsBothStringAndBytes")
fd_IntAsBothStringAndBytes_int_as_string = md_IntAsBothStringAndBytes.Fields().ByName("int_as_string")
fd_IntAsBothStringAndBytes_int_as_bytes = md_IntAsBothStringAndBytes.Fields().ByName("int_as_bytes")
}
var _ protoreflect.Message = (*fastReflection_IntAsBothStringAndBytes)(nil)
type fastReflection_IntAsBothStringAndBytes IntAsBothStringAndBytes
func (x *IntAsBothStringAndBytes) ProtoReflect() protoreflect.Message {
return (*fastReflection_IntAsBothStringAndBytes)(x)
}
func (x *IntAsBothStringAndBytes) slowProtoReflect() protoreflect.Message {
mi := &file_testpb_test_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_IntAsBothStringAndBytes_messageType fastReflection_IntAsBothStringAndBytes_messageType
var _ protoreflect.MessageType = fastReflection_IntAsBothStringAndBytes_messageType{}
type fastReflection_IntAsBothStringAndBytes_messageType struct{}
func (x fastReflection_IntAsBothStringAndBytes_messageType) Zero() protoreflect.Message {
return (*fastReflection_IntAsBothStringAndBytes)(nil)
}
func (x fastReflection_IntAsBothStringAndBytes_messageType) New() protoreflect.Message {
return new(fastReflection_IntAsBothStringAndBytes)
}
func (x fastReflection_IntAsBothStringAndBytes_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_IntAsBothStringAndBytes
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_IntAsBothStringAndBytes) Descriptor() protoreflect.MessageDescriptor {
return md_IntAsBothStringAndBytes
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_IntAsBothStringAndBytes) Type() protoreflect.MessageType {
return _fastReflection_IntAsBothStringAndBytes_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_IntAsBothStringAndBytes) New() protoreflect.Message {
return new(fastReflection_IntAsBothStringAndBytes)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_IntAsBothStringAndBytes) Interface() protoreflect.ProtoMessage {
return (*IntAsBothStringAndBytes)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_IntAsBothStringAndBytes) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.IntAsString != "" {
value := protoreflect.ValueOfString(x.IntAsString)
if !f(fd_IntAsBothStringAndBytes_int_as_string, value) {
return
}
}
if len(x.IntAsBytes) != 0 {
value := protoreflect.ValueOfBytes(x.IntAsBytes)
if !f(fd_IntAsBothStringAndBytes_int_as_bytes, value) {
return
}
}
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_IntAsBothStringAndBytes) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "testpb.IntAsBothStringAndBytes.int_as_string":
return x.IntAsString != ""
case "testpb.IntAsBothStringAndBytes.int_as_bytes":
return len(x.IntAsBytes) != 0
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.IntAsBothStringAndBytes"))
}
panic(fmt.Errorf("message testpb.IntAsBothStringAndBytes does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_IntAsBothStringAndBytes) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "testpb.IntAsBothStringAndBytes.int_as_string":
x.IntAsString = ""
case "testpb.IntAsBothStringAndBytes.int_as_bytes":
x.IntAsBytes = nil
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.IntAsBothStringAndBytes"))
}
panic(fmt.Errorf("message testpb.IntAsBothStringAndBytes does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_IntAsBothStringAndBytes) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "testpb.IntAsBothStringAndBytes.int_as_string":
value := x.IntAsString
return protoreflect.ValueOfString(value)
case "testpb.IntAsBothStringAndBytes.int_as_bytes":
value := x.IntAsBytes
return protoreflect.ValueOfBytes(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.IntAsBothStringAndBytes"))
}
panic(fmt.Errorf("message testpb.IntAsBothStringAndBytes does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_IntAsBothStringAndBytes) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "testpb.IntAsBothStringAndBytes.int_as_string":
x.IntAsString = value.Interface().(string)
case "testpb.IntAsBothStringAndBytes.int_as_bytes":
x.IntAsBytes = value.Bytes()
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.IntAsBothStringAndBytes"))
}
panic(fmt.Errorf("message testpb.IntAsBothStringAndBytes does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_IntAsBothStringAndBytes) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "testpb.IntAsBothStringAndBytes.int_as_string":
panic(fmt.Errorf("field int_as_string of message testpb.IntAsBothStringAndBytes is not mutable"))
case "testpb.IntAsBothStringAndBytes.int_as_bytes":
panic(fmt.Errorf("field int_as_bytes of message testpb.IntAsBothStringAndBytes is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.IntAsBothStringAndBytes"))
}
panic(fmt.Errorf("message testpb.IntAsBothStringAndBytes does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_IntAsBothStringAndBytes) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "testpb.IntAsBothStringAndBytes.int_as_string":
return protoreflect.ValueOfString("")
case "testpb.IntAsBothStringAndBytes.int_as_bytes":
return protoreflect.ValueOfBytes(nil)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.IntAsBothStringAndBytes"))
}
panic(fmt.Errorf("message testpb.IntAsBothStringAndBytes does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_IntAsBothStringAndBytes) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in testpb.IntAsBothStringAndBytes", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_IntAsBothStringAndBytes) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_IntAsBothStringAndBytes) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_IntAsBothStringAndBytes) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_IntAsBothStringAndBytes) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*IntAsBothStringAndBytes)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
l = len(x.IntAsString)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
l = len(x.IntAsBytes)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*IntAsBothStringAndBytes)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.IntAsBytes) > 0 {
i -= len(x.IntAsBytes)
copy(dAtA[i:], x.IntAsBytes)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.IntAsBytes)))
i--
dAtA[i] = 0x12
}
if len(x.IntAsString) > 0 {
i -= len(x.IntAsString)
copy(dAtA[i:], x.IntAsString)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.IntAsString)))
i--
dAtA[i] = 0xa
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*IntAsBothStringAndBytes)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IntAsBothStringAndBytes: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IntAsBothStringAndBytes: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field IntAsString", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.IntAsString = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field IntAsBytes", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + byteLen
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.IntAsBytes = append(x.IntAsBytes[:0], dAtA[iNdEx:postIndex]...)
if x.IntAsBytes == nil {
x.IntAsBytes = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
@ -3588,142 +3103,92 @@ func (x *IntAsBytes) GetIntAsBytes() []byte {
return nil
}
type IntAsBothStringAndBytes struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
IntAsString string `protobuf:"bytes,1,opt,name=int_as_string,json=intAsString,proto3" json:"int_as_string,omitempty"`
IntAsBytes []byte `protobuf:"bytes,2,opt,name=int_as_bytes,json=intAsBytes,proto3" json:"int_as_bytes,omitempty"`
}
func (x *IntAsBothStringAndBytes) Reset() {
*x = IntAsBothStringAndBytes{}
if protoimpl.UnsafeEnabled {
mi := &file_testpb_test_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *IntAsBothStringAndBytes) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*IntAsBothStringAndBytes) ProtoMessage() {}
// Deprecated: Use IntAsBothStringAndBytes.ProtoReflect.Descriptor instead.
func (*IntAsBothStringAndBytes) Descriptor() ([]byte, []int) {
return file_testpb_test_proto_rawDescGZIP(), []int{5}
}
func (x *IntAsBothStringAndBytes) GetIntAsString() string {
if x != nil {
return x.IntAsString
}
return ""
}
func (x *IntAsBothStringAndBytes) GetIntAsBytes() []byte {
if x != nil {
return x.IntAsBytes
}
return nil
}
var File_testpb_test_proto protoreflect.FileDescriptor
var file_testpb_test_proto_rawDesc = []byte{
0x0a, 0x11, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x1a, 0x14, 0x67, 0x6f, 0x67,
0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x1e, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
0xc8, 0x02, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64,
0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x3d, 0x0a, 0x12, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62,
0x6c, 0x65, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65,
0x6e, 0x67, 0x52, 0x11, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x6d, 0x69, 0x74,
0x65, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4d, 0x0a, 0x17, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c,
0x65, 0x5f, 0x64, 0x6f, 0x6e, 0x74, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e,
0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x42, 0x05, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x15, 0x6e,
0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x6f, 0x6e, 0x74, 0x4f, 0x6d, 0x69, 0x74, 0x65,
0x6d, 0x70, 0x74, 0x79, 0x12, 0x4a, 0x0a, 0x16, 0x6e, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6c, 0x6c,
0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74,
0x72, 0x65, 0x6e, 0x67, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x14, 0x6e, 0x6f, 0x6e, 0x4e,
0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79,
0x12, 0x58, 0x0a, 0x1b, 0x6e, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65,
0x5f, 0x64, 0x6f, 0x6e, 0x74, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18,
0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73,
0x74, 0x72, 0x65, 0x6e, 0x67, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01,
0x52, 0x18, 0x6e, 0x6f, 0x6e, 0x4e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x6f, 0x6e,
0x74, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xc8, 0x02, 0x0a, 0x12, 0x54,
0x65, 0x73, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64,
0x73, 0x12, 0x3d, 0x0a, 0x12, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6f, 0x6d,
0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x52, 0x11, 0x6e,
0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79,
0x12, 0x4d, 0x0a, 0x17, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6f, 0x6e,
0x74, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e,
0x67, 0x42, 0x05, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x15, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62,
0x6c, 0x65, 0x44, 0x6f, 0x6e, 0x74, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x12,
0x4a, 0x0a, 0x16, 0x6e, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f,
0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e,
0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1e, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65,
0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc8, 0x02, 0x0a, 0x12, 0x54, 0x65, 0x73,
0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12,
0x3d, 0x0a, 0x12, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6f, 0x6d, 0x69, 0x74,
0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65,
0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x52, 0x11, 0x6e, 0x75, 0x6c,
0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4d,
0x0a, 0x17, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6f, 0x6e, 0x74, 0x5f,
0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x42,
0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x14, 0x6e, 0x6f, 0x6e, 0x4e, 0x75, 0x6c, 0x6c, 0x61, 0x62,
0x6c, 0x65, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x58, 0x0a, 0x1b, 0x6e,
0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6f, 0x6e, 0x74,
0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67,
0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x18, 0x6e, 0x6f, 0x6e,
0x4e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x6f, 0x6e, 0x74, 0x4f, 0x6d, 0x69, 0x74,
0x65, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x74, 0x0a, 0x0b, 0x49, 0x6e, 0x74, 0x41, 0x73, 0x53, 0x74,
0x72, 0x69, 0x6e, 0x67, 0x12, 0x65, 0x0a, 0x0d, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x73, 0x5f, 0x73,
0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x41, 0xc8, 0xde, 0x1f,
0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64,
0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0b,
0x69, 0x6e, 0x74, 0x41, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x71, 0x0a, 0x0a, 0x49,
0x6e, 0x74, 0x41, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x63, 0x0a, 0x0c, 0x69, 0x6e, 0x74,
0x5f, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42,
0x41, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xd2,
0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0,
0x2a, 0x01, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x41, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0xe5,
0x01, 0x0a, 0x17, 0x49, 0x6e, 0x74, 0x41, 0x73, 0x42, 0x6f, 0x74, 0x68, 0x53, 0x74, 0x72, 0x69,
0x6e, 0x67, 0x41, 0x6e, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x65, 0x0a, 0x0d, 0x69, 0x6e,
0x74, 0x5f, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x42, 0x41, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e,
0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8,
0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x69, 0x6e, 0x74, 0x41, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e,
0x67, 0x12, 0x63, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65,
0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x41, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f,
0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79,
0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x41,
0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x42, 0xa7, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x74,
0x65, 0x73, 0x74, 0x70, 0x62, 0x42, 0x09, 0x54, 0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x56, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b,
0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x6a, 0x73, 0x6f, 0x6e, 0x2f, 0x69, 0x6e, 0x74,
0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x70, 0x75, 0x6c,
0x73, 0x61, 0x72, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x54, 0x58, 0x58,
0xaa, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62, 0xca, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74,
0x70, 0x62, 0xe2, 0x02, 0x12, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62, 0x5c, 0x47, 0x50, 0x42, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x05, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x15, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65,
0x44, 0x6f, 0x6e, 0x74, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4a, 0x0a,
0x16, 0x6e, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6f, 0x6d,
0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x42, 0x04, 0xc8,
0xde, 0x1f, 0x00, 0x52, 0x14, 0x6e, 0x6f, 0x6e, 0x4e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65,
0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x58, 0x0a, 0x1b, 0x6e, 0x6f, 0x6e,
0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6f, 0x6e, 0x74, 0x5f, 0x6f,
0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e,
0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x42, 0x09,
0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x18, 0x6e, 0x6f, 0x6e, 0x4e, 0x75,
0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x6f, 0x6e, 0x74, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d,
0x70, 0x74, 0x79, 0x22, 0xc8, 0x02, 0x0a, 0x12, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x75, 0x6c, 0x6c,
0x61, 0x62, 0x6c, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x3d, 0x0a, 0x12, 0x6e, 0x75,
0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e,
0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x52, 0x11, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65,
0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4d, 0x0a, 0x17, 0x6e, 0x75, 0x6c,
0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6f, 0x6e, 0x74, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65,
0x6d, 0x70, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73,
0x74, 0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x42, 0x05, 0xa8, 0xe7, 0xb0, 0x2a,
0x01, 0x52, 0x15, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x6f, 0x6e, 0x74, 0x4f,
0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x4a, 0x0a, 0x16, 0x6e, 0x6f, 0x6e, 0x5f,
0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70,
0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70,
0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x14,
0x6e, 0x6f, 0x6e, 0x4e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x6d, 0x69, 0x74, 0x65,
0x6d, 0x70, 0x74, 0x79, 0x12, 0x58, 0x0a, 0x1b, 0x6e, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6c, 0x6c,
0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x6f, 0x6e, 0x74, 0x5f, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x6d,
0x70, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x65, 0x73, 0x74,
0x70, 0x62, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8,
0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x18, 0x6e, 0x6f, 0x6e, 0x4e, 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c,
0x65, 0x44, 0x6f, 0x6e, 0x74, 0x4f, 0x6d, 0x69, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x74,
0x0a, 0x0b, 0x49, 0x6e, 0x74, 0x41, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x65, 0x0a,
0x0d, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x42, 0x41, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49,
0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x69, 0x6e, 0x74, 0x41, 0x73, 0x53, 0x74,
0x72, 0x69, 0x6e, 0x67, 0x22, 0x71, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x41, 0x73, 0x42, 0x79, 0x74,
0x65, 0x73, 0x12, 0x63, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x5f, 0x61, 0x73, 0x5f, 0x62, 0x79, 0x74,
0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x41, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde,
0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74,
0x79, 0x70, 0x65, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x69, 0x6e, 0x74,
0x41, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x32, 0x65, 0x0a, 0x14, 0x49, 0x6e, 0x74, 0x65, 0x67,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x78, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x12,
0x46, 0x0a, 0x0a, 0x54, 0x65, 0x73, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x1a, 0x2e,
0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61,
0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x1a, 0x1a, 0x2e, 0x74, 0x65, 0x73, 0x74,
0x70, 0x62, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x46,
0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x00, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa7,
0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x42, 0x09, 0x54,
0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x56, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x69,
0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f,
0x6a, 0x73, 0x6f, 0x6e, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65,
0x73, 0x74, 0x70, 0x62, 0x2f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x2f, 0x74, 0x65, 0x73, 0x74,
0x70, 0x62, 0xa2, 0x02, 0x03, 0x54, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, 0x70,
0x62, 0xca, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62, 0xe2, 0x02, 0x12, 0x54, 0x65, 0x73,
0x74, 0x70, 0x62, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
0x02, 0x06, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -3738,14 +3203,13 @@ func file_testpb_test_proto_rawDescGZIP() []byte {
return file_testpb_test_proto_rawDescData
}
var file_testpb_test_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_testpb_test_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_testpb_test_proto_goTypes = []interface{}{
(*Streng)(nil), // 0: testpb.streng
(*TestRepeatedFields)(nil), // 1: testpb.TestRepeatedFields
(*TestNullableFields)(nil), // 2: testpb.TestNullableFields
(*IntAsString)(nil), // 3: testpb.IntAsString
(*IntAsBytes)(nil), // 4: testpb.IntAsBytes
(*IntAsBothStringAndBytes)(nil), // 5: testpb.IntAsBothStringAndBytes
(*Streng)(nil), // 0: testpb.streng
(*TestRepeatedFields)(nil), // 1: testpb.TestRepeatedFields
(*TestNullableFields)(nil), // 2: testpb.TestNullableFields
(*IntAsString)(nil), // 3: testpb.IntAsString
(*IntAsBytes)(nil), // 4: testpb.IntAsBytes
}
var file_testpb_test_proto_depIdxs = []int32{
0, // 0: testpb.TestRepeatedFields.nullable_omitempty:type_name -> testpb.streng
@ -3756,8 +3220,10 @@ var file_testpb_test_proto_depIdxs = []int32{
0, // 5: testpb.TestNullableFields.nullable_dont_omitempty:type_name -> testpb.streng
0, // 6: testpb.TestNullableFields.non_nullable_omitempty:type_name -> testpb.streng
0, // 7: testpb.TestNullableFields.non_nullable_dont_omitempty:type_name -> testpb.streng
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
1, // 8: testpb.IntegrationTxTestMsg.TestFields:input_type -> testpb.TestRepeatedFields
1, // 9: testpb.IntegrationTxTestMsg.TestFields:output_type -> testpb.TestRepeatedFields
9, // [9:10] is the sub-list for method output_type
8, // [8:9] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
@ -3829,18 +3295,6 @@ func file_testpb_test_proto_init() {
return nil
}
}
file_testpb_test_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IntAsBothStringAndBytes); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -3848,9 +3302,9 @@ func file_testpb_test_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_testpb_test_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
NumServices: 1,
},
GoTypes: file_testpb_test_proto_goTypes,
DependencyIndexes: file_testpb_test_proto_depIdxs,

View File

@ -2,6 +2,7 @@ syntax = "proto3";
package testpb;
import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "cosmos_proto/cosmos.proto";
@ -55,4 +56,10 @@ message IntAsBytes {
(amino.dont_omitempty) = true,
(gogoproto.nullable) = false
];
}
service IntegrationTxTestMsg {
option (cosmos.msg.v1.service) = true;
rpc TestFields(TestRepeatedFields) returns (TestRepeatedFields) {}
}

View File

@ -1,6 +1,7 @@
package rosetta
import (
"cosmossdk.io/x/tx/signing"
"github.com/cosmos/gogoproto/proto"
"github.com/cosmos/cosmos-sdk/codec"
@ -18,11 +19,13 @@ func MakeCodec() (*codec.ProtoCodec, codectypes.InterfaceRegistry) {
ir, err := codectypes.NewInterfaceRegistryWithOptions(
codectypes.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
SigningOptions: signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
},
},
)

View File

@ -154,6 +154,7 @@ require (
// Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities.
// TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409
replace (
cosmossdk.io/x/tx => ../../x/tx
// TODO: remove me after collections 0.2. is released.
cosmossdk.io/collections => ../../collections
cosmossdk.io/core => ../../core

View File

@ -31,6 +31,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
## Unreleased
### Improvements
* [#16340](https://github.com/cosmos/cosmos-sdk/pull/16340): add `DefineCustomGetSigners` API function.
## v0.7.0
### API Breaking

View File

@ -61,7 +61,7 @@ func TestDecode(t *testing.T) {
{
name: "empty signer option",
msg: &testpb.A{},
error: "no cosmos.msg.v1.signer option found for message A: tx parse error",
error: "no cosmos.msg.v1.signer option found for message A; use DefineCustomGetSigners to specify a custom getter: tx parse error",
},
}

View File

@ -104,4 +104,4 @@ message Ballot {
string voter = 2;
reserved 3;
repeated WeightedBallotOption options = 4;
}
}

View File

@ -67,4 +67,9 @@ message NoSignerOption {
message ValidatorSigner {
option (cosmos.msg.v1.signer) = "signer";
string signer = 1 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"];
}
service TestSimpleSigner {
option (cosmos.msg.v1.service) = true;
rpc TestSimpleSigner(SimpleSigner) returns (SimpleSigner) {}
}

View File

@ -6362,12 +6362,17 @@ var file_signers_proto_rawDesc = []byte{
0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72,
0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x42, 0x3b, 0x42,
0x0c, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
0x29, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x78, 0x2f,
0x74, 0x78, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72,
0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x32, 0x4d, 0x0a,
0x10, 0x54, 0x65, 0x73, 0x74, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x65,
0x72, 0x12, 0x32, 0x0a, 0x10, 0x54, 0x65, 0x73, 0x74, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x53,
0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x0d, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x69,
0x67, 0x6e, 0x65, 0x72, 0x1a, 0x0d, 0x2e, 0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x69, 0x67,
0x6e, 0x65, 0x72, 0x22, 0x00, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x3b, 0x42, 0x0c,
0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x78, 0x2f, 0x74,
0x78, 0x2f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
0x61, 0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
@ -6403,8 +6408,10 @@ var file_signers_proto_depIdxs = []int32{
10, // 1: RepeatedNestedSigner.inner:type_name -> RepeatedNestedSigner.Inner
11, // 2: NestedRepeatedSigner.inner:type_name -> NestedRepeatedSigner.Inner
12, // 3: RepeatedNestedRepeatedSigner.inner:type_name -> RepeatedNestedRepeatedSigner.Inner
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
0, // 4: TestSimpleSigner.TestSimpleSigner:input_type -> SimpleSigner
0, // 5: TestSimpleSigner.TestSimpleSigner:output_type -> SimpleSigner
5, // [5:6] is the sub-list for method output_type
4, // [4:5] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
@ -6581,7 +6588,7 @@ func file_signers_proto_init() {
NumEnums: 0,
NumMessages: 13,
NumExtensions: 0,
NumServices: 0,
NumServices: 1,
},
GoTypes: file_signers_proto_goTypes,
DependencyIndexes: file_signers_proto_depIdxs,

View File

@ -10,8 +10,9 @@ import (
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
msgv1 "cosmossdk.io/api/cosmos/msg/v1"
"cosmossdk.io/core/address"
msgv1 "cosmossdk.io/api/cosmos/msg/v1"
)
// Context is a context for retrieving the list of signers from a
@ -23,7 +24,8 @@ type Context struct {
typeResolver protoregistry.MessageTypeResolver
addressCodec address.Codec
validatorAddressCodec address.Codec
getSignersFuncs map[protoreflect.FullName]getSignersFunc
getSignersFuncs map[protoreflect.FullName]GetSignersFunc
customGetSignerFuncs map[protoreflect.FullName]GetSignersFunc
}
// Options are options for creating Context which will be used for signing operations.
@ -40,6 +42,21 @@ type Options struct {
// ValidatorAddressCodec is the codec for converting validator addresses between strings and bytes.
ValidatorAddressCodec address.Codec
CustomGetSigners map[protoreflect.FullName]GetSignersFunc
}
// DefineCustomGetSigners defines a custom GetSigners function for a given
// message type.
//
// NOTE: if a custom signers function is defined, the message type used to
// define this function MUST be the concrete type passed to GetSigners,
// otherwise a runtime type error will occur.
func (o *Options) DefineCustomGetSigners(typeName protoreflect.FullName, f GetSignersFunc) {
if o.CustomGetSigners == nil {
o.CustomGetSigners = map[protoreflect.FullName]GetSignersFunc{}
}
o.CustomGetSigners[typeName] = f
}
// ProtoFileResolver is a protodesc.Resolver that also allows iterating over all
@ -69,23 +86,38 @@ func NewContext(options Options) (*Context, error) {
return nil, errors.New("validator address codec is required")
}
customGetSignerFuncs := map[protoreflect.FullName]GetSignersFunc{}
for k := range options.CustomGetSigners {
customGetSignerFuncs[k] = options.CustomGetSigners[k]
}
c := &Context{
fileResolver: protoFiles,
typeResolver: protoTypes,
addressCodec: options.AddressCodec,
validatorAddressCodec: options.ValidatorAddressCodec,
getSignersFuncs: map[protoreflect.FullName]getSignersFunc{},
getSignersFuncs: map[protoreflect.FullName]GetSignersFunc{},
customGetSignerFuncs: customGetSignerFuncs,
}
return c, nil
}
type getSignersFunc func(proto.Message) ([][]byte, error)
// GetSignersFunc returns the signers for a given message.
type GetSignersFunc func(proto.Message) ([][]byte, error)
// CustomGetSigner is a custom GetSignersFunc that is defined for a specific message type.
type CustomGetSigner struct {
MsgType protoreflect.FullName
Fn GetSignersFunc
}
func (c CustomGetSigner) IsManyPerContainerType() {}
func getSignersFieldNames(descriptor protoreflect.MessageDescriptor) ([]string, error) {
signersFields := proto.GetExtension(descriptor.Options(), msgv1.E_Signer).([]string)
if len(signersFields) == 0 {
return nil, fmt.Errorf("no cosmos.msg.v1.signer option found for message %s", descriptor.FullName())
return nil, fmt.Errorf("no cosmos.msg.v1.signer option found for message %s; use DefineCustomGetSigners to specify a custom getter", descriptor.FullName())
}
return signersFields, nil
@ -109,6 +141,11 @@ func (c *Context) Validate() error {
for j := 0; j < sd.Methods().Len(); j++ {
md := sd.Methods().Get(j).Input()
_, hasCustomSigner := c.customGetSignerFuncs[md.FullName()]
if _, err := getSignersFieldNames(md); err == nil && hasCustomSigner {
errs = append(errs, fmt.Errorf("a custom signer function as been defined for message %s which already has a signer field defined with (cosmos.msg.v1.signer)", md.FullName()))
continue
}
_, err := c.getGetSignersFn(md)
if err != nil {
errs = append(errs, err)
@ -122,7 +159,7 @@ func (c *Context) Validate() error {
return errors.Join(errs...)
}
func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor) (getSignersFunc, error) {
func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor) (GetSignersFunc, error) {
signersFields, err := getSignersFieldNames(descriptor)
if err != nil {
return nil, err
@ -282,8 +319,12 @@ func (c *Context) getAddressCodec(field protoreflect.FieldDescriptor) address.Co
return addrCdc
}
func (c *Context) getGetSignersFn(messageDescriptor protoreflect.MessageDescriptor) (getSignersFunc, error) {
f, ok := c.getSignersFuncs[messageDescriptor.FullName()]
func (c *Context) getGetSignersFn(messageDescriptor protoreflect.MessageDescriptor) (GetSignersFunc, error) {
f, ok := c.customGetSignerFuncs[messageDescriptor.FullName()]
if ok {
return f, nil
}
f, ok = c.getSignersFuncs[messageDescriptor.FullName()]
if !ok {
var err error
f, err = c.makeGetSignersFunc(messageDescriptor)
@ -316,11 +357,12 @@ func (c *Context) ValidatorAddressCodec() address.Codec {
return c.validatorAddressCodec
}
// FileResolver returns the proto file resolver used by the context.
// FileResolver returns the protobuf file resolver used by the context.
func (c *Context) FileResolver() ProtoFileResolver {
return c.fileResolver
}
// TypeResolver returns the protobuf type resolver used by the context.
func (c *Context) TypeResolver() protoregistry.MessageTypeResolver {
return c.typeResolver
}

View File

@ -145,6 +145,42 @@ func TestGetSigners(t *testing.T) {
}
}
func TestDefineCustomGetSigners(t *testing.T) {
customMsg := &testpb.Ballot{}
signers := [][]byte{[]byte("foo")}
options := Options{
AddressCodec: dummyAddressCodec{},
ValidatorAddressCodec: dummyValidatorAddressCodec{},
}
context, err := NewContext(options)
require.NoError(t, err)
_, err = context.GetSigners(customMsg)
// without a custom signer we should get an error
require.ErrorContains(t, err, "use DefineCustomGetSigners to specify")
// create a new context with a custom signer
options.DefineCustomGetSigners(proto.MessageName(customMsg), func(msg proto.Message) ([][]byte, error) {
return signers, nil
})
context, err = NewContext(options)
require.NoError(t, err)
gotSigners, err := context.GetSigners(customMsg)
// now that a custom signer has been defined, we should get no error and the expected result
require.NoError(t, err)
require.Equal(t, signers, gotSigners)
// test that registering a custom signer for a message that already has proto annotation defined signer
// fails validation
simpleSigner := &testpb.SimpleSigner{Signer: hex.EncodeToString([]byte("foo"))}
options.DefineCustomGetSigners(proto.MessageName(simpleSigner), func(msg proto.Message) ([][]byte, error) {
return [][]byte{[]byte("qux")}, nil
})
context, err = NewContext(options)
require.NoError(t, err)
require.ErrorContains(t, context.Validate(), "a custom signer function as been defined for message SimpleSigner")
}
type dummyAddressCodec struct{}
func (d dummyAddressCodec) StringToBytes(text string) ([]byte, error) {