Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Prost version to v0.11 #1171

Merged
merged 8 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changelog/unreleased/dependencies/1171-update-prost-0.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Update Prost to v0.11
([#1171](https://github.com/informalsystems/tendermint-rs/pull/1171))
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ jobs:
with:
toolchain: stable
override: true
- 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 ${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
Expand Down
2 changes: 1 addition & 1 deletion abci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 2 additions & 2 deletions p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 }
4 changes: 2 additions & 2 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
295 changes: 199 additions & 96 deletions proto/src/prost/google.protobuf.rs

Large diffs are not rendered by default.

67 changes: 62 additions & 5 deletions proto/src/prost/tendermint.abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// NOTE: When using custom types, mind the warnings.
// <https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues>

//----------------------------------------
// ----------------------------------------
// Request types

#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -162,7 +162,7 @@ pub struct RequestApplySnapshotChunk {
#[prost(string, tag="3")]
pub sender: ::prost::alloc::string::String,
}
//----------------------------------------
// ----------------------------------------
// Response types

#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -492,7 +524,7 @@ pub struct TxResult {
#[prost(message, optional, tag="4")]
pub result: ::core::option::Option<ResponseDeliverTx>,
}
//----------------------------------------
// ----------------------------------------
// Blockchain Types

/// Validator
Expand Down Expand Up @@ -542,7 +574,7 @@ pub struct Evidence {
#[prost(int64, tag="5")]
pub total_voting_power: i64,
}
//----------------------------------------
// ----------------------------------------
// State Sync Types

#[derive(Clone, PartialEq, ::prost::Message)]
Expand All @@ -569,10 +601,35 @@ 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 {
Unknown = 0,
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",
}
}
}
2 changes: 1 addition & 1 deletion proto/src/prost/tendermint.consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 16 additions & 0 deletions proto/src/prost/tendermint.privval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
}
}
4 changes: 2 additions & 2 deletions proto/src/prost/tendermint.rpc.grpc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//----------------------------------------
// ----------------------------------------
// Request types

#[derive(Clone, PartialEq, ::prost::Message)]
Expand All @@ -9,7 +9,7 @@ pub struct RequestBroadcastTx {
#[prost(bytes="vec", tag="1")]
pub tx: ::prost::alloc::vec::Vec<u8>,
}
//----------------------------------------
// ----------------------------------------
// Response types

#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
28 changes: 28 additions & 0 deletions proto/src/prost/tendermint.types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tendermint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion tools/proto-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }