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

collect membership storage

parent 3da9f54d
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !248. Comments created here will be created in the context of that merge request.
...@@ -56,6 +56,7 @@ type IdtyData = gdev::runtime_types::common_runtime::entities::IdtyData; ...@@ -56,6 +56,7 @@ type IdtyData = gdev::runtime_types::common_runtime::entities::IdtyData;
type IdtyIndex = u32; type IdtyIndex = u32;
type IdtyValue = type IdtyValue =
gdev::runtime_types::pallet_identity::types::IdtyValue<BlockNumber, AccountId32, IdtyData>; gdev::runtime_types::pallet_identity::types::IdtyValue<BlockNumber, AccountId32, IdtyData>;
type MembershipData = gdev::runtime_types::sp_membership::MembershipData<BlockNumber>;
// use gdev::runtime_types::pallet_identity::types::IdtyStatus; // use gdev::runtime_types::pallet_identity::types::IdtyStatus;
struct Storage { struct Storage {
...@@ -146,6 +147,25 @@ async fn sanity_tests_at(client: Client, _maybe_block_hash: Option<H256>) -> any ...@@ -146,6 +147,25 @@ async fn sanity_tests_at(client: Client, _maybe_block_hash: Option<H256>) -> any
} }
println!("identity_index_of.len(): {}.", identity_index_of.len()); println!("identity_index_of.len(): {}.", identity_index_of.len());
// Collect memberships
let mut memberships: HashMap<IdtyIndex, MembershipData> = HashMap::new();
let mut membership_iter = client
.storage()
.at_latest()
.await
.unwrap()
.iter(gdev::storage().membership().membership_iter())
.await?;
while let Some(Ok((key, membership_data))) = membership_iter.next().await {
let mut idty_index_bytes = [0u8; 4];
idty_index_bytes.copy_from_slice(&key[40..]);
let membership_val = MembershipData {
expire_on: membership_data.expire_on,
};
memberships.insert(IdtyIndex::from_le_bytes(idty_index_bytes), membership_val);
}
println!("memberships.len(): {}.", memberships.len());
let storage = Storage { let storage = Storage {
accounts, accounts,
identities, identities,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment