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

Parse and fetch proto dependencies from buf.lock in the repository source #1293

Merged
merged 5 commits into from
Apr 14, 2023
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
3 changes: 3 additions & 0 deletions .changelog/unreleased/improvements/1293-buf-proto-deps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [`tools/proto-compiler`] Parse and fetch proto dependencies as listed in the
`buf.lock` file
([\#1293](https://github.com/informalsystems/tendermint-rs/pull/1293)).
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ jobs:
unzip /tmp/protoc.zip -d ${HOME}/.local
echo "PROTOC=${HOME}/.local/bin/protoc" >> $GITHUB_ENV
export PATH="${PATH}:${HOME}/.local/bin"
- name: Install buf
run: |
curl -sSL https://github.com/bufbuild/buf/releases/download/v1.15.1/buf-Linux-x86_64 \
-o /usr/local/bin/buf
chmod +x /usr/local/bin/buf
- name: Regenerate proto definitions
working-directory: ./tools/proto-compiler/
run: cargo run
Expand Down
45 changes: 43 additions & 2 deletions proto/src/prost/v0_34/tendermint.abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ pub struct ResponseCheckTx {
pub sender: ::prost::alloc::string::String,
#[prost(int64, tag = "10")]
pub priority: i64,
/// mempool_error is set by Tendermint.
/// ABCI applications creating a ResponseCheckTX should not set mempool_error.
/// mempool_error is set by CometBFT.
/// ABCI applictions creating a ResponseCheckTX should not set mempool_error.
#[prost(string, tag = "11")]
pub mempool_error: ::prost::alloc::string::String,
}
Expand Down Expand Up @@ -438,6 +438,18 @@ pub mod response_offer_snapshot {
Result::RejectSender => "REJECT_SENDER",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"ACCEPT" => Some(Self::Accept),
"ABORT" => Some(Self::Abort),
"REJECT" => Some(Self::Reject),
"REJECT_FORMAT" => Some(Self::RejectFormat),
"REJECT_SENDER" => Some(Self::RejectSender),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -501,6 +513,18 @@ pub mod response_apply_snapshot_chunk {
Result::RejectSnapshot => "REJECT_SNAPSHOT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"ACCEPT" => Some(Self::Accept),
"ABORT" => Some(Self::Abort),
"RETRY" => Some(Self::Retry),
"RETRY_SNAPSHOT" => Some(Self::RetrySnapshot),
"REJECT_SNAPSHOT" => Some(Self::RejectSnapshot),
_ => None,
}
}
}
}
/// ConsensusParams contains all consensus-relevant parameters
Expand Down Expand Up @@ -661,6 +685,14 @@ impl CheckTxType {
CheckTxType::Recheck => "RECHECK",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NEW" => Some(Self::New),
"RECHECK" => Some(Self::Recheck),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
Expand All @@ -681,4 +713,13 @@ impl EvidenceType {
EvidenceType::LightClientAttack => "LIGHT_CLIENT_ATTACK",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"DUPLICATE_VOTE" => Some(Self::DuplicateVote),
"LIGHT_CLIENT_ATTACK" => Some(Self::LightClientAttack),
_ => None,
}
}
}
2 changes: 1 addition & 1 deletion proto/src/prost/v0_34/tendermint.crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct ProofOps {
#[prost(message, repeated, tag = "1")]
pub ops: ::prost::alloc::vec::Vec<ProofOp>,
}
/// PublicKey defines the keys available for use with Tendermint Validators
/// PublicKey defines the keys available for use with Validators
#[derive(::serde::Deserialize, ::serde::Serialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
12 changes: 12 additions & 0 deletions proto/src/prost/v0_34/tendermint.privval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,16 @@ impl Errors {
Errors::WriteTimeout => "ERRORS_WRITE_TIMEOUT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ERRORS_UNKNOWN" => Some(Self::Unknown),
"ERRORS_UNEXPECTED_RESPONSE" => Some(Self::UnexpectedResponse),
"ERRORS_NO_CONNECTION" => Some(Self::NoConnection),
"ERRORS_CONNECTION_TIMEOUT" => Some(Self::ConnectionTimeout),
"ERRORS_READ_TIMEOUT" => Some(Self::ReadTimeout),
"ERRORS_WRITE_TIMEOUT" => Some(Self::WriteTimeout),
_ => None,
}
}
}
22 changes: 21 additions & 1 deletion proto/src/prost/v0_34/tendermint.types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct BlockId {
#[serde(alias = "parts")]
pub part_set_header: ::core::option::Option<PartSetHeader>,
}
/// Header defines the structure of a Tendermint block header.
/// Header defines the structure of a block header.
#[derive(::serde::Deserialize, ::serde::Serialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -290,6 +290,16 @@ impl BlockIdFlag {
BlockIdFlag::Nil => "BLOCK_ID_FLAG_NIL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BLOCK_ID_FLAG_UNKNOWN" => Some(Self::Unknown),
"BLOCK_ID_FLAG_ABSENT" => Some(Self::Absent),
"BLOCK_ID_FLAG_COMMIT" => Some(Self::Commit),
"BLOCK_ID_FLAG_NIL" => Some(Self::Nil),
_ => None,
}
}
}
/// SignedMsgType is a type of signed message in the consensus.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
Expand All @@ -315,6 +325,16 @@ impl SignedMsgType {
SignedMsgType::Proposal => "SIGNED_MSG_TYPE_PROPOSAL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SIGNED_MSG_TYPE_UNKNOWN" => Some(Self::Unknown),
"SIGNED_MSG_TYPE_PREVOTE" => Some(Self::Prevote),
"SIGNED_MSG_TYPE_PRECOMMIT" => Some(Self::Precommit),
"SIGNED_MSG_TYPE_PROPOSAL" => Some(Self::Proposal),
_ => None,
}
}
}
/// ConsensusParams contains consensus critical parameters that determine the
/// validity of blocks.
Expand Down
52 changes: 51 additions & 1 deletion proto/src/prost/v0_37/tendermint.abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub struct ResponseCheckTx {
pub sender: ::prost::alloc::string::String,
#[prost(int64, tag = "10")]
pub priority: i64,
/// mempool_error is set by Tendermint.
/// mempool_error is set by CometBFT.
/// ABCI applictions creating a ResponseCheckTX should not set mempool_error.
#[prost(string, tag = "11")]
pub mempool_error: ::prost::alloc::string::String,
Expand Down Expand Up @@ -469,6 +469,18 @@ pub mod response_offer_snapshot {
Result::RejectSender => "REJECT_SENDER",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"ACCEPT" => Some(Self::Accept),
"ABORT" => Some(Self::Abort),
"REJECT" => Some(Self::Reject),
"REJECT_FORMAT" => Some(Self::RejectFormat),
"REJECT_SENDER" => Some(Self::RejectSender),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -532,6 +544,18 @@ pub mod response_apply_snapshot_chunk {
Result::RejectSnapshot => "REJECT_SNAPSHOT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"ACCEPT" => Some(Self::Accept),
"ABORT" => Some(Self::Abort),
"RETRY" => Some(Self::Retry),
"RETRY_SNAPSHOT" => Some(Self::RetrySnapshot),
"REJECT_SNAPSHOT" => Some(Self::RejectSnapshot),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -577,6 +601,15 @@ pub mod response_process_proposal {
ProposalStatus::Reject => "REJECT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"ACCEPT" => Some(Self::Accept),
"REJECT" => Some(Self::Reject),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -734,6 +767,14 @@ impl CheckTxType {
CheckTxType::Recheck => "RECHECK",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NEW" => Some(Self::New),
"RECHECK" => Some(Self::Recheck),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
Expand All @@ -754,4 +795,13 @@ impl MisbehaviorType {
MisbehaviorType::LightClientAttack => "LIGHT_CLIENT_ATTACK",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"DUPLICATE_VOTE" => Some(Self::DuplicateVote),
"LIGHT_CLIENT_ATTACK" => Some(Self::LightClientAttack),
_ => None,
}
}
}
4 changes: 2 additions & 2 deletions proto/src/prost/v0_37/tendermint.crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct DominoOp {
pub output: ::prost::alloc::string::String,
}
/// ProofOp defines an operation used for calculating Merkle root
/// The data could be arbitrary format, providing necessary data
/// The data could be arbitrary format, providing nessecary data
/// for example neighbouring node hash
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand All @@ -55,7 +55,7 @@ pub struct ProofOps {
#[prost(message, repeated, tag = "1")]
pub ops: ::prost::alloc::vec::Vec<ProofOp>,
}
/// PublicKey defines the keys available for use with Tendermint Validators
/// PublicKey defines the keys available for use with Validators
#[derive(::serde::Deserialize, ::serde::Serialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
12 changes: 12 additions & 0 deletions proto/src/prost/v0_37/tendermint.privval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,16 @@ impl Errors {
Errors::WriteTimeout => "ERRORS_WRITE_TIMEOUT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ERRORS_UNKNOWN" => Some(Self::Unknown),
"ERRORS_UNEXPECTED_RESPONSE" => Some(Self::UnexpectedResponse),
"ERRORS_NO_CONNECTION" => Some(Self::NoConnection),
"ERRORS_CONNECTION_TIMEOUT" => Some(Self::ConnectionTimeout),
"ERRORS_READ_TIMEOUT" => Some(Self::ReadTimeout),
"ERRORS_WRITE_TIMEOUT" => Some(Self::WriteTimeout),
_ => None,
}
}
}
22 changes: 21 additions & 1 deletion proto/src/prost/v0_37/tendermint.types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct BlockId {
#[serde(alias = "parts")]
pub part_set_header: ::core::option::Option<PartSetHeader>,
}
/// Header defines the structure of a Tendermint block header.
/// Header defines the structure of a block header.
#[derive(::serde::Deserialize, ::serde::Serialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -290,6 +290,16 @@ impl BlockIdFlag {
BlockIdFlag::Nil => "BLOCK_ID_FLAG_NIL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BLOCK_ID_FLAG_UNKNOWN" => Some(Self::Unknown),
"BLOCK_ID_FLAG_ABSENT" => Some(Self::Absent),
"BLOCK_ID_FLAG_COMMIT" => Some(Self::Commit),
"BLOCK_ID_FLAG_NIL" => Some(Self::Nil),
_ => None,
}
}
}
/// SignedMsgType is a type of signed message in the consensus.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
Expand All @@ -315,6 +325,16 @@ impl SignedMsgType {
SignedMsgType::Proposal => "SIGNED_MSG_TYPE_PROPOSAL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SIGNED_MSG_TYPE_UNKNOWN" => Some(Self::Unknown),
"SIGNED_MSG_TYPE_PREVOTE" => Some(Self::Prevote),
"SIGNED_MSG_TYPE_PRECOMMIT" => Some(Self::Precommit),
"SIGNED_MSG_TYPE_PROPOSAL" => Some(Self::Proposal),
_ => None,
}
}
}
/// ConsensusParams contains consensus critical parameters that determine the
/// validity of blocks.
Expand Down
4 changes: 2 additions & 2 deletions proto/src/tendermint/v0_34.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ pub mod version {
}

