Remove BlockNumber <-> u64 conversions from light-client related code (#2666)

* Remove As usage from CHT

* Remove As usage from CHT (continue)

* Restrict BN <-> int conversions in CT

* more BN <-> u64 conversions removed

* upd spec_version

* Apply suggestions from code review

Co-Authored-By: Gavin Wood <github@gavwood.com>

* Apply suggestions from code review

Co-Authored-By: Gavin Wood <github@gavwood.com>

* more grumbles

* fix last grumbles + compilation

* too long lines

* too long lines
This commit is contained in:
Svyatoslav Nikolsky
2019-05-28 16:07:16 +03:00
committed by Gavin Wood
parent 25b88f1a1f
commit 549d9e1da1
41 changed files with 1087 additions and 654 deletions
+2 -3
View File
@@ -78,7 +78,7 @@ use rstd::prelude::*;
use rstd::map;
use primitives::traits::{self, CheckEqual, SimpleArithmetic, SimpleBitOps, One, Bounded, Lookup,
Hash, Member, MaybeDisplay, EnsureOrigin, Digest as DigestT, CurrentHeight, BlockNumberToHash,
MaybeSerializeDebugButNotDeserialize, MaybeSerializeDebug, StaticLookup, SaturatedConversion
MaybeSerializeDebugButNotDeserialize, MaybeSerializeDebug, StaticLookup,
};
#[cfg(any(feature = "std", test))]
use primitives::traits::Zero;
@@ -493,8 +493,7 @@ impl<T: Trait> Module<T> {
let mut digest = <Digest<T>>::take();
let extrinsics_root = <ExtrinsicsRoot<T>>::take();
let storage_root = T::Hashing::storage_root();
let number_u64 = number.saturated_into::<u64>();
let storage_changes_root = T::Hashing::storage_changes_root(parent_hash, number_u64 - 1);
let storage_changes_root = T::Hashing::storage_changes_root(parent_hash);
// we can't compute changes trie root earlier && put it to the Digest
// because it will include all currently existing temporaries.