Skip to content

Commit

Permalink
update block result response
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivani912 committed Mar 24, 2020
1 parent a3367f3 commit d0b9039
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tendermint/src/abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ pub mod transaction;

pub use self::{
code::Code, data::Data, gas::Gas, info::Info, log::Log, path::Path, proof::Proof,
responses::Responses, transaction::Transaction,
responses::{Responses, DeliverTx, Event}, transaction::Transaction,
};
14 changes: 10 additions & 4 deletions tendermint/src/abci/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ where
///
/// This type corresponds to the `ResponseDeliverTx` proto from:
///
/// <https://github.com/tendermint/tendermint/blob/develop/abci/types/types.proto>
/// <https://github.com/tendermint/tendermint/blob/master/abci/types/types.proto>
// TODO(tarcieri): generate this automatically from the proto
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct DeliverTx {
Expand All @@ -59,21 +59,27 @@ pub struct DeliverTx {
pub info: Option<Info>,

/// Amount of gas wanted
#[serde(default, rename = "gasWanted")]
// #[serde(default, rename = "gasWanted")]
pub gas_wanted: Gas,

/// Amount of gas used
#[serde(default, rename = "gasUsed")]
// #[serde(default, rename = "gasUsed")]
pub gas_used: Gas,

/// Tags
#[serde(default)]
pub tags: Vec<Tag>,
pub events: Vec<Event>,

/// Codespace
pub codespace: Option<Codespace>,
}

pub struct Event {
#[serde(rename = "type")]
pub type_str: String,
pub attributes: Vec<Tag>,
}

/// Begin block response.
///
/// This type corresponds to the `ResponseBeginBlock` proto from:
Expand Down
6 changes: 0 additions & 6 deletions tendermint/src/block/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,4 @@ pub struct Size {
)]
pub max_gas: i64,

/// Time iota in ms
#[serde(
serialize_with = "serializers::serialize_u64",
deserialize_with = "serializers::parse_u64"
)]
pub time_iota_ms: u64,
}
7 changes: 6 additions & 1 deletion tendermint/src/evidence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,10 @@ pub struct Params {
serialize_with = "serializers::serialize_u64",
deserialize_with = "serializers::parse_u64"
)]
pub max_age: u64,
pub max_age_num_blocks: u64,

pub max_age_duration: Duration,
}

#[derive(Clone, Debug)]
struct Duration(u64);
19 changes: 16 additions & 3 deletions tendermint/src/rpc/endpoint/block_results.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `/block_results` endpoint JSONRPC wrapper

use crate::{abci, block, rpc};
use crate::{abci, block, rpc, validator, consensus};
use serde::{Deserialize, Serialize};

/// Get ABCI results at a given height.
Expand Down Expand Up @@ -35,8 +35,21 @@ pub struct Response {
/// Block height
pub height: block::Height,

/// Block results
pub results: abci::Responses,
/// Txs results
pub txs_results: abci::DeliverTx,

/// Begin block events
pub begin_block_events: abci::Event,

/// End block events
pub end_block_events: abci::Event,

/// Validator updates
#[serde(deserialize_with = "deserialize_validator_updates")]
pub validator_updates: Vec<validator::Update>,

/// New consensus params
pub consensus_param_updates: Option<consensus::Params>,
}

impl rpc::Response for Response {}

0 comments on commit d0b9039

Please sign in to comment.