From b20a1dfd2be064f29e79f076c4a8478563f34df1 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 16 May 2023 10:02:13 -0400 Subject: [PATCH 01/26] feat: get signers extension interface --- api/cosmos/msg/v1/msg.pulsar.go | 53 +++++++++++++++++++++++---------- proto/cosmos/msg/v1/msg.proto | 6 ++++ types/msgservice/msg.pb.go | 25 +++++++++++----- x/tx/go.mod | 3 ++ x/tx/signing/context.go | 17 ++++++++++- x/tx/signing/custom.go | 5 ++++ 6 files changed, 85 insertions(+), 24 deletions(-) create mode 100644 x/tx/signing/custom.go diff --git a/api/cosmos/msg/v1/msg.pulsar.go b/api/cosmos/msg/v1/msg.pulsar.go index 7bf986dd12c5..7f0944ddb473 100644 --- a/api/cosmos/msg/v1/msg.pulsar.go +++ b/api/cosmos/msg/v1/msg.pulsar.go @@ -38,6 +38,14 @@ var file_cosmos_msg_v1_msg_proto_extTypes = []protoimpl.ExtensionInfo{ Tag: "bytes,11110000,rep,name=signer", Filename: "cosmos/msg/v1/msg.proto", }, + { + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 57938276, + Name: "cosmos.msg.v1.custom_signer", + Tag: "varint,57938276,opt,name=custom_signer", + Filename: "cosmos/msg/v1/msg.proto", + }, } // Extension fields to descriptorpb.ServiceOptions. @@ -65,6 +73,13 @@ var ( // // repeated string signer = 11110000; E_Signer = &file_cosmos_msg_v1_msg_proto_extTypes[1] + // custom_signer indicates that a message does not define signers in the + // standard way using the signer option but instead defines its own custom + // way of defining signers. Frameworks and clients will need to provide + // custom logic to handle these messages. + // + // optional bool custom_signer = 57938276; + E_CustomSigner = &file_cosmos_msg_v1_msg_proto_extTypes[2] ) var File_cosmos_msg_v1_msg_proto protoreflect.FileDescriptor @@ -82,17 +97,22 @@ var file_cosmos_msg_v1_msg_proto_rawDesc = []byte{ 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0x8c, 0xa6, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x69, - 0x67, 0x6e, 0x65, 0x72, 0x42, 0x99, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x4d, 0x73, 0x67, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x73, 0x67, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, - 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x2e, - 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4d, 0x73, 0x67, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4d, 0x73, 0x67, 0x5c, - 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x4d, 0x73, 0x67, 0x3a, 0x3a, 0x56, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x6e, 0x65, 0x72, 0x3a, 0x47, 0x0a, 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x73, + 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xe4, 0xa2, 0xd0, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x42, 0x99, 0x01, + 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6d, 0x73, 0x67, + 0x2e, 0x76, 0x31, 0x42, 0x08, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x3b, + 0x6d, 0x73, 0x67, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4d, 0x73, 0x67, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4d, 0x73, 0x67, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x3a, 0x3a, 0x4d, 0x73, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var file_cosmos_msg_v1_msg_proto_goTypes = []interface{}{ @@ -102,10 +122,11 @@ var file_cosmos_msg_v1_msg_proto_goTypes = []interface{}{ var file_cosmos_msg_v1_msg_proto_depIdxs = []int32{ 0, // 0: cosmos.msg.v1.service:extendee -> google.protobuf.ServiceOptions 1, // 1: cosmos.msg.v1.signer:extendee -> google.protobuf.MessageOptions - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 0, // [0:2] is the sub-list for extension extendee + 1, // 2: cosmos.msg.v1.custom_signer:extendee -> google.protobuf.MessageOptions + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 0, // [0:3] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } @@ -121,7 +142,7 @@ func file_cosmos_msg_v1_msg_proto_init() { RawDescriptor: file_cosmos_msg_v1_msg_proto_rawDesc, NumEnums: 0, NumMessages: 0, - NumExtensions: 2, + NumExtensions: 3, NumServices: 0, }, GoTypes: file_cosmos_msg_v1_msg_proto_goTypes, diff --git a/proto/cosmos/msg/v1/msg.proto b/proto/cosmos/msg/v1/msg.proto index 853efa1f7c0f..62305459c3a7 100644 --- a/proto/cosmos/msg/v1/msg.proto +++ b/proto/cosmos/msg/v1/msg.proto @@ -27,4 +27,10 @@ extend google.protobuf.MessageOptions { // kind in case the signer information is contained within // a message inside the cosmos message. repeated string signer = 11110000; + + // custom_signer indicates that a message does not define signers in the + // standard way using the signer option but instead defines its own custom + // way of defining signers. Frameworks and clients will need to provide + // custom logic to handle these messages. + bool custom_signer = 57938276; } diff --git a/types/msgservice/msg.pb.go b/types/msgservice/msg.pb.go index 8b75fd6ea57a..0c3afbbdefae 100644 --- a/types/msgservice/msg.pb.go +++ b/types/msgservice/msg.pb.go @@ -39,15 +39,25 @@ var E_Signer = &proto.ExtensionDesc{ Filename: "cosmos/msg/v1/msg.proto", } +var E_CustomSigner = &proto.ExtensionDesc{ + ExtendedType: (*descriptorpb.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 57938276, + Name: "cosmos.msg.v1.custom_signer", + Tag: "varint,57938276,opt,name=custom_signer", + Filename: "cosmos/msg/v1/msg.proto", +} + func init() { proto.RegisterExtension(E_Service) proto.RegisterExtension(E_Signer) + proto.RegisterExtension(E_CustomSigner) } func init() { proto.RegisterFile("cosmos/msg/v1/msg.proto", fileDescriptor_5c08b83ea858d203) } var fileDescriptor_5c08b83ea858d203 = []byte{ - // 214 bytes of a gzipped FileDescriptorProto + // 240 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0xcf, 0x2d, 0x4e, 0xd7, 0x2f, 0x33, 0x04, 0x51, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xbc, 0x10, 0x09, 0x3d, 0x90, 0x48, 0x99, 0xa1, 0x94, 0x42, 0x7a, 0x7e, 0x7e, 0x7a, @@ -56,10 +66,11 @@ var fileDescriptor_5c08b83ea858d203 = []byte{ 0x48, 0x5e, 0x0f, 0xa2, 0x5a, 0x0f, 0xa6, 0x5a, 0x2f, 0x18, 0x22, 0xe3, 0x5f, 0x50, 0x92, 0x99, 0x9f, 0x57, 0x2c, 0xf1, 0xa1, 0x67, 0x19, 0xab, 0x02, 0xa3, 0x06, 0x47, 0x10, 0x4c, 0x8b, 0x95, 0x15, 0x17, 0x5b, 0x71, 0x66, 0x7a, 0x5e, 0x6a, 0x11, 0x16, 0xcd, 0xbe, 0xa9, 0xc5, 0xc5, 0x89, - 0xe9, 0xa8, 0x9a, 0x99, 0x35, 0x38, 0x83, 0xa0, 0x3a, 0x9c, 0xdc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, - 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, - 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x37, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, - 0x57, 0x1f, 0xea, 0x51, 0x08, 0xa5, 0x5b, 0x9c, 0x92, 0xad, 0x5f, 0x52, 0x59, 0x90, 0x0a, 0xf6, - 0x39, 0xd4, 0x11, 0x49, 0x6c, 0x60, 0x2b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xa2, - 0x03, 0xdb, 0x15, 0x01, 0x00, 0x00, + 0xe9, 0xa8, 0x9a, 0x99, 0x35, 0x38, 0x83, 0xa0, 0x3a, 0xac, 0xdc, 0xb9, 0x78, 0x93, 0x4b, 0x8b, + 0x4b, 0xf2, 0x73, 0xe3, 0x89, 0x35, 0xe2, 0xc9, 0xa2, 0x0b, 0xd2, 0x60, 0xfb, 0x79, 0x20, 0x1a, + 0x83, 0xc1, 0xfa, 0x9c, 0xdc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, + 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, + 0x37, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x1a, 0x62, 0x10, 0x4a, + 0xb7, 0x38, 0x25, 0x5b, 0xbf, 0xa4, 0xb2, 0x20, 0x15, 0x1c, 0x84, 0x50, 0xdf, 0x24, 0xb1, 0x81, + 0x2d, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc3, 0xc9, 0x90, 0x6b, 0x5e, 0x01, 0x00, 0x00, } diff --git a/x/tx/go.mod b/x/tx/go.mod index 777fab2e3210..1345765868b8 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -31,3 +31,6 @@ require ( google.golang.org/grpc v1.55.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +// temporary replace +replace cosmossdk.io/api => ../../api \ No newline at end of file diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 52a3eaab7f19..60feebaa9b67 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -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 @@ -123,6 +124,16 @@ func (c *Context) Validate() error { } func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor) (getSignersFunc, error) { + isCustom := proto.GetExtension(descriptor.Options(), msgv1.E_CustomSigner).(bool) + if isCustom { + return func(message proto.Message) ([][]byte, error) { + if custom, ok := message.(HasCustomSigners); ok { + return custom.GetCustomSigners() + } + return nil, fmt.Errorf("message %s does not implement HasCustomSigners", descriptor.FullName()) + }, nil + } + signersFields, err := getSignersFieldNames(descriptor) if err != nil { return nil, err @@ -324,3 +335,7 @@ func (c *Context) FileResolver() ProtoFileResolver { func (c *Context) TypeResolver() protoregistry.MessageTypeResolver { return c.typeResolver } + +func (c *Context) DefineCustomGetSigners() { + +} diff --git a/x/tx/signing/custom.go b/x/tx/signing/custom.go new file mode 100644 index 000000000000..efded8f3f8c9 --- /dev/null +++ b/x/tx/signing/custom.go @@ -0,0 +1,5 @@ +package signing + +type HasCustomSigners interface { + GetCustomSigners() ([][]byte, error) +} From badd826bd495b28999a395f841ed85337fd978c7 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 16 May 2023 11:28:58 -0400 Subject: [PATCH 02/26] WIP on defining custom get signers --- x/tx/signing/context.go | 51 +++++++++++++++++++++++++++-------------- x/tx/signing/custom.go | 5 ---- 2 files changed, 34 insertions(+), 22 deletions(-) delete mode 100644 x/tx/signing/custom.go diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 60feebaa9b67..831beec63bea 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -3,6 +3,7 @@ package signing import ( "errors" "fmt" + "reflect" cosmos_proto "github.com/cosmos/cosmos-proto" "google.golang.org/protobuf/proto" @@ -24,7 +25,8 @@ type Context struct { typeResolver protoregistry.MessageTypeResolver addressCodec address.Codec validatorAddressCodec address.Codec - getSignersFuncs map[protoreflect.FullName]getSignersFunc + getSignersFuncsByName map[protoreflect.FullName]getSignersFunc + getSignersFuncsByType map[reflect.Type]getSignersFunc } // Options are options for creating Context which will be used for signing operations. @@ -75,7 +77,7 @@ func NewContext(options Options) (*Context, error) { typeResolver: protoTypes, addressCodec: options.AddressCodec, validatorAddressCodec: options.ValidatorAddressCodec, - getSignersFuncs: map[protoreflect.FullName]getSignersFunc{}, + getSignersFuncsByName: map[protoreflect.FullName]getSignersFunc{}, } return c, nil @@ -95,8 +97,7 @@ func getSignersFieldNames(descriptor protoreflect.MessageDescriptor) ([]string, // Validate performs a dry run of getting all msg's signers. This has 2 benefits: // - it will error if any Msg has forgotten the "cosmos.msg.v1.signer" // annotation -// - it will pre-populate the context's internal cache for getSignersFuncs -// so that calling it in antehandlers will be faster. +// - it will pre-populate the context's internal cache so that calling it in antehandlers will be faster. func (c *Context) Validate() error { var errs []error c.fileResolver.RangeFiles(func(fd protoreflect.FileDescriptor) bool { @@ -110,7 +111,7 @@ func (c *Context) Validate() error { for j := 0; j < sd.Methods().Len(); j++ { md := sd.Methods().Get(j).Input() - _, err := c.getGetSignersFn(md) + _, err := c.getGetSignersFnByMd(md) if err != nil { errs = append(errs, err) } @@ -126,12 +127,6 @@ func (c *Context) Validate() error { func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor) (getSignersFunc, error) { isCustom := proto.GetExtension(descriptor.Options(), msgv1.E_CustomSigner).(bool) if isCustom { - return func(message proto.Message) ([][]byte, error) { - if custom, ok := message.(HasCustomSigners); ok { - return custom.GetCustomSigners() - } - return nil, fmt.Errorf("message %s does not implement HasCustomSigners", descriptor.FullName()) - }, nil } signersFields, err := getSignersFieldNames(descriptor) @@ -293,15 +288,32 @@ 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) getGetSignersFnByMd(messageDescriptor protoreflect.MessageDescriptor) (getSignersFunc, error) { + msgType, err := c.typeResolver.FindMessageByName(messageDescriptor.FullName()) + + f, ok := c.getSignersFuncsByName[] if !ok { var err error f, err = c.makeGetSignersFunc(messageDescriptor) if err != nil { return nil, err } - c.getSignersFuncs[messageDescriptor.FullName()] = f + c.getSignersFuncsByName[messageDescriptor.FullName()] = f + } + + return f, nil +} + +func (c *Context) getGetSignersFn(m proto.Message) (getSignersFunc, error) { + typ := reflect.TypeOf(m) + f, ok := c.getSignersFuncsByType[typ] + if !ok { + var err error + f, err = c.makeGetSignersFunc(m.ProtoReflect().Descriptor()) + if err != nil { + return nil, err + } + c.getSignersFuncsByType[typ] = f } return f, nil @@ -309,7 +321,7 @@ func (c *Context) getGetSignersFn(messageDescriptor protoreflect.MessageDescript // GetSigners returns the signers for a given message. func (c *Context) GetSigners(msg proto.Message) ([][]byte, error) { - f, err := c.getGetSignersFn(msg.ProtoReflect().Descriptor()) + f, err := c.getGetSignersFn(msg) if err != nil { return nil, err } @@ -332,10 +344,15 @@ func (c *Context) FileResolver() ProtoFileResolver { return c.fileResolver } +// TypeResolver returns the proto type resolver used by the context. func (c *Context) TypeResolver() protoregistry.MessageTypeResolver { return c.typeResolver } -func (c *Context) DefineCustomGetSigners() { - +// DefineCustomGetSigners defines a custom GetSigners function for a given message type. +// It is defined as a function rather than a method on Context because of how go generics work. +func DefineCustomGetSigners[T proto.Message](ctx *Context, getSigners func(T) ([][]byte, error)) { + ctx.getSignersFuncsByType[reflect.TypeOf((*T)(nil)).Elem()] = func(msg proto.Message) ([][]byte, error) { + return getSigners(msg.(T)) + } } diff --git a/x/tx/signing/custom.go b/x/tx/signing/custom.go deleted file mode 100644 index efded8f3f8c9..000000000000 --- a/x/tx/signing/custom.go +++ /dev/null @@ -1,5 +0,0 @@ -package signing - -type HasCustomSigners interface { - GetCustomSigners() ([][]byte, error) -} From 00eefcfe374fc907653819e527c67e4cfbe700bd Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 16 May 2023 11:37:12 -0400 Subject: [PATCH 03/26] add DefineCustomGetSigners --- x/tx/signing/context.go | 57 +++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 831beec63bea..56c7e863a682 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -3,7 +3,6 @@ package signing import ( "errors" "fmt" - "reflect" cosmos_proto "github.com/cosmos/cosmos-proto" "google.golang.org/protobuf/proto" @@ -25,8 +24,7 @@ type Context struct { typeResolver protoregistry.MessageTypeResolver addressCodec address.Codec validatorAddressCodec address.Codec - getSignersFuncsByName map[protoreflect.FullName]getSignersFunc - getSignersFuncsByType map[reflect.Type]getSignersFunc + getSignersFuncs map[protoreflect.FullName]getSignersFunc } // Options are options for creating Context which will be used for signing operations. @@ -77,7 +75,7 @@ func NewContext(options Options) (*Context, error) { typeResolver: protoTypes, addressCodec: options.AddressCodec, validatorAddressCodec: options.ValidatorAddressCodec, - getSignersFuncsByName: map[protoreflect.FullName]getSignersFunc{}, + getSignersFuncs: map[protoreflect.FullName]getSignersFunc{}, } return c, nil @@ -97,7 +95,8 @@ func getSignersFieldNames(descriptor protoreflect.MessageDescriptor) ([]string, // Validate performs a dry run of getting all msg's signers. This has 2 benefits: // - it will error if any Msg has forgotten the "cosmos.msg.v1.signer" // annotation -// - it will pre-populate the context's internal cache so that calling it in antehandlers will be faster. +// - it will pre-populate the context's internal cache for getSignersFuncs +// so that calling it in antehandlers will be faster. func (c *Context) Validate() error { var errs []error c.fileResolver.RangeFiles(func(fd protoreflect.FileDescriptor) bool { @@ -111,8 +110,8 @@ func (c *Context) Validate() error { for j := 0; j < sd.Methods().Len(); j++ { md := sd.Methods().Get(j).Input() - _, err := c.getGetSignersFnByMd(md) - if err != nil { + _, err := c.getGetSignersFn(md) + if err != nil && !errors.Is(err, NeedCustomSignersError) { // don't fail on custom signers errs = append(errs, err) } } @@ -127,6 +126,7 @@ func (c *Context) Validate() error { func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor) (getSignersFunc, error) { isCustom := proto.GetExtension(descriptor.Options(), msgv1.E_CustomSigner).(bool) if isCustom { + return nil, fmt.Errorf("%w: %s", NeedCustomSignersError, descriptor.FullName()) } signersFields, err := getSignersFieldNames(descriptor) @@ -288,32 +288,15 @@ func (c *Context) getAddressCodec(field protoreflect.FieldDescriptor) address.Co return addrCdc } -func (c *Context) getGetSignersFnByMd(messageDescriptor protoreflect.MessageDescriptor) (getSignersFunc, error) { - msgType, err := c.typeResolver.FindMessageByName(messageDescriptor.FullName()) - - f, ok := c.getSignersFuncsByName[] +func (c *Context) getGetSignersFn(messageDescriptor protoreflect.MessageDescriptor) (getSignersFunc, error) { + f, ok := c.getSignersFuncs[messageDescriptor.FullName()] if !ok { var err error f, err = c.makeGetSignersFunc(messageDescriptor) if err != nil { return nil, err } - c.getSignersFuncsByName[messageDescriptor.FullName()] = f - } - - return f, nil -} - -func (c *Context) getGetSignersFn(m proto.Message) (getSignersFunc, error) { - typ := reflect.TypeOf(m) - f, ok := c.getSignersFuncsByType[typ] - if !ok { - var err error - f, err = c.makeGetSignersFunc(m.ProtoReflect().Descriptor()) - if err != nil { - return nil, err - } - c.getSignersFuncsByType[typ] = f + c.getSignersFuncs[messageDescriptor.FullName()] = f } return f, nil @@ -321,7 +304,7 @@ func (c *Context) getGetSignersFn(m proto.Message) (getSignersFunc, error) { // GetSigners returns the signers for a given message. func (c *Context) GetSigners(msg proto.Message) ([][]byte, error) { - f, err := c.getGetSignersFn(msg) + f, err := c.getGetSignersFn(msg.ProtoReflect().Descriptor()) if err != nil { return nil, err } @@ -339,20 +322,28 @@ 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 proto type resolver used by the context. +// TypeResolver returns the protobuf type resolver used by the context. func (c *Context) TypeResolver() protoregistry.MessageTypeResolver { return c.typeResolver } -// DefineCustomGetSigners defines a custom GetSigners function for a given message type. -// It is defined as a function rather than a method on Context because of how go generics work. +// DefineCustomGetSigners defines a custom GetSigners function for a given +// message type. It is defined as a function rather than a method on Context +// because of how go generics work. +// +// 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 DefineCustomGetSigners[T proto.Message](ctx *Context, getSigners func(T) ([][]byte, error)) { - ctx.getSignersFuncsByType[reflect.TypeOf((*T)(nil)).Elem()] = func(msg proto.Message) ([][]byte, error) { + t := *new(T) + ctx.getSignersFuncs[t.ProtoReflect().Descriptor().FullName()] = func(msg proto.Message) ([][]byte, error) { return getSigners(msg.(T)) } } + +var NeedCustomSignersError = errors.New("need custom signers function") From d8290feed7e63a1e83147d9004ff9f34341bf2b0 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Tue, 30 May 2023 14:41:03 -0500 Subject: [PATCH 04/26] make vulncheck fix --- go.mod | 1 + go.sum | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 50a1942af833..0aad95df70bc 100644 --- a/go.mod +++ b/go.mod @@ -163,6 +163,7 @@ require ( // Below are the long-lived replace of the Cosmos SDK replace ( + cosmossdk.io/api => ./api // TODO: remove me after collections 0.2. is released. cosmossdk.io/collections => ./collections cosmossdk.io/core => ./core diff --git a/go.sum b/go.sum index 4a51dbcfab4e..b86a124eb334 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.4.1 h1:0ikaYM6GyxTYYcfBiyR8YnLCfhNnhKpEFnaSepCTmqg= -cosmossdk.io/api v0.4.1/go.mod h1:jR7k5ok90LxW2lFUXvd8Vpo/dr4PpiyVegxdm7b1ZdE= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7.0.20230429155654-3ee8242364e4 h1:rOy7iw7HlwKc5Af5qIHLXdBx/F98o6du/I/WGwOW6eA= From 7a6bc7194b81f34d365a12d2548a156e8248cefc Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Tue, 30 May 2023 16:31:16 -0500 Subject: [PATCH 05/26] add a custom signers test --- x/tx/internal/testpb/1.proto | 7 + x/tx/internal/testpb/1.pulsar.go | 845 +++++++++++++++++++++++++------ x/tx/signing/context_test.go | 22 + 3 files changed, 725 insertions(+), 149 deletions(-) diff --git a/x/tx/internal/testpb/1.proto b/x/tx/internal/testpb/1.proto index 041814598a26..b92920063c00 100644 --- a/x/tx/internal/testpb/1.proto +++ b/x/tx/internal/testpb/1.proto @@ -1,5 +1,6 @@ syntax = "proto3"; +import "cosmos/msg/v1/msg.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; @@ -105,3 +106,9 @@ message Ballot { reserved 3; repeated WeightedBallotOption options = 4; } + +message CustomSignedMessage { + option (cosmos.msg.v1.custom_signer) = true; + string thing1 = 1; + string thing2 = 2; +} \ No newline at end of file diff --git a/x/tx/internal/testpb/1.pulsar.go b/x/tx/internal/testpb/1.pulsar.go index 317f2df4611c..7c19d24540e1 100644 --- a/x/tx/internal/testpb/1.pulsar.go +++ b/x/tx/internal/testpb/1.pulsar.go @@ -3,6 +3,7 @@ package testpb import ( v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/msg/v1" binary "encoding/binary" fmt "fmt" _ "github.com/cosmos/cosmos-proto" @@ -5879,6 +5880,490 @@ func (x *fastReflection_Ballot) ProtoMethods() *protoiface.Methods { } } +var ( + md_CustomSignedMessage protoreflect.MessageDescriptor + fd_CustomSignedMessage_thing1 protoreflect.FieldDescriptor + fd_CustomSignedMessage_thing2 protoreflect.FieldDescriptor +) + +func init() { + file__1_proto_init() + md_CustomSignedMessage = File__1_proto.Messages().ByName("CustomSignedMessage") + fd_CustomSignedMessage_thing1 = md_CustomSignedMessage.Fields().ByName("thing1") + fd_CustomSignedMessage_thing2 = md_CustomSignedMessage.Fields().ByName("thing2") +} + +var _ protoreflect.Message = (*fastReflection_CustomSignedMessage)(nil) + +type fastReflection_CustomSignedMessage CustomSignedMessage + +func (x *CustomSignedMessage) ProtoReflect() protoreflect.Message { + return (*fastReflection_CustomSignedMessage)(x) +} + +func (x *CustomSignedMessage) slowProtoReflect() protoreflect.Message { + mi := &file__1_proto_msgTypes[7] + 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_CustomSignedMessage_messageType fastReflection_CustomSignedMessage_messageType +var _ protoreflect.MessageType = fastReflection_CustomSignedMessage_messageType{} + +type fastReflection_CustomSignedMessage_messageType struct{} + +func (x fastReflection_CustomSignedMessage_messageType) Zero() protoreflect.Message { + return (*fastReflection_CustomSignedMessage)(nil) +} +func (x fastReflection_CustomSignedMessage_messageType) New() protoreflect.Message { + return new(fastReflection_CustomSignedMessage) +} +func (x fastReflection_CustomSignedMessage_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_CustomSignedMessage +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_CustomSignedMessage) Descriptor() protoreflect.MessageDescriptor { + return md_CustomSignedMessage +} + +// 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_CustomSignedMessage) Type() protoreflect.MessageType { + return _fastReflection_CustomSignedMessage_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_CustomSignedMessage) New() protoreflect.Message { + return new(fastReflection_CustomSignedMessage) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_CustomSignedMessage) Interface() protoreflect.ProtoMessage { + return (*CustomSignedMessage)(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_CustomSignedMessage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Thing1 != "" { + value := protoreflect.ValueOfString(x.Thing1) + if !f(fd_CustomSignedMessage_thing1, value) { + return + } + } + if x.Thing2 != "" { + value := protoreflect.ValueOfString(x.Thing2) + if !f(fd_CustomSignedMessage_thing2, 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_CustomSignedMessage) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "CustomSignedMessage.thing1": + return x.Thing1 != "" + case "CustomSignedMessage.thing2": + return x.Thing2 != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) + } + panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "CustomSignedMessage.thing1": + x.Thing1 = "" + case "CustomSignedMessage.thing2": + x.Thing2 = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) + } + panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "CustomSignedMessage.thing1": + value := x.Thing1 + return protoreflect.ValueOfString(value) + case "CustomSignedMessage.thing2": + value := x.Thing2 + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) + } + panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "CustomSignedMessage.thing1": + x.Thing1 = value.Interface().(string) + case "CustomSignedMessage.thing2": + x.Thing2 = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) + } + panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "CustomSignedMessage.thing1": + panic(fmt.Errorf("field thing1 of message CustomSignedMessage is not mutable")) + case "CustomSignedMessage.thing2": + panic(fmt.Errorf("field thing2 of message CustomSignedMessage is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) + } + panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "CustomSignedMessage.thing1": + return protoreflect.ValueOfString("") + case "CustomSignedMessage.thing2": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) + } + panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in CustomSignedMessage", 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_CustomSignedMessage) 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_CustomSignedMessage) 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_CustomSignedMessage) 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_CustomSignedMessage) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*CustomSignedMessage) + 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.Thing1) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Thing2) + 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().(*CustomSignedMessage) + 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.Thing2) > 0 { + i -= len(x.Thing2) + copy(dAtA[i:], x.Thing2) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Thing2))) + i-- + dAtA[i] = 0x12 + } + if len(x.Thing1) > 0 { + i -= len(x.Thing1) + copy(dAtA[i:], x.Thing1) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Thing1))) + 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().(*CustomSignedMessage) + 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: CustomSignedMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CustomSignedMessage: 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 Thing1", 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.Thing1 = 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 Thing2", 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.Thing2 = string(dAtA[iNdEx:postIndex]) + 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 @@ -6594,142 +7079,191 @@ func (x *Ballot) GetOptions() []*WeightedBallotOption { return nil } +type CustomSignedMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Thing1 string `protobuf:"bytes,1,opt,name=thing1,proto3" json:"thing1,omitempty"` + Thing2 string `protobuf:"bytes,2,opt,name=thing2,proto3" json:"thing2,omitempty"` +} + +func (x *CustomSignedMessage) Reset() { + *x = CustomSignedMessage{} + if protoimpl.UnsafeEnabled { + mi := &file__1_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CustomSignedMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CustomSignedMessage) ProtoMessage() {} + +// Deprecated: Use CustomSignedMessage.ProtoReflect.Descriptor instead. +func (*CustomSignedMessage) Descriptor() ([]byte, []int) { + return file__1_proto_rawDescGZIP(), []int{7} +} + +func (x *CustomSignedMessage) GetThing1() string { + if x != nil { + return x.Thing1 + } + return "" +} + +func (x *CustomSignedMessage) GetThing2() string { + if x != nil { + return x.Thing2 + } + return "" +} + var File__1_proto protoreflect.FileDescriptor var file__1_proto_rawDesc = []byte{ - 0x0a, 0x07, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, - 0x6f, 0x69, 0x6e, 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, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x86, 0x06, 0x0a, 0x01, 0x41, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, - 0x33, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, - 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x33, - 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x14, - 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x49, - 0x4e, 0x54, 0x36, 0x34, 0x12, 0x26, 0x0a, 0x06, 0x53, 0x44, 0x4b, 0x49, 0x4e, 0x54, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x53, 0x44, 0x4b, 0x49, 0x4e, 0x54, 0x12, 0x26, 0x0a, 0x06, - 0x53, 0x44, 0x4b, 0x44, 0x45, 0x43, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, - 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x53, 0x44, - 0x4b, 0x44, 0x45, 0x43, 0x12, 0x2d, 0x0a, 0x04, 0x43, 0x4f, 0x49, 0x4e, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x04, 0x43, - 0x4f, 0x49, 0x4e, 0x12, 0x2f, 0x0a, 0x05, 0x43, 0x4f, 0x49, 0x4e, 0x53, 0x18, 0x08, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x43, - 0x4f, 0x49, 0x4e, 0x53, 0x12, 0x14, 0x0a, 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x12, 0x38, 0x0a, 0x09, 0x54, 0x49, - 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, - 0x54, 0x41, 0x4d, 0x50, 0x12, 0x35, 0x0a, 0x08, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x08, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x12, 0x21, 0x0a, 0x04, 0x45, - 0x4e, 0x55, 0x4d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x04, 0x45, 0x4e, 0x55, 0x4d, 0x12, 0x26, - 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x03, 0x41, 0x4e, 0x59, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, - 0x18, 0x65, 0x20, 0x01, 0x28, 0x11, 0x52, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x16, - 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x66, 0x20, 0x01, 0x28, 0x12, 0x52, 0x06, - 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, - 0x33, 0x32, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, - 0x33, 0x32, 0x12, 0x18, 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x18, 0x6a, 0x20, - 0x01, 0x28, 0x07, 0x52, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, 0x14, 0x0a, 0x05, - 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x46, 0x4c, 0x4f, - 0x41, 0x54, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, 0x6c, - 0x20, 0x01, 0x28, 0x10, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, 0x18, - 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x06, 0x52, - 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, 0x16, 0x0a, 0x06, 0x44, 0x4f, 0x55, 0x42, - 0x4c, 0x45, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, - 0x12, 0x1d, 0x0a, 0x03, 0x4d, 0x41, 0x50, 0x18, 0x6f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x41, 0x2e, 0x4d, 0x41, 0x50, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x4d, 0x41, 0x50, 0x1a, - 0x3a, 0x0a, 0x08, 0x4d, 0x41, 0x50, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x41, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbe, 0x01, 0x0a, 0x03, - 0x46, 0x6f, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x05, - 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, - 0x0a, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x46, - 0x6f, 0x6f, 0x52, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x12, 0x1a, 0x0a, 0x05, 0x72, 0x69, 0x67, 0x68, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x05, 0x72, - 0x69, 0x67, 0x68, 0x74, 0x12, 0x16, 0x0a, 0x03, 0x62, 0x61, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x04, 0x2e, 0x42, 0x61, 0x72, 0x52, 0x03, 0x62, 0x61, 0x72, 0x22, 0x60, 0x0a, 0x03, - 0x42, 0x61, 0x72, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x61, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x61, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2e, - 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x94, - 0x01, 0x0a, 0x03, 0x42, 0x61, 0x7a, 0x12, 0x1d, 0x0a, 0x02, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x0a, 0x07, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 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, 0x1a, 0x19, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, + 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x86, 0x06, 0x0a, 0x01, + 0x41, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, + 0x54, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, + 0x34, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x26, 0x0a, + 0x06, 0x53, 0x44, 0x4b, 0x49, 0x4e, 0x54, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x53, + 0x44, 0x4b, 0x49, 0x4e, 0x54, 0x12, 0x26, 0x0a, 0x06, 0x53, 0x44, 0x4b, 0x44, 0x45, 0x43, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x53, 0x44, 0x4b, 0x44, 0x45, 0x43, 0x12, 0x2d, 0x0a, + 0x04, 0x43, 0x4f, 0x49, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x04, 0x43, 0x4f, 0x49, 0x4e, 0x12, 0x2f, 0x0a, 0x05, + 0x43, 0x4f, 0x49, 0x4e, 0x53, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x43, 0x4f, 0x49, 0x4e, 0x53, 0x12, 0x14, 0x0a, + 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x42, 0x59, + 0x54, 0x45, 0x53, 0x12, 0x38, 0x0a, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x12, 0x35, 0x0a, + 0x08, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x44, 0x55, 0x52, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x12, 0x21, 0x0a, 0x04, 0x45, 0x4e, 0x55, 0x4d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, - 0x6d, 0x52, 0x02, 0x65, 0x65, 0x12, 0x22, 0x0a, 0x02, 0x69, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x12, 0x2e, 0x42, 0x61, 0x7a, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x02, 0x69, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x6c, 0x6c, - 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x23, 0x0a, 0x0d, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x6f, 0x75, 0x72, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, - 0x69, 0x76, 0x65, 0x10, 0x01, 0x22, 0xdc, 0x01, 0x0a, 0x03, 0x51, 0x75, 0x78, 0x12, 0x20, 0x0a, - 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, - 0x27, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x76, 0x6f, 0x74, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x52, - 0x04, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, - 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, - 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x56, 0x0a, 0x14, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, - 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x76, 0x0a, 0x06, - 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x2f, 0x0a, - 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x04, - 0x08, 0x03, 0x10, 0x04, 0x2a, 0x39, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, - 0x03, 0x54, 0x77, 0x6f, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, - 0x41, 0x4c, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x7f, 0x2a, - 0x95, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x15, 0x0a, 0x11, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, - 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, - 0x02, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x42, 0x41, 0x4c, 0x4c, 0x4f, - 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, - 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, 0x42, 0x35, 0x42, 0x06, 0x31, 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, + 0x6d, 0x52, 0x04, 0x45, 0x4e, 0x55, 0x4d, 0x12, 0x26, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x03, 0x41, 0x4e, 0x59, 0x12, + 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x65, 0x20, 0x01, 0x28, 0x11, 0x52, + 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x36, + 0x34, 0x18, 0x66, 0x20, 0x01, 0x28, 0x12, 0x52, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, + 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x18, 0x69, 0x20, 0x01, 0x28, + 0x0f, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, 0x18, 0x0a, 0x07, 0x46, + 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x07, 0x52, 0x07, 0x46, 0x49, + 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x18, 0x6b, + 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x12, 0x1a, 0x0a, 0x08, 0x53, + 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, 0x6c, 0x20, 0x01, 0x28, 0x10, 0x52, 0x08, 0x53, + 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, 0x18, 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, + 0x36, 0x34, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x06, 0x52, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, + 0x34, 0x12, 0x16, 0x0a, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x18, 0x6e, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x12, 0x1d, 0x0a, 0x03, 0x4d, 0x41, 0x50, + 0x18, 0x6f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x41, 0x2e, 0x4d, 0x41, 0x50, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x03, 0x4d, 0x41, 0x50, 0x1a, 0x3a, 0x0a, 0x08, 0x4d, 0x41, 0x50, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x41, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbe, 0x01, 0x0a, 0x03, 0x46, 0x6f, 0x6f, 0x12, 0x1b, 0x0a, 0x09, + 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, + 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, + 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x04, 0x6c, 0x65, 0x66, + 0x74, 0x12, 0x1a, 0x0a, 0x05, 0x72, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x05, 0x72, 0x69, 0x67, 0x68, 0x74, 0x12, 0x16, 0x0a, + 0x03, 0x62, 0x61, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x42, 0x61, 0x72, + 0x52, 0x03, 0x62, 0x61, 0x72, 0x22, 0x60, 0x0a, 0x03, 0x42, 0x61, 0x72, 0x12, 0x15, 0x0a, 0x06, + 0x62, 0x61, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x61, + 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x94, 0x01, 0x0a, 0x03, 0x42, 0x61, 0x7a, 0x12, + 0x1d, 0x0a, 0x02, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x45, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x02, 0x65, 0x65, 0x12, 0x22, + 0x0a, 0x02, 0x69, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x42, 0x61, 0x7a, + 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x02, + 0x69, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x23, 0x0a, 0x0d, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x6f, + 0x75, 0x72, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x69, 0x76, 0x65, 0x10, 0x01, 0x22, 0xdc, + 0x01, 0x0a, 0x03, 0x51, 0x75, 0x78, 0x12, 0x20, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x08, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x07, 0x2e, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x2f, + 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, + 0x3c, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x56, 0x0a, + 0x14, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, + 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x77, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x76, 0x0a, 0x06, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x12, + 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, 0x4d, 0x0a, + 0x13, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x31, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x31, 0x12, 0x16, 0x0a, 0x06, + 0x74, 0x68, 0x69, 0x6e, 0x67, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x32, 0x3a, 0x06, 0xa0, 0x96, 0x82, 0xdd, 0x01, 0x01, 0x2a, 0x39, 0x0a, 0x0c, + 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x07, 0x0a, 0x03, + 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x77, 0x6f, 0x10, 0x01, 0x12, 0x17, + 0x0a, 0x13, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, + 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x7f, 0x2a, 0x95, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x6c, 0x6c, + 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x41, 0x4c, 0x4c, + 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x42, 0x41, 0x4c, 0x4c, 0x4f, + 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x19, + 0x0a, 0x15, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, 0x4c, + 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, + 0x1e, 0x0a, 0x1a, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, 0x42, + 0x35, 0x42, 0x06, 0x31, 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 ( @@ -6745,7 +7279,7 @@ func file__1_proto_rawDescGZIP() []byte { } var file__1_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file__1_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file__1_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file__1_proto_goTypes = []interface{}{ (ExternalEnum)(0), // 0: ExternalEnum (BallotOption)(0), // 1: BallotOption @@ -6757,32 +7291,33 @@ var file__1_proto_goTypes = []interface{}{ (*Qux)(nil), // 7: Qux (*WeightedBallotOption)(nil), // 8: WeightedBallotOption (*Ballot)(nil), // 9: Ballot - nil, // 10: A.MAPEntry - (*v1beta1.Coin)(nil), // 11: cosmos.base.v1beta1.Coin - (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 13: google.protobuf.Duration - (*anypb.Any)(nil), // 14: google.protobuf.Any + (*CustomSignedMessage)(nil), // 10: CustomSignedMessage + nil, // 11: A.MAPEntry + (*v1beta1.Coin)(nil), // 12: cosmos.base.v1beta1.Coin + (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 14: google.protobuf.Duration + (*anypb.Any)(nil), // 15: google.protobuf.Any } var file__1_proto_depIdxs = []int32{ - 11, // 0: A.COIN:type_name -> cosmos.base.v1beta1.Coin - 11, // 1: A.COINS:type_name -> cosmos.base.v1beta1.Coin - 12, // 2: A.TIMESTAMP:type_name -> google.protobuf.Timestamp - 13, // 3: A.DURATION:type_name -> google.protobuf.Duration + 12, // 0: A.COIN:type_name -> cosmos.base.v1beta1.Coin + 12, // 1: A.COINS:type_name -> cosmos.base.v1beta1.Coin + 13, // 2: A.TIMESTAMP:type_name -> google.protobuf.Timestamp + 14, // 3: A.DURATION:type_name -> google.protobuf.Duration 0, // 4: A.ENUM:type_name -> ExternalEnum - 14, // 5: A.ANY:type_name -> google.protobuf.Any - 10, // 6: A.MAP:type_name -> A.MAPEntry - 12, // 7: Foo.mtime:type_name -> google.protobuf.Timestamp + 15, // 5: A.ANY:type_name -> google.protobuf.Any + 11, // 6: A.MAP:type_name -> A.MAPEntry + 13, // 7: Foo.mtime:type_name -> google.protobuf.Timestamp 4, // 8: Foo.left:type_name -> Foo 4, // 9: Foo.right:type_name -> Foo 5, // 10: Foo.bar:type_name -> Bar - 14, // 11: Bar.payload:type_name -> google.protobuf.Any + 15, // 11: Bar.payload:type_name -> google.protobuf.Any 0, // 12: Baz.ee:type_name -> ExternalEnum 2, // 13: Baz.ie:type_name -> Baz.Internal_Enum 1, // 14: Baz.option:type_name -> BallotOption 4, // 15: Qux.messages:type_name -> Foo 9, // 16: Qux.vote:type_name -> Ballot - 11, // 17: Qux.price:type_name -> cosmos.base.v1beta1.Coin - 12, // 18: Qux.expirations:type_name -> google.protobuf.Timestamp + 12, // 17: Qux.price:type_name -> cosmos.base.v1beta1.Coin + 13, // 18: Qux.expirations:type_name -> google.protobuf.Timestamp 8, // 19: Ballot.options:type_name -> WeightedBallotOption 3, // 20: A.MAPEntry.value:type_name -> A 21, // [21:21] is the sub-list for method output_type @@ -6882,6 +7417,18 @@ func file__1_proto_init() { return nil } } + file__1_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CustomSignedMessage); 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{ @@ -6889,7 +7436,7 @@ func file__1_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file__1_proto_rawDesc, NumEnums: 3, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/x/tx/signing/context_test.go b/x/tx/signing/context_test.go index a5979e300d73..d718a1396d29 100644 --- a/x/tx/signing/context_test.go +++ b/x/tx/signing/context_test.go @@ -145,6 +145,28 @@ func TestGetSigners(t *testing.T) { } } +func TestDefineCustomGetSigners(t *testing.T) { + customMsg := &testpb.CustomSignedMessage{} + signers := [][]byte{[]byte("foo")} + + context, err := NewContext(Options{ + AddressCodec: dummyAddressCodec{}, + ValidatorAddressCodec: dummyValidatorAddressCodec{}, + }) + require.NoError(t, err) + + _, err = context.GetSigners(customMsg) + // before calling DefineCustomGetSigners, we should get an error + require.ErrorContains(t, err, "need custom signers function") + DefineCustomGetSigners(context, func(msg *testpb.CustomSignedMessage) ([][]byte, error) { + return signers, nil + }) + // after calling DefineCustomGetSigners, we should get the signers + gotSigners, err := context.GetSigners(customMsg) + require.NoError(t, err) + require.Equal(t, signers, gotSigners) +} + type dummyAddressCodec struct{} func (d dummyAddressCodec) StringToBytes(text string) ([]byte, error) { From ccdb3c004404d002a9fff6f1fc2ec1463f6819ef Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 31 May 2023 08:40:47 -0500 Subject: [PATCH 06/26] remove replace --- x/tx/go.mod | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/x/tx/go.mod b/x/tx/go.mod index 6639c4df6563..9b33868e4688 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -30,7 +30,4 @@ require ( google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/grpc v1.55.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect -) - -// temporary replace -replace cosmossdk.io/api => ../../api \ No newline at end of file +) \ No newline at end of file From bbfe4aa1292b28c43419d0289552ec92bba27242 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 31 May 2023 08:46:41 -0500 Subject: [PATCH 07/26] still need replace for new annotation --- go.mod | 1 + go.sum | 2 -- x/tx/go.mod | 4 +++- x/tx/go.sum | 4 ---- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 7cd090fad70c..ec13d76b9b5d 100644 --- a/go.mod +++ b/go.mod @@ -159,6 +159,7 @@ require ( // Below are the short-lived replace of the Cosmos SDK replace ( + cosmossdk.io/api => ./api // TODO: remove me after collections 0.2. is released. cosmossdk.io/collections => ./collections cosmossdk.io/core => ./core diff --git a/go.sum b/go.sum index 4434147b264f..63bcc68d03b3 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.4.2 h1:lQBMl4xINnMnBOR/tQLtjlDnR4exr4e6/SfHR8PILE0= -cosmossdk.io/api v0.4.2/go.mod h1:qrVgOp7DIeAXa+Tt5dDjOC47bZCDrwx8ZHxrmy7STNE= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7.0.20230524212735-6cabb6aa5741 h1:BCRz06fvddw7cKGiEGDiSox3qMsjQ97f92K+PDZDHdc= diff --git a/x/tx/go.mod b/x/tx/go.mod index 9b33868e4688..202ae1d49ac0 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -30,4 +30,6 @@ require ( google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/grpc v1.55.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect -) \ No newline at end of file +) + +replace cosmossdk.io/api => ../../api diff --git a/x/tx/go.sum b/x/tx/go.sum index 57af097e6727..5ebb2471ec66 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -1,7 +1,3 @@ -cosmossdk.io/api v0.4.1 h1:0ikaYM6GyxTYYcfBiyR8YnLCfhNnhKpEFnaSepCTmqg= -cosmossdk.io/api v0.4.1/go.mod h1:jR7k5ok90LxW2lFUXvd8Vpo/dr4PpiyVegxdm7b1ZdE= -cosmossdk.io/api v0.4.2 h1:lQBMl4xINnMnBOR/tQLtjlDnR4exr4e6/SfHR8PILE0= -cosmossdk.io/api v0.4.2/go.mod h1:qrVgOp7DIeAXa+Tt5dDjOC47bZCDrwx8ZHxrmy7STNE= cosmossdk.io/core v0.7.0 h1:GFss3qt2P9p23Cz24NnqLkslzb8n+B75A24x1JgJJp0= cosmossdk.io/core v0.7.0/go.mod h1:36hP0ZH/8ipsjzfcp0yKU4bqQXUGhS0/m1krWFCtwCc= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= From d8022de77a9dccfb52299ceebb7b78953684fd87 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 31 May 2023 15:49:48 -0500 Subject: [PATCH 08/26] no custom signers annotation --- api/cosmos/msg/v1/msg.pulsar.go | 53 +-- go.mod | 1 - proto/cosmos/msg/v1/msg.proto | 6 - types/msgservice/msg.pb.go | 25 +- x/tx/go.mod | 2 - x/tx/internal/testpb/1.proto | 6 - x/tx/internal/testpb/1.pulsar.go | 615 ++----------------------------- x/tx/signing/context.go | 7 +- x/tx/signing/context_test.go | 6 +- 9 files changed, 62 insertions(+), 659 deletions(-) diff --git a/api/cosmos/msg/v1/msg.pulsar.go b/api/cosmos/msg/v1/msg.pulsar.go index 7f0944ddb473..7bf986dd12c5 100644 --- a/api/cosmos/msg/v1/msg.pulsar.go +++ b/api/cosmos/msg/v1/msg.pulsar.go @@ -38,14 +38,6 @@ var file_cosmos_msg_v1_msg_proto_extTypes = []protoimpl.ExtensionInfo{ Tag: "bytes,11110000,rep,name=signer", Filename: "cosmos/msg/v1/msg.proto", }, - { - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 57938276, - Name: "cosmos.msg.v1.custom_signer", - Tag: "varint,57938276,opt,name=custom_signer", - Filename: "cosmos/msg/v1/msg.proto", - }, } // Extension fields to descriptorpb.ServiceOptions. @@ -73,13 +65,6 @@ var ( // // repeated string signer = 11110000; E_Signer = &file_cosmos_msg_v1_msg_proto_extTypes[1] - // custom_signer indicates that a message does not define signers in the - // standard way using the signer option but instead defines its own custom - // way of defining signers. Frameworks and clients will need to provide - // custom logic to handle these messages. - // - // optional bool custom_signer = 57938276; - E_CustomSigner = &file_cosmos_msg_v1_msg_proto_extTypes[2] ) var File_cosmos_msg_v1_msg_proto protoreflect.FileDescriptor @@ -97,22 +82,17 @@ var file_cosmos_msg_v1_msg_proto_rawDesc = []byte{ 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xf0, 0x8c, 0xa6, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x69, - 0x67, 0x6e, 0x65, 0x72, 0x3a, 0x47, 0x0a, 0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x73, - 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0xe4, 0xa2, 0xd0, 0x1b, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0c, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x42, 0x99, 0x01, - 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x76, 0x31, 0x42, 0x08, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x3b, - 0x6d, 0x73, 0x67, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4d, 0x73, 0x67, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4d, 0x73, 0x67, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x3a, 0x3a, 0x4d, 0x73, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x67, 0x6e, 0x65, 0x72, 0x42, 0x99, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x76, 0x31, 0x42, 0x08, 0x4d, 0x73, 0x67, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x73, 0x67, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, + 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x2e, + 0x56, 0x31, 0xca, 0x02, 0x0d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4d, 0x73, 0x67, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4d, 0x73, 0x67, 0x5c, + 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x0f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x4d, 0x73, 0x67, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_cosmos_msg_v1_msg_proto_goTypes = []interface{}{ @@ -122,11 +102,10 @@ var file_cosmos_msg_v1_msg_proto_goTypes = []interface{}{ var file_cosmos_msg_v1_msg_proto_depIdxs = []int32{ 0, // 0: cosmos.msg.v1.service:extendee -> google.protobuf.ServiceOptions 1, // 1: cosmos.msg.v1.signer:extendee -> google.protobuf.MessageOptions - 1, // 2: cosmos.msg.v1.custom_signer:extendee -> google.protobuf.MessageOptions - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 0, // [0:3] is the sub-list for extension extendee + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 0, // [0:2] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } @@ -142,7 +121,7 @@ func file_cosmos_msg_v1_msg_proto_init() { RawDescriptor: file_cosmos_msg_v1_msg_proto_rawDesc, NumEnums: 0, NumMessages: 0, - NumExtensions: 3, + NumExtensions: 2, NumServices: 0, }, GoTypes: file_cosmos_msg_v1_msg_proto_goTypes, diff --git a/go.mod b/go.mod index ec13d76b9b5d..7cd090fad70c 100644 --- a/go.mod +++ b/go.mod @@ -159,7 +159,6 @@ require ( // Below are the short-lived replace of the Cosmos SDK replace ( - cosmossdk.io/api => ./api // TODO: remove me after collections 0.2. is released. cosmossdk.io/collections => ./collections cosmossdk.io/core => ./core diff --git a/proto/cosmos/msg/v1/msg.proto b/proto/cosmos/msg/v1/msg.proto index 62305459c3a7..853efa1f7c0f 100644 --- a/proto/cosmos/msg/v1/msg.proto +++ b/proto/cosmos/msg/v1/msg.proto @@ -27,10 +27,4 @@ extend google.protobuf.MessageOptions { // kind in case the signer information is contained within // a message inside the cosmos message. repeated string signer = 11110000; - - // custom_signer indicates that a message does not define signers in the - // standard way using the signer option but instead defines its own custom - // way of defining signers. Frameworks and clients will need to provide - // custom logic to handle these messages. - bool custom_signer = 57938276; } diff --git a/types/msgservice/msg.pb.go b/types/msgservice/msg.pb.go index 0c3afbbdefae..8b75fd6ea57a 100644 --- a/types/msgservice/msg.pb.go +++ b/types/msgservice/msg.pb.go @@ -39,25 +39,15 @@ var E_Signer = &proto.ExtensionDesc{ Filename: "cosmos/msg/v1/msg.proto", } -var E_CustomSigner = &proto.ExtensionDesc{ - ExtendedType: (*descriptorpb.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 57938276, - Name: "cosmos.msg.v1.custom_signer", - Tag: "varint,57938276,opt,name=custom_signer", - Filename: "cosmos/msg/v1/msg.proto", -} - func init() { proto.RegisterExtension(E_Service) proto.RegisterExtension(E_Signer) - proto.RegisterExtension(E_CustomSigner) } func init() { proto.RegisterFile("cosmos/msg/v1/msg.proto", fileDescriptor_5c08b83ea858d203) } var fileDescriptor_5c08b83ea858d203 = []byte{ - // 240 bytes of a gzipped FileDescriptorProto + // 214 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0xcf, 0x2d, 0x4e, 0xd7, 0x2f, 0x33, 0x04, 0x51, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xbc, 0x10, 0x09, 0x3d, 0x90, 0x48, 0x99, 0xa1, 0x94, 0x42, 0x7a, 0x7e, 0x7e, 0x7a, @@ -66,11 +56,10 @@ var fileDescriptor_5c08b83ea858d203 = []byte{ 0x48, 0x5e, 0x0f, 0xa2, 0x5a, 0x0f, 0xa6, 0x5a, 0x2f, 0x18, 0x22, 0xe3, 0x5f, 0x50, 0x92, 0x99, 0x9f, 0x57, 0x2c, 0xf1, 0xa1, 0x67, 0x19, 0xab, 0x02, 0xa3, 0x06, 0x47, 0x10, 0x4c, 0x8b, 0x95, 0x15, 0x17, 0x5b, 0x71, 0x66, 0x7a, 0x5e, 0x6a, 0x11, 0x16, 0xcd, 0xbe, 0xa9, 0xc5, 0xc5, 0x89, - 0xe9, 0xa8, 0x9a, 0x99, 0x35, 0x38, 0x83, 0xa0, 0x3a, 0xac, 0xdc, 0xb9, 0x78, 0x93, 0x4b, 0x8b, - 0x4b, 0xf2, 0x73, 0xe3, 0x89, 0x35, 0xe2, 0xc9, 0xa2, 0x0b, 0xd2, 0x60, 0xfb, 0x79, 0x20, 0x1a, - 0x83, 0xc1, 0xfa, 0x9c, 0xdc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, - 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, - 0x37, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x1a, 0x62, 0x10, 0x4a, - 0xb7, 0x38, 0x25, 0x5b, 0xbf, 0xa4, 0xb2, 0x20, 0x15, 0x1c, 0x84, 0x50, 0xdf, 0x24, 0xb1, 0x81, - 0x2d, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc3, 0xc9, 0x90, 0x6b, 0x5e, 0x01, 0x00, 0x00, + 0xe9, 0xa8, 0x9a, 0x99, 0x35, 0x38, 0x83, 0xa0, 0x3a, 0x9c, 0xdc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, + 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, + 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x37, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, + 0x57, 0x1f, 0xea, 0x51, 0x08, 0xa5, 0x5b, 0x9c, 0x92, 0xad, 0x5f, 0x52, 0x59, 0x90, 0x0a, 0xf6, + 0x39, 0xd4, 0x11, 0x49, 0x6c, 0x60, 0x2b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcc, 0xa2, + 0x03, 0xdb, 0x15, 0x01, 0x00, 0x00, } diff --git a/x/tx/go.mod b/x/tx/go.mod index 202ae1d49ac0..026286b14cc2 100644 --- a/x/tx/go.mod +++ b/x/tx/go.mod @@ -31,5 +31,3 @@ require ( google.golang.org/grpc v1.55.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace cosmossdk.io/api => ../../api diff --git a/x/tx/internal/testpb/1.proto b/x/tx/internal/testpb/1.proto index b92920063c00..070b8e71a1a2 100644 --- a/x/tx/internal/testpb/1.proto +++ b/x/tx/internal/testpb/1.proto @@ -105,10 +105,4 @@ message Ballot { string voter = 2; reserved 3; repeated WeightedBallotOption options = 4; -} - -message CustomSignedMessage { - option (cosmos.msg.v1.custom_signer) = true; - string thing1 = 1; - string thing2 = 2; } \ No newline at end of file diff --git a/x/tx/internal/testpb/1.pulsar.go b/x/tx/internal/testpb/1.pulsar.go index 7c19d24540e1..e9a6e179f610 100644 --- a/x/tx/internal/testpb/1.pulsar.go +++ b/x/tx/internal/testpb/1.pulsar.go @@ -5880,490 +5880,6 @@ func (x *fastReflection_Ballot) ProtoMethods() *protoiface.Methods { } } -var ( - md_CustomSignedMessage protoreflect.MessageDescriptor - fd_CustomSignedMessage_thing1 protoreflect.FieldDescriptor - fd_CustomSignedMessage_thing2 protoreflect.FieldDescriptor -) - -func init() { - file__1_proto_init() - md_CustomSignedMessage = File__1_proto.Messages().ByName("CustomSignedMessage") - fd_CustomSignedMessage_thing1 = md_CustomSignedMessage.Fields().ByName("thing1") - fd_CustomSignedMessage_thing2 = md_CustomSignedMessage.Fields().ByName("thing2") -} - -var _ protoreflect.Message = (*fastReflection_CustomSignedMessage)(nil) - -type fastReflection_CustomSignedMessage CustomSignedMessage - -func (x *CustomSignedMessage) ProtoReflect() protoreflect.Message { - return (*fastReflection_CustomSignedMessage)(x) -} - -func (x *CustomSignedMessage) slowProtoReflect() protoreflect.Message { - mi := &file__1_proto_msgTypes[7] - 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_CustomSignedMessage_messageType fastReflection_CustomSignedMessage_messageType -var _ protoreflect.MessageType = fastReflection_CustomSignedMessage_messageType{} - -type fastReflection_CustomSignedMessage_messageType struct{} - -func (x fastReflection_CustomSignedMessage_messageType) Zero() protoreflect.Message { - return (*fastReflection_CustomSignedMessage)(nil) -} -func (x fastReflection_CustomSignedMessage_messageType) New() protoreflect.Message { - return new(fastReflection_CustomSignedMessage) -} -func (x fastReflection_CustomSignedMessage_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_CustomSignedMessage -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_CustomSignedMessage) Descriptor() protoreflect.MessageDescriptor { - return md_CustomSignedMessage -} - -// 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_CustomSignedMessage) Type() protoreflect.MessageType { - return _fastReflection_CustomSignedMessage_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_CustomSignedMessage) New() protoreflect.Message { - return new(fastReflection_CustomSignedMessage) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_CustomSignedMessage) Interface() protoreflect.ProtoMessage { - return (*CustomSignedMessage)(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_CustomSignedMessage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Thing1 != "" { - value := protoreflect.ValueOfString(x.Thing1) - if !f(fd_CustomSignedMessage_thing1, value) { - return - } - } - if x.Thing2 != "" { - value := protoreflect.ValueOfString(x.Thing2) - if !f(fd_CustomSignedMessage_thing2, 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_CustomSignedMessage) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "CustomSignedMessage.thing1": - return x.Thing1 != "" - case "CustomSignedMessage.thing2": - return x.Thing2 != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) - } - panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "CustomSignedMessage.thing1": - x.Thing1 = "" - case "CustomSignedMessage.thing2": - x.Thing2 = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) - } - panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "CustomSignedMessage.thing1": - value := x.Thing1 - return protoreflect.ValueOfString(value) - case "CustomSignedMessage.thing2": - value := x.Thing2 - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) - } - panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "CustomSignedMessage.thing1": - x.Thing1 = value.Interface().(string) - case "CustomSignedMessage.thing2": - x.Thing2 = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) - } - panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "CustomSignedMessage.thing1": - panic(fmt.Errorf("field thing1 of message CustomSignedMessage is not mutable")) - case "CustomSignedMessage.thing2": - panic(fmt.Errorf("field thing2 of message CustomSignedMessage is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) - } - panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "CustomSignedMessage.thing1": - return protoreflect.ValueOfString("") - case "CustomSignedMessage.thing2": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: CustomSignedMessage")) - } - panic(fmt.Errorf("message CustomSignedMessage 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_CustomSignedMessage) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in CustomSignedMessage", 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_CustomSignedMessage) 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_CustomSignedMessage) 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_CustomSignedMessage) 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_CustomSignedMessage) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*CustomSignedMessage) - 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.Thing1) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Thing2) - 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().(*CustomSignedMessage) - 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.Thing2) > 0 { - i -= len(x.Thing2) - copy(dAtA[i:], x.Thing2) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Thing2))) - i-- - dAtA[i] = 0x12 - } - if len(x.Thing1) > 0 { - i -= len(x.Thing1) - copy(dAtA[i:], x.Thing1) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Thing1))) - 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().(*CustomSignedMessage) - 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: CustomSignedMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CustomSignedMessage: 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 Thing1", 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.Thing1 = 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 Thing2", 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.Thing2 = string(dAtA[iNdEx:postIndex]) - 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 @@ -7079,49 +6595,6 @@ func (x *Ballot) GetOptions() []*WeightedBallotOption { return nil } -type CustomSignedMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Thing1 string `protobuf:"bytes,1,opt,name=thing1,proto3" json:"thing1,omitempty"` - Thing2 string `protobuf:"bytes,2,opt,name=thing2,proto3" json:"thing2,omitempty"` -} - -func (x *CustomSignedMessage) Reset() { - *x = CustomSignedMessage{} - if protoimpl.UnsafeEnabled { - mi := &file__1_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CustomSignedMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CustomSignedMessage) ProtoMessage() {} - -// Deprecated: Use CustomSignedMessage.ProtoReflect.Descriptor instead. -func (*CustomSignedMessage) Descriptor() ([]byte, []int) { - return file__1_proto_rawDescGZIP(), []int{7} -} - -func (x *CustomSignedMessage) GetThing1() string { - if x != nil { - return x.Thing1 - } - return "" -} - -func (x *CustomSignedMessage) GetThing2() string { - if x != nil { - return x.Thing2 - } - return "" -} - var File__1_proto protoreflect.FileDescriptor var file__1_proto_rawDesc = []byte{ @@ -7241,29 +6714,24 @@ var file__1_proto_rawDesc = []byte{ 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, 0x4d, 0x0a, - 0x13, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x31, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x31, 0x12, 0x16, 0x0a, 0x06, - 0x74, 0x68, 0x69, 0x6e, 0x67, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x68, - 0x69, 0x6e, 0x67, 0x32, 0x3a, 0x06, 0xa0, 0x96, 0x82, 0xdd, 0x01, 0x01, 0x2a, 0x39, 0x0a, 0x0c, - 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x07, 0x0a, 0x03, - 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x77, 0x6f, 0x10, 0x01, 0x12, 0x17, - 0x0a, 0x13, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, - 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x7f, 0x2a, 0x95, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x6c, 0x6c, - 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x41, 0x4c, 0x4c, - 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x42, 0x41, 0x4c, 0x4c, 0x4f, - 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x19, - 0x0a, 0x15, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, 0x4c, - 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, - 0x1e, 0x0a, 0x1a, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, 0x42, - 0x35, 0x42, 0x06, 0x31, 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, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x2a, 0x39, 0x0a, + 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x07, 0x0a, + 0x03, 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x77, 0x6f, 0x10, 0x01, 0x12, + 0x17, 0x0a, 0x13, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x4e, 0x55, 0x4d, + 0x5f, 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x7f, 0x2a, 0x95, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x6c, + 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x41, 0x4c, + 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, + 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x42, 0x41, 0x4c, 0x4c, + 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, + 0x19, 0x0a, 0x15, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, + 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, + 0x12, 0x1e, 0x0a, 0x1a, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, + 0x42, 0x35, 0x42, 0x06, 0x31, 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 ( @@ -7279,7 +6747,7 @@ func file__1_proto_rawDescGZIP() []byte { } var file__1_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file__1_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file__1_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file__1_proto_goTypes = []interface{}{ (ExternalEnum)(0), // 0: ExternalEnum (BallotOption)(0), // 1: BallotOption @@ -7291,33 +6759,32 @@ var file__1_proto_goTypes = []interface{}{ (*Qux)(nil), // 7: Qux (*WeightedBallotOption)(nil), // 8: WeightedBallotOption (*Ballot)(nil), // 9: Ballot - (*CustomSignedMessage)(nil), // 10: CustomSignedMessage - nil, // 11: A.MAPEntry - (*v1beta1.Coin)(nil), // 12: cosmos.base.v1beta1.Coin - (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 14: google.protobuf.Duration - (*anypb.Any)(nil), // 15: google.protobuf.Any + nil, // 10: A.MAPEntry + (*v1beta1.Coin)(nil), // 11: cosmos.base.v1beta1.Coin + (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 13: google.protobuf.Duration + (*anypb.Any)(nil), // 14: google.protobuf.Any } var file__1_proto_depIdxs = []int32{ - 12, // 0: A.COIN:type_name -> cosmos.base.v1beta1.Coin - 12, // 1: A.COINS:type_name -> cosmos.base.v1beta1.Coin - 13, // 2: A.TIMESTAMP:type_name -> google.protobuf.Timestamp - 14, // 3: A.DURATION:type_name -> google.protobuf.Duration + 11, // 0: A.COIN:type_name -> cosmos.base.v1beta1.Coin + 11, // 1: A.COINS:type_name -> cosmos.base.v1beta1.Coin + 12, // 2: A.TIMESTAMP:type_name -> google.protobuf.Timestamp + 13, // 3: A.DURATION:type_name -> google.protobuf.Duration 0, // 4: A.ENUM:type_name -> ExternalEnum - 15, // 5: A.ANY:type_name -> google.protobuf.Any - 11, // 6: A.MAP:type_name -> A.MAPEntry - 13, // 7: Foo.mtime:type_name -> google.protobuf.Timestamp + 14, // 5: A.ANY:type_name -> google.protobuf.Any + 10, // 6: A.MAP:type_name -> A.MAPEntry + 12, // 7: Foo.mtime:type_name -> google.protobuf.Timestamp 4, // 8: Foo.left:type_name -> Foo 4, // 9: Foo.right:type_name -> Foo 5, // 10: Foo.bar:type_name -> Bar - 15, // 11: Bar.payload:type_name -> google.protobuf.Any + 14, // 11: Bar.payload:type_name -> google.protobuf.Any 0, // 12: Baz.ee:type_name -> ExternalEnum 2, // 13: Baz.ie:type_name -> Baz.Internal_Enum 1, // 14: Baz.option:type_name -> BallotOption 4, // 15: Qux.messages:type_name -> Foo 9, // 16: Qux.vote:type_name -> Ballot - 12, // 17: Qux.price:type_name -> cosmos.base.v1beta1.Coin - 13, // 18: Qux.expirations:type_name -> google.protobuf.Timestamp + 11, // 17: Qux.price:type_name -> cosmos.base.v1beta1.Coin + 12, // 18: Qux.expirations:type_name -> google.protobuf.Timestamp 8, // 19: Ballot.options:type_name -> WeightedBallotOption 3, // 20: A.MAPEntry.value:type_name -> A 21, // [21:21] is the sub-list for method output_type @@ -7417,18 +6884,6 @@ func file__1_proto_init() { return nil } } - file__1_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CustomSignedMessage); 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{ @@ -7436,7 +6891,7 @@ func file__1_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file__1_proto_rawDesc, NumEnums: 3, - NumMessages: 9, + NumMessages: 8, NumExtensions: 0, NumServices: 0, }, diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 56c7e863a682..8aeb98c9bf49 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -86,7 +86,7 @@ type getSignersFunc func(proto.Message) ([][]byte, error) 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 @@ -124,11 +124,6 @@ func (c *Context) Validate() error { } func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor) (getSignersFunc, error) { - isCustom := proto.GetExtension(descriptor.Options(), msgv1.E_CustomSigner).(bool) - if isCustom { - return nil, fmt.Errorf("%w: %s", NeedCustomSignersError, descriptor.FullName()) - } - signersFields, err := getSignersFieldNames(descriptor) if err != nil { return nil, err diff --git a/x/tx/signing/context_test.go b/x/tx/signing/context_test.go index d718a1396d29..74a35302118f 100644 --- a/x/tx/signing/context_test.go +++ b/x/tx/signing/context_test.go @@ -146,7 +146,7 @@ func TestGetSigners(t *testing.T) { } func TestDefineCustomGetSigners(t *testing.T) { - customMsg := &testpb.CustomSignedMessage{} + customMsg := &testpb.Ballot{} signers := [][]byte{[]byte("foo")} context, err := NewContext(Options{ @@ -157,8 +157,8 @@ func TestDefineCustomGetSigners(t *testing.T) { _, err = context.GetSigners(customMsg) // before calling DefineCustomGetSigners, we should get an error - require.ErrorContains(t, err, "need custom signers function") - DefineCustomGetSigners(context, func(msg *testpb.CustomSignedMessage) ([][]byte, error) { + require.ErrorContains(t, err, "use DefineCustomGetSigners to specify") + DefineCustomGetSigners(context, func(msg *testpb.Ballot) ([][]byte, error) { return signers, nil }) // after calling DefineCustomGetSigners, we should get the signers From a1db0df0e6f491cf0e9073c15426837836a69360 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 31 May 2023 15:54:50 -0500 Subject: [PATCH 09/26] go mod tidy --- go.sum | 2 ++ x/tx/go.sum | 2 ++ 2 files changed, 4 insertions(+) diff --git a/go.sum b/go.sum index 63bcc68d03b3..4434147b264f 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +cosmossdk.io/api v0.4.2 h1:lQBMl4xINnMnBOR/tQLtjlDnR4exr4e6/SfHR8PILE0= +cosmossdk.io/api v0.4.2/go.mod h1:qrVgOp7DIeAXa+Tt5dDjOC47bZCDrwx8ZHxrmy7STNE= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7.0.20230524212735-6cabb6aa5741 h1:BCRz06fvddw7cKGiEGDiSox3qMsjQ97f92K+PDZDHdc= diff --git a/x/tx/go.sum b/x/tx/go.sum index 5ebb2471ec66..45c34366f6a9 100644 --- a/x/tx/go.sum +++ b/x/tx/go.sum @@ -1,3 +1,5 @@ +cosmossdk.io/api v0.4.2 h1:lQBMl4xINnMnBOR/tQLtjlDnR4exr4e6/SfHR8PILE0= +cosmossdk.io/api v0.4.2/go.mod h1:qrVgOp7DIeAXa+Tt5dDjOC47bZCDrwx8ZHxrmy7STNE= cosmossdk.io/core v0.7.0 h1:GFss3qt2P9p23Cz24NnqLkslzb8n+B75A24x1JgJJp0= cosmossdk.io/core v0.7.0/go.mod h1:36hP0ZH/8ipsjzfcp0yKU4bqQXUGhS0/m1krWFCtwCc= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= From 3cac4459e65d78ec654249ba85f927886ff7f7e5 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 31 May 2023 15:56:05 -0500 Subject: [PATCH 10/26] rm unused import --- x/tx/internal/testpb/1.proto | 1 - x/tx/internal/testpb/1.pulsar.go | 266 +++++++++++++++---------------- 2 files changed, 132 insertions(+), 135 deletions(-) diff --git a/x/tx/internal/testpb/1.proto b/x/tx/internal/testpb/1.proto index 070b8e71a1a2..aede0ed4f200 100644 --- a/x/tx/internal/testpb/1.proto +++ b/x/tx/internal/testpb/1.proto @@ -1,6 +1,5 @@ syntax = "proto3"; -import "cosmos/msg/v1/msg.proto"; import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; diff --git a/x/tx/internal/testpb/1.pulsar.go b/x/tx/internal/testpb/1.pulsar.go index e9a6e179f610..317f2df4611c 100644 --- a/x/tx/internal/testpb/1.pulsar.go +++ b/x/tx/internal/testpb/1.pulsar.go @@ -3,7 +3,6 @@ package testpb import ( v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" - _ "cosmossdk.io/api/cosmos/msg/v1" binary "encoding/binary" fmt "fmt" _ "github.com/cosmos/cosmos-proto" @@ -6598,140 +6597,139 @@ func (x *Ballot) GetOptions() []*WeightedBallotOption { var File__1_proto protoreflect.FileDescriptor var file__1_proto_rawDesc = []byte{ - 0x0a, 0x07, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 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, 0x1a, 0x19, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, - 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x86, 0x06, 0x0a, 0x01, - 0x41, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, - 0x54, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, - 0x34, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x26, 0x0a, - 0x06, 0x53, 0x44, 0x4b, 0x49, 0x4e, 0x54, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, - 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x53, - 0x44, 0x4b, 0x49, 0x4e, 0x54, 0x12, 0x26, 0x0a, 0x06, 0x53, 0x44, 0x4b, 0x44, 0x45, 0x43, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x53, 0x44, 0x4b, 0x44, 0x45, 0x43, 0x12, 0x2d, 0x0a, - 0x04, 0x43, 0x4f, 0x49, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x04, 0x43, 0x4f, 0x49, 0x4e, 0x12, 0x2f, 0x0a, 0x05, - 0x43, 0x4f, 0x49, 0x4e, 0x53, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x43, 0x4f, 0x49, 0x4e, 0x53, 0x12, 0x14, 0x0a, - 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x42, 0x59, - 0x54, 0x45, 0x53, 0x12, 0x38, 0x0a, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x12, 0x35, 0x0a, - 0x08, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x44, 0x55, 0x52, 0x41, - 0x54, 0x49, 0x4f, 0x4e, 0x12, 0x21, 0x0a, 0x04, 0x45, 0x4e, 0x55, 0x4d, 0x18, 0x0c, 0x20, 0x01, + 0x0a, 0x07, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, + 0x6f, 0x69, 0x6e, 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, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x86, 0x06, 0x0a, 0x01, 0x41, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, + 0x33, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, + 0x12, 0x16, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x33, + 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x14, + 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x49, + 0x4e, 0x54, 0x36, 0x34, 0x12, 0x26, 0x0a, 0x06, 0x53, 0x44, 0x4b, 0x49, 0x4e, 0x54, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x53, 0x44, 0x4b, 0x49, 0x4e, 0x54, 0x12, 0x26, 0x0a, 0x06, + 0x53, 0x44, 0x4b, 0x44, 0x45, 0x43, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x53, 0x44, + 0x4b, 0x44, 0x45, 0x43, 0x12, 0x2d, 0x0a, 0x04, 0x43, 0x4f, 0x49, 0x4e, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x04, 0x43, + 0x4f, 0x49, 0x4e, 0x12, 0x2f, 0x0a, 0x05, 0x43, 0x4f, 0x49, 0x4e, 0x53, 0x18, 0x08, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x43, + 0x4f, 0x49, 0x4e, 0x53, 0x12, 0x14, 0x0a, 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x42, 0x59, 0x54, 0x45, 0x53, 0x12, 0x38, 0x0a, 0x09, 0x54, 0x49, + 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, + 0x54, 0x41, 0x4d, 0x50, 0x12, 0x35, 0x0a, 0x08, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x08, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x12, 0x21, 0x0a, 0x04, 0x45, + 0x4e, 0x55, 0x4d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x45, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x04, 0x45, 0x4e, 0x55, 0x4d, 0x12, 0x26, + 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, + 0x79, 0x52, 0x03, 0x41, 0x4e, 0x59, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, + 0x18, 0x65, 0x20, 0x01, 0x28, 0x11, 0x52, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x16, + 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x18, 0x66, 0x20, 0x01, 0x28, 0x12, 0x52, 0x06, + 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, + 0x33, 0x32, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0f, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, + 0x33, 0x32, 0x12, 0x18, 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x18, 0x6a, 0x20, + 0x01, 0x28, 0x07, 0x52, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, 0x14, 0x0a, 0x05, + 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x18, 0x6b, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x46, 0x4c, 0x4f, + 0x41, 0x54, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, 0x6c, + 0x20, 0x01, 0x28, 0x10, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, 0x18, + 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x06, 0x52, + 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, 0x16, 0x0a, 0x06, 0x44, 0x4f, 0x55, 0x42, + 0x4c, 0x45, 0x18, 0x6e, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, + 0x12, 0x1d, 0x0a, 0x03, 0x4d, 0x41, 0x50, 0x18, 0x6f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, + 0x41, 0x2e, 0x4d, 0x41, 0x50, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x4d, 0x41, 0x50, 0x1a, + 0x3a, 0x0a, 0x08, 0x4d, 0x41, 0x50, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x41, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbe, 0x01, 0x0a, 0x03, + 0x46, 0x6f, 0x6f, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x05, + 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, + 0x0a, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x46, + 0x6f, 0x6f, 0x52, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x12, 0x1a, 0x0a, 0x05, 0x72, 0x69, 0x67, 0x68, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x05, 0x72, + 0x69, 0x67, 0x68, 0x74, 0x12, 0x16, 0x0a, 0x03, 0x62, 0x61, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x04, 0x2e, 0x42, 0x61, 0x72, 0x52, 0x03, 0x62, 0x61, 0x72, 0x22, 0x60, 0x0a, 0x03, + 0x42, 0x61, 0x72, 0x12, 0x15, 0x0a, 0x06, 0x62, 0x61, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x61, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2e, + 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x94, + 0x01, 0x0a, 0x03, 0x42, 0x61, 0x7a, 0x12, 0x1d, 0x0a, 0x02, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, - 0x6d, 0x52, 0x04, 0x45, 0x4e, 0x55, 0x4d, 0x12, 0x26, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x18, 0x0d, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x03, 0x41, 0x4e, 0x59, 0x12, - 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x18, 0x65, 0x20, 0x01, 0x28, 0x11, 0x52, - 0x06, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x36, - 0x34, 0x18, 0x66, 0x20, 0x01, 0x28, 0x12, 0x52, 0x06, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x12, - 0x1a, 0x0a, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x18, 0x69, 0x20, 0x01, 0x28, - 0x0f, 0x52, 0x08, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, 0x18, 0x0a, 0x07, 0x46, - 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x07, 0x52, 0x07, 0x46, 0x49, - 0x58, 0x45, 0x44, 0x33, 0x32, 0x12, 0x14, 0x0a, 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x18, 0x6b, - 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x12, 0x1a, 0x0a, 0x08, 0x53, - 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x18, 0x6c, 0x20, 0x01, 0x28, 0x10, 0x52, 0x08, 0x53, - 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x12, 0x18, 0x0a, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, - 0x36, 0x34, 0x18, 0x6d, 0x20, 0x01, 0x28, 0x06, 0x52, 0x07, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, - 0x34, 0x12, 0x16, 0x0a, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x18, 0x6e, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x12, 0x1d, 0x0a, 0x03, 0x4d, 0x41, 0x50, - 0x18, 0x6f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x41, 0x2e, 0x4d, 0x41, 0x50, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x03, 0x4d, 0x41, 0x50, 0x1a, 0x3a, 0x0a, 0x08, 0x4d, 0x41, 0x50, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x02, 0x2e, 0x41, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xbe, 0x01, 0x0a, 0x03, 0x46, 0x6f, 0x6f, 0x12, 0x1b, 0x0a, 0x09, - 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, - 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, - 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x04, 0x6c, 0x65, 0x66, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x04, 0x6c, 0x65, 0x66, - 0x74, 0x12, 0x1a, 0x0a, 0x05, 0x72, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x05, 0x72, 0x69, 0x67, 0x68, 0x74, 0x12, 0x16, 0x0a, - 0x03, 0x62, 0x61, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x42, 0x61, 0x72, - 0x52, 0x03, 0x62, 0x61, 0x72, 0x22, 0x60, 0x0a, 0x03, 0x42, 0x61, 0x72, 0x12, 0x15, 0x0a, 0x06, - 0x62, 0x61, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x62, 0x61, - 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, - 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x94, 0x01, 0x0a, 0x03, 0x42, 0x61, 0x7a, 0x12, - 0x1d, 0x0a, 0x02, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x45, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x02, 0x65, 0x65, 0x12, 0x22, - 0x0a, 0x02, 0x69, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x42, 0x61, 0x7a, - 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x02, - 0x69, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x23, 0x0a, 0x0d, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x6f, - 0x75, 0x72, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x69, 0x76, 0x65, 0x10, 0x01, 0x22, 0xdc, - 0x01, 0x0a, 0x03, 0x51, 0x75, 0x78, 0x12, 0x20, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x08, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x07, 0x2e, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x52, 0x04, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x2f, - 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, - 0x3c, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x56, 0x0a, - 0x14, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, - 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, - 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x77, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x76, 0x0a, 0x06, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x12, - 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x2a, 0x39, 0x0a, - 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x07, 0x0a, - 0x03, 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x77, 0x6f, 0x10, 0x01, 0x12, - 0x17, 0x0a, 0x13, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x4e, 0x55, 0x4d, - 0x5f, 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x7f, 0x2a, 0x95, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x6c, - 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x41, 0x4c, - 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x42, 0x41, 0x4c, 0x4c, - 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, - 0x19, 0x0a, 0x15, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, - 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, - 0x12, 0x1e, 0x0a, 0x1a, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, - 0x42, 0x35, 0x42, 0x06, 0x31, 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, + 0x6d, 0x52, 0x02, 0x65, 0x65, 0x12, 0x22, 0x0a, 0x02, 0x69, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x12, 0x2e, 0x42, 0x61, 0x7a, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x5f, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x02, 0x69, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x6c, 0x6c, + 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0x23, 0x0a, 0x0d, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x6f, 0x75, 0x72, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, + 0x69, 0x76, 0x65, 0x10, 0x01, 0x22, 0xdc, 0x01, 0x0a, 0x03, 0x51, 0x75, 0x78, 0x12, 0x20, 0x0a, + 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x04, 0x2e, 0x46, 0x6f, 0x6f, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, + 0x27, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x76, 0x6f, 0x74, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x52, + 0x04, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, + 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, + 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x56, 0x0a, 0x14, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, + 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x76, 0x0a, 0x06, + 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, + 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x70, 0x72, 0x6f, + 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x6f, 0x74, 0x65, 0x72, 0x12, 0x2f, 0x0a, + 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x65, 0x64, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x04, + 0x08, 0x03, 0x10, 0x04, 0x2a, 0x39, 0x0a, 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x07, 0x0a, + 0x03, 0x54, 0x77, 0x6f, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x58, 0x54, 0x45, 0x52, 0x4e, + 0x41, 0x4c, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0x7f, 0x2a, + 0x95, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x6c, 0x6c, 0x6f, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x1d, 0x0a, 0x19, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x15, 0x0a, 0x11, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, + 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x53, 0x54, 0x41, 0x49, 0x4e, 0x10, + 0x02, 0x12, 0x14, 0x0a, 0x10, 0x42, 0x41, 0x4c, 0x4c, 0x4f, 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x42, 0x41, 0x4c, 0x4c, 0x4f, + 0x54, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x57, 0x49, 0x54, 0x48, + 0x5f, 0x56, 0x45, 0x54, 0x4f, 0x10, 0x04, 0x42, 0x35, 0x42, 0x06, 0x31, 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 ( From c088db21878f07dec36cec61d9b1d529ba50a96b Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 31 May 2023 16:51:02 -0500 Subject: [PATCH 11/26] specify CustomGetSignersFuncs as inputs --- runtime/module.go | 58 ++++++++++++++++++++++++----------------- x/tx/signing/context.go | 8 +++--- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/runtime/module.go b/runtime/module.go index a84019036f1a..889d07d794a7 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -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,36 @@ func init() { ) } -func ProvideApp() ( - codectypes.InterfaceRegistry, +func ProvideInterfaceRegistry(customGetSigners []signing.CustomGetSignersFunc) (codectypes.InterfaceRegistry, 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, err + } + + for _, customGetSignersFunc := range customGetSigners { + signing.DefineCustomGetSigners(interfaceRegistry.SigningContext(), customGetSignersFunc) + } + + // 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, err + } + + return interfaceRegistry, nil +} + +func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) ( codec.Codec, *codec.LegacyAmino, *AppBuilder, @@ -98,27 +129,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 +146,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 { diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 8aeb98c9bf49..54af2505371b 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -111,7 +111,7 @@ func (c *Context) Validate() error { for j := 0; j < sd.Methods().Len(); j++ { md := sd.Methods().Get(j).Input() _, err := c.getGetSignersFn(md) - if err != nil && !errors.Is(err, NeedCustomSignersError) { // don't fail on custom signers + if err != nil { errs = append(errs, err) } } @@ -327,6 +327,10 @@ func (c *Context) TypeResolver() protoregistry.MessageTypeResolver { return c.typeResolver } +type CustomGetSignersFunc func(message proto.Message) ([][]byte, error) + +func (cgsf CustomGetSignersFunc) IsManyPerContainerType() {} + // DefineCustomGetSigners defines a custom GetSigners function for a given // message type. It is defined as a function rather than a method on Context // because of how go generics work. @@ -340,5 +344,3 @@ func DefineCustomGetSigners[T proto.Message](ctx *Context, getSigners func(T) ([ return getSigners(msg.(T)) } } - -var NeedCustomSignersError = errors.New("need custom signers function") From ee6fa69cad9708240d5c12d3e2a0382b9d0572a6 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 31 May 2023 16:53:34 -0500 Subject: [PATCH 12/26] fix x/tx test --- x/tx/decode/decode_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tx/decode/decode_test.go b/x/tx/decode/decode_test.go index 1c095030e6b1..ac21431a50c0 100644 --- a/x/tx/decode/decode_test.go +++ b/x/tx/decode/decode_test.go @@ -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", }, } From ea17470da76a526230cb5f6c7867430ba7ffb1a6 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Wed, 31 May 2023 17:51:05 -0500 Subject: [PATCH 13/26] need x/tx replace in x/nft/go.mod --- x/nft/go.mod | 1 + 1 file changed, 1 insertion(+) diff --git a/x/nft/go.mod b/x/nft/go.mod index 1fda996b8112..8c3d71392530 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -152,6 +152,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 From 5dce52b9a0252ff6d7940204ca96e049eae8642c Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Thu, 1 Jun 2023 09:58:54 -0500 Subject: [PATCH 14/26] works, but not how I want it to --- runtime/module.go | 16 +++++------ tests/integration/tx/context_test.go | 43 ++++++++++++++++++++++++++++ x/tx/signing/context.go | 10 +++++-- 3 files changed, 59 insertions(+), 10 deletions(-) create mode 100644 tests/integration/tx/context_test.go diff --git a/runtime/module.go b/runtime/module.go index 889d07d794a7..8e83870c1418 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -6,20 +6,20 @@ import ( runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" 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" - + bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/comet" "cosmossdk.io/core/event" "cosmossdk.io/core/genesis" "cosmossdk.io/core/header" "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" + "cosmossdk.io/x/tx/signing" + "github.com/cosmos/gogoproto/proto" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoregistry" "github.com/cosmos/cosmos-sdk/codec/address" @@ -79,7 +79,7 @@ func init() { ) } -func ProvideInterfaceRegistry(customGetSigners []signing.CustomGetSignersFunc) (codectypes.InterfaceRegistry, error) { +func ProvideInterfaceRegistry(customGetSigners []signing.CustomGetSignersImpl[*bankv1beta1.SendAuthorization]) (codectypes.InterfaceRegistry, error) { interfaceRegistry, err := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{ ProtoFiles: proto.HybridResolver, // using the global prefixes is a temporary solution until we refactor this diff --git a/tests/integration/tx/context_test.go b/tests/integration/tx/context_test.go new file mode 100644 index 000000000000..e20dfa934e3b --- /dev/null +++ b/tests/integration/tx/context_test.go @@ -0,0 +1,43 @@ +package tx + +import ( + "testing" + + bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "cosmossdk.io/x/tx/signing" + "github.com/stretchr/testify/require" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/testutil/configurator" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" +) + +func ProvideCustomGetSigners() signing.CustomGetSignersImpl[*bankv1beta1.SendAuthorization] { + return func(msg *bankv1beta1.SendAuthorization) ([][]byte, error) { + return [][]byte{[]byte("foo")}, 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.GovModule(), + configurator.DistributionModule(), + configurator.ConsensusModule(), + ), + depinject.Supply(log.NewNopLogger()), + depinject.Provide(ProvideCustomGetSigners), + ), + &interfaceRegistry, + ) + require.NoError(t, err) + require.NotNil(t, interfaceRegistry) +} diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 54af2505371b..482a03a18692 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -327,9 +327,15 @@ func (c *Context) TypeResolver() protoregistry.MessageTypeResolver { return c.typeResolver } -type CustomGetSignersFunc func(message proto.Message) ([][]byte, error) +type CustomGetSignersFunc interface { + isCustomGetSignersFunc() +} + +type CustomGetSignersImpl[T proto.Message] func(message T) ([][]byte, error) + +func (cgsf CustomGetSignersImpl[T]) IsManyPerContainerType() {} -func (cgsf CustomGetSignersFunc) IsManyPerContainerType() {} +func (cgsf CustomGetSignersImpl[T]) isCustomGetSignersFunc() {} // DefineCustomGetSigners defines a custom GetSigners function for a given // message type. It is defined as a function rather than a method on Context From 49a9013d63a3f8b48b8629f36f849e0b435afebe Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Thu, 1 Jun 2023 10:51:06 -0500 Subject: [PATCH 15/26] simplify and use invoker --- runtime/module.go | 69 ++++++++++++---------------- tests/integration/tx/context_test.go | 40 +++++++++++++--- x/tx/signing/context.go | 10 ---- 3 files changed, 63 insertions(+), 56 deletions(-) diff --git a/runtime/module.go b/runtime/module.go index 8e83870c1418..a98df8de0b37 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -6,20 +6,19 @@ import ( runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/gogoproto/proto" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoregistry" + "cosmossdk.io/core/appmodule" "cosmossdk.io/core/comet" "cosmossdk.io/core/event" "cosmossdk.io/core/genesis" "cosmossdk.io/core/header" "cosmossdk.io/core/store" - "cosmossdk.io/depinject" - "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - "cosmossdk.io/x/tx/signing" - "github.com/cosmos/gogoproto/proto" - "google.golang.org/protobuf/reflect/protodesc" - "google.golang.org/protobuf/reflect/protoregistry" "github.com/cosmos/cosmos-sdk/codec/address" @@ -62,7 +61,6 @@ func init() { appmodule.Register(&runtimev1alpha1.Module{}, appmodule.Provide( ProvideApp, - ProvideInterfaceRegistry, ProvideKVStoreKey, ProvideTransientStoreKey, ProvideMemoryStoreKey, @@ -79,36 +77,8 @@ func init() { ) } -func ProvideInterfaceRegistry(customGetSigners []signing.CustomGetSignersImpl[*bankv1beta1.SendAuthorization]) (codectypes.InterfaceRegistry, 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, err - } - - for _, customGetSignersFunc := range customGetSigners { - signing.DefineCustomGetSigners(interfaceRegistry.SigningContext(), customGetSignersFunc) - } - - // 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, err - } - - return interfaceRegistry, nil -} - -func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) ( +func ProvideApp() ( + codectypes.InterfaceRegistry, codec.Codec, *codec.LegacyAmino, *AppBuilder, @@ -129,6 +99,27 @@ func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) ( _, _ = 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) @@ -146,7 +137,7 @@ func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) ( } appBuilder := &AppBuilder{app} - return cdc, amino, appBuilder, cdc, msgServiceRouter, appModule{app}, protoFiles, protoTypes, nil + return interfaceRegistry, cdc, amino, appBuilder, cdc, msgServiceRouter, appModule{app}, protoFiles, protoTypes, nil } type AppInputs struct { diff --git a/tests/integration/tx/context_test.go b/tests/integration/tx/context_test.go index e20dfa934e3b..6717ba7bde5e 100644 --- a/tests/integration/tx/context_test.go +++ b/tests/integration/tx/context_test.go @@ -14,10 +14,12 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" ) -func ProvideCustomGetSigners() signing.CustomGetSignersImpl[*bankv1beta1.SendAuthorization] { - return func(msg *bankv1beta1.SendAuthorization) ([][]byte, error) { - return [][]byte{[]byte("foo")}, nil - } +func SetCustomGetSigners(registry codectypes.InterfaceRegistry) { + signing.DefineCustomGetSigners(registry.SigningContext(), func(msg *bankv1beta1.SendAuthorization) ([][]byte, error) { + // arbitrary logic + signer := msg.AllowList[1] + return [][]byte{[]byte(signer)}, nil + }) } func TestDefineCustomGetSigners(t *testing.T) { @@ -29,15 +31,39 @@ func TestDefineCustomGetSigners(t *testing.T) { configurator.AuthModule(), configurator.StakingModule(), configurator.BankModule(), - configurator.GovModule(), - configurator.DistributionModule(), configurator.ConsensusModule(), ), depinject.Supply(log.NewNopLogger()), - depinject.Provide(ProvideCustomGetSigners), + depinject.Invoke(SetCustomGetSigners), ), &interfaceRegistry, ) require.NoError(t, err) require.NotNil(t, interfaceRegistry) + + sendAuth := &bankv1beta1.SendAuthorization{ + AllowList: []string{"foo", "bar"}, + } + signers, err := interfaceRegistry.SigningContext().GetSigners(sendAuth) + require.Equal(t, [][]byte{[]byte("bar")}, signers) + + // reset without invoker, no custom signer. + _, err = simtestutil.SetupAtGenesis( + depinject.Configs( + configurator.NewAppConfig( + configurator.ParamsModule(), + configurator.AuthModule(), + configurator.StakingModule(), + configurator.BankModule(), + configurator.ConsensusModule(), + ), + depinject.Supply(log.NewNopLogger()), + ), + &interfaceRegistry, + ) + require.NoError(t, err) + require.NotNil(t, interfaceRegistry) + + _, err = interfaceRegistry.SigningContext().GetSigners(sendAuth) + require.ErrorContains(t, err, "use DefineCustomGetSigners") } diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 482a03a18692..252082afc2dd 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -327,16 +327,6 @@ func (c *Context) TypeResolver() protoregistry.MessageTypeResolver { return c.typeResolver } -type CustomGetSignersFunc interface { - isCustomGetSignersFunc() -} - -type CustomGetSignersImpl[T proto.Message] func(message T) ([][]byte, error) - -func (cgsf CustomGetSignersImpl[T]) IsManyPerContainerType() {} - -func (cgsf CustomGetSignersImpl[T]) isCustomGetSignersFunc() {} - // DefineCustomGetSigners defines a custom GetSigners function for a given // message type. It is defined as a function rather than a method on Context // because of how go generics work. From 2f4772e35c395907a670777d0c7a74cb5c1ba430 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Thu, 1 Jun 2023 10:56:03 -0500 Subject: [PATCH 16/26] remove signingContext validation from ProvideApp --- runtime/module.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/runtime/module.go b/runtime/module.go index a98df8de0b37..fdde552fc1fd 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -114,12 +114,6 @@ func ProvideApp() ( 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) From b01d359f7125510b96fa2224d2557774d18f07ae Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Thu, 1 Jun 2023 11:11:41 -0500 Subject: [PATCH 17/26] changelog --- x/tx/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/tx/CHANGELOG.md b/x/tx/CHANGELOG.md index 9bffe20092b1..7b2a895ce474 100644 --- a/x/tx/CHANGELOG.md +++ b/x/tx/CHANGELOG.md @@ -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 From 66aedff18fe4b54c2f14dbf4e059bf99d995a36c Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Thu, 1 Jun 2023 11:46:12 -0500 Subject: [PATCH 18/26] lint fixg --- tests/integration/tx/context_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/tx/context_test.go b/tests/integration/tx/context_test.go index 6717ba7bde5e..393b53fe2583 100644 --- a/tests/integration/tx/context_test.go +++ b/tests/integration/tx/context_test.go @@ -45,6 +45,7 @@ func TestDefineCustomGetSigners(t *testing.T) { AllowList: []string{"foo", "bar"}, } signers, err := interfaceRegistry.SigningContext().GetSigners(sendAuth) + require.NoError(t, err) require.Equal(t, [][]byte{[]byte("bar")}, signers) // reset without invoker, no custom signer. From 9e7a2bb9f1b2af3fc83f05d1d3d4a9d5aaf777be Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Thu, 1 Jun 2023 14:48:32 -0500 Subject: [PATCH 19/26] seems better --- codec/proto_codec_test.go | 9 +++-- codec/testutil/codec.go | 9 +++-- codec/types/interface_registry.go | 25 +++++--------- runtime/module.go | 51 ++++++++++++++++++---------- simapp/app.go | 14 +++++--- tests/integration/tx/context_test.go | 19 +++++++---- tools/rosetta/codec.go | 13 ++++--- x/tx/signing/context.go | 50 ++++++++++++++++----------- x/tx/signing/context_test.go | 15 ++++---- 9 files changed, 123 insertions(+), 82 deletions(-) diff --git a/codec/proto_codec_test.go b/codec/proto_codec_test.go index 7e02f91aada6..d5ade07f6e0a 100644 --- a/codec/proto_codec_test.go +++ b/codec/proto_codec_test.go @@ -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) diff --git a/codec/testutil/codec.go b/codec/testutil/codec.go index 2f08a4ad3b4c..971994c3d731 100644 --- a/codec/testutil/codec.go +++ b/codec/testutil/codec.go @@ -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) diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go index f182c011f1f7..50a5ca01c126 100644 --- a/codec/types/interface_registry.go +++ b/codec/types/interface_registry.go @@ -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 } diff --git a/runtime/module.go b/runtime/module.go index fdde552fc1fd..8fca550d7261 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -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" @@ -61,6 +62,7 @@ func init() { appmodule.Register(&runtimev1alpha1.Module{}, appmodule.Provide( ProvideApp, + ProvideInterfaceRegistry, ProvideKVStoreKey, ProvideTransientStoreKey, ProvideMemoryStoreKey, @@ -77,8 +79,7 @@ func init() { ) } -func ProvideApp() ( - codectypes.InterfaceRegistry, +func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) ( codec.Codec, *codec.LegacyAmino, *AppBuilder, @@ -99,21 +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 - } - amino := codec.NewLegacyAmino() std.RegisterInterfaces(interfaceRegistry) @@ -131,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 { @@ -171,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) } diff --git a/simapp/app.go b/simapp/app.go index 57c6baf2e8e9..045578df111c 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -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) diff --git a/tests/integration/tx/context_test.go b/tests/integration/tx/context_test.go index 393b53fe2583..3461cac0c4ae 100644 --- a/tests/integration/tx/context_test.go +++ b/tests/integration/tx/context_test.go @@ -8,18 +8,23 @@ import ( "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/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" ) -func SetCustomGetSigners(registry codectypes.InterfaceRegistry) { - signing.DefineCustomGetSigners(registry.SigningContext(), func(msg *bankv1beta1.SendAuthorization) ([][]byte, error) { - // arbitrary logic - signer := msg.AllowList[1] - return [][]byte{[]byte(signer)}, nil - }) +func ProvideCustomGetSigners() signing.CustomGetSigner { + return signing.CustomGetSigner{ + MsgType: proto.MessageName(&bankv1beta1.SendAuthorization{}), + Fn: func(msg proto.Message) ([][]byte, error) { + sendAuth := msg.(*bankv1beta1.SendAuthorization) + // arbitrary logic + signer := sendAuth.AllowList[1] + return [][]byte{[]byte(signer)}, nil + }, + } } func TestDefineCustomGetSigners(t *testing.T) { @@ -34,7 +39,7 @@ func TestDefineCustomGetSigners(t *testing.T) { configurator.ConsensusModule(), ), depinject.Supply(log.NewNopLogger()), - depinject.Invoke(SetCustomGetSigners), + depinject.Provide(ProvideCustomGetSigners), ), &interfaceRegistry, ) diff --git a/tools/rosetta/codec.go b/tools/rosetta/codec.go index ff0668378890..7f284186574e 100644 --- a/tools/rosetta/codec.go +++ b/tools/rosetta/codec.go @@ -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(), + }, }, }, ) diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 252082afc2dd..91ee24ca8e48 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -24,7 +24,7 @@ type Context struct { typeResolver protoregistry.MessageTypeResolver addressCodec address.Codec validatorAddressCodec address.Codec - getSignersFuncs map[protoreflect.FullName]getSignersFunc + getSignersFuncs map[protoreflect.FullName]GetSignersFunc } // Options are options for creating Context which will be used for signing operations. @@ -41,6 +41,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 @@ -70,18 +85,29 @@ func NewContext(options Options) (*Context, error) { return nil, errors.New("validator address codec is required") } + if options.CustomGetSigners == nil { + options.CustomGetSigners = map[protoreflect.FullName]GetSignersFunc{} + } + c := &Context{ fileResolver: protoFiles, typeResolver: protoTypes, addressCodec: options.AddressCodec, validatorAddressCodec: options.ValidatorAddressCodec, - getSignersFuncs: map[protoreflect.FullName]getSignersFunc{}, + getSignersFuncs: options.CustomGetSigners, } return c, nil } -type getSignersFunc func(proto.Message) ([][]byte, error) +type GetSignersFunc func(proto.Message) ([][]byte, error) + +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) @@ -123,7 +149,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 @@ -283,7 +309,7 @@ func (c *Context) getAddressCodec(field protoreflect.FieldDescriptor) address.Co return addrCdc } -func (c *Context) getGetSignersFn(messageDescriptor protoreflect.MessageDescriptor) (getSignersFunc, error) { +func (c *Context) getGetSignersFn(messageDescriptor protoreflect.MessageDescriptor) (GetSignersFunc, error) { f, ok := c.getSignersFuncs[messageDescriptor.FullName()] if !ok { var err error @@ -326,17 +352,3 @@ func (c *Context) FileResolver() ProtoFileResolver { func (c *Context) TypeResolver() protoregistry.MessageTypeResolver { return c.typeResolver } - -// DefineCustomGetSigners defines a custom GetSigners function for a given -// message type. It is defined as a function rather than a method on Context -// because of how go generics work. -// -// 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 DefineCustomGetSigners[T proto.Message](ctx *Context, getSigners func(T) ([][]byte, error)) { - t := *new(T) - ctx.getSignersFuncs[t.ProtoReflect().Descriptor().FullName()] = func(msg proto.Message) ([][]byte, error) { - return getSigners(msg.(T)) - } -} diff --git a/x/tx/signing/context_test.go b/x/tx/signing/context_test.go index 74a35302118f..49fda72c9f80 100644 --- a/x/tx/signing/context_test.go +++ b/x/tx/signing/context_test.go @@ -148,20 +148,23 @@ func TestGetSigners(t *testing.T) { func TestDefineCustomGetSigners(t *testing.T) { customMsg := &testpb.Ballot{} signers := [][]byte{[]byte("foo")} - - context, err := NewContext(Options{ + options := Options{ AddressCodec: dummyAddressCodec{}, ValidatorAddressCodec: dummyValidatorAddressCodec{}, - }) + } + context, err := NewContext(options) require.NoError(t, err) _, err = context.GetSigners(customMsg) - // before calling DefineCustomGetSigners, we should get an error + // without a custom signer we should get an error require.ErrorContains(t, err, "use DefineCustomGetSigners to specify") - DefineCustomGetSigners(context, func(msg *testpb.Ballot) ([][]byte, error) { + + // create a new context with a custom signer + options.DefineCustomGetSigners(proto.MessageName(customMsg), func(msg proto.Message) ([][]byte, error) { return signers, nil }) - // after calling DefineCustomGetSigners, we should get the signers + context, err = NewContext(options) + require.NoError(t, err) gotSigners, err := context.GetSigners(customMsg) require.NoError(t, err) require.Equal(t, signers, gotSigners) From de3816cd41ae5584e6c4570464a48d10f92cfe61 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Fri, 2 Jun 2023 10:17:00 -0500 Subject: [PATCH 20/26] add comments --- x/tx/signing/context.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 91ee24ca8e48..90e896996151 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -100,8 +100,10 @@ func NewContext(options Options) (*Context, error) { return c, nil } +// 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 From eb720310821ca4b6262df13ca2051f2a5b3032ae Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Fri, 2 Jun 2023 10:31:18 -0500 Subject: [PATCH 21/26] refactor moving files --- tests/integration/{ => tx}/aminojson/.gitignore | 0 .../integration/{ => tx}/aminojson/aminojson_test.go | 4 ++-- .../integration/{ => tx}/aminojson/repeated_test.go | 5 +++-- .../integration/{aminojson => tx}/internal/Makefile | 0 .../{aminojson => tx}/internal/buf.gen.gogo.yaml | 0 .../{aminojson => tx}/internal/buf.gen.pulsar.yaml | 0 .../integration/{aminojson => tx}/internal/buf.lock | 0 .../integration/{aminojson => tx}/internal/buf.yaml | 0 .../internal/gogo/testpb/test.pb.go | 12 +++++++----- .../internal/pulsar/testpb/test.pulsar.go | 9 +++++---- .../{aminojson => tx}/internal/testpb/test.proto | 0 11 files changed, 17 insertions(+), 13 deletions(-) rename tests/integration/{ => tx}/aminojson/.gitignore (100%) rename tests/integration/{ => tx}/aminojson/aminojson_test.go (99%) rename tests/integration/{ => tx}/aminojson/repeated_test.go (91%) rename tests/integration/{aminojson => tx}/internal/Makefile (100%) rename tests/integration/{aminojson => tx}/internal/buf.gen.gogo.yaml (100%) rename tests/integration/{aminojson => tx}/internal/buf.gen.pulsar.yaml (100%) rename tests/integration/{aminojson => tx}/internal/buf.lock (100%) rename tests/integration/{aminojson => tx}/internal/buf.yaml (100%) rename tests/integration/{aminojson => tx}/internal/gogo/testpb/test.pb.go (99%) rename tests/integration/{aminojson => tx}/internal/pulsar/testpb/test.pulsar.go (99%) rename tests/integration/{aminojson => tx}/internal/testpb/test.proto (100%) diff --git a/tests/integration/aminojson/.gitignore b/tests/integration/tx/aminojson/.gitignore similarity index 100% rename from tests/integration/aminojson/.gitignore rename to tests/integration/tx/aminojson/.gitignore diff --git a/tests/integration/aminojson/aminojson_test.go b/tests/integration/tx/aminojson/aminojson_test.go similarity index 99% rename from tests/integration/aminojson/aminojson_test.go rename to tests/integration/tx/aminojson/aminojson_test.go index 22cd7b3b8d0f..9c7a0ce06e61 100644 --- a/tests/integration/aminojson/aminojson_test.go +++ b/tests/integration/tx/aminojson/aminojson_test.go @@ -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" diff --git a/tests/integration/aminojson/repeated_test.go b/tests/integration/tx/aminojson/repeated_test.go similarity index 91% rename from tests/integration/aminojson/repeated_test.go rename to tests/integration/tx/aminojson/repeated_test.go index 63842e58c29c..081d43c172b9 100644 --- a/tests/integration/aminojson/repeated_test.go +++ b/tests/integration/tx/aminojson/repeated_test.go @@ -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) { diff --git a/tests/integration/aminojson/internal/Makefile b/tests/integration/tx/internal/Makefile similarity index 100% rename from tests/integration/aminojson/internal/Makefile rename to tests/integration/tx/internal/Makefile diff --git a/tests/integration/aminojson/internal/buf.gen.gogo.yaml b/tests/integration/tx/internal/buf.gen.gogo.yaml similarity index 100% rename from tests/integration/aminojson/internal/buf.gen.gogo.yaml rename to tests/integration/tx/internal/buf.gen.gogo.yaml diff --git a/tests/integration/aminojson/internal/buf.gen.pulsar.yaml b/tests/integration/tx/internal/buf.gen.pulsar.yaml similarity index 100% rename from tests/integration/aminojson/internal/buf.gen.pulsar.yaml rename to tests/integration/tx/internal/buf.gen.pulsar.yaml diff --git a/tests/integration/aminojson/internal/buf.lock b/tests/integration/tx/internal/buf.lock similarity index 100% rename from tests/integration/aminojson/internal/buf.lock rename to tests/integration/tx/internal/buf.lock diff --git a/tests/integration/aminojson/internal/buf.yaml b/tests/integration/tx/internal/buf.yaml similarity index 100% rename from tests/integration/aminojson/internal/buf.yaml rename to tests/integration/tx/internal/buf.yaml diff --git a/tests/integration/aminojson/internal/gogo/testpb/test.pb.go b/tests/integration/tx/internal/gogo/testpb/test.pb.go similarity index 99% rename from tests/integration/aminojson/internal/gogo/testpb/test.pb.go rename to tests/integration/tx/internal/gogo/testpb/test.pb.go index 4ed2ed504d53..cd0aef4b14ee 100644 --- a/tests/integration/aminojson/internal/gogo/testpb/test.pb.go +++ b/tests/integration/tx/internal/gogo/testpb/test.pb.go @@ -5,14 +5,16 @@ package testpb import ( 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/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/tests/integration/aminojson/internal/pulsar/testpb/test.pulsar.go b/tests/integration/tx/internal/pulsar/testpb/test.pulsar.go similarity index 99% rename from tests/integration/aminojson/internal/pulsar/testpb/test.pulsar.go rename to tests/integration/tx/internal/pulsar/testpb/test.pulsar.go index dd3158b93eae..afffe1113bb8 100644 --- a/tests/integration/aminojson/internal/pulsar/testpb/test.pulsar.go +++ b/tests/integration/tx/internal/pulsar/testpb/test.pulsar.go @@ -2,17 +2,18 @@ package testpb import ( - _ "cosmossdk.io/api/amino" fmt "fmt" + io "io" + reflect "reflect" + sync "sync" + + _ "cosmossdk.io/api/amino" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" ) var ( diff --git a/tests/integration/aminojson/internal/testpb/test.proto b/tests/integration/tx/internal/testpb/test.proto similarity index 100% rename from tests/integration/aminojson/internal/testpb/test.proto rename to tests/integration/tx/internal/testpb/test.proto From 9138f2c88ddd39ebcf10d14f6f49197ed8c6911f Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Fri, 2 Jun 2023 10:48:23 -0500 Subject: [PATCH 22/26] adjust depinject test to fail during startup --- tests/integration/tx/context_test.go | 23 +- .../tx/internal/gogo/testpb/test.pb.go | 366 +++------ .../tx/internal/pulsar/testpb/test.pulsar.go | 743 +++--------------- .../integration/tx/internal/testpb/test.proto | 7 + 4 files changed, 236 insertions(+), 903 deletions(-) diff --git a/tests/integration/tx/context_test.go b/tests/integration/tx/context_test.go index 3461cac0c4ae..215b3a864ce3 100644 --- a/tests/integration/tx/context_test.go +++ b/tests/integration/tx/context_test.go @@ -3,7 +3,6 @@ package tx import ( "testing" - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" "cosmossdk.io/depinject" "cosmossdk.io/log" "cosmossdk.io/x/tx/signing" @@ -11,17 +10,18 @@ import ( "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(&bankv1beta1.SendAuthorization{}), + MsgType: proto.MessageName(&testpb.TestRepeatedFields{}), Fn: func(msg proto.Message) ([][]byte, error) { - sendAuth := msg.(*bankv1beta1.SendAuthorization) + testMsg := msg.(*testpb.TestRepeatedFields) // arbitrary logic - signer := sendAuth.AllowList[1] + signer := testMsg.NullableDontOmitempty[1].Value return [][]byte{[]byte(signer)}, nil }, } @@ -46,14 +46,17 @@ func TestDefineCustomGetSigners(t *testing.T) { require.NoError(t, err) require.NotNil(t, interfaceRegistry) - sendAuth := &bankv1beta1.SendAuthorization{ - AllowList: []string{"foo", "bar"}, + msg := &testpb.TestRepeatedFields{ + NullableDontOmitempty: []*testpb.Streng{ + {Value: "foo"}, + {Value: "bar"}, + }, } - signers, err := interfaceRegistry.SigningContext().GetSigners(sendAuth) + signers, err := interfaceRegistry.SigningContext().GetSigners(msg) require.NoError(t, err) require.Equal(t, [][]byte{[]byte("bar")}, signers) - // reset without invoker, no custom signer. + // reset providing CustomGetSigners. validation will fail and depinject will return an error _, err = simtestutil.SetupAtGenesis( depinject.Configs( configurator.NewAppConfig( @@ -67,9 +70,5 @@ func TestDefineCustomGetSigners(t *testing.T) { ), &interfaceRegistry, ) - require.NoError(t, err) - require.NotNil(t, interfaceRegistry) - - _, err = interfaceRegistry.SigningContext().GetSigners(sendAuth) require.ErrorContains(t, err, "use DefineCustomGetSigners") } diff --git a/tests/integration/tx/internal/gogo/testpb/test.pb.go b/tests/integration/tx/internal/gogo/testpb/test.pb.go index cd0aef4b14ee..9ae36d6492cd 100644 --- a/tests/integration/tx/internal/gogo/testpb/test.pb.go +++ b/tests/integration/tx/internal/gogo/testpb/test.pb.go @@ -4,17 +4,21 @@ package testpb import ( + context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/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" ) // Reference imports to suppress errors if they are not otherwise used. @@ -291,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 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") } -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 init() { proto.RegisterFile("testpb/test.proto", fileDescriptor_41c67e33ca9d1f26) } + +var fileDescriptor_41c67e33ca9d1f26 = []byte{ + // 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, } -func (m *IntAsBothStringAndBytes) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + +// 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) } -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 - } + +type integrationTxTestMsgClient struct { + cc grpc1.ClientConn } -func (m *IntAsBothStringAndBytes) XXX_Merge(src proto.Message) { - xxx_messageInfo_IntAsBothStringAndBytes.Merge(m, src) + +func NewIntegrationTxTestMsgClient(cc grpc1.ClientConn) IntegrationTxTestMsgClient { + return &integrationTxTestMsgClient{cc} } -func (m *IntAsBothStringAndBytes) XXX_Size() int { - return m.Size() + +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 } -func (m *IntAsBothStringAndBytes) XXX_DiscardUnknown() { - xxx_messageInfo_IntAsBothStringAndBytes.DiscardUnknown(m) + +// IntegrationTxTestMsgServer is the server API for IntegrationTxTestMsg service. +type IntegrationTxTestMsgServer interface { + TestFields(context.Context, *TestRepeatedFields) (*TestRepeatedFields, error) } -var xxx_messageInfo_IntAsBothStringAndBytes proto.InternalMessageInfo +// UnimplementedIntegrationTxTestMsgServer can be embedded to have forward compatible implementations. +type UnimplementedIntegrationTxTestMsgServer struct { +} -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 (*UnimplementedIntegrationTxTestMsgServer) TestFields(ctx context.Context, req *TestRepeatedFields) (*TestRepeatedFields, error) { + return nil, status.Errorf(codes.Unimplemented, "method TestFields not implemented") } -func init() { proto.RegisterFile("testpb/test.proto", fileDescriptor_41c67e33ca9d1f26) } +func RegisterIntegrationTxTestMsgServer(s grpc1.Server, srv IntegrationTxTestMsgServer) { + s.RegisterService(&_IntegrationTxTestMsg_serviceDesc, srv) +} -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, +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) { @@ -614,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 @@ -757,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 } @@ -1399,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 diff --git a/tests/integration/tx/internal/pulsar/testpb/test.pulsar.go b/tests/integration/tx/internal/pulsar/testpb/test.pulsar.go index afffe1113bb8..c42b16edf217 100644 --- a/tests/integration/tx/internal/pulsar/testpb/test.pulsar.go +++ b/tests/integration/tx/internal/pulsar/testpb/test.pulsar.go @@ -2,18 +2,18 @@ package testpb import ( - fmt "fmt" - io "io" - reflect "reflect" - sync "sync" - _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" ) var ( @@ -2858,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 @@ -3589,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 ( @@ -3739,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 @@ -3757,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 @@ -3830,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{ @@ -3849,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, diff --git a/tests/integration/tx/internal/testpb/test.proto b/tests/integration/tx/internal/testpb/test.proto index 5385d7ebce7b..e20d6996a5ab 100644 --- a/tests/integration/tx/internal/testpb/test.proto +++ b/tests/integration/tx/internal/testpb/test.proto @@ -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) {} } \ No newline at end of file From 410935fd25f03017eac8f252ecb9e7f71b21b664 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Fri, 2 Jun 2023 10:49:49 -0500 Subject: [PATCH 23/26] fix comment --- tests/integration/tx/context_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/tx/context_test.go b/tests/integration/tx/context_test.go index 215b3a864ce3..62daad659ded 100644 --- a/tests/integration/tx/context_test.go +++ b/tests/integration/tx/context_test.go @@ -56,7 +56,7 @@ func TestDefineCustomGetSigners(t *testing.T) { require.NoError(t, err) require.Equal(t, [][]byte{[]byte("bar")}, signers) - // reset providing CustomGetSigners. validation will fail and depinject will return an error + // Reset and provider no CustomGetSigners. Consequently, validation will fail and depinject will return an error _, err = simtestutil.SetupAtGenesis( depinject.Configs( configurator.NewAppConfig( From 0d6f08fe124dec1924b092d6e958f18600c6177c Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Mon, 5 Jun 2023 10:15:08 -0500 Subject: [PATCH 24/26] disallow custom signer with proto annotation in Validate --- x/tx/internal/testpb/signers.proto | 5 +++++ x/tx/internal/testpb/signers.pulsar.go | 25 ++++++++++++++++--------- x/tx/signing/context.go | 18 ++++++++++++++---- x/tx/signing/context_test.go | 10 ++++++++++ 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/x/tx/internal/testpb/signers.proto b/x/tx/internal/testpb/signers.proto index dfd6db078646..3104bf5d19fe 100644 --- a/x/tx/internal/testpb/signers.proto +++ b/x/tx/internal/testpb/signers.proto @@ -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) {} } \ No newline at end of file diff --git a/x/tx/internal/testpb/signers.pulsar.go b/x/tx/internal/testpb/signers.pulsar.go index f7ce5db88e20..51c8cf163e39 100644 --- a/x/tx/internal/testpb/signers.pulsar.go +++ b/x/tx/internal/testpb/signers.pulsar.go @@ -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, diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index 90e896996151..b68aea5dd4b2 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -25,6 +25,7 @@ type Context struct { addressCodec address.Codec validatorAddressCodec address.Codec getSignersFuncs map[protoreflect.FullName]GetSignersFunc + customGetSignerFuncs map[protoreflect.FullName]GetSignersFunc } // Options are options for creating Context which will be used for signing operations. @@ -85,8 +86,9 @@ func NewContext(options Options) (*Context, error) { return nil, errors.New("validator address codec is required") } - if options.CustomGetSigners == nil { - options.CustomGetSigners = map[protoreflect.FullName]GetSignersFunc{} + customGetSignerFuncs := map[protoreflect.FullName]GetSignersFunc{} + for k, _ := range options.CustomGetSigners { + customGetSignerFuncs[k] = options.CustomGetSigners[k] } c := &Context{ @@ -94,7 +96,8 @@ func NewContext(options Options) (*Context, error) { typeResolver: protoTypes, addressCodec: options.AddressCodec, validatorAddressCodec: options.ValidatorAddressCodec, - getSignersFuncs: options.CustomGetSigners, + getSignersFuncs: map[protoreflect.FullName]GetSignersFunc{}, + customGetSignerFuncs: customGetSignerFuncs, } return c, nil @@ -138,6 +141,9 @@ func (c *Context) Validate() error { for j := 0; j < sd.Methods().Len(); j++ { md := sd.Methods().Get(j).Input() + if _, customSigner := c.customGetSignerFuncs[md.FullName()]; customSigner { + 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())) + } _, err := c.getGetSignersFn(md) if err != nil { errs = append(errs, err) @@ -312,7 +318,11 @@ func (c *Context) getAddressCodec(field protoreflect.FieldDescriptor) address.Co } func (c *Context) getGetSignersFn(messageDescriptor protoreflect.MessageDescriptor) (GetSignersFunc, error) { - f, ok := c.getSignersFuncs[messageDescriptor.FullName()] + 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) diff --git a/x/tx/signing/context_test.go b/x/tx/signing/context_test.go index 49fda72c9f80..a5655e31b17d 100644 --- a/x/tx/signing/context_test.go +++ b/x/tx/signing/context_test.go @@ -166,8 +166,18 @@ func TestDefineCustomGetSigners(t *testing.T) { 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.ErrorContains(t, context.Validate(), "a custom signer function as been defined for message SimpleSigner") } type dummyAddressCodec struct{} From 544575417f2ff99a0cf15192d1f0d740614b9502 Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Mon, 5 Jun 2023 10:39:23 -0500 Subject: [PATCH 25/26] fix validate logic --- x/tx/signing/context.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index b68aea5dd4b2..bac52a2b40e1 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -141,8 +141,10 @@ func (c *Context) Validate() error { for j := 0; j < sd.Methods().Len(); j++ { md := sd.Methods().Get(j).Input() - if _, customSigner := c.customGetSignerFuncs[md.FullName()]; customSigner { + _, 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 { From e3dd1c32666425f29d913dbec5ca3db47af0ed4d Mon Sep 17 00:00:00 2001 From: Matt Kocubinski Date: Mon, 5 Jun 2023 11:09:42 -0500 Subject: [PATCH 26/26] linting fix --- x/tx/signing/context.go | 2 +- x/tx/signing/context_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/x/tx/signing/context.go b/x/tx/signing/context.go index bac52a2b40e1..9571bea67c07 100644 --- a/x/tx/signing/context.go +++ b/x/tx/signing/context.go @@ -87,7 +87,7 @@ func NewContext(options Options) (*Context, error) { } customGetSignerFuncs := map[protoreflect.FullName]GetSignersFunc{} - for k, _ := range options.CustomGetSigners { + for k := range options.CustomGetSigners { customGetSignerFuncs[k] = options.CustomGetSigners[k] } diff --git a/x/tx/signing/context_test.go b/x/tx/signing/context_test.go index a5655e31b17d..34ca2daa6465 100644 --- a/x/tx/signing/context_test.go +++ b/x/tx/signing/context_test.go @@ -177,6 +177,7 @@ func TestDefineCustomGetSigners(t *testing.T) { 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") }