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

Paranoid mode

parent e6fe8379
...@@ -1705,6 +1705,7 @@ name = "polkadot-api" ...@@ -1705,6 +1705,7 @@ name = "polkadot-api"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "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-executor 0.1.0",
"polkadot-primitives 0.1.0", "polkadot-primitives 0.1.0",
"polkadot-runtime 0.1.0", "polkadot-runtime 0.1.0",
......
...@@ -5,6 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"] ...@@ -5,6 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
error-chain = "0.12" error-chain = "0.12"
log = "0.3"
polkadot-executor = { path = "../executor" } polkadot-executor = { path = "../executor" }
polkadot-runtime = { path = "../runtime" } polkadot-runtime = { path = "../runtime" }
polkadot-primitives = { path = "../primitives" } polkadot-primitives = { path = "../primitives" }
......
...@@ -22,7 +22,7 @@ use client::{self, Client, LocalCallExecutor, CallExecutor}; ...@@ -22,7 +22,7 @@ use client::{self, Client, LocalCallExecutor, CallExecutor};
use codec::{Encode, Decode}; use codec::{Encode, Decode};
use polkadot_executor::Executor as LocalDispatch; use polkadot_executor::Executor as LocalDispatch;
use substrate_executor::NativeExecutor; use substrate_executor::NativeExecutor;
use state_machine; use state_machine::ExecutionManager;
use runtime::Address; use runtime::Address;
use primitives::{ use primitives::{
...@@ -50,19 +50,26 @@ where ...@@ -50,19 +50,26 @@ where
}; };
client.state_at(&parent).map_err(Error::from).and_then(|state| { client.state_at(&parent).map_err(Error::from).and_then(|state| {
let mut overlay = Default::default(); 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( client.executor().call_at_state(
&state, &state,
&mut overlay, &mut overlay,
"initialise_block", "initialise_block",
&header.encode(), &header.encode(),
state_machine::native_when_possible() execution_manager()
)?; )?;
let (r, _) = client.executor().call_at_state( let (r, _) = client.executor().call_at_state(
&state, &state,
&mut overlay, &mut overlay,
method, method,
input, input,
state_machine::native_when_possible() execution_manager()
)?; )?;
Ok(R::decode(&mut &r[..]) Ok(R::decode(&mut &r[..])
.ok_or_else(|| client::error::Error::from(client::error::ErrorKind::CallResultDecode(method)))?) .ok_or_else(|| client::error::Error::from(client::error::ErrorKind::CallResultDecode(method)))?)
......
...@@ -32,6 +32,9 @@ extern crate substrate_state_machine as state_machine; ...@@ -32,6 +32,9 @@ extern crate substrate_state_machine as state_machine;
#[macro_use] #[macro_use]
extern crate error_chain; extern crate error_chain;
#[macro_use]
extern crate log;
#[cfg(test)] #[cfg(test)]
extern crate substrate_keyring as keyring; 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