@aztec/stdlib 0.0.1-commit.8f9871590 → 0.0.1-commit.934299a21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/auth_witness/auth_witness.js +3 -3
- package/dest/block/block_data.d.ts +52 -0
- package/dest/block/block_data.d.ts.map +1 -0
- package/dest/block/block_data.js +12 -0
- package/dest/block/index.d.ts +2 -1
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -0
- package/dest/block/l2_block_source.d.ts +20 -1
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.d.ts +6 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +5 -4
- package/dest/checkpoint/checkpoint_data.d.ts +120 -0
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -0
- package/dest/checkpoint/checkpoint_data.js +26 -0
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/published_checkpoint.d.ts +11 -2
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +1 -2
- package/dest/config/sequencer-config.d.ts +2 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +6 -0
- package/dest/contract/contract_address.js +4 -4
- package/dest/contract/contract_class.d.ts +2 -3
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class_id.js +3 -3
- package/dest/contract/private_function.js +2 -2
- package/dest/file-store/local.d.ts +3 -3
- package/dest/file-store/local.d.ts.map +1 -1
- package/dest/file-store/local.js +13 -4
- package/dest/file-store/s3.d.ts +1 -1
- package/dest/file-store/s3.d.ts.map +1 -1
- package/dest/file-store/s3.js +11 -3
- package/dest/ha-signing/config.d.ts +101 -0
- package/dest/ha-signing/config.d.ts.map +1 -0
- package/dest/ha-signing/config.js +92 -0
- package/dest/ha-signing/index.d.ts +3 -0
- package/dest/ha-signing/index.d.ts.map +1 -0
- package/dest/ha-signing/index.js +2 -0
- package/dest/ha-signing/types.d.ts +85 -0
- package/dest/ha-signing/types.d.ts.map +1 -0
- package/dest/ha-signing/types.js +32 -0
- package/dest/hash/hash.js +11 -11
- package/dest/hash/map_slot.js +2 -2
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +5 -0
- package/dest/interfaces/aztec-node-admin.d.ts +30 -2
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +9 -3
- package/dest/interfaces/configs.d.ts +17 -2
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +4 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +2 -2
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +2 -2
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +13 -10
- package/dest/kernel/hints/build_transient_data_hints.d.ts +5 -2
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +9 -3
- package/dest/kernel/hints/index.d.ts +2 -2
- package/dest/kernel/hints/index.js +2 -2
- package/dest/kernel/hints/key_validation_request_and_separator.d.ts +24 -0
- package/dest/kernel/hints/key_validation_request_and_separator.d.ts.map +1 -0
- package/dest/kernel/hints/{key_validation_request_and_generator.js → key_validation_request_and_separator.js} +12 -15
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.d.ts → scoped_key_validation_request_and_separator.d.ts} +8 -8
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.d.ts.map → scoped_key_validation_request_and_separator.d.ts.map} +1 -1
- package/dest/kernel/hints/{scoped_key_validation_request_and_generator.js → scoped_key_validation_request_and_separator.js} +6 -6
- package/dest/kernel/private_circuit_public_inputs.d.ts +6 -6
- package/dest/kernel/private_circuit_public_inputs.js +11 -11
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +2 -2
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +2 -2
- package/dest/kernel/private_validation_requests.d.ts +3 -3
- package/dest/kernel/private_validation_requests.js +9 -9
- package/dest/keys/derivation.js +8 -8
- package/dest/keys/key_types.d.ts +3 -3
- package/dest/keys/key_types.d.ts.map +1 -1
- package/dest/keys/public_keys.js +2 -2
- package/dest/keys/utils.js +5 -5
- package/dest/logs/debug_log_store.d.ts +30 -0
- package/dest/logs/debug_log_store.d.ts.map +1 -0
- package/dest/logs/debug_log_store.js +30 -0
- package/dest/logs/index.d.ts +2 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +1 -0
- package/dest/logs/private_log.d.ts +2 -2
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.d.ts +11 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +45 -0
- package/dest/p2p/block_proposal.d.ts +2 -2
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +2 -4
- package/dest/p2p/checkpoint_proposal.d.ts +2 -2
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +1 -1
- package/dest/rollup/checkpoint_header.d.ts +2 -2
- package/dest/rollup/checkpoint_header.js +2 -2
- package/dest/tests/factories.js +10 -10
- package/dest/tests/mocks.d.ts +2 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +5 -5
- package/dest/tx/block_header.js +2 -2
- package/dest/tx/global_variables.d.ts +4 -4
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/profiling.d.ts +4 -4
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +3 -3
- package/dest/tx/protocol_contracts.d.ts +1 -1
- package/dest/tx/protocol_contracts.d.ts.map +1 -1
- package/dest/tx/protocol_contracts.js +2 -2
- package/dest/tx/public_simulation_output.d.ts +4 -2
- package/dest/tx/public_simulation_output.d.ts.map +1 -1
- package/dest/tx/public_simulation_output.js +7 -3
- package/dest/tx/tx_receipt.d.ts +16 -2
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +11 -3
- package/dest/tx/tx_request.js +2 -2
- package/package.json +9 -9
- package/src/auth_witness/auth_witness.ts +3 -3
- package/src/block/block_data.ts +26 -0
- package/src/block/index.ts +1 -0
- package/src/block/l2_block_source.ts +22 -0
- package/src/checkpoint/checkpoint.ts +5 -3
- package/src/checkpoint/checkpoint_data.ts +51 -0
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/published_checkpoint.ts +3 -1
- package/src/config/sequencer-config.ts +11 -1
- package/src/contract/contract_address.ts +4 -4
- package/src/contract/contract_class.ts +3 -3
- package/src/contract/contract_class_id.ts +3 -3
- package/src/contract/private_function.ts +2 -2
- package/src/file-store/local.ts +15 -5
- package/src/file-store/s3.ts +12 -3
- package/src/ha-signing/config.ts +149 -0
- package/src/ha-signing/index.ts +18 -0
- package/src/ha-signing/types.ts +112 -0
- package/src/hash/hash.ts +11 -11
- package/src/hash/map_slot.ts +2 -2
- package/src/interfaces/archiver.ts +5 -0
- package/src/interfaces/aztec-node-admin.ts +23 -0
- package/src/interfaces/configs.ts +12 -1
- package/src/interfaces/merkle_tree_operations.ts +1 -1
- package/src/interfaces/validator.ts +1 -1
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +14 -18
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +15 -18
- package/src/kernel/hints/build_transient_data_hints.ts +17 -2
- package/src/kernel/hints/index.ts +2 -2
- package/src/kernel/hints/{key_validation_request_and_generator.ts → key_validation_request_and_separator.ts} +12 -15
- package/src/kernel/hints/{scoped_key_validation_request_and_generator.ts → scoped_key_validation_request_and_separator.ts} +10 -10
- package/src/kernel/private_circuit_public_inputs.ts +10 -10
- package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +2 -2
- package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +2 -2
- package/src/kernel/private_validation_requests.ts +8 -8
- package/src/keys/derivation.ts +8 -8
- package/src/keys/key_types.ts +6 -2
- package/src/keys/public_keys.ts +2 -2
- package/src/keys/utils.ts +5 -5
- package/src/logs/debug_log_store.ts +54 -0
- package/src/logs/index.ts +1 -0
- package/src/p2p/attestation_utils.ts +56 -0
- package/src/p2p/block_proposal.ts +1 -3
- package/src/p2p/checkpoint_proposal.ts +1 -1
- package/src/rollup/checkpoint_header.ts +2 -2
- package/src/tests/factories.ts +11 -11
- package/src/tests/mocks.ts +7 -3
- package/src/tx/block_header.ts +2 -2
- package/src/tx/global_variables.ts +3 -3
- package/src/tx/profiling.ts +5 -5
- package/src/tx/protocol_contracts.ts +2 -2
- package/src/tx/public_simulation_output.ts +4 -0
- package/src/tx/tx_receipt.ts +10 -0
- package/src/tx/tx_request.ts +2 -2
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts +0 -30
- package/dest/kernel/hints/key_validation_request_and_generator.d.ts.map +0 -1
|
@@ -3,17 +3,19 @@ import { isValidNoteHashReadRequest } from './build_note_hash_read_request_hints
|
|
|
3
3
|
import { isValidNullifierReadRequest } from './build_nullifier_read_request_hints.js';
|
|
4
4
|
import { ScopedValueCache } from './scoped_value_cache.js';
|
|
5
5
|
import { TransientDataSquashingHint } from './transient_data_squashing_hint.js';
|
|
6
|
-
export function buildTransientDataHints(noteHashes, nullifiers, futureNoteHashReads, futureNullifierReads, noteHashNullifierCounterMap, splitCounter) {
|
|
6
|
+
export function buildTransientDataHints(noteHashes, nullifiers, futureNoteHashReads, futureNullifierReads, futureLogs, noteHashNullifierCounterMap, splitCounter) {
|
|
7
7
|
const futureNoteHashReadsMap = new ScopedValueCache(futureNoteHashReads);
|
|
8
8
|
const futureNullifierReadsMap = new ScopedValueCache(futureNullifierReads);
|
|
9
|
+
const futureLogNoteHashCounters = new Set(futureLogs.filter((l)=>l.noteHashCounter > 0).map((l)=>l.noteHashCounter));
|
|
9
10
|
const nullifierIndexMap = new Map();
|
|
10
11
|
nullifiers.getActiveItems().forEach((n, i)=>nullifierIndexMap.set(n.counter, i));
|
|
11
12
|
const hints = [];
|
|
12
13
|
for(let noteHashIndex = 0; noteHashIndex < noteHashes.claimedLength; noteHashIndex++){
|
|
13
14
|
const noteHash = noteHashes.array[noteHashIndex];
|
|
14
15
|
const noteHashNullifierCounter = noteHashNullifierCounterMap.get(noteHash.counter);
|
|
15
|
-
// The note hash might not be linked to a nullifier or it might be read in the future
|
|
16
|
-
|
|
16
|
+
// The note hash might not be linked to a nullifier, or it might be read in the future, or a future log might be
|
|
17
|
+
// linked to it.
|
|
18
|
+
if (!noteHashNullifierCounter || futureNoteHashReadsMap.get(noteHash).find((read)=>isValidNoteHashReadRequest(read, noteHash)) || futureLogNoteHashCounters.has(noteHash.counter)) {
|
|
17
19
|
continue;
|
|
18
20
|
}
|
|
19
21
|
const nullifierIndex = nullifierIndexMap.get(noteHashNullifierCounter);
|
|
@@ -48,3 +50,7 @@ export function buildTransientDataHints(noteHashes, nullifiers, futureNoteHashRe
|
|
|
48
50
|
hints: padArrayEnd(hints, noActionHint, nullifiers.array.length)
|
|
49
51
|
};
|
|
50
52
|
}
|
|
53
|
+
/** Counts private logs that are linked to squashed note hashes and would be removed along with them. */ export function countSquashedLogs(noteHashes, privateLogs, squashingHints) {
|
|
54
|
+
const squashedNoteHashCounters = new Set(squashingHints.map((h)=>noteHashes.array[h.noteHashIndex].counter));
|
|
55
|
+
return privateLogs.getActiveItems().filter((l)=>squashedNoteHashCounters.has(l.inner.noteHashCounter)).length;
|
|
56
|
+
}
|
|
@@ -6,10 +6,10 @@ export * from './note_hash_read_request_hints.js';
|
|
|
6
6
|
export * from './nullifier_read_request_hints.js';
|
|
7
7
|
export * from './read_request_hints.js';
|
|
8
8
|
export * from './key_validation_hint.js';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './key_validation_request_and_separator.js';
|
|
10
10
|
export * from './read_request.js';
|
|
11
11
|
export * from './key_validation_request.js';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './scoped_key_validation_request_and_separator.js';
|
|
13
13
|
export * from './transient_data_squashing_hint.js';
|
|
14
14
|
export * from './private_kernel_reset_hints.js';
|
|
15
15
|
export * from './tree_leaf_read_request.js';
|
|
@@ -6,10 +6,10 @@ export * from './note_hash_read_request_hints.js';
|
|
|
6
6
|
export * from './nullifier_read_request_hints.js';
|
|
7
7
|
export * from './read_request_hints.js';
|
|
8
8
|
export * from './key_validation_hint.js';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './key_validation_request_and_separator.js';
|
|
10
10
|
export * from './read_request.js';
|
|
11
11
|
export * from './key_validation_request.js';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './scoped_key_validation_request_and_separator.js';
|
|
13
13
|
export * from './transient_data_squashing_hint.js';
|
|
14
14
|
export * from './private_kernel_reset_hints.js';
|
|
15
15
|
export * from './tree_leaf_read_request.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
+
import { KeyValidationRequest } from './key_validation_request.js';
|
|
4
|
+
/**
|
|
5
|
+
* Request for validating keys used in the app, along with a domain separator for the key type.
|
|
6
|
+
*/
|
|
7
|
+
export declare class KeyValidationRequestAndSeparator {
|
|
8
|
+
/** The key validation request. */
|
|
9
|
+
readonly request: KeyValidationRequest;
|
|
10
|
+
/** Domain separator for the key type, used along with sk_m to derive the sk_app stored in the request. */
|
|
11
|
+
readonly keyTypeDomainSeparator: Fr;
|
|
12
|
+
constructor(
|
|
13
|
+
/** The key validation request. */
|
|
14
|
+
request: KeyValidationRequest,
|
|
15
|
+
/** Domain separator for the key type, used along with sk_m to derive the sk_app stored in the request. */
|
|
16
|
+
keyTypeDomainSeparator: Fr);
|
|
17
|
+
toBuffer(): Buffer<ArrayBufferLike>;
|
|
18
|
+
static fromBuffer(buffer: Buffer | BufferReader): KeyValidationRequestAndSeparator;
|
|
19
|
+
toFields(): Fr[];
|
|
20
|
+
static fromFields(fields: Fr[] | FieldReader): KeyValidationRequestAndSeparator;
|
|
21
|
+
isEmpty(): boolean;
|
|
22
|
+
static empty(): KeyValidationRequestAndSeparator;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5X3ZhbGlkYXRpb25fcmVxdWVzdF9hbmRfc2VwYXJhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMva2VybmVsL2hpbnRzL2tleV92YWxpZGF0aW9uX3JlcXVlc3RfYW5kX3NlcGFyYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLFlBQVksRUFBRSxXQUFXLEVBQXFCLE1BQU0sNkJBQTZCLENBQUM7QUFFM0YsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFbkU7O0dBRUc7QUFDSCxxQkFBYSxnQ0FBZ0M7SUFFekMsa0NBQWtDO2FBQ2xCLE9BQU8sRUFBRSxvQkFBb0I7SUFDN0MsMEdBQTBHO2FBQzFGLHNCQUFzQixFQUFFLEVBQUU7SUFKNUM7SUFDRSxrQ0FBa0M7SUFDbEIsT0FBTyxFQUFFLG9CQUFvQjtJQUM3QywwR0FBMEc7SUFDMUYsc0JBQXNCLEVBQUUsRUFBRSxFQUN4QztJQUVKLFFBQVEsNEJBRVA7SUFFRCxNQUFNLENBQUMsVUFBVSxDQUFDLE1BQU0sRUFBRSxNQUFNLEdBQUcsWUFBWSxvQ0FHOUM7SUFFRCxRQUFRLElBQUksRUFBRSxFQUFFLENBUWY7SUFFRCxNQUFNLENBQUMsVUFBVSxDQUFDLE1BQU0sRUFBRSxFQUFFLEVBQUUsR0FBRyxXQUFXLEdBQUcsZ0NBQWdDLENBRzlFO0lBRUQsT0FBTyxZQUVOO0lBRUQsTUFBTSxDQUFDLEtBQUsscUNBRVg7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key_validation_request_and_separator.d.ts","sourceRoot":"","sources":["../../../src/kernel/hints/key_validation_request_and_separator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAE3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;GAEG;AACH,qBAAa,gCAAgC;IAEzC,kCAAkC;aAClB,OAAO,EAAE,oBAAoB;IAC7C,0GAA0G;aAC1F,sBAAsB,EAAE,EAAE;IAJ5C;IACE,kCAAkC;IAClB,OAAO,EAAE,oBAAoB;IAC7C,0GAA0G;IAC1F,sBAAsB,EAAE,EAAE,EACxC;IAEJ,QAAQ,4BAEP;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,oCAG9C;IAED,QAAQ,IAAI,EAAE,EAAE,CAQf;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,gCAAgC,CAG9E;IAED,OAAO,YAEN;IAED,MAAM,CAAC,KAAK,qCAEX;CACF"}
|
|
@@ -3,42 +3,39 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
4
|
import { KeyValidationRequest } from './key_validation_request.js';
|
|
5
5
|
/**
|
|
6
|
-
* Request for validating keys used in the app
|
|
7
|
-
*/ export class
|
|
6
|
+
* Request for validating keys used in the app, along with a domain separator for the key type.
|
|
7
|
+
*/ export class KeyValidationRequestAndSeparator {
|
|
8
8
|
request;
|
|
9
|
-
|
|
10
|
-
constructor(/** The key validation request. */ request, /**
|
|
11
|
-
* The generator index which can be used along with sk_m to derive the sk_app stored in the request.
|
|
12
|
-
* Note: This generator constrains that a correct key type gets validated in the kernel.
|
|
13
|
-
*/ skAppGenerator){
|
|
9
|
+
keyTypeDomainSeparator;
|
|
10
|
+
constructor(/** The key validation request. */ request, /** Domain separator for the key type, used along with sk_m to derive the sk_app stored in the request. */ keyTypeDomainSeparator){
|
|
14
11
|
this.request = request;
|
|
15
|
-
this.
|
|
12
|
+
this.keyTypeDomainSeparator = keyTypeDomainSeparator;
|
|
16
13
|
}
|
|
17
14
|
toBuffer() {
|
|
18
|
-
return serializeToBuffer(this.request, this.
|
|
15
|
+
return serializeToBuffer(this.request, this.keyTypeDomainSeparator);
|
|
19
16
|
}
|
|
20
17
|
static fromBuffer(buffer) {
|
|
21
18
|
const reader = BufferReader.asReader(buffer);
|
|
22
|
-
return new
|
|
19
|
+
return new KeyValidationRequestAndSeparator(reader.readObject(KeyValidationRequest), Fr.fromBuffer(reader));
|
|
23
20
|
}
|
|
24
21
|
toFields() {
|
|
25
22
|
const fields = [
|
|
26
23
|
...this.request.toFields(),
|
|
27
|
-
this.
|
|
24
|
+
this.keyTypeDomainSeparator
|
|
28
25
|
];
|
|
29
26
|
if (fields.length !== KEY_VALIDATION_REQUEST_AND_GENERATOR_LENGTH) {
|
|
30
|
-
throw new Error(`Invalid number of fields for
|
|
27
|
+
throw new Error(`Invalid number of fields for KeyValidationRequestAndSeparator. Expected ${KEY_VALIDATION_REQUEST_AND_GENERATOR_LENGTH}, got ${fields.length}`);
|
|
31
28
|
}
|
|
32
29
|
return fields;
|
|
33
30
|
}
|
|
34
31
|
static fromFields(fields) {
|
|
35
32
|
const reader = FieldReader.asReader(fields);
|
|
36
|
-
return new
|
|
33
|
+
return new KeyValidationRequestAndSeparator(KeyValidationRequest.fromFields(reader), reader.readField());
|
|
37
34
|
}
|
|
38
35
|
isEmpty() {
|
|
39
|
-
return this.request.isEmpty() && this.
|
|
36
|
+
return this.request.isEmpty() && this.keyTypeDomainSeparator.isZero();
|
|
40
37
|
}
|
|
41
38
|
static empty() {
|
|
42
|
-
return new
|
|
39
|
+
return new KeyValidationRequestAndSeparator(KeyValidationRequest.empty(), Fr.ZERO);
|
|
43
40
|
}
|
|
44
41
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AztecAddress } from '../../aztec-address/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { KeyValidationRequestAndSeparator } from './key_validation_request_and_separator.js';
|
|
5
5
|
/**
|
|
6
6
|
* Request for validating keys used in the app.
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
9
|
-
readonly request:
|
|
8
|
+
export declare class ScopedKeyValidationRequestAndSeparator {
|
|
9
|
+
readonly request: KeyValidationRequestAndSeparator;
|
|
10
10
|
readonly contractAddress: AztecAddress;
|
|
11
|
-
constructor(request:
|
|
11
|
+
constructor(request: KeyValidationRequestAndSeparator, contractAddress: AztecAddress);
|
|
12
12
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
13
|
-
static fromBuffer(buffer: Buffer | BufferReader):
|
|
13
|
+
static fromBuffer(buffer: Buffer | BufferReader): ScopedKeyValidationRequestAndSeparator;
|
|
14
14
|
toFields(): Fr[];
|
|
15
|
-
static fromFields(fields: Fr[] | FieldReader):
|
|
15
|
+
static fromFields(fields: Fr[] | FieldReader): ScopedKeyValidationRequestAndSeparator;
|
|
16
16
|
isEmpty(): boolean;
|
|
17
|
-
static empty():
|
|
17
|
+
static empty(): ScopedKeyValidationRequestAndSeparator;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NvcGVkX2tleV92YWxpZGF0aW9uX3JlcXVlc3RfYW5kX3NlcGFyYXRvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2tlcm5lbC9oaW50cy9zY29wZWRfa2V5X3ZhbGlkYXRpb25fcmVxdWVzdF9hbmRfc2VwYXJhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3pELE9BQU8sRUFBRSxZQUFZLEVBQUUsV0FBVyxFQUFxQixNQUFNLDZCQUE2QixDQUFDO0FBRTNGLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUM1RCxPQUFPLEVBQUUsZ0NBQWdDLEVBQUUsTUFBTSwyQ0FBMkMsQ0FBQztBQUU3Rjs7R0FFRztBQUNILHFCQUFhLHNDQUFzQzthQUUvQixPQUFPLEVBQUUsZ0NBQWdDO2FBQ3pDLGVBQWUsRUFBRSxZQUFZO0lBRi9DLFlBQ2tCLE9BQU8sRUFBRSxnQ0FBZ0MsRUFDekMsZUFBZSxFQUFFLFlBQVksRUFDM0M7SUFFSixRQUFRLDRCQUVQO0lBRUQsTUFBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLFlBQVksMENBTTlDO0lBRUQsUUFBUSxJQUFJLEVBQUUsRUFBRSxDQVFmO0lBRUQsTUFBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLEVBQUUsRUFBRSxFQUFFLEdBQUcsV0FBVyxHQUFHLHNDQUFzQyxDQU1wRjtJQUVELE9BQU8sWUFFTjtJQUVELE1BQU0sQ0FBQyxLQUFLLDJDQUVYO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"scoped_key_validation_request_and_separator.d.ts","sourceRoot":"","sources":["../../../src/kernel/hints/scoped_key_validation_request_and_separator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,2CAA2C,CAAC;AAE7F;;GAEG;AACH,qBAAa,sCAAsC;aAE/B,OAAO,EAAE,gCAAgC;aACzC,eAAe,EAAE,YAAY;IAF/C,YACkB,OAAO,EAAE,gCAAgC,EACzC,eAAe,EAAE,YAAY,EAC3C;IAEJ,QAAQ,4BAEP;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,0CAM9C;IAED,QAAQ,IAAI,EAAE,EAAE,CAQf;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,sCAAsC,CAMpF;IAED,OAAO,YAEN;IAED,MAAM,CAAC,KAAK,2CAEX;CACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SCOPED_KEY_VALIDATION_REQUEST_AND_GENERATOR_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AztecAddress } from '../../aztec-address/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { KeyValidationRequestAndSeparator } from './key_validation_request_and_separator.js';
|
|
5
5
|
/**
|
|
6
6
|
* Request for validating keys used in the app.
|
|
7
|
-
*/ export class
|
|
7
|
+
*/ export class ScopedKeyValidationRequestAndSeparator {
|
|
8
8
|
request;
|
|
9
9
|
contractAddress;
|
|
10
10
|
constructor(request, contractAddress){
|
|
@@ -16,7 +16,7 @@ import { KeyValidationRequestAndGenerator } from './key_validation_request_and_g
|
|
|
16
16
|
}
|
|
17
17
|
static fromBuffer(buffer) {
|
|
18
18
|
const reader = BufferReader.asReader(buffer);
|
|
19
|
-
return new
|
|
19
|
+
return new ScopedKeyValidationRequestAndSeparator(KeyValidationRequestAndSeparator.fromBuffer(reader), AztecAddress.fromBuffer(reader));
|
|
20
20
|
}
|
|
21
21
|
toFields() {
|
|
22
22
|
const fields = [
|
|
@@ -24,18 +24,18 @@ import { KeyValidationRequestAndGenerator } from './key_validation_request_and_g
|
|
|
24
24
|
this.contractAddress.toField()
|
|
25
25
|
];
|
|
26
26
|
if (fields.length !== SCOPED_KEY_VALIDATION_REQUEST_AND_GENERATOR_LENGTH) {
|
|
27
|
-
throw new Error(`Invalid number of fields for
|
|
27
|
+
throw new Error(`Invalid number of fields for ScopedKeyValidationRequestAndSeparator. Expected ${SCOPED_KEY_VALIDATION_REQUEST_AND_GENERATOR_LENGTH}, got ${fields.length}`);
|
|
28
28
|
}
|
|
29
29
|
return fields;
|
|
30
30
|
}
|
|
31
31
|
static fromFields(fields) {
|
|
32
32
|
const reader = FieldReader.asReader(fields);
|
|
33
|
-
return new
|
|
33
|
+
return new ScopedKeyValidationRequestAndSeparator(KeyValidationRequestAndSeparator.fromFields(reader), AztecAddress.fromFields(reader));
|
|
34
34
|
}
|
|
35
35
|
isEmpty() {
|
|
36
36
|
return this.request.isEmpty() && this.contractAddress.isZero();
|
|
37
37
|
}
|
|
38
38
|
static empty() {
|
|
39
|
-
return new
|
|
39
|
+
return new ScopedKeyValidationRequestAndSeparator(KeyValidationRequestAndSeparator.empty(), AztecAddress.ZERO);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -2,7 +2,7 @@ import { MAX_CONTRACT_CLASS_LOGS_PER_CALL, MAX_ENQUEUED_CALLS_PER_CALL, MAX_KEY_
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
4
4
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
|
-
import {
|
|
5
|
+
import { KeyValidationRequestAndSeparator } from '../kernel/hints/key_validation_request_and_separator.js';
|
|
6
6
|
import { CountedLogHash } from '../kernel/log_hash.js';
|
|
7
7
|
import { PrivateCallRequest } from '../kernel/private_call_request.js';
|
|
8
8
|
import { PrivateLogData } from '../kernel/private_log_data.js';
|
|
@@ -81,9 +81,9 @@ export declare class PrivateCircuitPublicInputs {
|
|
|
81
81
|
*/
|
|
82
82
|
nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_CALL>;
|
|
83
83
|
/**
|
|
84
|
-
* Key validation requests and
|
|
84
|
+
* Key validation requests and separators created by the corresponding function call.
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
keyValidationRequestsAndSeparators: ClaimedLengthArray<KeyValidationRequestAndSeparator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_CALL>;
|
|
87
87
|
/**
|
|
88
88
|
* Private call requests made within the current kernel iteration.
|
|
89
89
|
*/
|
|
@@ -178,9 +178,9 @@ export declare class PrivateCircuitPublicInputs {
|
|
|
178
178
|
*/
|
|
179
179
|
nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_CALL>,
|
|
180
180
|
/**
|
|
181
|
-
* Key validation requests and
|
|
181
|
+
* Key validation requests and separators created by the corresponding function call.
|
|
182
182
|
*/
|
|
183
|
-
|
|
183
|
+
keyValidationRequestsAndSeparators: ClaimedLengthArray<KeyValidationRequestAndSeparator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_CALL>,
|
|
184
184
|
/**
|
|
185
185
|
* Private call requests made within the current kernel iteration.
|
|
186
186
|
*/
|
|
@@ -237,7 +237,7 @@ export declare class PrivateCircuitPublicInputs {
|
|
|
237
237
|
* @param fields - Object with fields.
|
|
238
238
|
* @returns The array.
|
|
239
239
|
*/
|
|
240
|
-
static getFields(fields: FieldsOf<PrivateCircuitPublicInputs>): readonly [CallContext, Fr, Fr, BlockHeader, TxContext, Fr, boolean, bigint, Fr, Fr, Fr, Fr, ClaimedLengthArray<ScopedReadRequest, 16>, ClaimedLengthArray<ScopedReadRequest, 16>, ClaimedLengthArray<
|
|
240
|
+
static getFields(fields: FieldsOf<PrivateCircuitPublicInputs>): readonly [CallContext, Fr, Fr, BlockHeader, TxContext, Fr, boolean, bigint, Fr, Fr, Fr, Fr, ClaimedLengthArray<ScopedReadRequest, 16>, ClaimedLengthArray<ScopedReadRequest, 16>, ClaimedLengthArray<KeyValidationRequestAndSeparator, 16>, ClaimedLengthArray<PrivateCallRequest, 8>, ClaimedLengthArray<CountedPublicCallRequest, 32>, PublicCallRequest, ClaimedLengthArray<NoteHash, 16>, ClaimedLengthArray<Nullifier, 16>, ClaimedLengthArray<CountedL2ToL1Message, 8>, ClaimedLengthArray<PrivateLogData, 16>, ClaimedLengthArray<CountedLogHash, 1>];
|
|
241
241
|
/**
|
|
242
242
|
* Serialize this as a buffer.
|
|
243
243
|
* @returns The buffer.
|
|
@@ -2,7 +2,7 @@ import { MAX_CONTRACT_CLASS_LOGS_PER_CALL, MAX_ENQUEUED_CALLS_PER_CALL, MAX_KEY_
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
4
4
|
import { BufferReader, FieldReader, bigintToUInt64BE, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
5
|
-
import {
|
|
5
|
+
import { KeyValidationRequestAndSeparator } from '../kernel/hints/key_validation_request_and_separator.js';
|
|
6
6
|
import { CountedLogHash } from '../kernel/log_hash.js';
|
|
7
7
|
import { PrivateCallRequest } from '../kernel/private_call_request.js';
|
|
8
8
|
import { PrivateLogData } from '../kernel/private_log_data.js';
|
|
@@ -32,7 +32,7 @@ import { CountedPublicCallRequest, PublicCallRequest } from './public_call_reque
|
|
|
32
32
|
expectedRevertibleSideEffectCounter;
|
|
33
33
|
noteHashReadRequests;
|
|
34
34
|
nullifierReadRequests;
|
|
35
|
-
|
|
35
|
+
keyValidationRequestsAndSeparators;
|
|
36
36
|
privateCallRequests;
|
|
37
37
|
publicCallRequests;
|
|
38
38
|
publicTeardownCallRequest;
|
|
@@ -74,8 +74,8 @@ import { CountedPublicCallRequest, PublicCallRequest } from './public_call_reque
|
|
|
74
74
|
*/ noteHashReadRequests, /**
|
|
75
75
|
* Nullifier read requests created by the corresponding function call.
|
|
76
76
|
*/ nullifierReadRequests, /**
|
|
77
|
-
* Key validation requests and
|
|
78
|
-
*/
|
|
77
|
+
* Key validation requests and separators created by the corresponding function call.
|
|
78
|
+
*/ keyValidationRequestsAndSeparators, /**
|
|
79
79
|
* Private call requests made within the current kernel iteration.
|
|
80
80
|
*/ privateCallRequests, /**
|
|
81
81
|
* Public call stack at the current kernel iteration.
|
|
@@ -106,7 +106,7 @@ import { CountedPublicCallRequest, PublicCallRequest } from './public_call_reque
|
|
|
106
106
|
this.expectedRevertibleSideEffectCounter = expectedRevertibleSideEffectCounter;
|
|
107
107
|
this.noteHashReadRequests = noteHashReadRequests;
|
|
108
108
|
this.nullifierReadRequests = nullifierReadRequests;
|
|
109
|
-
this.
|
|
109
|
+
this.keyValidationRequestsAndSeparators = keyValidationRequestsAndSeparators;
|
|
110
110
|
this.privateCallRequests = privateCallRequests;
|
|
111
111
|
this.publicCallRequests = publicCallRequests;
|
|
112
112
|
this.publicTeardownCallRequest = publicTeardownCallRequest;
|
|
@@ -129,20 +129,20 @@ import { CountedPublicCallRequest, PublicCallRequest } from './public_call_reque
|
|
|
129
129
|
* @returns The deserialized instance.
|
|
130
130
|
*/ static fromBuffer(buffer) {
|
|
131
131
|
const reader = BufferReader.asReader(buffer);
|
|
132
|
-
return new PrivateCircuitPublicInputs(reader.readObject(CallContext), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(BlockHeader), reader.readObject(TxContext), reader.readObject(Fr), reader.readBoolean(), reader.readUInt64(), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(
|
|
132
|
+
return new PrivateCircuitPublicInputs(reader.readObject(CallContext), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(BlockHeader), reader.readObject(TxContext), reader.readObject(Fr), reader.readBoolean(), reader.readUInt64(), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(KeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(PrivateCallRequest, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(CountedPublicCallRequest, MAX_ENQUEUED_CALLS_PER_CALL)), reader.readObject(PublicCallRequest), reader.readObject(ClaimedLengthArrayFromBuffer(NoteHash, MAX_NOTE_HASHES_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(Nullifier, MAX_NULLIFIERS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromBuffer(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL)));
|
|
133
133
|
}
|
|
134
134
|
static fromFields(fields) {
|
|
135
135
|
const reader = FieldReader.asReader(fields);
|
|
136
|
-
return new PrivateCircuitPublicInputs(reader.readObject(CallContext), reader.readField(), reader.readField(), reader.readObject(BlockHeader), reader.readObject(TxContext), reader.readField(), reader.readBoolean(), reader.readU64(), reader.readField(), reader.readField(), reader.readField(), reader.readField(), reader.readObject(ClaimedLengthArrayFromFields(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(
|
|
136
|
+
return new PrivateCircuitPublicInputs(reader.readObject(CallContext), reader.readField(), reader.readField(), reader.readObject(BlockHeader), reader.readObject(TxContext), reader.readField(), reader.readBoolean(), reader.readU64(), reader.readField(), reader.readField(), reader.readField(), reader.readField(), reader.readObject(ClaimedLengthArrayFromFields(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(KeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(PrivateCallRequest, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(CountedPublicCallRequest, MAX_ENQUEUED_CALLS_PER_CALL)), reader.readObject(PublicCallRequest), reader.readObject(ClaimedLengthArrayFromFields(NoteHash, MAX_NOTE_HASHES_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(Nullifier, MAX_NULLIFIERS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL)), reader.readObject(ClaimedLengthArrayFromFields(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL)));
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Create an empty PrivateCircuitPublicInputs.
|
|
140
140
|
* @returns An empty PrivateCircuitPublicInputs object.
|
|
141
141
|
*/ static empty() {
|
|
142
|
-
return new PrivateCircuitPublicInputs(CallContext.empty(), Fr.ZERO, Fr.ZERO, BlockHeader.empty(), TxContext.empty(), Fr.ZERO, false, 0n, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO, ClaimedLengthArray.empty(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL), ClaimedLengthArray.empty(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL), ClaimedLengthArray.empty(
|
|
142
|
+
return new PrivateCircuitPublicInputs(CallContext.empty(), Fr.ZERO, Fr.ZERO, BlockHeader.empty(), TxContext.empty(), Fr.ZERO, false, 0n, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO, ClaimedLengthArray.empty(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL), ClaimedLengthArray.empty(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL), ClaimedLengthArray.empty(KeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL), ClaimedLengthArray.empty(PrivateCallRequest, MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL), ClaimedLengthArray.empty(CountedPublicCallRequest, MAX_ENQUEUED_CALLS_PER_CALL), PublicCallRequest.empty(), ClaimedLengthArray.empty(NoteHash, MAX_NOTE_HASHES_PER_CALL), ClaimedLengthArray.empty(Nullifier, MAX_NULLIFIERS_PER_CALL), ClaimedLengthArray.empty(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL), ClaimedLengthArray.empty(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL), ClaimedLengthArray.empty(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL));
|
|
143
143
|
}
|
|
144
144
|
isEmpty() {
|
|
145
|
-
return this.callContext.isEmpty() && this.argsHash.isZero() && this.returnsHash.isZero() && this.anchorBlockHeader.isEmpty() && this.txContext.isEmpty() && this.minRevertibleSideEffectCounter.isZero() && !this.isFeePayer && !this.expirationTimestamp && this.startSideEffectCounter.isZero() && this.endSideEffectCounter.isZero() && this.expectedNonRevertibleSideEffectCounter.isZero() && this.expectedRevertibleSideEffectCounter.isZero() && this.noteHashReadRequests.isEmpty() && this.nullifierReadRequests.isEmpty() && this.
|
|
145
|
+
return this.callContext.isEmpty() && this.argsHash.isZero() && this.returnsHash.isZero() && this.anchorBlockHeader.isEmpty() && this.txContext.isEmpty() && this.minRevertibleSideEffectCounter.isZero() && !this.isFeePayer && !this.expirationTimestamp && this.startSideEffectCounter.isZero() && this.endSideEffectCounter.isZero() && this.expectedNonRevertibleSideEffectCounter.isZero() && this.expectedRevertibleSideEffectCounter.isZero() && this.noteHashReadRequests.isEmpty() && this.nullifierReadRequests.isEmpty() && this.keyValidationRequestsAndSeparators.isEmpty() && this.privateCallRequests.isEmpty() && this.publicCallRequests.isEmpty() && this.publicTeardownCallRequest.isEmpty() && this.noteHashes.isEmpty() && this.nullifiers.isEmpty() && this.l2ToL1Msgs.isEmpty() && this.privateLogs.isEmpty() && this.contractClassLogsHashes.isEmpty();
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Serialize into a field array. Low-level utility.
|
|
@@ -164,7 +164,7 @@ import { CountedPublicCallRequest, PublicCallRequest } from './public_call_reque
|
|
|
164
164
|
fields.expectedRevertibleSideEffectCounter,
|
|
165
165
|
fields.noteHashReadRequests,
|
|
166
166
|
fields.nullifierReadRequests,
|
|
167
|
-
fields.
|
|
167
|
+
fields.keyValidationRequestsAndSeparators,
|
|
168
168
|
fields.privateCallRequests,
|
|
169
169
|
fields.publicCallRequests,
|
|
170
170
|
fields.publicTeardownCallRequest,
|
|
@@ -196,7 +196,7 @@ import { CountedPublicCallRequest, PublicCallRequest } from './public_call_reque
|
|
|
196
196
|
this.expectedRevertibleSideEffectCounter,
|
|
197
197
|
this.noteHashReadRequests,
|
|
198
198
|
this.nullifierReadRequests,
|
|
199
|
-
this.
|
|
199
|
+
this.keyValidationRequestsAndSeparators,
|
|
200
200
|
this.privateCallRequests,
|
|
201
201
|
this.publicCallRequests,
|
|
202
202
|
this.publicTeardownCallRequest,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainSeparator, PRIVATE_TO_PUBLIC_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
3
3
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
4
4
|
import { BufferReader, bigintToUInt64BE, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
@@ -60,7 +60,7 @@ export class PrivateToPublicKernelCircuitPublicInputs {
|
|
|
60
60
|
return fields;
|
|
61
61
|
}
|
|
62
62
|
hash() {
|
|
63
|
-
return poseidon2HashWithSeparator(this.toFields(),
|
|
63
|
+
return poseidon2HashWithSeparator(this.toFields(), DomainSeparator.PUBLIC_TX_HASH);
|
|
64
64
|
}
|
|
65
65
|
toJSON() {
|
|
66
66
|
return this.toBuffer();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainSeparator, PRIVATE_TO_ROLLUP_KERNEL_CIRCUIT_PUBLIC_INPUTS_LENGTH } from '@aztec/constants';
|
|
2
2
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
3
3
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
4
4
|
import { BufferReader, bigintToUInt64BE, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
@@ -79,6 +79,6 @@ import { PrivateToRollupAccumulatedData } from './private_to_rollup_accumulated_
|
|
|
79
79
|
return fields;
|
|
80
80
|
}
|
|
81
81
|
hash() {
|
|
82
|
-
return poseidon2HashWithSeparator(this.toFields(),
|
|
82
|
+
return poseidon2HashWithSeparator(this.toFields(), DomainSeparator.PRIVATE_TX_HASH);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '@aztec/constants';
|
|
2
2
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { inspect } from 'util';
|
|
4
|
-
import {
|
|
4
|
+
import { ScopedKeyValidationRequestAndSeparator } from '../kernel/hints/scoped_key_validation_request_and_separator.js';
|
|
5
5
|
import { ClaimedLengthArray } from './claimed_length_array.js';
|
|
6
6
|
import { ScopedReadRequest } from './hints/read_request.js';
|
|
7
7
|
/**
|
|
@@ -19,7 +19,7 @@ export declare class PrivateValidationRequests {
|
|
|
19
19
|
/**
|
|
20
20
|
* All the key validation requests made in this transaction.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
scopedKeyValidationRequestsAndSeparators: ClaimedLengthArray<ScopedKeyValidationRequestAndSeparator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX>;
|
|
23
23
|
constructor(
|
|
24
24
|
/**
|
|
25
25
|
* All the read requests made in this transaction.
|
|
@@ -32,7 +32,7 @@ export declare class PrivateValidationRequests {
|
|
|
32
32
|
/**
|
|
33
33
|
* All the key validation requests made in this transaction.
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
scopedKeyValidationRequestsAndSeparators: ClaimedLengthArray<ScopedKeyValidationRequestAndSeparator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX>);
|
|
36
36
|
getSize(): number;
|
|
37
37
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
38
38
|
toString(): `0x${string}`;
|
|
@@ -3,7 +3,7 @@ import { MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
|
|
|
3
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
4
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
5
5
|
import { inspect } from 'util';
|
|
6
|
-
import {
|
|
6
|
+
import { ScopedKeyValidationRequestAndSeparator } from '../kernel/hints/scoped_key_validation_request_and_separator.js';
|
|
7
7
|
import { ClaimedLengthArray, ClaimedLengthArrayFromBuffer } from './claimed_length_array.js';
|
|
8
8
|
import { ScopedReadRequest } from './hints/read_request.js';
|
|
9
9
|
_computedKey = inspect.custom;
|
|
@@ -12,23 +12,23 @@ _computedKey = inspect.custom;
|
|
|
12
12
|
*/ export class PrivateValidationRequests {
|
|
13
13
|
noteHashReadRequests;
|
|
14
14
|
nullifierReadRequests;
|
|
15
|
-
|
|
15
|
+
scopedKeyValidationRequestsAndSeparators;
|
|
16
16
|
constructor(/**
|
|
17
17
|
* All the read requests made in this transaction.
|
|
18
18
|
*/ noteHashReadRequests, /**
|
|
19
19
|
* All the nullifier read requests made in this transaction.
|
|
20
20
|
*/ nullifierReadRequests, /**
|
|
21
21
|
* All the key validation requests made in this transaction.
|
|
22
|
-
*/
|
|
22
|
+
*/ scopedKeyValidationRequestsAndSeparators){
|
|
23
23
|
this.noteHashReadRequests = noteHashReadRequests;
|
|
24
24
|
this.nullifierReadRequests = nullifierReadRequests;
|
|
25
|
-
this.
|
|
25
|
+
this.scopedKeyValidationRequestsAndSeparators = scopedKeyValidationRequestsAndSeparators;
|
|
26
26
|
}
|
|
27
27
|
getSize() {
|
|
28
|
-
return this.noteHashReadRequests.getSize() + this.nullifierReadRequests.getSize() + this.
|
|
28
|
+
return this.noteHashReadRequests.getSize() + this.nullifierReadRequests.getSize() + this.scopedKeyValidationRequestsAndSeparators.getSize();
|
|
29
29
|
}
|
|
30
30
|
toBuffer() {
|
|
31
|
-
return serializeToBuffer(this.noteHashReadRequests, this.nullifierReadRequests, this.
|
|
31
|
+
return serializeToBuffer(this.noteHashReadRequests, this.nullifierReadRequests, this.scopedKeyValidationRequestsAndSeparators);
|
|
32
32
|
}
|
|
33
33
|
toString() {
|
|
34
34
|
return bufferToHex(this.toBuffer());
|
|
@@ -39,7 +39,7 @@ _computedKey = inspect.custom;
|
|
|
39
39
|
* @returns Deserialized object.
|
|
40
40
|
*/ static fromBuffer(buffer) {
|
|
41
41
|
const reader = BufferReader.asReader(buffer);
|
|
42
|
-
return new PrivateValidationRequests(reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX)), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX)), reader.readObject(ClaimedLengthArrayFromBuffer(
|
|
42
|
+
return new PrivateValidationRequests(reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX)), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX)), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedKeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_TX)));
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Deserializes from a string, corresponding to a write in cpp.
|
|
@@ -49,13 +49,13 @@ _computedKey = inspect.custom;
|
|
|
49
49
|
return PrivateValidationRequests.fromBuffer(hexToBuffer(str));
|
|
50
50
|
}
|
|
51
51
|
static empty() {
|
|
52
|
-
return new PrivateValidationRequests(ClaimedLengthArray.empty(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX), ClaimedLengthArray.empty(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX), ClaimedLengthArray.empty(
|
|
52
|
+
return new PrivateValidationRequests(ClaimedLengthArray.empty(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX), ClaimedLengthArray.empty(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX), ClaimedLengthArray.empty(ScopedKeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_TX));
|
|
53
53
|
}
|
|
54
54
|
[_computedKey]() {
|
|
55
55
|
return `PrivateValidationRequests {
|
|
56
56
|
noteHashReadRequests: ${inspect(this.noteHashReadRequests)},
|
|
57
57
|
nullifierReadRequests: ${inspect(this.nullifierReadRequests)},
|
|
58
|
-
|
|
58
|
+
scopedKeyValidationRequestsAndSeparators: ${inspect(this.scopedKeyValidationRequestsAndSeparators)},
|
|
59
59
|
`;
|
|
60
60
|
}
|
|
61
61
|
}
|
package/dest/keys/derivation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainSeparator } from '@aztec/constants';
|
|
2
2
|
import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
|
|
3
3
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
4
4
|
import { sha512ToGrumpkinScalar } from '@aztec/foundation/crypto/sha512';
|
|
@@ -27,37 +27,37 @@ export async function computeOvskApp(ovsk, app) {
|
|
|
27
27
|
export function deriveMasterNullifierHidingKey(secretKey) {
|
|
28
28
|
return sha512ToGrumpkinScalar([
|
|
29
29
|
secretKey,
|
|
30
|
-
|
|
30
|
+
DomainSeparator.NHK_M
|
|
31
31
|
]);
|
|
32
32
|
}
|
|
33
33
|
export function deriveMasterIncomingViewingSecretKey(secretKey) {
|
|
34
34
|
return sha512ToGrumpkinScalar([
|
|
35
35
|
secretKey,
|
|
36
|
-
|
|
36
|
+
DomainSeparator.IVSK_M
|
|
37
37
|
]);
|
|
38
38
|
}
|
|
39
39
|
export function deriveMasterOutgoingViewingSecretKey(secretKey) {
|
|
40
40
|
return sha512ToGrumpkinScalar([
|
|
41
41
|
secretKey,
|
|
42
|
-
|
|
42
|
+
DomainSeparator.OVSK_M
|
|
43
43
|
]);
|
|
44
44
|
}
|
|
45
45
|
export function deriveSigningKey(secretKey) {
|
|
46
46
|
// TODO(#5837): come up with a standard signing key derivation scheme instead of using ivsk_m as signing keys here
|
|
47
47
|
return sha512ToGrumpkinScalar([
|
|
48
48
|
secretKey,
|
|
49
|
-
|
|
49
|
+
DomainSeparator.IVSK_M
|
|
50
50
|
]);
|
|
51
51
|
}
|
|
52
52
|
export function computePreaddress(publicKeysHash, partialAddress) {
|
|
53
53
|
return poseidon2HashWithSeparator([
|
|
54
54
|
publicKeysHash,
|
|
55
55
|
partialAddress
|
|
56
|
-
],
|
|
56
|
+
], DomainSeparator.CONTRACT_ADDRESS_V1);
|
|
57
57
|
}
|
|
58
58
|
export async function computeAddress(publicKeys, partialAddress) {
|
|
59
59
|
// Given public keys and a partial address, we can compute our address in the following steps.
|
|
60
|
-
// 1. preaddress = poseidon2([publicKeysHash, partialAddress],
|
|
60
|
+
// 1. preaddress = poseidon2([publicKeysHash, partialAddress], DomainSeparator.CONTRACT_ADDRESS_V1);
|
|
61
61
|
// 2. addressPoint = (preaddress * G) + ivpk_m
|
|
62
62
|
// 3. address = addressPoint.x
|
|
63
63
|
const preaddress = await computePreaddress(await publicKeys.hash(), partialAddress);
|
|
@@ -98,7 +98,7 @@ export function derivePublicKeyFromSecretKey(secretKey) {
|
|
|
98
98
|
const masterOutgoingViewingSecretKey = deriveMasterOutgoingViewingSecretKey(secretKey);
|
|
99
99
|
const masterTaggingSecretKey = sha512ToGrumpkinScalar([
|
|
100
100
|
secretKey,
|
|
101
|
-
|
|
101
|
+
DomainSeparator.TSK_M
|
|
102
102
|
]);
|
|
103
103
|
// Then we derive master public keys
|
|
104
104
|
const masterNullifierPublicKey = await derivePublicKeyFromSecretKey(masterNullifierHidingKey);
|
package/dest/keys/key_types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type KeyGenerator =
|
|
1
|
+
import type { DomainSeparator } from '@aztec/constants';
|
|
2
|
+
export type KeyGenerator = DomainSeparator.NHK_M | DomainSeparator.IVSK_M | DomainSeparator.OVSK_M | DomainSeparator.TSK_M;
|
|
3
3
|
export type KeyPrefix = 'n' | 'iv' | 'ov' | 't';
|
|
4
4
|
export declare const KEY_PREFIXES: KeyPrefix[];
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5X3R5cGVzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMva2V5cy9rZXlfdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFeEQsTUFBTSxNQUFNLFlBQVksR0FDcEIsZUFBZSxDQUFDLEtBQUssR0FDckIsZUFBZSxDQUFDLE1BQU0sR0FDdEIsZUFBZSxDQUFDLE1BQU0sR0FDdEIsZUFBZSxDQUFDLEtBQUssQ0FBQztBQUMxQixNQUFNLE1BQU0sU0FBUyxHQUFHLEdBQUcsR0FBRyxJQUFJLEdBQUcsSUFBSSxHQUFHLEdBQUcsQ0FBQztBQUNoRCxlQUFPLE1BQU0sWUFBWSxFQUFFLFNBQVMsRUFBMkIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key_types.d.ts","sourceRoot":"","sources":["../../src/keys/key_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"key_types.d.ts","sourceRoot":"","sources":["../../src/keys/key_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,MAAM,YAAY,GACpB,eAAe,CAAC,KAAK,GACrB,eAAe,CAAC,MAAM,GACtB,eAAe,CAAC,MAAM,GACtB,eAAe,CAAC,KAAK,CAAC;AAC1B,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC;AAChD,eAAO,MAAM,YAAY,EAAE,SAAS,EAA2B,CAAC"}
|
package/dest/keys/public_keys.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_IVPK_M_X, DEFAULT_IVPK_M_Y, DEFAULT_NPK_M_X, DEFAULT_NPK_M_Y, DEFAULT_OVPK_M_X, DEFAULT_OVPK_M_Y, DEFAULT_TPK_M_X, DEFAULT_TPK_M_Y,
|
|
1
|
+
import { DEFAULT_IVPK_M_X, DEFAULT_IVPK_M_Y, DEFAULT_NPK_M_X, DEFAULT_NPK_M_Y, DEFAULT_OVPK_M_X, DEFAULT_OVPK_M_Y, DEFAULT_TPK_M_X, DEFAULT_TPK_M_Y, DomainSeparator } from '@aztec/constants';
|
|
2
2
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { Point } from '@aztec/foundation/curves/grumpkin';
|
|
@@ -46,7 +46,7 @@ export class PublicKeys {
|
|
|
46
46
|
this.masterIncomingViewingPublicKey,
|
|
47
47
|
this.masterOutgoingViewingPublicKey,
|
|
48
48
|
this.masterTaggingPublicKey
|
|
49
|
-
],
|
|
49
|
+
], DomainSeparator.PUBLIC_KEYS_HASH);
|
|
50
50
|
}
|
|
51
51
|
isEmpty() {
|
|
52
52
|
return this.masterNullifierPublicKey.isZero() && this.masterIncomingViewingPublicKey.isZero() && this.masterOutgoingViewingPublicKey.isZero() && this.masterTaggingPublicKey.isZero();
|
package/dest/keys/utils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainSeparator } from '@aztec/constants';
|
|
2
2
|
export function getKeyGenerator(prefix) {
|
|
3
3
|
const map = {
|
|
4
|
-
n:
|
|
5
|
-
iv:
|
|
6
|
-
ov:
|
|
7
|
-
t:
|
|
4
|
+
n: DomainSeparator.NHK_M,
|
|
5
|
+
iv: DomainSeparator.IVSK_M,
|
|
6
|
+
ov: DomainSeparator.OVSK_M,
|
|
7
|
+
t: DomainSeparator.TSK_M
|
|
8
8
|
};
|
|
9
9
|
return map[prefix];
|
|
10
10
|
}
|