Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
This commit is contained in:
co-authored by
Matt Kocubinski
parent
2b7826d2af
commit
1b27e4fd6e
Vendored
+8
@@ -5,6 +5,7 @@ import "amino/amino.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "testpb/testdata.proto";
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/testutil/testdata";
|
||||
|
||||
@@ -35,4 +36,11 @@ message TestMsg {
|
||||
option (amino.name) = "testpb/TestMsg";
|
||||
|
||||
repeated string signers = 1;
|
||||
|
||||
string decField = 2 [
|
||||
(cosmos_proto.scalar) = "cosmos.Dec",
|
||||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
|
||||
(amino.dont_omitempty) = true,
|
||||
(gogoproto.nullable) = false
|
||||
];
|
||||
}
|
||||
|
||||
+94
-14
@@ -5,6 +5,7 @@ import (
|
||||
_ "cosmossdk.io/api/amino"
|
||||
_ "cosmossdk.io/api/cosmos/msg/v1"
|
||||
fmt "fmt"
|
||||
_ "github.com/cosmos/cosmos-proto"
|
||||
runtime "github.com/cosmos/cosmos-proto/runtime"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -981,14 +982,16 @@ func (x *_TestMsg_1_list) IsValid() bool {
|
||||
}
|
||||
|
||||
var (
|
||||
md_TestMsg protoreflect.MessageDescriptor
|
||||
fd_TestMsg_signers protoreflect.FieldDescriptor
|
||||
md_TestMsg protoreflect.MessageDescriptor
|
||||
fd_TestMsg_signers protoreflect.FieldDescriptor
|
||||
fd_TestMsg_decField protoreflect.FieldDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_testpb_tx_proto_init()
|
||||
md_TestMsg = File_testpb_tx_proto.Messages().ByName("TestMsg")
|
||||
fd_TestMsg_signers = md_TestMsg.Fields().ByName("signers")
|
||||
fd_TestMsg_decField = md_TestMsg.Fields().ByName("decField")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_TestMsg)(nil)
|
||||
@@ -1062,6 +1065,12 @@ func (x *fastReflection_TestMsg) Range(f func(protoreflect.FieldDescriptor, prot
|
||||
return
|
||||
}
|
||||
}
|
||||
if x.DecField != "" {
|
||||
value := protoreflect.ValueOfString(x.DecField)
|
||||
if !f(fd_TestMsg_decField, value) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Has reports whether a field is populated.
|
||||
@@ -1079,6 +1088,8 @@ func (x *fastReflection_TestMsg) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
case "testpb.TestMsg.signers":
|
||||
return len(x.Signers) != 0
|
||||
case "testpb.TestMsg.decField":
|
||||
return x.DecField != ""
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.TestMsg"))
|
||||
@@ -1097,6 +1108,8 @@ func (x *fastReflection_TestMsg) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
case "testpb.TestMsg.signers":
|
||||
x.Signers = nil
|
||||
case "testpb.TestMsg.decField":
|
||||
x.DecField = ""
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.TestMsg"))
|
||||
@@ -1119,6 +1132,9 @@ func (x *fastReflection_TestMsg) Get(descriptor protoreflect.FieldDescriptor) pr
|
||||
}
|
||||
listValue := &_TestMsg_1_list{list: &x.Signers}
|
||||
return protoreflect.ValueOfList(listValue)
|
||||
case "testpb.TestMsg.decField":
|
||||
value := x.DecField
|
||||
return protoreflect.ValueOfString(value)
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.TestMsg"))
|
||||
@@ -1143,6 +1159,8 @@ func (x *fastReflection_TestMsg) Set(fd protoreflect.FieldDescriptor, value prot
|
||||
lv := value.List()
|
||||
clv := lv.(*_TestMsg_1_list)
|
||||
x.Signers = *clv.list
|
||||
case "testpb.TestMsg.decField":
|
||||
x.DecField = value.Interface().(string)
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.TestMsg"))
|
||||
@@ -1169,6 +1187,8 @@ func (x *fastReflection_TestMsg) Mutable(fd protoreflect.FieldDescriptor) protor
|
||||
}
|
||||
value := &_TestMsg_1_list{list: &x.Signers}
|
||||
return protoreflect.ValueOfList(value)
|
||||
case "testpb.TestMsg.decField":
|
||||
panic(fmt.Errorf("field decField of message testpb.TestMsg is not mutable"))
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.TestMsg"))
|
||||
@@ -1185,6 +1205,8 @@ func (x *fastReflection_TestMsg) NewField(fd protoreflect.FieldDescriptor) proto
|
||||
case "testpb.TestMsg.signers":
|
||||
list := []string{}
|
||||
return protoreflect.ValueOfList(&_TestMsg_1_list{list: &list})
|
||||
case "testpb.TestMsg.decField":
|
||||
return protoreflect.ValueOfString("")
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.TestMsg"))
|
||||
@@ -1260,6 +1282,10 @@ func (x *fastReflection_TestMsg) ProtoMethods() *protoiface.Methods {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
}
|
||||
l = len(x.DecField)
|
||||
if l > 0 {
|
||||
n += 1 + l + runtime.Sov(uint64(l))
|
||||
}
|
||||
if x.unknownFields != nil {
|
||||
n += len(x.unknownFields)
|
||||
}
|
||||
@@ -1289,6 +1315,13 @@ func (x *fastReflection_TestMsg) ProtoMethods() *protoiface.Methods {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if len(x.DecField) > 0 {
|
||||
i -= len(x.DecField)
|
||||
copy(dAtA[i:], x.DecField)
|
||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DecField)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(x.Signers) > 0 {
|
||||
for iNdEx := len(x.Signers) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(x.Signers[iNdEx])
|
||||
@@ -1379,6 +1412,38 @@ func (x *fastReflection_TestMsg) ProtoMethods() *protoiface.Methods {
|
||||
}
|
||||
x.Signers = append(x.Signers, 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 DecField", 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.DecField = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||
@@ -1512,7 +1577,8 @@ type TestMsg struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Signers []string `protobuf:"bytes,1,rep,name=signers,proto3" json:"signers,omitempty"`
|
||||
Signers []string `protobuf:"bytes,1,rep,name=signers,proto3" json:"signers,omitempty"`
|
||||
DecField string `protobuf:"bytes,2,opt,name=decField,proto3" json:"decField,omitempty"`
|
||||
}
|
||||
|
||||
func (x *TestMsg) Reset() {
|
||||
@@ -1542,6 +1608,13 @@ func (x *TestMsg) GetSigners() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *TestMsg) GetDecField() string {
|
||||
if x != nil {
|
||||
return x.DecField
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_testpb_tx_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_testpb_tx_proto_rawDesc = []byte{
|
||||
@@ -1552,17 +1625,24 @@ var file_testpb_tx_proto_rawDesc = []byte{
|
||||
0x74, 0x6f, 0x1a, 0x15, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64,
|
||||
0x61, 0x74, 0x61, 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, 0x22, 0x4f, 0x0a, 0x0c, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44,
|
||||
0x6f, 0x67, 0x12, 0x1d, 0x0a, 0x03, 0x64, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x0b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x44, 0x6f, 0x67, 0x52, 0x03, 0x64, 0x6f,
|
||||
0x67, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x6f, 0x77,
|
||||
0x6e, 0x65, 0x72, 0x22, 0x2a, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x44, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22,
|
||||
0x48, 0x0a, 0x07, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x69,
|
||||
0x67, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x69, 0x67,
|
||||
0x6e, 0x65, 0x72, 0x73, 0x3a, 0x23, 0x88, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x73,
|
||||
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, 0x4f, 0x0a,
|
||||
0x0c, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x67, 0x12, 0x1d, 0x0a,
|
||||
0x03, 0x64, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x74, 0x65, 0x73,
|
||||
0x74, 0x70, 0x62, 0x2e, 0x44, 0x6f, 0x67, 0x52, 0x03, 0x64, 0x6f, 0x67, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e,
|
||||
0x65, 0x72, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x22, 0x2a,
|
||||
0x0a, 0x14, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x67, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x07, 0x54,
|
||||
0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x73,
|
||||
0x12, 0x52, 0x0a, 0x08, 0x64, 0x65, 0x63, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x42, 0x36, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d,
|
||||
0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65,
|
||||
0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
|
||||
0x73, 0x2e, 0x44, 0x65, 0x63, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x08, 0x64, 0x65, 0x63, 0x46,
|
||||
0x69, 0x65, 0x6c, 0x64, 0x3a, 0x23, 0x88, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x73,
|
||||
0x69, 0x67, 0x6e, 0x65, 0x72, 0x73, 0x8a, 0xe7, 0xb0, 0x2a, 0x0e, 0x74, 0x65, 0x73, 0x74, 0x70,
|
||||
0x62, 0x2f, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x73, 0x67, 0x32, 0x4d, 0x0a, 0x03, 0x4d, 0x73, 0x67,
|
||||
0x12, 0x3f, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x67, 0x12, 0x14, 0x2e,
|
||||
|
||||
Reference in New Issue
Block a user