Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 5199bc1

Browse files
gavofyorkrphmeier
authored andcommitted
Extrinsics root is calculated as part of block-building (#120)
* extrinsics root is calculated as part of block-building. * Fix build. * Fix xt root. * Couple of fixes. * Logging and more useful APIs. * Fix test. * Update log version. * Switch back to correct version of log.
1 parent 0f2dd15 commit 5199bc1

File tree

24 files changed

+106
-44
lines changed

24 files changed

+106
-44
lines changed

Cargo.lock

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

polkadot/api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ authors = ["Parity Technologies <[email protected]>"]
55

66
[dependencies]
77
error-chain = "0.11"
8+
log = "0.3"
89
polkadot-executor = { path = "../executor" }
910
polkadot-runtime = { path = "../runtime" }
1011
polkadot-primitives = { path = "../primitives" }

polkadot/api/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ extern crate substrate_state_machine as state_machine;
3131
#[macro_use]
3232
extern crate error_chain;
3333

34+
#[macro_use]
35+
extern crate log;
36+
3437
#[cfg(test)]
3538
extern crate substrate_keyring as keyring;
3639

@@ -174,7 +177,7 @@ impl<B: Backend> PolkadotApi for Client<B, NativeExecutor<LocalDispatch>>
174177
fn check_id(&self, id: BlockId) -> Result<CheckedId> {
175178
// bail if the code is not the same as the natively linked.
176179
if self.code_at(&id)? != LocalDispatch::native_equivalent() {
177-
bail!(ErrorKind::UnknownRuntime);
180+
warn!("This node is out of date. Block authoring may not work correctly.")
178181
}
179182

180183
Ok(CheckedId(id))
@@ -324,19 +327,15 @@ impl<S: state_machine::Backend> BlockBuilder for ClientBlockBuilder<S>
324327
}
325328

326329
fn bake(mut self) -> Block {
327-
use substrate_runtime_executive::extrinsics_root;
328-
329330
let mut ext = state_machine::Ext {
330331
overlay: &mut self.changes,
331332
backend: &self.state,
332333
};
333334

334-
let mut final_header = ::substrate_executor::with_native_environment(
335+
let final_header = ::substrate_executor::with_native_environment(
335336
&mut ext,
336337
move || runtime::Executive::finalise_block()
337338
).expect("all inherent extrinsics pushed; all other extrinsics executed correctly; qed");
338-
339-
final_header.extrinsics_root = extrinsics_root::<runtime_io::BlakeTwo256, _>(&self.extrinsics);
340339
Block {
341340
header: final_header,
342341
extrinsics: self.extrinsics,

polkadot/consensus/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ parking_lot = "0.4"
99
tokio-core = "0.1.12"
1010
ed25519 = { path = "../../substrate/ed25519" }
1111
error-chain = "0.11"
12-
log = "0.4"
12+
log = "0.3"
1313
polkadot-api = { path = "../api" }
1414
polkadot-collator = { path = "../collator" }
1515
polkadot-primitives = { path = "../primitives" }

polkadot/runtime/wasm/genesis.wasm

6.96 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

polkadot/service/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ futures = "0.1.17"
88
parking_lot = "0.4"
99
tokio-timer = "0.1.2"
1010
error-chain = "0.11"
11-
log = "0.4"
11+
log = "0.3"
1212
tokio-core = "0.1.12"
1313
ed25519 = { path = "../../substrate/ed25519" }
1414
polkadot-primitives = { path = "../primitives" }

0 commit comments

Comments
 (0)