diff --git a/src/phoenix/demotion_monitor.rs b/src/phoenix/demotion_monitor.rs index 20c54a1..a1762a0 100644 --- a/src/phoenix/demotion_monitor.rs +++ b/src/phoenix/demotion_monitor.rs @@ -6,7 +6,7 @@ use tracing::{error, info}; use crate::{ env::{ToBeaconExplorerUrl, ToNetwork}, - phoenix::{markdown, promotion_monitor::ELIGIBLE_ERRORS}, + phoenix::markdown, }; use super::{ @@ -66,6 +66,14 @@ pub async fn get_builder_demotions( .map_err(Into::into) } +/// Demotion errors that shouldn't be broadcast on telegram +pub const SILENT_ERRORS: &[&str] = &[ + "HTTP status server error (500 Internal Server Error) for url (http://prio-load-balancer/)", + "Post \"http://prio-load-balancer:80\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", + "json error: request timeout hit before processing", + "simulation failed: unknown ancestor", +]; + pub async fn run_demotion_monitor(relay_pool: &PgPool, mev_pool: &PgPool) -> Result<()> { let checkpoint = match checkpoint::get_checkpoint(mev_pool, CheckpointId::Demotion).await? { Some(c) => c, @@ -86,7 +94,7 @@ pub async fn run_demotion_monitor(relay_pool: &PgPool, mev_pool: &PgPool) -> Res .into_iter() // reduce alert noise by filtering out duplicate demotions and auto-promotable ones .unique_by(|d| format!("{}{}{}", d.builder_pubkey, d.slot, d.sim_error)) - .filter(|d| !ELIGIBLE_ERRORS.contains(&d.sim_error.as_str())) + .filter(|d| !SILENT_ERRORS.contains(&d.sim_error.as_str())) .collect_vec(); if !demotions.is_empty() { diff --git a/src/phoenix/promotion_monitor.rs b/src/phoenix/promotion_monitor.rs index 5aeac36..d6d707e 100644 --- a/src/phoenix/promotion_monitor.rs +++ b/src/phoenix/promotion_monitor.rs @@ -76,13 +76,22 @@ fn format_builder_list(builders: &Vec<(String, String)>) -> String { }) } -pub const ELIGIBLE_ERRORS: &[&str] = &[ +/// Demotion errors eligible for re-promotion if no slot was missed +const PROMOTABLE_ERRORS: &[&str] = &[ "HTTP status server error (500 Internal Server Error) for url (http://prio-load-balancer/)", "Post \"http://prio-load-balancer:80\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)", "json error: request timeout hit before processing", "simulation failed: unknown ancestor", + "simulation failed: incorrect gas limit set" ]; +fn is_promotable_error(error: &str) -> bool { + PROMOTABLE_ERRORS + .iter() + // Use starts_with to account for additional info in gas limit error + .any(|promotable_error| error.starts_with(promotable_error)) +} + fn get_eligible_builders(demotions: Vec, missed_slots: Vec) -> Vec { debug!( "get_eligible_builders: demotions: {:?}, missed_slots {:?}", @@ -107,7 +116,7 @@ fn get_eligible_builders(demotions: Vec, missed_slots: Vec let no_missed_slots = demotions.iter().all(|d| !missed_slots.contains(&d.slot)); let only_eligible_errors = demotions .iter() - .all(|d| ELIGIBLE_ERRORS.contains(&d.sim_error.as_str())); + .all(|d| is_promotable_error(&d.sim_error.as_str())); if no_missed_slots && only_eligible_errors { Some(builder_id)