|
| 1 | +use filecoin_proofs_api::post::verify_window_post; |
| 2 | +use filecoin_proofs_api::RegisteredPoStProof::{ |
| 3 | + StackedDrgWindow32GiBV1, StackedDrgWindow32GiBV1_2, |
| 4 | +}; |
| 5 | +use filecoin_proofs_api::{PublicReplicaInfo, RegisteredPoStProof}; |
| 6 | +use filecoin_proofs_v1::{ChallengeSeed, ProverId}; |
| 7 | +use std::collections::BTreeMap; |
| 8 | +use storage_proofs_core::sector::SectorId; |
| 9 | + |
| 10 | +#[test] |
| 11 | +#[cfg(feature = "big-tests")] |
| 12 | +fn verify_post() { |
| 13 | + let randomness = ChallengeSeed::from([ |
| 14 | + 47, 180, 15, 215, 4, 51, 54, 214, 69, 205, 19, 137, 99, 198, 249, 96, 246, 73, 219, 83, |
| 15 | + 160, 245, 50, 226, 100, 89, 142, 159, 83, 226, 237, 35, |
| 16 | + ]); |
| 17 | + let post_proof_v1: &[(RegisteredPoStProof, &[u8])] = &[( |
| 18 | + StackedDrgWindow32GiBV1, |
| 19 | + &[ |
| 20 | + 181, 223, 130, 56, 59, 30, 190, 80, 43, 249, 221, 153, 147, 148, 98, 121, 237, 44, 151, |
| 21 | + 249, 139, 112, 43, 60, 46, 204, 169, 18, 51, 14, 113, 152, 215, 192, 189, 33, 229, 57, |
| 22 | + 132, 48, 44, 14, 223, 15, 212, 245, 113, 23, 132, 212, 146, 166, 26, 242, 115, 122, 83, |
| 23 | + 72, 156, 7, 218, 41, 27, 153, 254, 3, 232, 30, 133, 190, 150, 211, 250, 86, 117, 123, |
| 24 | + 227, 85, 180, 236, 61, 183, 1, 165, 5, 116, 230, 132, 224, 247, 194, 126, 12, 111, 86, |
| 25 | + 243, 9, 194, 191, 175, 150, 27, 154, 113, 247, 166, 200, 119, 62, 0, 186, 134, 155, 83, |
| 26 | + 232, 227, 89, 161, 156, 246, 37, 112, 85, 22, 24, 241, 108, 85, 234, 247, 225, 18, 234, |
| 27 | + 136, 107, 23, 50, 21, 166, 75, 167, 77, 227, 40, 128, 21, 11, 121, 154, 22, 160, 200, |
| 28 | + 152, 249, 6, 90, 78, 190, 217, 21, 141, 63, 90, 34, 125, 180, 161, 13, 220, 119, 173, |
| 29 | + 169, 86, 170, 200, 48, 12, 90, 80, 26, 79, 213, 92, 19, 174, 30, 29, 11, 53, 47, 157, |
| 30 | + 1, |
| 31 | + ], |
| 32 | + )]; |
| 33 | + let public_replica_info_v1 = PublicReplicaInfo::new( |
| 34 | + StackedDrgWindow32GiBV1, |
| 35 | + [ |
| 36 | + 85, 177, 161, 128, 182, 149, 59, 73, 186, 144, 39, 142, 172, 241, 4, 165, 209, 60, 20, |
| 37 | + 153, 120, 49, 236, 233, 203, 115, 95, 195, 117, 182, 84, 31, |
| 38 | + ], |
| 39 | + ); |
| 40 | + let replicas_v1: BTreeMap<SectorId, PublicReplicaInfo> = |
| 41 | + BTreeMap::from([(SectorId::from(132), public_replica_info_v1)]); |
| 42 | + let prover_id = ProverId::from([ |
| 43 | + 167, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 44 | + 0, 0, 0, |
| 45 | + ]); |
| 46 | + |
| 47 | + assert!(verify_window_post(&randomness, &post_proof_v1, &replicas_v1, prover_id).unwrap()); |
| 48 | + |
| 49 | + let post_proof_v2: &[(RegisteredPoStProof, &[u8])] = &[( |
| 50 | + StackedDrgWindow32GiBV1_2, |
| 51 | + &[ |
| 52 | + 181, 223, 130, 56, 59, 30, 190, 80, 43, 249, 221, 153, 147, 148, 98, 121, 237, 44, 151, |
| 53 | + 249, 139, 112, 43, 60, 46, 204, 169, 18, 51, 14, 113, 152, 215, 192, 189, 33, 229, 57, |
| 54 | + 132, 48, 44, 14, 223, 15, 212, 245, 113, 23, 132, 212, 146, 166, 26, 242, 115, 122, 83, |
| 55 | + 72, 156, 7, 218, 41, 27, 153, 254, 3, 232, 30, 133, 190, 150, 211, 250, 86, 117, 123, |
| 56 | + 227, 85, 180, 236, 61, 183, 1, 165, 5, 116, 230, 132, 224, 247, 194, 126, 12, 111, 86, |
| 57 | + 243, 9, 194, 191, 175, 150, 27, 154, 113, 247, 166, 200, 119, 62, 0, 186, 134, 155, 83, |
| 58 | + 232, 227, 89, 161, 156, 246, 37, 112, 85, 22, 24, 241, 108, 85, 234, 247, 225, 18, 234, |
| 59 | + 136, 107, 23, 50, 21, 166, 75, 167, 77, 227, 40, 128, 21, 11, 121, 154, 22, 160, 200, |
| 60 | + 152, 249, 6, 90, 78, 190, 217, 21, 141, 63, 90, 34, 125, 180, 161, 13, 220, 119, 173, |
| 61 | + 169, 86, 170, 200, 48, 12, 90, 80, 26, 79, 213, 92, 19, 174, 30, 29, 11, 53, 47, 157, |
| 62 | + 1, |
| 63 | + ], |
| 64 | + )]; |
| 65 | + let public_replica_info_v2 = PublicReplicaInfo::new( |
| 66 | + StackedDrgWindow32GiBV1_2, |
| 67 | + [ |
| 68 | + 85, 177, 161, 128, 182, 149, 59, 73, 186, 144, 39, 142, 172, 241, 4, 165, 209, 60, 20, |
| 69 | + 153, 120, 49, 236, 233, 203, 115, 95, 195, 117, 182, 84, 31, |
| 70 | + ], |
| 71 | + ); |
| 72 | + let replicas_v2: BTreeMap<SectorId, PublicReplicaInfo> = |
| 73 | + BTreeMap::from([(SectorId::from(132), public_replica_info_v2)]); |
| 74 | + assert!(verify_window_post(&randomness, &post_proof_v2, &replicas_v2, prover_id).unwrap()); |
| 75 | +} |
0 commit comments