diff --git a/client/src/lib.rs b/client/src/lib.rs index a335b11c48..2dabb6aee2 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -218,8 +218,8 @@ pub struct SubxtClientConfig { pub chain_spec: C, /// Role of the node. pub role: Role, - /// Enable telemetry. - pub enable_telemetry: bool, + /// Enable telemetry on the given port. + pub telemetry: Option, } impl SubxtClientConfig { @@ -238,10 +238,12 @@ impl SubxtClientConfig { wasm_external_transport: None, use_yamux_flow_control: true, }; - let telemetry_endpoints = if self.enable_telemetry { - let endpoints = - TelemetryEndpoints::new(vec![("/ip4/127.0.0.1/tcp/99000/ws".into(), 0)]) - .expect("valid config; qed"); + let telemetry_endpoints = if let Some(port) = self.telemetry { + let endpoints = TelemetryEndpoints::new(vec![( + format!("/ip4/127.0.0.1/tcp/{}/ws", port), + 0, + )]) + .expect("valid config; qed"); Some(endpoints) } else { None @@ -356,7 +358,7 @@ mod tests { keystore: KeystoreConfig::InMemory, chain_spec, role: Role::Light, - enable_telemetry: false, + telemetry: None, }; let client = ClientBuilder::::new() .set_client( @@ -389,7 +391,7 @@ mod tests { keystore: KeystoreConfig::InMemory, chain_spec: test_node::chain_spec::development_config().unwrap(), role: Role::Authority(AccountKeyring::Alice), - enable_telemetry: false, + telemetry: None, }; let client = ClientBuilder::::new() .set_client( diff --git a/src/frame/staking.rs b/src/frame/staking.rs index 63731d0035..8df4bc7491 100644 --- a/src/frame/staking.rs +++ b/src/frame/staking.rs @@ -307,9 +307,11 @@ pub struct NominateCall { pub targets: Vec, } -/// Claim a payout. +/// Claim a payout for a validator’s stakers #[derive(PartialEq, Eq, Clone, Call, Encode, Decode, Debug)] pub struct PayoutStakersCall<'a, T: Staking> { + /// Stash account of the validator pub validator_stash: &'a T::AccountId, + /// Era index pub era: EraIndex, } diff --git a/src/lib.rs b/src/lib.rs index f2ffac1507..a4cc5949ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -247,7 +247,7 @@ impl> KeyIter { } } } - debug_assert_eq!(self.buffer.len(), self.count as usize); + debug_assert_eq!(self.buffer.len(), keys.len()); } } } @@ -269,6 +269,19 @@ impl Client { &self.properties } + /// Fetch the value under an unhashed storage key + pub async fn fetch_unhashed( + &self, + key: StorageKey, + hash: Option, + ) -> Result, Error> { + if let Some(data) = self.rpc.storage(&key, hash).await? { + Ok(Some(Decode::decode(&mut &data.0[..])?)) + } else { + Ok(None) + } + } + /// Fetch a StorageKey with an optional block hash. pub async fn fetch>( &self, @@ -276,11 +289,7 @@ impl Client { hash: Option, ) -> Result, Error> { let key = store.key(&self.metadata)?; - if let Some(data) = self.rpc.storage(&key, hash).await? { - Ok(Some(Decode::decode(&mut &data.0[..])?)) - } else { - Ok(None) - } + self.fetch_unhashed::(key, hash).await } /// Fetch a StorageKey that has a default value with an optional block hash. @@ -599,14 +608,14 @@ mod tests { }, chain_spec: test_node::chain_spec::development_config().unwrap(), role: Role::Authority(key), - enable_telemetry: false, + telemetry: None, }; let client = ClientBuilder::new() .set_client( SubxtClient::from_config(config, test_node::service::new_full) .expect("Error creating subxt client"), ) - .set_page_size(2) + .set_page_size(3) .build() .await .expect("Error creating client");