Avoid schedule copying in nested call/create (#9190)

* Avoid schedule copying in nested call/create

* Fix tests

* fix test: wrong Schedule used

* Fix private-tx test

* Fix jsontests compilation
This commit is contained in:
Wei Tang
2018-07-23 21:48:01 +08:00
committed by Tomasz Drwięga
parent d4f38d3894
commit 4848c384cd
12 changed files with 117 additions and 67 deletions

View File

@@ -373,8 +373,11 @@ fn transaction_proof() {
factories.accountdb = ::account_db::Factory::Plain; // raw state values, no mangled keys.
let root = *client.best_block_header().state_root();
let machine = test_spec.engine.machine();
let env_info = client.latest_env_info();
let schedule = machine.schedule(env_info.number);
let mut state = State::from_existing(backend, root, 0.into(), factories.clone()).unwrap();
Executive::new(&mut state, &client.latest_env_info(), test_spec.engine.machine())
Executive::new(&mut state, &env_info, &machine, &schedule)
.transact(&transaction, TransactOptions::with_no_tracing().dont_check_nonce()).unwrap();
assert_eq!(state.balance(&Address::default()).unwrap(), 5.into());

View File

@@ -62,7 +62,8 @@ fn test_blockhash_eip210(factory: Factory) {
call_type: CallType::Call,
params_type: ParamsType::Separate,
};
let mut ex = Executive::new(&mut state, &env_info, &machine);
let schedule = machine.schedule(env_info.number);
let mut ex = Executive::new(&mut state, &env_info, &machine, &schedule);
let mut substate = Substate::new();
let mut output = [];
if let Err(e) = ex.call(params, &mut substate, BytesRef::Fixed(&mut output), &mut NoopTracer, &mut NoopVMTracer) {
@@ -85,7 +86,8 @@ fn test_blockhash_eip210(factory: Factory) {
call_type: CallType::Call,
params_type: ParamsType::Separate,
};
let mut ex = Executive::new(&mut state, &env_info, &machine);
let schedule = machine.schedule(env_info.number);
let mut ex = Executive::new(&mut state, &env_info, &machine, &schedule);
let mut substate = Substate::new();
let mut output = H256::new();
if let Err(e) = ex.call(params, &mut substate, BytesRef::Fixed(&mut output), &mut NoopTracer, &mut NoopVMTracer) {