Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void FuzzerWorldStateManager::initialize_world_state()
{ simulation::MerkleTreeId::NULLIFIER_TREE, 128 },
{ simulation::MerkleTreeId::PUBLIC_DATA_TREE, 128 },
};
uint32_t initial_header_generator_point = 2064783670; // GeneratorIndex.BLOCK_HEADER_HASH
uint32_t initial_header_generator_point = 2064783670; // DomainSeparator.BLOCK_HEADER_HASH
ws = std::make_unique<world_state::WorldState>(
/*thread_pool_size=*/4, DATA_DIR, MAP_SIZE_KB, tree_heights, tree_prefill, initial_header_generator_point);

Expand Down
18 changes: 9 additions & 9 deletions docs/static/typescript-api/devnet/stdlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -2635,23 +2635,23 @@ new KeyValidationRequest(pkM: Point, skApp: Fr | Fq)
- `toBuffer() => any`
- `toFields() => Fr[]`

### KeyValidationRequestAndGenerator
### KeyValidationRequestAndSeparator

Request for validating keys used in the app and a generator.

**Constructor**
```typescript
new KeyValidationRequestAndGenerator(request: KeyValidationRequest, skAppGenerator: Fr)
new KeyValidationRequestAndSeparator(request: KeyValidationRequest, skAppGenerator: Fr)
```

**Properties**
- `readonly request: KeyValidationRequest`
- `readonly skAppGenerator: Fr`

**Methods**
- `static empty() => KeyValidationRequestAndGenerator`
- `static fromBuffer(buffer: Buffer | BufferReader) => KeyValidationRequestAndGenerator`
- `static fromFields(fields: Fr[] | FieldReader) => KeyValidationRequestAndGenerator`
- `static empty() => KeyValidationRequestAndSeparator`
- `static fromBuffer(buffer: Buffer | BufferReader) => KeyValidationRequestAndSeparator`
- `static fromFields(fields: Fr[] | FieldReader) => KeyValidationRequestAndSeparator`
- `isEmpty() => boolean`
- `toBuffer() => any`
- `toFields() => Fr[]`
Expand Down Expand Up @@ -3698,7 +3698,7 @@ Public inputs to a private circuit.

**Constructor**
```typescript
new PrivateCircuitPublicInputs(callContext: CallContext, argsHash: Fr, returnsHash: Fr, minRevertibleSideEffectCounter: Fr, isFeePayer: boolean, includeByTimestamp: bigint, noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, 16>, nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, 16>, keyValidationRequestsAndGenerators: ClaimedLengthArray<KeyValidationRequestAndGenerator, 16>, noteHashes: ClaimedLengthArray<NoteHash, 16>, nullifiers: ClaimedLengthArray<Nullifier, 16>, privateCallRequests: ClaimedLengthArray<PrivateCallRequest, 8>, publicCallRequests: ClaimedLengthArray<CountedPublicCallRequest, 32>, publicTeardownCallRequest: PublicCallRequest, l2ToL1Msgs: ClaimedLengthArray<CountedL2ToL1Message, 8>, privateLogs: ClaimedLengthArray<PrivateLogData, 16>, contractClassLogsHashes: ClaimedLengthArray<CountedLogHash, 1>, startSideEffectCounter: Fr, endSideEffectCounter: Fr, expectedNonRevertibleSideEffectCounter: Fr, expectedRevertibleSideEffectCounter: Fr, anchorBlockHeader: BlockHeader, txContext: TxContext)
new PrivateCircuitPublicInputs(callContext: CallContext, argsHash: Fr, returnsHash: Fr, minRevertibleSideEffectCounter: Fr, isFeePayer: boolean, includeByTimestamp: bigint, noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, 16>, nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, 16>, keyValidationRequestsAndGenerators: ClaimedLengthArray<KeyValidationRequestAndSeparator, 16>, noteHashes: ClaimedLengthArray<NoteHash, 16>, nullifiers: ClaimedLengthArray<Nullifier, 16>, privateCallRequests: ClaimedLengthArray<PrivateCallRequest, 8>, publicCallRequests: ClaimedLengthArray<CountedPublicCallRequest, 32>, publicTeardownCallRequest: PublicCallRequest, l2ToL1Msgs: ClaimedLengthArray<CountedL2ToL1Message, 8>, privateLogs: ClaimedLengthArray<PrivateLogData, 16>, contractClassLogsHashes: ClaimedLengthArray<CountedLogHash, 1>, startSideEffectCounter: Fr, endSideEffectCounter: Fr, expectedNonRevertibleSideEffectCounter: Fr, expectedRevertibleSideEffectCounter: Fr, anchorBlockHeader: BlockHeader, txContext: TxContext)
```

