diff --git a/miner/src/lib.rs b/miner/src/lib.rs index 27f914181..9ba2cdc1c 100644 --- a/miner/src/lib.rs +++ b/miner/src/lib.rs @@ -132,8 +132,11 @@ pub trait MinerService : Send + Sync { /// Returns highest transaction nonce for given address. fn last_nonce(&self, address: &Address) -> Option; - /// Suggested gas price + /// Suggested gas price. fn sensible_gas_price(&self) -> U256 { x!(20000000000u64) } + + /// Suggested gas limit. + fn sensible_gas_limit(&self) -> U256 { x!(21000) } } /// Mining status diff --git a/miner/src/miner.rs b/miner/src/miner.rs index 7f7dc2980..5169be2c5 100644 --- a/miner/src/miner.rs +++ b/miner/src/miner.rs @@ -201,6 +201,10 @@ impl MinerService for Miner { *self.transaction_queue.lock().unwrap().minimal_gas_price() * x!(110) / x!(100) } + fn sensible_gas_limit(&self) -> U256 { + *self.gas_floor_target.read().unwrap() / x!(5) + } + /// Get the author that we will seal blocks as. fn author(&self) -> Address { *self.author.read().unwrap() diff --git a/parity/main.rs b/parity/main.rs index 8c4a9ddf0..bbf7e27a9 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -622,9 +622,9 @@ impl Configuration { let mut secret_store = SecretStore::new_in(Path::new(&self.keys_path())); if self.args.cmd_new { println!("Please note that password is NOT RECOVERABLE."); - println!("Type password: "); + print!("Type password: "); let password = read_password().unwrap(); - println!("Repeat password: "); + print!("Repeat password: "); let password_repeat = read_password().unwrap(); if password != password_repeat { println!("Passwords do not match!"); diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index c885407cc..5a7f93e17 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -40,14 +40,6 @@ use v1::helpers::{PollFilter, PollManager, ExternalMinerService, ExternalMiner}; use util::keys::store::AccountProvider; use serde; -fn default_gas() -> U256 { - U256::from(21_000) -} - -fn default_call_gas() -> U256 { - U256::from(50_000_000) -} - /// Eth rpc implementation. pub struct EthClient where C: BlockChainClient, @@ -180,7 +172,7 @@ impl EthClient Ok(EthTransaction { nonce: request.nonce.unwrap_or_else(|| client.nonce(&from)), action: request.to.map_or(Action::Create, Action::Call), - gas: request.gas.unwrap_or_else(default_call_gas), + gas: request.gas.unwrap_or(U256::from(50_000_000)), gas_price: request.gas_price.unwrap_or_else(|| miner.sensible_gas_price()), value: request.value.unwrap_or_else(U256::zero), data: request.data.map_or_else(Vec::new, |d| d.to_vec()) @@ -498,7 +490,7 @@ impl Eth for EthClient .map(|nonce| nonce + U256::one())) .unwrap_or_else(|| client.nonce(&request.from)), action: request.to.map_or(Action::Create, Action::Call), - gas: request.gas.unwrap_or_else(default_gas), + gas: request.gas.unwrap_or_else(|| miner.sensible_gas_limit()), gas_price: request.gas_price.unwrap_or_else(|| miner.sensible_gas_price()), value: request.value.unwrap_or_else(U256::zero), data: request.data.map_or_else(Vec::new, |d| d.to_vec()), @@ -524,6 +516,7 @@ impl Eth for EthClient } fn call(&self, params: Params) -> Result { + trace!(target: "jsonrpc", "call: {:?}", params); from_params_discard_second(params).and_then(|(request, )| { let signed = try!(self.sign_call(request)); let client = take_weak!(self.client);