Skip to content

Commit

Permalink
backwards compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanCorDX committed Jan 24, 2025
1 parent 5e510c1 commit 958f5d0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/rbuilder/src/primitives/mev_boost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ pub type MevBoostRelayID = String;
pub enum RelayMode {
/// Submits bids, gets slot info. No extra headers on bidding.
#[serde(rename = "full")]
#[default]
Full,
/// Only gets slot info.
#[serde(rename = "slot_info")]
#[default]
GetSlotInfoOnly,
/// Submits bids with extra headers. Does not used to get slot info.
#[serde(rename = "test")]
Expand Down Expand Up @@ -52,6 +52,7 @@ pub struct RelayConfig {
#[serde(default, deserialize_with = "deserialize_env_var")]
pub api_token_header: Option<String>,
/// mode defines the need of submit_config/priority
#[serde(default)]
pub mode: RelayMode,
#[serde(flatten)]
/// Submit specific info.
Expand Down Expand Up @@ -245,4 +246,14 @@ mod test {
let config: RelayConfig = toml::from_str(&(example_base.clone() + "'test'")).unwrap();
assert_eq!(config.mode, RelayMode::Test);
}

#[test]
fn test_deserialize_relay_config_no_mode() {
let config = "
name = 'relay1'
url = 'url'";

let config: RelayConfig = toml::from_str(config).unwrap();
assert_eq!(config.mode, RelayMode::Full);
}
}

0 comments on commit 958f5d0

Please sign in to comment.