Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions essentials/src/api/api_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,17 @@ impl<T: OnlineClientT<PolkadotConfig>> ApiClient<T> {
self.storage().at_latest().await?.fetch(&addr).await
}

pub async fn get_session_account_keys(&self, session_index: u32) -> Result<Option<Vec<AccountId32>>, subxt::Error> {
pub async fn get_session_account_keys(
&self,
session_index: u32,
hash: Option<H256>,
) -> Result<Option<Vec<AccountId32>>, subxt::Error> {
let addr = polkadot::storage().para_session_info().account_keys(session_index);
self.storage().at_latest().await?.fetch(&addr).await
if let Some(hash) = hash {
self.storage().at(hash).fetch(&addr).await
} else {
self.storage().at_latest().await?.fetch(&addr).await
}
}

pub async fn get_session_next_keys(&self, account: &AccountId32) -> Result<Option<SessionKeys>, subxt::Error> {
Expand Down
9 changes: 5 additions & 4 deletions essentials/src/api/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum Request {
GetOccupiedCores(H256),
GetBackingGroups(H256),
GetSessionIndex(H256),
GetSessionAccountKeys(u32),
GetSessionAccountKeys(u32, Option<H256>),
GetSessionNextKeys(AccountId32),
GetSessionQueuedKeys(Option<H256>),
GetInboundOutBoundHrmpChannels(H256, Vec<u32>),
Expand Down Expand Up @@ -233,8 +233,8 @@ impl RequestExecutorBackend {
BackingGroups(decode_validator_groups(&value)?)
},
GetSessionIndex(hash) => SessionIndex(client.get_session_index(hash).await?.unwrap_or_default()),
GetSessionAccountKeys(session_index) =>
SessionAccountKeys(client.get_session_account_keys(session_index).await?),
GetSessionAccountKeys(session_index, at) =>
SessionAccountKeys(client.get_session_account_keys(session_index, at).await?),
GetSessionNextKeys(ref account) => SessionNextKeys(client.get_session_next_keys(account).await?),
GetSessionQueuedKeys(at) => SessionQueuedKeys(client.get_session_queued_keys(at).await?),
GetSessionIndexNow => SessionIndex(client.get_session_index_now().await?.unwrap_or_default()),
Expand Down Expand Up @@ -431,8 +431,9 @@ impl RequestExecutor {
&mut self,
url: &str,
session_index: u32,
at: Option<H256>,
) -> color_eyre::Result<Option<Vec<AccountId32>>, RequestExecutorError> {
wrap_backend_call!(self, url, GetSessionAccountKeys, SessionAccountKeys, session_index)
wrap_backend_call!(self, url, GetSessionAccountKeys, SessionAccountKeys, session_index, at)
}

pub async fn get_session_next_keys(
Expand Down
2 changes: 1 addition & 1 deletion essentials/src/collector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ impl Collector {
debug!("new session: {}, hash: {}", cur_session, cur_session_hash);
let accounts_keys = self
.executor
.get_session_account_keys(self.endpoint.as_str(), cur_session)
.get_session_account_keys(self.endpoint.as_str(), cur_session, None)
.await?
.ok_or_else(|| eyre!("Missing account keys for session {}", cur_session))?;
self.storage_write_prefixed(
Expand Down
1 change: 1 addition & 0 deletions whois/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ futures = { workspace = true }
log = { workspace = true }
polkadot-introspector-essentials = { workspace = true }
polkadot-introspector-priority-channel = { workspace = true }
chrono = "0.4"
thiserror = { workspace = true }
tokio = { workspace = true }
serde = {workspace = true }
Expand Down
Loading
Loading