From e7724cd69690440f2cdbddaa05ee20eb8743f83f Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Tue, 2 Aug 2022 09:31:14 -0400 Subject: [PATCH 1/8] Bump Prost version to v0.11 Signed-off-by: Thane Thomson --- abci/Cargo.toml | 2 +- p2p/Cargo.toml | 4 ++-- proto/Cargo.toml | 4 ++-- tendermint/Cargo.toml | 4 ++-- tools/proto-compiler/Cargo.toml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/abci/Cargo.toml b/abci/Cargo.toml index ca3bddc1a..2b18b4a6a 100644 --- a/abci/Cargo.toml +++ b/abci/Cargo.toml @@ -32,7 +32,7 @@ binary = [ [dependencies] bytes = { version = "1.0", default-features = false } -prost = { version = "0.10", default-features = false } +prost = { version = "0.11", default-features = false } tendermint-proto = { version = "0.23.8", default-features = false, path = "../proto" } tracing = { version = "0.1", default-features = false } flex-error = { version = "0.4.4", default-features = false } diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml index 412d163d2..6d73d1d54 100644 --- a/p2p/Cargo.toml +++ b/p2p/Cargo.toml @@ -33,7 +33,7 @@ eyre = { version = "0.6", default-features = false } flume = { version = "0.10.7", default-features = false } hkdf = { version = "0.10.0", default-features = false } merlin = { version = "2", default-features = false } -prost = { version = "0.10", default-features = false } +prost = { version = "0.11", default-features = false } rand_core = { version = "0.5", default-features = false, features = ["std"] } sha2 = { version = "0.9", default-features = false } subtle = { version = "2", default-features = false } @@ -49,4 +49,4 @@ tendermint-proto = { path = "../proto", version = "0.23.8", default-features = f tendermint-std-ext = { path = "../std-ext", version = "0.23.8", default-features = false } # optional dependencies -prost-derive = { version = "0.10", optional = true } +prost-derive = { version = "0.11", optional = true } diff --git a/proto/Cargo.toml b/proto/Cargo.toml index a194fdefb..666658e83 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -17,8 +17,8 @@ description = """ all-features = true [dependencies] -prost = { version = "0.10", default-features = false } -prost-types = { version = "0.10", default-features = false } +prost = { version = "0.11", default-features = false } +prost-types = { version = "0.11", default-features = false } bytes = { version = "1.0", default-features = false } serde = { version = "1.0", default-features = false, features = ["derive"] } serde_bytes = { version = "0.11", default-features = false, features = ["alloc"] } diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index 406afa528..f15c09e5a 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -37,8 +37,8 @@ ed25519-dalek = { version = "1", default-features = false, features = ["u64_back futures = { version = "0.3", default-features = false } num-traits = { version = "0.2", default-features = false } once_cell = { version = "1.3", default-features = false } -prost = { version = "0.10", default-features = false } -prost-types = { version = "0.10", default-features = false } +prost = { version = "0.11", default-features = false } +prost-types = { version = "0.11", default-features = false } serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, features = ["alloc"] } serde_bytes = { version = "0.11", default-features = false } diff --git a/tools/proto-compiler/Cargo.toml b/tools/proto-compiler/Cargo.toml index b8396b0af..0ecd67907 100644 --- a/tools/proto-compiler/Cargo.toml +++ b/tools/proto-compiler/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] walkdir = { version = "2.3" } -prost-build = { version = "0.10" } +prost-build = { version = "0.11" } git2 = { version = "0.13" } tempfile = { version = "3.2.0" } subtle-encoding = { version = "0.5" } From 5d3dcf93ce80daef43d74e6fb1221750e81f947e Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Tue, 2 Aug 2022 09:34:56 -0400 Subject: [PATCH 2/8] Add changelog entry Signed-off-by: Thane Thomson --- .changelog/unreleased/dependencies/1171-update-prost-0.11.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/dependencies/1171-update-prost-0.11.md diff --git a/.changelog/unreleased/dependencies/1171-update-prost-0.11.md b/.changelog/unreleased/dependencies/1171-update-prost-0.11.md new file mode 100644 index 000000000..a92929558 --- /dev/null +++ b/.changelog/unreleased/dependencies/1171-update-prost-0.11.md @@ -0,0 +1,2 @@ +- Update Prost to v0.11 + ([#1171](https://github.com/informalsystems/tendermint-rs/pull/1171)) From a98fe863d37260cb2da63d0e7238fcf99e96ad66 Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Tue, 2 Aug 2022 10:39:55 -0400 Subject: [PATCH 3/8] Add step in generated-protos-compile job to install protoc Signed-off-by: Thane Thomson --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a6fe9718b..24e0ace0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,6 +67,11 @@ jobs: with: toolchain: stable override: true + - name: Install protoc + shell: | + curl -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_64.zip + unzip /tmp/protoc.zip -d /usr/local/bin/ + echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV - name: Regenerate proto definitions working-directory: ./tools/proto-compiler/ run: cargo run From 4401bb2a6f8e76c366764518c66df0ca86203720 Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Tue, 2 Aug 2022 10:45:05 -0400 Subject: [PATCH 4/8] shell should be run Signed-off-by: Thane Thomson --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 24e0ace0f..67cf6ecdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: toolchain: stable override: true - name: Install protoc - shell: | + run: | curl -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_64.zip unzip /tmp/protoc.zip -d /usr/local/bin/ echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV From 8ff9fc4022756fa6ebddd92633ea4d0f259dbfe8 Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Tue, 2 Aug 2022 10:47:55 -0400 Subject: [PATCH 5/8] Tell curl to follow redirects Signed-off-by: Thane Thomson --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67cf6ecdc..b1b2f2b96 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,7 +69,7 @@ jobs: override: true - name: Install protoc run: | - curl -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_64.zip + curl -Lo /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_64.zip unzip /tmp/protoc.zip -d /usr/local/bin/ echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV - name: Regenerate proto definitions From 0bc01015be01fd3bf327b02fd91cf618f5041d58 Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Tue, 2 Aug 2022 10:49:22 -0400 Subject: [PATCH 6/8] Fix protoc unzip target Signed-off-by: Thane Thomson --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1b2f2b96..d83517f04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,7 +70,7 @@ jobs: - name: Install protoc run: | curl -Lo /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_64.zip - unzip /tmp/protoc.zip -d /usr/local/bin/ + unzip /tmp/protoc.zip -d /usr/local/ echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV - name: Regenerate proto definitions working-directory: ./tools/proto-compiler/ From c17cfe8804a4737ad4381da708c1a3cb779dc5ae Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Tue, 2 Aug 2022 10:57:14 -0400 Subject: [PATCH 7/8] Install protoc to unprivileged location Signed-off-by: Thane Thomson --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d83517f04..b017ecb5d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,8 +70,9 @@ jobs: - name: Install protoc run: | curl -Lo /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.4/protoc-21.4-linux-x86_64.zip - unzip /tmp/protoc.zip -d /usr/local/ - echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV + unzip /tmp/protoc.zip -d ${HOME}/.local + echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV + export PATH="${PATH}:${HOME}/.local/bin" - name: Regenerate proto definitions working-directory: ./tools/proto-compiler/ run: cargo run From 235146375edd23d269edd4b41072888601880a4a Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Thu, 4 Aug 2022 22:34:17 -0400 Subject: [PATCH 8/8] Regenerate protos Signed-off-by: Thane Thomson --- proto/src/prost/google.protobuf.rs | 295 ++++++++++++++++-------- proto/src/prost/tendermint.abci.rs | 67 +++++- proto/src/prost/tendermint.consensus.rs | 2 +- proto/src/prost/tendermint.privval.rs | 16 ++ proto/src/prost/tendermint.rpc.grpc.rs | 4 +- proto/src/prost/tendermint.types.rs | 28 +++ 6 files changed, 308 insertions(+), 104 deletions(-) diff --git a/proto/src/prost/google.protobuf.rs b/proto/src/prost/google.protobuf.rs index 1e4f0e9ff..08397cef7 100644 --- a/proto/src/prost/google.protobuf.rs +++ b/proto/src/prost/google.protobuf.rs @@ -132,7 +132,6 @@ pub struct FieldDescriptorProto { /// For booleans, "true" or "false". /// For strings, contains the default text contents (not escaped in any way). /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. - /// TODO(kenton): Base-64 encode? #[prost(string, optional, tag="7")] pub default_value: ::core::option::Option<::prost::alloc::string::String>, /// If set, gives the index of a oneof in the containing type's oneof_decl @@ -209,6 +208,34 @@ pub mod field_descriptor_proto { /// Uses ZigZag encoding. Sint64 = 18, } + impl Type { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Type::Double => "TYPE_DOUBLE", + Type::Float => "TYPE_FLOAT", + Type::Int64 => "TYPE_INT64", + Type::Uint64 => "TYPE_UINT64", + Type::Int32 => "TYPE_INT32", + Type::Fixed64 => "TYPE_FIXED64", + Type::Fixed32 => "TYPE_FIXED32", + Type::Bool => "TYPE_BOOL", + Type::String => "TYPE_STRING", + Type::Group => "TYPE_GROUP", + Type::Message => "TYPE_MESSAGE", + Type::Bytes => "TYPE_BYTES", + Type::Uint32 => "TYPE_UINT32", + Type::Enum => "TYPE_ENUM", + Type::Sfixed32 => "TYPE_SFIXED32", + Type::Sfixed64 => "TYPE_SFIXED64", + Type::Sint32 => "TYPE_SINT32", + Type::Sint64 => "TYPE_SINT64", + } + } + } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum Label { @@ -217,6 +244,19 @@ pub mod field_descriptor_proto { Required = 2, Repeated = 3, } + impl Label { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Label::Optional => "LABEL_OPTIONAL", + Label::Required => "LABEL_REQUIRED", + Label::Repeated => "LABEL_REPEATED", + } + } + } } /// Describes a oneof. #[derive(Clone, PartialEq, ::prost::Message)] @@ -320,20 +360,20 @@ pub struct MethodDescriptorProto { // // Extension numbers for custom options may be chosen as follows: // * For options which will only be used within a single application or -// organization, or for experimental options, use field numbers 50000 -// through 99999. It is up to you to ensure that you do not use the -// same number for multiple options. +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. // * For options which will be published and used publicly by multiple -// independent entities, e-mail protobuf-global-extension-registry@google.com -// to reserve extension numbers. Simply provide your project name (e.g. -// Objective-C plugin) and your project website (if available) -- there's no -// need to explain how you intend to use them. Usually you only need one -// extension number. You can declare multiple options with only one extension -// number by putting them in a sub-message. See the Custom Options section of -// the docs for examples: -// -// If this turns out to be popular, a web service will be set up -// to automatically assign option numbers. +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Objective-C plugin) and your project website (if available) -- there's no +// need to explain how you intend to use them. Usually you only need one +// extension number. You can declare multiple options with only one extension +// number by putting them in a sub-message. See the Custom Options section of +// the docs for examples: +// +// If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. #[derive(Clone, PartialEq, ::prost::Message)] pub struct FileOptions { @@ -374,9 +414,9 @@ pub struct FileOptions { pub optimize_for: ::core::option::Option, /// Sets the Go package where structs generated from this .proto will be /// placed. If omitted, the Go package will be derived from the following: - /// - The basename of the package import path, if provided. - /// - Otherwise, the package statement in the .proto file, if present. - /// - Otherwise, the basename of the .proto file, without extension. + /// - The basename of the package import path, if provided. + /// - Otherwise, the package statement in the .proto file, if present. + /// - Otherwise, the basename of the .proto file, without extension. #[prost(string, optional, tag="11")] pub go_package: ::core::option::Option<::prost::alloc::string::String>, /// Should generic services be generated in each language? "Generic" services @@ -459,6 +499,19 @@ pub mod file_options { /// Generate code using MessageLite and the lite runtime. LiteRuntime = 3, } + impl OptimizeMode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + OptimizeMode::Speed => "SPEED", + OptimizeMode::CodeSize => "CODE_SIZE", + OptimizeMode::LiteRuntime => "LITE_RUNTIME", + } + } + } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct MessageOptions { @@ -468,10 +521,10 @@ pub struct MessageOptions { /// efficient, has fewer features, and is more complicated. /// /// The message must be defined exactly as follows: - /// message Foo { - /// option message_set_wire_format = true; - /// extensions 4 to max; - /// } + /// message Foo { + /// option message_set_wire_format = true; + /// extensions 4 to max; + /// } /// Note that the message cannot have any defined fields; MessageSets only /// have extensions. /// @@ -497,14 +550,14 @@ pub struct MessageOptions { /// maps field. /// /// For maps fields: - /// map map_field = 1; + /// map map_field = 1; /// The parsed descriptor looks like: - /// message MapFieldEntry { - /// option map_entry = true; - /// optional KeyType key = 1; - /// optional ValueType value = 2; - /// } - /// repeated MapFieldEntry map_field = 1; + /// message MapFieldEntry { + /// option map_entry = true; + /// optional KeyType key = 1; + /// optional ValueType value = 2; + /// } + /// repeated MapFieldEntry map_field = 1; /// /// Implementations may choose not to generate the map_entry=true message, but /// use a native map in the target language to hold the keys and values. @@ -576,8 +629,19 @@ pub struct FieldOptions { /// implementation must either *always* check its required fields, or *never* /// check its required fields, regardless of whether or not the message has /// been parsed. + /// + /// As of 2021, lazy does no correctness checks on the byte stream during + /// parsing. This may lead to crashes if and when an invalid byte stream is + /// finally parsed upon access. + /// + /// TODO(b/211906113): Enable validation on lazy fields. #[prost(bool, optional, tag="5", default="false")] pub lazy: ::core::option::Option, + /// unverified_lazy does no correctness checks on the byte stream. This should + /// only be used where lazy with verification is prohibitive for performance + /// reasons. + #[prost(bool, optional, tag="15", default="false")] + pub unverified_lazy: ::core::option::Option, /// Is this field deprecated? /// Depending on the target platform, this can emit Deprecated annotations /// for accessors, or it will be completely ignored; in the very least, this @@ -601,6 +665,19 @@ pub mod field_options { Cord = 1, StringPiece = 2, } + impl CType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + CType::String => "STRING", + CType::Cord => "CORD", + CType::StringPiece => "STRING_PIECE", + } + } + } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum JsType { @@ -611,6 +688,19 @@ pub mod field_options { /// Use JavaScript numbers. JsNumber = 2, } + impl JsType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + JsType::JsNormal => "JS_NORMAL", + JsType::JsString => "JS_STRING", + JsType::JsNumber => "JS_NUMBER", + } + } + } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct OneofOptions { @@ -649,9 +739,9 @@ pub struct EnumValueOptions { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ServiceOptions { // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. /// Is this service deprecated? /// Depending on the target platform, this can emit Deprecated annotations @@ -666,9 +756,9 @@ pub struct ServiceOptions { #[derive(Clone, PartialEq, ::prost::Message)] pub struct MethodOptions { // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. /// Is this method deprecated? /// Depending on the target platform, this can emit Deprecated annotations @@ -696,6 +786,19 @@ pub mod method_options { /// idempotent, but may have side effects Idempotent = 2, } + impl IdempotencyLevel { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + IdempotencyLevel::IdempotencyUnknown => "IDEMPOTENCY_UNKNOWN", + IdempotencyLevel::NoSideEffects => "NO_SIDE_EFFECTS", + IdempotencyLevel::Idempotent => "IDEMPOTENT", + } + } + } } /// A message representing a option the parser does not recognize. This only /// appears in options protos created by the compiler::Parser class. @@ -727,8 +830,8 @@ pub mod uninterpreted_option { /// The name of the uninterpreted option. Each string represents a segment in /// a dot-separated name. is_extension is true iff a segment represents an /// extension (denoted with parentheses in options specs in .proto files). - /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - /// "foo.(bar.baz).qux". + /// E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + /// "foo.(bar.baz).moo". #[derive(Clone, PartialEq, ::prost::Message)] pub struct NamePart { #[prost(string, required, tag="1")] @@ -750,43 +853,43 @@ pub struct SourceCodeInfo { /// tools. /// /// For example, say we have a file like: - /// message Foo { - /// optional string foo = 1; - /// } + /// message Foo { + /// optional string foo = 1; + /// } /// Let's look at just the field definition: - /// optional string foo = 1; - /// ^ ^^ ^^ ^ ^^^ - /// a bc de f ghi + /// optional string foo = 1; + /// ^ ^^ ^^ ^ ^^^ + /// a bc de f ghi /// We have the following locations: - /// span path represents - /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. - /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + /// span path represents + /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. + /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). /// /// Notes: /// - A location may refer to a repeated field itself (i.e. not to any - /// particular index within it). This is used whenever a set of elements are - /// logically enclosed in a single code segment. For example, an entire - /// extend block (possibly containing multiple extension definitions) will - /// have an outer location whose path refers to the "extensions" repeated - /// field without an index. + /// particular index within it). This is used whenever a set of elements are + /// logically enclosed in a single code segment. For example, an entire + /// extend block (possibly containing multiple extension definitions) will + /// have an outer location whose path refers to the "extensions" repeated + /// field without an index. /// - Multiple locations may have the same path. This happens when a single - /// logical declaration is spread out across multiple places. The most - /// obvious example is the "extend" block again -- there may be multiple - /// extend blocks in the same scope, each of which will have the same path. + /// logical declaration is spread out across multiple places. The most + /// obvious example is the "extend" block again -- there may be multiple + /// extend blocks in the same scope, each of which will have the same path. /// - A location's span is not always a subset of its parent's span. For - /// example, the "extendee" of an extension declaration appears at the - /// beginning of the "extend" block and is shared by all extensions within - /// the block. + /// example, the "extendee" of an extension declaration appears at the + /// beginning of the "extend" block and is shared by all extensions within + /// the block. /// - Just because a location's span is a subset of some other location's span - /// does not mean that it is a descendant. For example, a "group" defines - /// both a type and a field in a single declaration. Thus, the locations - /// corresponding to the type and field and their components will overlap. + /// does not mean that it is a descendant. For example, a "group" defines + /// both a type and a field in a single declaration. Thus, the locations + /// corresponding to the type and field and their components will overlap. /// - Code which tries to interpret locations should probably be designed to - /// ignore those that it doesn't understand, as more types of locations could - /// be recorded in the future. + /// ignore those that it doesn't understand, as more types of locations could + /// be recorded in the future. #[prost(message, repeated, tag="1")] pub location: ::prost::alloc::vec::Vec, } @@ -798,23 +901,23 @@ pub mod source_code_info { /// location. /// /// Each element is a field number or an index. They form a path from - /// the root FileDescriptorProto to the place where the definition. For - /// example, this path: - /// [ 4, 3, 2, 7, 1 ] + /// the root FileDescriptorProto to the place where the definition occurs. + /// For example, this path: + /// [ 4, 3, 2, 7, 1 ] /// refers to: - /// file.message_type(3) // 4, 3 - /// .field(7) // 2, 7 - /// .name() // 1 + /// file.message_type(3) // 4, 3 + /// .field(7) // 2, 7 + /// .name() // 1 /// This is because FileDescriptorProto.message_type has field number 4: - /// repeated DescriptorProto message_type = 4; + /// repeated DescriptorProto message_type = 4; /// and DescriptorProto.field has field number 2: - /// repeated FieldDescriptorProto field = 2; + /// repeated FieldDescriptorProto field = 2; /// and FieldDescriptorProto.name has field number 1: - /// optional string name = 1; + /// optional string name = 1; /// /// Thus, the above path gives the location of a field name. If we removed /// the last element: - /// [ 4, 3, 2, 7 ] + /// [ 4, 3, 2, 7 ] /// this path refers to the whole field declaration (from the beginning /// of the label to the terminating semicolon). #[prost(int32, repeated, tag="1")] @@ -845,34 +948,34 @@ pub mod source_code_info { /// /// Examples: /// - /// optional int32 foo = 1; // Comment attached to foo. - /// // Comment attached to bar. - /// optional int32 bar = 2; + /// optional int32 foo = 1; // Comment attached to foo. + /// // Comment attached to bar. + /// optional int32 bar = 2; /// - /// optional string baz = 3; - /// // Comment attached to baz. - /// // Another line attached to baz. + /// optional string baz = 3; + /// // Comment attached to baz. + /// // Another line attached to baz. /// - /// // Comment attached to qux. - /// // - /// // Another line attached to qux. - /// optional double qux = 4; + /// // Comment attached to moo. + /// // + /// // Another line attached to moo. + /// optional double moo = 4; /// - /// // Detached comment for corge. This is not leading or trailing comments - /// // to qux or corge because there are blank lines separating it from - /// // both. + /// // Detached comment for corge. This is not leading or trailing comments + /// // to moo or corge because there are blank lines separating it from + /// // both. /// - /// // Detached comment for corge paragraph 2. + /// // Detached comment for corge paragraph 2. /// - /// optional string corge = 5; - /// /* Block comment attached - /// * to corge. Leading asterisks - /// * will be removed. */ - /// /* Block comment attached to - /// * grault. */ - /// optional int32 grault = 6; + /// optional string corge = 5; + /// /* Block comment attached + /// * to corge. Leading asterisks + /// * will be removed. */ + /// /* Block comment attached to + /// * grault. */ + /// optional int32 grault = 6; /// - /// // ignored detached comments. + /// // ignored detached comments. #[prost(string, optional, tag="3")] pub leading_comments: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag="4")] diff --git a/proto/src/prost/tendermint.abci.rs b/proto/src/prost/tendermint.abci.rs index c8b10b258..e2f493e6f 100644 --- a/proto/src/prost/tendermint.abci.rs +++ b/proto/src/prost/tendermint.abci.rs @@ -2,7 +2,7 @@ // NOTE: When using custom types, mind the warnings. // -//---------------------------------------- +// ---------------------------------------- // Request types #[derive(Clone, PartialEq, ::prost::Message)] @@ -162,7 +162,7 @@ pub struct RequestApplySnapshotChunk { #[prost(string, tag="3")] pub sender: ::prost::alloc::string::String, } -//---------------------------------------- +// ---------------------------------------- // Response types #[derive(Clone, PartialEq, ::prost::Message)] @@ -388,6 +388,22 @@ pub mod response_offer_snapshot { /// Reject all snapshots from the sender(s), try others RejectSender = 5, } + impl Result { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Result::Unknown => "UNKNOWN", + Result::Accept => "ACCEPT", + Result::Abort => "ABORT", + Result::Reject => "REJECT", + Result::RejectFormat => "REJECT_FORMAT", + Result::RejectSender => "REJECT_SENDER", + } + } + } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseLoadSnapshotChunk { @@ -423,8 +439,24 @@ pub mod response_apply_snapshot_chunk { /// Reject this snapshot, try others RejectSnapshot = 5, } + impl Result { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Result::Unknown => "UNKNOWN", + Result::Accept => "ACCEPT", + Result::Abort => "ABORT", + Result::Retry => "RETRY", + Result::RetrySnapshot => "RETRY_SNAPSHOT", + Result::RejectSnapshot => "REJECT_SNAPSHOT", + } + } + } } -//---------------------------------------- +// ---------------------------------------- // Misc. /// ConsensusParams contains all consensus-relevant parameters @@ -492,7 +524,7 @@ pub struct TxResult { #[prost(message, optional, tag="4")] pub result: ::core::option::Option, } -//---------------------------------------- +// ---------------------------------------- // Blockchain Types /// Validator @@ -542,7 +574,7 @@ pub struct Evidence { #[prost(int64, tag="5")] pub total_voting_power: i64, } -//---------------------------------------- +// ---------------------------------------- // State Sync Types #[derive(Clone, PartialEq, ::prost::Message)] @@ -569,6 +601,18 @@ pub enum CheckTxType { New = 0, Recheck = 1, } +impl CheckTxType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + CheckTxType::New => "NEW", + CheckTxType::Recheck => "RECHECK", + } + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum EvidenceType { @@ -576,3 +620,16 @@ pub enum EvidenceType { DuplicateVote = 1, LightClientAttack = 2, } +impl EvidenceType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + EvidenceType::Unknown => "UNKNOWN", + EvidenceType::DuplicateVote => "DUPLICATE_VOTE", + EvidenceType::LightClientAttack => "LIGHT_CLIENT_ATTACK", + } + } +} diff --git a/proto/src/prost/tendermint.consensus.rs b/proto/src/prost/tendermint.consensus.rs index c58b0719d..1ada48be4 100644 --- a/proto/src/prost/tendermint.consensus.rs +++ b/proto/src/prost/tendermint.consensus.rs @@ -14,7 +14,7 @@ pub struct NewRoundStep { pub last_commit_round: i32, } /// NewValidBlock is sent when a validator observes a valid block B in some round r, -///i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. +/// i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. /// In case the block is also committed, then IsCommit flag is set to true. #[derive(Clone, PartialEq, ::prost::Message)] pub struct NewValidBlock { diff --git a/proto/src/prost/tendermint.privval.rs b/proto/src/prost/tendermint.privval.rs index 8a86b3369..892a10bbf 100644 --- a/proto/src/prost/tendermint.privval.rs +++ b/proto/src/prost/tendermint.privval.rs @@ -96,3 +96,19 @@ pub enum Errors { ReadTimeout = 4, WriteTimeout = 5, } +impl Errors { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Errors::Unknown => "ERRORS_UNKNOWN", + Errors::UnexpectedResponse => "ERRORS_UNEXPECTED_RESPONSE", + Errors::NoConnection => "ERRORS_NO_CONNECTION", + Errors::ConnectionTimeout => "ERRORS_CONNECTION_TIMEOUT", + Errors::ReadTimeout => "ERRORS_READ_TIMEOUT", + Errors::WriteTimeout => "ERRORS_WRITE_TIMEOUT", + } + } +} diff --git a/proto/src/prost/tendermint.rpc.grpc.rs b/proto/src/prost/tendermint.rpc.grpc.rs index 97e339365..4739bccac 100644 --- a/proto/src/prost/tendermint.rpc.grpc.rs +++ b/proto/src/prost/tendermint.rpc.grpc.rs @@ -1,4 +1,4 @@ -//---------------------------------------- +// ---------------------------------------- // Request types #[derive(Clone, PartialEq, ::prost::Message)] @@ -9,7 +9,7 @@ pub struct RequestBroadcastTx { #[prost(bytes="vec", tag="1")] pub tx: ::prost::alloc::vec::Vec, } -//---------------------------------------- +// ---------------------------------------- // Response types #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/proto/src/prost/tendermint.types.rs b/proto/src/prost/tendermint.types.rs index 61c23229e..4e1ab5d7e 100644 --- a/proto/src/prost/tendermint.types.rs +++ b/proto/src/prost/tendermint.types.rs @@ -265,6 +265,20 @@ pub enum BlockIdFlag { Commit = 2, Nil = 3, } +impl BlockIdFlag { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + BlockIdFlag::Unknown => "BLOCK_ID_FLAG_UNKNOWN", + BlockIdFlag::Absent => "BLOCK_ID_FLAG_ABSENT", + BlockIdFlag::Commit => "BLOCK_ID_FLAG_COMMIT", + BlockIdFlag::Nil => "BLOCK_ID_FLAG_NIL", + } + } +} /// SignedMsgType is a type of signed message in the consensus. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -276,6 +290,20 @@ pub enum SignedMsgType { /// Proposals Proposal = 32, } +impl SignedMsgType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SignedMsgType::Unknown => "SIGNED_MSG_TYPE_UNKNOWN", + SignedMsgType::Prevote => "SIGNED_MSG_TYPE_PREVOTE", + SignedMsgType::Precommit => "SIGNED_MSG_TYPE_PRECOMMIT", + SignedMsgType::Proposal => "SIGNED_MSG_TYPE_PROPOSAL", + } + } +} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CanonicalBlockId {