**Properties**
Expand All @@ -3711,7 +3711,7 @@ new PrivateCircuitPublicInputs(callContext: CallContext, argsHash: Fr, returnsHa
- `expectedRevertibleSideEffectCounter: Fr`
- `includeByTimestamp: bigint`
- `isFeePayer: boolean`
- `keyValidationRequestsAndGenerators: ClaimedLengthArray<KeyValidationRequestAndGenerator, 16>`
- `keyValidationRequestsAndGenerators: ClaimedLengthArray<KeyValidationRequestAndSeparator, 16>`
- `l2ToL1Msgs: ClaimedLengthArray<CountedL2ToL1Message, 8>`
- `minRevertibleSideEffectCounter: Fr`
- `noteHashes: ClaimedLengthArray<NoteHash, 16>`
Expand Down Expand Up @@ -5374,12 +5374,12 @@ Request for validating keys used in the app.

**Constructor**
```typescript
new ScopedKeyValidationRequestAndGenerator(request: KeyValidationRequestAndGenerator, contractAddress: AztecAddress)
new ScopedKeyValidationRequestAndGenerator(request: KeyValidationRequestAndSeparator, contractAddress: AztecAddress)
```

**Properties**
- `readonly contractAddress: AztecAddress`
- `readonly request: KeyValidationRequestAndGenerator`
- `readonly request: KeyValidationRequestAndSeparator`

**Methods**
- `static empty() => ScopedKeyValidationRequestAndGenerator`
Expand Down
21 changes: 12 additions & 9 deletions noir-projects/aztec-nr/aztec/src/context/private_context.nr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
context::{inputs::PrivateContextInputs, NoteExistenceRequest, NullifierExistenceRequest, ReturnsHash},
hash::{hash_args, hash_calldata_array},
keys::constants::{NULLIFIER_INDEX, NUM_KEY_TYPES, OUTGOING_INDEX, sk_generators},
keys::constants::{NULLIFIER_INDEX, NUM_KEY_TYPES, OUTGOING_INDEX, public_key_domain_separators},
messaging::process_l1_to_l2_message,
oracle::{
block_header::get_block_header_at,
Expand Down Expand Up @@ -30,7 +30,7 @@ use crate::protocol::{
private_circuit_public_inputs::PrivateCircuitPublicInputs,
private_log::{PrivateLog, PrivateLogData},
public_call_request::PublicCallRequest,
validation_requests::{KeyValidationRequest, KeyValidationRequestAndGenerator},
validation_requests::{KeyValidationRequest, KeyValidationRequestAndSeparator},
},
address::{AztecAddress, EthAddress},
constants::{
Expand Down Expand Up @@ -152,7 +152,7 @@ pub struct PrivateContext {

pub(crate) note_hash_read_requests: BoundedVec<Scoped<Counted<Field>>, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL>,
pub(crate) nullifier_read_requests: BoundedVec<Scoped<Counted<Field>>, MAX_NULLIFIER_READ_REQUESTS_PER_CALL>,
key_validation_requests_and_generators: BoundedVec<KeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL>,
key_validation_requests_and_separators: BoundedVec<KeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL>,

pub note_hashes: BoundedVec<Counted<NoteHash>, MAX_NOTE_HASHES_PER_CALL>,
pub nullifiers: BoundedVec<Counted<Nullifier>, MAX_NULLIFIERS_PER_CALL>,
Expand Down Expand Up @@ -190,7 +190,7 @@ impl PrivateContext {
expiration_timestamp: inputs.anchor_block_header.global_variables.timestamp + MAX_TX_LIFETIME,
note_hash_read_requests: BoundedVec::new(),
nullifier_read_requests: BoundedVec::new(),
key_validation_requests_and_generators: BoundedVec::new(),
key_validation_requests_and_separators: BoundedVec::new(),
note_hashes: BoundedVec::new(),
nullifiers: BoundedVec::new(),
anchor_block_header: inputs.anchor_block_header,
Expand Down Expand Up @@ -497,8 +497,8 @@ impl PrivateContext {
expiration_timestamp: self.expiration_timestamp,
note_hash_read_requests: ClaimedLengthArray::from_bounded_vec(self.note_hash_read_requests),
nullifier_read_requests: ClaimedLengthArray::from_bounded_vec(self.nullifier_read_requests),
key_validation_requests_and_generators: ClaimedLengthArray::from_bounded_vec(
self.key_validation_requests_and_generators,
key_validation_requests_and_separators: ClaimedLengthArray::from_bounded_vec(
self.key_validation_requests_and_separators,
),
note_hashes: ClaimedLengthArray::from_bounded_vec(self.note_hashes),
nullifiers: ClaimedLengthArray::from_bounded_vec(self.nullifiers),
Expand Down Expand Up @@ -796,8 +796,11 @@ impl PrivateContext {
let request = unsafe { get_key_validation_request(pk_m_hash, key_index) };
assert_eq(request.pk_m.hash(), pk_m_hash, "Obtained invalid key validation request");

self.key_validation_requests_and_generators.push(
KeyValidationRequestAndGenerator { request, sk_app_generator: sk_generators[key_index as u32] },
self.key_validation_requests_and_separators.push(
KeyValidationRequestAndSeparator {
request,
key_type_domain_separator: public_key_domain_separators[key_index as u32],
},
);
self.last_key_validation_requests[key_index as u32] = Option::some(request);
request.sk_app
Expand Down Expand Up @@ -1461,7 +1464,7 @@ impl Empty for PrivateContext {
expiration_timestamp: 0,
note_hash_read_requests: BoundedVec::new(),
nullifier_read_requests: BoundedVec::new(),
key_validation_requests_and_generators: BoundedVec::new(),
key_validation_requests_and_separators: BoundedVec::new(),
note_hashes: BoundedVec::new(),
nullifiers: BoundedVec::new(),
private_call_requests: BoundedVec::new(),
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/aztec-nr/aztec/src/keys/constants.nr
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pub global TAGGING_INDEX: Field = 3;

pub global NUM_KEY_TYPES: u32 = 4;

pub global sk_generators: [Field; 4] =
pub global public_key_domain_separators: [Field; 4] =
[DOM_SEP__NHK_M as Field, DOM_SEP__IVSK_M as Field, DOM_SEP__OVSK_M as Field, DOM_SEP__TSK_M as Field];
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl PrivateContext {
nullifier_read_requests: ClaimedLengthArray::from_bounded_vec(
self.nullifier_read_requests,
),
key_validation_requests_and_generators: ClaimedLengthArray::empty(), // Not used by protocol contracts
key_validation_requests_and_separators: ClaimedLengthArray::empty(), // Not used by protocol contracts
note_hashes: ClaimedLengthArray::empty(), // Not used by protocol contracts
nullifiers: ClaimedLengthArray::from_bounded_vec(self.nullifiers),
private_call_requests: ClaimedLengthArray::from_bounded_vec(self.private_call_requests),
Expand Down
6 changes: 6 additions & 0 deletions noir-projects/noir-protocol-circuits/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ function compile {
local program_hash=$(dump_fail "$program_hash_cmd")
echo_stderr "Hash preimage: $NOIR_HASH-$program_hash"
local hash=$(hash_str "$NOIR_HASH-$program_hash" $(cache_content_hash "^noir-projects/noir-protocol-circuits/bootstrap.sh"))
# Note: an edge case: If you change the name of a circuit public input, but don't change any of the
# circuit's bytecode, then this bootstrap script will not re-compile the circuits. You can force a
# re-compilation by temporarily replacing $NOIR_HASH on the above two lines with:
# `$NOIR_HASH-$program_hash-$circuits_hash"`
# We don't want to include `-$circuits_hash"` ordinarily, because it would force unnecessary
# rebuilds when tests / comments are changed.

if ! cache_download circuit-$hash.tar.gz 1>&2; then
SECONDS=0
Expand Down
Loading
Loading