From 716844ad7fa6fa5c0492ec86be04b4e6307f8ac9 Mon Sep 17 00:00:00 2001 From: dancoombs Date: Fri, 28 Jul 2023 11:05:26 -0500 Subject: [PATCH] feat(builder): remove fixed priority fee mode --- src/builder/bundle_proposer.rs | 2 +- src/cli/mod.rs | 4 ++-- src/common/gas.rs | 20 ++++---------------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/builder/bundle_proposer.rs b/src/builder/bundle_proposer.rs index 14f65730e..298c5c4e4 100644 --- a/src/builder/bundle_proposer.rs +++ b/src/builder/bundle_proposer.rs @@ -1204,7 +1204,7 @@ mod tests { max_bundle_size, beneficiary, use_bundle_priority_fee: Some(true), - priority_fee_mode: PriorityFeeMode::PriorityFeePercent(10), + priority_fee_mode: PriorityFeeMode::PriorityFeeIncreasePercent(10), bundle_priority_fee_overhead_percent: 0, }, event_sender, diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 6ca19b072..231dbe46b 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -168,8 +168,8 @@ pub struct CommonArgs { long = "priority_fee_mode_kind", name = "priority_fee_mode_kind", env = "PRIORITY_FEE_MODE_KIND", - value_parser = PossibleValuesParser::new(["fixed", "base_fee_percent", "priority_fee_percent"]), - default_value = "fixed" + value_parser = PossibleValuesParser::new(["base_fee_percent", "priority_fee_increase_percent"]), + default_value = "priority_fee_increase_percent" )] priority_fee_mode_kind: String, diff --git a/src/common/gas.rs b/src/common/gas.rs index 10c525980..c5c28e625 100644 --- a/src/common/gas.rs +++ b/src/common/gas.rs @@ -114,17 +114,15 @@ impl GasFees { #[derive(Debug, Clone, Copy)] pub enum PriorityFeeMode { - Fixed(u64), BaseFeePercent(u64), - PriorityFeePercent(u64), + PriorityFeeIncreasePercent(u64), } impl PriorityFeeMode { pub fn try_from(kind: &str, value: u64) -> anyhow::Result { match kind { - "fixed" => Ok(Self::Fixed(value)), "base_fee_percent" => Ok(Self::BaseFeePercent(value)), - "priority_fee_percent" => Ok(Self::PriorityFeePercent(value)), + "priority_fee_increase_percent" => Ok(Self::PriorityFeeIncreasePercent(value)), _ => anyhow::bail!("Invalid priority fee mode: {}", kind), } } @@ -133,19 +131,9 @@ impl PriorityFeeMode { let base_fee = bundle_fees.max_fee_per_gas - bundle_fees.max_priority_fee_per_gas; let max_priority_fee_per_gas = match *self { - PriorityFeeMode::Fixed(value) => { - bundle_fees.max_priority_fee_per_gas.max(U256::from(value)) - } PriorityFeeMode::BaseFeePercent(percent) => math::percent(base_fee, percent), - PriorityFeeMode::PriorityFeePercent(percent) => { - let ret = math::increase_by_percent(bundle_fees.max_priority_fee_per_gas, percent); - tracing::info!( - "bundle_fees {:?} max_priority_fee_per_gas {:?} percent {:?}", - bundle_fees, - ret, - percent - ); - ret + PriorityFeeMode::PriorityFeeIncreasePercent(percent) => { + math::increase_by_percent(bundle_fees.max_priority_fee_per_gas, percent) } };