diff --git a/polkadot/api/Cargo.toml b/polkadot/api/Cargo.toml index 860536ac95..cb2204d69e 100644 --- a/polkadot/api/Cargo.toml +++ b/polkadot/api/Cargo.toml @@ -5,6 +5,7 @@ authors = ["Parity Technologies "] [dependencies] error-chain = "0.11" +log = "0.3" polkadot-executor = { path = "../executor" } polkadot-runtime = { path = "../runtime" } polkadot-primitives = { path = "../primitives" } diff --git a/polkadot/api/src/lib.rs b/polkadot/api/src/lib.rs index 1459c4a4d1..98e439875a 100644 --- a/polkadot/api/src/lib.rs +++ b/polkadot/api/src/lib.rs @@ -31,6 +31,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; @@ -174,7 +177,7 @@ impl PolkadotApi for Client> fn check_id(&self, id: BlockId) -> Result { // bail if the code is not the same as the natively linked. if self.code_at(&id)? != LocalDispatch::native_equivalent() { - bail!(ErrorKind::UnknownRuntime); + warn!("This node is out of date. Block authoring may not work correctly.") } Ok(CheckedId(id)) @@ -324,19 +327,15 @@ impl BlockBuilder for ClientBlockBuilder } fn bake(mut self) -> Block { - use substrate_runtime_executive::extrinsics_root; - let mut ext = state_machine::Ext { overlay: &mut self.changes, backend: &self.state, }; - let mut final_header = ::substrate_executor::with_native_environment( + let final_header = ::substrate_executor::with_native_environment( &mut ext, move || runtime::Executive::finalise_block() ).expect("all inherent extrinsics pushed; all other extrinsics executed correctly; qed"); - - final_header.extrinsics_root = extrinsics_root::(&self.extrinsics); Block { header: final_header, extrinsics: self.extrinsics, diff --git a/polkadot/consensus/Cargo.toml b/polkadot/consensus/Cargo.toml index ad33a17712..9d883b5003 100644 --- a/polkadot/consensus/Cargo.toml +++ b/polkadot/consensus/Cargo.toml @@ -9,7 +9,7 @@ parking_lot = "0.4" tokio-core = "0.1.12" ed25519 = { path = "../../substrate/ed25519" } error-chain = "0.11" -log = "0.4" +log = "0.3" polkadot-api = { path = "../api" } polkadot-collator = { path = "../collator" } polkadot-primitives = { path = "../primitives" } diff --git a/polkadot/runtime/wasm/genesis.wasm b/polkadot/runtime/wasm/genesis.wasm index b7adff2d53..13aa514936 100644 Binary files a/polkadot/runtime/wasm/genesis.wasm and b/polkadot/runtime/wasm/genesis.wasm differ diff --git a/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm b/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm index 580bc98f7a..13aa514936 100644 Binary files a/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm and b/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.compact.wasm differ diff --git a/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm b/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm index e7fb35798f..3c4a32a5a9 100755 Binary files a/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm and b/polkadot/runtime/wasm/target/wasm32-unknown-unknown/release/polkadot_runtime.wasm differ diff --git a/polkadot/service/Cargo.toml b/polkadot/service/Cargo.toml index f071d9ffc4..51aaf006fc 100644 --- a/polkadot/service/Cargo.toml +++ b/polkadot/service/Cargo.toml @@ -8,7 +8,7 @@ futures = "0.1.17" parking_lot = "0.4" tokio-timer = "0.1.2" error-chain = "0.11" -log = "0.4" +log = "0.3" tokio-core = "0.1.12" ed25519 = { path = "../../substrate/ed25519" } polkadot-primitives = { path = "../primitives" } diff --git a/polkadot/transaction-pool/Cargo.toml b/polkadot/transaction-pool/Cargo.toml index d80384c23c..b8bf7f001c 100644 --- a/polkadot/transaction-pool/Cargo.toml +++ b/polkadot/transaction-pool/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" authors = ["Parity Technologies "] [dependencies] +log = "0.4.0" transaction-pool = "1.9.0" error-chain = "0.11" polkadot-api = { path = "../api" } diff --git a/polkadot/transaction-pool/src/lib.rs b/polkadot/transaction-pool/src/lib.rs index 47fc7c99bd..56534aa699 100644 --- a/polkadot/transaction-pool/src/lib.rs +++ b/polkadot/transaction-pool/src/lib.rs @@ -28,6 +28,9 @@ extern crate transaction_pool; #[macro_use] extern crate error_chain; +#[macro_use] +extern crate log; + use std::collections::HashMap; use std::cmp::Ordering; use std::sync::Arc; @@ -296,12 +299,10 @@ impl<'a, T: 'a + PolkadotApi> transaction_pool::Ready for R let next_index = self.known_indices.entry(sender) .or_insert_with(|| api_handle.index(at_block, sender).ok().unwrap_or_else(u64::max_value)); - *next_index += 1; - match xt.inner.index.cmp(&next_index) { Ordering::Greater => Readiness::Future, Ordering::Equal => Readiness::Ready, - Ordering::Less => Readiness::Stalled, + Ordering::Less => Readiness::Stalled, // TODO: this is not "stalled" but rather stale and can be discarded. } } } @@ -330,12 +331,14 @@ impl TransactionPool { let verified = VerifiedTransaction::create(xt, insertion_index)?; + info!("Extrinsic verified {:?}. Importing...", verified); + // TODO: just use a foreign link when the error type is made public. let hash = verified.hash.clone(); self.inner.import(verified) .map_err(|e| match e { - // TODO: make error types public in transaction_pool. For now just treat all errors as AlradyImported + // TODO: make error types public in transaction_pool. For now just treat all errors as AlreadyImported _ => ErrorKind::AlreadyImported(hash), // transaction_pool::error::AlreadyImported(h) => ErrorKind::AlreadyImported(h), // e => ErrorKind::Import(Box::new(e)), @@ -376,11 +379,14 @@ impl TransactionPool { impl substrate_rpc::author::AsyncAuthorApi for TransactionPool { fn submit_extrinsic(&mut self, xt: Extrinsic) -> substrate_rpc::author::error::Result<()> { - self.import(xt - .using_encoded(|ref mut s| UncheckedExtrinsic::decode(s)) - .ok_or(substrate_rpc::author::error::ErrorKind::InvalidFormat)?) - .map(|_| ()) - .map_err(|_| substrate_rpc::author::error::ErrorKind::PoolError.into()) + use substrate_primitives::hexdisplay::HexDisplay; + info!("Extrinsic submitted: {}", HexDisplay::from(&xt.0)); + let xt = xt.using_encoded(|ref mut s| UncheckedExtrinsic::decode(s)) + .ok_or(substrate_rpc::author::error::ErrorKind::InvalidFormat)?; + info!("Correctly formatted: {:?}", xt); + self.import(xt) + .map(|_| ()) + .map_err(|_| substrate_rpc::author::error::ErrorKind::PoolError.into()) } }