Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pool): fix candidate gas price #884

Merged
merged 1 commit into from
Oct 23, 2024
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
2 changes: 1 addition & 1 deletion bin/rundler/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ impl TryFrom<&CommonArgs> for PrecheckSettings {
Ok(Self {
max_verification_gas: value.max_verification_gas as u128,
max_total_execution_gas: value.max_bundle_gas,
bundle_base_fee_overhead_percent: value.bundle_priority_fee_overhead_percent,
bundle_base_fee_overhead_percent: value.bundle_base_fee_overhead_percent,
bundle_priority_fee_overhead_percent: value.bundle_priority_fee_overhead_percent,
priority_fee_mode: PriorityFeeMode::try_from(
value.priority_fee_mode_kind.as_str(),
Expand Down
86 changes: 43 additions & 43 deletions crates/pool/src/mempool/uo_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,48 @@ where
.unmined_operations
.increment(unmined_op_count);

// update required bundle fees and update metrics
match self.pool_providers.prechecker().update_fees().await {
Ok((bundle_fees, base_fee)) => {
let max_fee = match format_units(bundle_fees.max_fee_per_gas, "gwei") {
Ok(s) => s.parse::<f64>().unwrap_or_default(),
Err(_) => 0.0,
};
self.metrics.current_max_fee_gwei.set(max_fee);

let max_priority_fee =
match format_units(bundle_fees.max_priority_fee_per_gas, "gwei") {
Ok(s) => s.parse::<f64>().unwrap_or_default(),
Err(_) => 0.0,
};
self.metrics
.current_max_priority_fee_gwei
.set(max_priority_fee);

let base_fee_f64 = match format_units(base_fee, "gwei") {
Ok(s) => s.parse::<f64>().unwrap_or_default(),
Err(_) => 0.0,
};
self.metrics.current_base_fee.set(base_fee_f64);

// cache for the next update
{
let mut state = self.state.write();
state.block_number = update.latest_block_number;
state.block_hash = update.latest_block_hash;
state.gas_fees = bundle_fees;
state.base_fee = base_fee;
}
}
Err(e) => {
tracing::error!("Failed to update fees: {:?}", e);
{
let mut state = self.state.write();
state.block_number = update.latest_block_number;
}
}
}

let da_block_data = if self.config.da_gas_tracking_enabled
&& self.ep_providers.da_gas_oracle_sync().is_some()
{
Expand Down Expand Up @@ -403,7 +445,7 @@ where
da_block_data.as_ref(),
gas_fees,
base_fee,
)
);
}
let maintenance_time = start.elapsed();
tracing::debug!(
Expand All @@ -413,48 +455,6 @@ where
self.ep_specific_metrics
.maintenance_time
.record(maintenance_time.as_micros() as f64);

// update required bundle fees and update metrics
match self.pool_providers.prechecker().update_fees().await {
Ok((bundle_fees, base_fee)) => {
let max_fee = match format_units(bundle_fees.max_fee_per_gas, "gwei") {
Ok(s) => s.parse::<f64>().unwrap_or_default(),
Err(_) => 0.0,
};
self.metrics.current_max_fee_gwei.set(max_fee);

let max_priority_fee =
match format_units(bundle_fees.max_priority_fee_per_gas, "gwei") {
Ok(s) => s.parse::<f64>().unwrap_or_default(),
Err(_) => 0.0,
};
self.metrics
.current_max_priority_fee_gwei
.set(max_priority_fee);

let base_fee_f64 = match format_units(base_fee, "gwei") {
Ok(s) => s.parse::<f64>().unwrap_or_default(),
Err(_) => 0.0,
};
self.metrics.current_base_fee.set(base_fee_f64);

// cache for the next update
{
let mut state = self.state.write();
state.block_number = update.latest_block_number;
state.block_hash = update.latest_block_hash;
state.gas_fees = bundle_fees;
state.base_fee = base_fee;
}
}
Err(e) => {
tracing::error!("Failed to update fees: {:?}", e);
{
let mut state = self.state.write();
state.block_number = update.latest_block_number;
}
}
}
}

fn entry_point(&self) -> Address {
Expand Down
Loading