From 10ca5b9757a1731f71fe1dc5d49dcb7c2380ab9a Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Tue, 30 Sep 2025 06:40:19 -0400 Subject: [PATCH] Manually insert the authority discovery key into the keystore I did try pulling in `pallet-authority-discovery` for this, updating `SessionKeys`, but that was insufficient for whatever reason. --- substrate/client/src/serai/mod.rs | 2 +- substrate/node/src/rpc.rs | 2 +- substrate/node/src/service.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/substrate/client/src/serai/mod.rs b/substrate/client/src/serai/mod.rs index f1451305..afe34397 100644 --- a/substrate/client/src/serai/mod.rs +++ b/substrate/client/src/serai/mod.rs @@ -315,7 +315,7 @@ impl Serai { &self, network: NetworkId, ) -> Result, SeraiError> { - self.call("p2p_validators", network).await + self.call("p2p_validators", [network]).await } } diff --git a/substrate/node/src/rpc.rs b/substrate/node/src/rpc.rs index d53a3c33..1bd047f9 100644 --- a/substrate/node/src/rpc.rs +++ b/substrate/node/src/rpc.rs @@ -59,7 +59,7 @@ where authority_discovery_module.register_async_method( "p2p_validators", |params, context, _ext| async move { - let network: NetworkId = params.parse()?; + let [network]: [NetworkId; 1] = params.parse()?; let (id, client, authority_discovery) = &*context; let latest_block = client.info().best_hash; diff --git a/substrate/node/src/service.rs b/substrate/node/src/service.rs index ec794869..33c89522 100644 --- a/substrate/node/src/service.rs +++ b/substrate/node/src/service.rs @@ -287,6 +287,9 @@ pub fn new_full(mut config: Configuration) -> Result let role = config.role; let keystore = keystore_container; + if let Some(seed) = config.dev_key_seed.as_ref() { + let _ = keystore.sr25519_generate_new(sp_core::crypto::key_types::AUTHORITY_DISCOVERY, Some(seed)); + } let prometheus_registry = config.prometheus_registry().cloned(); // TODO: Ensure we're considered as an authority is a validator of an external network