Test multiple blocks/txs per block.

Better debug tracing.
This commit is contained in:
Gav
2018-01-31 12:33:40 +00:00
parent e9958a8e5c
commit 6fd19a630a
9 changed files with 116 additions and 30 deletions
+12 -1
View File
@@ -37,6 +37,7 @@ pub mod runtime;
use runtime_std::prelude::*;
use codec::Slicable;
use runtime_std::print;
use primitives::{Block, UncheckedTransaction};
/// Execute a block, with `input` being the canonical serialisation of the block. Returns the
@@ -53,4 +54,14 @@ pub fn execute_transaction(input: &[u8]) -> Vec<u8> {
Vec::new()
}
impl_stubs!(execute_block, execute_transaction);
/// Run whatever tests we have.
pub fn run_tests(input: &[u8]) -> Vec<u8> {
print("run_tests...");
let block = Block::from_slice(input).unwrap();
print("deserialised block.");
let stxs = block.transactions.iter().map(Slicable::to_vec).collect::<Vec<_>>();
print("reserialised transactions.");
[stxs.len() as u8].to_vec()
}
impl_stubs!(execute_block, execute_transaction, run_tests);