@@ -2,45 +2,54 @@ use crate::history::nullifier_non_inclusion::{ProveNoteNotNullified, ProveNullif
2
2
use crate::oracle::random::random ;
3
3
4
4
use crate::history::test ;
5
+ use crate::test::helpers::test_environment::FIRST_NULLIFIER_EMITTED_IN_TXE ;
5
6
6
7
// In these tests, we create a note in one block and nullify it in the next.
7
8
8
- // In this test, we prove the absence of the note's nullifier in state before the note was nullified.
9
+ // In this test, we prove the absence of the note's nullifier in state at the block before it was nullified.
9
10
#[test]
10
11
unconstrained fn note_not_nullified () {
11
12
let (env , retrieved_note ) = test:: create_note_and_nullify_it ();
12
13
13
- let context = &mut env .private_at (2 );
14
+ let context = &mut env .private_at (test::NOTE_NULLIFIED_AT - 1 );
14
15
15
- context .historical_header .prove_note_not_nullified (retrieved_note , 15 , context );
16
+ context .historical_header .prove_note_not_nullified (
17
+ retrieved_note ,
18
+ test::NOTE_STORAGE_SLOT ,
19
+ context ,
20
+ );
16
21
}
17
22
18
- // In this test, we fail to prove the absence of the note's nullifier in state at the current block (the block after it was nullified) .
23
+ // In this test, we fail prove the absence of the note's nullifier in state at the block it was nullified in .
19
24
#[test(should_fail_with = "Proving nullifier non-inclusion failed")]
20
25
unconstrained fn note_not_nullified_fails () {
21
26
let (env , retrieved_note ) = test:: create_note_and_nullify_it ();
22
27
23
- let context = &mut env .private ();
24
- context .historical_header .prove_note_not_nullified (retrieved_note , 15 , context );
28
+ let context = &mut env .private_at (test::NOTE_NULLIFIED_AT );
29
+ context .historical_header .prove_note_not_nullified (
30
+ retrieved_note ,
31
+ test::NOTE_STORAGE_SLOT ,
32
+ context ,
33
+ );
25
34
}
26
35
27
36
// In this test, we prove the absence of an arbitrary nullifier in state.
28
37
#[test]
29
38
unconstrained fn nullifier_non_inclusion () {
30
39
let (env ) = test:: create_note_and_nullify_it ();
31
40
32
- let context = &mut env .private_at ( 2 );
41
+ let context = &mut env .private ( );
33
42
34
43
context .historical_header .prove_nullifier_non_inclusion (random ());
35
44
}
36
45
37
- // In this test, we fail to prove the inclusion of an existing nullifier in state. We use 6969 + 1 because it is
38
- // the first nullifier created ( the TXe creates deterministic first nullifiers if no side-effects are emitted)
46
+ // In this test, we fail to prove the absence of an existing nullifier in state. We use know FIRST_NULLIFIER_EMITTED_IN_TXE exists
47
+ // because the TXe creates deterministic first nullifiers if no side-effects are emitted.
39
48
#[test(should_fail_with = "Proving nullifier non-inclusion failed")]
40
49
unconstrained fn nullifier_non_inclusion_fails () {
41
50
let (env ) = test:: create_note_and_nullify_it ();
42
51
43
52
let context = &mut env .private ();
44
53
45
- context .historical_header .prove_nullifier_non_inclusion (6969 + 1 );
54
+ context .historical_header .prove_nullifier_non_inclusion (FIRST_NULLIFIER_EMITTED_IN_TXE );
46
55
}
0 commit comments