Skip to content
Snippets Groups Projects
Unverified Commit 8a88c758 authored by bgallois's avatar bgallois
Browse files

fix oracle

parent 002fcce4
No related branches found
No related tags found
No related merge requests found
Pipeline #35667 waiting for manual action
......@@ -114,11 +114,11 @@ pub struct MemberIter(
impl MemberIter {
pub async fn next(&mut self) -> Result<Option<IdtyIndex>, subxt::error::Error> {
self.0
.next()
.await
.unwrap()
.map(|(storage_key, _membership_data)| Some(idty_id_from_storage_key(&storage_key)))
if let Some(i) = self.0.next().await {
i.map(|(storage_key, _membership_data)| Some(idty_id_from_storage_key(&storage_key)))
} else {
Ok(None)
}
}
}
......@@ -139,14 +139,18 @@ impl CertIter {
pub async fn next(
&mut self,
) -> Result<Option<(IdtyIndex, Vec<(IdtyIndex, u32)>)>, subxt::error::Error> {
self.0
.next()
.await
.unwrap()
.map(|(storage_key, issuers)| Some((idty_id_from_storage_key(&storage_key), issuers)))
if let Some(i) = self.0.next().await {
i.map(|(storage_key, issuers)| Some((idty_id_from_storage_key(&storage_key), issuers)))
} else {
Ok(None)
}
}
}
fn idty_id_from_storage_key(storage_key: &[u8]) -> IdtyIndex {
u32::from_le_bytes(storage_key[40..44].try_into().unwrap())
u32::from_le_bytes(
storage_key.as_ref()[40..44]
.try_into()
.expect("Cannot convert StorageKey to IdtyIndex"),
)
}
......@@ -27,6 +27,6 @@ Feature: Identity creation
Then dave should have distance result in 2 sessions
When 30 blocks later
Then dave should have distance result in 1 session
#When alice runs distance oracle
#When 30 blocks later
#Then dave identity should be member TODO fix distance oracle
When alice runs distance oracle
When 30 blocks later
Then dave identity should be member
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment