[beta] Increase default gas limit for eth_call (#6337)

* Increase default gas limit for eth_call.

* Fix balance increase.

* Cap gas limit for dapp-originating requests.
This commit is contained in:
Arkadiy Paronyan
2017-08-20 08:14:32 +02:00
committed by Gav Wood
parent 4992064663
commit 7bf840f80a
10 changed files with 56 additions and 24 deletions

View File

@@ -155,7 +155,7 @@ impl<'a, B: 'a + StateBackend, E: Engine + ?Sized> Executive<'a, B, E> {
pub fn transact_virtual(&'a mut self, t: &SignedTransaction, options: TransactOptions) -> Result<Executed, ExecutionError> {
let sender = t.sender();
let balance = self.state.balance(&sender)?;
let needed_balance = t.value + t.gas * t.gas_price;
let needed_balance = t.value.saturating_add(t.gas.saturating_mul(t.gas_price));
if balance < needed_balance {
// give the sender a sufficient balance
self.state.add_balance(&sender, &(needed_balance - balance), CleanupMode::NoEmpty)?;