Skip to content

Commit

Permalink
fix ens name lookups to use correct encoding (#216)
Browse files Browse the repository at this point in the history
`encode_to_vec` adds extra characters to the string and is not
consistent with how the primary key is encoded on insert. Use `as_bytes`
to translate the string to a vec of utf8 bytes.
  • Loading branch information
aditiharini authored Jan 14, 2025
1 parent ec9785c commit c7af168
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/storage/store/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use crate::storage::trie::merkle_trie;
use crate::utils::statsd_wrapper::StatsdClientWrapper;
use itertools::Itertools;
use merkle_trie::TrieKey;
use prost::Message;
use std::collections::HashSet;
use std::str;
use std::sync::Arc;
Expand Down Expand Up @@ -973,7 +972,7 @@ impl ShardEngine {
if name.ends_with(".eth") {
let proof_message = UsernameProofStore::get_username_proof(
&self.stores.username_proof_store,
&name.encode_to_vec(),
&name.as_bytes().to_vec(),
UserNameType::UsernameTypeEnsL1 as u8,
)
.map_err(|e| MessageValidationError::StoreError {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ pub mod messages_factory {
) -> message::Message {
let proof = UserNameProof {
timestamp,
name: name.encode_to_vec(),
name: name.as_bytes().to_vec(),
owner,
signature: signature.encode_to_vec(),
fid,
Expand Down

0 comments on commit c7af168

Please sign in to comment.