Skip to content

Commit

Permalink
Add autogenerated protos for v1.0 (#2)
Browse files Browse the repository at this point in the history
* Pre: auto changes

* Added cometbft v1_0 to protobuf generation

* Auto generated protobuf code

* Adapted custom attributes for cometbft types

* Auto generated protobuf code after adapting custom attributes

* Extended mod generation to support several sub-mods

* Auto generated protobuf code after extended mod generation

* Fix build of protos crate

* Changelog

* Addressed @mzabaluev's comments

* Fix cometbft tags

* Re-Fix build of protos crate

* Fix main and constants

* Regenerated protobuf code

* cargo fmt
  • Loading branch information
sergio-mena authored Dec 18, 2023
1 parent 7e1787c commit 8f9df6f
Show file tree
Hide file tree
Showing 50 changed files with 12,791 additions and 414 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[proto-compiler]` Introduce auto-generated protobuf code for CometBFT `v1.0`
([\#1381](https://github.com/informalsystems/tendermint-rs/pull/1381)).
2 changes: 2 additions & 0 deletions proto/src/cometbft.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod v1_0;
pub use v1_0::*;
156 changes: 156 additions & 0 deletions proto/src/cometbft/v1_0.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
//! Protobuf auto-generated sub-modules for Tendermint. DO NOT EDIT

pub mod abci {
pub mod v1 {
include!("../prost/v1_0/cometbft.abci.v1.rs");
}
pub mod v1beta1 {
include!("../prost/v1_0/cometbft.abci.v1beta1.rs");
}
pub mod v1beta2 {
include!("../prost/v1_0/cometbft.abci.v1beta2.rs");
}
pub mod v1beta3 {
include!("../prost/v1_0/cometbft.abci.v1beta3.rs");
}
}

pub mod blocksync {
pub mod v1 {
include!("../prost/v1_0/cometbft.blocksync.v1.rs");
}
pub mod v1beta1 {
include!("../prost/v1_0/cometbft.blocksync.v1beta1.rs");
}
}

pub mod consensus {
pub mod v1 {
include!("../prost/v1_0/cometbft.consensus.v1.rs");
}
pub mod v1beta1 {
include!("../prost/v1_0/cometbft.consensus.v1beta1.rs");
}
}

pub mod crypto {
pub mod v1 {
include!("../prost/v1_0/cometbft.crypto.v1.rs");
}
}

pub mod libs {
pub mod bits {
pub mod v1 {
include!("../prost/v1_0/cometbft.libs.bits.v1.rs");
}
}
}

pub mod mempool {
pub mod v1 {
include!("../prost/v1_0/cometbft.mempool.v1.rs");
}
}

pub mod p2p {
pub mod v1 {
include!("../prost/v1_0/cometbft.p2p.v1.rs");
}
}

pub mod privval {
pub mod v1 {
include!("../prost/v1_0/cometbft.privval.v1.rs");
}
pub mod v1beta1 {
include!("../prost/v1_0/cometbft.privval.v1beta1.rs");
}
}

pub mod rpc {
pub mod grpc {
pub mod v1beta1 {
include!("../prost/v1_0/cometbft.rpc.grpc.v1beta1.rs");
}
pub mod v1beta2 {
include!("../prost/v1_0/cometbft.rpc.grpc.v1beta2.rs");
}
pub mod v1beta3 {
include!("../prost/v1_0/cometbft.rpc.grpc.v1beta3.rs");
}
}
}

pub mod services {
pub mod block {
pub mod v1 {
include!("../prost/v1_0/cometbft.services.block.v1.rs");
}
}
pub mod block_results {
pub mod v1 {
include!("../prost/v1_0/cometbft.services.block_results.v1.rs");
}
}
pub mod pruning {
pub mod v1 {
include!("../prost/v1_0/cometbft.services.pruning.v1.rs");
}
}
pub mod version {
pub mod v1 {
include!("../prost/v1_0/cometbft.services.version.v1.rs");
}
}
}

pub mod state {
pub mod v1 {
include!("../prost/v1_0/cometbft.state.v1.rs");
}
pub mod v1beta1 {
include!("../prost/v1_0/cometbft.state.v1beta1.rs");
}
pub mod v1beta2 {
include!("../prost/v1_0/cometbft.state.v1beta2.rs");
}
pub mod v1beta3 {
include!("../prost/v1_0/cometbft.state.v1beta3.rs");
}
}

pub mod statesync {
pub mod v1 {
include!("../prost/v1_0/cometbft.statesync.v1.rs");
}
}

pub mod store {
pub mod v1 {
include!("../prost/v1_0/cometbft.store.v1.rs");
}
}

pub mod types {
pub mod v1 {
include!("../prost/v1_0/cometbft.types.v1.rs");
}
pub mod v1beta1 {
include!("../prost/v1_0/cometbft.types.v1beta1.rs");
}
pub mod v1beta2 {
include!("../prost/v1_0/cometbft.types.v1beta2.rs");
}
}

pub mod version {
pub mod v1 {
include!("../prost/v1_0/cometbft.version.v1.rs");
}
}

pub mod meta {
pub const REPOSITORY: &str = "https://github.com/cometbft/cometbft";
pub const COMMITISH: &str = "v1.0.0-alpha.1";
}
4 changes: 3 additions & 1 deletion proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ pub mod google {
}
}

mod error;
#[allow(warnings)]
mod cometbft;
mod error;
mod tendermint;

use core::{convert::TryFrom, fmt::Display};

use bytes::{Buf, BufMut};
pub use cometbft::*;
pub use error::Error;
use prost::Message;
pub use tendermint::*;
Expand Down
86 changes: 43 additions & 43 deletions proto/src/prost/v0_34/tendermint.p2p.rs
Original file line number Diff line number Diff line change
@@ -1,48 +1,5 @@
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PacketPing {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PacketPong {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PacketMsg {
#[prost(int32, tag = "1")]
pub channel_id: i32,
#[prost(bool, tag = "2")]
pub eof: bool,
#[prost(bytes = "vec", tag = "3")]
pub data: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Packet {
#[prost(oneof = "packet::Sum", tags = "1, 2, 3")]
pub sum: ::core::option::Option<packet::Sum>,
}
/// Nested message and enum types in `Packet`.
pub mod packet {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Sum {
#[prost(message, tag = "1")]
PacketPing(super::PacketPing),
#[prost(message, tag = "2")]
PacketPong(super::PacketPong),
#[prost(message, tag = "3")]
PacketMsg(super::PacketMsg),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthSigMessage {
#[prost(message, optional, tag = "1")]
pub pub_key: ::core::option::Option<super::crypto::PublicKey>,
#[prost(bytes = "vec", tag = "2")]
pub sig: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NetAddress {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
Expand Down Expand Up @@ -91,6 +48,49 @@ pub struct DefaultNodeInfoOther {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PacketPing {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PacketPong {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PacketMsg {
#[prost(int32, tag = "1")]
pub channel_id: i32,
#[prost(bool, tag = "2")]
pub eof: bool,
#[prost(bytes = "vec", tag = "3")]
pub data: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Packet {
#[prost(oneof = "packet::Sum", tags = "1, 2, 3")]
pub sum: ::core::option::Option<packet::Sum>,
}
/// Nested message and enum types in `Packet`.
pub mod packet {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Sum {
#[prost(message, tag = "1")]
PacketPing(super::PacketPing),
#[prost(message, tag = "2")]
PacketPong(super::PacketPong),
#[prost(message, tag = "3")]
PacketMsg(super::PacketMsg),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthSigMessage {
#[prost(message, optional, tag = "1")]
pub pub_key: ::core::option::Option<super::crypto::PublicKey>,
#[prost(bytes = "vec", tag = "2")]
pub sig: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PexRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down
46 changes: 23 additions & 23 deletions proto/src/prost/v0_34/tendermint.types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,16 @@ impl SignedMsgType {
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventDataRoundState {
#[prost(int64, tag = "1")]
pub height: i64,
#[prost(int32, tag = "2")]
pub round: i32,
#[prost(string, tag = "3")]
pub step: ::prost::alloc::string::String,
}
/// ConsensusParams contains consensus critical parameters that determine the
/// validity of blocks.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -426,16 +436,6 @@ pub struct HashedParams {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EventDataRoundState {
#[prost(int64, tag = "1")]
pub height: i64,
#[prost(int32, tag = "2")]
pub round: i32,
#[prost(string, tag = "3")]
pub step: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Evidence {
#[prost(oneof = "evidence::Sum", tags = "1, 2")]
pub sum: ::core::option::Option<evidence::Sum>,
Expand Down Expand Up @@ -504,19 +504,6 @@ pub struct EvidenceList {
#[derive(::serde::Deserialize, ::serde::Serialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<Header>,
#[prost(message, optional, tag = "2")]
pub data: ::core::option::Option<Data>,
#[prost(message, optional, tag = "3")]
pub evidence: ::core::option::Option<EvidenceList>,
#[prost(message, optional, tag = "4")]
pub last_commit: ::core::option::Option<Commit>,
}
#[derive(::serde::Deserialize, ::serde::Serialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CanonicalBlockId {
#[prost(bytes = "vec", tag = "1")]
pub hash: ::prost::alloc::vec::Vec<u8>,
Expand Down Expand Up @@ -573,3 +560,16 @@ pub struct CanonicalVote {
#[prost(string, tag = "6")]
pub chain_id: ::prost::alloc::string::String,
}
#[derive(::serde::Deserialize, ::serde::Serialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<Header>,
#[prost(message, optional, tag = "2")]
pub data: ::core::option::Option<Data>,
#[prost(message, optional, tag = "3")]
pub evidence: ::core::option::Option<EvidenceList>,
#[prost(message, optional, tag = "4")]
pub last_commit: ::core::option::Option<Commit>,
}
Loading

0 comments on commit 8f9df6f

Please sign in to comment.