Skip to content

Commit

Permalink
chore: add proof len consistency check (#1144)
Browse files Browse the repository at this point in the history
  • Loading branch information
ananas-block authored Sep 2, 2024
1 parent 1b2a327 commit 51d076e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions programs/account-compression/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ pub enum AccountCompressionErrorCode {
InvalidAccountBalance,
UnsupportedAdditionalBytes,
InvalidGroup,
ProofLengthMismatch,
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ pub fn process_nullify_leaves<'a, 'b, 'c: 'info, 'info>(
msg!("only implemented for 1 nullifier update");
return Err(AccountCompressionErrorCode::NumberOfProofsMismatch.into());
}
if proofs.len() > 1 && proofs[0].len() != proofs[1].len() {
msg!(
"Proofs length mismatch {} {}",
proofs[0].len(),
proofs[1].len()
);
return Err(AccountCompressionErrorCode::ProofLengthMismatch.into());
}
insert_nullifier(
proofs,
change_log_indices,
Expand Down

0 comments on commit 51d076e

Please sign in to comment.