Unverified Commit e17e5b31 authored by Arkadiy Paronyan's avatar Arkadiy Paronyan
Browse files

Paranoid mode

parent e6fe8379
......@@ -1705,6 +1705,7 @@ name = "polkadot-api"
version = "0.1.0"
dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"polkadot-executor 0.1.0",
"polkadot-primitives 0.1.0",
"polkadot-runtime 0.1.0",
......
......@@ -5,6 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
error-chain = "0.12"
log = "0.3"
polkadot-executor = { path = "../executor" }
polkadot-runtime = { path = "../runtime" }
polkadot-primitives = { path = "../primitives" }
......
......@@ -22,7 +22,7 @@ use client::{self, Client, LocalCallExecutor, CallExecutor};
use codec::{Encode, Decode};
use polkadot_executor::Executor as LocalDispatch;
use substrate_executor::NativeExecutor;
use state_machine;
use state_machine::ExecutionManager;
use runtime::Address;
use primitives::{
......@@ -50,19 +50,26 @@ where
};
client.state_at(&parent).map_err(Error::from).and_then(|state| {
let mut overlay = Default::default();
let execution_manager = || ExecutionManager::Both(|wasm_result, native_result| {
warn!("Consensus error between wasm and native runtime execution at block {:?}", at);
warn!(" Method {:?}", method);
warn!(" Native result {:?}", native_result);
warn!(" Wasm result {:?}", wasm_result);
wasm_result
});
client.executor().call_at_state(
&state,
&mut overlay,
"initialise_block",
&header.encode(),
state_machine::native_when_possible()
execution_manager()
)?;
let (r, _) = client.executor().call_at_state(
&state,
&mut overlay,
method,
input,
state_machine::native_when_possible()
execution_manager()
)?;
Ok(R::decode(&mut &r[..])
.ok_or_else(|| client::error::Error::from(client::error::ErrorKind::CallResultDecode(method)))?)
......
......@@ -32,6 +32,9 @@ extern crate substrate_state_machine as state_machine;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate log;
#[cfg(test)]
extern crate substrate_keyring as keyring;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment