Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Avoid schedule copying in nested call/create #9190

Merged
merged 5 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ethcore/private-tx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ impl Provider where {
let (new_address, _) = ethcore_contract_address(engine.create_address_scheme(env_info.number), &sender, &nonce, &transaction.data);
Some(new_address)
});
let result = Executive::new(&mut state, &env_info, engine.machine()).transact_virtual(transaction, options)?;
let machine = engine.machine();
let schedule = machine.schedule(env_info.number);
let result = Executive::new(&mut state, &env_info, &machine, &schedule).transact_virtual(transaction, options)?;
let (encrypted_code, encrypted_storage) = match contract_address {
None => bail!(ErrorKind::ContractDoesNotExist),
Some(address) => {
Expand Down
11 changes: 8 additions & 3 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)?);
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 3 additions & 1 deletion ethcore/src/client/evm_test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading