diff --git a/bin/network-monitor/src/faucet.rs b/bin/network-monitor/src/faucet.rs index 4cca3907d..7431ae951 100644 --- a/bin/network-monitor/src/faucet.rs +++ b/bin/network-monitor/src/faucet.rs @@ -43,24 +43,16 @@ pub struct FaucetTestDetails { /// Response from the faucet's `/pow` endpoint. /// -/// `deny_unknown_fields` makes the monitor flag schema drift loudly — a new field on the faucet -/// response will fail deserialization and surface in the error message, instead of being -/// silently dropped. +/// Only the fields the monitor uses are declared. Other fields, including ones added by newer +/// faucet releases, are ignored. #[derive(Debug, Deserialize)] -#[serde(deny_unknown_fields)] struct PowChallengeResponse { challenge: String, target: u64, - #[expect( - dead_code, - reason = "Part of the API response, unused but required for `deny_unknown_fields`" - )] - timestamp: u64, } /// Response from the faucet's `/get_tokens` endpoint. #[derive(Debug, Deserialize)] -#[serde(deny_unknown_fields)] pub(crate) struct GetTokensResponse { /// The ID of the note that holds the minted tokens. #[serde(deserialize_with = "deserialize_note_id")] @@ -75,11 +67,9 @@ fn deserialize_note_id<'de, D: Deserializer<'de>>(deserializer: D) -> Result, pub pow_load_difficulty: u64, pub base_amount: u64, + /// The token amounts, in base units, that the faucet offers. + #[serde(default)] + pub token_amounts: Vec, /// The remaining balance of the funding account in base units. It is `None` when the funding /// service did not answer. pub balance: Option, @@ -317,9 +310,8 @@ async fn read_success_body(response: reqwest::Response) -> anyhow::Result(body: &str) -> anyhow::Result where T: for<'de> Deserialize<'de>, diff --git a/bin/network-monitor/src/view/mod.rs b/bin/network-monitor/src/view/mod.rs index 28b89794f..94d7eb5bd 100644 --- a/bin/network-monitor/src/view/mod.rs +++ b/bin/network-monitor/src/view/mod.rs @@ -407,6 +407,7 @@ mod tests { explorer_url: Some("https://explorer.example".to_string()), pow_load_difficulty: 4, base_amount: 100, + token_amounts: vec![100, 500], balance: Some(1_000_000), }), }; @@ -435,6 +436,7 @@ mod tests { explorer_url: None, pow_load_difficulty: 4, base_amount: 100, + token_amounts: vec![100, 500], balance: None, }), };