diff --git a/proto/src/prost/v0_34/tendermint.abci.rs b/proto/src/prost/v0_34/tendermint.abci.rs new file mode 100644 index 000000000..777597b9c --- /dev/null +++ b/proto/src/prost/v0_34/tendermint.abci.rs @@ -0,0 +1,635 @@ +// This file is copied from +// NOTE: When using custom types, mind the warnings. +// + +// ---------------------------------------- +// Request types + +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Request { + #[prost(oneof="request::Value", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Request`. +pub mod request { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="1")] + Echo(super::RequestEcho), + #[prost(message, tag="2")] + Flush(super::RequestFlush), + #[prost(message, tag="3")] + Info(super::RequestInfo), + #[prost(message, tag="4")] + SetOption(super::RequestSetOption), + #[prost(message, tag="5")] + InitChain(super::RequestInitChain), + #[prost(message, tag="6")] + Query(super::RequestQuery), + #[prost(message, tag="7")] + BeginBlock(super::RequestBeginBlock), + #[prost(message, tag="8")] + CheckTx(super::RequestCheckTx), + #[prost(message, tag="9")] + DeliverTx(super::RequestDeliverTx), + #[prost(message, tag="10")] + EndBlock(super::RequestEndBlock), + #[prost(message, tag="11")] + Commit(super::RequestCommit), + #[prost(message, tag="12")] + ListSnapshots(super::RequestListSnapshots), + #[prost(message, tag="13")] + OfferSnapshot(super::RequestOfferSnapshot), + #[prost(message, tag="14")] + LoadSnapshotChunk(super::RequestLoadSnapshotChunk), + #[prost(message, tag="15")] + ApplySnapshotChunk(super::RequestApplySnapshotChunk), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestEcho { + #[prost(string, tag="1")] + pub message: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestFlush { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestInfo { + #[prost(string, tag="1")] + pub version: ::prost::alloc::string::String, + #[prost(uint64, tag="2")] + pub block_version: u64, + #[prost(uint64, tag="3")] + pub p2p_version: u64, +} +/// nondeterministic +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestSetOption { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub value: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestInitChain { + #[prost(message, optional, tag="1")] + pub time: ::core::option::Option, + #[prost(string, tag="2")] + pub chain_id: ::prost::alloc::string::String, + #[prost(message, optional, tag="3")] + pub consensus_params: ::core::option::Option, + #[prost(message, repeated, tag="4")] + pub validators: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="5")] + pub app_state_bytes: ::prost::alloc::vec::Vec, + #[prost(int64, tag="6")] + pub initial_height: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestQuery { + #[prost(bytes="vec", tag="1")] + pub data: ::prost::alloc::vec::Vec, + #[prost(string, tag="2")] + pub path: ::prost::alloc::string::String, + #[prost(int64, tag="3")] + pub height: i64, + #[prost(bool, tag="4")] + pub prove: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestBeginBlock { + #[prost(bytes="vec", tag="1")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub header: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub last_commit_info: ::core::option::Option, + #[prost(message, repeated, tag="4")] + pub byzantine_validators: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestCheckTx { + #[prost(bytes="vec", tag="1")] + pub tx: ::prost::alloc::vec::Vec, + #[prost(enumeration="CheckTxType", tag="2")] + pub r#type: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestDeliverTx { + #[prost(bytes="vec", tag="1")] + pub tx: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestEndBlock { + #[prost(int64, tag="1")] + pub height: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestCommit { +} +/// lists available snapshots +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestListSnapshots { +} +/// offers a snapshot to the application +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestOfferSnapshot { + /// snapshot offered by peers + #[prost(message, optional, tag="1")] + pub snapshot: ::core::option::Option, + /// light client-verified app hash for snapshot height + #[prost(bytes="vec", tag="2")] + pub app_hash: ::prost::alloc::vec::Vec, +} +/// loads a snapshot chunk +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestLoadSnapshotChunk { + #[prost(uint64, tag="1")] + pub height: u64, + #[prost(uint32, tag="2")] + pub format: u32, + #[prost(uint32, tag="3")] + pub chunk: u32, +} +/// Applies a snapshot chunk +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestApplySnapshotChunk { + #[prost(uint32, tag="1")] + pub index: u32, + #[prost(bytes="vec", tag="2")] + pub chunk: ::prost::alloc::vec::Vec, + #[prost(string, tag="3")] + pub sender: ::prost::alloc::string::String, +} +// ---------------------------------------- +// Response types + +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Response { + #[prost(oneof="response::Value", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16")] + pub value: ::core::option::Option, +} +/// Nested message and enum types in `Response`. +pub mod response { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Value { + #[prost(message, tag="1")] + Exception(super::ResponseException), + #[prost(message, tag="2")] + Echo(super::ResponseEcho), + #[prost(message, tag="3")] + Flush(super::ResponseFlush), + #[prost(message, tag="4")] + Info(super::ResponseInfo), + #[prost(message, tag="5")] + SetOption(super::ResponseSetOption), + #[prost(message, tag="6")] + InitChain(super::ResponseInitChain), + #[prost(message, tag="7")] + Query(super::ResponseQuery), + #[prost(message, tag="8")] + BeginBlock(super::ResponseBeginBlock), + #[prost(message, tag="9")] + CheckTx(super::ResponseCheckTx), + #[prost(message, tag="10")] + DeliverTx(super::ResponseDeliverTx), + #[prost(message, tag="11")] + EndBlock(super::ResponseEndBlock), + #[prost(message, tag="12")] + Commit(super::ResponseCommit), + #[prost(message, tag="13")] + ListSnapshots(super::ResponseListSnapshots), + #[prost(message, tag="14")] + OfferSnapshot(super::ResponseOfferSnapshot), + #[prost(message, tag="15")] + LoadSnapshotChunk(super::ResponseLoadSnapshotChunk), + #[prost(message, tag="16")] + ApplySnapshotChunk(super::ResponseApplySnapshotChunk), + } +} +/// nondeterministic +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseException { + #[prost(string, tag="1")] + pub error: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseEcho { + #[prost(string, tag="1")] + pub message: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseFlush { +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseInfo { + #[prost(string, tag="1")] + #[serde(default)] + pub data: ::prost::alloc::string::String, + #[prost(string, tag="2")] + #[serde(default)] + pub version: ::prost::alloc::string::String, + #[prost(uint64, tag="3")] + #[serde(with = "crate::serializers::from_str", default)] + pub app_version: u64, + #[prost(int64, tag="4")] + #[serde(with = "crate::serializers::from_str", default)] + pub last_block_height: i64, + #[prost(bytes="vec", tag="5")] + #[serde(default)] + #[serde(skip_serializing_if = "::prost::alloc::vec::Vec::is_empty", with = "serde_bytes")] + pub last_block_app_hash: ::prost::alloc::vec::Vec, +} +/// nondeterministic +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseSetOption { + #[prost(uint32, tag="1")] + pub code: u32, + /// bytes data = 2; + #[prost(string, tag="3")] + pub log: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub info: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseInitChain { + #[prost(message, optional, tag="1")] + pub consensus_params: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub validators: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub app_hash: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseQuery { + #[prost(uint32, tag="1")] + pub code: u32, + /// bytes data = 2; // use "value" instead. + /// + /// nondeterministic + #[prost(string, tag="3")] + pub log: ::prost::alloc::string::String, + /// nondeterministic + #[prost(string, tag="4")] + pub info: ::prost::alloc::string::String, + #[prost(int64, tag="5")] + pub index: i64, + #[prost(bytes="vec", tag="6")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="7")] + pub value: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="8")] + pub proof_ops: ::core::option::Option, + #[prost(int64, tag="9")] + pub height: i64, + #[prost(string, tag="10")] + pub codespace: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseBeginBlock { + #[prost(message, repeated, tag="1")] + pub events: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseCheckTx { + #[prost(uint32, tag="1")] + pub code: u32, + #[prost(bytes="vec", tag="2")] + pub data: ::prost::alloc::vec::Vec, + /// nondeterministic + #[prost(string, tag="3")] + pub log: ::prost::alloc::string::String, + /// nondeterministic + #[prost(string, tag="4")] + pub info: ::prost::alloc::string::String, + #[prost(int64, tag="5")] + pub gas_wanted: i64, + #[prost(int64, tag="6")] + pub gas_used: i64, + #[prost(message, repeated, tag="7")] + pub events: ::prost::alloc::vec::Vec, + #[prost(string, tag="8")] + pub codespace: ::prost::alloc::string::String, + #[prost(string, tag="9")] + pub sender: ::prost::alloc::string::String, + #[prost(int64, tag="10")] + pub priority: i64, + /// mempool_error is set by Tendermint. + /// ABCI applictions creating a ResponseCheckTX should not set mempool_error. + #[prost(string, tag="11")] + pub mempool_error: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseDeliverTx { + #[prost(uint32, tag="1")] + pub code: u32, + #[prost(bytes="vec", tag="2")] + pub data: ::prost::alloc::vec::Vec, + /// nondeterministic + #[prost(string, tag="3")] + pub log: ::prost::alloc::string::String, + /// nondeterministic + #[prost(string, tag="4")] + pub info: ::prost::alloc::string::String, + #[prost(int64, tag="5")] + pub gas_wanted: i64, + #[prost(int64, tag="6")] + pub gas_used: i64, + /// nondeterministic + #[prost(message, repeated, tag="7")] + pub events: ::prost::alloc::vec::Vec, + #[prost(string, tag="8")] + pub codespace: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseEndBlock { + #[prost(message, repeated, tag="1")] + pub validator_updates: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub consensus_param_updates: ::core::option::Option, + #[prost(message, repeated, tag="3")] + pub events: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseCommit { + /// reserve 1 + #[prost(bytes="vec", tag="2")] + pub data: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub retain_height: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseListSnapshots { + #[prost(message, repeated, tag="1")] + pub snapshots: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseOfferSnapshot { + #[prost(enumeration="response_offer_snapshot::Result", tag="1")] + pub result: i32, +} +/// Nested message and enum types in `ResponseOfferSnapshot`. +pub mod response_offer_snapshot { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Result { + /// Unknown result, abort all snapshot restoration + Unknown = 0, + /// Snapshot accepted, apply chunks + Accept = 1, + /// Abort all snapshot restoration + Abort = 2, + /// Reject this specific snapshot, try others + Reject = 3, + /// Reject all snapshots of this format, try others + RejectFormat = 4, + /// 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 { + #[prost(bytes="vec", tag="1")] + pub chunk: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseApplySnapshotChunk { + #[prost(enumeration="response_apply_snapshot_chunk::Result", tag="1")] + pub result: i32, + /// Chunks to refetch and reapply + #[prost(uint32, repeated, tag="2")] + pub refetch_chunks: ::prost::alloc::vec::Vec, + /// Chunk senders to reject and ban + #[prost(string, repeated, tag="3")] + pub reject_senders: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// Nested message and enum types in `ResponseApplySnapshotChunk`. +pub mod response_apply_snapshot_chunk { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Result { + /// Unknown result, abort all snapshot restoration + Unknown = 0, + /// Chunk successfully accepted + Accept = 1, + /// Abort all snapshot restoration + Abort = 2, + /// Retry chunk (combine with refetch and reject) + Retry = 3, + /// Retry snapshot (combine with refetch and reject) + RetrySnapshot = 4, + /// 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 +/// that can be adjusted by the abci app +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConsensusParams { + #[prost(message, optional, tag="1")] + pub block: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub evidence: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub validator: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub version: ::core::option::Option, +} +/// BlockParams contains limits on the block size. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockParams { + /// Note: must be greater than 0 + #[prost(int64, tag="1")] + pub max_bytes: i64, + /// Note: must be greater or equal to -1 + #[prost(int64, tag="2")] + pub max_gas: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LastCommitInfo { + #[prost(int32, tag="1")] + pub round: i32, + #[prost(message, repeated, tag="2")] + pub votes: ::prost::alloc::vec::Vec, +} +/// Event allows application developers to attach additional information to +/// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. +/// Later, transactions may be queried using these events. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Event { + #[prost(string, tag="1")] + pub r#type: ::prost::alloc::string::String, + #[prost(message, repeated, tag="2")] + pub attributes: ::prost::alloc::vec::Vec, +} +/// EventAttribute is a single key-value pair, associated with an event. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventAttribute { + #[prost(bytes="vec", tag="1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub value: ::prost::alloc::vec::Vec, + /// nondeterministic + #[prost(bool, tag="3")] + pub index: bool, +} +/// TxResult contains results of executing the transaction. +/// +/// One usage is indexing transaction results. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxResult { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(uint32, tag="2")] + pub index: u32, + #[prost(bytes="vec", tag="3")] + pub tx: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="4")] + pub result: ::core::option::Option, +} +// ---------------------------------------- +// Blockchain Types + +/// Validator +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Validator { + /// The first 20 bytes of SHA256(public key) + #[prost(bytes="vec", tag="1")] + pub address: ::prost::alloc::vec::Vec, + /// PubKey pub_key = 2 \[(gogoproto.nullable)=false\]; + /// + /// The voting power + #[prost(int64, tag="3")] + pub power: i64, +} +/// ValidatorUpdate +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorUpdate { + #[prost(message, optional, tag="1")] + pub pub_key: ::core::option::Option, + #[prost(int64, tag="2")] + pub power: i64, +} +/// VoteInfo +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VoteInfo { + #[prost(message, optional, tag="1")] + pub validator: ::core::option::Option, + #[prost(bool, tag="2")] + pub signed_last_block: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Evidence { + #[prost(enumeration="EvidenceType", tag="1")] + pub r#type: i32, + /// The offending validator + #[prost(message, optional, tag="2")] + pub validator: ::core::option::Option, + /// The height when the offense occurred + #[prost(int64, tag="3")] + pub height: i64, + /// The corresponding time where the offense occurred + #[prost(message, optional, tag="4")] + pub time: ::core::option::Option, + /// Total voting power of the validator set in case the ABCI application does + /// not store historical validators. + /// + #[prost(int64, tag="5")] + pub total_voting_power: i64, +} +// ---------------------------------------- +// State Sync Types + +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Snapshot { + /// The height at which the snapshot was taken + #[prost(uint64, tag="1")] + pub height: u64, + /// The application-specific snapshot format + #[prost(uint32, tag="2")] + pub format: u32, + /// Number of chunks in the snapshot + #[prost(uint32, tag="3")] + pub chunks: u32, + /// Arbitrary snapshot hash, equal only if identical + #[prost(bytes="vec", tag="4")] + pub hash: ::prost::alloc::vec::Vec, + /// Arbitrary application metadata + #[prost(bytes="vec", tag="5")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +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", + } + } +} diff --git a/proto/src/prost/tendermint.blocksync.rs b/proto/src/prost/v0_34/tendermint.blockchain.rs similarity index 100% rename from proto/src/prost/tendermint.blocksync.rs rename to proto/src/prost/v0_34/tendermint.blockchain.rs diff --git a/proto/src/prost/tendermint.consensus.rs b/proto/src/prost/v0_34/tendermint.consensus.rs similarity index 97% rename from proto/src/prost/tendermint.consensus.rs rename to proto/src/prost/v0_34/tendermint.consensus.rs index 1ada48be4..6f3fe8624 100644 --- a/proto/src/prost/tendermint.consensus.rs +++ b/proto/src/prost/v0_34/tendermint.consensus.rs @@ -140,7 +140,7 @@ pub struct MsgInfo { #[derive(Clone, PartialEq, ::prost::Message)] pub struct TimeoutInfo { #[prost(message, optional, tag="1")] - pub duration: ::core::option::Option, + pub duration: ::core::option::Option, #[prost(int64, tag="2")] pub height: i64, #[prost(int32, tag="3")] @@ -178,7 +178,7 @@ pub mod wal_message { #[derive(Clone, PartialEq, ::prost::Message)] pub struct TimedWalMessage { #[prost(message, optional, tag="1")] - pub time: ::core::option::Option, + pub time: ::core::option::Option, #[prost(message, optional, tag="2")] pub msg: ::core::option::Option, } diff --git a/proto/src/prost/tendermint.crypto.rs b/proto/src/prost/v0_34/tendermint.crypto.rs similarity index 100% rename from proto/src/prost/tendermint.crypto.rs rename to proto/src/prost/v0_34/tendermint.crypto.rs diff --git a/proto/src/prost/tendermint.libs.bits.rs b/proto/src/prost/v0_34/tendermint.libs.bits.rs similarity index 100% rename from proto/src/prost/tendermint.libs.bits.rs rename to proto/src/prost/v0_34/tendermint.libs.bits.rs diff --git a/proto/src/prost/tendermint.mempool.rs b/proto/src/prost/v0_34/tendermint.mempool.rs similarity index 100% rename from proto/src/prost/tendermint.mempool.rs rename to proto/src/prost/v0_34/tendermint.mempool.rs diff --git a/proto/src/prost/tendermint.p2p.rs b/proto/src/prost/v0_34/tendermint.p2p.rs similarity index 100% rename from proto/src/prost/tendermint.p2p.rs rename to proto/src/prost/v0_34/tendermint.p2p.rs diff --git a/proto/src/prost/tendermint.privval.rs b/proto/src/prost/v0_34/tendermint.privval.rs similarity index 100% rename from proto/src/prost/tendermint.privval.rs rename to proto/src/prost/v0_34/tendermint.privval.rs diff --git a/proto/src/prost/tendermint.rpc.grpc.rs b/proto/src/prost/v0_34/tendermint.rpc.grpc.rs similarity index 100% rename from proto/src/prost/tendermint.rpc.grpc.rs rename to proto/src/prost/v0_34/tendermint.rpc.grpc.rs diff --git a/proto/src/prost/tendermint.state.rs b/proto/src/prost/v0_34/tendermint.state.rs similarity index 97% rename from proto/src/prost/tendermint.state.rs rename to proto/src/prost/v0_34/tendermint.state.rs index c536f5df5..c996b31a5 100644 --- a/proto/src/prost/tendermint.state.rs +++ b/proto/src/prost/v0_34/tendermint.state.rs @@ -55,7 +55,7 @@ pub struct State { #[prost(message, optional, tag="4")] pub last_block_id: ::core::option::Option, #[prost(message, optional, tag="5")] - pub last_block_time: ::core::option::Option, + pub last_block_time: ::core::option::Option, /// LastValidators is used to validate block.LastCommit. /// Validators are persisted to the database separately every time they change, /// so we can query for historical validator sets. diff --git a/proto/src/prost/tendermint.statesync.rs b/proto/src/prost/v0_34/tendermint.statesync.rs similarity index 100% rename from proto/src/prost/tendermint.statesync.rs rename to proto/src/prost/v0_34/tendermint.statesync.rs diff --git a/proto/src/prost/tendermint.store.rs b/proto/src/prost/v0_34/tendermint.store.rs similarity index 100% rename from proto/src/prost/tendermint.store.rs rename to proto/src/prost/v0_34/tendermint.store.rs diff --git a/proto/src/prost/v0_34/tendermint.types.rs b/proto/src/prost/v0_34/tendermint.types.rs new file mode 100644 index 000000000..a1ce46559 --- /dev/null +++ b/proto/src/prost/v0_34/tendermint.types.rs @@ -0,0 +1,520 @@ +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorSet { + #[prost(message, repeated, tag="1")] + pub validators: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub proposer: ::core::option::Option, + #[prost(int64, tag="3")] + pub total_voting_power: i64, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Validator { + #[prost(bytes="vec", tag="1")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub address: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub pub_key: ::core::option::Option, + #[prost(int64, tag="3")] + #[serde(alias = "power", with = "crate::serializers::from_str")] + pub voting_power: i64, + #[prost(int64, tag="4")] + #[serde(with = "crate::serializers::from_str", default)] + pub proposer_priority: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SimpleValidator { + #[prost(message, optional, tag="1")] + pub pub_key: ::core::option::Option, + #[prost(int64, tag="2")] + pub voting_power: i64, +} +/// PartsetHeader +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PartSetHeader { + #[prost(uint32, tag="1")] + #[serde(with = "crate::serializers::part_set_header_total")] + pub total: u32, + #[prost(bytes="vec", tag="2")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub hash: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Part { + #[prost(uint32, tag="1")] + pub index: u32, + #[prost(bytes="vec", tag="2")] + pub bytes: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="3")] + pub proof: ::core::option::Option, +} +/// BlockID +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockId { + #[prost(bytes="vec", tag="1")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + #[serde(alias = "parts")] + pub part_set_header: ::core::option::Option, +} +// -------------------------------- + +/// Header defines the structure of a Tendermint block header. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Header { + /// basic block info + #[prost(message, optional, tag="1")] + pub version: ::core::option::Option, + #[prost(string, tag="2")] + pub chain_id: ::prost::alloc::string::String, + #[prost(int64, tag="3")] + #[serde(with = "crate::serializers::from_str")] + pub height: i64, + #[prost(message, optional, tag="4")] + #[serde(with = "crate::serializers::optional")] + pub time: ::core::option::Option, + /// prev block info + #[prost(message, optional, tag="5")] + pub last_block_id: ::core::option::Option, + /// hashes of block data + /// + /// commit from validators from the last block + #[prost(bytes="vec", tag="6")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub last_commit_hash: ::prost::alloc::vec::Vec, + /// transactions + #[prost(bytes="vec", tag="7")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub data_hash: ::prost::alloc::vec::Vec, + /// hashes from the app output from the prev block + /// + /// validators for the current block + #[prost(bytes="vec", tag="8")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub validators_hash: ::prost::alloc::vec::Vec, + /// validators for the next block + #[prost(bytes="vec", tag="9")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub next_validators_hash: ::prost::alloc::vec::Vec, + /// consensus params for current block + #[prost(bytes="vec", tag="10")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub consensus_hash: ::prost::alloc::vec::Vec, + /// state after txs from the previous block + #[prost(bytes="vec", tag="11")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub app_hash: ::prost::alloc::vec::Vec, + /// root hash of all results from the txs from the previous block + #[prost(bytes="vec", tag="12")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub last_results_hash: ::prost::alloc::vec::Vec, + /// consensus info + /// + /// evidence included in the block + #[prost(bytes="vec", tag="13")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub evidence_hash: ::prost::alloc::vec::Vec, + /// original proposer of the block + #[prost(bytes="vec", tag="14")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub proposer_address: ::prost::alloc::vec::Vec, +} +/// Data contains the set of transactions included in the block +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Data { + /// Txs that will be applied by state @ block.Height+1. + /// NOTE: not all txs here are valid. We're just agreeing on the order first. + /// This means that block.AppHash does not include these txs. + #[prost(bytes="vec", repeated, tag="1")] + #[serde(with = "crate::serializers::txs")] + pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +/// Vote represents a prevote, precommit, or commit vote from validators for +/// consensus. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Vote { + #[prost(enumeration="SignedMsgType", tag="1")] + pub r#type: i32, + #[prost(int64, tag="2")] + #[serde(with = "crate::serializers::from_str")] + pub height: i64, + #[prost(int32, tag="3")] + #[serde(with = "crate::serializers::from_str")] + pub round: i32, + /// zero if vote is nil. + #[prost(message, optional, tag="4")] + pub block_id: ::core::option::Option, + #[prost(message, optional, tag="5")] + #[serde(with = "crate::serializers::optional")] + pub timestamp: ::core::option::Option, + #[prost(bytes="vec", tag="6")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub validator_address: ::prost::alloc::vec::Vec, + #[prost(int32, tag="7")] + #[serde(with = "crate::serializers::from_str")] + pub validator_index: i32, + #[prost(bytes="vec", tag="8")] + #[serde(with = "crate::serializers::bytes::base64string")] + pub signature: ::prost::alloc::vec::Vec, +} +/// Commit contains the evidence that a block was committed by a set of validators. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Commit { + #[prost(int64, tag="1")] + #[serde(with = "crate::serializers::from_str")] + pub height: i64, + #[prost(int32, tag="2")] + pub round: i32, + #[prost(message, optional, tag="3")] + pub block_id: ::core::option::Option, + #[prost(message, repeated, tag="4")] + #[serde(with = "crate::serializers::nullable")] + pub signatures: ::prost::alloc::vec::Vec, +} +/// CommitSig is a part of the Vote included in a Commit. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommitSig { + #[prost(enumeration="BlockIdFlag", tag="1")] + pub block_id_flag: i32, + #[prost(bytes="vec", tag="2")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub validator_address: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="3")] + #[serde(with = "crate::serializers::optional")] + pub timestamp: ::core::option::Option, + #[prost(bytes="vec", tag="4")] + #[serde(with = "crate::serializers::bytes::base64string")] + pub signature: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Proposal { + #[prost(enumeration="SignedMsgType", tag="1")] + pub r#type: i32, + #[prost(int64, tag="2")] + pub height: i64, + #[prost(int32, tag="3")] + pub round: i32, + #[prost(int32, tag="4")] + pub pol_round: i32, + #[prost(message, optional, tag="5")] + pub block_id: ::core::option::Option, + #[prost(message, optional, tag="6")] + pub timestamp: ::core::option::Option, + #[prost(bytes="vec", tag="7")] + pub signature: ::prost::alloc::vec::Vec, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignedHeader { + #[prost(message, optional, tag="1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag="2")] + pub commit: ::core::option::Option, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LightBlock { + #[prost(message, optional, tag="1")] + pub signed_header: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub validator_set: ::core::option::Option, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockMeta { + #[prost(message, optional, tag="1")] + pub block_id: ::core::option::Option, + #[prost(int64, tag="2")] + #[serde(with = "crate::serializers::from_str")] + pub block_size: i64, + #[prost(message, optional, tag="3")] + pub header: ::core::option::Option
, + #[prost(int64, tag="4")] + #[serde(with = "crate::serializers::from_str")] + pub num_txs: i64, +} +/// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxProof { + #[prost(bytes="vec", tag="1")] + #[serde(with = "crate::serializers::bytes::hexstring")] + pub root_hash: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + #[serde(with = "crate::serializers::bytes::base64string")] + pub data: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="3")] + pub proof: ::core::option::Option, +} +/// BlockIdFlag indicates which BlcokID the signature is for +#[derive(::num_derive::FromPrimitive, ::num_derive::ToPrimitive)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum BlockIdFlag { + Unknown = 0, + Absent = 1, + 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)] +pub enum SignedMsgType { + Unknown = 0, + /// Votes + Prevote = 1, + Precommit = 2, + /// 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", + } + } +} +/// ConsensusParams contains consensus critical parameters that determine the +/// validity of blocks. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConsensusParams { + #[prost(message, optional, tag="1")] + pub block: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub evidence: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub validator: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub version: ::core::option::Option, +} +/// BlockParams contains limits on the block size. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockParams { + /// Max block size, in bytes. + /// Note: must be greater than 0 + #[prost(int64, tag="1")] + pub max_bytes: i64, + /// Max gas per block. + /// Note: must be greater or equal to -1 + #[prost(int64, tag="2")] + pub max_gas: i64, + /// Minimum time increment between consecutive blocks (in milliseconds) If the + /// block header timestamp is ahead of the system clock, decrease this value. + /// + /// Not exposed to the application. + #[prost(int64, tag="3")] + pub time_iota_ms: i64, +} +/// EvidenceParams determine how we handle evidence of malfeasance. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EvidenceParams { + /// Max age of evidence, in blocks. + /// + /// The basic formula for calculating this is: MaxAgeDuration / {average block + /// time}. + #[prost(int64, tag="1")] + pub max_age_num_blocks: i64, + /// Max age of evidence, in time. + /// + /// It should correspond with an app's "unbonding period" or other similar + /// mechanism for handling [Nothing-At-Stake + /// attacks](). + #[prost(message, optional, tag="2")] + pub max_age_duration: ::core::option::Option, + /// This sets the maximum size of total evidence in bytes that can be committed in a single block. + /// and should fall comfortably under the max block bytes. + /// Default is 1048576 or 1MB + #[prost(int64, tag="3")] + #[serde(with = "crate::serializers::from_str", default)] + pub max_bytes: i64, +} +/// ValidatorParams restrict the public key types validators can use. +/// NOTE: uses ABCI pubkey naming, not Amino names. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorParams { + #[prost(string, repeated, tag="1")] + pub pub_key_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// VersionParams contains the ABCI application version. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VersionParams { + #[prost(uint64, tag="1")] + pub app_version: u64, +} +/// HashedParams is a subset of ConsensusParams. +/// +/// It is hashed into the Header.ConsensusHash. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HashedParams { + #[prost(int64, tag="1")] + pub block_max_bytes: i64, + #[prost(int64, tag="2")] + pub block_max_gas: i64, +} +#[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, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[serde(from = "crate::serializers::evidence::EvidenceVariant", into = "crate::serializers::evidence::EvidenceVariant")] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Evidence { + #[prost(oneof="evidence::Sum", tags="1, 2")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Evidence`. +pub mod evidence { + #[derive(::serde::Deserialize, ::serde::Serialize)] + #[serde(tag = "type", content = "value")] + #[serde(from = "crate::serializers::evidence::EvidenceVariant", into = "crate::serializers::evidence::EvidenceVariant")] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + #[serde(rename = "tendermint/DuplicateVoteEvidence")] + DuplicateVoteEvidence(super::DuplicateVoteEvidence), + #[prost(message, tag="2")] + #[serde(rename = "tendermint/LightClientAttackEvidence")] + LightClientAttackEvidence(super::LightClientAttackEvidence), + } +} +/// DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DuplicateVoteEvidence { + #[prost(message, optional, tag="1")] + pub vote_a: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub vote_b: ::core::option::Option, + #[prost(int64, tag="3")] + pub total_voting_power: i64, + #[prost(int64, tag="4")] + pub validator_power: i64, + #[prost(message, optional, tag="5")] + pub timestamp: ::core::option::Option, +} +/// LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LightClientAttackEvidence { + #[prost(message, optional, tag="1")] + pub conflicting_block: ::core::option::Option, + #[prost(int64, tag="2")] + pub common_height: i64, + #[prost(message, repeated, tag="3")] + pub byzantine_validators: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub total_voting_power: i64, + #[prost(message, optional, tag="5")] + pub timestamp: ::core::option::Option, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EvidenceList { + #[prost(message, repeated, tag="1")] + #[serde(with = "crate::serializers::nullable")] + pub evidence: ::prost::alloc::vec::Vec, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Block { + #[prost(message, optional, tag="1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag="2")] + pub data: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub evidence: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub last_commit: ::core::option::Option, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CanonicalBlockId { + #[prost(bytes="vec", tag="1")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + #[serde(alias = "parts")] + pub part_set_header: ::core::option::Option, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CanonicalPartSetHeader { + #[prost(uint32, tag="1")] + pub total: u32, + #[prost(bytes="vec", tag="2")] + pub hash: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CanonicalProposal { + /// type alias for byte + #[prost(enumeration="SignedMsgType", tag="1")] + pub r#type: i32, + /// canonicalization requires fixed size encoding here + #[prost(sfixed64, tag="2")] + pub height: i64, + /// canonicalization requires fixed size encoding here + #[prost(sfixed64, tag="3")] + pub round: i64, + #[prost(int64, tag="4")] + pub pol_round: i64, + #[prost(message, optional, tag="5")] + pub block_id: ::core::option::Option, + #[prost(message, optional, tag="6")] + pub timestamp: ::core::option::Option, + #[prost(string, tag="7")] + pub chain_id: ::prost::alloc::string::String, +} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CanonicalVote { + /// type alias for byte + #[prost(enumeration="SignedMsgType", tag="1")] + pub r#type: i32, + /// canonicalization requires fixed size encoding here + #[prost(sfixed64, tag="2")] + pub height: i64, + /// canonicalization requires fixed size encoding here + #[prost(sfixed64, tag="3")] + pub round: i64, + #[prost(message, optional, tag="4")] + pub block_id: ::core::option::Option, + #[prost(message, optional, tag="5")] + pub timestamp: ::core::option::Option, + #[prost(string, tag="6")] + pub chain_id: ::prost::alloc::string::String, +} diff --git a/proto/src/prost/tendermint.version.rs b/proto/src/prost/v0_34/tendermint.version.rs similarity index 100% rename from proto/src/prost/tendermint.version.rs rename to proto/src/prost/v0_34/tendermint.version.rs diff --git a/proto/src/prost/tendermint.abci.rs b/proto/src/prost/v0_37/tendermint.abci.rs similarity index 98% rename from proto/src/prost/tendermint.abci.rs rename to proto/src/prost/v0_37/tendermint.abci.rs index 313618514..4b38fbb88 100644 --- a/proto/src/prost/tendermint.abci.rs +++ b/proto/src/prost/v0_37/tendermint.abci.rs @@ -70,7 +70,7 @@ pub struct RequestInfo { #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestInitChain { #[prost(message, optional, tag="1")] - pub time: ::core::option::Option, + pub time: ::core::option::Option, #[prost(string, tag="2")] pub chain_id: ::prost::alloc::string::String, #[prost(message, optional, tag="3")] @@ -174,7 +174,7 @@ pub struct RequestPrepareProposal { #[prost(int64, tag="5")] pub height: i64, #[prost(message, optional, tag="6")] - pub time: ::core::option::Option, + pub time: ::core::option::Option, #[prost(bytes="vec", tag="7")] pub next_validators_hash: ::prost::alloc::vec::Vec, /// address of the public key of the validator proposing the block. @@ -195,7 +195,7 @@ pub struct RequestProcessProposal { #[prost(int64, tag="5")] pub height: i64, #[prost(message, optional, tag="6")] - pub time: ::core::option::Option, + pub time: ::core::option::Option, #[prost(bytes="vec", tag="7")] pub next_validators_hash: ::prost::alloc::vec::Vec, /// address of the public key of the original proposer of the block. @@ -628,7 +628,7 @@ pub struct Misbehavior { pub height: i64, /// The corresponding time where the offense occurred #[prost(message, optional, tag="4")] - pub time: ::core::option::Option, + pub time: ::core::option::Option, /// Total voting power of the validator set in case the ABCI application does /// not store historical validators. /// diff --git a/proto/src/prost/v0_37/tendermint.blocksync.rs b/proto/src/prost/v0_37/tendermint.blocksync.rs new file mode 100644 index 000000000..492aa692e --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.blocksync.rs @@ -0,0 +1,51 @@ +/// BlockRequest requests a block for a specific height +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockRequest { + #[prost(int64, tag="1")] + pub height: i64, +} +/// NoBlockResponse informs the node that the peer does not have block at the requested height +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NoBlockResponse { + #[prost(int64, tag="1")] + pub height: i64, +} +/// BlockResponse returns block to the requested +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockResponse { + #[prost(message, optional, tag="1")] + pub block: ::core::option::Option, +} +/// StatusRequest requests the status of a peer. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusRequest { +} +/// StatusResponse is a peer response to inform their status. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusResponse { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int64, tag="2")] + pub base: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1, 2, 3, 4, 5")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Message`. +pub mod message { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + BlockRequest(super::BlockRequest), + #[prost(message, tag="2")] + NoBlockResponse(super::NoBlockResponse), + #[prost(message, tag="3")] + BlockResponse(super::BlockResponse), + #[prost(message, tag="4")] + StatusRequest(super::StatusRequest), + #[prost(message, tag="5")] + StatusResponse(super::StatusResponse), + } +} diff --git a/proto/src/prost/v0_37/tendermint.consensus.rs b/proto/src/prost/v0_37/tendermint.consensus.rs new file mode 100644 index 000000000..6f3fe8624 --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.consensus.rs @@ -0,0 +1,184 @@ +/// NewRoundStep is sent for every step taken in the ConsensusState. +/// For every height/round/step transition +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewRoundStep { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int32, tag="2")] + pub round: i32, + #[prost(uint32, tag="3")] + pub step: u32, + #[prost(int64, tag="4")] + pub seconds_since_start_time: i64, + #[prost(int32, tag="5")] + 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. +/// In case the block is also committed, then IsCommit flag is set to true. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewValidBlock { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int32, tag="2")] + pub round: i32, + #[prost(message, optional, tag="3")] + pub block_part_set_header: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub block_parts: ::core::option::Option, + #[prost(bool, tag="5")] + pub is_commit: bool, +} +/// Proposal is sent when a new block is proposed. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Proposal { + #[prost(message, optional, tag="1")] + pub proposal: ::core::option::Option, +} +/// ProposalPOL is sent when a previous proposal is re-proposed. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProposalPol { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int32, tag="2")] + pub proposal_pol_round: i32, + #[prost(message, optional, tag="3")] + pub proposal_pol: ::core::option::Option, +} +/// BlockPart is sent when gossipping a piece of the proposed block. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockPart { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int32, tag="2")] + pub round: i32, + #[prost(message, optional, tag="3")] + pub part: ::core::option::Option, +} +/// Vote is sent when voting for a proposal (or lack thereof). +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Vote { + #[prost(message, optional, tag="1")] + pub vote: ::core::option::Option, +} +/// HasVote is sent to indicate that a particular vote has been received. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HasVote { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int32, tag="2")] + pub round: i32, + #[prost(enumeration="super::types::SignedMsgType", tag="3")] + pub r#type: i32, + #[prost(int32, tag="4")] + pub index: i32, +} +/// VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VoteSetMaj23 { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int32, tag="2")] + pub round: i32, + #[prost(enumeration="super::types::SignedMsgType", tag="3")] + pub r#type: i32, + #[prost(message, optional, tag="4")] + pub block_id: ::core::option::Option, +} +/// VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VoteSetBits { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int32, tag="2")] + pub round: i32, + #[prost(enumeration="super::types::SignedMsgType", tag="3")] + pub r#type: i32, + #[prost(message, optional, tag="4")] + pub block_id: ::core::option::Option, + #[prost(message, optional, tag="5")] + pub votes: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1, 2, 3, 4, 5, 6, 7, 8, 9")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Message`. +pub mod message { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + NewRoundStep(super::NewRoundStep), + #[prost(message, tag="2")] + NewValidBlock(super::NewValidBlock), + #[prost(message, tag="3")] + Proposal(super::Proposal), + #[prost(message, tag="4")] + ProposalPol(super::ProposalPol), + #[prost(message, tag="5")] + BlockPart(super::BlockPart), + #[prost(message, tag="6")] + Vote(super::Vote), + #[prost(message, tag="7")] + HasVote(super::HasVote), + #[prost(message, tag="8")] + VoteSetMaj23(super::VoteSetMaj23), + #[prost(message, tag="9")] + VoteSetBits(super::VoteSetBits), + } +} +/// MsgInfo are msgs from the reactor which may update the state +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgInfo { + #[prost(message, optional, tag="1")] + pub msg: ::core::option::Option, + #[prost(string, tag="2")] + pub peer_id: ::prost::alloc::string::String, +} +/// TimeoutInfo internally generated messages which may update the state +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TimeoutInfo { + #[prost(message, optional, tag="1")] + pub duration: ::core::option::Option, + #[prost(int64, tag="2")] + pub height: i64, + #[prost(int32, tag="3")] + pub round: i32, + #[prost(uint32, tag="4")] + pub step: u32, +} +/// EndHeight marks the end of the given height inside WAL. +/// @internal used by scripts/wal2json util. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EndHeight { + #[prost(int64, tag="1")] + pub height: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WalMessage { + #[prost(oneof="wal_message::Sum", tags="1, 2, 3, 4")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `WALMessage`. +pub mod wal_message { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + EventDataRoundState(super::super::types::EventDataRoundState), + #[prost(message, tag="2")] + MsgInfo(super::MsgInfo), + #[prost(message, tag="3")] + TimeoutInfo(super::TimeoutInfo), + #[prost(message, tag="4")] + EndHeight(super::EndHeight), + } +} +/// TimedWALMessage wraps WALMessage and adds Time for debugging purposes. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TimedWalMessage { + #[prost(message, optional, tag="1")] + pub time: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub msg: ::core::option::Option, +} diff --git a/proto/src/prost/v0_37/tendermint.crypto.rs b/proto/src/prost/v0_37/tendermint.crypto.rs new file mode 100644 index 000000000..0fac07973 --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.crypto.rs @@ -0,0 +1,73 @@ +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Proof { + #[prost(int64, tag="1")] + #[serde(with = "crate::serializers::from_str")] + pub total: i64, + #[prost(int64, tag="2")] + #[serde(with = "crate::serializers::from_str")] + pub index: i64, + #[prost(bytes="vec", tag="3")] + #[serde(with = "crate::serializers::bytes::base64string")] + pub leaf_hash: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="4")] + #[serde(with = "crate::serializers::bytes::vec_base64string")] + pub aunts: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValueOp { + /// Encoded in ProofOp.Key. + #[prost(bytes="vec", tag="1")] + pub key: ::prost::alloc::vec::Vec, + /// To encode in ProofOp.Data + #[prost(message, optional, tag="2")] + pub proof: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DominoOp { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub input: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub output: ::prost::alloc::string::String, +} +/// ProofOp defines an operation used for calculating Merkle root +/// The data could be arbitrary format, providing nessecary data +/// for example neighbouring node hash +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProofOp { + #[prost(string, tag="1")] + pub r#type: ::prost::alloc::string::String, + #[prost(bytes="vec", tag="2")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub data: ::prost::alloc::vec::Vec, +} +/// ProofOps is Merkle proof defined by the list of ProofOps +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProofOps { + #[prost(message, repeated, tag="1")] + pub ops: ::prost::alloc::vec::Vec, +} +/// PublicKey defines the keys available for use with Tendermint Validators +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PublicKey { + #[prost(oneof="public_key::Sum", tags="1, 2")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `PublicKey`. +pub mod public_key { + #[derive(::serde::Deserialize, ::serde::Serialize)] + #[serde(tag = "type", content = "value")] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(bytes, tag="1")] + #[serde(rename = "tendermint/PubKeyEd25519", with = "crate::serializers::bytes::base64string")] + Ed25519(::prost::alloc::vec::Vec), + #[prost(bytes, tag="2")] + #[serde(rename = "tendermint/PubKeySecp256k1", with = "crate::serializers::bytes::base64string")] + Secp256k1(::prost::alloc::vec::Vec), + } +} diff --git a/proto/src/prost/v0_37/tendermint.libs.bits.rs b/proto/src/prost/v0_37/tendermint.libs.bits.rs new file mode 100644 index 000000000..47eee3773 --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.libs.bits.rs @@ -0,0 +1,8 @@ +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BitArray { + #[prost(int64, tag="1")] + pub bits: i64, + #[prost(uint64, repeated, tag="2")] + pub elems: ::prost::alloc::vec::Vec, +} diff --git a/proto/src/prost/v0_37/tendermint.mempool.rs b/proto/src/prost/v0_37/tendermint.mempool.rs new file mode 100644 index 000000000..af22801ba --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.mempool.rs @@ -0,0 +1,18 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Txs { + #[prost(bytes="vec", repeated, tag="1")] + pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Message`. +pub mod message { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + Txs(super::Txs), + } +} diff --git a/proto/src/prost/v0_37/tendermint.p2p.rs b/proto/src/prost/v0_37/tendermint.p2p.rs new file mode 100644 index 000000000..4b81d0be0 --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.p2p.rs @@ -0,0 +1,106 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PacketPing { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PacketPong { +} +#[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, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Packet { + #[prost(oneof="packet::Sum", tags="1, 2, 3")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Packet`. +pub mod packet { + #[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), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuthSigMessage { + #[prost(message, optional, tag="1")] + pub pub_key: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub sig: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NetAddress { + #[prost(string, tag="1")] + pub id: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub ip: ::prost::alloc::string::String, + #[prost(uint32, tag="3")] + pub port: u32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProtocolVersion { + #[prost(uint64, tag="1")] + pub p2p: u64, + #[prost(uint64, tag="2")] + pub block: u64, + #[prost(uint64, tag="3")] + pub app: u64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DefaultNodeInfo { + #[prost(message, optional, tag="1")] + pub protocol_version: ::core::option::Option, + #[prost(string, tag="2")] + pub default_node_id: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub listen_addr: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub network: ::prost::alloc::string::String, + #[prost(string, tag="5")] + pub version: ::prost::alloc::string::String, + #[prost(bytes="vec", tag="6")] + pub channels: ::prost::alloc::vec::Vec, + #[prost(string, tag="7")] + pub moniker: ::prost::alloc::string::String, + #[prost(message, optional, tag="8")] + pub other: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DefaultNodeInfoOther { + #[prost(string, tag="1")] + pub tx_index: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub rpc_address: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PexRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PexAddrs { + #[prost(message, repeated, tag="1")] + pub addrs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1, 2")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Message`. +pub mod message { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + PexRequest(super::PexRequest), + #[prost(message, tag="2")] + PexAddrs(super::PexAddrs), + } +} diff --git a/proto/src/prost/v0_37/tendermint.privval.rs b/proto/src/prost/v0_37/tendermint.privval.rs new file mode 100644 index 000000000..892a10bbf --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.privval.rs @@ -0,0 +1,114 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RemoteSignerError { + #[prost(int32, tag="1")] + pub code: i32, + #[prost(string, tag="2")] + pub description: ::prost::alloc::string::String, +} +/// PubKeyRequest requests the consensus public key from the remote signer. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubKeyRequest { + #[prost(string, tag="1")] + pub chain_id: ::prost::alloc::string::String, +} +/// PubKeyResponse is a response message containing the public key. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubKeyResponse { + #[prost(message, optional, tag="1")] + pub pub_key: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub error: ::core::option::Option, +} +/// SignVoteRequest is a request to sign a vote +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignVoteRequest { + #[prost(message, optional, tag="1")] + pub vote: ::core::option::Option, + #[prost(string, tag="2")] + pub chain_id: ::prost::alloc::string::String, +} +/// SignedVoteResponse is a response containing a signed vote or an error +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignedVoteResponse { + #[prost(message, optional, tag="1")] + pub vote: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub error: ::core::option::Option, +} +/// SignProposalRequest is a request to sign a proposal +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignProposalRequest { + #[prost(message, optional, tag="1")] + pub proposal: ::core::option::Option, + #[prost(string, tag="2")] + pub chain_id: ::prost::alloc::string::String, +} +/// SignedProposalResponse is response containing a signed proposal or an error +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignedProposalResponse { + #[prost(message, optional, tag="1")] + pub proposal: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub error: ::core::option::Option, +} +/// PingRequest is a request to confirm that the connection is alive. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PingRequest { +} +/// PingResponse is a response to confirm that the connection is alive. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PingResponse { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1, 2, 3, 4, 5, 6, 7, 8")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Message`. +pub mod message { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + PubKeyRequest(super::PubKeyRequest), + #[prost(message, tag="2")] + PubKeyResponse(super::PubKeyResponse), + #[prost(message, tag="3")] + SignVoteRequest(super::SignVoteRequest), + #[prost(message, tag="4")] + SignedVoteResponse(super::SignedVoteResponse), + #[prost(message, tag="5")] + SignProposalRequest(super::SignProposalRequest), + #[prost(message, tag="6")] + SignedProposalResponse(super::SignedProposalResponse), + #[prost(message, tag="7")] + PingRequest(super::PingRequest), + #[prost(message, tag="8")] + PingResponse(super::PingResponse), + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Errors { + Unknown = 0, + UnexpectedResponse = 1, + NoConnection = 2, + ConnectionTimeout = 3, + 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/v0_37/tendermint.rpc.grpc.rs b/proto/src/prost/v0_37/tendermint.rpc.grpc.rs new file mode 100644 index 000000000..4739bccac --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.rpc.grpc.rs @@ -0,0 +1,24 @@ +// ---------------------------------------- +// Request types + +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestPing { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestBroadcastTx { + #[prost(bytes="vec", tag="1")] + pub tx: ::prost::alloc::vec::Vec, +} +// ---------------------------------------- +// Response types + +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponsePing { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseBroadcastTx { + #[prost(message, optional, tag="1")] + pub check_tx: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub deliver_tx: ::core::option::Option, +} diff --git a/proto/src/prost/v0_37/tendermint.state.rs b/proto/src/prost/v0_37/tendermint.state.rs new file mode 100644 index 000000000..c996b31a5 --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.state.rs @@ -0,0 +1,85 @@ +/// ABCIResponses retains the responses +/// of the various ABCI calls during block processing. +/// It is persisted to disk for each height before calling Commit. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AbciResponses { + #[prost(message, repeated, tag="1")] + pub deliver_txs: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub end_block: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub begin_block: ::core::option::Option, +} +/// ValidatorsInfo represents the latest validator set, or the last height it changed +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorsInfo { + #[prost(message, optional, tag="1")] + pub validator_set: ::core::option::Option, + #[prost(int64, tag="2")] + pub last_height_changed: i64, +} +/// ConsensusParamsInfo represents the latest consensus params, or the last height it changed +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConsensusParamsInfo { + #[prost(message, optional, tag="1")] + pub consensus_params: ::core::option::Option, + #[prost(int64, tag="2")] + pub last_height_changed: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AbciResponsesInfo { + #[prost(message, optional, tag="1")] + pub abci_responses: ::core::option::Option, + #[prost(int64, tag="2")] + pub height: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Version { + #[prost(message, optional, tag="1")] + pub consensus: ::core::option::Option, + #[prost(string, tag="2")] + pub software: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct State { + #[prost(message, optional, tag="1")] + pub version: ::core::option::Option, + /// immutable + #[prost(string, tag="2")] + pub chain_id: ::prost::alloc::string::String, + #[prost(int64, tag="14")] + pub initial_height: i64, + /// LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) + #[prost(int64, tag="3")] + pub last_block_height: i64, + #[prost(message, optional, tag="4")] + pub last_block_id: ::core::option::Option, + #[prost(message, optional, tag="5")] + pub last_block_time: ::core::option::Option, + /// LastValidators is used to validate block.LastCommit. + /// Validators are persisted to the database separately every time they change, + /// so we can query for historical validator sets. + /// Note that if s.LastBlockHeight causes a valset change, + /// we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 + /// Extra +1 due to nextValSet delay. + #[prost(message, optional, tag="6")] + pub next_validators: ::core::option::Option, + #[prost(message, optional, tag="7")] + pub validators: ::core::option::Option, + #[prost(message, optional, tag="8")] + pub last_validators: ::core::option::Option, + #[prost(int64, tag="9")] + pub last_height_validators_changed: i64, + /// Consensus parameters used for validating blocks. + /// Changes returned by EndBlock and updated after Commit. + #[prost(message, optional, tag="10")] + pub consensus_params: ::core::option::Option, + #[prost(int64, tag="11")] + pub last_height_consensus_params_changed: i64, + /// Merkle root of the results from executing prev block + #[prost(bytes="vec", tag="12")] + pub last_results_hash: ::prost::alloc::vec::Vec, + /// the latest AppHash we've received from calling abci.Commit() + #[prost(bytes="vec", tag="13")] + pub app_hash: ::prost::alloc::vec::Vec, +} diff --git a/proto/src/prost/v0_37/tendermint.statesync.rs b/proto/src/prost/v0_37/tendermint.statesync.rs new file mode 100644 index 000000000..593bd0222 --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.statesync.rs @@ -0,0 +1,57 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1, 2, 3, 4")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Message`. +pub mod message { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + SnapshotsRequest(super::SnapshotsRequest), + #[prost(message, tag="2")] + SnapshotsResponse(super::SnapshotsResponse), + #[prost(message, tag="3")] + ChunkRequest(super::ChunkRequest), + #[prost(message, tag="4")] + ChunkResponse(super::ChunkResponse), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotsRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotsResponse { + #[prost(uint64, tag="1")] + pub height: u64, + #[prost(uint32, tag="2")] + pub format: u32, + #[prost(uint32, tag="3")] + pub chunks: u32, + #[prost(bytes="vec", tag="4")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="5")] + pub metadata: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChunkRequest { + #[prost(uint64, tag="1")] + pub height: u64, + #[prost(uint32, tag="2")] + pub format: u32, + #[prost(uint32, tag="3")] + pub index: u32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChunkResponse { + #[prost(uint64, tag="1")] + pub height: u64, + #[prost(uint32, tag="2")] + pub format: u32, + #[prost(uint32, tag="3")] + pub index: u32, + #[prost(bytes="vec", tag="4")] + pub chunk: ::prost::alloc::vec::Vec, + #[prost(bool, tag="5")] + pub missing: bool, +} diff --git a/proto/src/prost/v0_37/tendermint.store.rs b/proto/src/prost/v0_37/tendermint.store.rs new file mode 100644 index 000000000..a4c2799d9 --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.store.rs @@ -0,0 +1,7 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockStoreState { + #[prost(int64, tag="1")] + pub base: i64, + #[prost(int64, tag="2")] + pub height: i64, +} diff --git a/proto/src/prost/tendermint.types.rs b/proto/src/prost/v0_37/tendermint.types.rs similarity index 96% rename from proto/src/prost/tendermint.types.rs rename to proto/src/prost/v0_37/tendermint.types.rs index e1b3002b0..7e9700f84 100644 --- a/proto/src/prost/tendermint.types.rs +++ b/proto/src/prost/v0_37/tendermint.types.rs @@ -77,7 +77,7 @@ pub struct Header { pub height: i64, #[prost(message, optional, tag="4")] #[serde(with = "crate::serializers::optional")] - pub time: ::core::option::Option, + pub time: ::core::option::Option, /// prev block info #[prost(message, optional, tag="5")] pub last_block_id: ::core::option::Option, @@ -153,7 +153,7 @@ pub struct Vote { pub block_id: ::core::option::Option, #[prost(message, optional, tag="5")] #[serde(with = "crate::serializers::optional")] - pub timestamp: ::core::option::Option, + pub timestamp: ::core::option::Option, #[prost(bytes="vec", tag="6")] #[serde(with = "crate::serializers::bytes::hexstring")] pub validator_address: ::prost::alloc::vec::Vec, @@ -190,7 +190,7 @@ pub struct CommitSig { pub validator_address: ::prost::alloc::vec::Vec, #[prost(message, optional, tag="3")] #[serde(with = "crate::serializers::optional")] - pub timestamp: ::core::option::Option, + pub timestamp: ::core::option::Option, #[prost(bytes="vec", tag="4")] #[serde(with = "crate::serializers::bytes::base64string")] pub signature: ::prost::alloc::vec::Vec, @@ -208,7 +208,7 @@ pub struct Proposal { #[prost(message, optional, tag="5")] pub block_id: ::core::option::Option, #[prost(message, optional, tag="6")] - pub timestamp: ::core::option::Option, + pub timestamp: ::core::option::Option, #[prost(bytes="vec", tag="7")] pub signature: ::prost::alloc::vec::Vec, } @@ -345,7 +345,7 @@ pub struct EvidenceParams { /// mechanism for handling [Nothing-At-Stake /// attacks](). #[prost(message, optional, tag="2")] - pub max_age_duration: ::core::option::Option, + pub max_age_duration: ::core::option::Option, /// This sets the maximum size of total evidence in bytes that can be committed in a single block. /// and should fall comfortably under the max block bytes. /// Default is 1048576 or 1MB @@ -376,6 +376,15 @@ pub struct HashedParams { #[prost(int64, tag="2")] pub block_max_gas: i64, } +#[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, +} #[derive(::serde::Deserialize, ::serde::Serialize)] #[serde(from = "crate::serializers::evidence::EvidenceVariant", into = "crate::serializers::evidence::EvidenceVariant")] #[derive(Clone, PartialEq, ::prost::Message)] @@ -411,7 +420,7 @@ pub struct DuplicateVoteEvidence { #[prost(int64, tag="4")] pub validator_power: i64, #[prost(message, optional, tag="5")] - pub timestamp: ::core::option::Option, + pub timestamp: ::core::option::Option, } /// LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. #[derive(::serde::Deserialize, ::serde::Serialize)] @@ -426,7 +435,7 @@ pub struct LightClientAttackEvidence { #[prost(int64, tag="4")] pub total_voting_power: i64, #[prost(message, optional, tag="5")] - pub timestamp: ::core::option::Option, + pub timestamp: ::core::option::Option, } #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -447,15 +456,6 @@ pub struct Block { #[prost(message, optional, tag="4")] pub last_commit: ::core::option::Option, } -#[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, -} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CanonicalBlockId { @@ -489,7 +489,7 @@ pub struct CanonicalProposal { #[prost(message, optional, tag="5")] pub block_id: ::core::option::Option, #[prost(message, optional, tag="6")] - pub timestamp: ::core::option::Option, + pub timestamp: ::core::option::Option, #[prost(string, tag="7")] pub chain_id: ::prost::alloc::string::String, } @@ -508,7 +508,7 @@ pub struct CanonicalVote { #[prost(message, optional, tag="4")] pub block_id: ::core::option::Option, #[prost(message, optional, tag="5")] - pub timestamp: ::core::option::Option, + pub timestamp: ::core::option::Option, #[prost(string, tag="6")] pub chain_id: ::prost::alloc::string::String, } diff --git a/proto/src/prost/v0_37/tendermint.version.rs b/proto/src/prost/v0_37/tendermint.version.rs new file mode 100644 index 000000000..bd1227266 --- /dev/null +++ b/proto/src/prost/v0_37/tendermint.version.rs @@ -0,0 +1,23 @@ +/// App includes the protocol and software version for the application. +/// This information is included in ResponseInfo. The App.Protocol can be +/// updated in ResponseEndBlock. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct App { + #[prost(uint64, tag="1")] + pub protocol: u64, + #[prost(string, tag="2")] + pub software: ::prost::alloc::string::String, +} +/// Consensus captures the consensus rules for processing a block in the blockchain, +/// including all blockchain data structures and the rules of the application's +/// state transition machine. +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Consensus { + #[prost(uint64, tag="1")] + #[serde(with = "crate::serializers::from_str")] + pub block: u64, + #[prost(uint64, tag="2")] + #[serde(with = "crate::serializers::from_str", default)] + pub app: u64, +} diff --git a/proto/src/tendermint.rs b/proto/src/tendermint.rs index 1513aeee8..4a8211a91 100644 --- a/proto/src/tendermint.rs +++ b/proto/src/tendermint.rs @@ -1,66 +1,3 @@ -//! Tendermint-proto auto-generated sub-modules for Tendermint - -pub mod abci { - include!("prost/tendermint.abci.rs"); -} - -pub mod blocksync { - include!("prost/tendermint.blocksync.rs"); -} - -pub mod consensus { - include!("prost/tendermint.consensus.rs"); -} - -pub mod crypto { - include!("prost/tendermint.crypto.rs"); -} - -pub mod libs { - pub mod bits { - include!("prost/tendermint.libs.bits.rs"); - } -} - -pub mod mempool { - include!("prost/tendermint.mempool.rs"); -} - -pub mod p2p { - include!("prost/tendermint.p2p.rs"); -} - -pub mod privval { - include!("prost/tendermint.privval.rs"); -} - -pub mod rpc { - pub mod grpc { - include!("prost/tendermint.rpc.grpc.rs"); - } -} - -pub mod state { - include!("prost/tendermint.state.rs"); -} - -pub mod statesync { - include!("prost/tendermint.statesync.rs"); -} - -pub mod store { - include!("prost/tendermint.store.rs"); -} - -pub mod types { - include!("prost/tendermint.types.rs"); -} - -pub mod version { - include!("prost/tendermint.version.rs"); -} - -pub mod meta { - pub const REPOSITORY: &str = "https://github.com/tendermint/tendermint"; - pub const COMMITISH: &str = "v0.37.0-alpha.1"; -} +pub mod v0_34; +pub mod v0_37; +pub use v0_37::*; diff --git a/proto/src/tendermint/v0_34.rs b/proto/src/tendermint/v0_34.rs new file mode 100644 index 000000000..950815c7d --- /dev/null +++ b/proto/src/tendermint/v0_34.rs @@ -0,0 +1,66 @@ +//! Tendermint-proto auto-generated sub-modules for Tendermint + +pub mod abci { + include!("../prost/v0_34/tendermint.abci.rs"); +} + +pub mod blockchain { + include!("../prost/v0_34/tendermint.blockchain.rs"); +} + +pub mod consensus { + include!("../prost/v0_34/tendermint.consensus.rs"); +} + +pub mod crypto { + include!("../prost/v0_34/tendermint.crypto.rs"); +} + +pub mod libs { + pub mod bits { + include!("../prost/v0_34/tendermint.libs.bits.rs"); + } +} + +pub mod mempool { + include!("../prost/v0_34/tendermint.mempool.rs"); +} + +pub mod p2p { + include!("../prost/v0_34/tendermint.p2p.rs"); +} + +pub mod privval { + include!("../prost/v0_34/tendermint.privval.rs"); +} + +pub mod rpc { + pub mod grpc { + include!("../prost/v0_34/tendermint.rpc.grpc.rs"); + } +} + +pub mod state { + include!("../prost/v0_34/tendermint.state.rs"); +} + +pub mod statesync { + include!("../prost/v0_34/tendermint.statesync.rs"); +} + +pub mod store { + include!("../prost/v0_34/tendermint.store.rs"); +} + +pub mod types { + include!("../prost/v0_34/tendermint.types.rs"); +} + +pub mod version { + include!("../prost/v0_34/tendermint.version.rs"); +} + +pub mod meta { + pub const REPOSITORY: &str = "https://github.com/tendermint/tendermint"; + pub const COMMITISH: &str = "v0.34.21"; +} diff --git a/proto/src/tendermint/v0_37.rs b/proto/src/tendermint/v0_37.rs new file mode 100644 index 000000000..292f1a337 --- /dev/null +++ b/proto/src/tendermint/v0_37.rs @@ -0,0 +1,66 @@ +//! Tendermint-proto auto-generated sub-modules for Tendermint + +pub mod abci { + include!("../prost/v0_37/tendermint.abci.rs"); +} + +pub mod blocksync { + include!("../prost/v0_37/tendermint.blocksync.rs"); +} + +pub mod consensus { + include!("../prost/v0_37/tendermint.consensus.rs"); +} + +pub mod crypto { + include!("../prost/v0_37/tendermint.crypto.rs"); +} + +pub mod libs { + pub mod bits { + include!("../prost/v0_37/tendermint.libs.bits.rs"); + } +} + +pub mod mempool { + include!("../prost/v0_37/tendermint.mempool.rs"); +} + +pub mod p2p { + include!("../prost/v0_37/tendermint.p2p.rs"); +} + +pub mod privval { + include!("../prost/v0_37/tendermint.privval.rs"); +} + +pub mod rpc { + pub mod grpc { + include!("../prost/v0_37/tendermint.rpc.grpc.rs"); + } +} + +pub mod state { + include!("../prost/v0_37/tendermint.state.rs"); +} + +pub mod statesync { + include!("../prost/v0_37/tendermint.statesync.rs"); +} + +pub mod store { + include!("../prost/v0_37/tendermint.store.rs"); +} + +pub mod types { + include!("../prost/v0_37/tendermint.types.rs"); +} + +pub mod version { + include!("../prost/v0_37/tendermint.version.rs"); +} + +pub mod meta { + pub const REPOSITORY: &str = "https://github.com/tendermint/tendermint"; + pub const COMMITISH: &str = "v0.37.0-alpha.1"; +} diff --git a/tools/proto-compiler/Cargo.toml b/tools/proto-compiler/Cargo.toml index 82b6168b7..1e5806428 100644 --- a/tools/proto-compiler/Cargo.toml +++ b/tools/proto-compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tendermint-proto-compiler" -version = "0.1.0" +version = "0.2.0" authors = ["Informal Systems "] edition = "2021" publish = false diff --git a/tools/proto-compiler/src/constants.rs b/tools/proto-compiler/src/constants.rs index 70aa1d63c..a69ef0097 100644 --- a/tools/proto-compiler/src/constants.rs +++ b/tools/proto-compiler/src/constants.rs @@ -2,11 +2,30 @@ /// Tendermint repository URL. pub const TENDERMINT_REPO: &str = "https://github.com/tendermint/tendermint"; -// Commitish formats: -// Tag: v0.34.0-rc4 -// Branch: master -// Commit ID (full length): d7d0ffea13c60c98b812d243ba5a2c375f341c15 -pub const TENDERMINT_COMMITISH: &str = "v0.37.0-alpha.1"; + +/// Information on a Tendermint snapshot to generate prost structures from. +pub struct TendermintVersion { + /// Identifier to use in module names. + pub ident: &'static str, + /// A commitish reference in the tendermint git repository, for example: + /// + /// - Tag: `v0.34.0-rc4` + /// - Branch: `main` + /// - Commit ID (full length): `d7d0ffea13c60c98b812d243ba5a2c375f341c15` + pub commitish: &'static str, +} + +/// All Tendermint versions to generate code for +pub const TENDERMINT_VERSIONS: &[TendermintVersion] = &[ + TendermintVersion { + ident: "v0_34", + commitish: "v0.34.21", + }, + TendermintVersion { + ident: "v0_37", + commitish: "v0.37.0-alpha.1", + }, +]; /// Predefined custom attributes for message annotations const PRIMITIVE_ENUM: &str = r#"#[derive(::num_derive::FromPrimitive, ::num_derive::ToPrimitive)]"#; diff --git a/tools/proto-compiler/src/functions.rs b/tools/proto-compiler/src/functions.rs index 2e268394e..9e95846a4 100644 --- a/tools/proto-compiler/src/functions.rs +++ b/tools/proto-compiler/src/functions.rs @@ -12,9 +12,11 @@ use git2::{ use subtle_encoding::hex; use walkdir::WalkDir; +use crate::constants::TendermintVersion; + /// Clone or open+fetch a repository and check out a specific commitish /// In case of an existing repository, the origin remote will be set to `url`. -pub fn get_commitish(dir: &PathBuf, url: &str, commitish: &str) { +pub fn get_commitish(dir: &Path, url: &str, commitish: &str) { let repo = if dir.exists() { fetch_existing(dir, url) } else { @@ -40,7 +42,7 @@ fn clone_new(dir: &Path, url: &str) -> Repository { builder.clone(url, dir).unwrap() } -fn fetch_existing(dir: &PathBuf, url: &str) -> Repository { +fn fetch_existing(dir: &Path, url: &str) -> Repository { println!( " [info] => Fetching from {} into existing {} folder", url, @@ -208,8 +210,10 @@ pub fn find_proto_files(proto_paths: Vec) -> Vec { protos } -/// Create tendermint.rs with library information -pub fn generate_tendermint_lib(prost_dir: &PathBuf, tendermint_lib_target: &PathBuf) { +/// Create a module including generated content for the specified +/// Tendermint source version. +pub fn generate_tendermint_mod(prost_dir: &Path, version: &TendermintVersion, target_dir: &Path) { + create_dir_all(target_dir).unwrap(); let file_names = WalkDir::new(prost_dir) .into_iter() .filter_map(|e| e.ok()) @@ -239,8 +243,9 @@ pub fn generate_tendermint_lib(prost_dir: &PathBuf, tendermint_lib_target: &Path let mut tab_count = parts.len(); let mut inner_content = format!( - "{}include!(\"prost/{}\");", + "{}include!(\"../prost/{}/{}\");", tab.repeat(tab_count), + &version.ident, file_name ); @@ -263,11 +268,22 @@ pub fn generate_tendermint_lib(prost_dir: &PathBuf, tendermint_lib_target: &Path tab, crate::constants::TENDERMINT_REPO, tab, - crate::constants::TENDERMINT_COMMITISH, + &version.commitish, ); + let tendermint_mod_target = target_dir.join(format!("{}.rs", version.ident)); let mut file = - File::create(tendermint_lib_target).expect("tendermint library file create failed"); + File::create(tendermint_mod_target).expect("tendermint module file create failed"); file.write_all(content.as_bytes()) - .expect("tendermint library file write failed"); + .expect("tendermint module file write failed"); +} + +pub fn generate_tendermint_lib(versions: &[TendermintVersion], tendermint_lib_target: &Path) { + let mut file = + File::create(tendermint_lib_target).expect("tendermint library file create failed"); + for version in versions { + writeln!(&mut file, "pub mod {};", version.ident).unwrap(); + } + let last_version = versions.last().unwrap(); + writeln!(&mut file, "pub use {}::*;", last_version.ident).unwrap(); } diff --git a/tools/proto-compiler/src/main.rs b/tools/proto-compiler/src/main.rs index f2e6dc5ab..51ed03301 100644 --- a/tools/proto-compiler/src/main.rs +++ b/tools/proto-compiler/src/main.rs @@ -1,33 +1,24 @@ -use std::{env::var, path::PathBuf, process}; +use std::{ + env::var, + path::{Path, PathBuf}, + process, +}; use tempfile::tempdir; mod functions; -use functions::{copy_files, find_proto_files, generate_tendermint_lib, get_commitish}; +use functions::{ + copy_files, find_proto_files, generate_tendermint_lib, generate_tendermint_mod, get_commitish, +}; mod constants; use constants::{ - CUSTOM_FIELD_ATTRIBUTES, CUSTOM_TYPE_ATTRIBUTES, TENDERMINT_COMMITISH, TENDERMINT_REPO, + CUSTOM_FIELD_ATTRIBUTES, CUSTOM_TYPE_ATTRIBUTES, TENDERMINT_REPO, TENDERMINT_VERSIONS, }; fn main() { let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let tendermint_lib_target = root - .join("..") - .join("..") - .join("proto") - .join("src") - .join("tendermint.rs"); - let target_dir = root - .join("..") - .join("..") - .join("proto") - .join("src") - .join("prost"); - let out_dir = var("OUT_DIR") - .map(PathBuf::from) - .or_else(|_| tempdir().map(|d| d.into_path())) - .unwrap(); + let target_dir = ["..", "..", "proto", "src"].iter().collect::(); let tendermint_dir = PathBuf::from(var("TENDERMINT_DIR").unwrap_or_else(|_| { root.join("..") .join("target") @@ -37,56 +28,66 @@ fn main() { .to_string() })); - println!( - "[info] => Fetching {} at {} into {:?}", - TENDERMINT_REPO, TENDERMINT_COMMITISH, tendermint_dir - ); - get_commitish( - &PathBuf::from(&tendermint_dir), - TENDERMINT_REPO, - TENDERMINT_COMMITISH, - ); // This panics if it fails. + for version in TENDERMINT_VERSIONS { + println!( + "[info] => Fetching {} at {} into {:?}", + TENDERMINT_REPO, &version.commitish, tendermint_dir + ); + get_commitish(&tendermint_dir, TENDERMINT_REPO, &version.commitish); // This panics if it fails. - let proto_paths = vec![tendermint_dir.join("proto")]; - let proto_includes_paths = vec![ - tendermint_dir.join("proto"), - tendermint_dir.join("third_party").join("proto"), - ]; - // List available proto files - let protos = find_proto_files(proto_paths); + let proto_paths = vec![tendermint_dir.join("proto")]; + let proto_includes_paths = vec![ + tendermint_dir.join("proto"), + tendermint_dir.join("third_party").join("proto"), + ]; + // List available proto files + let protos = find_proto_files(proto_paths); - // Compile proto files with added annotations, exchange prost_types to our own - let mut pb = prost_build::Config::new(); - pb.out_dir(&out_dir); - for type_attribute in CUSTOM_TYPE_ATTRIBUTES { - pb.type_attribute(type_attribute.0, type_attribute.1); - } - for field_attribute in CUSTOM_FIELD_ATTRIBUTES { - pb.field_attribute(field_attribute.0, field_attribute.1); - } - // The below in-place path redirection replaces references to the Duration - // and Timestamp WKTs with our own versions that have valid doctest comments. - // See also https://github.com/danburkert/prost/issues/374 . - pb.extern_path( - ".google.protobuf.Duration", - "super::super::google::protobuf::Duration", - ); - pb.extern_path( - ".google.protobuf.Timestamp", - "super::super::google::protobuf::Timestamp", - ); - println!("[info] => Creating structs."); - match pb.compile_protos(&protos, &proto_includes_paths) { - Ok(()) => {}, - Err(e) => { - eprintln!("{}", e); - process::exit(1); - }, - } + let ver_target_dir = target_dir.join("prost").join(&version.ident); + let ver_module_dir = target_dir.join("tendermint"); + + let out_dir = var("OUT_DIR") + .map(|d| Path::new(&d).join(&version.ident)) + .or_else(|_| tempdir().map(|d| d.into_path())) + .unwrap(); - println!("[info] => Removing old structs and copying new structs."); - copy_files(&out_dir, &target_dir); // This panics if it fails. - generate_tendermint_lib(&out_dir, &tendermint_lib_target); + // Compile proto files with added annotations, exchange prost_types to our own + let mut pb = prost_build::Config::new(); + pb.out_dir(&out_dir); + for type_attribute in CUSTOM_TYPE_ATTRIBUTES { + pb.type_attribute(type_attribute.0, type_attribute.1); + } + for field_attribute in CUSTOM_FIELD_ATTRIBUTES { + pb.field_attribute(field_attribute.0, field_attribute.1); + } + // The below in-place path redirection replaces references to the Duration + // and Timestamp WKTs with our own versions that have valid doctest comments. + // See also https://github.com/danburkert/prost/issues/374 . + pb.extern_path( + ".google.protobuf.Duration", + "crate::google::protobuf::Duration", + ); + pb.extern_path( + ".google.protobuf.Timestamp", + "crate::google::protobuf::Timestamp", + ); + println!("[info] => Creating structs."); + match pb.compile_protos(&protos, &proto_includes_paths) { + Ok(()) => {}, + Err(e) => { + eprintln!("{}", e); + process::exit(1); + }, + } + + println!( + "[info] => Removing old structs and copying new structs to {}", + ver_target_dir.to_string_lossy(), + ); + copy_files(&out_dir, &ver_target_dir); // This panics if it fails. + generate_tendermint_mod(&out_dir, &version, &ver_module_dir); + } + generate_tendermint_lib(TENDERMINT_VERSIONS, &target_dir.join("tendermint.rs")); println!("[info] => Done!"); }