Storage tracing (#3614)

* Storage tracing

* Whitepsaces

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update Cargo.lock
This commit is contained in:
Arkadiy Paronyan
2019-09-17 20:42:15 +02:00
committed by GitHub
parent 2b040fe983
commit a07e567fe1
12 changed files with 223 additions and 41 deletions
+14 -1
View File
@@ -22,12 +22,13 @@ use std::{
fmt, result, collections::HashMap,
marker::PhantomData, panic::UnwindSafe,
};
use log::warn;
use log::{warn, trace};
use hash_db::Hasher;
use codec::{Decode, Encode};
use primitives::{
storage::well_known_keys, NativeOrEncoded, NeverNativeValue, offchain::{self, NeverOffchainExt},
traits::{BareCryptoStorePtr, CodeExecutor},
hexdisplay::HexDisplay,
};
pub mod backend;
@@ -258,6 +259,13 @@ impl<'a, B, H, N, T, O, Exec> StateMachine<'a, B, H, N, T, O, Exec> where
self.offchain_ext.as_mut().map(|x| &mut **x),
self.keystore.clone(),
);
let id = externalities.id;
trace!(target: "state-trace", "{:04x}: Call {} at {:?}. Input={:?}",
id,
self.method,
self.backend,
HexDisplay::from(&self.call_data),
);
let (result, was_native) = self.exec.call(
&mut externalities,
self.method,
@@ -271,6 +279,11 @@ impl<'a, B, H, N, T, O, Exec> StateMachine<'a, B, H, N, T, O, Exec> where
} else {
(None, None)
};
trace!(target: "state-trace", "{:04x}: Return. Native={:?}, Result={:?}",
id,
was_native,
result,
);
(result, was_native, storage_delta, changes_delta)
}