diff --git a/system/crypto/common/cert.chain33.pb.go b/system/crypto/common/cert.chain33.pb.go index e4fd135652..89df4ff7fc 100644 --- a/system/crypto/common/cert.chain33.pb.go +++ b/system/crypto/common/cert.chain33.pb.go @@ -5,8 +5,9 @@ package cert_chain33 import ( fmt "fmt" - proto "github.com/golang/protobuf/proto" math "math" + + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/system/store/mavl/db/ticket/ticket.chain33.pb.go b/system/store/mavl/db/ticket/ticket.chain33.pb.go index f4b3cfaee8..11e589f9a4 100644 --- a/system/store/mavl/db/ticket/ticket.chain33.pb.go +++ b/system/store/mavl/db/ticket/ticket.chain33.pb.go @@ -5,8 +5,9 @@ package ticket import ( fmt "fmt" - proto "github.com/golang/protobuf/proto" math "math" + + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -134,7 +135,9 @@ func init() { proto.RegisterType((*Ticket)(nil), "ticket.Ticket") } -func init() { proto.RegisterFile("ticket.chain33.proto", fileDescriptor_f2d177ac8a0e6c77) } +func init() { + proto.RegisterFile("ticket.chain33.proto", fileDescriptor_f2d177ac8a0e6c77) +} var fileDescriptor_f2d177ac8a0e6c77 = []byte{ // 214 bytes of a gzipped FileDescriptorProto diff --git a/types/jsonpb/encode.go b/types/jsonpb/encode.go index 9b28b6a71a..72a22b72bc 100644 --- a/types/jsonpb/encode.go +++ b/types/jsonpb/encode.go @@ -8,7 +8,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/33cn/chain33/common" "io" "math" "reflect" @@ -18,6 +17,8 @@ import ( "time" "unicode/utf8" + "github.com/33cn/chain33/common" + "github.com/golang/protobuf/proto" "google.golang.org/protobuf/encoding/protojson" protoV2 "google.golang.org/protobuf/proto" diff --git a/types/jsonpb/jsonpb_proto/test2.pb.go b/types/jsonpb/jsonpb_proto/test2.pb.go index a27dc0c256..570b03d008 100644 --- a/types/jsonpb/jsonpb_proto/test2.pb.go +++ b/types/jsonpb/jsonpb_proto/test2.pb.go @@ -5,13 +5,14 @@ package jsonpb_proto import ( fmt "fmt" + math "math" + proto "github.com/golang/protobuf/proto" anypb "google.golang.org/protobuf/types/known/anypb" durationpb "google.golang.org/protobuf/types/known/durationpb" structpb "google.golang.org/protobuf/types/known/structpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/types/jsonpb/jsonpb_proto/test2.proto b/types/jsonpb/jsonpb_proto/test2.proto index f830eee94c..0d7a9f2b8e 100644 --- a/types/jsonpb/jsonpb_proto/test2.proto +++ b/types/jsonpb/jsonpb_proto/test2.proto @@ -16,139 +16,139 @@ package jsonpb_test; // Test message for holding primitive types. message Simple { - optional bool o_bool = 1; - optional int32 o_int32 = 2; - optional int32 o_int32_str = 3; - optional int64 o_int64 = 4; - optional int64 o_int64_str = 5; - optional uint32 o_uint32 = 6; - optional uint32 o_uint32_str = 7; - optional uint64 o_uint64 = 8; - optional uint64 o_uint64_str = 9; - optional sint32 o_sint32 = 10; - optional sint32 o_sint32_str = 11; - optional sint64 o_sint64 = 12; - optional sint64 o_sint64_str = 13; - optional float o_float = 14; - optional float o_float_str = 15; - optional double o_double = 16; - optional double o_double_str = 17; - optional string o_string = 18; - optional bytes o_bytes = 19; + optional bool o_bool = 1; + optional int32 o_int32 = 2; + optional int32 o_int32_str = 3; + optional int64 o_int64 = 4; + optional int64 o_int64_str = 5; + optional uint32 o_uint32 = 6; + optional uint32 o_uint32_str = 7; + optional uint64 o_uint64 = 8; + optional uint64 o_uint64_str = 9; + optional sint32 o_sint32 = 10; + optional sint32 o_sint32_str = 11; + optional sint64 o_sint64 = 12; + optional sint64 o_sint64_str = 13; + optional float o_float = 14; + optional float o_float_str = 15; + optional double o_double = 16; + optional double o_double_str = 17; + optional string o_string = 18; + optional bytes o_bytes = 19; } // Test message for holding special non-finites primitives. message NonFinites { - optional float f_nan = 1; - optional float f_pinf = 2; - optional float f_ninf = 3; - optional double d_nan = 4; + optional float f_nan = 1; + optional float f_pinf = 2; + optional float f_ninf = 3; + optional double d_nan = 4; optional double d_pinf = 5; optional double d_ninf = 6; } // Test message for holding repeated primitives. message Repeats { - repeated bool r_bool = 1; - repeated int32 r_int32 = 2; - repeated int64 r_int64 = 3; - repeated uint32 r_uint32 = 4; - repeated uint64 r_uint64 = 5; - repeated sint32 r_sint32 = 6; - repeated sint64 r_sint64 = 7; - repeated float r_float = 8; - repeated double r_double = 9; - repeated string r_string = 10; - repeated bytes r_bytes = 11; + repeated bool r_bool = 1; + repeated int32 r_int32 = 2; + repeated int64 r_int64 = 3; + repeated uint32 r_uint32 = 4; + repeated uint64 r_uint64 = 5; + repeated sint32 r_sint32 = 6; + repeated sint64 r_sint64 = 7; + repeated float r_float = 8; + repeated double r_double = 9; + repeated string r_string = 10; + repeated bytes r_bytes = 11; } // Test message for holding enums and nested messages. message Widget { - enum Color { - RED = 0; - GREEN = 1; - BLUE = 2; - }; - optional Color color = 1; - repeated Color r_color = 2; - - optional Simple simple = 10; - repeated Simple r_simple = 11; - - optional Repeats repeats = 20; - repeated Repeats r_repeats = 21; + enum Color { + RED = 0; + GREEN = 1; + BLUE = 2; + }; + optional Color color = 1; + repeated Color r_color = 2; + + optional Simple simple = 10; + repeated Simple r_simple = 11; + + optional Repeats repeats = 20; + repeated Repeats r_repeats = 21; } message Maps { - map m_int64_str = 1; - map m_bool_simple = 2; + map m_int64_str = 1; + map m_bool_simple = 2; } message MsgWithOneof { - oneof union { - string title = 1; - int64 salary = 2; - string Country = 3; - string home_address = 4; - MsgWithRequired msg_with_required = 5; - } + oneof union { + string title = 1; + int64 salary = 2; + string Country = 3; + string home_address = 4; + MsgWithRequired msg_with_required = 5; + } } message Real { - optional double value = 1; - extensions 100 to max; + optional double value = 1; + extensions 100 to max; } extend Real { - optional string name = 124; + optional string name = 124; } message Complex { - extend Real { - optional Complex real_extension = 123; - } - optional double imaginary = 1; - extensions 100 to max; + extend Real { + optional Complex real_extension = 123; + } + optional double imaginary = 1; + extensions 100 to max; } message KnownTypes { - optional google.protobuf.Any an = 14; - optional google.protobuf.Duration dur = 1; - optional google.protobuf.Struct st = 12; - optional google.protobuf.Timestamp ts = 2; - optional google.protobuf.ListValue lv = 15; - optional google.protobuf.Value val = 16; - - optional google.protobuf.DoubleValue dbl = 3; - optional google.protobuf.FloatValue flt = 4; - optional google.protobuf.Int64Value i64 = 5; - optional google.protobuf.UInt64Value u64 = 6; - optional google.protobuf.Int32Value i32 = 7; - optional google.protobuf.UInt32Value u32 = 8; - optional google.protobuf.BoolValue bool = 9; - optional google.protobuf.StringValue str = 10; - optional google.protobuf.BytesValue bytes = 11; + optional google.protobuf.Any an = 14; + optional google.protobuf.Duration dur = 1; + optional google.protobuf.Struct st = 12; + optional google.protobuf.Timestamp ts = 2; + optional google.protobuf.ListValue lv = 15; + optional google.protobuf.Value val = 16; + + optional google.protobuf.DoubleValue dbl = 3; + optional google.protobuf.FloatValue flt = 4; + optional google.protobuf.Int64Value i64 = 5; + optional google.protobuf.UInt64Value u64 = 6; + optional google.protobuf.Int32Value i32 = 7; + optional google.protobuf.UInt32Value u32 = 8; + optional google.protobuf.BoolValue bool = 9; + optional google.protobuf.StringValue str = 10; + optional google.protobuf.BytesValue bytes = 11; } // Test messages for marshaling/unmarshaling required fields. message MsgWithRequired { - required string str = 1; + required string str = 1; } message MsgWithIndirectRequired { - optional MsgWithRequired subm = 1; - map map_field = 2; - repeated MsgWithRequired slice_field = 3; + optional MsgWithRequired subm = 1; + map map_field = 2; + repeated MsgWithRequired slice_field = 3; } message MsgWithRequiredBytes { - required bytes byts = 1; + required bytes byts = 1; } message MsgWithRequiredWKT { - required google.protobuf.StringValue str = 1; + required google.protobuf.StringValue str = 1; } extend Real { - optional MsgWithRequired extm = 125; + optional MsgWithRequired extm = 125; } diff --git a/types/jsonpb/jsonpb_proto/test3.pb.go b/types/jsonpb/jsonpb_proto/test3.pb.go index cb9a814112..11c1ac61e2 100644 --- a/types/jsonpb/jsonpb_proto/test3.pb.go +++ b/types/jsonpb/jsonpb_proto/test3.pb.go @@ -5,8 +5,9 @@ package jsonpb_proto import ( fmt "fmt" - proto "github.com/golang/protobuf/proto" math "math" + + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/types/jsonpb/jsonpb_proto/test3.proto b/types/jsonpb/jsonpb_proto/test3.proto index c7ddd11f67..85c534162d 100644 --- a/types/jsonpb/jsonpb_proto/test3.proto +++ b/types/jsonpb/jsonpb_proto/test3.proto @@ -9,36 +9,36 @@ option go_package = "github.com/33cn/chain33/types/jsonpb/jsonpb_proto"; package jsonpb_test; message Simple3 { - double dub = 1; + double dub = 1; } message SimpleSlice3 { - repeated string slices = 1; + repeated string slices = 1; } message SimpleMap3 { - map stringy = 1; + map stringy = 1; } message SimpleNull3 { - Simple3 simple = 1; + Simple3 simple = 1; } enum Numeral { - UNKNOWN = 0; - ARABIC = 1; - ROMAN = 2; + UNKNOWN = 0; + ARABIC = 1; + ROMAN = 2; } message Mappy { - map nummy = 1; - map strry = 2; - map objjy = 3; - map buggy = 4; - map booly = 5; - map enumy = 6; - map s32booly = 7; - map s64booly = 8; - map u32booly = 9; - map u64booly = 10; + map nummy = 1; + map strry = 2; + map objjy = 3; + map buggy = 4; + map booly = 5; + map enumy = 6; + map s32booly = 7; + map s64booly = 8; + map u32booly = 9; + map u64booly = 10; } diff --git a/types/jsonpb/proto2_proto/test.pb.go b/types/jsonpb/proto2_proto/test.pb.go index cd202f971f..b8b0f292d0 100644 --- a/types/jsonpb/proto2_proto/test.pb.go +++ b/types/jsonpb/proto2_proto/test.pb.go @@ -5,8 +5,9 @@ package proto2_proto import ( fmt "fmt" - proto "github.com/golang/protobuf/proto" math "math" + + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/types/jsonpb/proto2_proto/test.proto b/types/jsonpb/proto2_proto/test.proto index 900dabbfc5..392942da10 100644 --- a/types/jsonpb/proto2_proto/test.proto +++ b/types/jsonpb/proto2_proto/test.proto @@ -13,473 +13,472 @@ package proto2_test; enum FOO { FOO1 = 1; }; message GoEnum { - required FOO foo = 1; + required FOO foo = 1; } message GoTestField { - required string Label = 1; - required string Type = 2; + required string Label = 1; + required string Type = 2; } message GoTest { - // An enum, for completeness. - enum KIND { - VOID = 0; - - // Basic types - BOOL = 1; - BYTES = 2; - FINGERPRINT = 3; - FLOAT = 4; - INT = 5; - STRING = 6; - TIME = 7; - - // Groupings - TUPLE = 8; - ARRAY = 9; - MAP = 10; - - // Table types - TABLE = 11; - - // Functions - FUNCTION = 12; // last tag - }; - - // Some typical parameters - required KIND Kind = 1; - optional string Table = 2; - optional int32 Param = 3; - - // Required, repeated and optional foreign fields. - required GoTestField RequiredField = 4; - repeated GoTestField RepeatedField = 5; - optional GoTestField OptionalField = 6; - - // Required fields of all basic types - required bool F_Bool_required = 10; - required int32 F_Int32_required = 11; - required int64 F_Int64_required = 12; - required fixed32 F_Fixed32_required = 13; - required fixed64 F_Fixed64_required = 14; - required uint32 F_Uint32_required = 15; - required uint64 F_Uint64_required = 16; - required float F_Float_required = 17; - required double F_Double_required = 18; - required string F_String_required = 19; - required bytes F_Bytes_required = 101; - required sint32 F_Sint32_required = 102; - required sint64 F_Sint64_required = 103; - required sfixed32 F_Sfixed32_required = 104; - required sfixed64 F_Sfixed64_required = 105; - - // Repeated fields of all basic types - repeated bool F_Bool_repeated = 20; - repeated int32 F_Int32_repeated = 21; - repeated int64 F_Int64_repeated = 22; - repeated fixed32 F_Fixed32_repeated = 23; - repeated fixed64 F_Fixed64_repeated = 24; - repeated uint32 F_Uint32_repeated = 25; - repeated uint64 F_Uint64_repeated = 26; - repeated float F_Float_repeated = 27; - repeated double F_Double_repeated = 28; - repeated string F_String_repeated = 29; - repeated bytes F_Bytes_repeated = 201; - repeated sint32 F_Sint32_repeated = 202; - repeated sint64 F_Sint64_repeated = 203; - repeated sfixed32 F_Sfixed32_repeated = 204; - repeated sfixed64 F_Sfixed64_repeated = 205; - - // Optional fields of all basic types - optional bool F_Bool_optional = 30; - optional int32 F_Int32_optional = 31; - optional int64 F_Int64_optional = 32; - optional fixed32 F_Fixed32_optional = 33; - optional fixed64 F_Fixed64_optional = 34; - optional uint32 F_Uint32_optional = 35; - optional uint64 F_Uint64_optional = 36; - optional float F_Float_optional = 37; - optional double F_Double_optional = 38; - optional string F_String_optional = 39; - optional bytes F_Bytes_optional = 301; - optional sint32 F_Sint32_optional = 302; - optional sint64 F_Sint64_optional = 303; - optional sfixed32 F_Sfixed32_optional = 304; - optional sfixed64 F_Sfixed64_optional = 305; - - // Default-valued fields of all basic types - optional bool F_Bool_defaulted = 40 [default=true]; - optional int32 F_Int32_defaulted = 41 [default=32]; - optional int64 F_Int64_defaulted = 42 [default=64]; - optional fixed32 F_Fixed32_defaulted = 43 [default=320]; - optional fixed64 F_Fixed64_defaulted = 44 [default=640]; - optional uint32 F_Uint32_defaulted = 45 [default=3200]; - optional uint64 F_Uint64_defaulted = 46 [default=6400]; - optional float F_Float_defaulted = 47 [default=314159.]; - optional double F_Double_defaulted = 48 [default=271828.]; - optional string F_String_defaulted = 49 [default="hello, \"world!\"\n"]; - optional bytes F_Bytes_defaulted = 401 [default="Bignose"]; - optional sint32 F_Sint32_defaulted = 402 [default = -32]; - optional sint64 F_Sint64_defaulted = 403 [default = -64]; - optional sfixed32 F_Sfixed32_defaulted = 404 [default = -32]; - optional sfixed64 F_Sfixed64_defaulted = 405 [default = -64]; - - // Packed repeated fields (no string or bytes). - repeated bool F_Bool_repeated_packed = 50 [packed=true]; - repeated int32 F_Int32_repeated_packed = 51 [packed=true]; - repeated int64 F_Int64_repeated_packed = 52 [packed=true]; - repeated fixed32 F_Fixed32_repeated_packed = 53 [packed=true]; - repeated fixed64 F_Fixed64_repeated_packed = 54 [packed=true]; - repeated uint32 F_Uint32_repeated_packed = 55 [packed=true]; - repeated uint64 F_Uint64_repeated_packed = 56 [packed=true]; - repeated float F_Float_repeated_packed = 57 [packed=true]; - repeated double F_Double_repeated_packed = 58 [packed=true]; - repeated sint32 F_Sint32_repeated_packed = 502 [packed=true]; - repeated sint64 F_Sint64_repeated_packed = 503 [packed=true]; - repeated sfixed32 F_Sfixed32_repeated_packed = 504 [packed=true]; - repeated sfixed64 F_Sfixed64_repeated_packed = 505 [packed=true]; - - // Required, repeated, and optional groups. - required group RequiredGroup = 70 { - required string RequiredField = 71; - }; - - repeated group RepeatedGroup = 80 { - required string RequiredField = 81; - }; - - optional group OptionalGroup = 90 { - required string RequiredField = 91; - }; + // An enum, for completeness. + enum KIND { + VOID = 0; + + // Basic types + BOOL = 1; + BYTES = 2; + FINGERPRINT = 3; + FLOAT = 4; + INT = 5; + STRING = 6; + TIME = 7; + + // Groupings + TUPLE = 8; + ARRAY = 9; + MAP = 10; + + // Table types + TABLE = 11; + + // Functions + FUNCTION = 12; // last tag + }; + + // Some typical parameters + required KIND Kind = 1; + optional string Table = 2; + optional int32 Param = 3; + + // Required, repeated and optional foreign fields. + required GoTestField RequiredField = 4; + repeated GoTestField RepeatedField = 5; + optional GoTestField OptionalField = 6; + + // Required fields of all basic types + required bool F_Bool_required = 10; + required int32 F_Int32_required = 11; + required int64 F_Int64_required = 12; + required fixed32 F_Fixed32_required = 13; + required fixed64 F_Fixed64_required = 14; + required uint32 F_Uint32_required = 15; + required uint64 F_Uint64_required = 16; + required float F_Float_required = 17; + required double F_Double_required = 18; + required string F_String_required = 19; + required bytes F_Bytes_required = 101; + required sint32 F_Sint32_required = 102; + required sint64 F_Sint64_required = 103; + required sfixed32 F_Sfixed32_required = 104; + required sfixed64 F_Sfixed64_required = 105; + + // Repeated fields of all basic types + repeated bool F_Bool_repeated = 20; + repeated int32 F_Int32_repeated = 21; + repeated int64 F_Int64_repeated = 22; + repeated fixed32 F_Fixed32_repeated = 23; + repeated fixed64 F_Fixed64_repeated = 24; + repeated uint32 F_Uint32_repeated = 25; + repeated uint64 F_Uint64_repeated = 26; + repeated float F_Float_repeated = 27; + repeated double F_Double_repeated = 28; + repeated string F_String_repeated = 29; + repeated bytes F_Bytes_repeated = 201; + repeated sint32 F_Sint32_repeated = 202; + repeated sint64 F_Sint64_repeated = 203; + repeated sfixed32 F_Sfixed32_repeated = 204; + repeated sfixed64 F_Sfixed64_repeated = 205; + + // Optional fields of all basic types + optional bool F_Bool_optional = 30; + optional int32 F_Int32_optional = 31; + optional int64 F_Int64_optional = 32; + optional fixed32 F_Fixed32_optional = 33; + optional fixed64 F_Fixed64_optional = 34; + optional uint32 F_Uint32_optional = 35; + optional uint64 F_Uint64_optional = 36; + optional float F_Float_optional = 37; + optional double F_Double_optional = 38; + optional string F_String_optional = 39; + optional bytes F_Bytes_optional = 301; + optional sint32 F_Sint32_optional = 302; + optional sint64 F_Sint64_optional = 303; + optional sfixed32 F_Sfixed32_optional = 304; + optional sfixed64 F_Sfixed64_optional = 305; + + // Default-valued fields of all basic types + optional bool F_Bool_defaulted = 40 [ default = true ]; + optional int32 F_Int32_defaulted = 41 [ default = 32 ]; + optional int64 F_Int64_defaulted = 42 [ default = 64 ]; + optional fixed32 F_Fixed32_defaulted = 43 [ default = 320 ]; + optional fixed64 F_Fixed64_defaulted = 44 [ default = 640 ]; + optional uint32 F_Uint32_defaulted = 45 [ default = 3200 ]; + optional uint64 F_Uint64_defaulted = 46 [ default = 6400 ]; + optional float F_Float_defaulted = 47 [ default = 314159. ]; + optional double F_Double_defaulted = 48 [ default = 271828. ]; + optional string F_String_defaulted = 49 [ default = "hello, \"world!\"\n" ]; + optional bytes F_Bytes_defaulted = 401 [ default = "Bignose" ]; + optional sint32 F_Sint32_defaulted = 402 [ default = -32 ]; + optional sint64 F_Sint64_defaulted = 403 [ default = -64 ]; + optional sfixed32 F_Sfixed32_defaulted = 404 [ default = -32 ]; + optional sfixed64 F_Sfixed64_defaulted = 405 [ default = -64 ]; + + // Packed repeated fields (no string or bytes). + repeated bool F_Bool_repeated_packed = 50 [ packed = true ]; + repeated int32 F_Int32_repeated_packed = 51 [ packed = true ]; + repeated int64 F_Int64_repeated_packed = 52 [ packed = true ]; + repeated fixed32 F_Fixed32_repeated_packed = 53 [ packed = true ]; + repeated fixed64 F_Fixed64_repeated_packed = 54 [ packed = true ]; + repeated uint32 F_Uint32_repeated_packed = 55 [ packed = true ]; + repeated uint64 F_Uint64_repeated_packed = 56 [ packed = true ]; + repeated float F_Float_repeated_packed = 57 [ packed = true ]; + repeated double F_Double_repeated_packed = 58 [ packed = true ]; + repeated sint32 F_Sint32_repeated_packed = 502 [ packed = true ]; + repeated sint64 F_Sint64_repeated_packed = 503 [ packed = true ]; + repeated sfixed32 F_Sfixed32_repeated_packed = 504 [ packed = true ]; + repeated sfixed64 F_Sfixed64_repeated_packed = 505 [ packed = true ]; + + // Required, repeated, and optional groups. + required group RequiredGroup = 70 { + required string RequiredField = 71; + }; + + repeated group RepeatedGroup = 80 { + required string RequiredField = 81; + }; + + optional group OptionalGroup = 90 { + required string RequiredField = 91; + }; } // For testing a group containing a required field. message GoTestRequiredGroupField { - required group Group = 1 { - required int32 Field = 2; - }; + required group Group = 1 { + required int32 Field = 2; + }; } // For testing skipping of unrecognized fields. // Numbers are all big, larger than tag numbers in GoTestField, // the message used in the corresponding test. message GoSkipTest { - required int32 skip_int32 = 11; - required fixed32 skip_fixed32 = 12; - required fixed64 skip_fixed64 = 13; - required string skip_string = 14; - required group SkipGroup = 15 { - required int32 group_int32 = 16; - required string group_string = 17; - } + required int32 skip_int32 = 11; + required fixed32 skip_fixed32 = 12; + required fixed64 skip_fixed64 = 13; + required string skip_string = 14; + required group SkipGroup = 15 { + required int32 group_int32 = 16; + required string group_string = 17; + } } // For testing packed/non-packed decoder switching. // A serialized instance of one should be deserializable as the other. message NonPackedTest { - repeated int32 a = 1; + repeated int32 a = 1; } message PackedTest { - repeated int32 b = 1 [packed=true]; + repeated int32 b = 1 [ packed = true ]; } message MaxTag { - // Maximum possible tag number. - optional string last_field = 536870911; + // Maximum possible tag number. + optional string last_field = 536870911; } message OldMessage { - message Nested { - optional string name = 1; - } - optional Nested nested = 1; + message Nested { + optional string name = 1; + } + optional Nested nested = 1; - optional int32 num = 2; + optional int32 num = 2; } // NewMessage is wire compatible with OldMessage; // imagine it as a future version. message NewMessage { - message Nested { - optional string name = 1; - optional string food_group = 2; - } - optional Nested nested = 1; + message Nested { + optional string name = 1; + optional string food_group = 2; + } + optional Nested nested = 1; - // This is an int32 in OldMessage. - optional int64 num = 2; + // This is an int32 in OldMessage. + optional int64 num = 2; } // Smaller tests for ASCII formatting. message InnerMessage { - required string host = 1; - optional int32 port = 2 [default=4000]; - optional bool connected = 3; + required string host = 1; + optional int32 port = 2 [ default = 4000 ]; + optional bool connected = 3; } message OtherMessage { - optional int64 key = 1; - optional bytes value = 2; - optional float weight = 3; - optional InnerMessage inner = 4; + optional int64 key = 1; + optional bytes value = 2; + optional float weight = 3; + optional InnerMessage inner = 4; - extensions 100 to max; + extensions 100 to max; } message RequiredInnerMessage { - required InnerMessage leo_finally_won_an_oscar = 1; + required InnerMessage leo_finally_won_an_oscar = 1; } message MyMessage { - required int32 count = 1; - optional string name = 2; - optional string quote = 3; - repeated string pet = 4; - optional InnerMessage inner = 5; - repeated OtherMessage others = 6; - optional RequiredInnerMessage we_must_go_deeper = 13; - repeated InnerMessage rep_inner = 12; - - enum Color { - RED = 0; - GREEN = 1; - BLUE = 2; - }; - optional Color bikeshed = 7; - - optional group SomeGroup = 8 { - optional int32 group_field = 9; - } + required int32 count = 1; + optional string name = 2; + optional string quote = 3; + repeated string pet = 4; + optional InnerMessage inner = 5; + repeated OtherMessage others = 6; + optional RequiredInnerMessage we_must_go_deeper = 13; + repeated InnerMessage rep_inner = 12; + + enum Color { + RED = 0; + GREEN = 1; + BLUE = 2; + }; + optional Color bikeshed = 7; + + optional group SomeGroup = 8 { + optional int32 group_field = 9; + } - // This field becomes [][]byte in the generated code. - repeated bytes rep_bytes = 10; + // This field becomes [][]byte in the generated code. + repeated bytes rep_bytes = 10; - optional double bigfloat = 11; + optional double bigfloat = 11; - extensions 100 to max; + extensions 100 to max; } message Ext { - extend MyMessage { - optional Ext more = 103; - optional string text = 104; - optional int32 number = 105; - } + extend MyMessage { + optional Ext more = 103; + optional string text = 104; + optional int32 number = 105; + } - optional string data = 1; - map map_field = 2; + optional string data = 1; + map map_field = 2; } extend MyMessage { - repeated string greeting = 106; - // leave field 200 unregistered for testing + repeated string greeting = 106; + // leave field 200 unregistered for testing } message ComplexExtension { - optional int32 first = 1; - optional int32 second = 2; - repeated int32 third = 3; + optional int32 first = 1; + optional int32 second = 2; + repeated int32 third = 3; } extend OtherMessage { - optional ComplexExtension complex = 200; - repeated ComplexExtension r_complex = 201; + optional ComplexExtension complex = 200; + repeated ComplexExtension r_complex = 201; } message DefaultsMessage { - enum DefaultsEnum { - ZERO = 0; - ONE = 1; - TWO = 2; - }; - extensions 100 to max; + enum DefaultsEnum { + ZERO = 0; + ONE = 1; + TWO = 2; + }; + extensions 100 to max; } extend DefaultsMessage { - optional double no_default_double = 101; - optional float no_default_float = 102; - optional int32 no_default_int32 = 103; - optional int64 no_default_int64 = 104; - optional uint32 no_default_uint32 = 105; - optional uint64 no_default_uint64 = 106; - optional sint32 no_default_sint32 = 107; - optional sint64 no_default_sint64 = 108; - optional fixed32 no_default_fixed32 = 109; - optional fixed64 no_default_fixed64 = 110; - optional sfixed32 no_default_sfixed32 = 111; - optional sfixed64 no_default_sfixed64 = 112; - optional bool no_default_bool = 113; - optional string no_default_string = 114; - optional bytes no_default_bytes = 115; - optional DefaultsMessage.DefaultsEnum no_default_enum = 116; - - optional double default_double = 201 [default = 3.1415]; - optional float default_float = 202 [default = 3.14]; - optional int32 default_int32 = 203 [default = 42]; - optional int64 default_int64 = 204 [default = 43]; - optional uint32 default_uint32 = 205 [default = 44]; - optional uint64 default_uint64 = 206 [default = 45]; - optional sint32 default_sint32 = 207 [default = 46]; - optional sint64 default_sint64 = 208 [default = 47]; - optional fixed32 default_fixed32 = 209 [default = 48]; - optional fixed64 default_fixed64 = 210 [default = 49]; - optional sfixed32 default_sfixed32 = 211 [default = 50]; - optional sfixed64 default_sfixed64 = 212 [default = 51]; - optional bool default_bool = 213 [default = true]; - optional string default_string = 214 [default = "Hello, string,def=foo"]; - optional bytes default_bytes = 215 [default = "Hello, bytes"]; - optional DefaultsMessage.DefaultsEnum default_enum = 216 [default = ONE]; -} - -message Empty { -} + optional double no_default_double = 101; + optional float no_default_float = 102; + optional int32 no_default_int32 = 103; + optional int64 no_default_int64 = 104; + optional uint32 no_default_uint32 = 105; + optional uint64 no_default_uint64 = 106; + optional sint32 no_default_sint32 = 107; + optional sint64 no_default_sint64 = 108; + optional fixed32 no_default_fixed32 = 109; + optional fixed64 no_default_fixed64 = 110; + optional sfixed32 no_default_sfixed32 = 111; + optional sfixed64 no_default_sfixed64 = 112; + optional bool no_default_bool = 113; + optional string no_default_string = 114; + optional bytes no_default_bytes = 115; + optional DefaultsMessage.DefaultsEnum no_default_enum = 116; + + optional double default_double = 201 [ default = 3.1415 ]; + optional float default_float = 202 [ default = 3.14 ]; + optional int32 default_int32 = 203 [ default = 42 ]; + optional int64 default_int64 = 204 [ default = 43 ]; + optional uint32 default_uint32 = 205 [ default = 44 ]; + optional uint64 default_uint64 = 206 [ default = 45 ]; + optional sint32 default_sint32 = 207 [ default = 46 ]; + optional sint64 default_sint64 = 208 [ default = 47 ]; + optional fixed32 default_fixed32 = 209 [ default = 48 ]; + optional fixed64 default_fixed64 = 210 [ default = 49 ]; + optional sfixed32 default_sfixed32 = 211 [ default = 50 ]; + optional sfixed64 default_sfixed64 = 212 [ default = 51 ]; + optional bool default_bool = 213 [ default = true ]; + optional string default_string = 214 [ default = "Hello, string,def=foo" ]; + optional bytes default_bytes = 215 [ default = "Hello, bytes" ]; + optional DefaultsMessage.DefaultsEnum default_enum = 216 [ default = ONE ]; +} + +message Empty {} message MessageList { - repeated group Message = 1 { - required string name = 2; - required int32 count = 3; - } + repeated group Message = 1 { + required string name = 2; + required int32 count = 3; + } } message Strings { - optional string string_field = 1; - optional bytes bytes_field = 2; + optional string string_field = 1; + optional bytes bytes_field = 2; } message Defaults { - enum Color { - RED = 0; - GREEN = 1; - BLUE = 2; - } - - // Default-valued fields of all basic types. - // Same as GoTest, but copied here to make testing easier. - optional bool F_Bool = 1 [default=true]; - optional int32 F_Int32 = 2 [default=32]; - optional int64 F_Int64 = 3 [default=64]; - optional fixed32 F_Fixed32 = 4 [default=320]; - optional fixed64 F_Fixed64 = 5 [default=640]; - optional uint32 F_Uint32 = 6 [default=3200]; - optional uint64 F_Uint64 = 7 [default=6400]; - optional float F_Float = 8 [default=314159.]; - optional double F_Double = 9 [default=271828.]; - optional string F_String = 10 [default="hello, \"world!\"\n"]; - optional bytes F_Bytes = 11 [default="Bignose"]; - optional sint32 F_Sint32 = 12 [default=-32]; - optional sint64 F_Sint64 = 13 [default=-64]; - optional Color F_Enum = 14 [default=GREEN]; - - // More fields with crazy defaults. - optional float F_Pinf = 15 [default=inf]; - optional float F_Ninf = 16 [default=-inf]; - optional float F_Nan = 17 [default=nan]; - - // Sub-message. - optional SubDefaults sub = 18; - - // Redundant but explicit defaults. - optional string str_zero = 19 [default=""]; + enum Color { + RED = 0; + GREEN = 1; + BLUE = 2; + } + + // Default-valued fields of all basic types. + // Same as GoTest, but copied here to make testing easier. + optional bool F_Bool = 1 [ default = true ]; + optional int32 F_Int32 = 2 [ default = 32 ]; + optional int64 F_Int64 = 3 [ default = 64 ]; + optional fixed32 F_Fixed32 = 4 [ default = 320 ]; + optional fixed64 F_Fixed64 = 5 [ default = 640 ]; + optional uint32 F_Uint32 = 6 [ default = 3200 ]; + optional uint64 F_Uint64 = 7 [ default = 6400 ]; + optional float F_Float = 8 [ default = 314159. ]; + optional double F_Double = 9 [ default = 271828. ]; + optional string F_String = 10 [ default = "hello, \"world!\"\n" ]; + optional bytes F_Bytes = 11 [ default = "Bignose" ]; + optional sint32 F_Sint32 = 12 [ default = -32 ]; + optional sint64 F_Sint64 = 13 [ default = -64 ]; + optional Color F_Enum = 14 [ default = GREEN ]; + + // More fields with crazy defaults. + optional float F_Pinf = 15 [ default = inf ]; + optional float F_Ninf = 16 [ default = -inf ]; + optional float F_Nan = 17 [ default = nan ]; + + // Sub-message. + optional SubDefaults sub = 18; + + // Redundant but explicit defaults. + optional string str_zero = 19 [ default = "" ]; } message SubDefaults { - optional int64 n = 1 [default=7]; + optional int64 n = 1 [ default = 7 ]; } message RepeatedEnum { - enum Color { - RED = 1; - } - repeated Color color = 1; + enum Color { RED = 1; } + repeated Color color = 1; } message MoreRepeated { - repeated bool bools = 1; - repeated bool bools_packed = 2 [packed=true]; - repeated int32 ints = 3; - repeated int32 ints_packed = 4 [packed=true]; - repeated int64 int64s_packed = 7 [packed=true]; - repeated string strings = 5; - repeated fixed32 fixeds = 6; + repeated bool bools = 1; + repeated bool bools_packed = 2 [ packed = true ]; + repeated int32 ints = 3; + repeated int32 ints_packed = 4 [ packed = true ]; + repeated int64 int64s_packed = 7 [ packed = true ]; + repeated string strings = 5; + repeated fixed32 fixeds = 6; } // GroupOld and GroupNew have the same wire format. // GroupNew has a new field inside a group. message GroupOld { - optional group G = 101 { - optional int32 x = 2; - } + optional group G = 101 { + optional int32 x = 2; + } } message GroupNew { - optional group G = 101 { - optional int32 x = 2; - optional int32 y = 3; - } + optional group G = 101 { + optional int32 x = 2; + optional int32 y = 3; + } } message FloatingPoint { - required double f = 1; - optional bool exact = 2; + required double f = 1; + optional bool exact = 2; } message MessageWithMap { - map name_mapping = 1; - map msg_mapping = 2; - map byte_mapping = 3; - map str_to_str = 4; + map name_mapping = 1; + map msg_mapping = 2; + map byte_mapping = 3; + map str_to_str = 4; } message Oneof { - oneof union { - bool F_Bool = 1; - int32 F_Int32 = 2; - int64 F_Int64 = 3; - fixed32 F_Fixed32 = 4; - fixed64 F_Fixed64 = 5; - uint32 F_Uint32 = 6; - uint64 F_Uint64 = 7; - float F_Float = 8; - double F_Double = 9; - string F_String = 10; - bytes F_Bytes = 11; - sint32 F_Sint32 = 12; - sint64 F_Sint64 = 13; - MyMessage.Color F_Enum = 14; - GoTestField F_Message = 15; - group F_Group = 16 { - optional int32 x = 17; + oneof union { + bool F_Bool = 1; + int32 F_Int32 = 2; + int64 F_Int64 = 3; + fixed32 F_Fixed32 = 4; + fixed64 F_Fixed64 = 5; + uint32 F_Uint32 = 6; + uint64 F_Uint64 = 7; + float F_Float = 8; + double F_Double = 9; + string F_String = 10; + bytes F_Bytes = 11; + sint32 F_Sint32 = 12; + sint64 F_Sint64 = 13; + MyMessage.Color F_Enum = 14; + GoTestField F_Message = 15; + group F_Group = 16 { + optional int32 x = 17; + } + int32 F_Largest_Tag = 536870911; } - int32 F_Largest_Tag = 536870911; - } - oneof tormato { - int32 value = 100; - } + oneof tormato { + int32 value = 100; + } } message Communique { - optional bool make_me_cry = 1; - - // This is a oneof, called "union". - oneof union { - int32 number = 5; - string name = 6; - bytes data = 7; - double temp_c = 8; - MyMessage.Color col = 9; - Strings msg = 10; - } + optional bool make_me_cry = 1; + + // This is a oneof, called "union". + oneof union { + int32 number = 5; + string name = 6; + bytes data = 7; + double temp_c = 8; + MyMessage.Color col = 9; + Strings msg = 10; + } } message TestUTF8 { - optional string scalar = 1; - repeated string vector = 2; - oneof oneof { string field = 3; } - map map_key = 4; - map map_value = 5; + optional string scalar = 1; + repeated string vector = 2; + oneof oneof { + string field = 3; + } + map map_key = 4; + map map_value = 5; } diff --git a/types/jsonpb/proto3_proto/test.pb.go b/types/jsonpb/proto3_proto/test.pb.go index 2175bc5925..6878752e16 100644 --- a/types/jsonpb/proto3_proto/test.pb.go +++ b/types/jsonpb/proto3_proto/test.pb.go @@ -5,10 +5,11 @@ package proto3_proto import ( fmt "fmt" + math "math" + proto2_proto "github.com/33cn/chain33/types/jsonpb/proto2_proto" proto "github.com/golang/protobuf/proto" anypb "google.golang.org/protobuf/types/known/anypb" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/types/jsonpb/proto3_proto/test.proto b/types/jsonpb/proto3_proto/test.proto index f5b7ddae87..fc7b38755f 100644 --- a/types/jsonpb/proto3_proto/test.proto +++ b/types/jsonpb/proto3_proto/test.proto @@ -12,61 +12,62 @@ import "proto2_proto/test.proto"; package proto3_test; message Message { - enum Humour { - UNKNOWN = 0; - PUNS = 1; - SLAPSTICK = 2; - BILL_BAILEY = 3; - } - - string name = 1; - Humour hilarity = 2; - uint32 height_in_cm = 3; - bytes data = 4; - int64 result_count = 7; - bool true_scotsman = 8; - float score = 9; - - repeated uint64 key = 5; - repeated int32 short_key = 19; - Nested nested = 6; - repeated Humour r_funny = 16; - - map terrain = 10; - proto2_test.SubDefaults proto2_field = 11; - map proto2_value = 13; - - google.protobuf.Any anything = 14; - repeated google.protobuf.Any many_things = 15; - - Message submessage = 17; - repeated Message children = 18; - - map string_map = 20; + enum Humour { + UNKNOWN = 0; + PUNS = 1; + SLAPSTICK = 2; + BILL_BAILEY = 3; + } + + string name = 1; + Humour hilarity = 2; + uint32 height_in_cm = 3; + bytes data = 4; + int64 result_count = 7; + bool true_scotsman = 8; + float score = 9; + + repeated uint64 key = 5; + repeated int32 short_key = 19; + Nested nested = 6; + repeated Humour r_funny = 16; + + map terrain = 10; + proto2_test.SubDefaults proto2_field = 11; + map proto2_value = 13; + + google.protobuf.Any anything = 14; + repeated google.protobuf.Any many_things = 15; + + Message submessage = 17; + repeated Message children = 18; + + map string_map = 20; } message Nested { - string bunny = 1; - bool cute = 2; + string bunny = 1; + bool cute = 2; } message MessageWithMap { - map byte_mapping = 1; + map byte_mapping = 1; } - message IntMap { - map rtt = 1; + map rtt = 1; } message IntMaps { - repeated IntMap maps = 1; + repeated IntMap maps = 1; } message TestUTF8 { - string scalar = 1; - repeated string vector = 2; - oneof oneof { string field = 3; } - map map_key = 4; - map map_value = 5; + string scalar = 1; + repeated string vector = 2; + oneof oneof { + string field = 3; + } + map map_key = 4; + map map_value = 5; } diff --git a/types/jsonpb/regenerate.sh b/types/jsonpb/regenerate.sh index 332eb08484..1c55860332 100755 --- a/types/jsonpb/regenerate.sh +++ b/types/jsonpb/regenerate.sh @@ -13,8 +13,8 @@ # protoc-gen-go: v1.3.2 for X in $(find . -name "*.proto" | sed "s|^\./||"); do - # shellcheck disable=SC2046 - protoc -I$(pwd) --go_out=paths=source_relative:. "$X" + # shellcheck disable=SC2046 + protoc -I$(pwd) --go_out=paths=source_relative:. "$X" done -# migrate from https://github.com/golang/protobuf/tree/v1.4.3/jsonpb \ No newline at end of file +# migrate from https://github.com/golang/protobuf/tree/v1.4.3/jsonpb