Skip to content

Commit

Permalink
fix: use geo enum for sql queries
Browse files Browse the repository at this point in the history
  • Loading branch information
blombern committed Sep 4, 2024
1 parent 379fd80 commit 95b317c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/phoenix/demotion_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ use crate::{

use super::{
checkpoint::{self, CheckpointId},
env::APP_CONFIG,
env::{Geo, APP_CONFIG},
};

#[derive(Debug, Clone)]
pub struct BuilderDemotion {
pub geo: String,
pub geo: Geo,
pub builder_pubkey: String,
pub builder_id: Option<String>,
pub slot: i64,
Expand Down
4 changes: 4 additions & 0 deletions src/phoenix/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ fn default_missed_slots_alert_threshold() -> i64 {

/// Auction geography
#[allow(clippy::upper_case_acronyms)]
#[derive(Debug, Clone, sqlx::Type)]
#[sqlx(type_name = "geo")]
pub enum Geo {
#[sqlx(rename = "rbx")]
RBX,
#[sqlx(rename = "vin")]
VIN,
}

Expand Down
4 changes: 2 additions & 2 deletions src/phoenix/inclusion_monitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use super::{
SendAlert,
},
checkpoint::{self, CheckpointId},
env::APP_CONFIG,
env::{Geo, APP_CONFIG},
};

#[derive(Debug)]
Expand All @@ -40,7 +40,7 @@ struct DeliveredPayload {
inserted_at: DateTime<Utc>,
proposer_pubkey: String,
slot: i64,
geo: String,
geo: Geo,
}

async fn get_delivered_payloads(
Expand Down

0 comments on commit 95b317c

Please sign in to comment.