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

Commit

Permalink
remove From::from. (#8390)
Browse files Browse the repository at this point in the history
* Some tiny modifications.
1. fix some typo in the comment.
2. sort the order of methods in 'impl state::Backend for StateDB`

* Remove the clone of code_cache, as it has been done in clone_basic.

* remove From::from. It seems not necessary.
  • Loading branch information
EighteenZi authored and debris committed Apr 19, 2018
1 parent 14361cc commit 8fb47b5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ethcore/src/executive.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -237,27 +237,27 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
let base_gas_required = U256::from(t.gas_required(&schedule));

if t.gas < base_gas_required {
return Err(From::from(ExecutionError::NotEnoughBaseGas { required: base_gas_required, got: t.gas }));
return Err(ExecutionError::NotEnoughBaseGas { required: base_gas_required, got: t.gas });
}

if !t.is_unsigned() && check_nonce && schedule.kill_dust != CleanDustMode::Off && !self.state.exists(&sender)? {
return Err(From::from(ExecutionError::SenderMustExist));
return Err(ExecutionError::SenderMustExist);
}

let init_gas = t.gas - base_gas_required;

// validate transaction nonce
if check_nonce && t.nonce != nonce {
return Err(From::from(ExecutionError::InvalidNonce { expected: nonce, got: t.nonce }));
return Err(ExecutionError::InvalidNonce { expected: nonce, got: t.nonce });
}

// validate if transaction fits into given block
if self.info.gas_used + t.gas > self.info.gas_limit {
return Err(From::from(ExecutionError::BlockGasLimitReached {
return Err(ExecutionError::BlockGasLimitReached {
gas_limit: self.info.gas_limit,
gas_used: self.info.gas_used,
gas: t.gas
}));
});
}

// TODO: we might need bigints here, or at least check overflows.
Expand All @@ -268,7 +268,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
// avoid unaffordable transactions
let balance512 = U512::from(balance);
if balance512 < total_cost {
return Err(From::from(ExecutionError::NotEnoughCash { required: total_cost, got: balance512 }));
return Err(ExecutionError::NotEnoughCash { required: total_cost, got: balance512 });
}

let mut substate = Substate::new();
Expand Down

0 comments on commit 8fb47b5

Please sign in to comment.