History Reference
Note inclusion
Note inclusion proves that a note existed (its hash was included in a note hash tree) in a block header.
prove_note_inclusion
prove_note_inclusion
takes 1 parameter:
Name | Type | Description |
---|---|---|
note | Note | The note you are proving inclusion for |
Example
header.prove_note_inclusion(note);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L67-L69
Note validity
This proves that a note exists and has not been nullified in a specific block header.
prove_note_validity
prove_note_validity
takes 2 parameters:
Name | Type | Description |
---|---|---|
note_with_header | Note | The note you are proving inclusion for |
context | PrivateContext | Private context |
Example
header.prove_note_validity(note, &mut context);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L143-L145
Nullifier inclusion
This proves that a nullifier exists in a given block header (can be used to prove that a note had been nullified).
prove_nullifier_inclusion
prove_nullifier_inclusion
takes 1 parameter:
Name | Type | Description |
---|---|---|
nullifier | Field | The nullifier you are proving inclusion for |
Example
header.prove_nullifier_inclusion(nullifier);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L175-L177
prove_note_is_nullified
Instead of passing the nullifier, you can check that a note has been nullified by passing the note.
Implementation
fn prove_note_is_nullified<Note, N, M>(self, note: Note, context: &mut PrivateContext) where Note: NoteInterface<N, M> {
let nullifier = compute_siloed_nullifier(note, context);
self.prove_nullifier_inclusion(nullifier);
}
Source code: noir-projects/aztec-nr/aztec/src/history/nullifier_inclusion.nr#L39-L45
Nullifier non inclusion
This proves that a nullifier was not included in a certain block, given the block header (can be used to prove that a note had not yet been nullified in a given block).
prove_nullifier_non_inclusion
prove_nullifier_non_inclusion
takes 1 parameters:
Name | Type | Description |
---|---|---|
nullifier | Field | The nullifier you are proving inclusion for |
Example
self.prove_nullifier_non_inclusion(nullifier);
Source code: noir-projects/aztec-nr/aztec/src/history/contract_inclusion.nr#L34-L36
prove_note_not_nullified
Instead of passing the nullifier, you can check that a note has not been nullified by passing the note.
Implementation
fn prove_note_not_nullified<Note, N, M>(self, note: Note, context: &mut PrivateContext) where Note: NoteInterface<N, M> {
let nullifier = compute_siloed_nullifier(note, context);
self.prove_nullifier_non_inclusion(nullifier);
}
Source code: noir-projects/aztec-nr/aztec/src/history/nullifier_non_inclusion.nr#L47-L53
Public storage historical reads
These return the value stored in a public storage slot of a given contract at the end of the execution of a certain block (the latest one if using public_storage_historical_read
).
Note that it is never possible to read the current value in a public storage slot in private since private execution is local and by definition always works on historical state.
public_storage_historical_read
public_storage_historical_read
takes 2 parameters:
Name | Type | Description |
---|---|---|
storage_slot | Field | Storage slot |
contract_address | AztecAddress | The contract that owns the storage slot |
Example
header.public_storage_historical_read(
storage.public_unused_value.storage_slot,
context.this_address()
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L197-L201
Contract inclusion
This proves that a contract exists in, ie had been deployed before or in, a certain block.
prove_contract_deployment
prove_contract_deployment
takes 1 parameter:
Name | Type | Description |
---|---|---|
contract_address | AztecAddress | The contract address to prove deployment of |
Example
header.prove_contract_deployment(contract_address);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L234-L236
prove_contract_non_deployment
prove_contract_non_deployment
takes 1 parameter:
Name | Type | Description |
---|---|---|
contract_address | AztecAddress | The contract address to prove non-deployment of |
Example
header.prove_contract_non_deployment(contract_address);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L256-L258
prove_contract_initialization
prove_contract_initialization
takes 1 parameter:
Name | Type | Description |
---|---|---|
contract_address | AztecAddress | The contract address to prove initialization of |
Example
header.prove_contract_initialization(contract_address);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L239-L241
prove_contract_non_initialization
prove_contract_non_initialization
takes 1 parameter:
Name | Type | Description |
---|---|---|
contract_address | AztecAddress | The contract address to prove non-initialization of |
Example
header.prove_contract_non_initialization(contract_address);
Source code: noir-projects/noir-contracts/contracts/inclusion_proofs_contract/src/main.nr#L261-L263