drive/verify/shielded/verify_shielded_nullifiers/
mod.rs1mod v0;
2
3use crate::drive::Drive;
4use crate::error::drive::DriveError;
5use crate::error::Error;
6use crate::verify::RootHash;
7use dpp::version::PlatformVersion;
8
9impl Drive {
10 #[allow(clippy::type_complexity)]
12 pub fn verify_shielded_nullifiers(
13 proof: &[u8],
14 nullifiers: &[Vec<u8>],
15 verify_subset_of_proof: bool,
16 platform_version: &PlatformVersion,
17 ) -> Result<(RootHash, Vec<(Vec<u8>, bool)>), Error> {
18 match platform_version
19 .drive
20 .methods
21 .verify
22 .shielded
23 .verify_shielded_nullifiers
24 {
25 0 => Self::verify_shielded_nullifiers_v0(
26 proof,
27 nullifiers,
28 verify_subset_of_proof,
29 platform_version,
30 ),
31 version => Err(Error::Drive(DriveError::UnknownVersionMismatch {
32 method: "verify_shielded_nullifiers".to_string(),
33 known_versions: vec![0],
34 received: version,
35 })),
36 }
37 }
38}
39
40#[cfg(test)]
41mod tests {
42 use super::*;
43 use dpp::version::PlatformVersion;
44
45 #[test]
46 fn test_verify_shielded_nullifiers_unknown_version_mismatch() {
47 let mut platform_version = PlatformVersion::latest().clone();
48 platform_version
49 .drive
50 .methods
51 .verify
52 .shielded
53 .verify_shielded_nullifiers = 255;
54
55 let result = Drive::verify_shielded_nullifiers(&[], &[], false, &platform_version);
56
57 assert!(
58 matches!(
59 result,
60 Err(Error::Drive(DriveError::UnknownVersionMismatch { .. }))
61 ),
62 "expected UnknownVersionMismatch, got {:?}",
63 result,
64 );
65 }
66}