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
+3 -3
View File
@@ -100,7 +100,7 @@ pub fn polish_block(block: &mut Block) {
// check digest
let mut digest = Digest::default();
if let Some(storage_changes_root) = storage_changes_root(header.parent_hash.into(), header.number - 1) {
if let Some(storage_changes_root) = storage_changes_root(header.parent_hash.into()) {
digest.push(generic::DigestItem::ChangesTrieRoot(storage_changes_root.into()));
}
if let Some(new_authorities) = <NewAuthorities>::take() {
@@ -133,7 +133,7 @@ pub fn execute_block(block: Block) {
// check digest
let mut digest = Digest::default();
if let Some(storage_changes_root) = storage_changes_root(header.parent_hash.into(), header.number - 1) {
if let Some(storage_changes_root) = storage_changes_root(header.parent_hash.into()) {
digest.push(generic::DigestItem::ChangesTrieRoot(storage_changes_root.into()));
}
if let Some(new_authorities) = <NewAuthorities>::take() {
@@ -213,7 +213,7 @@ pub fn finalize_block() -> Header {
let number = <Number>::take().expect("Number is set by `initialize_block`");
let parent_hash = <ParentHash>::take();
let storage_root = BlakeTwo256::storage_root();
let storage_changes_root = BlakeTwo256::storage_changes_root(parent_hash, number - 1);
let storage_changes_root = BlakeTwo256::storage_changes_root(parent_hash);
let mut digest = Digest::default();
if let Some(storage_changes_root) = storage_changes_root {