Prevent building invalid blocks (#430)

* Commit extrinsics changes

* Removed panic=abort

* Commit when needed

* Resotre default hook for the native call

* Revert test

* Proper test

* Sorted errors and fixed wasm build
This commit is contained in:
Arkadiy Paronyan
2018-07-27 11:11:47 +02:00
committed by GitHub
parent 1b0e3e57dd
commit 916131b073
17 changed files with 91 additions and 15 deletions
@@ -355,4 +355,15 @@ mod tests {
});
});
}
#[test]
fn bad_extrinsic_not_inserted() {
let mut t = new_test_ext();
let xt = primitives::testing::TestXt((1, 42, Call::transfer(33.into(), 69)));
with_externalities(&mut t, || {
Executive::initialise_block(&Header::new(1, H256::default(), H256::default(), [69u8; 32].into(), Digest::default()));
assert!(Executive::apply_extrinsic(xt).is_err());
assert_eq!(<system::Module<Test>>::extrinsic_index(), 0);
});
}
}