Skip to content
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
9 changes: 8 additions & 1 deletion crates/node/core/src/args/gas_price_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,22 @@ pub struct GasPriceOracleArgs {
/// The percentile of gas prices to use for the estimate
#[arg(long = "gpo.percentile", default_value_t = DEFAULT_GAS_PRICE_PERCENTILE)]
pub percentile: u32,

/// The default gas price to use if there are no blocks to use
#[arg(long = "gpo.default-suggested-fee")]
pub default_suggested_fee: Option<U256>,
}

impl GasPriceOracleArgs {
/// Returns a [`GasPriceOracleConfig`] from the arguments.
pub fn gas_price_oracle_config(&self) -> GasPriceOracleConfig {
let Self { blocks, ignore_price, max_price, percentile } = self;
let Self { blocks, ignore_price, max_price, percentile, default_suggested_fee } = self;
GasPriceOracleConfig {
max_price: Some(U256::from(*max_price)),
ignore_price: Some(U256::from(*ignore_price)),
percentile: *percentile,
blocks: *blocks,
default_suggested_fee: *default_suggested_fee,
..Default::default()
}
}
Expand All @@ -48,6 +53,7 @@ impl Default for GasPriceOracleArgs {
ignore_price: DEFAULT_IGNORE_GAS_PRICE.to(),
max_price: DEFAULT_MAX_GAS_PRICE.to(),
percentile: DEFAULT_GAS_PRICE_PERCENTILE,
default_suggested_fee: None,
}
}
}
Expand All @@ -73,6 +79,7 @@ mod tests {
ignore_price: DEFAULT_IGNORE_GAS_PRICE.to(),
max_price: DEFAULT_MAX_GAS_PRICE.to(),
percentile: DEFAULT_GAS_PRICE_PERCENTILE,
default_suggested_fee: None,
}
);
}
Expand Down
11 changes: 8 additions & 3 deletions crates/rpc/rpc-eth-types/src/gas_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct GasPriceOracleConfig {
pub max_reward_percentile_count: u64,

/// The default gas price to use if there are no blocks to use
pub default: Option<U256>,
pub default_suggested_fee: Option<U256>,

/// The maximum gas price to use for the estimate
pub max_price: Option<U256>,
Expand All @@ -66,7 +66,7 @@ impl Default for GasPriceOracleConfig {
max_header_history: MAX_HEADER_HISTORY,
max_block_history: MAX_HEADER_HISTORY,
max_reward_percentile_count: MAX_REWARD_PERCENTILE_COUNT,
default: None,
default_suggested_fee: None,
max_price: Some(DEFAULT_MAX_GAS_PRICE),
ignore_price: Some(DEFAULT_IGNORE_GAS_PRICE),
}
Expand Down Expand Up @@ -112,7 +112,12 @@ where
// this is the number of blocks that we will cache the values for
let cached_values = (oracle_config.blocks * 5).max(oracle_config.max_block_history as u32);
let inner = Mutex::new(GasPriceOracleInner {
last_price: Default::default(),
last_price: GasPriceOracleResult {
block_hash: B256::ZERO,
price: oracle_config
.default_suggested_fee
.unwrap_or_else(|| GasPriceOracleResult::default().price),
},
lowest_effective_tip_cache: EffectiveTipLruCache(LruMap::new(ByLength::new(
cached_values,
))),
Expand Down
3 changes: 3 additions & 0 deletions docs/vocs/docs/pages/cli/reth/node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ Gas Price Oracle:

[default: 60]

--gpo.default-suggested-fee <DEFAULT_SUGGESTED_FEE>
The default gas price to use if there are no blocks to use

TxPool:
--txpool.pending-max-count <PENDING_MAX_COUNT>
Max number of transaction in the pending sub-pool
Expand Down