Additional state check. (#2915)

* check resulting state root on import.

* get root from last method.

* Fix test runtime (was changing state after root calculation).

* Do reset new authorities (just take before root calculation).

* bump impl runtime version.

* Update core/sr-api-macros/tests/trybuild.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
cheme
2019-06-26 16:28:12 +02:00
committed by Bastian Köcher
parent 443ad90b47
commit f69c48c7b8
7 changed files with 46 additions and 14 deletions
+5 -1
View File
@@ -1027,7 +1027,11 @@ impl<B, E, Block, RA> Client<B, E, Block, RA> where
let (top, children) = overlay.into_committed();
let children = children.map(|(sk, it)| (sk, it.collect())).collect();
Ok((Some(storage_update), Some(changes_update), Some((top.collect(), children))))
if import_headers.post().state_root() != &storage_update.1 {
return Err(error::Error::InvalidStateRoot);
}
Ok((Some(storage_update.0), Some(changes_update), Some((top.collect(), children))))
},
None => Ok((None, None, None))
}