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

@@ -616,7 +616,9 @@ impl Importer {
).expect("state known to be available for just-imported block; qed");
let options = TransactOptions::with_no_tracing().dont_check_nonce();
let res = Executive::new(&mut state, &env_info, self.engine.machine())
let machine = self.engine.machine();
let schedule = machine.schedule(env_info.number);
let res = Executive::new(&mut state, &env_info, &machine, &schedule)
.transact(&transaction, options);
let res = match res {
@@ -1232,8 +1234,9 @@ impl Client {
.dont_check_nonce()
.save_output_from_contract();
let original_state = if state_diff { Some(state.clone()) } else { None };
let schedule = machine.schedule(env_info.number);
let mut ret = Executive::new(state, env_info, machine).transact_virtual(transaction, options)?;
let mut ret = Executive::new(state, env_info, &machine, &schedule).transact_virtual(transaction, options)?;
if let Some(original) = original_state {
ret.state_diff = Some(state.diff_from(original).map_err(ExecutionError::from)?);
@@ -1486,7 +1489,9 @@ impl Call for Client {
let tx = tx.fake_sign(sender);
let mut clone = state.clone();
Ok(Executive::new(&mut clone, &env_info, self.engine.machine())
let machine = self.engine.machine();
let schedule = machine.schedule(env_info.number);
Ok(Executive::new(&mut clone, &env_info, &machine, &schedule)
.transact_virtual(&tx, options())
.map(|r| r.exception.is_none())
.unwrap_or(false))

View File

@@ -184,7 +184,9 @@ impl<'a> EvmTestClient<'a> {
};
let mut substate = state::Substate::new();
let mut output = vec![];
let mut executive = executive::Executive::new(&mut self.state, &info, self.spec.engine.machine());
let machine = self.spec.engine.machine();
let schedule = machine.schedule(info.number);
let mut executive = executive::Executive::new(&mut self.state, &info, &machine, &schedule);
executive.call(
params,
&mut substate,