diff --git a/p2p/src/secret_connection.rs b/p2p/src/secret_connection.rs index 4cdfbee67..75600f4a3 100644 --- a/p2p/src/secret_connection.rs +++ b/p2p/src/secret_connection.rs @@ -165,6 +165,7 @@ impl Handshake { ed25519::PublicKey::from_bytes(bytes).ok() } proto::crypto::public_key::Sum::Secp256k1(_) => None, + proto::crypto::public_key::Sum::Sr25519(_) => None, }) .ok_or(Error::CryptoError)?; diff --git a/proto/src/prost/tendermint.abci.rs b/proto/src/prost/tendermint.abci.rs index 3931c942f..0e26710d3 100644 --- a/proto/src/prost/tendermint.abci.rs +++ b/proto/src/prost/tendermint.abci.rs @@ -100,7 +100,6 @@ pub struct RequestQuery { #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestFinalizeBlock { } - #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestCheckTx { #[prost(bytes="bytes", tag="1")] @@ -108,7 +107,6 @@ pub struct RequestCheckTx { #[prost(enumeration="CheckTxType", tag="2")] pub r#type: i32, } - #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestCommit { } @@ -146,29 +144,20 @@ pub struct RequestApplySnapshotChunk { #[prost(string, tag="3")] pub sender: ::prost::alloc::string::String, } - /// Prepare proposal #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestPrepareProposal { - //FIXME(Ash): add block field, unbatched header field } - /// Verify header #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestVerifyHeader { - //FIXME(Ash): add header field - #[prost(bool, tag="1")] pub is_validator: bool, } - /// Process proposal #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestProcessProposal { - //FIXME(Ash): add block field } - -/// Revert proposal #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestRevertProposal { #[prost(uint64, tag="1")] @@ -176,8 +165,6 @@ pub struct RequestRevertProposal { #[prost(uint64, tag="2")] pub round: u64, } - -/// Extend vote #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestExtendVote { #[prost(uint64, tag="1")] @@ -185,16 +172,13 @@ pub struct RequestExtendVote { #[prost(uint64, tag="2")] pub round: u64, } - -/// Verify vote extension #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestVerifyVoteExtension { - #[prost(bytes, tag="1")] - pub signed_app_vote_data: Vec, - #[prost(bytes, tag="2")] - pub self_authenticating_app_vote_data: Vec, + #[prost(bytes="bytes", tag="1")] + pub signed_app_vote_data: ::prost::bytes::Bytes, + #[prost(bytes="bytes", tag="2")] + pub self_authenticating_app_vote_data: ::prost::bytes::Bytes, } - //---------------------------------------- // Response types @@ -314,6 +298,13 @@ pub struct ResponseQuery { pub codespace: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseFinalizeBlock { + #[prost(message, optional, tag="1")] + pub updates: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub tx_results: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseCheckTx { #[prost(uint32, tag="1")] pub code: u32, @@ -335,14 +326,6 @@ pub struct ResponseCheckTx { pub codespace: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] -pub struct ResponseFinalizeBlock { - //FIXME(ash): this should not be optional - #[prost(message, optional, tag="1")] - pub updates: ::std::option::Option, - #[prost(message, repeated, tag="2")] - pub tx_results: ::std::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseTx { #[prost(uint32, tag="1")] pub code: u32, @@ -447,30 +430,29 @@ pub mod response_apply_snapshot_chunk { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponsePrepareProposal { - //FIXME(Ash): add BlockData field, header field } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseVerifyHeader { #[prost(bool, tag="1")] pub accept_header: bool, #[prost(message, repeated, tag="2")] - pub evidence: ::std::vec::Vec, + pub evidence: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseProcessProposal { #[prost(bool, tag="1")] pub accept_block: bool, #[prost(message, repeated, tag="2")] - pub evidence: ::std::vec::Vec, + pub evidence: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseRevertProposal { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseExtendVote { - #[prost(bytes, tag="1")] + #[prost(bytes="bytes", tag="1")] pub unsigned_app_vote_data: ::prost::bytes::Bytes, - #[prost(bytes, tag="2")] + #[prost(bytes="bytes", tag="2")] pub self_authenticating_app_data: ::prost::bytes::Bytes, } #[derive(Clone, PartialEq, ::prost::Message)] @@ -489,7 +471,7 @@ pub struct LastCommitInfo { pub votes: ::prost::alloc::vec::Vec, } /// Event allows application developers to attach additional information to -/// ResponseFinalizeBlock and ResponseCheckTx. +/// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. /// Later, transactions may be queried using these events. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Event { @@ -501,10 +483,10 @@ pub struct Event { /// EventAttribute is a single key-value pair, associated with an event. #[derive(Clone, PartialEq, ::prost::Message)] pub struct EventAttribute { - #[prost(bytes="bytes", tag="1")] - pub key: ::prost::bytes::Bytes, - #[prost(bytes="bytes", tag="2")] - pub value: ::prost::bytes::Bytes, + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub value: ::prost::alloc::string::String, /// nondeterministic #[prost(bool, tag="3")] pub index: bool, diff --git a/proto/src/prost/tendermint.crypto.rs b/proto/src/prost/tendermint.crypto.rs index 0fac07973..b1950ccde 100644 --- a/proto/src/prost/tendermint.crypto.rs +++ b/proto/src/prost/tendermint.crypto.rs @@ -1,3 +1,26 @@ +/// 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, 3")] + 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), + #[prost(bytes, tag="3")] + Sr25519(::prost::alloc::vec::Vec), + } +} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Proof { @@ -50,24 +73,3 @@ 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/tendermint.p2p.rs b/proto/src/prost/tendermint.p2p.rs index 6e84903e1..bd3d4c4aa 100644 --- a/proto/src/prost/tendermint.p2p.rs +++ b/proto/src/prost/tendermint.p2p.rs @@ -1,4 +1,43 @@ #[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 ProtocolVersion { #[prost(uint64, tag="1")] pub p2p: u64, @@ -54,45 +93,6 @@ pub struct PeerAddressInfo { pub dial_failures: u32, } #[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 PexAddress { #[prost(string, tag="1")] pub id: ::prost::alloc::string::String, @@ -110,8 +110,21 @@ pub struct PexResponse { pub addresses: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] +pub struct PexAddressV2 { + #[prost(string, tag="1")] + pub url: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PexRequestV2 { +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PexResponseV2 { + #[prost(message, repeated, tag="1")] + pub addresses: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] pub struct PexMessage { - #[prost(oneof="pex_message::Sum", tags="1, 2")] + #[prost(oneof="pex_message::Sum", tags="1, 2, 3, 4")] pub sum: ::core::option::Option, } /// Nested message and enum types in `PexMessage`. @@ -122,5 +135,9 @@ pub mod pex_message { PexRequest(super::PexRequest), #[prost(message, tag="2")] PexResponse(super::PexResponse), + #[prost(message, tag="3")] + PexRequestV2(super::PexRequestV2), + #[prost(message, tag="4")] + PexResponseV2(super::PexResponseV2), } } diff --git a/proto/src/prost/tendermint.state.rs b/proto/src/prost/tendermint.state.rs index 7b361a5be..35e7a5360 100644 --- a/proto/src/prost/tendermint.state.rs +++ b/proto/src/prost/tendermint.state.rs @@ -4,7 +4,9 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct AbciResponses { #[prost(message, repeated, tag="1")] - pub finalize_block: ::std::vec::Vec, + pub deliver_txs: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub finalize_block: ::core::option::Option, } /// ValidatorsInfo represents the latest validator set, or the last height it changed #[derive(Clone, PartialEq, ::prost::Message)] @@ -60,7 +62,7 @@ pub struct State { #[prost(int64, tag="9")] pub last_height_validators_changed: i64, /// Consensus parameters used for validating blocks. - /// Changes returned by FinalizeBlock and updated after Commit. + /// Changes returned by EndBlock and updated after Commit. #[prost(message, optional, tag="10")] pub consensus_params: ::core::option::Option, #[prost(int64, tag="11")] diff --git a/proto/src/prost/tendermint.types.rs b/proto/src/prost/tendermint.types.rs index 1a3ccc396..c1084d048 100644 --- a/proto/src/prost/tendermint.types.rs +++ b/proto/src/prost/tendermint.types.rs @@ -276,15 +276,6 @@ pub enum SignedMsgType { /// 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: ::prost::alloc::string::String, -} /// ConsensusParams contains consensus critical parameters that determine the /// validity of blocks. #[derive(Clone, PartialEq, ::prost::Message)] @@ -418,6 +409,27 @@ pub struct EvidenceList { } #[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(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 { #[prost(bytes="vec", tag="1")] pub hash: ::prost::alloc::vec::Vec, @@ -474,16 +486,3 @@ pub struct CanonicalVote { #[prost(string, tag="7")] pub unsigned_app_vote_data: ::prost::alloc::string::String, } - -#[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, -} diff --git a/proto/src/tendermint.rs b/proto/src/tendermint.rs index a09480b33..ec5807200 100644 --- a/proto/src/tendermint.rs +++ b/proto/src/tendermint.rs @@ -1,23 +1,31 @@ //! Tendermint-proto auto-generated sub-modules for Tendermint -pub mod statesync { - include!("prost/tendermint.statesync.rs"); +pub mod rpc { + pub mod grpc { + include!("prost/tendermint.rpc.grpc.rs"); + } } -pub mod abci { - include!("prost/tendermint.abci.rs"); +pub mod state { + include!("prost/tendermint.state.rs"); +} + +pub mod libs { + pub mod bits { + include!("prost/tendermint.libs.bits.rs"); + } } pub mod version { include!("prost/tendermint.version.rs"); } -pub mod types { - include!("prost/tendermint.types.rs"); +pub mod abci { + include!("prost/tendermint.abci.rs"); } -pub mod consensus { - include!("prost/tendermint.consensus.rs"); +pub mod types { + include!("prost/tendermint.types.rs"); } pub mod p2p { @@ -28,35 +36,27 @@ pub mod privval { include!("prost/tendermint.privval.rs"); } -pub mod blockchain { - include!("prost/tendermint.blockchain.rs"); +pub mod consensus { + include!("prost/tendermint.consensus.rs"); } -pub mod crypto { - include!("prost/tendermint.crypto.rs"); +pub mod blockchain { + include!("prost/tendermint.blockchain.rs"); } pub mod mempool { include!("prost/tendermint.mempool.rs"); } -pub mod state { - include!("prost/tendermint.state.rs"); -} - -pub mod libs { - pub mod bits { - include!("prost/tendermint.libs.bits.rs"); - } +pub mod crypto { + include!("prost/tendermint.crypto.rs"); } -pub mod rpc { - pub mod grpc { - include!("prost/tendermint.rpc.grpc.rs"); - } +pub mod statesync { + include!("prost/tendermint.statesync.rs"); } pub mod meta { - pub const REPOSITORY: &str = "https://github.com/tendermint/tendermint"; - pub const COMMITISH: &str = "570e24f9025fe5a2b946c330721458c4ad5c9e0a"; + pub const REPOSITORY: &str = "https://github.com/heliaxdev/tendermint"; + pub const COMMITISH: &str = "ash/abci++"; } diff --git a/tendermint/src/abci/event.rs b/tendermint/src/abci/event.rs index f25e0244f..f343fd3c1 100644 --- a/tendermint/src/abci/event.rs +++ b/tendermint/src/abci/event.rs @@ -134,8 +134,8 @@ use tendermint_proto::Protobuf; impl From for pb::EventAttribute { fn from(event: EventAttribute) -> Self { Self { - key: event.key.into_bytes().into(), - value: event.value.into_bytes().into(), + key: event.key, + value: event.value, index: event.index, } } @@ -146,8 +146,8 @@ impl TryFrom for EventAttribute { fn try_from(event: pb::EventAttribute) -> Result { Ok(Self { - key: String::from_utf8(event.key.to_vec())?, - value: String::from_utf8(event.value.to_vec())?, + key: event.key, + value: event.value, index: event.index, }) } diff --git a/tendermint/src/abci/request.rs b/tendermint/src/abci/request.rs index 65171b00d..3272e3f44 100644 --- a/tendermint/src/abci/request.rs +++ b/tendermint/src/abci/request.rs @@ -279,9 +279,9 @@ pub struct ExtendVote { #[derive(Clone, PartialEq, Eq, Debug)] pub struct VerifyVoteExtension { /// signed app vote data - pub signed_app_vote_data: Vec, + pub signed_app_vote_data: Bytes, /// self-authenticating vote data - pub self_authenticating_app_vote_data: Vec, + pub self_authenticating_app_vote_data: Bytes, } /// All possible ABCI requests. diff --git a/tools/proto-compiler/src/constants.rs b/tools/proto-compiler/src/constants.rs index a8266a9ad..a574c1adb 100644 --- a/tools/proto-compiler/src/constants.rs +++ b/tools/proto-compiler/src/constants.rs @@ -1,12 +1,12 @@ /// Tendermint protobuf version /// Tendermint repository URL. -pub const TENDERMINT_REPO: &str = "https://github.com/tendermint/tendermint"; +pub const TENDERMINT_REPO: &str = "https://github.com/heliaxdev/tendermint"; // Commitish formats: // Tag: v0.34.0-rc4 // Branch: master // Commit ID (full length): d7d0ffea13c60c98b812d243ba5a2c375f341c15 -pub const TENDERMINT_COMMITISH: &str = "570e24f9025fe5a2b946c330721458c4ad5c9e0a"; +pub const TENDERMINT_COMMITISH: &str = "ash/abci++"; /// Predefined custom attributes for message annotations const PRIMITIVE_ENUM: &str = r#"#[derive(::num_derive::FromPrimitive, ::num_derive::ToPrimitive)]"#;