@aztec/pxe 0.37.0 → 0.38.0

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.
Files changed (51) hide show
  1. package/dest/config/index.d.ts +17 -2
  2. package/dest/config/index.d.ts.map +1 -1
  3. package/dest/config/index.js +1 -1
  4. package/dest/index.d.ts +1 -0
  5. package/dest/index.d.ts.map +1 -1
  6. package/dest/index.js +3 -1
  7. package/dest/kernel_oracle/index.d.ts +1 -1
  8. package/dest/kernel_oracle/index.d.ts.map +1 -1
  9. package/dest/kernel_oracle/index.js +2 -2
  10. package/dest/kernel_prover/bb_prover/bb_native_proof_creator.d.ts +95 -0
  11. package/dest/kernel_prover/bb_prover/bb_native_proof_creator.d.ts.map +1 -0
  12. package/dest/kernel_prover/bb_prover/bb_native_proof_creator.js +437 -0
  13. package/dest/kernel_prover/{proof_creator.d.ts → interface/proof_creator.d.ts} +16 -35
  14. package/dest/kernel_prover/interface/proof_creator.d.ts.map +1 -0
  15. package/dest/kernel_prover/interface/proof_creator.js +2 -0
  16. package/dest/kernel_prover/kernel_prover.d.ts +4 -4
  17. package/dest/kernel_prover/kernel_prover.d.ts.map +1 -1
  18. package/dest/kernel_prover/kernel_prover.js +10 -37
  19. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.d.ts +1 -1
  20. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.d.ts.map +1 -1
  21. package/dest/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.js +4 -33
  22. package/dest/kernel_prover/proving_data_oracle.d.ts +1 -1
  23. package/dest/kernel_prover/proving_data_oracle.d.ts.map +1 -1
  24. package/dest/kernel_prover/test/test_circuit_prover.d.ts +16 -0
  25. package/dest/kernel_prover/test/test_circuit_prover.d.ts.map +1 -0
  26. package/dest/kernel_prover/test/test_circuit_prover.js +67 -0
  27. package/dest/pxe_service/create_pxe_service.d.ts +3 -1
  28. package/dest/pxe_service/create_pxe_service.d.ts.map +1 -1
  29. package/dest/pxe_service/create_pxe_service.js +16 -3
  30. package/dest/pxe_service/pxe_service.d.ts +3 -2
  31. package/dest/pxe_service/pxe_service.d.ts.map +1 -1
  32. package/dest/pxe_service/pxe_service.js +11 -56
  33. package/dest/simulator_oracle/index.d.ts +3 -3
  34. package/dest/simulator_oracle/index.d.ts.map +1 -1
  35. package/dest/simulator_oracle/index.js +3 -3
  36. package/package.json +14 -12
  37. package/src/config/index.ts +19 -2
  38. package/src/index.ts +3 -0
  39. package/src/kernel_oracle/index.ts +1 -1
  40. package/src/kernel_prover/bb_prover/bb_native_proof_creator.ts +713 -0
  41. package/src/kernel_prover/interface/proof_creator.ts +79 -0
  42. package/src/kernel_prover/kernel_prover.ts +19 -48
  43. package/src/kernel_prover/private_inputs_builders/build_private_kernel_tail_hints.ts +5 -40
  44. package/src/kernel_prover/proving_data_oracle.ts +1 -1
  45. package/src/kernel_prover/test/test_circuit_prover.ts +96 -0
  46. package/src/pxe_service/create_pxe_service.ts +17 -1
  47. package/src/pxe_service/pxe_service.ts +17 -66
  48. package/src/simulator_oracle/index.ts +4 -7
  49. package/dest/kernel_prover/proof_creator.d.ts.map +0 -1
  50. package/dest/kernel_prover/proof_creator.js +0 -68
  51. package/src/kernel_prover/proof_creator.ts +0 -157
