Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions light-client/src/light_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ impl LightClient {
/// should be trusted based on a previously verified light block.
/// - When doing _forward_ verification, the Scheduler component decides which height to try to
/// verify next, in case the current block pass verification but cannot be trusted yet.
/// - When doing _backward_ verification, the Hasher component is used to determine
/// whether the `last_block_id` hash of a block matches the hash of the block right below it.
/// - When doing _backward_ verification, the Hasher component is used to determine whether the
/// `last_block_id` hash of a block matches the hash of the block right below it.
///
/// ## Implements
/// - [LCV-DIST-SAFE.1]
Expand Down
172 changes: 126 additions & 46 deletions proto/src/prost/tendermint.abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#[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")]
#[prost(oneof="request::Value", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19")]
pub value: ::std::option::Option<request::Value>,
}
pub mod request {
Expand All @@ -26,23 +26,31 @@ pub mod request {
#[prost(message, tag="6")]
Query(super::RequestQuery),
#[prost(message, tag="7")]
BeginBlock(super::RequestBeginBlock),
FinalizeBlock(super::RequestFinalizeBlock),
#[prost(message, tag="8")]
CheckTx(super::RequestCheckTx),
#[prost(message, tag="9")]
DeliverTx(super::RequestDeliverTx),
Commit(super::RequestCommit),
#[prost(message, tag="10")]
EndBlock(super::RequestEndBlock),
ListSnapshots(super::RequestListSnapshots),
#[prost(message, tag="11")]
Commit(super::RequestCommit),
OfferSnapshot(super::RequestOfferSnapshot),
#[prost(message, tag="12")]
ListSnapshots(super::RequestListSnapshots),
LoadSnapshotChunk(super::RequestLoadSnapshotChunk),
#[prost(message, tag="13")]
OfferSnapshot(super::RequestOfferSnapshot),
ApplySnapshotChunk(super::RequestApplySnapshotChunk),
#[prost(message, tag="14")]
LoadSnapshotChunk(super::RequestLoadSnapshotChunk),
PrepareProposal(super::RequestPrepareProposal),
#[prost(message, tag="15")]
ApplySnapshotChunk(super::RequestApplySnapshotChunk),
VerifyHeader(super::RequestVerifyHeader),
#[prost(message, tag="16")]
ProcessProposal(super::RequestProcessProposal),
#[prost(message, tag="17")]
RevertProposal(super::RequestRevertProposal),
#[prost(message, tag="18")]
ExtendVote(super::RequestExtendVote),
#[prost(message, tag="19")]
VerifyVoteExtension(super::RequestVerifyVoteExtension),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -97,33 +105,17 @@ pub struct RequestQuery {
pub prove: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestBeginBlock {
#[prost(bytes, tag="1")]
pub hash: std::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub header: ::std::option::Option<super::types::Header>,
#[prost(message, optional, tag="3")]
pub last_commit_info: ::std::option::Option<LastCommitInfo>,
#[prost(message, repeated, tag="4")]
pub byzantine_validators: ::std::vec::Vec<Evidence>,
pub struct RequestFinalizeBlock {
}

#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestCheckTx {
#[prost(bytes, tag="1")]
pub tx: std::vec::Vec<u8>,
#[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<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestEndBlock {
#[prost(int64, tag="1")]
pub height: i64,
}

#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestCommit {
}
Expand Down Expand Up @@ -161,12 +153,61 @@ pub struct RequestApplySnapshotChunk {
#[prost(string, tag="3")]
pub sender: std::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,
}

/// Verify header
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestProcessProposal {
//FIXME(Ash): add block field
}

/// Verify header
#[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>,
}

//----------------------------------------
// 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")]
#[prost(oneof="response::Value", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19")]
pub value: ::std::option::Option<response::Value>,
}
pub mod response {
Expand All @@ -187,23 +228,29 @@ pub mod response {
#[prost(message, tag="7")]
Query(super::ResponseQuery),
#[prost(message, tag="8")]
BeginBlock(super::ResponseBeginBlock),
FinalizeBlock(super::ResponseFinalizeBlock),
#[prost(message, tag="9")]
CheckTx(super::ResponseCheckTx),
#[prost(message, tag="10")]
DeliverTx(super::ResponseDeliverTx),
Commit(super::ResponseCommit),
#[prost(message, tag="11")]
EndBlock(super::ResponseEndBlock),
ListSnapshots(super::ResponseListSnapshots),
#[prost(message, tag="12")]
Commit(super::ResponseCommit),
OfferSnapshot(super::ResponseOfferSnapshot),
#[prost(message, tag="13")]
ListSnapshots(super::ResponseListSnapshots),
LoadSnapshotChunk(super::ResponseLoadSnapshotChunk),
#[prost(message, tag="14")]
OfferSnapshot(super::ResponseOfferSnapshot),
ApplySnapshotChunk(super::ResponseApplySnapshotChunk),
#[prost(message, tag="15")]
LoadSnapshotChunk(super::ResponseLoadSnapshotChunk),
PrepareProposal(super::ResponsePrepareProposal),
#[prost(message, tag="16")]
ApplySnapshotChunk(super::ResponseApplySnapshotChunk),
VerifyHeader(super::ResponseVerifyHeader),
#[prost(message, tag="17")]
ProcessProposal(super::ResponseProcessProposal),
#[prost(message, tag="18")]
ExtendVote(super::ResponseExtendVote),
#[prost(message, tag="19")]
VerifyVoteExtension(super::ResponseVerifyVoteExtension),
}
}
/// nondeterministic
Expand Down Expand Up @@ -283,11 +330,6 @@ pub struct ResponseQuery {
pub codespace: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseBeginBlock {
#[prost(message, repeated, tag="1")]
pub events: ::std::vec::Vec<Event>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseCheckTx {
#[prost(uint32, tag="1")]
pub code: u32,
Expand All @@ -309,7 +351,15 @@ pub struct ResponseCheckTx {
pub codespace: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseDeliverTx {
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,
#[prost(bytes, tag="2")]
Expand All @@ -330,7 +380,7 @@ pub struct ResponseDeliverTx {
pub codespace: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseEndBlock {
pub struct ConsensusUpdates {
#[prost(message, repeated, tag="1")]
pub validator_updates: ::std::vec::Vec<ValidatorUpdate>,
#[prost(message, optional, tag="2")]
Expand Down Expand Up @@ -408,6 +458,36 @@ pub mod response_apply_snapshot_chunk {
RejectSnapshot = 5,
}
}
#[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>,
}
#[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>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseExtendVote {
#[prost(bytes, tag="1")]
pub unsigned_app_vote_data: Vec<u8>,
#[prost(bytes, tag="2")]
pub self_authenticating_app_data: Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseVerifyVoteExtension {
#[prost(bool, tag="1")]
pub result: bool,
}
//----------------------------------------
// Misc.

Expand Down Expand Up @@ -442,7 +522,7 @@ pub struct LastCommitInfo {
pub votes: ::std::vec::Vec<VoteInfo>,
}
/// Event allows application developers to attach additional information to
/// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx.
/// ResponseFinalizeBlock and ResponseCheckTx.
/// Later, transactions may be queried using these events.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Event {
Expand Down Expand Up @@ -474,7 +554,7 @@ pub struct TxResult {
#[prost(bytes, tag="3")]
pub tx: std::vec::Vec<u8>,
#[prost(message, optional, tag="4")]
pub result: ::std::option::Option<ResponseDeliverTx>,
pub result: ::std::option::Option<ResponseTx>,
}
//----------------------------------------
// Blockchain Types
Expand Down
2 changes: 1 addition & 1 deletion proto/src/prost/tendermint.rpc.grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ pub struct ResponseBroadcastTx {
#[prost(message, optional, tag="1")]
pub check_tx: ::std::option::Option<super::super::abci::ResponseCheckTx>,
#[prost(message, optional, tag="2")]
pub deliver_tx: ::std::option::Option<super::super::abci::ResponseDeliverTx>,
pub deliver_tx: ::std::option::Option<super::super::abci::ResponseTx>,
}
8 changes: 2 additions & 6 deletions proto/src/prost/tendermint.state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AbciResponses {
#[prost(message, repeated, tag="1")]
pub deliver_txs: ::std::vec::Vec<super::abci::ResponseDeliverTx>,
#[prost(message, optional, tag="2")]
pub end_block: ::std::option::Option<super::abci::ResponseEndBlock>,
#[prost(message, optional, tag="3")]
pub begin_block: ::std::option::Option<super::abci::ResponseBeginBlock>,
pub finalize_block: ::std::vec::Vec<super::abci::ResponseFinalizeBlock>,
}
/// ValidatorsInfo represents the latest validator set, or the last height it changed
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -64,7 +60,7 @@ pub struct State {
#[prost(int64, tag="9")]
pub last_height_validators_changed: i64,
/// Consensus parameters used for validating blocks.
/// Changes returned by EndBlock and updated after Commit.
/// Changes returned by FinalizeBlock and updated after Commit.
#[prost(message, optional, tag="10")]
pub consensus_params: ::std::option::Option<super::types::ConsensusParams>,
#[prost(int64, tag="11")]
Expand Down
3 changes: 3 additions & 0 deletions proto/src/prost/tendermint.types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,10 @@ pub struct CanonicalVote {
pub timestamp: ::std::option::Option<super::super::google::protobuf::Timestamp>,
#[prost(string, tag="6")]
pub chain_id: std::string::String,
#[prost(string, tag="7")]
pub unsigned_app_vote_data: std::string::String,
}

#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(::serde::Deserialize, ::serde::Serialize)]
pub struct Block {
Expand Down
2 changes: 1 addition & 1 deletion proto/src/prost/tendermint.version.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// App includes the protocol and software version for the application.
/// This information is included in ResponseInfo. The App.Protocol can be
/// updated in ResponseEndBlock.
/// updated in ResponseFinalizeBlock.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct App {
#[prost(uint64, tag="1")]
Expand Down
7 changes: 2 additions & 5 deletions rpc/src/endpoint/block_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ pub struct Response {
/// Txs results (might be explicit null)
pub txs_results: Option<Vec<abci::DeliverTx>>,

/// Begin block events (might be explicit null)
pub begin_block_events: Option<Vec<abci::Event>>,

/// End block events (might be explicit null)
pub end_block_events: Option<Vec<abci::Event>>,
/// Finalize block events (might be explicit null)
pub finalize_block_events: Option<Vec<abci::Event>>,

/// Validator updates (might be explicit null)
#[serde(deserialize_with = "abci::responses::deserialize_validator_updates")]
Expand Down
8 changes: 2 additions & 6 deletions rpc/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use tendermint::{
abci::responses::{BeginBlock, EndBlock},
Block,
};
use tendermint::{abci::responses::FinalizeBlock, Block};

use crate::query::EventType;
use crate::{response::Wrapper, Response};
Expand Down Expand Up @@ -46,8 +43,7 @@ pub enum EventData {
#[serde(alias = "tendermint/event/NewBlock")]
NewBlock {
block: Option<Block>,
result_begin_block: Option<BeginBlock>,
result_end_block: Option<EndBlock>,
result_finalize_block: Option<FinalizeBlock>,
},
#[serde(alias = "tendermint/event/Tx")]
Tx {
Expand Down
14 changes: 6 additions & 8 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
//!
//! Two features are provided at present:
//!
//! * `http-client` - Provides [`HttpClient`], which is a basic RPC client that
//! interacts with remote Tendermint nodes via **JSON-RPC over HTTP**. This
//! client does not provide [`Event`] subscription functionality. See the
//! [Tendermint RPC] for more details.
//! * `websocket-client` - Provides [`WebSocketClient`], which provides full
//! client functionality, including general RPC functionality (such as that
//! provided by `HttpClient`) as well as [`Event`] subscription
//! functionality.
//! * `http-client` - Provides [`HttpClient`], which is a basic RPC client that interacts with
//! remote Tendermint nodes via **JSON-RPC over HTTP**. This client does not provide [`Event`]
//! subscription functionality. See the [Tendermint RPC] for more details.
//! * `websocket-client` - Provides [`WebSocketClient`], which provides full client functionality,
//! including general RPC functionality (such as that provided by `HttpClient`) as well as
//! [`Event`] subscription functionality.
//!
//! ### Mock Clients
//!
Expand Down
Loading