@aztec/stdlib 3.0.0-nightly.20251211 → 3.0.0-nightly.20251213
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/avm/avm.d.ts +22 -1
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +32 -16
- package/dest/block/l2_block_new.d.ts +3 -1
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +3 -0
- package/dest/contract/interfaces/contract_class.d.ts +9 -2
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +17 -0
- package/dest/contract/interfaces/contract_instance.d.ts +13 -3
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +25 -0
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +0 -2
- package/dest/interfaces/aztec-node.d.ts +1 -9
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +0 -2
- package/dest/interfaces/l2_logs_source.d.ts +1 -9
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/proofs/proof_data.d.ts +13 -1
- package/dest/proofs/proof_data.d.ts.map +1 -1
- package/dest/proofs/proof_data.js +17 -0
- package/dest/rollup/avm_proof_data.d.ts +3 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts +1 -1
- package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/public_tx_base_rollup_private_inputs.js +2 -2
- package/dest/tests/factories.d.ts +1 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +12 -4
- package/package.json +13 -8
- package/src/avm/avm.ts +26 -6
- package/src/block/l2_block_new.ts +5 -0
- package/src/contract/interfaces/contract_class.ts +19 -1
- package/src/contract/interfaces/contract_instance.ts +32 -2
- package/src/interfaces/archiver.ts +0 -2
- package/src/interfaces/aztec-node.ts +0 -14
- package/src/interfaces/l2_logs_source.ts +0 -9
- package/src/proofs/proof_data.ts +24 -0
- package/src/rollup/avm_proof_data.ts +2 -2
- package/src/rollup/public_tx_base_rollup_private_inputs.ts +2 -2
- package/src/tests/factories.ts +21 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { AztecAddress } from '../../aztec-address/index.js';
|
|
6
6
|
import { PublicKeys } from '../../keys/public_keys.js';
|
|
7
7
|
import { type ZodFor, schemas } from '../../schemas/index.js';
|
|
8
8
|
|
|
@@ -45,3 +45,33 @@ export const ContractInstanceSchema = z.object({
|
|
|
45
45
|
export const ContractInstanceWithAddressSchema = ContractInstanceSchema.and(
|
|
46
46
|
z.object({ address: schemas.AztecAddress }),
|
|
47
47
|
) satisfies ZodFor<ContractInstanceWithAddress>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Creates a ContractInstance from a plain object without Zod validation.
|
|
51
|
+
* Suitable for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
52
|
+
*/
|
|
53
|
+
export function contractInstanceFromPlainObject(obj: any): ContractInstance {
|
|
54
|
+
return {
|
|
55
|
+
version: 1,
|
|
56
|
+
salt: Fr.fromPlainObject(obj.salt),
|
|
57
|
+
deployer: AztecAddress.fromPlainObject(obj.deployer),
|
|
58
|
+
currentContractClassId: Fr.fromPlainObject(obj.currentContractClassId),
|
|
59
|
+
originalContractClassId: Fr.fromPlainObject(obj.originalContractClassId),
|
|
60
|
+
initializationHash: Fr.fromPlainObject(obj.initializationHash),
|
|
61
|
+
publicKeys: PublicKeys.fromPlainObject(obj.publicKeys),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Creates a ContractInstanceWithAddress from a plain object without Zod validation.
|
|
67
|
+
* Suitable for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
68
|
+
*/
|
|
69
|
+
export function contractInstanceWithAddressFromPlainObject(
|
|
70
|
+
address: AztecAddress,
|
|
71
|
+
obj: any,
|
|
72
|
+
): ContractInstanceWithAddress {
|
|
73
|
+
return {
|
|
74
|
+
...contractInstanceFromPlainObject(obj),
|
|
75
|
+
address,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
} from '../contract/index.js';
|
|
18
18
|
import { L1RollupConstantsSchema } from '../epoch-helpers/index.js';
|
|
19
19
|
import { LogFilterSchema } from '../logs/log_filter.js';
|
|
20
|
-
import { PrivateLog } from '../logs/private_log.js';
|
|
21
20
|
import { TxScopedL2Log } from '../logs/tx_scoped_l2_log.js';
|
|
22
21
|
import type { L1ToL2MessageSource } from '../messaging/l1_to_l2_message_source.js';
|
|
23
22
|
import { optional, schemas } from '../schemas/schemas.js';
|
|
@@ -112,7 +111,6 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
112
111
|
getBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
|
|
113
112
|
isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
|
|
114
113
|
getL2Tips: z.function().args().returns(L2TipsSchema),
|
|
115
|
-
getPrivateLogs: z.function().args(BlockNumberSchema, z.number()).returns(z.array(PrivateLog.schema)),
|
|
116
114
|
getLogsByTags: z
|
|
117
115
|
.function()
|
|
118
116
|
.args(z.array(schemas.Fr))
|
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
} from '../contract/index.js';
|
|
38
38
|
import { GasFees } from '../gas/gas_fees.js';
|
|
39
39
|
import { type LogFilter, LogFilterSchema } from '../logs/log_filter.js';
|
|
40
|
-
import { PrivateLog } from '../logs/private_log.js';
|
|
41
40
|
import { TxScopedL2Log } from '../logs/tx_scoped_l2_log.js';
|
|
42
41
|
import { type ApiSchemaFor, optional, schemas } from '../schemas/schemas.js';
|
|
43
42
|
import { MerkleTreeId } from '../trees/merkle_tree_id.js';
|
|
@@ -324,14 +323,6 @@ export interface AztecNode
|
|
|
324
323
|
*/
|
|
325
324
|
registerContractFunctionSignatures(functionSignatures: string[]): Promise<void>;
|
|
326
325
|
|
|
327
|
-
/**
|
|
328
|
-
* Retrieves all private logs from up to `limit` blocks, starting from the block number `from`.
|
|
329
|
-
* @param from - The block number from which to begin retrieving logs.
|
|
330
|
-
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
331
|
-
* @returns An array of private logs from the specified range of blocks.
|
|
332
|
-
*/
|
|
333
|
-
getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]>;
|
|
334
|
-
|
|
335
326
|
/**
|
|
336
327
|
* Gets public logs based on the provided filter.
|
|
337
328
|
* @param filter - The filter to apply to the logs.
|
|
@@ -606,11 +597,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
606
597
|
.args(z.array(z.string().max(MAX_SIGNATURE_LEN)).max(MAX_SIGNATURES_PER_REGISTER_CALL))
|
|
607
598
|
.returns(z.void()),
|
|
608
599
|
|
|
609
|
-
getPrivateLogs: z
|
|
610
|
-
.function()
|
|
611
|
-
.args(BlockNumberPositiveSchema, z.number().lte(MAX_RPC_LEN))
|
|
612
|
-
.returns(z.array(PrivateLog.schema)),
|
|
613
|
-
|
|
614
600
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
615
601
|
|
|
616
602
|
getContractClassLogs: z.function().args(LogFilterSchema).returns(GetContractClassLogsResponseSchema),
|
|
@@ -2,7 +2,6 @@ import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
|
|
4
4
|
import type { LogFilter } from '../logs/log_filter.js';
|
|
5
|
-
import type { PrivateLog } from '../logs/private_log.js';
|
|
6
5
|
import type { TxScopedL2Log } from '../logs/tx_scoped_l2_log.js';
|
|
7
6
|
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from './get_logs_response.js';
|
|
8
7
|
|
|
@@ -10,14 +9,6 @@ import type { GetContractClassLogsResponse, GetPublicLogsResponse } from './get_
|
|
|
10
9
|
* Interface of classes allowing for the retrieval of logs.
|
|
11
10
|
*/
|
|
12
11
|
export interface L2LogsSource {
|
|
13
|
-
/**
|
|
14
|
-
* Retrieves all private logs from up to `limit` blocks, starting from the block number `from`.
|
|
15
|
-
* @param from - The block number from which to begin retrieving logs.
|
|
16
|
-
* @param limit - The maximum number of blocks to retrieve logs from.
|
|
17
|
-
* @returns An array of private logs from the specified range of blocks.
|
|
18
|
-
*/
|
|
19
|
-
getPrivateLogs(from: BlockNumber, limit: number): Promise<PrivateLog[]>;
|
|
20
|
-
|
|
21
12
|
/**
|
|
22
13
|
* Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
|
|
23
14
|
* @param tags - The tags to filter the logs by.
|
package/src/proofs/proof_data.ts
CHANGED
|
@@ -29,6 +29,30 @@ export class ProofData<T extends Bufferable, PROOF_LENGTH extends number> {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Represents the data of a recursive proof for a circuit with a fixed verification key.
|
|
34
|
+
*/
|
|
35
|
+
export class ProofDataForFixedVk<T extends Bufferable, PROOF_LENGTH extends number> {
|
|
36
|
+
constructor(
|
|
37
|
+
public publicInputs: T,
|
|
38
|
+
public proof: RecursiveProof<PROOF_LENGTH>,
|
|
39
|
+
) {}
|
|
40
|
+
|
|
41
|
+
public toBuffer(): Buffer {
|
|
42
|
+
return serializeToBuffer(this.publicInputs, this.proof);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static fromBuffer<T extends Bufferable, PROOF_LENGTH extends number>(
|
|
46
|
+
buffer: Buffer | BufferReader,
|
|
47
|
+
publicInputs: {
|
|
48
|
+
fromBuffer: (reader: BufferReader) => T;
|
|
49
|
+
},
|
|
50
|
+
): ProofDataForFixedVk<T, PROOF_LENGTH> {
|
|
51
|
+
const reader = BufferReader.asReader(buffer);
|
|
52
|
+
return new ProofDataForFixedVk(reader.readObject(publicInputs), RecursiveProof.fromBuffer(reader));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
32
56
|
export type ChonkProofData<T extends Bufferable> = ProofData<T, typeof CHONK_PROOF_LENGTH>;
|
|
33
57
|
|
|
34
58
|
export type UltraHonkProofData<T extends Bufferable> = ProofData<T, typeof RECURSIVE_PROOF_LENGTH>;
|
|
@@ -2,9 +2,9 @@ import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
|
|
4
4
|
import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ProofDataForFixedVk } from '../proofs/proof_data.js';
|
|
6
6
|
|
|
7
|
-
export type AvmProofData =
|
|
7
|
+
export type AvmProofData = ProofDataForFixedVk<AvmCircuitPublicInputs, typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
|
|
8
8
|
|
|
9
9
|
// TODO(#14234)[Unconditional PIs validation]: remove this function.
|
|
10
10
|
export function enhanceProofWithPiValidationFlag(proof: Fr[], skipPublicInputsValidation: boolean): Fr[] {
|
|
@@ -4,7 +4,7 @@ import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
|
4
4
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
5
|
|
|
6
6
|
import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
|
|
7
|
-
import { ProofData, type RollupHonkProofData } from '../proofs/proof_data.js';
|
|
7
|
+
import { ProofData, ProofDataForFixedVk, type RollupHonkProofData } from '../proofs/proof_data.js';
|
|
8
8
|
import type { AvmProofData } from './avm_proof_data.js';
|
|
9
9
|
import { PublicBaseRollupHints } from './base_rollup_hints.js';
|
|
10
10
|
import { PublicChonkVerifierPublicInputs } from './public_chonk_verifier_public_inputs.js';
|
|
@@ -28,7 +28,7 @@ export class PublicTxBaseRollupPrivateInputs {
|
|
|
28
28
|
const reader = BufferReader.asReader(buffer);
|
|
29
29
|
return new PublicTxBaseRollupPrivateInputs(
|
|
30
30
|
ProofData.fromBuffer(reader, PublicChonkVerifierPublicInputs),
|
|
31
|
-
|
|
31
|
+
ProofDataForFixedVk.fromBuffer(reader, AvmCircuitPublicInputs),
|
|
32
32
|
reader.readObject(PublicBaseRollupHints),
|
|
33
33
|
);
|
|
34
34
|
}
|
package/src/tests/factories.ts
CHANGED
|
@@ -135,7 +135,7 @@ import { CountedL2ToL1Message, L2ToL1Message, ScopedL2ToL1Message } from '../mes
|
|
|
135
135
|
import { ParityBasePrivateInputs } from '../parity/parity_base_private_inputs.js';
|
|
136
136
|
import { ParityPublicInputs } from '../parity/parity_public_inputs.js';
|
|
137
137
|
import { ParityRootPrivateInputs } from '../parity/parity_root_private_inputs.js';
|
|
138
|
-
import { ProofData } from '../proofs/index.js';
|
|
138
|
+
import { ProofData, ProofDataForFixedVk } from '../proofs/index.js';
|
|
139
139
|
import { Proof } from '../proofs/proof.js';
|
|
140
140
|
import { makeRecursiveProof } from '../proofs/recursive_proof.js';
|
|
141
141
|
import { PrivateBaseRollupHints, PublicBaseRollupHints } from '../rollup/base_rollup_hints.js';
|
|
@@ -439,7 +439,10 @@ function makeAvmAccumulatedDataArrayLengths(seed = 1) {
|
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
export function makeGas(seed = 1) {
|
|
442
|
-
|
|
442
|
+
// Constrain gas values to u32 range
|
|
443
|
+
const daGas = seed % 2 ** 32;
|
|
444
|
+
const l2Gas = (seed + 1) % 2 ** 32;
|
|
445
|
+
return new Gas(daGas, l2Gas);
|
|
443
446
|
}
|
|
444
447
|
|
|
445
448
|
/**
|
|
@@ -722,7 +725,9 @@ function makeFeeRecipient(seed = 1) {
|
|
|
722
725
|
* @returns An append only tree snapshot.
|
|
723
726
|
*/
|
|
724
727
|
export function makeAppendOnlyTreeSnapshot(seed = 1): AppendOnlyTreeSnapshot {
|
|
725
|
-
|
|
728
|
+
// Constrain nextAvailableLeafIndex to u32 range
|
|
729
|
+
const nextAvailableLeafIndex = seed % 2 ** 32;
|
|
730
|
+
return new AppendOnlyTreeSnapshot(fr(seed), nextAvailableLeafIndex);
|
|
726
731
|
}
|
|
727
732
|
|
|
728
733
|
/**
|
|
@@ -1125,6 +1130,14 @@ export function makeProofData<T extends Bufferable, PROOF_LENGTH extends number>
|
|
|
1125
1130
|
);
|
|
1126
1131
|
}
|
|
1127
1132
|
|
|
1133
|
+
function makeProofDataForFixedVk<T extends Bufferable, PROOF_LENGTH extends number>(
|
|
1134
|
+
seed = 0,
|
|
1135
|
+
makePublicInputs: (seed: number) => T,
|
|
1136
|
+
proofSize: PROOF_LENGTH = NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH as PROOF_LENGTH,
|
|
1137
|
+
) {
|
|
1138
|
+
return new ProofDataForFixedVk(makePublicInputs(seed), makeRecursiveProof<PROOF_LENGTH>(proofSize, seed + 0x100));
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1128
1141
|
function makeContractClassLogFields(seed = 1) {
|
|
1129
1142
|
return new ContractClassLogFields(makeArray(CONTRACT_CLASS_LOG_SIZE_IN_FIELDS, fr, seed));
|
|
1130
1143
|
}
|
|
@@ -1177,7 +1190,11 @@ export function makePublicTxBaseRollupPrivateInputs(seed = 0) {
|
|
|
1177
1190
|
makePublicChonkVerifierPublicInputs,
|
|
1178
1191
|
RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
1179
1192
|
);
|
|
1180
|
-
const avmProofData =
|
|
1193
|
+
const avmProofData = makeProofDataForFixedVk(
|
|
1194
|
+
seed + 0x100,
|
|
1195
|
+
makeAvmCircuitPublicInputs,
|
|
1196
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
1197
|
+
);
|
|
1181
1198
|
const hints = makePublicBaseRollupHints(seed + 0x200);
|
|
1182
1199
|
|
|
1183
1200
|
return PublicTxBaseRollupPrivateInputs.from({
|