Expose default gas price percentile configuration in CLI (#7497)
* Expose gas price percentile. * Fix light eth_call. * fix gas_price in light client
This commit is contained in:
committed by
Marek Kotewicz
parent
1e8533acbc
commit
69d7c4f519
@@ -346,6 +346,7 @@ usage! {
|
||||
ARG arg_password: (Vec<String>) = Vec::new(), or |c: &Config| otry!(c.account).password.clone(),
|
||||
"--password=[FILE]...",
|
||||
"Provide a file containing a password for unlocking an account. Leading and trailing whitespace is trimmed.",
|
||||
|
||||
["UI options"]
|
||||
FLAG flag_force_ui: (bool) = false, or |c: &Config| otry!(c.ui).force.clone(),
|
||||
"--force-ui",
|
||||
@@ -696,6 +697,10 @@ usage! {
|
||||
"--min-gas-price=[STRING]",
|
||||
"Minimum amount of Wei per GAS to be paid for a transaction to be accepted for mining. Overrides --usd-per-tx.",
|
||||
|
||||
ARG arg_gas_price_percentile: (usize) = 50usize, or |c: &Config| otry!(c.mining).gas_price_percentile,
|
||||
"--gas-price-percentile=[PCT]",
|
||||
"Set PCT percentile gas price value from last 100 blocks as default gas price when sending transactions.",
|
||||
|
||||
ARG arg_author: (Option<String>) = None, or |c: &Config| otry!(c.mining).author.clone(),
|
||||
"--author=[ADDRESS]",
|
||||
"Specify the block author (aka \"coinbase\") address for sending block rewards from sealed blocks. NOTE: MINING WILL NOT WORK WITHOUT THIS OPTION.", // Sealing/Mining Option
|
||||
@@ -1142,6 +1147,7 @@ struct Mining {
|
||||
tx_time_limit: Option<u64>,
|
||||
relay_set: Option<String>,
|
||||
min_gas_price: Option<u64>,
|
||||
gas_price_percentile: Option<usize>,
|
||||
usd_per_tx: Option<String>,
|
||||
usd_per_eth: Option<String>,
|
||||
price_update_period: Option<String>,
|
||||
@@ -1546,6 +1552,7 @@ mod tests {
|
||||
arg_tx_time_limit: Some(100u64),
|
||||
arg_relay_set: "cheap".into(),
|
||||
arg_min_gas_price: Some(0u64),
|
||||
arg_gas_price_percentile: 50usize,
|
||||
arg_usd_per_tx: "0.0025".into(),
|
||||
arg_usd_per_eth: "auto".into(),
|
||||
arg_price_update_period: "hourly".into(),
|
||||
@@ -1794,6 +1801,7 @@ mod tests {
|
||||
work_queue_size: None,
|
||||
relay_set: None,
|
||||
min_gas_price: None,
|
||||
gas_price_percentile: None,
|
||||
usd_per_tx: None,
|
||||
usd_per_eth: None,
|
||||
price_update_period: Some("hourly".into()),
|
||||
|
||||
@@ -339,6 +339,7 @@ impl Configuration {
|
||||
daemon: daemon,
|
||||
logger_config: logger_config.clone(),
|
||||
miner_options: self.miner_options()?,
|
||||
gas_price_percentile: self.args.arg_gas_price_percentile,
|
||||
ntp_servers: self.ntp_servers(),
|
||||
ws_conf: ws_conf,
|
||||
http_conf: http_conf,
|
||||
@@ -1357,6 +1358,7 @@ mod tests {
|
||||
daemon: None,
|
||||
logger_config: Default::default(),
|
||||
miner_options: Default::default(),
|
||||
gas_price_percentile: 50,
|
||||
ntp_servers: vec![
|
||||
"0.parity.pool.ntp.org:123".into(),
|
||||
"1.parity.pool.ntp.org:123".into(),
|
||||
|
||||
@@ -226,6 +226,7 @@ pub struct FullDependencies {
|
||||
pub fetch: FetchClient,
|
||||
pub remote: parity_reactor::Remote,
|
||||
pub whisper_rpc: Option<::whisper::RpcFactory>,
|
||||
pub gas_price_percentile: usize,
|
||||
}
|
||||
|
||||
impl FullDependencies {
|
||||
@@ -241,7 +242,7 @@ impl FullDependencies {
|
||||
($namespace:ident, $handler:expr, $deps:expr, $nonces:expr) => {
|
||||
{
|
||||
let deps = &$deps;
|
||||
let dispatcher = FullDispatcher::new(deps.client.clone(), deps.miner.clone(), $nonces);
|
||||
let dispatcher = FullDispatcher::new(deps.client.clone(), deps.miner.clone(), $nonces, deps.gas_price_percentile);
|
||||
if deps.signer_service.is_enabled() {
|
||||
$handler.extend_with($namespace::to_delegate(SigningQueueClient::new(&deps.signer_service, dispatcher, deps.remote.clone(), &deps.secret_store)))
|
||||
} else {
|
||||
@@ -256,6 +257,7 @@ impl FullDependencies {
|
||||
self.client.clone(),
|
||||
self.miner.clone(),
|
||||
nonces.clone(),
|
||||
self.gas_price_percentile,
|
||||
);
|
||||
for api in apis {
|
||||
match *api {
|
||||
@@ -277,6 +279,7 @@ impl FullDependencies {
|
||||
pending_nonce_from_queue: self.geth_compatibility,
|
||||
allow_pending_receipt_query: !self.geth_compatibility,
|
||||
send_block_number_in_get_work: !self.geth_compatibility,
|
||||
gas_price_percentile: self.gas_price_percentile,
|
||||
}
|
||||
);
|
||||
handler.extend_with(client.to_delegate());
|
||||
@@ -422,6 +425,7 @@ pub struct LightDependencies<T> {
|
||||
pub geth_compatibility: bool,
|
||||
pub remote: parity_reactor::Remote,
|
||||
pub whisper_rpc: Option<::whisper::RpcFactory>,
|
||||
pub gas_price_percentile: usize,
|
||||
}
|
||||
|
||||
impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
@@ -440,6 +444,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
self.cache.clone(),
|
||||
self.transaction_queue.clone(),
|
||||
Arc::new(Mutex::new(dispatch::Reservations::with_pool(self.fetch.pool()))),
|
||||
self.gas_price_percentile,
|
||||
);
|
||||
|
||||
macro_rules! add_signing_methods {
|
||||
@@ -477,6 +482,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
self.transaction_queue.clone(),
|
||||
self.secret_store.clone(),
|
||||
self.cache.clone(),
|
||||
self.gas_price_percentile,
|
||||
);
|
||||
handler.extend_with(Eth::to_delegate(client.clone()));
|
||||
|
||||
@@ -492,6 +498,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
self.sync.clone(),
|
||||
self.cache.clone(),
|
||||
self.remote.clone(),
|
||||
self.gas_price_percentile,
|
||||
);
|
||||
self.client.add_listener(
|
||||
Arc::downgrade(&client.handler()) as Weak<::light::client::LightChainNotify>
|
||||
@@ -521,6 +528,7 @@ impl<C: LightChainClient + 'static> LightDependencies<C> {
|
||||
signer,
|
||||
self.dapps_address.clone(),
|
||||
self.ws_address.clone(),
|
||||
self.gas_price_percentile,
|
||||
).to_delegate());
|
||||
|
||||
if !for_generic_pubsub {
|
||||
|
||||
@@ -87,6 +87,7 @@ pub struct RunCmd {
|
||||
pub daemon: Option<String>,
|
||||
pub logger_config: LogConfig,
|
||||
pub miner_options: MinerOptions,
|
||||
pub gas_price_percentile: usize,
|
||||
pub ntp_servers: Vec<String>,
|
||||
pub ws_conf: rpc::WsConfiguration,
|
||||
pub http_conf: rpc::HttpConfiguration,
|
||||
@@ -358,6 +359,7 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
geth_compatibility: cmd.geth_compatibility,
|
||||
remote: event_loop.remote(),
|
||||
whisper_rpc: whisper_factory,
|
||||
gas_price_percentile: cmd.gas_price_percentile,
|
||||
});
|
||||
|
||||
let dependencies = rpc::Dependencies {
|
||||
@@ -761,6 +763,7 @@ pub fn execute(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) -> R
|
||||
fetch: fetch.clone(),
|
||||
remote: event_loop.remote(),
|
||||
whisper_rpc: whisper_factory,
|
||||
gas_price_percentile: cmd.gas_price_percentile,
|
||||
});
|
||||
|
||||
let dependencies = rpc::Dependencies {
|
||||
|
||||
Reference in New Issue
Block a user