Fix JSONRPC test utils.

This commit is contained in:
Gav Wood 2016-03-19 14:10:32 +01:00
parent 66837452c2
commit 152f132b7b
2 changed files with 14 additions and 12 deletions

View File

@ -227,19 +227,21 @@ fn do_json_test_for(vm: &VMType, json_data: &[u8]) -> Vec<String> {
let out_of_gas = test.find("callcreates").map(|_calls| { let out_of_gas = test.find("callcreates").map(|_calls| {
}).is_none(); }).is_none();
let mut substate = Substate::new(); let mut substate = Substate::new(false);
let mut output = vec![]; let mut output = vec![];
// execute // execute
let (res, callcreates) = { let (res, callcreates) = {
let mut ex = TestExt::new(&mut state, let mut ex = TestExt::new(
&info, &mut state,
&engine, &info,
0, &engine,
OriginInfo::from(&params), 0,
&mut substate, OriginInfo::from(&params),
OutputPolicy::Return(BytesRef::Flexible(&mut output)), &mut substate,
params.address.clone()); OutputPolicy::Return(BytesRef::Flexible(&mut output)),
params.address.clone()
);
let evm = engine.vm_factory().create(); let evm = engine.vm_factory().create();
let res = evm.exec(params, &mut ex); let res = evm.exec(params, &mut ex);
(res, ex.callcreates) (res, ex.callcreates)

View File

@ -69,7 +69,7 @@ pub fn json_chain_test(json_data: &[u8], era: ChainEra) -> Vec<String> {
let mut state = state_result.reference_mut(); let mut state = state_result.reference_mut();
state.populate_from(pre); state.populate_from(pre);
state.commit(); state.commit();
let res = state.apply(&env, engine.deref(), &t); let res = state.apply(&env, engine.deref(), &t, false);
if fail_unless(state.root() == &post_state_root) { if fail_unless(state.root() == &post_state_root) {
println!("!!! {}: State mismatch (got: {}, expect: {}):", name, state.root(), post_state_root); println!("!!! {}: State mismatch (got: {}, expect: {}):", name, state.root(), post_state_root);
@ -80,9 +80,9 @@ pub fn json_chain_test(json_data: &[u8], era: ChainEra) -> Vec<String> {
} }
if let Ok(r) = res { if let Ok(r) = res {
if fail_unless(logs == r.logs) { if fail_unless(logs == r.receipt.logs) {
println!("!!! {}: Logs mismatch:", name); println!("!!! {}: Logs mismatch:", name);
println!("Got:\n{:?}", r.logs); println!("Got:\n{:?}", r.receipt.logs);
println!("Expect:\n{:?}", logs); println!("Expect:\n{:?}", logs);
} }
} }