diff --git a/config.example.toml b/config.example.toml index bb217b35..7c6b0b13 100644 --- a/config.example.toml +++ b/config.example.toml @@ -120,6 +120,13 @@ validator_pubkeys = [ # - SSV: SSV API # OPTIONAL loader = "./tests/data/mux_keys.example.json" +# URL to HTTP endpoint returning JSON list of validator pubkeys +# Example response: +# [ +# "0x80c7f782b2467c5898c5516a8b6595d75623960b4afc4f71ee07d40985d20e117ba35e7cd352a3e75fb85a8668a3b745", +# "0xa119589bb33ef52acbb8116832bec2b58fca590fe5c85eac5d3230b44d5bc09fe73ccd21f88eab31d6de16194d17782e" +#] +# loader = { url = "http://localhost:8000/keys" } # loader = { registry = "lido", node_operator_id = 8 } # loader = { registry = "ssv", node_operator_id = 8 } timeout_get_header_ms = 900 diff --git a/crates/common/src/config/mux.rs b/crates/common/src/config/mux.rs index 32ff8e97..ef0f1125 100644 --- a/crates/common/src/config/mux.rs +++ b/crates/common/src/config/mux.rs @@ -129,6 +129,7 @@ impl MuxConfig { Some((get_mux_env(&self.id), path.to_owned(), internal_path)) } + MuxKeysLoader::HTTP { .. } => None, MuxKeysLoader::Registry { .. } => None, }) } @@ -139,6 +140,9 @@ impl MuxConfig { pub enum MuxKeysLoader { /// A file containing a list of validator pubkeys File(PathBuf), + HTTP { + url: String, + }, Registry { registry: NORegistry, node_operator_id: u64, @@ -170,6 +174,14 @@ impl MuxKeysLoader { serde_json::from_str(&file).wrap_err("failed to parse mux keys file") } + Self::HTTP { url } => { + let client = reqwest::Client::new(); + let response = client.get(url).send().await?; + let pubkeys = response.text().await?; + serde_json::from_str(&pubkeys) + .wrap_err("failed to fetch mux keys from http endpoint") + } + Self::Registry { registry, node_operator_id } => match registry { NORegistry::Lido => { let Some(rpc_url) = rpc_url else {