This commit is contained in:
steve-gg 2024-04-06 02:52:53 +02:00
parent 201e019319
commit f6bafb1a70
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
6 changed files with 10 additions and 8 deletions

8
Cargo.lock generated
View File

@ -1912,6 +1912,12 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "fd_bs58"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdaac1b30ff95de4562a79ae990f91ac7bf2062d7313cc25c58987762c8e8160"
[[package]]
name = "feature-probe"
version = "0.1.1"
@ -6511,13 +6517,13 @@ dependencies = [
"blake3",
"borsh 0.10.3",
"borsh 0.9.3",
"bs58",
"bv",
"bytemuck",
"cc",
"console_error_panic_hook",
"console_log",
"curve25519-dalek",
"fd_bs58",
"getrandom 0.2.10",
"itertools",
"js-sys",

View File

@ -16,7 +16,7 @@ bincode = { workspace = true }
blake3 = { workspace = true, features = ["digest", "traits-preview"] }
borsh = { workspace = true }
borsh0-9 = { package = "borsh", version = "0.9.3" }
bs58 = "0.1.0"
fd_bs58 = "0.1.0"
bv = { workspace = true, features = ["serde"] }
bytemuck = { workspace = true, features = ["derive"] }
itertools = { workspace = true }

View File

@ -89,7 +89,6 @@ impl FromStr for Hash {
return Err(ParseHashError::WrongSize);
}
let bytes = fd_bs58::decode_32(s)
.into_vec()
.map_err(|_| ParseHashError::Invalid)?;
if bytes.len() != mem::size_of::<Hash>() {
Err(ParseHashError::WrongSize)
@ -193,7 +192,7 @@ mod tests {
Err(ParseHashError::WrongSize)
);
let input_too_big = bs58::encode(&[0xffu8; HASH_BYTES + 1]).into_string();
let input_too_big = fd_bs58::encode_32(&[0xffu8; HASH_BYTES + 1]);
assert!(input_too_big.len() > MAX_BASE58_LEN);
assert_eq!(
input_too_big.parse::<Hash>(),

View File

@ -110,7 +110,6 @@ impl FromStr for Hash {
return Err(ParseHashError::WrongSize);
}
let bytes = fd_bs58::decode_32(s)
.into_vec()
.map_err(|_| ParseHashError::Invalid)?;
if bytes.len() != mem::size_of::<Hash>() {
Err(ParseHashError::WrongSize)
@ -214,7 +213,7 @@ mod tests {
Err(ParseHashError::WrongSize)
);
let input_too_big = bs58::encode(&[0xffu8; HASH_BYTES + 1]).into_string();
let input_too_big = fd_bs58::encode_32(&[0xffu8; HASH_BYTES + 1]);
assert!(input_too_big.len() > MAX_BASE58_LEN);
assert_eq!(
input_too_big.parse::<Hash>(),

View File

@ -89,7 +89,6 @@ impl FromStr for Hash {
return Err(ParseHashError::WrongSize);
}
let bytes = fd_bs58::decode_32(s)
.into_vec()
.map_err(|_| ParseHashError::Invalid)?;
if bytes.len() != mem::size_of::<Hash>() {
Err(ParseHashError::WrongSize)

View File

@ -116,7 +116,6 @@ impl FromStr for Pubkey {
return Err(ParsePubkeyError::WrongSize);
}
let pubkey_vec = fd_bs58::decode_32(s)
.into_vec()
.map_err(|_| ParsePubkeyError::Invalid)?;
if pubkey_vec.len() != mem::size_of::<Pubkey>() {
Err(ParsePubkeyError::WrongSize)