From ee9d211f54f5813eddd7da1bdc41ee2a7475f47d Mon Sep 17 00:00:00 2001 From: vlad Date: Tue, 15 Oct 2024 09:01:20 +0000 Subject: [PATCH] ValidatorList - using HashSet rather than Vec (faster contains()) --- .../shared/block-verifier/src/validator_whitelist.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cosmwasm/enclaves/shared/block-verifier/src/validator_whitelist.rs b/cosmwasm/enclaves/shared/block-verifier/src/validator_whitelist.rs index f44252d80..e13a07cd9 100644 --- a/cosmwasm/enclaves/shared/block-verifier/src/validator_whitelist.rs +++ b/cosmwasm/enclaves/shared/block-verifier/src/validator_whitelist.rs @@ -1,3 +1,4 @@ +use std::collections::HashSet; use tendermint_light_client_verifier::types::UntrustedBlockState; #[cfg(not(feature = "production"))] @@ -16,11 +17,11 @@ lazy_static::lazy_static! { } #[derive(Debug, Clone)] -struct ValidatorList(pub Vec); +pub struct ValidatorList(pub HashSet); impl ValidatorList { fn from_str(list: &str) -> Self { - let addresses: Vec = list.split(',').map(|s| s.to_string()).collect(); + let addresses: HashSet = list.split(',').map(|s| s.to_string()).collect(); Self(addresses) }