diff --git a/substrate/validator-sets/pallet/src/lib.rs b/substrate/validator-sets/pallet/src/lib.rs index 4427d653..d71859c1 100644 --- a/substrate/validator-sets/pallet/src/lib.rs +++ b/substrate/validator-sets/pallet/src/lib.rs @@ -83,8 +83,12 @@ pub mod pallet { ValueQuery, >; /// The validators selected to be in-set, yet with the ability to perform a check for presence. + // Uses Identity so we can call clear_prefix over network, manually inserting a Blake2 hash + // before the spammable key. + // TODO: Review child trees? #[pallet::storage] - pub type InSet = StorageMap<_, Blake2_128Concat, (NetworkId, Public), (), OptionQuery>; + pub type InSet = + StorageMap<_, Identity, (NetworkId, [u8; 16], Public), (), OptionQuery>; /// The current amount allocated to a validator set by a validator. #[pallet::storage] @@ -197,7 +201,10 @@ pub mod pallet { } let key = Public(next[(next.len() - 32) .. next.len()].try_into().unwrap()); - InSet::::set((network, key), Some(())); + InSet::::set( + (network, sp_io::hashing::blake2_128(&(network, key).encode()), key), + Some(()), + ); participants.push(key); last = next;