Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit e93e1fc

Browse files
Zygimantassmattsse
andauthored
feat(gpo): add default fee price argument (paradigmxyz#18297)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
1 parent d684535 commit e93e1fc

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

crates/node/core/src/args/gas_price_oracle.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,22 @@ pub struct GasPriceOracleArgs {
2525
/// The percentile of gas prices to use for the estimate
2626
#[arg(long = "gpo.percentile", default_value_t = DEFAULT_GAS_PRICE_PERCENTILE)]
2727
pub percentile: u32,
28+
29+
/// The default gas price to use if there are no blocks to use
30+
#[arg(long = "gpo.default-suggested-fee")]
31+
pub default_suggested_fee: Option<U256>,
2832
}
2933

3034
impl GasPriceOracleArgs {
3135
/// Returns a [`GasPriceOracleConfig`] from the arguments.
3236
pub fn gas_price_oracle_config(&self) -> GasPriceOracleConfig {
33-
let Self { blocks, ignore_price, max_price, percentile } = self;
37+
let Self { blocks, ignore_price, max_price, percentile, default_suggested_fee } = self;
3438
GasPriceOracleConfig {
3539
max_price: Some(U256::from(*max_price)),
3640
ignore_price: Some(U256::from(*ignore_price)),
3741
percentile: *percentile,
3842
blocks: *blocks,
43+
default_suggested_fee: *default_suggested_fee,
3944
..Default::default()
4045
}
4146
}
@@ -48,6 +53,7 @@ impl Default for GasPriceOracleArgs {
4853
ignore_price: DEFAULT_IGNORE_GAS_PRICE.to(),
4954
max_price: DEFAULT_MAX_GAS_PRICE.to(),
5055
percentile: DEFAULT_GAS_PRICE_PERCENTILE,
56+
default_suggested_fee: None,
5157
}
5258
}
5359
}
@@ -73,6 +79,7 @@ mod tests {
7379
ignore_price: DEFAULT_IGNORE_GAS_PRICE.to(),
7480
max_price: DEFAULT_MAX_GAS_PRICE.to(),
7581
percentile: DEFAULT_GAS_PRICE_PERCENTILE,
82+
default_suggested_fee: None,
7683
}
7784
);
7885
}

crates/rpc/rpc-eth-types/src/gas_oracle.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub struct GasPriceOracleConfig {
4949
pub max_reward_percentile_count: u64,
5050

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

5454
/// The maximum gas price to use for the estimate
5555
pub max_price: Option<U256>,
@@ -66,7 +66,7 @@ impl Default for GasPriceOracleConfig {
6666
max_header_history: MAX_HEADER_HISTORY,
6767
max_block_history: MAX_HEADER_HISTORY,
6868
max_reward_percentile_count: MAX_REWARD_PERCENTILE_COUNT,
69-
default: None,
69+
default_suggested_fee: None,
7070
max_price: Some(DEFAULT_MAX_GAS_PRICE),
7171
ignore_price: Some(DEFAULT_IGNORE_GAS_PRICE),
7272
}
@@ -112,7 +112,12 @@ where
112112
// this is the number of blocks that we will cache the values for
113113
let cached_values = (oracle_config.blocks * 5).max(oracle_config.max_block_history as u32);
114114
let inner = Mutex::new(GasPriceOracleInner {
115-
last_price: Default::default(),
115+
last_price: GasPriceOracleResult {
116+
block_hash: B256::ZERO,
117+
price: oracle_config
118+
.default_suggested_fee
119+
.unwrap_or_else(|| GasPriceOracleResult::default().price),
120+
},
116121
lowest_effective_tip_cache: EffectiveTipLruCache(LruMap::new(ByLength::new(
117122
cached_values,
118123
))),

docs/vocs/docs/pages/cli/reth/node.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ Gas Price Oracle:
462462
463463
[default: 60]
464464
465+
--gpo.default-suggested-fee <DEFAULT_SUGGESTED_FEE>
466+
The default gas price to use if there are no blocks to use
467+
465468
TxPool:
466469
--txpool.pending-max-count <PENDING_MAX_COUNT>
467470
Max number of transaction in the pending sub-pool

0 commit comments

Comments
 (0)