@@ -1,68 +0,0 @@
1
- import { makeEmptyProof, } from '@aztec/circuits.js';
2
- import { siloNoteHash } from '@aztec/circuits.js/hash';
3
- import { createDebugLogger } from '@aztec/foundation/log';
4
- import { elapsed } from '@aztec/foundation/timer';
5
- import { executeInit, executeInner, executeTail, executeTailForPublic } from '@aztec/noir-protocol-circuits-types';
6
- /**
7
- * The KernelProofCreator class is responsible for generating siloed commitments and zero-knowledge proofs
8
- * for private kernel circuit. It leverages Barretenberg to perform cryptographic operations and proof creation.
9
- * The class provides methods to compute commitments based on the given public inputs and to generate proofs based on
10
- * signed transaction requests, previous kernel data, private call data, and a flag indicating whether it's the first
11
- * iteration or not.
12
- */
13
- export class KernelProofCreator {
14
- constructor(log = createDebugLogger('aztec:kernel_proof_creator')) {
15
- this.log = log;
16
- }
17
- getSiloedCommitments(publicInputs) {
18
- const contractAddress = publicInputs.callContext.storageContractAddress;
19
- return Promise.resolve(publicInputs.newNoteHashes.map(commitment => siloNoteHash(contractAddress, commitment.value)));
20
- }
21
- async createProofInit(privateInputs) {
22
- const [duration, result] = await elapsed(() => executeInit(privateInputs));
23
- this.log.debug(`Simulated private kernel init`, {
24
- eventName: 'circuit-simulation',
25
- circuitName: 'private-kernel-init',
26
- duration,
27
- inputSize: privateInputs.toBuffer().length,
28
- outputSize: result.toBuffer().length,
29
- });
30
- const proof = makeEmptyProof();
31
- return {
32
- publicInputs: result,
33
- proof: proof,
34
- };
35
- }
36
- async createProofInner(privateInputs) {
37
- const [duration, result] = await elapsed(() => executeInner(privateInputs));
38
- this.log.debug(`Simulated private kernel inner`, {
39
- eventName: 'circuit-simulation',
40
- circuitName: 'private-kernel-inner',
41
- duration,
42
- inputSize: privateInputs.toBuffer().length,
43
- outputSize: result.toBuffer().length,
44
- });
45
- const proof = makeEmptyProof();
46
- return {
47
- publicInputs: result,
48
- proof: proof,
49
- };
50
- }
51
- async createProofTail(privateInputs) {
52
- const isForPublic = privateInputs.isForPublic();
53
- const [duration, result] = await elapsed(() => isForPublic ? executeTailForPublic(privateInputs) : executeTail(privateInputs));
54
- this.log.debug(`Simulated private kernel ordering`, {
55
- eventName: 'circuit-simulation',
56
- circuitName: 'private-kernel-ordering',
57
- duration,
58
- inputSize: privateInputs.toBuffer().length,
59
- outputSize: result.toBuffer().length,
60
- });
61
- const proof = makeEmptyProof();
62
- return {
63
- publicInputs: result,
64
- proof: proof,
65
- };
66
- }
67
- }
68
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvb2ZfY3JlYXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9rZXJuZWxfcHJvdmVyL3Byb29mX2N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yxhQUFvRDtRQUMvRSxNQUFNLFdBQVcsR0FBRyxhQUFhLENBQUMsV0FBVyxFQUFFLENBQUM7UUFDaEQsTUFBTSxDQUFDLFFBQVEsRUFBRSxNQUFNLENBQUMsR0FBRyxNQUFNLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FDNUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxvQkFBb0IsQ0FBQyxhQUFhLENBQUMsQ0FBQyxDQUFDLENBQUMsV0FBVyxDQUFDLGFBQWEsQ0FBQyxDQUMvRSxDQUFDO1FBQ0YsSUFBSSxDQUFDLEdBQUcsQ0FBQyxLQUFLLENBQUMsbUNBQW1DLEVBQUU7WUFDbEQsU0FBUyxFQUFFLG9CQUFvQjtZQUMvQixXQUFXLEVBQUUseUJBQXlCO1lBQ3RDLFFBQVE7WUFDUixTQUFTLEVBQUUsYUFBYSxDQUFDLFFBQVEsRUFBRSxDQUFDLE1BQU07WUFDMUMsVUFBVSxFQUFFLE1BQU0sQ0FBQyxRQUFRLEVBQUUsQ0FBQyxNQUFNO1NBQ0osQ0FBQyxDQUFDO1FBQ3BDLE1BQU0sS0FBSyxHQUFHLGNBQWMsRUFBRSxDQUFDO1FBRS9CLE9BQU87WUFDTCxZQUFZLEVBQUUsTUFBTTtZQUNwQixLQUFLLEVBQUUsS0FBSztTQUNiLENBQUM7SUFDSixDQUFDO0NBQ0YifQ==
@@ -1,157 +0,0 @@
1
- import { type CircuitSimulationStats } from '@aztec/circuit-types/stats';
2
- import {
3
- type PrivateCircuitPublicInputs,
4
- type PrivateKernelCircuitPublicInputs,
5
- type PrivateKernelInitCircuitPrivateInputs,
6
- type PrivateKernelInnerCircuitPrivateInputs,
7
- type PrivateKernelTailCircuitPrivateInputs,
8
- type PrivateKernelTailCircuitPublicInputs,
9
- type Proof,
10
- makeEmptyProof,
11
- } from '@aztec/circuits.js';
12
- import { siloNoteHash } from '@aztec/circuits.js/hash';
13
- import { type Fr } from '@aztec/foundation/fields';
14
- import { createDebugLogger } from '@aztec/foundation/log';
15
- import { elapsed } from '@aztec/foundation/timer';
16
- import { executeInit, executeInner, executeTail, executeTailForPublic } from '@aztec/noir-protocol-circuits-types';
17
-
18
- /**
19
- * Represents the output of the proof creation process for init and inner private kernel circuit.
20
- * Contains the public inputs required for the init and inner private kernel circuit and the generated proof.
21
- */
22
- export interface ProofOutput {
23
- /**
24
- * The public inputs required for the proof generation process.
25
- */
26
- publicInputs: PrivateKernelCircuitPublicInputs;
27
- /**
28
- * The zk-SNARK proof for the kernel execution.
29
- */
30
- proof: Proof;
31
- }
32
-
33
- /**
34
- * Represents the output of the proof creation process for final ordering private kernel circuit.
35
- * Contains the public inputs required for the final ordering private kernel circuit and the generated proof.
36
- */
37
- export interface ProofOutputFinal {
38
- /**
39
- * The public inputs required for the proof generation process.
40
- */
41
- publicInputs: PrivateKernelTailCircuitPublicInputs;
42
- /**
43
- * The zk-SNARK proof for the kernel execution.
44
- */
45
- proof: Proof;
46
- }
47
-
48
- /**
49
- * ProofCreator provides functionality to create and validate proofs, and retrieve
50
- * siloed commitments necessary for maintaining transaction privacy and security on the network.
51
- */
52
- export interface ProofCreator {
53
- /**
54
- * Computes the siloed commitments for a given set of public inputs.
55
- *
56
- * @param publicInputs - The public inputs containing the contract address and new note hashes to be used in generating siloed note hashes.
57
- * @returns An array of Fr (finite field) elements representing the siloed commitments.
58
- */
59
- getSiloedCommitments(publicInputs: PrivateCircuitPublicInputs): Promise<Fr[]>;
60
-
61
- /**
62
- * Creates a proof output for a given signed transaction request and private call data for the first iteration.
63
- *
64
- * @param privateKernelInputsInit - The private data structure for the initial iteration.
65
- * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
66
- */
67
- createProofInit(privateKernelInputsInit: PrivateKernelInitCircuitPrivateInputs): Promise<ProofOutput>;
68
-
69
- /**
70
- * Creates a proof output for a given previous kernel data and private call data for an inner iteration.
71
- *
72
- * @param privateKernelInputsInner - The private input data structure for the inner iteration.
73
- * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
74
- */
75
- createProofInner(privateKernelInputsInner: PrivateKernelInnerCircuitPrivateInputs): Promise<ProofOutput>;
76
-
77
- /**
78
- * Creates a proof output based on the last inner kernel iteration kernel data for the final ordering iteration.
79
- *
80
- * @param privateKernelInputsTail - The private input data structure for the final ordering iteration.
81
- * @returns A Promise resolving to a ProofOutput object containing public inputs and the kernel proof.
82
- */
83
- createProofTail(privateKernelInputsTail: PrivateKernelTailCircuitPrivateInputs): Promise<ProofOutputFinal>;
84
- }
85
-
86
- /**
87
- * The KernelProofCreator class is responsible for generating siloed commitments and zero-knowledge proofs
88
- * for private kernel circuit. It leverages Barretenberg to perform cryptographic operations and proof creation.
89
- * The class provides methods to compute commitments based on the given public inputs and to generate proofs based on
90
- * signed transaction requests, previous kernel data, private call data, and a flag indicating whether it's the first
91
- * iteration or not.
92
- */
93
- export class KernelProofCreator implements ProofCreator {
94
- constructor(private log = createDebugLogger('aztec:kernel_proof_creator')) {}
95
-
96
- public getSiloedCommitments(publicInputs: PrivateCircuitPublicInputs) {
97
- const contractAddress = publicInputs.callContext.storageContractAddress;
98
-
99
- return Promise.resolve(
100
- publicInputs.newNoteHashes.map(commitment => siloNoteHash(contractAddress, commitment.value)),
101
- );
102
- }
103
-
104
- public async createProofInit(privateInputs: PrivateKernelInitCircuitPrivateInputs): Promise<ProofOutput> {
105
- const [duration, result] = await elapsed(() => executeInit(privateInputs));
106
- this.log.debug(`Simulated private kernel init`, {
107
- eventName: 'circuit-simulation',
108
- circuitName: 'private-kernel-init',
109
- duration,
110
- inputSize: privateInputs.toBuffer().length,
111
- outputSize: result.toBuffer().length,
112
- } satisfies CircuitSimulationStats);
113
- const proof = makeEmptyProof();
114
-
115
- return {
116
- publicInputs: result,
117
- proof: proof,
118
- };
119
- }
120
-
121
- public async createProofInner(privateInputs: PrivateKernelInnerCircuitPrivateInputs): Promise<ProofOutput> {
122
- const [duration, result] = await elapsed(() => executeInner(privateInputs));
123
- this.log.debug(`Simulated private kernel inner`, {
124
- eventName: 'circuit-simulation',
125
- circuitName: 'private-kernel-inner',
126
- duration,
127
- inputSize: privateInputs.toBuffer().length,
128
- outputSize: result.toBuffer().length,
129
- } satisfies CircuitSimulationStats);
130
- const proof = makeEmptyProof();
131
-
132
- return {
133
- publicInputs: result,
134
- proof: proof,
135
- };
136
- }
137
-
138
- public async createProofTail(privateInputs: PrivateKernelTailCircuitPrivateInputs): Promise<ProofOutputFinal> {
139
- const isForPublic = privateInputs.isForPublic();
140
- const [duration, result] = await elapsed(() =>
141
- isForPublic ? executeTailForPublic(privateInputs) : executeTail(privateInputs),
142
- );
143
- this.log.debug(`Simulated private kernel ordering`, {
144
- eventName: 'circuit-simulation',
145
- circuitName: 'private-kernel-ordering',
146
- duration,
147
- inputSize: privateInputs.toBuffer().length,
148
- outputSize: result.toBuffer().length,
149
- } satisfies CircuitSimulationStats);
150
- const proof = makeEmptyProof();
151
-
152
- return {
153
- publicInputs: result,
154
- proof: proof,
155
- };
156
- }
157
- }