diff --git a/.codecov.yml b/.codecov.yml index 5d8c25482..628bd1ba5 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -20,4 +20,7 @@ parsers: conditional: yes loop: yes method: yes - macro: no \ No newline at end of file + macro: no + +ignore: + - "proto/src/prost" # Rust structs automatically generated from Protobuf definitions diff --git a/CHANGELOG.md b/CHANGELOG.md index a03a3d12a..967b3bcc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ [#472]: https://github.com/informalsystems/tendermint-rs/pull/472 +### Proto crate + +- Created Rust structs from Tendermint Proto files ([#504]) + ## [0.15.0] (2020-07-17) This release is mostly about the revamped [light-client] library and the [light-node] command-line interface. diff --git a/Cargo.toml b/Cargo.toml index 98fa0c129..e3cb00264 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,12 @@ members = [ "light-client", "light-node", + "proto", "rpc", "tendermint", "testgen" ] + +exclude = [ + "proto-compiler" +] diff --git a/light-client/src/predicates.rs b/light-client/src/predicates.rs index efb2f460d..b05e5efb3 100644 --- a/light-client/src/predicates.rs +++ b/light-client/src/predicates.rs @@ -25,7 +25,8 @@ impl VerificationPredicates for ProdPredicates {} /// This enables test implementations to only override a single method rather than /// have to re-define every predicate. pub trait VerificationPredicates: Send { - /// Compare the provided validator_set_hash against the hash produced from hashing the validator set. + /// Compare the provided validator_set_hash against the hash produced from hashing the validator + /// set. fn validator_sets_match( &self, light_block: &LightBlock, diff --git a/light-node/light_node.toml.example b/light-node/light_node.toml similarity index 100% rename from light-node/light_node.toml.example rename to light-node/light_node.toml diff --git a/proto-compiler/.gitignore b/proto-compiler/.gitignore new file mode 100644 index 000000000..2f7896d1d --- /dev/null +++ b/proto-compiler/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/proto-compiler/Cargo.toml b/proto-compiler/Cargo.toml new file mode 100644 index 000000000..64cda1a25 --- /dev/null +++ b/proto-compiler/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "tendermint-proto-compiler" +version = "0.1.0" +authors = ["Greg Szabo "] +edition = "2018" + + +[dependencies] +walkdir = { version = "2.3" } + +[build-dependencies] +prost-build = { version = "0.6" } +walkdir = { version = "2.3" } +git2 = { version = "0.13" } + +[workspace] diff --git a/proto-compiler/README.md b/proto-compiler/README.md new file mode 100644 index 000000000..2f1f1527e --- /dev/null +++ b/proto-compiler/README.md @@ -0,0 +1,7 @@ +## How to compile fresh proto structs + +* `git clone https://github.com/tendermint/tendermint` into the repository `target/` folder. +* `cargo run` in the compiler folder. + +The resultant structs will be created in the `tendermint-proto/src/prost` folder. +Build the `tendermint-proto` library. diff --git a/proto-compiler/build.rs b/proto-compiler/build.rs new file mode 100644 index 000000000..3dc1653ef --- /dev/null +++ b/proto-compiler/build.rs @@ -0,0 +1,41 @@ +use git2::Repository; +use prost_build::compile_protos; +use std::env::var; +use std::path::{Path, PathBuf}; +use walkdir::WalkDir; + +fn main() { + let tendermint_dir = var("TENDERMINT_DIR").unwrap_or_else(|_| "target/tendermint".to_string()); + if !Path::new(&tendermint_dir).exists() { + let url = "https://github.com/tendermint/tendermint"; + Repository::clone(url, &tendermint_dir).unwrap(); + } + let proto_paths = [format!("{}/proto", tendermint_dir)]; + let proto_includes_paths = [ + format!("{}/proto", tendermint_dir), + format!("{}/third_party/proto", tendermint_dir), + ]; + + // List available proto files + let mut protos: Vec = vec![]; + for proto_path in &proto_paths { + protos.append( + &mut WalkDir::new(proto_path) + .into_iter() + .filter_map(|e| e.ok()) + .filter(|e| { + e.file_type().is_file() + && e.path().extension().is_some() + && e.path().extension().unwrap() == "proto" + }) + .map(|e| e.into_path()) + .collect(), + ); + } + + // List available paths for dependencies + let includes: Vec = proto_includes_paths.iter().map(PathBuf::from).collect(); + + // Compile all proto files + compile_protos(&protos, &includes).unwrap(); +} diff --git a/proto-compiler/src/main.rs b/proto-compiler/src/main.rs new file mode 100644 index 000000000..cb4813186 --- /dev/null +++ b/proto-compiler/src/main.rs @@ -0,0 +1,36 @@ +use std::fs::remove_dir_all; +use std::fs::{copy, create_dir_all}; +use walkdir::WalkDir; + +fn main() { + let tendermint_proto_path = "../proto/src/prost"; + + // Remove old compiled files + remove_dir_all(tendermint_proto_path).unwrap_or_default(); + create_dir_all(tendermint_proto_path).unwrap(); + + // Copy new compiled files (prost does not use folder structures) + let err: Vec = WalkDir::new(env!("OUT_DIR")) + .into_iter() + .filter_map(|e| e.ok()) + .filter(|e| e.file_type().is_file()) + .map(|e| { + copy( + e.path(), + std::path::Path::new(&format!( + "{}/{}", + tendermint_proto_path, + &e.file_name().to_os_string().to_str().unwrap() + )), + ) + }) + .filter_map(|e| e.err()) + .collect(); + + if !err.is_empty() { + for e in err { + dbg!(e); + } + panic!("error while copying compiled files") + } +} diff --git a/proto/Cargo.toml b/proto/Cargo.toml new file mode 100644 index 000000000..449a6bc51 --- /dev/null +++ b/proto/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "tendermint-proto" +version = "0.1.0" +authors = ["Greg Szabo "] +edition = "2018" +license = "Apache-2.0" +repository = "https://github.com/informalsystems/tendermint-rs/tree/master/tendermint-proto" +readme = "README.md" +categories = ["cryptography", "cryptography::cryptocurrencies", "database"] +keywords = ["blockchain", "tendermint", "proto"] + +description = """ + tendermint-proto is a the Rust implementation of the Tendermint proto structs. + """ + +[package.metadata.docs.rs] +all-features = true + +[dependencies] +prost = { version = "0.6" } +prost-types = { version = "0.6" } diff --git a/proto/README.md b/proto/README.md new file mode 100644 index 000000000..591513190 --- /dev/null +++ b/proto/README.md @@ -0,0 +1,50 @@ +## tendermint-proto + +[![Crate][crate-image]][crate-link] +[![Docs][docs-image]][docs-link] +[![Build Status][build-image]][build-link] +[![Audit Status][audit-image]][audit-link] +[![Apache 2.0 Licensed][license-image]][license-link] +![Rust 1.39+][rustc-image] + +Crate for interacting with Tendermint [proto structs][tendermint-go-proto-link]. + +[Documentation][docs-link] + +## Requirements + +- Rust 1.39+ + +## License + +Copyright © 2020 Informal Systems + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use the files in this repository except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +[//]: # (badges) + +[crate-image]: https://img.shields.io/crates/v/tendermint-proto.svg +[crate-link]: https://crates.io/crates/tendermint-proto +[docs-image]: https://docs.rs/tendermint-proto/badge.svg +[docs-link]: https://docs.rs/tendermint-proto/ +[build-image]: https://github.com/informalsystems/tendermint-rs/workflows/Rust/badge.svg +[build-link]: https://github.com/informalsystems/tendermint-rs/actions?query=workflow%3ARust +[audit-image]: https://github.com/informalsystems/tendermint-rs/workflows/Audit-Check/badge.svg +[audit-link]: https://github.com/informalsystems/tendermint-rs/actions?query=workflow%3AAudit-Check +[license-image]: https://img.shields.io/badge/license-Apache2.0-blue.svg +[license-link]: https://github.com/informalsystems/tendermint-rs/blob/master/LICENSE +[rustc-image]: https://img.shields.io/badge/rustc-1.39+-blue.svg + +[//]: # (general links) + +[tendermint-go-proto-link]: https://github.com/tendermint/tendermint/tree/master/proto/tendermint diff --git a/proto/src/lib.rs b/proto/src/lib.rs new file mode 100644 index 000000000..d90e81deb --- /dev/null +++ b/proto/src/lib.rs @@ -0,0 +1,88 @@ +//! tendermint-proto library gives the developer access to the Tendermint proto-defined structs. + +// This module setup is necessary because the generated code contains "super::" calls for +// dependencies. Unfortunately, prost doesn't create this for us automatically. + +#![deny( + warnings, + missing_docs, + trivial_casts, + trivial_numeric_casts, + unused_import_braces +)] +#![forbid(unsafe_code)] +#![doc(html_root_url = "https://docs.rs/tendermint-proto/0.1.0")] + +mod tendermint { + pub mod abci { + #![allow(missing_docs)] + #![allow(clippy::large_enum_variant)] + include!("prost/tendermint.abci.rs"); + } + pub mod blockchain { + #![allow(missing_docs)] + #![allow(clippy::large_enum_variant)] + include!("prost/tendermint.blockchain.rs"); + } + pub mod consensus { + #![allow(missing_docs)] + include!("prost/tendermint.consensus.rs"); + } + pub mod crypto { + #![allow(missing_docs)] + include!("prost/tendermint.crypto.rs"); + } + pub mod evidence { + #![allow(missing_docs)] + include!("prost/tendermint.evidence.rs"); + } + pub mod libs { + #![allow(missing_docs)] + pub mod bits { + #![allow(missing_docs)] + include!("prost/tendermint.libs.bits.rs"); + } + } + pub mod mempool { + #![allow(missing_docs)] + include!("prost/tendermint.mempool.rs"); + } + pub mod p2p { + #![allow(missing_docs)] + include!("prost/tendermint.p2p.rs"); + } + pub mod privval { + #![allow(missing_docs)] + include!("prost/tendermint.privval.rs"); + } + pub mod rpc { + #![allow(missing_docs)] + pub mod grpc { + #![allow(missing_docs)] + include!("prost/tendermint.rpc.grpc.rs"); + } + } + pub mod state { + #![allow(missing_docs)] + include!("prost/tendermint.state.rs"); + } + pub mod statesync { + #![allow(missing_docs)] + include!("prost/tendermint.statesync.rs"); + } + pub mod store { + #![allow(missing_docs)] + include!("prost/tendermint.store.rs"); + } + pub mod types { + #![allow(missing_docs)] + #![allow(clippy::large_enum_variant)] + include!("prost/tendermint.types.rs"); + } + pub mod version { + #![allow(missing_docs)] + include!("prost/tendermint.version.rs"); + } +} + +pub use tendermint::*; diff --git a/proto/src/prost/gogoproto.rs b/proto/src/prost/gogoproto.rs new file mode 100644 index 000000000..e69de29bb diff --git a/proto/src/prost/google.protobuf.rs b/proto/src/prost/google.protobuf.rs new file mode 100644 index 000000000..e69de29bb diff --git a/proto/src/prost/tendermint.abci.rs b/proto/src/prost/tendermint.abci.rs new file mode 100644 index 000000000..bb6b25f43 --- /dev/null +++ b/proto/src/prost/tendermint.abci.rs @@ -0,0 +1,547 @@ +// This file is copied from http://github.com/tendermint/abci +// NOTE: When using custom types, mind the warnings. +// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues + +//---------------------------------------- +// Request types + +#[derive(Clone, PartialEq, ::prost::Message)] +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: ::std::option::Option, +} +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: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestFlush { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestInfo { + #[prost(string, tag="1")] + pub version: std::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: std::string::String, + #[prost(string, tag="2")] + pub value: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestInitChain { + #[prost(message, optional, tag="1")] + pub time: ::std::option::Option<::prost_types::Timestamp>, + #[prost(string, tag="2")] + pub chain_id: std::string::String, + #[prost(message, optional, tag="3")] + pub consensus_params: ::std::option::Option, + #[prost(message, repeated, tag="4")] + pub validators: ::std::vec::Vec, + #[prost(bytes, tag="5")] + pub app_state_bytes: std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestQuery { + #[prost(bytes, tag="1")] + pub data: std::vec::Vec, + #[prost(string, tag="2")] + pub path: std::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, tag="1")] + pub hash: std::vec::Vec, + #[prost(message, optional, tag="2")] + pub header: ::std::option::Option, + #[prost(message, optional, tag="3")] + pub last_commit_info: ::std::option::Option, + #[prost(message, repeated, tag="4")] + pub byzantine_validators: ::std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestCheckTx { + #[prost(bytes, tag="1")] + pub tx: std::vec::Vec, + #[prost(enumeration="CheckTxType", tag="2")] + pub r#type: i32, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestDeliverTx { + #[prost(bytes, tag="1")] + pub tx: std::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: ::std::option::Option, + /// light client-verified app hash for snapshot height + #[prost(bytes, tag="2")] + pub app_hash: std::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, tag="2")] + pub chunk: std::vec::Vec, + #[prost(string, tag="3")] + pub sender: std::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: ::std::option::Option, +} +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: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseEcho { + #[prost(string, tag="1")] + pub message: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseFlush { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseInfo { + #[prost(string, tag="1")] + pub data: std::string::String, + #[prost(string, tag="2")] + pub version: std::string::String, + #[prost(uint64, tag="3")] + pub app_version: u64, + #[prost(int64, tag="4")] + pub last_block_height: i64, + #[prost(bytes, tag="5")] + pub last_block_app_hash: std::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: std::string::String, + #[prost(string, tag="4")] + pub info: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseInitChain { + #[prost(message, optional, tag="1")] + pub consensus_params: ::std::option::Option, + #[prost(message, repeated, tag="2")] + pub validators: ::std::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: std::string::String, + /// nondeterministic + #[prost(string, tag="4")] + pub info: std::string::String, + #[prost(int64, tag="5")] + pub index: i64, + #[prost(bytes, tag="6")] + pub key: std::vec::Vec, + #[prost(bytes, tag="7")] + pub value: std::vec::Vec, + #[prost(message, optional, tag="8")] + pub proof_ops: ::std::option::Option, + #[prost(int64, tag="9")] + pub height: i64, + #[prost(string, tag="10")] + pub codespace: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseBeginBlock { + #[prost(message, repeated, tag="1")] + pub events: ::std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseCheckTx { + #[prost(uint32, tag="1")] + pub code: u32, + #[prost(bytes, tag="2")] + pub data: std::vec::Vec, + /// nondeterministic + #[prost(string, tag="3")] + pub log: std::string::String, + /// nondeterministic + #[prost(string, tag="4")] + pub info: std::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: ::std::vec::Vec, + #[prost(string, tag="8")] + pub codespace: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseDeliverTx { + #[prost(uint32, tag="1")] + pub code: u32, + #[prost(bytes, tag="2")] + pub data: std::vec::Vec, + /// nondeterministic + #[prost(string, tag="3")] + pub log: std::string::String, + /// nondeterministic + #[prost(string, tag="4")] + pub info: std::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: ::std::vec::Vec, + #[prost(string, tag="8")] + pub codespace: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseEndBlock { + #[prost(message, repeated, tag="1")] + pub validator_updates: ::std::vec::Vec, + #[prost(message, optional, tag="2")] + pub consensus_param_updates: ::std::option::Option, + #[prost(message, repeated, tag="3")] + pub events: ::std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseCommit { + /// reserve 1 + #[prost(bytes, tag="2")] + pub data: std::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: ::std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseOfferSnapshot { + #[prost(enumeration="response_offer_snapshot::Result", tag="1")] + pub result: i32, +} +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, + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseLoadSnapshotChunk { + #[prost(bytes, tag="1")] + pub chunk: std::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: ::std::vec::Vec, + /// Chunk senders to reject and ban + #[prost(string, repeated, tag="3")] + pub reject_senders: ::std::vec::Vec, +} +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, + } +} +//---------------------------------------- +// 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: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub evidence: ::std::option::Option, + #[prost(message, optional, tag="3")] + pub validator: ::std::option::Option, + #[prost(message, optional, tag="4")] + pub version: ::std::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: ::std::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: std::string::String, + #[prost(message, repeated, tag="2")] + pub attributes: ::std::vec::Vec, +} +/// EventAttribute is a single key-value pair, associated with an event. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventAttribute { + #[prost(bytes, tag="1")] + pub key: std::vec::Vec, + #[prost(bytes, tag="2")] + pub value: std::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, tag="3")] + pub tx: std::vec::Vec, + #[prost(message, optional, tag="4")] + pub result: ::std::option::Option, +} +//---------------------------------------- +// Blockchain Types + +/// Validator +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Validator { + /// The first 20 bytes of SHA256(public key) + #[prost(bytes, tag="1")] + pub address: std::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: ::std::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: ::std::option::Option, + #[prost(bool, tag="2")] + pub signed_last_block: bool, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Evidence { + #[prost(string, tag="1")] + pub r#type: std::string::String, + /// The offending validator + #[prost(message, optional, tag="2")] + pub validator: ::std::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: ::std::option::Option<::prost_types::Timestamp>, + /// Total voting power of the validator set in case the ABCI application does + /// not store historical validators. + /// https://github.com/tendermint/tendermint/issues/4581 + #[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, tag="4")] + pub hash: std::vec::Vec, + /// Arbitrary application metadata + #[prost(bytes, tag="5")] + pub metadata: std::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum CheckTxType { + New = 0, + Recheck = 1, +} diff --git a/proto/src/prost/tendermint.blockchain.rs b/proto/src/prost/tendermint.blockchain.rs new file mode 100644 index 000000000..f1de08363 --- /dev/null +++ b/proto/src/prost/tendermint.blockchain.rs @@ -0,0 +1,50 @@ +/// 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: ::std::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: ::std::option::Option, +} +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/tendermint.consensus.rs b/proto/src/prost/tendermint.consensus.rs new file mode 100644 index 000000000..32e17efb6 --- /dev/null +++ b/proto/src/prost/tendermint.consensus.rs @@ -0,0 +1,182 @@ +/// 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: ::std::option::Option, + #[prost(message, optional, tag="4")] + pub block_parts: ::std::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: ::std::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: ::std::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: ::std::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: ::std::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: ::std::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: ::std::option::Option, + #[prost(message, optional, tag="5")] + pub votes: ::std::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: ::std::option::Option, +} +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: ::std::option::Option, + #[prost(string, tag="2")] + pub peer_id: std::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: ::std::option::Option<::prost_types::Duration>, + #[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: ::std::option::Option, +} +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: ::std::option::Option<::prost_types::Timestamp>, + #[prost(message, optional, tag="2")] + pub msg: ::std::option::Option, +} diff --git a/proto/src/prost/tendermint.crypto.rs b/proto/src/prost/tendermint.crypto.rs new file mode 100644 index 000000000..e459e853c --- /dev/null +++ b/proto/src/prost/tendermint.crypto.rs @@ -0,0 +1,74 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Proof { + #[prost(int64, tag="1")] + pub total: i64, + #[prost(int64, tag="2")] + pub index: i64, + #[prost(bytes, tag="3")] + pub leaf_hash: std::vec::Vec, + #[prost(bytes, repeated, tag="4")] + pub aunts: ::std::vec::Vec>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValueOp { + /// Encoded in ProofOp.Key. + #[prost(bytes, tag="1")] + pub key: std::vec::Vec, + /// To encode in ProofOp.Data + #[prost(message, optional, tag="2")] + pub proof: ::std::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DominoOp { + #[prost(string, tag="1")] + pub key: std::string::String, + #[prost(string, tag="2")] + pub input: std::string::String, + #[prost(string, tag="3")] + pub output: std::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: std::string::String, + #[prost(bytes, tag="2")] + pub key: std::vec::Vec, + #[prost(bytes, tag="3")] + pub data: std::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: ::std::vec::Vec, +} +/// PublicKey defines the keys available for use with Tendermint Validators +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PublicKey { + #[prost(oneof="public_key::Sum", tags="1")] + pub sum: ::std::option::Option, +} +pub mod public_key { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(bytes, tag="1")] + Ed25519(std::vec::Vec), + } +} +/// PrivateKey defines the keys available for use with Tendermint Validators +/// WARNING PrivateKey is used for internal purposes only +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrivateKey { + #[prost(oneof="private_key::Sum", tags="1")] + pub sum: ::std::option::Option, +} +pub mod private_key { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(bytes, tag="1")] + Ed25519(std::vec::Vec), + } +} diff --git a/proto/src/prost/tendermint.evidence.rs b/proto/src/prost/tendermint.evidence.rs new file mode 100644 index 000000000..0e31bf7c1 --- /dev/null +++ b/proto/src/prost/tendermint.evidence.rs @@ -0,0 +1,14 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct List { + #[prost(message, repeated, tag="1")] + pub evidence: ::std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Info { + #[prost(bool, tag="1")] + pub committed: bool, + #[prost(int64, tag="2")] + pub priority: i64, + #[prost(message, optional, tag="3")] + pub evidence: ::std::option::Option, +} diff --git a/proto/src/prost/tendermint.libs.bits.rs b/proto/src/prost/tendermint.libs.bits.rs new file mode 100644 index 000000000..4e078a0aa --- /dev/null +++ b/proto/src/prost/tendermint.libs.bits.rs @@ -0,0 +1,7 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BitArray { + #[prost(int64, tag="1")] + pub bits: i64, + #[prost(uint64, repeated, tag="2")] + pub elems: ::std::vec::Vec, +} diff --git a/proto/src/prost/tendermint.mempool.rs b/proto/src/prost/tendermint.mempool.rs new file mode 100644 index 000000000..1f44c353f --- /dev/null +++ b/proto/src/prost/tendermint.mempool.rs @@ -0,0 +1,17 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Tx { + #[prost(bytes, tag="1")] + pub tx: std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1")] + pub sum: ::std::option::Option, +} +pub mod message { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + Tx(super::Tx), + } +} diff --git a/proto/src/prost/tendermint.p2p.rs b/proto/src/prost/tendermint.p2p.rs new file mode 100644 index 000000000..43f7ca7a1 --- /dev/null +++ b/proto/src/prost/tendermint.p2p.rs @@ -0,0 +1,104 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NetAddress { + #[prost(string, tag="1")] + pub id: std::string::String, + #[prost(string, tag="2")] + pub ip: std::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: ::std::option::Option, + #[prost(string, tag="2")] + pub default_node_id: std::string::String, + #[prost(string, tag="3")] + pub listen_addr: std::string::String, + #[prost(string, tag="4")] + pub network: std::string::String, + #[prost(string, tag="5")] + pub version: std::string::String, + #[prost(bytes, tag="6")] + pub channels: std::vec::Vec, + #[prost(string, tag="7")] + pub moniker: std::string::String, + #[prost(message, optional, tag="8")] + pub other: ::std::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DefaultNodeInfoOther { + #[prost(string, tag="1")] + pub tx_index: std::string::String, + #[prost(string, tag="2")] + pub rpc_address: std::string::String, +} +#[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, tag="3")] + pub data: std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Packet { + #[prost(oneof="packet::Sum", tags="1, 2, 3")] + pub sum: ::std::option::Option, +} +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: ::std::option::Option, + #[prost(bytes, tag="2")] + pub sig: std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PexRequest { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PexAddrs { + #[prost(message, repeated, tag="1")] + pub addrs: ::std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1, 2")] + pub sum: ::std::option::Option, +} +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/tendermint.privval.rs b/proto/src/prost/tendermint.privval.rs new file mode 100644 index 000000000..c36bf41d6 --- /dev/null +++ b/proto/src/prost/tendermint.privval.rs @@ -0,0 +1,91 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RemoteSignerError { + #[prost(int32, tag="1")] + pub code: i32, + #[prost(string, tag="2")] + pub description: std::string::String, +} +/// PubKeyRequest requests the consensus public key from the remote signer. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PubKeyRequest { +} +/// 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: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub error: ::std::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: ::std::option::Option, +} +/// 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: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub error: ::std::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: ::std::option::Option, +} +/// 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: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub error: ::std::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: ::std::option::Option, +} +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, +} diff --git a/proto/src/prost/tendermint.rpc.grpc.rs b/proto/src/prost/tendermint.rpc.grpc.rs new file mode 100644 index 000000000..42247b09a --- /dev/null +++ b/proto/src/prost/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, tag="1")] + pub tx: std::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: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub deliver_tx: ::std::option::Option, +} diff --git a/proto/src/prost/tendermint.state.rs b/proto/src/prost/tendermint.state.rs new file mode 100644 index 000000000..31f3f2539 --- /dev/null +++ b/proto/src/prost/tendermint.state.rs @@ -0,0 +1,76 @@ +/// 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: ::std::vec::Vec, + #[prost(message, optional, tag="2")] + pub end_block: ::std::option::Option, + #[prost(message, optional, tag="3")] + pub begin_block: ::std::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: ::std::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: ::std::option::Option, + #[prost(int64, tag="2")] + pub last_height_changed: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Version { + #[prost(message, optional, tag="1")] + pub consensus: ::std::option::Option, + #[prost(string, tag="2")] + pub software: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct State { + #[prost(message, optional, tag="1")] + pub version: ::std::option::Option, + /// immutable + #[prost(string, tag="2")] + pub chain_id: std::string::String, + /// 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: ::std::option::Option, + #[prost(message, optional, tag="5")] + pub last_block_time: ::std::option::Option<::prost_types::Timestamp>, + /// 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: ::std::option::Option, + #[prost(message, optional, tag="7")] + pub validators: ::std::option::Option, + #[prost(message, optional, tag="8")] + pub last_validators: ::std::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: ::std::option::Option, + #[prost(int64, tag="11")] + pub last_height_consensus_params_changed: i64, + /// Merkle root of the results from executing prev block + #[prost(bytes, tag="12")] + pub last_results_hash: std::vec::Vec, + /// the latest AppHash we've received from calling abci.Commit() + #[prost(bytes, tag="13")] + pub app_hash: std::vec::Vec, +} diff --git a/proto/src/prost/tendermint.statesync.rs b/proto/src/prost/tendermint.statesync.rs new file mode 100644 index 000000000..51e896b60 --- /dev/null +++ b/proto/src/prost/tendermint.statesync.rs @@ -0,0 +1,56 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(oneof="message::Sum", tags="1, 2, 3, 4")] + pub sum: ::std::option::Option, +} +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, tag="4")] + pub hash: std::vec::Vec, + #[prost(bytes, tag="5")] + pub metadata: std::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, tag="4")] + pub chunk: std::vec::Vec, + #[prost(bool, tag="5")] + pub missing: bool, +} diff --git a/proto/src/prost/tendermint.store.rs b/proto/src/prost/tendermint.store.rs new file mode 100644 index 000000000..a4c2799d9 --- /dev/null +++ b/proto/src/prost/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/tendermint.types.rs new file mode 100644 index 000000000..bd919b619 --- /dev/null +++ b/proto/src/prost/tendermint.types.rs @@ -0,0 +1,460 @@ +/// PartsetHeader +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PartSetHeader { + #[prost(uint32, tag="1")] + pub total: u32, + #[prost(bytes, tag="2")] + pub hash: std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Part { + #[prost(uint32, tag="1")] + pub index: u32, + #[prost(bytes, tag="2")] + pub bytes: std::vec::Vec, + #[prost(message, optional, tag="3")] + pub proof: ::std::option::Option, +} +/// BlockID +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockId { + #[prost(bytes, tag="1")] + pub hash: std::vec::Vec, + #[prost(message, optional, tag="2")] + pub part_set_header: ::std::option::Option, +} +// -------------------------------- + +/// Header defines the structure of a Tendermint block header. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Header { + /// basic block info + #[prost(message, optional, tag="1")] + pub version: ::std::option::Option, + #[prost(string, tag="2")] + pub chain_id: std::string::String, + #[prost(int64, tag="3")] + pub height: i64, + #[prost(message, optional, tag="4")] + pub time: ::std::option::Option<::prost_types::Timestamp>, + /// prev block info + #[prost(message, optional, tag="5")] + pub last_block_id: ::std::option::Option, + /// hashes of block data + /// + /// commit from validators from the last block + #[prost(bytes, tag="6")] + pub last_commit_hash: std::vec::Vec, + /// transactions + #[prost(bytes, tag="7")] + pub data_hash: std::vec::Vec, + /// hashes from the app output from the prev block + /// + /// validators for the current block + #[prost(bytes, tag="8")] + pub validators_hash: std::vec::Vec, + /// validators for the next block + #[prost(bytes, tag="9")] + pub next_validators_hash: std::vec::Vec, + /// consensus params for current block + #[prost(bytes, tag="10")] + pub consensus_hash: std::vec::Vec, + /// state after txs from the previous block + #[prost(bytes, tag="11")] + pub app_hash: std::vec::Vec, + /// root hash of all results from the txs from the previous block + #[prost(bytes, tag="12")] + pub last_results_hash: std::vec::Vec, + /// consensus info + /// + /// evidence included in the block + #[prost(bytes, tag="13")] + pub evidence_hash: std::vec::Vec, + /// original proposer of the block + #[prost(bytes, tag="14")] + pub proposer_address: std::vec::Vec, +} +/// Data contains the set of transactions included in the block +#[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, repeated, tag="1")] + pub txs: ::std::vec::Vec>, + /// Volatile + #[prost(bytes, tag="2")] + pub hash: std::vec::Vec, +} +/// Vote represents a prevote, precommit, or commit vote from validators for +/// consensus. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Vote { + #[prost(enumeration="SignedMsgType", tag="1")] + pub r#type: i32, + #[prost(int64, tag="2")] + pub height: i64, + #[prost(int32, tag="3")] + pub round: i32, + /// zero if vote is nil. + #[prost(message, optional, tag="4")] + pub block_id: ::std::option::Option, + #[prost(message, optional, tag="5")] + pub timestamp: ::std::option::Option<::prost_types::Timestamp>, + #[prost(bytes, tag="6")] + pub validator_address: std::vec::Vec, + #[prost(int32, tag="7")] + pub validator_index: i32, + #[prost(bytes, tag="8")] + pub signature: std::vec::Vec, +} +/// Commit contains the evidence that a block was committed by a set of validators. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Commit { + #[prost(int64, tag="1")] + pub height: i64, + #[prost(int32, tag="2")] + pub round: i32, + #[prost(message, optional, tag="3")] + pub block_id: ::std::option::Option, + #[prost(message, repeated, tag="4")] + pub signatures: ::std::vec::Vec, + #[prost(bytes, tag="5")] + pub hash: std::vec::Vec, + #[prost(message, optional, tag="6")] + pub bit_array: ::std::option::Option, +} +/// CommitSig is a part of the Vote included in a Commit. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommitSig { + #[prost(enumeration="BlockIdFlag", tag="1")] + pub block_id_flag: i32, + #[prost(bytes, tag="2")] + pub validator_address: std::vec::Vec, + #[prost(message, optional, tag="3")] + pub timestamp: ::std::option::Option<::prost_types::Timestamp>, + #[prost(bytes, tag="4")] + pub signature: std::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: ::std::option::Option, + #[prost(message, optional, tag="6")] + pub timestamp: ::std::option::Option<::prost_types::Timestamp>, + #[prost(bytes, tag="7")] + pub signature: std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SignedHeader { + #[prost(message, optional, tag="1")] + pub header: ::std::option::Option
, + #[prost(message, optional, tag="2")] + pub commit: ::std::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockMeta { + #[prost(message, optional, tag="1")] + pub block_id: ::std::option::Option, + #[prost(int64, tag="2")] + pub block_size: i64, + #[prost(message, optional, tag="3")] + pub header: ::std::option::Option
, + #[prost(int64, tag="4")] + pub num_txs: i64, +} +/// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxProof { + #[prost(bytes, tag="1")] + pub root_hash: std::vec::Vec, + #[prost(bytes, tag="2")] + pub data: std::vec::Vec, + #[prost(message, optional, tag="3")] + pub proof: ::std::option::Option, +} +/// BlockIdFlag indicates which BlcokID the signature is for +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum BlockIdFlag { + Unknown = 0, + Absent = 1, + Commit = 2, + Nil = 3, +} +/// 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, +} +#[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: std::string::String, +} +/// 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: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub evidence: ::std::option::Option, + #[prost(message, optional, tag="3")] + pub validator: ::std::option::Option, + #[prost(message, optional, tag="4")] + pub version: ::std::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(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](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + #[prost(message, optional, tag="2")] + pub max_age_duration: ::std::option::Option<::prost_types::Duration>, + /// This sets the maximum number of evidence that can be committed in a single block. + /// and should fall comfortably under the max block bytes when we consider the size of + /// each evidence (See MaxEvidenceBytes). The maximum number is MaxEvidencePerBlock. + /// Default is 50 + #[prost(uint32, tag="3")] + pub max_num: u32, + /// Proof trial period dictates the time given for nodes accused of amnesia evidence, incorrectly + /// voting twice in two different rounds to respond with their respective proofs. + /// Default is half the max age in blocks: 50,000 + #[prost(int64, tag="4")] + pub proof_trial_period: 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: ::std::vec::Vec, +} +/// 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, +} +/// DuplicateVoteEvidence contains evidence a validator signed two conflicting +/// votes. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DuplicateVoteEvidence { + #[prost(message, optional, tag="1")] + pub vote_a: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub vote_b: ::std::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PotentialAmnesiaEvidence { + #[prost(message, optional, tag="1")] + pub vote_a: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub vote_b: ::std::option::Option, + #[prost(int64, tag="3")] + pub height_stamp: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AmnesiaEvidence { + #[prost(message, optional, tag="1")] + pub potential_amnesia_evidence: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub polc: ::std::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConflictingHeadersEvidence { + #[prost(message, optional, tag="1")] + pub h1: ::std::option::Option, + #[prost(message, optional, tag="2")] + pub h2: ::std::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LunaticValidatorEvidence { + #[prost(message, optional, tag="1")] + pub header: ::std::option::Option
, + #[prost(message, optional, tag="2")] + pub vote: ::std::option::Option, + #[prost(string, tag="3")] + pub invalid_header_field: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Evidence { + #[prost(oneof="evidence::Sum", tags="1, 2, 3, 4, 5")] + pub sum: ::std::option::Option, +} +pub mod evidence { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag="1")] + DuplicateVoteEvidence(super::DuplicateVoteEvidence), + #[prost(message, tag="2")] + ConflictingHeadersEvidence(super::ConflictingHeadersEvidence), + #[prost(message, tag="3")] + LunaticValidatorEvidence(super::LunaticValidatorEvidence), + #[prost(message, tag="4")] + PotentialAmnesiaEvidence(super::PotentialAmnesiaEvidence), + #[prost(message, tag="5")] + AmnesiaEvidence(super::AmnesiaEvidence), + } +} +/// EvidenceData contains any evidence of malicious wrong-doing by validators +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EvidenceData { + #[prost(message, repeated, tag="1")] + pub evidence: ::std::vec::Vec, + #[prost(bytes, tag="2")] + pub hash: std::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProofOfLockChange { + #[prost(message, repeated, tag="1")] + pub votes: ::std::vec::Vec, + #[prost(message, optional, tag="2")] + pub pub_key: ::std::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CanonicalBlockId { + #[prost(bytes, tag="1")] + pub hash: std::vec::Vec, + #[prost(message, optional, tag="2")] + pub part_set_header: ::std::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CanonicalPartSetHeader { + #[prost(uint32, tag="1")] + pub total: u32, + #[prost(bytes, tag="2")] + pub hash: std::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: ::std::option::Option, + #[prost(message, optional, tag="6")] + pub timestamp: ::std::option::Option<::prost_types::Timestamp>, + #[prost(string, tag="7")] + pub chain_id: std::string::String, +} +#[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: ::std::option::Option, + #[prost(message, optional, tag="5")] + pub timestamp: ::std::option::Option<::prost_types::Timestamp>, + #[prost(string, tag="6")] + pub chain_id: std::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorSet { + #[prost(message, repeated, tag="1")] + pub validators: ::std::vec::Vec, + #[prost(message, optional, tag="2")] + pub proposer: ::std::option::Option, + #[prost(int64, tag="3")] + pub total_voting_power: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Validator { + #[prost(bytes, tag="1")] + pub address: std::vec::Vec, + #[prost(message, optional, tag="2")] + pub pub_key: ::std::option::Option, + #[prost(int64, tag="3")] + pub voting_power: i64, + #[prost(int64, tag="4")] + pub proposer_priority: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SimpleValidator { + #[prost(message, optional, tag="1")] + pub pub_key: ::std::option::Option, + #[prost(int64, tag="2")] + pub voting_power: i64, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Block { + #[prost(message, optional, tag="1")] + pub header: ::std::option::Option
, + #[prost(message, optional, tag="2")] + pub data: ::std::option::Option, + #[prost(message, optional, tag="3")] + pub evidence: ::std::option::Option, + #[prost(message, optional, tag="4")] + pub last_commit: ::std::option::Option, +} diff --git a/proto/src/prost/tendermint.version.rs b/proto/src/prost/tendermint.version.rs new file mode 100644 index 000000000..b1a4113cb --- /dev/null +++ b/proto/src/prost/tendermint.version.rs @@ -0,0 +1,20 @@ +/// 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: std::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(Clone, PartialEq, ::prost::Message)] +pub struct Consensus { + #[prost(uint64, tag="1")] + pub block: u64, + #[prost(uint64, tag="2")] + pub app: u64, +} diff --git a/proto/tests/unit.rs b/proto/tests/unit.rs new file mode 100644 index 000000000..9293e45dd --- /dev/null +++ b/proto/tests/unit.rs @@ -0,0 +1,10 @@ +#[test] +pub fn import_evidence_info() { + use tendermint_proto::evidence::Info; + let x = Info { + committed: true, + priority: 0, + evidence: None, + }; + assert_eq!(x.committed, true); +} diff --git a/testgen/src/commit.rs b/testgen/src/commit.rs index 162aa0d6a..7f05c78f0 100644 --- a/testgen/src/commit.rs +++ b/testgen/src/commit.rs @@ -126,7 +126,8 @@ impl Generator for Commit { let commit = block::Commit { height: block_header.height, round: self.round.unwrap_or(1), - block_id, // TODO do we need at least one part? //block::Id::new(hasher.hash_header(&block_header), None), // + block_id, /* TODO do we need at least one part? + * //block::Id::new(hasher.hash_header(&block_header), None), // */ signatures: block::CommitSigs::new(sigs), }; Ok(commit) diff --git a/testgen/src/consensus.rs b/testgen/src/consensus.rs index ad63104bc..e40551e1c 100644 --- a/testgen/src/consensus.rs +++ b/testgen/src/consensus.rs @@ -1,6 +1,7 @@ use tendermint::{block, consensus, evidence, public_key::Algorithm}; -/// Default consensus params modeled after Go code; but it's not clear how to go to a valid hash from here +/// Default consensus params modeled after Go code; but it's not clear how to go to a valid hash +/// from here pub fn default_consensus_params() -> consensus::Params { consensus::Params { block: block::Size {