Update crates/store/src/smt/smt_store.rs
@@ -49,7 +49,7 @@ impl<'a, DB: KVStore> Store<H256> for SMTStore<'a, DB> {
fn get_leaf(&self, leaf_key: &H256) -> Result<Option<H256>, SMTError> {
match self.store.get(self.leaf_col, leaf_key.as_slice()) {
Some(slice) if 32 == slice.len() => {
- let leaf: [u8; 32] = slice[..].try_into().unwrap();
+ let leaf: [u8; 32] = slice.as_ref().try_into().unwrap();
Ok(Some(H256::from(leaf)))
}
Some(_) => Err(SMTError::Store("get corrupted leaf".to_string())),
