* Squashed commit of the following: commit 1f85076fd584365f1acbbafef5c8bdee722b479b Author: shamardy <shamardy@yahoo.com> Date: Sat Jun 30 03:40:12 2018 +0200 update commit 63363cca7354873a8abe3b631b8b7dbd9da6ce1e Author: shamardy <shamardy@yahoo.com> Date: Sat Jun 30 03:36:25 2018 +0200 Update commit e05caddc170a4cf0e476c23d443f07184dcb4fb1 Author: shamardy <shamardy@yahoo.com> Date: Fri Jun 29 10:04:34 2018 +0200 Test commit b0be065eadd0f2dd70f6613c50cbf3eb16d693ec Author: shamardy <shamardy@yahoo.com> Date: Fri Jun 29 09:19:57 2018 +0200 test_client edit commit 949205ccdbac75f730639e5f0d8e1bdd9436de1d Author: shamardy <shamardy@yahoo.com> Date: Fri Jun 29 05:14:53 2018 +0200 Edit Test commit 7cd44ee379a1e847f3e7d225444e72775bdbd4b5 Author: shamardy <shamardy@yahoo.com> Date: Fri Jun 29 04:25:22 2018 +0200 Updates commit e90de71e698d29475e8ba5696664b7d7bb335f9c Author: shamardy <shamardy@yahoo.com> Date: Wed Jun 27 13:53:15 2018 +0200 Test commit 12a76381561b66ecf6ea636d7eebe43d2dcb7731 Author: shamardy <shamardy@yahoo.com> Date: Wed Jun 27 11:43:39 2018 +0200 Edited Tests commit 6c21e6de2da24e7b9f33ac8b82abb0b39488bd60 Merge: 87c4c74b8 9550cf766 Author: shamardy <shamardy@yahoo.com> Date: Wed Jun 27 10:31:21 2018 +0200 Merge branch 'Issue#8725' of https://github.com/shamardy/parity into Issue#8725 commit 87c4c74b8f769c8e4b55ba78b5aa1d6716413f6d Author: shamardy <shamardy@yahoo.com> Date: Wed Jun 27 10:31:13 2018 +0200 Avoided Changing non-RPC Types commit 9550cf76610953c8492cc9473e4b9f876e770b70 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:29:03 2018 +0200 Update traces.rs commit 3e0b0ef29685b62f0917b80a48054b3379d59a50 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:27:44 2018 +0200 Update trace.rs commit 5078d67a2da7268db2a1064540a3c887e1f1a3cd Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:26:08 2018 +0200 Update traces.rs commit 28f5ba1b035c6919ac11089cf1bdd703c75f0dbd Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:24:04 2018 +0200 Update parity.rs commit 3b86b98ab5860efa61a7cc6a2b20e6c5c0f859cb Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:23:33 2018 +0200 Update eth.rs commit bcad5a40f14a3c5d2d901ae1a9bed87949ab9c66 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:21:43 2018 +0200 Update call_analytics.rs commit e9029e0b8158387b606132b264652d285483870f Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:20:56 2018 +0200 Update transaction.rs commit 0dacc81779bc62713e3f8e405229dfd7f89f33e8 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:20:01 2018 +0200 Update executive.rs commit 3921d4ec77f49460d45603111b98cc07d3c235a0 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:18:39 2018 +0200 Update executed.rs commit 8416df654ebf6f68ad04c8a4a89a29ce704f9ca1 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Wed Jun 27 10:17:34 2018 +0200 Update client.rs commit cf0b4dddbc93395bc5ce1f17c3c07a294bf8dd49 Merge: 23bfa78c2 36e05e5f3 Author: shamardy <shamardy@yahoo.com> Date: Sun Jun 24 04:54:04 2018 +0200 Merge branch 'Issue#8725' of https://github.com/shamardy/parity into Issue#8725 commit 23bfa78c2662d697018e7061ab9ad0b864fde0ef Author: shamardy <shamardy@yahoo.com> Date: Sun Jun 24 04:53:50 2018 +0200 Undo commit 36e05e5f30c35bd6b57af50fd337f2006df51b86 Merge: 2f6e1ef64 0afc74825 Author: shamardy <shamardy@yahoo.com> Date: Sun Jun 24 04:44:33 2018 +0200 Merge branch 'Issue#8725' of https://github.com/shamardy/parity into Issue#8725 commit 2f6e1ef64763a79ad2ed8baa2aed5a8f3136bafc Author: shamardy <shamardy@yahoo.com> Date: Sun Jun 24 04:44:22 2018 +0200 Another rpc test output with ("transactionHash":null) commit 0afc74825828f724d68f3e444655b872a6c51ce0 Author: shamardy <shamardy@yahoo.com> Date: Thu Jun 14 07:18:45 2018 +0200 Another rpc test output with ("transactionHash":null) commit 138fbac9f02841adfeaaf061c5dd9e647f725e12 Author: shamardy <shamardy@yahoo.com> Date: Thu Jun 14 06:30:41 2018 +0200 Edited some rpc tests output with ("transactionHash":null) commit 8c129a63109c00f88ce36bad10699dc2f3237d95 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 05:48:39 2018 +0200 Update traces.rs commit 52c17f6191740637c1d1589a420996dccefe16bb Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 05:47:29 2018 +0200 Update parity.rs commit d39303aa8c2097ba9e2ed94c7ad2166bf1608d3f Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 05:46:25 2018 +0200 Update eth.rs commit 49be84bf529c33dc47c8260435fd0d26e137c66d Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 05:40:56 2018 +0200 Update trace.rs commit 4fc801377fb01ff11867f66b547a307c162d7a56 Merge: d34ba2351 544210439 Author: shamardy <shamardy@yahoo.com> Date: Thu Jun 14 05:12:21 2018 +0200 Merge branch 'Issue#8725' of https://github.com/shamardy/parity into Issue#8725 commit 54421043959e14a76f309fe87d3c7513a95999f8 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 05:04:51 2018 +0200 Update trace.rs commit 2b2524a31119d741df4076e9d1b3ce8f0b17b479 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 05:01:47 2018 +0200 Update state_diff.rs commit 2bf9982b8ce29ef69f116142eaeacf3049f7db49 Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 05:00:50 2018 +0200 Update transaction.rs commit da696ea192c0f89cceb38834f6efee280129048c Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 05:00:13 2018 +0200 Update mod.rs commit cfc194ca0f44bfabec01a52897a322ea5a91930b Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 04:59:18 2018 +0200 Update pod_state.rs commit 3b3156853535a666778e0ad0e902de79fb138f1d Author: shamardy <39480341+shamardy@users.noreply.github.com> Date: Thu Jun 14 04:57:37 2018 +0200 Update client.rs commit d34ba235132c654da6c2ed6ff0dcf96fda0c45ee Author: shamardy <shamardy@yahoo.com> Date: Thu Jun 14 04:53:50 2018 +0200 RPC Only commit 8b5c4f19727549ee6f180a6effc228b2693509e9 Merge: 744491632 291b4a01b Author: shamardy <shamardy@yahoo.com> Date: Thu Jun 14 02:55:14 2018 +0200 Merge branch 'Issue#8725' of https://github.com/shamardy/parity into Issue#8725 commit 74449163222e0ab75c704ac0ad424870e3c321d9 Author: shamardy <shamardy@yahoo.com> Date: Thu Jun 14 02:27:13 2018 +0200 Issue#8725 Transactions hashes missing in trace_replayBlockTransactions method result #8725 commit 291b4a01be6771acff8f5829c5406fa193665dbe Author: shamardy <shamardy@yahoo.com> Date: Thu Jun 14 01:18:18 2018 +0200 Edited to make changes to RPC types only To make a transactions hash trace with "trace_replayBlockTransactions" add "transactionHash" to parameters commit 9d082bece73beb8ebddfda51fa5ec279f30b7bea Author: shamardy <shamardy@yahoo.com> Date: Wed Jun 13 09:15:56 2018 +0200 Issue#8725 Transactions hashes missing in trace_replayBlockTransactions method result #8725 * update * Removed unwrap_or * Update * test_client update
This commit is contained in:
parent
c7f608ec74
commit
526c61e2c0
@ -1548,10 +1548,10 @@ impl BlockChainClient for Client {
|
||||
let block = BlockId::Hash(address.block_hash);
|
||||
|
||||
const PROOF: &'static str = "The transaction address contains a valid index within block; qed";
|
||||
Ok(self.replay_block_transactions(block, analytics)?.nth(address.index).expect(PROOF))
|
||||
Ok(self.replay_block_transactions(block, analytics)?.nth(address.index).expect(PROOF).1)
|
||||
}
|
||||
|
||||
fn replay_block_transactions(&self, block: BlockId, analytics: CallAnalytics) -> Result<Box<Iterator<Item = Executed>>, CallError> {
|
||||
fn replay_block_transactions(&self, block: BlockId, analytics: CallAnalytics) -> Result<Box<Iterator<Item = (H256, Executed)>>, CallError> {
|
||||
let mut env_info = self.env_info(block).ok_or(CallError::StatePruned)?;
|
||||
let body = self.block_body(block).ok_or(CallError::StatePruned)?;
|
||||
let mut state = self.state_at_beginning(block).ok_or(CallError::StatePruned)?;
|
||||
@ -1563,11 +1563,12 @@ impl BlockChainClient for Client {
|
||||
|
||||
Ok(Box::new(txs.into_iter()
|
||||
.map(move |t| {
|
||||
let transaction_hash = t.hash();
|
||||
let t = SignedTransaction::new(t).expect(PROOF);
|
||||
let machine = engine.machine();
|
||||
let x = Self::do_virtual_call(machine, &env_info, &mut state, &t, analytics).expect(EXECUTE_PROOF);
|
||||
env_info.gas_used = env_info.gas_used + x.gas_used;
|
||||
x
|
||||
(transaction_hash, x)
|
||||
})))
|
||||
}
|
||||
|
||||
|
@ -610,8 +610,8 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
self.execution_result.read().clone().unwrap()
|
||||
}
|
||||
|
||||
fn replay_block_transactions(&self, _block: BlockId, _analytics: CallAnalytics) -> Result<Box<Iterator<Item = Executed>>, CallError> {
|
||||
Ok(Box::new(self.execution_result.read().clone().unwrap().into_iter()))
|
||||
fn replay_block_transactions(&self, _block: BlockId, _analytics: CallAnalytics) -> Result<Box<Iterator<Item = (H256, Executed)>>, CallError> {
|
||||
Ok(Box::new(self.traces.read().clone().unwrap().into_iter().map(|t| t.transaction_hash.unwrap_or(H256::new())).zip(self.execution_result.read().clone().unwrap().into_iter())))
|
||||
}
|
||||
|
||||
fn block_total_difficulty(&self, _id: BlockId) -> Option<U256> {
|
||||
|
@ -303,7 +303,7 @@ pub trait BlockChainClient : Sync + Send + AccountData + BlockChain + CallContra
|
||||
fn replay(&self, t: TransactionId, analytics: CallAnalytics) -> Result<Executed, CallError>;
|
||||
|
||||
/// Replays all the transactions in a given block for inspection.
|
||||
fn replay_block_transactions(&self, block: BlockId, analytics: CallAnalytics) -> Result<Box<Iterator<Item = Executed>>, CallError>;
|
||||
fn replay_block_transactions(&self, block: BlockId, analytics: CallAnalytics) -> Result<Box<Iterator<Item = (H256, Executed)>>, CallError>;
|
||||
|
||||
/// Returns traces matching given filter.
|
||||
fn filter_traces(&self, filter: TraceFilter) -> Option<Vec<LocalizedTrace>>;
|
||||
|
@ -21,7 +21,7 @@ use jsonrpc_macros::Trailing;
|
||||
use v1::Metadata;
|
||||
use v1::traits::Traces;
|
||||
use v1::helpers::errors;
|
||||
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, TraceOptions, H256};
|
||||
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, TraceResultsWithTransactionHash, TraceOptions, H256};
|
||||
|
||||
/// Traces api implementation.
|
||||
// TODO: all calling APIs should be possible w. proved remote TX execution.
|
||||
@ -62,7 +62,7 @@ impl Traces for TracesClient {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn replay_block_transactions(&self, _block_number: BlockNumber, _flags: TraceOptions) -> Result<Vec<TraceResults>> {
|
||||
fn replay_block_transactions(&self, _block_number: BlockNumber, _flags: TraceOptions) -> Result<Vec<TraceResultsWithTransactionHash>> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ use jsonrpc_macros::Trailing;
|
||||
use v1::Metadata;
|
||||
use v1::traits::Traces;
|
||||
use v1::helpers::{errors, fake_sign};
|
||||
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, TraceOptions, H256, block_number_to_id};
|
||||
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, TraceResultsWithTransactionHash, TraceOptions, H256, block_number_to_id};
|
||||
|
||||
fn to_call_analytics(flags: TraceOptions) -> CallAnalytics {
|
||||
CallAnalytics {
|
||||
@ -164,7 +164,7 @@ impl<C, S> Traces for TracesClient<C> where
|
||||
.map_err(errors::call)
|
||||
}
|
||||
|
||||
fn replay_block_transactions(&self, block_number: BlockNumber, flags: TraceOptions) -> Result<Vec<TraceResults>> {
|
||||
fn replay_block_transactions(&self, block_number: BlockNumber, flags: TraceOptions) -> Result<Vec<TraceResultsWithTransactionHash>> {
|
||||
let id = match block_number {
|
||||
BlockNumber::Num(num) => BlockId::Number(num),
|
||||
BlockNumber::Earliest => BlockId::Earliest,
|
||||
@ -174,7 +174,7 @@ impl<C, S> Traces for TracesClient<C> where
|
||||
};
|
||||
|
||||
self.client.replay_block_transactions(id, to_call_analytics(flags))
|
||||
.map(|results| results.into_iter().map(TraceResults::from).collect())
|
||||
.map(|results| results.into_iter().map(TraceResultsWithTransactionHash::from).collect())
|
||||
.map_err(errors::call)
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ fn rpc_trace_replay_block_transactions() {
|
||||
let tester = io();
|
||||
|
||||
let request = r#"{"jsonrpc":"2.0","method":"trace_replayBlockTransactions","params":["0x10", ["trace", "stateDiff", "vmTrace"]],"id":1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":[{"output":"0x010203","stateDiff":null,"trace":[],"vmTrace":null}],"id":1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":[{"output":"0x010203","stateDiff":null,"trace":[],"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000005","vmTrace":null}],"id":1}"#;
|
||||
|
||||
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
use jsonrpc_core::Result;
|
||||
use jsonrpc_macros::Trailing;
|
||||
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, H256, TraceOptions};
|
||||
use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, Bytes, TraceResults, TraceResultsWithTransactionHash, H256, TraceOptions};
|
||||
|
||||
build_rpc_trait! {
|
||||
/// Traces specific rpc interface.
|
||||
@ -59,6 +59,6 @@ build_rpc_trait! {
|
||||
|
||||
/// Executes all the transactions at the given block and returns a number of possible traces for each transaction.
|
||||
#[rpc(name = "trace_replayBlockTransactions")]
|
||||
fn replay_block_transactions(&self, BlockNumber, TraceOptions) -> Result<Vec<TraceResults>>;
|
||||
fn replay_block_transactions(&self, BlockNumber, TraceOptions) -> Result<Vec<TraceResultsWithTransactionHash>>;
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ pub use self::sync::{
|
||||
SyncStatus, SyncInfo, Peers, PeerInfo, PeerNetworkInfo, PeerProtocolsInfo,
|
||||
TransactionStats, ChainStatus, EthProtocolInfo, PipProtocolInfo,
|
||||
};
|
||||
pub use self::trace::{LocalizedTrace, TraceResults};
|
||||
pub use self::trace::{LocalizedTrace, TraceResults, TraceResultsWithTransactionHash};
|
||||
pub use self::trace_filter::TraceFilter;
|
||||
pub use self::transaction::{Transaction, RichRawTransaction, LocalTransactionStatus};
|
||||
pub use self::transaction_request::TransactionRequest;
|
||||
|
@ -22,6 +22,7 @@ use ethcore::trace as et;
|
||||
use ethcore::state_diff;
|
||||
use ethcore::account_diff;
|
||||
use ethcore::client::Executed;
|
||||
use ethereum_types::H256 as EthH256;
|
||||
use vm;
|
||||
use v1::types::{Bytes, H160, H256, U256};
|
||||
|
||||
@ -631,6 +632,36 @@ impl From<Executed> for TraceResults {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
/// A diff of some chunk of memory.
|
||||
pub struct TraceResultsWithTransactionHash {
|
||||
/// The output of the call/create
|
||||
pub output: Bytes,
|
||||
/// The transaction trace.
|
||||
pub trace: Vec<Trace>,
|
||||
/// The transaction trace.
|
||||
#[serde(rename="vmTrace")]
|
||||
pub vm_trace: Option<VMTrace>,
|
||||
/// The transaction trace.
|
||||
#[serde(rename="stateDiff")]
|
||||
pub state_diff: Option<StateDiff>,
|
||||
/// The transaction Hash.
|
||||
#[serde(rename="transactionHash")]
|
||||
pub transaction_hash: H256,
|
||||
}
|
||||
|
||||
impl From<(EthH256, Executed)> for TraceResultsWithTransactionHash {
|
||||
fn from(t: (EthH256, Executed)) -> Self {
|
||||
TraceResultsWithTransactionHash {
|
||||
output: t.1.output.into(),
|
||||
trace: t.1.trace.into_iter().map(Into::into).collect(),
|
||||
vm_trace: t.1.vm_trace.map(Into::into),
|
||||
state_diff: t.1.state_diff.map(Into::into),
|
||||
transaction_hash: t.0.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json;
|
||||
|
Loading…
Reference in New Issue
Block a user