State conensus tests now print mismatching diff.

This commit is contained in:
Gav Wood 2016-01-13 18:40:18 +01:00
parent 311aa5c442
commit 602d9d99b1

View File

@ -47,7 +47,7 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
let t = Transaction::from_json(&test["transaction"]); let t = Transaction::from_json(&test["transaction"]);
let env = EnvInfo::from_json(&test["env"]); let env = EnvInfo::from_json(&test["env"]);
let out = bytes_from_json(&test["out"]); let _out = bytes_from_json(&test["out"]);
let post_state_root = h256_from_json(&test["postStateRoot"]); let post_state_root = h256_from_json(&test["postStateRoot"]);
let pre = pod_map_from_json(&test["pre"]); let pre = pod_map_from_json(&test["pre"]);
let post = pod_map_from_json(&test["post"]); let post = pod_map_from_json(&test["post"]);
@ -56,19 +56,14 @@ fn do_json_test(json_data: &[u8]) -> Vec<String> {
println!("Transaction: {:?}", t); println!("Transaction: {:?}", t);
println!("Env: {:?}", env); println!("Env: {:?}", env);
println!("Pre:\n{:?}", pre);
let mut s = State::new_temp(); let mut s = State::new_temp();
s.populate_from(pre); s.populate_from(pre);
println!("Our-pre:\n{:?}", s.to_pod_map());
s.apply(&env, engine.deref(), &t).unwrap(); s.apply(&env, engine.deref(), &t).unwrap();
let our_post = s.to_pod_map(); let our_post = s.to_pod_map();
if fail_unless(s.root() == &post_state_root) { if fail_unless(s.root() == &post_state_root) {
println!("EXPECTED:\n{:?}", post); println!("DIFF:\n{:?}", pod_map_diff(&post, &our_post));
println!("GOT:\n{:?}", our_post);
// println!("DIFF:\n{:?}", pod_map_diff(post, our_post));
} }
// TODO: Compare logs. // TODO: Compare logs.