Skip to content

Commit 89bc538

Browse files
committed
feat: generic key validation request 2
1 parent d4968b2 commit 89bc538

39 files changed

Lines changed: 234 additions & 188 deletions

barretenberg/cpp/src/barretenberg/vm/avm_trace/aztec_constants.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const size_t MAX_PUBLIC_DATA_READS_PER_CALL = 16;
1313
const size_t MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 32;
1414
const size_t MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 2;
1515
const size_t MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 2;
16-
const size_t MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL = 1;
16+
const size_t MAX_KEY_VALIDATION_REQUESTS_PER_CALL = 1;
1717
const size_t MAX_NOTE_ENCRYPTED_LOGS_PER_CALL = 16;
1818
const size_t MAX_ENCRYPTED_LOGS_PER_CALL = 4;
1919
const size_t MAX_UNENCRYPTED_LOGS_PER_CALL = 4;
@@ -27,7 +27,7 @@ const size_t MAX_NEW_L2_TO_L1_MSGS_PER_TX = 2;
2727
const size_t MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 128;
2828
const size_t MAX_NULLIFIER_READ_REQUESTS_PER_TX = 8;
2929
const size_t MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 8;
30-
const size_t MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX = 4;
30+
const size_t MAX_KEY_VALIDATION_REQUESTS_PER_TX = 4;
3131
const size_t MAX_NOTE_ENCRYPTED_LOGS_PER_TX = 64;
3232
const size_t MAX_ENCRYPTED_LOGS_PER_TX = 8;
3333
const size_t MAX_UNENCRYPTED_LOGS_PER_TX = 8;
@@ -112,7 +112,7 @@ const size_t HEADER_LENGTH =
112112
const size_t PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH =
113113
CALL_CONTEXT_LENGTH + 4 + MAX_BLOCK_NUMBER_LENGTH + (READ_REQUEST_LENGTH * MAX_NOTE_HASH_READ_REQUESTS_PER_CALL) +
114114
(READ_REQUEST_LENGTH * MAX_NULLIFIER_READ_REQUESTS_PER_CALL) +
115-
(NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH * MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL) +
115+
(NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH * MAX_KEY_VALIDATION_REQUESTS_PER_CALL) +
116116
(NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_CALL) + (NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_CALL) +
117117
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL + MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + 1 +
118118
(L2_TO_L1_MESSAGE_LENGTH * MAX_NEW_L2_TO_L1_MSGS_PER_CALL) + 2 +
@@ -137,7 +137,7 @@ const size_t VALIDATION_REQUESTS_LENGTH =
137137
ROLLUP_VALIDATION_REQUESTS_LENGTH + (SCOPED_READ_REQUEST_LEN * MAX_NOTE_HASH_READ_REQUESTS_PER_TX) +
138138
(SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_READ_REQUESTS_PER_TX) +
139139
(SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX) +
140-
(SCOPED_NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH * MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX) +
140+
(SCOPED_NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH * MAX_KEY_VALIDATION_REQUESTS
141141
(PUBLIC_DATA_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_TX);
142142
const size_t PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 2;
143143
const size_t COMBINED_ACCUMULATED_DATA_LENGTH =

docs/docs/protocol-specs/circuits/private-function.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The public inputs of _every_ private function _must_ adhere to the following ABI
5151
| `encrypted_note_preimage_hashes` | [[`EncryptedNotePreimageHash`](#encryptednotepreimagehash); [`MAX_ENCRYPTED_NOTE_PREIMAGE_HASHES_PER_CALL`](../constants.md#circuit-constants)] | Hashes of the encrypted note preimages emitted in this function call. |
5252
| `note_hash_read_requests` | [[`ReadRequest`](#readrequest); [`MAX_NOTE_HASH_READ_REQUESTS_PER_CALL`](../constants.md#circuit-constants)] | Requests to prove the note hashes being read exist. |
5353
| `nullifier_read_requests` | [[`ReadRequest`](#readrequest); [`MAX_NULLIFIER_READ_REQUESTS_PER_CALL`](../constants.md#circuit-constants)] | Requests to prove the nullifiers being read exist. |
54-
| `nullifier_key_validation_requests` | [[`ParentSecretKeyValidationRequest`](#parentsecretkeyvalidationrequest); [`MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL`](../constants.md#circuit-constants)] | Requests to validate nullifier keys used in this function call. |
54+
| `key_validation_requests` | [[`ParentSecretKeyValidationRequest`](#parentsecretkeyvalidationrequest); [`MAX_KEY_VALIDATION_REQUESTS_PER_CALL`](../constants.md#circuit-constants)] | Requests to validate keys used in this function call. |
5555
| `public_call_requests` | [[`PublicCallRequest`](#publiccallrequest); [`MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL`](../constants.md#circuit-constants)] | Requests to call public functions. |
5656
| `private_call_requests` | [[`PrivateCallRequest`](#privatecallrequest); [`MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL`](../constants.md#circuit-constants)] | Requests to call Private functions. |
5757
| `counter_start` | `u32` | Counter at which the function call was initiated. |

docs/docs/protocol-specs/circuits/private-kernel-initial.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ class PrivateFunctionPublicInputs {
452452
l2_to_l1_messages: List~field~
453453
note_hash_read_requests: List~ReadRequest~
454454
nullifier_read_requests: List~ReadRequest~
455-
nullifier_key_validation_requests: List~ParentSecretKeyValidationRequest~
455+
key_validation_requests: List~ParentSecretKeyValidationRequest~
456456
unencrypted_log_hashes: List~UnencryptedLogHash~
457457
encrypted_log_hashes: List~EncryptedLogHash~
458458
encrypted_note_preimage_hashes: List~EncryptedNotePreimageHash~
@@ -470,7 +470,7 @@ PrivateFunctionPublicInputs *-- NoteHash: note_hashes
470470
PrivateFunctionPublicInputs *-- Nullifier: nullifiers
471471
PrivateFunctionPublicInputs *-- ReadRequest: note_hash_read_requests
472472
PrivateFunctionPublicInputs *-- ReadRequest: nullifier_read_requests
473-
PrivateFunctionPublicInputs *-- ParentSecretKeyValidationRequest: nullifier_key_validation_requests
473+
PrivateFunctionPublicInputs *-- ParentSecretKeyValidationRequest: key_validation_requests
474474
PrivateFunctionPublicInputs *-- UnencryptedLogHash: unencrypted_log_hashes
475475
PrivateFunctionPublicInputs *-- EncryptedLogHash: encrypted_log_hashes
476476
PrivateFunctionPublicInputs *-- EncryptedNotePreimageHash: encrypted_note_preimage_hashes
@@ -529,7 +529,7 @@ class ParentSecretKeyValidationRequest {
529529
parent_public_key: GrumpkinPoint
530530
hardened_child_secret_key: fq
531531
}
532-
ParentSecretKeyValidationRequest ..> ParentSecretKeyValidationRequestContext: nullifier_key_validation_requests\n->nullifier_key_validation_request_contexts
532+
ParentSecretKeyValidationRequest ..> ParentSecretKeyValidationRequestContext: key_validation_requests\n->nullifier_key_validation_request_contexts
533533
534534
class UnencryptedLogHash {
535535
hash: field
@@ -776,7 +776,7 @@ Would it be accurate to describe this as `AccumulatedTransientSideEffects`, perh
776776
| `encrypted_note_preimage_hash_contexts` | [[`EncryptedNotePreimageHashContext`](#encryptednotepreimagehash); [`MAX_ENCRYPTED_NOTE_PREIMAGE_HASHES_PER_TX`](../constants.md#circuit-constants)] | Hashes of the encrypted note preimages with extra data aiding verification. |
777777
| `note_hash_read_requests` | [[`ReadRequest`](./private-function#readrequest); [`MAX_NOTE_HASH_READ_REQUESTS_PER_TX`](../constants.md#circuit-constants)] | Requests to prove the note hashes being read exist. |
778778
| `nullifier_read_requests` | [[`ReadRequest`](./private-function#readrequest); [`MAX_NULLIFIER_READ_REQUESTS_PER_TX`](../constants.md#circuit-constants)] | Requests to prove the nullifiers being read exist. |
779-
| `nullifier_key_validation_request_contexts` | [[`ParentSecretKeyValidationRequestContext`](#parentsecretkeyvalidationrequestcontext); [`MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX`](../constants.md#circuit-constants)] | Requests to validate nullifier keys. |
779+
| `nullifier_key_validation_request_contexts` | [[`ParentSecretKeyValidationRequestContext`](#parentsecretkeyvalidationrequestcontext); [`MAX_KEY_VALIDATION_REQUESTS_PER_TX`](../constants.md#circuit-constants)] | Requests to validate nullifier keys. |
780780
| `public_call_request_contexts` | [[`PublicCallRequestContext`](./public-kernel-tail.md#publiccallrequestcontext); [`MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX`](../constants.md#circuit-constants)] | Requests to call publics functions. |
781781
| `private_call_request_stack` | [[`PrivateCallRequestContext`](#privatecallrequestcontext); [`MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX`](../constants.md#circuit-constants)] | Requests to call private functions. Pushed to the stack in reverse order so that they will be executed in chronological order. |
782782

docs/docs/protocol-specs/circuits/private-kernel-inner.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class PrivateFunctionPublicInputs {
251251
encrypted_note_preimage_hashes: List~EncryptedNotePreimageHash~
252252
note_hash_read_requests: List~ReadRequest~
253253
nullifier_read_requests: List~ReadRequest~
254-
nullifier_key_validation_requests: List~ParentSecretKeyValidationRequest~
254+
key_validation_requests: List~ParentSecretKeyValidationRequest~
255255
public_call_requests: List~PublicCallRequest~
256256
private_call_requests: List~PrivateCallRequest~
257257
counter_start: u32
@@ -266,7 +266,7 @@ PrivateFunctionPublicInputs *-- NoteHash: note_hashes
266266
PrivateFunctionPublicInputs *-- Nullifier: nullifiers
267267
PrivateFunctionPublicInputs *-- ReadRequest: note_hash_read_requests
268268
PrivateFunctionPublicInputs *-- ReadRequest: nullifier_read_requests
269-
PrivateFunctionPublicInputs *-- ParentSecretKeyValidationRequest: nullifier_key_validation_requests
269+
PrivateFunctionPublicInputs *-- ParentSecretKeyValidationRequest: key_validation_requests
270270
PrivateFunctionPublicInputs *-- UnencryptedLogHash: unencrypted_log_hashes
271271
PrivateFunctionPublicInputs *-- EncryptedLogHash: encrypted_log_hashes
272272
PrivateFunctionPublicInputs *-- EncryptedNotePreimageHash: encrypted_note_preimage_hashes
@@ -338,7 +338,7 @@ class ParentSecretKeyValidationRequest {
338338
parent_public_key: GrumpkinPoint
339339
hardened_child_secret_key: fq
340340
}
341-
ParentSecretKeyValidationRequest ..> ParentSecretKeyValidationRequestContext: nullifier_key_validation_requests\n->nullifier_key_validation_request_contexts
341+
ParentSecretKeyValidationRequest ..> ParentSecretKeyValidationRequestContext: key_validation_requests\n->nullifier_key_validation_request_contexts
342342

343343
class UnencryptedLogHash {
344344
hash: field

docs/docs/protocol-specs/circuits/private-kernel-reset.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ The format aligns with the [`PreviousKernel`](./private-kernel-inner#previousker
236236

237237
| Field | Type | Description |
238238
| -------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------- |
239-
| `master_secret_keys` | [`field`; [`MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX`](../constants.md#circuit-constants)] | Master secret keys for the secret keys. |
239+
| `master_secret_keys` | [`field`; [`MAX_KEY_VALIDATION_REQUESTS_PER_TX`](../constants.md#circuit-constants)] | Master secret keys for the secret keys. |
240240

241241
### _Hints_ for [Transient Note Reset Private Kernel Circuit](#transient-note-reset-private-kernel-circuit)
242242

docs/docs/protocol-specs/constants.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The statically-sized nature the kernel & rollup circuits will restrict the quant
5252
| `MAX_ENCRYPTED_NOTE_PREIMAGE_HASHES_PER_CALL` | 128 |
5353
| `MAX_NOTE_HASH_READ_REQUESTS_PER_CALL` | 128 |
5454
| `MAX_NULLIFIER_READ_REQUESTS_PER_CALL` | 128 |
55-
| `MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL` | 1 | TODO: we shouldn't need this, given the reset circuit. |
55+
| `MAX_KEY_VALIDATION_REQUESTS_PER_CALL | 1 | TODO: we shouldn't need this, given the reset circuit. |
5656
| `MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL` | 32 |
5757
| `MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL` | 32 |
5858

@@ -71,7 +71,7 @@ The statically-sized nature the kernel & rollup circuits will restrict the quant
7171
| `MAX_ENCRYPTED_NOTE_PREIMAGE_HASHES_PER_TX` | 128 |
7272
| `MAX_OPTIONALLY_REVEALED_DATA_LENGTH_PER_TX` | 4 |
7373
| `MAX_NOTE_HASH_READ_REQUESTS_PER_TX` | 128 | TODO: we shouldn't need this, given the reset circuit. |
74-
| `MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX` | 4 | TODO: we shouldn't need this, given the reset circuit. |
74+
| `MAX_KEY_VALIDATION_REQUESTS_PER_TX` | 4 | TODO: we shouldn't need this, given the reset circuit. |
7575
| `MAX_PRIVATE_CALL_STACK_LENGTH_PER_TX` | 32 |
7676
| `MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX` | 32 |
7777

l1-contracts/src/core/libraries/ConstantsGen.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ library Constants {
2525
uint256 internal constant MAX_NOTE_HASH_READ_REQUESTS_PER_CALL = 32;
2626
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_CALL = 2;
2727
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL = 2;
28-
uint256 internal constant MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL = 16;
28+
uint256 internal constant MAX_KEY_VALIDATION_REQUESTS_PER_CALL = 16;
2929
uint256 internal constant MAX_NOTE_ENCRYPTED_LOGS_PER_CALL = 16;
3030
uint256 internal constant MAX_ENCRYPTED_LOGS_PER_CALL = 4;
3131
uint256 internal constant MAX_UNENCRYPTED_LOGS_PER_CALL = 4;
@@ -39,7 +39,7 @@ library Constants {
3939
uint256 internal constant MAX_NOTE_HASH_READ_REQUESTS_PER_TX = 128;
4040
uint256 internal constant MAX_NULLIFIER_READ_REQUESTS_PER_TX = 8;
4141
uint256 internal constant MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX = 8;
42-
uint256 internal constant MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX = 64;
42+
uint256 internal constant MAX_KEY_VALIDATION_REQUESTS_PER_TX = 64;
4343
uint256 internal constant MAX_NOTE_ENCRYPTED_LOGS_PER_TX = 64;
4444
uint256 internal constant MAX_ENCRYPTED_LOGS_PER_TX = 8;
4545
uint256 internal constant MAX_UNENCRYPTED_LOGS_PER_TX = 8;
@@ -142,7 +142,7 @@ library Constants {
142142
uint256 internal constant PRIVATE_CIRCUIT_PUBLIC_INPUTS_LENGTH = CALL_CONTEXT_LENGTH + 4
143143
+ MAX_BLOCK_NUMBER_LENGTH + (READ_REQUEST_LENGTH * MAX_NOTE_HASH_READ_REQUESTS_PER_CALL)
144144
+ (READ_REQUEST_LENGTH * MAX_NULLIFIER_READ_REQUESTS_PER_CALL)
145-
+ (NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH * MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_CALL)
145+
+ (NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH * MAX_KEY_VALIDATION_REQUESTS_PER_CALL)
146146
+ (NOTE_HASH_LENGTH * MAX_NEW_NOTE_HASHES_PER_CALL)
147147
+ (NULLIFIER_LENGTH * MAX_NEW_NULLIFIERS_PER_CALL) + MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL
148148
+ MAX_PUBLIC_CALL_STACK_LENGTH_PER_CALL + 1
@@ -170,7 +170,7 @@ library Constants {
170170
+ (SCOPED_READ_REQUEST_LEN * MAX_NOTE_HASH_READ_REQUESTS_PER_TX)
171171
+ (SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_READ_REQUESTS_PER_TX)
172172
+ (SCOPED_READ_REQUEST_LEN * MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX)
173-
+ (SCOPED_NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH * MAX_NULLIFIER_KEY_VALIDATION_REQUESTS_PER_TX)
173+
+ (SCOPED_NULLIFIER_KEY_VALIDATION_REQUEST_LENGTH * MAX_KEY_VALIDATION_REQUESTS_PER_TX)
174174
+ (PUBLIC_DATA_READ_LENGTH * MAX_PUBLIC_DATA_READS_PER_TX);
175175
uint256 internal constant PUBLIC_DATA_UPDATE_REQUEST_LENGTH = 2;
176176
uint256 internal constant COMBINED_ACCUMULATED_DATA_LENGTH = MAX_NEW_NOTE_HASHES_PER_TX

0 commit comments

Comments
 (0)