fix: misspelled variant name in TieredSmtProofError

This commit is contained in:
Bobbin Threadbare 2023-08-04 22:46:23 -07:00
parent 5c6a20cb60
commit b3e7578ab2
2 changed files with 23 additions and 24 deletions

View file

@ -3,11 +3,11 @@ use core::fmt::Display;
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub enum TieredSmtProofError { pub enum TieredSmtProofError {
EntriesEmpty, EntriesEmpty,
PathTooLong,
NotATierPath(u8),
MultipleEntriesOutsideLastTier,
EmptyValueNotAllowed, EmptyValueNotAllowed,
UnmatchingPrefixes(u64, u64), MismatchedPrefixes(u64, u64),
MultipleEntriesOutsideLastTier,
NotATierPath(u8),
PathTooLong,
} }
impl Display for TieredSmtProofError { impl Display for TieredSmtProofError {
@ -16,31 +16,30 @@ impl Display for TieredSmtProofError {
TieredSmtProofError::EntriesEmpty => { TieredSmtProofError::EntriesEmpty => {
write!(f, "Missing entries for tiered sparse merkle tree proof") write!(f, "Missing entries for tiered sparse merkle tree proof")
} }
TieredSmtProofError::EmptyValueNotAllowed => {
write!(
f,
"The empty value [0, 0, 0, 0] is not allowed inside a tiered sparse merkle tree"
)
}
TieredSmtProofError::MismatchedPrefixes(first, second) => {
write!(f, "Not all leaves have the same prefix. First {first} second {second}")
}
TieredSmtProofError::MultipleEntriesOutsideLastTier => {
write!(f, "Multiple entries are only allowed for the last tier (depth 64)")
}
TieredSmtProofError::NotATierPath(got) => {
write!(
f,
"Path length does not correspond to a tier. Got {got} Expected one of 16, 32, 48, 64"
)
}
TieredSmtProofError::PathTooLong => { TieredSmtProofError::PathTooLong => {
write!( write!(
f, f,
"Path longer than maximum depth of 64 for tiered sparse merkle tree proof" "Path longer than maximum depth of 64 for tiered sparse merkle tree proof"
) )
} }
TieredSmtProofError::NotATierPath(got) => {
write!(
f,
"Path length does not correspond to a tier. Got {} Expected one of 16,32,48,64",
got
)
}
TieredSmtProofError::MultipleEntriesOutsideLastTier => {
write!(f, "Multiple entries are only allowed for the last tier (depth 64)")
}
TieredSmtProofError::EmptyValueNotAllowed => {
write!(
f,
"The empty value [0,0,0,0] is not allowed inside a tiered sparse merkle tree"
)
}
TieredSmtProofError::UnmatchingPrefixes(first, second) => {
write!(f, "Not all leaves have the same prefix. First {} second {}", first, second)
}
} }
} }
} }

View file

@ -68,7 +68,7 @@ impl TieredSmtProof {
} }
let current = get_key_prefix(&entry.0); let current = get_key_prefix(&entry.0);
if prefix != current { if prefix != current {
return Err(TieredSmtProofError::UnmatchingPrefixes(prefix, current)); return Err(TieredSmtProofError::MismatchedPrefixes(prefix, current));
} }
} }
} }