Skip to content

Commit

Permalink
ABCI++
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Manning committed May 24, 2021
1 parent 3f270a9 commit de6e4f3
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 157 deletions.
1 change: 1 addition & 0 deletions p2p/src/secret_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ impl Handshake<AwaitingAuthSig> {
ed25519::PublicKey::from_bytes(bytes).ok()
}
proto::crypto::public_key::Sum::Secp256k1(_) => None,
proto::crypto::public_key::Sum::Sr25519(_) => None,
})
.ok_or(Error::CryptoError)?;

Expand Down
58 changes: 20 additions & 38 deletions proto/src/prost/tendermint.abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,13 @@ pub struct RequestQuery {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestFinalizeBlock {
}

#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestCheckTx {
#[prost(bytes="bytes", tag="1")]
pub tx: ::prost::bytes::Bytes,
#[prost(enumeration="CheckTxType", tag="2")]
pub r#type: i32,
}

#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestCommit {
}
Expand Down Expand Up @@ -146,55 +144,41 @@ 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")]
pub height: u64,
#[prost(uint64, tag="2")]
pub round: u64,
}

/// Extend vote
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestExtendVote {
#[prost(uint64, tag="1")]
pub height: u64,
#[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<u8>,
#[prost(bytes, tag="2")]
pub self_authenticating_app_vote_data: Vec<u8>,
#[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

Expand Down Expand Up @@ -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<ConsensusUpdates>,
#[prost(message, repeated, tag="2")]
pub tx_results: ::prost::alloc::vec::Vec<ResponseTx>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseCheckTx {
#[prost(uint32, tag="1")]
pub code: u32,
Expand All @@ -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<ConsensusUpdates>,
#[prost(message, repeated, tag="2")]
pub tx_results: ::std::vec::Vec<ResponseTx>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseTx {
#[prost(uint32, tag="1")]
pub code: u32,
Expand Down Expand Up @@ -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<Evidence>,
pub evidence: ::prost::alloc::vec::Vec<Evidence>,
}
#[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<Evidence>,
pub evidence: ::prost::alloc::vec::Vec<Evidence>,
}
#[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)]
Expand All @@ -489,7 +471,7 @@ pub struct LastCommitInfo {
pub votes: ::prost::alloc::vec::Vec<VoteInfo>,
}
/// 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 {
Expand All @@ -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,
Expand Down
44 changes: 23 additions & 21 deletions proto/src/prost/tendermint.crypto.rs
Original file line number Diff line number Diff line change
@@ -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<public_key::Sum>,
}
/// 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<u8>),
#[prost(bytes, tag="2")]
#[serde(rename = "tendermint/PubKeySecp256k1", with = "crate::serializers::bytes::base64string")]
Secp256k1(::prost::alloc::vec::Vec<u8>),
#[prost(bytes, tag="3")]
Sr25519(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(::serde::Deserialize, ::serde::Serialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Proof {
Expand Down Expand Up @@ -50,24 +73,3 @@ pub struct ProofOps {
#[prost(message, repeated, tag="1")]
pub ops: ::prost::alloc::vec::Vec<ProofOp>,
}
/// PublicKey defines the keys available for use with Tendermint Validators
#[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<public_key::Sum>,
}
/// 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<u8>),
#[prost(bytes, tag="2")]
#[serde(rename = "tendermint/PubKeySecp256k1", with = "crate::serializers::bytes::base64string")]
Secp256k1(::prost::alloc::vec::Vec<u8>),
}
}
97 changes: 57 additions & 40 deletions proto/src/prost/tendermint.p2p.rs
Original file line number Diff line number Diff line change
@@ -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<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Packet {
#[prost(oneof="packet::Sum", tags="1, 2, 3")]
pub sum: ::core::option::Option<packet::Sum>,
}
/// Nested message and enum types in `Packet`.
pub mod packet {
#[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<super::crypto::PublicKey>,
#[prost(bytes="vec", tag="2")]
pub sig: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProtocolVersion {
#[prost(uint64, tag="1")]
pub p2p: u64,
Expand Down Expand Up @@ -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<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Packet {
#[prost(oneof="packet::Sum", tags="1, 2, 3")]
pub sum: ::core::option::Option<packet::Sum>,
}
/// Nested message and enum types in `Packet`.
pub mod packet {
#[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<super::crypto::PublicKey>,
#[prost(bytes="vec", tag="2")]
pub sig: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PexAddress {
#[prost(string, tag="1")]
pub id: ::prost::alloc::string::String,
Expand All @@ -110,8 +110,21 @@ pub struct PexResponse {
pub addresses: ::prost::alloc::vec::Vec<PexAddress>,
}
#[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<PexAddressV2>,
}
#[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<pex_message::Sum>,
}
/// Nested message and enum types in `PexMessage`.
Expand All @@ -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),
}
}
6 changes: 4 additions & 2 deletions proto/src/prost/tendermint.state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AbciResponses {
#[prost(message, repeated, tag="1")]
pub finalize_block: ::std::vec::Vec<super::abci::ResponseFinalizeBlock>,
pub deliver_txs: ::prost::alloc::vec::Vec<super::abci::ResponseTx>,
#[prost(message, optional, tag="2")]
pub finalize_block: ::core::option::Option<super::abci::ResponseFinalizeBlock>,
}
/// ValidatorsInfo represents the latest validator set, or the last height it changed
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -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<super::types::ConsensusParams>,
#[prost(int64, tag="11")]
Expand Down
Loading

0 comments on commit de6e4f3

Please sign in to comment.