@aztec/stdlib 3.0.0-nightly.20251025 → 3.0.0-nightly.20251030-2
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/block/body.d.ts.map +1 -1
- package/dest/block/body.js +2 -6
- package/dest/block/l2_block.d.ts +11 -0
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +15 -1
- package/dest/block/l2_block_source.d.ts +5 -5
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_body.d.ts +4 -0
- package/dest/checkpoint/checkpoint_body.d.ts.map +1 -0
- package/dest/checkpoint/checkpoint_body.js +9 -0
- package/dest/checkpoint/index.d.ts +2 -0
- package/dest/checkpoint/index.d.ts.map +1 -0
- package/dest/checkpoint/index.js +1 -0
- package/dest/interfaces/archiver.js +3 -3
- package/dest/interfaces/epoch-prover.d.ts +3 -3
- package/dest/interfaces/epoch-prover.d.ts.map +1 -1
- package/dest/interfaces/private_kernel_prover.d.ts +2 -2
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +15 -15
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +8 -8
- package/dest/interfaces/server_circuit_prover.d.ts +3 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/kernel/private_kernel_data.js +2 -2
- package/dest/kernel/private_kernel_prover_output.d.ts +4 -4
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +1 -0
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +3 -0
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +2 -3
- package/dest/logs/directional_app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/directional_app_tagging_secret.js +1 -2
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +2 -4
- package/dest/p2p/gossipable.d.ts +4 -12
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/gossipable.js +4 -7
- package/dest/p2p/topic_type.d.ts +4 -8
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +14 -8
- package/dest/proofs/chonk_proof.d.ts +28 -0
- package/dest/proofs/chonk_proof.d.ts.map +1 -0
- package/dest/proofs/chonk_proof.js +101 -0
- package/dest/proofs/index.d.ts +1 -1
- package/dest/proofs/index.d.ts.map +1 -1
- package/dest/proofs/index.js +1 -1
- package/dest/proofs/proof_data.d.ts +2 -2
- package/dest/proofs/proof_data.d.ts.map +1 -1
- package/dest/proofs/proving_request_type.d.ts +1 -1
- package/dest/proofs/proving_request_type.d.ts.map +1 -1
- package/dest/proofs/proving_request_type.js +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_root_rollup_private_inputs.js +1 -1
- package/dest/rollup/index.d.ts +2 -2
- package/dest/rollup/index.d.ts.map +1 -1
- package/dest/rollup/index.js +2 -2
- package/dest/rollup/private_tx_base_rollup_private_inputs.d.ts +4 -4
- package/dest/rollup/private_tx_base_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/public_chonk_verifier_private_inputs.d.ts +21 -0
- package/dest/rollup/public_chonk_verifier_private_inputs.d.ts.map +1 -0
- package/dest/rollup/{public_tube_private_inputs.js → public_chonk_verifier_private_inputs.js} +7 -6
- package/dest/rollup/{public_tube_public_inputs.d.ts → public_chonk_verifier_public_inputs.d.ts} +7 -7
- package/dest/rollup/public_chonk_verifier_public_inputs.d.ts.map +1 -0
- package/dest/rollup/{public_tube_public_inputs.js → public_chonk_verifier_public_inputs.js} +7 -6
- package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts +4 -4
- package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/public_tx_base_rollup_private_inputs.js +6 -6
- package/dest/rollup/root_rollup_public_inputs.d.ts +1 -1
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +1 -1
- package/dest/stats/stats.d.ts +3 -3
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +3 -3
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +15 -15
- package/dest/tests/mocks.d.ts +3 -3
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +3 -3
- package/dest/tx/processed_tx.d.ts +2 -3
- package/dest/tx/processed_tx.d.ts.map +1 -1
- package/dest/tx/processed_tx.js +2 -7
- package/dest/tx/proven_tx.d.ts +7 -7
- package/dest/tx/proven_tx.d.ts.map +1 -1
- package/dest/tx/proven_tx.js +8 -8
- package/dest/tx/simulated_tx.js +2 -2
- package/dest/tx/tx.d.ts +3 -3
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +13 -13
- package/package.json +9 -8
- package/src/block/body.ts +3 -12
- package/src/block/l2_block.ts +15 -0
- package/src/block/l2_block_source.ts +5 -5
- package/src/checkpoint/checkpoint_body.ts +10 -0
- package/src/checkpoint/index.ts +1 -0
- package/src/interfaces/archiver.ts +3 -3
- package/src/interfaces/epoch-prover.ts +3 -3
- package/src/interfaces/private_kernel_prover.ts +2 -2
- package/src/interfaces/proving-job.ts +13 -10
- package/src/interfaces/server_circuit_prover.ts +7 -5
- package/src/kernel/private_kernel_data.ts +2 -2
- package/src/kernel/private_kernel_prover_output.ts +4 -4
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +6 -0
- package/src/keys/derivation.ts +2 -3
- package/src/logs/directional_app_tagging_secret.ts +1 -2
- package/src/logs/shared_secret_derivation.ts +2 -4
- package/src/p2p/gossipable.ts +4 -12
- package/src/p2p/topic_type.ts +15 -8
- package/src/proofs/chonk_proof.ts +118 -0
- package/src/proofs/index.ts +1 -1
- package/src/proofs/proof_data.ts +2 -2
- package/src/proofs/proving_request_type.ts +1 -1
- package/src/rollup/checkpoint_rollup_public_inputs.ts +1 -1
- package/src/rollup/checkpoint_root_rollup_private_inputs.ts +1 -1
- package/src/rollup/index.ts +2 -2
- package/src/rollup/private_tx_base_rollup_private_inputs.ts +2 -2
- package/src/rollup/{public_tube_private_inputs.ts → public_chonk_verifier_private_inputs.ts} +11 -10
- package/src/rollup/{public_tube_public_inputs.ts → public_chonk_verifier_public_inputs.ts} +9 -8
- package/src/rollup/public_tx_base_rollup_private_inputs.ts +4 -4
- package/src/rollup/root_rollup_public_inputs.ts +1 -1
- package/src/stats/stats.ts +3 -3
- package/src/tests/factories.ts +21 -21
- package/src/tests/mocks.ts +4 -4
- package/src/tx/processed_tx.ts +4 -10
- package/src/tx/proven_tx.ts +6 -6
- package/src/tx/simulated_tx.ts +2 -2
- package/src/tx/tx.ts +11 -11
- package/dest/proofs/client_ivc_proof.d.ts +0 -15
- package/dest/proofs/client_ivc_proof.d.ts.map +0 -1
- package/dest/proofs/client_ivc_proof.js +0 -48
- package/dest/rollup/public_tube_private_inputs.d.ts +0 -21
- package/dest/rollup/public_tube_private_inputs.d.ts.map +0 -1
- package/dest/rollup/public_tube_public_inputs.d.ts.map +0 -1
- package/src/proofs/client_ivc_proof.ts +0 -57
package/src/tx/simulated_tx.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { Gas } from '../gas/gas.js';
|
|
12
12
|
import type { GasUsed } from '../gas/gas_used.js';
|
|
13
13
|
import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
|
|
14
|
-
import {
|
|
14
|
+
import { ChonkProof } from '../proofs/chonk_proof.js';
|
|
15
15
|
import {
|
|
16
16
|
PrivateCallExecutionResult,
|
|
17
17
|
PrivateExecutionResult,
|
|
@@ -69,7 +69,7 @@ export class PrivateSimulationResult {
|
|
|
69
69
|
|
|
70
70
|
return await Tx.create({
|
|
71
71
|
data: this.publicInputs,
|
|
72
|
-
|
|
72
|
+
chonkProof: ChonkProof.empty(),
|
|
73
73
|
contractClassLogFields: contractClassLogs,
|
|
74
74
|
publicFunctionCalldata: this.privateExecutionResult.publicFunctionCalldata,
|
|
75
75
|
});
|
package/src/tx/tx.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_t
|
|
|
15
15
|
import { ContractClassLog, ContractClassLogFields } from '../logs/contract_class_log.js';
|
|
16
16
|
import { Gossipable } from '../p2p/gossipable.js';
|
|
17
17
|
import { TopicType } from '../p2p/topic_type.js';
|
|
18
|
-
import {
|
|
18
|
+
import { ChonkProof } from '../proofs/chonk_proof.js';
|
|
19
19
|
import type { TxStats } from '../stats/stats.js';
|
|
20
20
|
import { HashedValues } from './hashed_values.js';
|
|
21
21
|
import { PublicCallRequestWithCalldata } from './public_call_request_with_calldata.js';
|
|
@@ -39,7 +39,7 @@ export class Tx extends Gossipable {
|
|
|
39
39
|
/**
|
|
40
40
|
* Proof from the private kernel circuit.
|
|
41
41
|
*/
|
|
42
|
-
public readonly
|
|
42
|
+
public readonly chonkProof: ChonkProof,
|
|
43
43
|
/**
|
|
44
44
|
* Contract class log fields emitted from the tx.
|
|
45
45
|
* Their order should match the order of the log hashes returned from `this.data.getNonEmptyContractClassLogsHashes`.
|
|
@@ -108,7 +108,7 @@ export class Tx extends Gossipable {
|
|
|
108
108
|
return new Tx(
|
|
109
109
|
reader.readObject(TxHash),
|
|
110
110
|
reader.readObject(PrivateKernelTailCircuitPublicInputs),
|
|
111
|
-
reader.readObject(
|
|
111
|
+
reader.readObject(ChonkProof),
|
|
112
112
|
reader.readVectorUint8Prefix(ContractClassLogFields),
|
|
113
113
|
reader.readVectorUint8Prefix(HashedValues),
|
|
114
114
|
);
|
|
@@ -122,7 +122,7 @@ export class Tx extends Gossipable {
|
|
|
122
122
|
return serializeToBuffer([
|
|
123
123
|
this.txHash,
|
|
124
124
|
this.data,
|
|
125
|
-
this.
|
|
125
|
+
this.chonkProof,
|
|
126
126
|
serializeArrayOfBufferableToVector(this.contractClassLogFields, 1),
|
|
127
127
|
serializeArrayOfBufferableToVector(this.publicFunctionCalldata, 1),
|
|
128
128
|
]);
|
|
@@ -132,7 +132,7 @@ export class Tx extends Gossipable {
|
|
|
132
132
|
return z
|
|
133
133
|
.object({
|
|
134
134
|
data: PrivateKernelTailCircuitPublicInputs.schema,
|
|
135
|
-
|
|
135
|
+
chonkProof: ChonkProof.schema,
|
|
136
136
|
contractClassLogFields: z.array(ContractClassLogFields.schema),
|
|
137
137
|
publicFunctionCalldata: z.array(HashedValues.schema),
|
|
138
138
|
})
|
|
@@ -155,7 +155,7 @@ export class Tx extends Gossipable {
|
|
|
155
155
|
return new Tx(
|
|
156
156
|
fields.txHash,
|
|
157
157
|
fields.data,
|
|
158
|
-
fields.
|
|
158
|
+
fields.chonkProof,
|
|
159
159
|
fields.contractClassLogFields,
|
|
160
160
|
fields.publicFunctionCalldata,
|
|
161
161
|
);
|
|
@@ -237,7 +237,7 @@ export class Tx extends Gossipable {
|
|
|
237
237
|
classPublishedCount: this.data.getNonEmptyContractClassLogsHashes().length,
|
|
238
238
|
contractClassLogSize: this.data.getEmittedContractClassLogsLength(),
|
|
239
239
|
|
|
240
|
-
proofSize: this.
|
|
240
|
+
proofSize: this.chonkProof.fields.length,
|
|
241
241
|
size: this.toBuffer().length,
|
|
242
242
|
|
|
243
243
|
feePaymentMethod:
|
|
@@ -249,7 +249,7 @@ export class Tx extends Gossipable {
|
|
|
249
249
|
getSize() {
|
|
250
250
|
return (
|
|
251
251
|
this.data.getSize() +
|
|
252
|
-
this.
|
|
252
|
+
this.chonkProof.fields.length * Fr.SIZE_IN_BYTES +
|
|
253
253
|
arraySerializedSizeOfNonEmpty(this.contractClassLogFields) +
|
|
254
254
|
this.publicFunctionCalldata.reduce((accum, cd) => accum + cd.getSize(), 0)
|
|
255
255
|
);
|
|
@@ -275,10 +275,10 @@ export class Tx extends Gossipable {
|
|
|
275
275
|
*/
|
|
276
276
|
static clone(tx: Tx): Tx {
|
|
277
277
|
const publicInputs = PrivateKernelTailCircuitPublicInputs.fromBuffer(tx.data.toBuffer());
|
|
278
|
-
const
|
|
278
|
+
const chonkProof = ChonkProof.fromBuffer(tx.chonkProof.toBuffer());
|
|
279
279
|
const contractClassLogFields = tx.contractClassLogFields.map(p => p.clone());
|
|
280
280
|
const publicFunctionCalldata = tx.publicFunctionCalldata.map(cd => HashedValues.fromBuffer(cd.toBuffer()));
|
|
281
|
-
const clonedTx = new Tx(tx.txHash, publicInputs,
|
|
281
|
+
const clonedTx = new Tx(tx.txHash, publicInputs, chonkProof, contractClassLogFields, publicFunctionCalldata);
|
|
282
282
|
|
|
283
283
|
return clonedTx;
|
|
284
284
|
}
|
|
@@ -292,7 +292,7 @@ export class Tx extends Gossipable {
|
|
|
292
292
|
return Tx.from({
|
|
293
293
|
txHash: (typeof args.txHash === 'string' ? TxHash.fromString(args.txHash) : args.txHash) ?? TxHash.random(),
|
|
294
294
|
data: PrivateKernelTailCircuitPublicInputs.emptyWithNullifier(),
|
|
295
|
-
|
|
295
|
+
chonkProof: args.randomProof ? ChonkProof.random() : ChonkProof.empty(),
|
|
296
296
|
contractClassLogFields: [ContractClassLogFields.random()],
|
|
297
297
|
publicFunctionCalldata: [HashedValues.random()],
|
|
298
298
|
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
|
-
export declare class ClientIvcProof {
|
|
4
|
-
proof: Fr[];
|
|
5
|
-
constructor(proof: Fr[]);
|
|
6
|
-
isEmpty(): boolean;
|
|
7
|
-
static empty(): ClientIvcProof;
|
|
8
|
-
static random(proofSize?: number): ClientIvcProof;
|
|
9
|
-
static get schema(): import("zod").ZodType<ClientIvcProof, any, string>;
|
|
10
|
-
toJSON(): Buffer<ArrayBufferLike>;
|
|
11
|
-
static fromBuffer(buffer: Buffer | BufferReader): ClientIvcProof;
|
|
12
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
13
|
-
static fromBufferArray(fields: Uint8Array[]): ClientIvcProof;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=client_ivc_proof.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client_ivc_proof.d.ts","sourceRoot":"","sources":["../../src/proofs/client_ivc_proof.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,qBAAa,cAAc;IAIhB,KAAK,EAAE,EAAE,EAAE;gBAAX,KAAK,EAAE,EAAE,EAAE;IAGb,OAAO;IAId,MAAM,CAAC,KAAK;IAIZ,MAAM,CAAC,MAAM,CAAC,SAAS,SAAoB;IAW3C,MAAM,KAAK,MAAM,uDAEhB;IAED,MAAM;IAIN,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,cAAc;IAOzD,QAAQ;IAKf,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc;CAI7D"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { CIVC_PROOF_LENGTH } from '@aztec/constants';
|
|
2
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
5
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
6
|
-
export class ClientIvcProof {
|
|
7
|
-
proof;
|
|
8
|
-
constructor(// The proof fields with public inputs.
|
|
9
|
-
// For recursive verification, the public inputs (at the front of the array) must be removed.
|
|
10
|
-
proof){
|
|
11
|
-
this.proof = proof;
|
|
12
|
-
}
|
|
13
|
-
isEmpty() {
|
|
14
|
-
return this.proof.length === 0;
|
|
15
|
-
}
|
|
16
|
-
static empty() {
|
|
17
|
-
return new ClientIvcProof([]);
|
|
18
|
-
}
|
|
19
|
-
static random(proofSize = CIVC_PROOF_LENGTH) {
|
|
20
|
-
// NB: Not using Fr.random here because it slows down some tests that require a large number of txs significantly.
|
|
21
|
-
const reducedFrSize = Fr.SIZE_IN_BYTES - 1;
|
|
22
|
-
const randomFields = randomBytes(proofSize * reducedFrSize);
|
|
23
|
-
const proof = Array.from({
|
|
24
|
-
length: proofSize
|
|
25
|
-
}, (_, i)=>new Fr(randomFields.subarray(i * reducedFrSize, (i + 1) * reducedFrSize)));
|
|
26
|
-
return new ClientIvcProof(proof);
|
|
27
|
-
}
|
|
28
|
-
static get schema() {
|
|
29
|
-
return bufferSchemaFor(ClientIvcProof);
|
|
30
|
-
}
|
|
31
|
-
toJSON() {
|
|
32
|
-
return this.toBuffer();
|
|
33
|
-
}
|
|
34
|
-
static fromBuffer(buffer) {
|
|
35
|
-
const reader = BufferReader.asReader(buffer);
|
|
36
|
-
const proofLength = reader.readNumber();
|
|
37
|
-
const proof = reader.readArray(proofLength, Fr);
|
|
38
|
-
return new ClientIvcProof(proof);
|
|
39
|
-
}
|
|
40
|
-
toBuffer() {
|
|
41
|
-
return serializeToBuffer(this.proof.length, this.proof);
|
|
42
|
-
}
|
|
43
|
-
// Called when constructing a ClientIvcProof from proving results.
|
|
44
|
-
static fromBufferArray(fields) {
|
|
45
|
-
const proof = fields.map((field)=>Fr.fromBuffer(Buffer.from(field)));
|
|
46
|
-
return new ClientIvcProof(proof);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
|
-
import { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
|
|
5
|
-
import { type CivcProofData } from '../proofs/proof_data.js';
|
|
6
|
-
export declare class PublicTubePrivateInputs {
|
|
7
|
-
hidingKernelProofData: CivcProofData<PrivateToPublicKernelCircuitPublicInputs>;
|
|
8
|
-
proverId: Fr;
|
|
9
|
-
constructor(hidingKernelProofData: CivcProofData<PrivateToPublicKernelCircuitPublicInputs>, proverId: Fr);
|
|
10
|
-
static from(fields: FieldsOf<PublicTubePrivateInputs>): PublicTubePrivateInputs;
|
|
11
|
-
static getFields(fields: FieldsOf<PublicTubePrivateInputs>): readonly [CivcProofData<PrivateToPublicKernelCircuitPublicInputs>, Fr];
|
|
12
|
-
static fromBuffer(buffer: Buffer | BufferReader): PublicTubePrivateInputs;
|
|
13
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
14
|
-
static fromString(str: string): PublicTubePrivateInputs;
|
|
15
|
-
toString(): `0x${string}`;
|
|
16
|
-
/** Returns a representation for JSON serialization. */
|
|
17
|
-
toJSON(): Buffer<ArrayBufferLike>;
|
|
18
|
-
/** Creates an instance from a string. */
|
|
19
|
-
static get schema(): import("zod").ZodType<PublicTubePrivateInputs, any, string>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=public_tube_private_inputs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public_tube_private_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/public_tube_private_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,wCAAwC,EAAE,MAAM,6DAA6D,CAAC;AACvH,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,yBAAyB,CAAC;AAExE,qBAAa,uBAAuB;IAEzB,qBAAqB,EAAE,aAAa,CAAC,wCAAwC,CAAC;IAC9E,QAAQ,EAAE,EAAE;gBADZ,qBAAqB,EAAE,aAAa,CAAC,wCAAwC,CAAC,EAC9E,QAAQ,EAAE,EAAE;IAGrB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC;IAIrD,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC;IAI1D,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAQ/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,QAAQ;IAIR,uDAAuD;IACvD,MAAM;IAIN,yCAAyC;IACzC,MAAM,KAAK,MAAM,gEAEhB;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public_tube_public_inputs.d.ts","sourceRoot":"","sources":["../../src/rollup/public_tube_public_inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,wCAAwC,EAAE,MAAM,6DAA6D,CAAC;AAEvH,qBAAa,sBAAsB;IAExB,WAAW,EAAE,wCAAwC;IACrD,QAAQ,EAAE,EAAE;gBADZ,WAAW,EAAE,wCAAwC,EACrD,QAAQ,EAAE,EAAE;IAGrB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;IAIpD,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;IAIzD,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAQ/C,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,QAAQ;IAIR,uDAAuD;IACvD,MAAM;IAIN,yCAAyC;IACzC,MAAM,KAAK,MAAM,+DAEhB;CACF"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { CIVC_PROOF_LENGTH } from '@aztec/constants';
|
|
2
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
5
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
6
|
-
|
|
7
|
-
export class ClientIvcProof {
|
|
8
|
-
constructor(
|
|
9
|
-
// The proof fields with public inputs.
|
|
10
|
-
// For recursive verification, the public inputs (at the front of the array) must be removed.
|
|
11
|
-
public proof: Fr[],
|
|
12
|
-
) {}
|
|
13
|
-
|
|
14
|
-
public isEmpty() {
|
|
15
|
-
return this.proof.length === 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
static empty() {
|
|
19
|
-
return new ClientIvcProof([]);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static random(proofSize = CIVC_PROOF_LENGTH) {
|
|
23
|
-
// NB: Not using Fr.random here because it slows down some tests that require a large number of txs significantly.
|
|
24
|
-
const reducedFrSize = Fr.SIZE_IN_BYTES - 1;
|
|
25
|
-
const randomFields = randomBytes(proofSize * reducedFrSize);
|
|
26
|
-
const proof = Array.from(
|
|
27
|
-
{ length: proofSize },
|
|
28
|
-
(_, i) => new Fr(randomFields.subarray(i * reducedFrSize, (i + 1) * reducedFrSize)),
|
|
29
|
-
);
|
|
30
|
-
return new ClientIvcProof(proof);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static get schema() {
|
|
34
|
-
return bufferSchemaFor(ClientIvcProof);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
toJSON() {
|
|
38
|
-
return this.toBuffer();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static fromBuffer(buffer: Buffer | BufferReader): ClientIvcProof {
|
|
42
|
-
const reader = BufferReader.asReader(buffer);
|
|
43
|
-
const proofLength = reader.readNumber();
|
|
44
|
-
const proof = reader.readArray(proofLength, Fr);
|
|
45
|
-
return new ClientIvcProof(proof);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public toBuffer() {
|
|
49
|
-
return serializeToBuffer(this.proof.length, this.proof);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Called when constructing a ClientIvcProof from proving results.
|
|
53
|
-
static fromBufferArray(fields: Uint8Array[]): ClientIvcProof {
|
|
54
|
-
const proof = fields.map(field => Fr.fromBuffer(Buffer.from(field)));
|
|
55
|
-
return new ClientIvcProof(proof);
|
|
56
|
-
}
|
|
57
|
-
}
|