pub mod meta {
pub const REPOSITORY: &str = "https://github.com/tendermint/tendermint";
pub const COMMITISH: &str = "v0.34.24";
pub const REPOSITORY: &str = "https://github.com/cometbft/cometbft";
pub const COMMITISH: &str = "v0.34.27";
}
4 changes: 2 additions & 2 deletions proto/src/tendermint/v0_37.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ pub mod version {
}

pub mod meta {
pub const REPOSITORY: &str = "https://github.com/tendermint/tendermint";
pub const COMMITISH: &str = "v0.37.0-alpha.1";
pub const REPOSITORY: &str = "https://github.com/cometbft/cometbft";
pub const COMMITISH: &str = "v0.37.0";
}
7 changes: 5 additions & 2 deletions tools/proto-compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tendermint-proto-compiler"
version = "0.2.0"
version = "0.3.0"
authors = ["Informal Systems <hello@informal.systems>"]
edition = "2021"
publish = false
Expand All @@ -9,5 +9,8 @@ publish = false
walkdir = { version = "2.3" }
prost-build = { version = "0.11.4" }
git2 = { version = "0.16" }
tempfile = { version = "3.2.0" }
tempfile = { version = "3.5.0" }
subtle-encoding = { version = "0.5" }
serde = { version = "1.0", features = ["derive"] }
serde_yaml = { version = "0.9" }
thiserror = { version = "1.0" }
Loading