@aztec/stdlib 0.87.0 → 0.87.2-nightly.20250523
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/abi/abi.d.ts +3 -0
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +38 -0
- package/dest/avm/avm.d.ts +92 -0
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.d.ts +77 -0
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +67 -0
- package/dest/avm/avm_circuit_public_inputs.d.ts +73 -3
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +19 -9
- package/dest/avm/avm_proving_request.d.ts +104 -0
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/body.d.ts +1 -1
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +2 -2
- package/dest/block/l2_block.d.ts +1 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +2 -2
- package/dest/interfaces/proving-job.d.ts +108 -4
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +2 -2
- package/dest/interfaces/server_circuit_prover.d.ts +3 -2
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/kernel/public_call_request.d.ts +54 -0
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +58 -0
- package/dest/logs/pending_tagged_log.d.ts +1 -1
- package/dest/logs/pending_tagged_log.js +1 -1
- package/dest/rollup/avm_proof_data.d.ts +5 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/avm_proof_data.js +10 -2
- package/dest/rollup/root_rollup.d.ts +9 -10
- package/dest/rollup/root_rollup.d.ts.map +1 -1
- package/dest/rollup/root_rollup.js +9 -20
- package/dest/tests/factories.d.ts +2 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +12 -6
- package/dest/tx/tx_effect.d.ts +1 -1
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +2 -2
- package/dest/tx/validator/error_texts.d.ts +1 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +1 -1
- package/package.json +7 -7
- package/src/abi/abi.ts +37 -0
- package/src/avm/avm_accumulated_data.ts +93 -0
- package/src/avm/avm_circuit_public_inputs.ts +22 -2
- package/src/block/body.ts +7 -2
- package/src/block/l2_block.ts +2 -1
- package/src/interfaces/proving-job.ts +3 -3
- package/src/interfaces/server_circuit_prover.ts +3 -2
- package/src/kernel/public_call_request.ts +66 -0
- package/src/logs/pending_tagged_log.ts +1 -1
- package/src/rollup/avm_proof_data.ts +10 -3
- package/src/rollup/root_rollup.ts +6 -19
- package/src/tests/factories.ts +22 -10
- package/src/tx/tx_effect.ts +23 -5
- package/src/tx/validator/error_texts.ts +1 -1
package/src/block/l2_block.ts
CHANGED
|
@@ -86,8 +86,9 @@ export class L2Block {
|
|
|
86
86
|
numPublicLogsPerCall = 1,
|
|
87
87
|
inHash: Buffer | undefined = undefined,
|
|
88
88
|
slotNumber: number | undefined = undefined,
|
|
89
|
+
maxEffects: number | undefined = undefined,
|
|
89
90
|
): Promise<L2Block> {
|
|
90
|
-
const body = await Body.random(txsPerBlock, numPublicCallsPerTx, numPublicLogsPerCall);
|
|
91
|
+
const body = await Body.random(txsPerBlock, numPublicCallsPerTx, numPublicLogsPerCall, maxEffects);
|
|
91
92
|
|
|
92
93
|
return new L2Block(
|
|
93
94
|
makeAppendOnlyTreeSnapshot(l2BlockNum + 1),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -179,7 +179,7 @@ export type ProvingJobInputsMap = {
|
|
|
179
179
|
export const ProvingJobResult = z.discriminatedUnion('type', [
|
|
180
180
|
z.object({
|
|
181
181
|
type: z.literal(ProvingRequestType.PUBLIC_VM),
|
|
182
|
-
result: schemaForRecursiveProofAndVerificationKey(
|
|
182
|
+
result: schemaForRecursiveProofAndVerificationKey(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
183
183
|
}),
|
|
184
184
|
z.object({
|
|
185
185
|
type: z.literal(ProvingRequestType.PRIVATE_BASE_ROLLUP),
|
|
@@ -249,7 +249,7 @@ export const ProvingJobResult = z.discriminatedUnion('type', [
|
|
|
249
249
|
]);
|
|
250
250
|
export type ProvingJobResult = z.infer<typeof ProvingJobResult>;
|
|
251
251
|
export type ProvingJobResultsMap = {
|
|
252
|
-
[ProvingRequestType.PUBLIC_VM]: ProofAndVerificationKey<typeof
|
|
252
|
+
[ProvingRequestType.PUBLIC_VM]: ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
|
|
253
253
|
[ProvingRequestType.PRIVATE_BASE_ROLLUP]: PublicInputsAndRecursiveProof<
|
|
254
254
|
BaseOrMergeRollupPublicInputs,
|
|
255
255
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -149,9 +149,10 @@ export interface ServerCircuitProver {
|
|
|
149
149
|
*/
|
|
150
150
|
getAvmProof(
|
|
151
151
|
inputs: AvmCircuitInputs,
|
|
152
|
+
skipPublicInputsValidation?: boolean, // TODO(#14234)[Unconditional PIs validation]: Remove.
|
|
152
153
|
signal?: AbortSignal,
|
|
153
154
|
epochNumber?: number,
|
|
154
|
-
): Promise<ProofAndVerificationKey<typeof
|
|
155
|
+
): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>>;
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
/**
|
|
@@ -123,6 +123,72 @@ export class PublicCallRequest {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Represents lengths of arrays of public call requests.
|
|
128
|
+
*/
|
|
129
|
+
export class PublicCallRequestArrayLengths {
|
|
130
|
+
constructor(
|
|
131
|
+
/**
|
|
132
|
+
* Number of setup call requests
|
|
133
|
+
*/
|
|
134
|
+
public setupCalls: number,
|
|
135
|
+
/**
|
|
136
|
+
* Number of app logic call requests
|
|
137
|
+
*/
|
|
138
|
+
public appLogicCalls: number,
|
|
139
|
+
/**
|
|
140
|
+
* Whether there is a teardown call request
|
|
141
|
+
*/
|
|
142
|
+
public teardownCall: boolean,
|
|
143
|
+
) {}
|
|
144
|
+
|
|
145
|
+
static get schema() {
|
|
146
|
+
return z
|
|
147
|
+
.object({
|
|
148
|
+
setupCalls: z.number(),
|
|
149
|
+
appLogicCalls: z.number(),
|
|
150
|
+
teardownCall: z.boolean(),
|
|
151
|
+
})
|
|
152
|
+
.transform(({ setupCalls, appLogicCalls, teardownCall }) => {
|
|
153
|
+
return new PublicCallRequestArrayLengths(setupCalls, appLogicCalls, teardownCall);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static getFields(fields: FieldsOf<PublicCallRequestArrayLengths>) {
|
|
158
|
+
return [fields.setupCalls, fields.appLogicCalls, fields.teardownCall] as const;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static fromFields(fields: Fr[] | FieldReader): PublicCallRequestArrayLengths {
|
|
162
|
+
const reader = FieldReader.asReader(fields);
|
|
163
|
+
return new PublicCallRequestArrayLengths(reader.readU32(), reader.readU32(), reader.readBoolean());
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
toFields(): Fr[] {
|
|
167
|
+
return serializeToFields(...PublicCallRequestArrayLengths.getFields(this));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static fromBuffer(buffer: Buffer | BufferReader) {
|
|
171
|
+
const reader = BufferReader.asReader(buffer);
|
|
172
|
+
return new PublicCallRequestArrayLengths(reader.readNumber(), reader.readNumber(), reader.readBoolean());
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
toBuffer() {
|
|
176
|
+
return serializeToBuffer(...PublicCallRequestArrayLengths.getFields(this));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static empty() {
|
|
180
|
+
return new PublicCallRequestArrayLengths(0, 0, false);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
[inspect.custom]() {
|
|
184
|
+
return `PublicCallRequestArrayLengths {
|
|
185
|
+
setupCalls: ${this.setupCalls}
|
|
186
|
+
appLogicCalls: ${this.appLogicCalls}
|
|
187
|
+
teardownCall: ${this.teardownCall}
|
|
188
|
+
}`;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
126
192
|
export class CountedPublicCallRequest {
|
|
127
193
|
constructor(
|
|
128
194
|
public inner: PublicCallRequest,
|
|
@@ -5,7 +5,7 @@ import type { AztecAddress } from '../aztec-address/index.js';
|
|
|
5
5
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Represents a pending tagged log as it is stored in the pending tagged log array to which the
|
|
8
|
+
* Represents a pending tagged log as it is stored in the pending tagged log array to which the fetchTaggedLogs oracle
|
|
9
9
|
* inserts found private logs. A TS version of `pending_tagged_log.nr`.
|
|
10
10
|
*/
|
|
11
11
|
export class PendingTaggedLog {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
4
|
|
|
4
5
|
import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
|
|
@@ -8,7 +9,7 @@ import { VkWitnessData } from '../vks/vk_witness_data.js';
|
|
|
8
9
|
export class AvmProofData {
|
|
9
10
|
constructor(
|
|
10
11
|
public publicInputs: AvmCircuitPublicInputs,
|
|
11
|
-
public proof: RecursiveProof<typeof
|
|
12
|
+
public proof: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>,
|
|
12
13
|
public vkData: VkWitnessData,
|
|
13
14
|
) {}
|
|
14
15
|
|
|
@@ -28,8 +29,14 @@ export class AvmProofData {
|
|
|
28
29
|
static empty() {
|
|
29
30
|
return new AvmProofData(
|
|
30
31
|
AvmCircuitPublicInputs.empty(),
|
|
31
|
-
makeEmptyRecursiveProof(
|
|
32
|
+
makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
|
|
32
33
|
VkWitnessData.empty(),
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
37
|
+
|
|
38
|
+
// TODO(#14234)[Unconditional PIs validation]: remove this function.
|
|
39
|
+
export function enhanceProofWithPiValidationFlag(proof: Fr[], skipPublicInputsValidation: boolean): Fr[] {
|
|
40
|
+
const skipPublicInputsField = skipPublicInputsValidation ? new Fr(1) : new Fr(0);
|
|
41
|
+
return [skipPublicInputsField].concat(proof).slice(0, AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED);
|
|
42
|
+
}
|
|
@@ -7,7 +7,6 @@ import { BufferReader, type Tuple, serializeToBuffer, serializeToFields } from '
|
|
|
7
7
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
8
8
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
9
9
|
|
|
10
|
-
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
11
10
|
import { FeeRecipient } from './block_root_or_block_merge_public_inputs.js';
|
|
12
11
|
import { PreviousRollupBlockData } from './previous_rollup_block_data.js';
|
|
13
12
|
|
|
@@ -100,13 +99,10 @@ export class RootRollupInputs {
|
|
|
100
99
|
*/
|
|
101
100
|
export class RootRollupPublicInputs {
|
|
102
101
|
constructor(
|
|
103
|
-
/**
|
|
104
|
-
public
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
public endTimestamp: Fr,
|
|
108
|
-
public endBlockNumber: Fr,
|
|
109
|
-
public outHash: Fr,
|
|
102
|
+
/** Root of the archive tree before this rollup is processed */
|
|
103
|
+
public previousArchiveRoot: Fr,
|
|
104
|
+
/** Root of the archive tree after this rollup is processed */
|
|
105
|
+
public endArchiveRoot: Fr,
|
|
110
106
|
public proposedBlockHeaderHashes: Tuple<Fr, typeof AZTEC_MAX_EPOCH_DURATION>,
|
|
111
107
|
public fees: Tuple<FeeRecipient, typeof AZTEC_MAX_EPOCH_DURATION>,
|
|
112
108
|
public chainId: Fr,
|
|
@@ -119,11 +115,8 @@ export class RootRollupPublicInputs {
|
|
|
119
115
|
|
|
120
116
|
static getFields(fields: FieldsOf<RootRollupPublicInputs>) {
|
|
121
117
|
return [
|
|
122
|
-
fields.
|
|
123
|
-
fields.
|
|
124
|
-
fields.endTimestamp,
|
|
125
|
-
fields.endBlockNumber,
|
|
126
|
-
fields.outHash,
|
|
118
|
+
fields.previousArchiveRoot,
|
|
119
|
+
fields.endArchiveRoot,
|
|
127
120
|
fields.proposedBlockHeaderHashes,
|
|
128
121
|
fields.fees,
|
|
129
122
|
fields.chainId,
|
|
@@ -155,9 +148,6 @@ export class RootRollupPublicInputs {
|
|
|
155
148
|
public static fromBuffer(buffer: Buffer | BufferReader): RootRollupPublicInputs {
|
|
156
149
|
const reader = BufferReader.asReader(buffer);
|
|
157
150
|
return new RootRollupPublicInputs(
|
|
158
|
-
reader.readObject(AppendOnlyTreeSnapshot),
|
|
159
|
-
reader.readObject(AppendOnlyTreeSnapshot),
|
|
160
|
-
Fr.fromBuffer(reader),
|
|
161
151
|
Fr.fromBuffer(reader),
|
|
162
152
|
Fr.fromBuffer(reader),
|
|
163
153
|
reader.readArray(AZTEC_MAX_EPOCH_DURATION, Fr),
|
|
@@ -192,9 +182,6 @@ export class RootRollupPublicInputs {
|
|
|
192
182
|
/** Creates a random instance. */
|
|
193
183
|
static random() {
|
|
194
184
|
return new RootRollupPublicInputs(
|
|
195
|
-
AppendOnlyTreeSnapshot.random(),
|
|
196
|
-
AppendOnlyTreeSnapshot.random(),
|
|
197
|
-
Fr.random(),
|
|
198
185
|
Fr.random(),
|
|
199
186
|
Fr.random(),
|
|
200
187
|
makeTuple(AZTEC_MAX_EPOCH_DURATION, Fr.random),
|
package/src/tests/factories.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { makeBlockBlobPublicInputs, makeSpongeBlob } from '@aztec/blob-lib/testing';
|
|
2
2
|
import {
|
|
3
3
|
ARCHIVE_HEIGHT,
|
|
4
|
-
|
|
4
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
5
5
|
AZTEC_MAX_EPOCH_DURATION,
|
|
6
6
|
BLOBS_PER_BLOCK,
|
|
7
7
|
CONTRACT_CLASS_LOG_SIZE_IN_FIELDS,
|
|
@@ -55,6 +55,7 @@ import { ContractStorageRead } from '../avm/contract_storage_read.js';
|
|
|
55
55
|
import { ContractStorageUpdateRequest } from '../avm/contract_storage_update_request.js';
|
|
56
56
|
import {
|
|
57
57
|
AvmAccumulatedData,
|
|
58
|
+
AvmAccumulatedDataArrayLengths,
|
|
58
59
|
AvmAppendLeavesHint,
|
|
59
60
|
AvmBytecodeCommitmentHint,
|
|
60
61
|
AvmCircuitInputs,
|
|
@@ -115,7 +116,11 @@ import { PrivateCallRequest } from '../kernel/private_call_request.js';
|
|
|
115
116
|
import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inputs.js';
|
|
116
117
|
import { PrivateLogData } from '../kernel/private_log_data.js';
|
|
117
118
|
import { PrivateToRollupKernelCircuitPublicInputs } from '../kernel/private_to_rollup_kernel_circuit_public_inputs.js';
|
|
118
|
-
import {
|
|
119
|
+
import {
|
|
120
|
+
CountedPublicCallRequest,
|
|
121
|
+
PublicCallRequest,
|
|
122
|
+
PublicCallRequestArrayLengths,
|
|
123
|
+
} from '../kernel/public_call_request.js';
|
|
119
124
|
import { PublicKeys, computeAddress } from '../keys/index.js';
|
|
120
125
|
import { ContractClassLogFields } from '../logs/index.js';
|
|
121
126
|
import { PrivateLog } from '../logs/private_log.js';
|
|
@@ -368,6 +373,10 @@ function makeAvmAccumulatedData(seed = 1) {
|
|
|
368
373
|
);
|
|
369
374
|
}
|
|
370
375
|
|
|
376
|
+
function makeAvmAccumulatedDataArrayLengths(seed = 1) {
|
|
377
|
+
return new AvmAccumulatedDataArrayLengths(seed, seed + 1, seed + 2, seed + 3, seed + 4);
|
|
378
|
+
}
|
|
379
|
+
|
|
371
380
|
export function makeGas(seed = 1) {
|
|
372
381
|
return new Gas(seed, seed + 1);
|
|
373
382
|
}
|
|
@@ -453,6 +462,7 @@ function makeAvmCircuitPublicInputs(seed = 1) {
|
|
|
453
462
|
makeGas(seed + 0x20),
|
|
454
463
|
makeGasSettings(),
|
|
455
464
|
makeAztecAddress(seed + 0x40),
|
|
465
|
+
makePublicCallRequestArrayLengths(seed + 0x40),
|
|
456
466
|
makeTuple(MAX_ENQUEUED_CALLS_PER_TX, makePublicCallRequest, seed + 0x100),
|
|
457
467
|
makeTuple(MAX_ENQUEUED_CALLS_PER_TX, makePublicCallRequest, seed + 0x200),
|
|
458
468
|
makePublicCallRequest(seed + 0x300),
|
|
@@ -462,6 +472,7 @@ function makeAvmCircuitPublicInputs(seed = 1) {
|
|
|
462
472
|
makePrivateToAvmAccumulatedData(seed + 0x600),
|
|
463
473
|
makeTreeSnapshots(seed + 0x700),
|
|
464
474
|
makeGas(seed + 0x750),
|
|
475
|
+
makeAvmAccumulatedDataArrayLengths(seed + 0x800),
|
|
465
476
|
makeAvmAccumulatedData(seed + 0x800),
|
|
466
477
|
fr(seed + 0x900),
|
|
467
478
|
false,
|
|
@@ -533,6 +544,10 @@ export function makePublicCallRequest(seed = 1) {
|
|
|
533
544
|
return new PublicCallRequest(makeAztecAddress(seed), makeAztecAddress(seed + 1), false, fr(seed + 0x3));
|
|
534
545
|
}
|
|
535
546
|
|
|
547
|
+
export function makePublicCallRequestArrayLengths(seed = 1) {
|
|
548
|
+
return new PublicCallRequestArrayLengths(seed, seed + 1, seed % 2 === 0);
|
|
549
|
+
}
|
|
550
|
+
|
|
536
551
|
function makeCountedPublicCallRequest(seed = 1) {
|
|
537
552
|
return new CountedPublicCallRequest(makePublicCallRequest(seed), seed + 0x100);
|
|
538
553
|
}
|
|
@@ -881,13 +896,10 @@ export function makeRootParityInputs(seed = 0): RootParityInputs {
|
|
|
881
896
|
*/
|
|
882
897
|
export function makeRootRollupPublicInputs(seed = 0): RootRollupPublicInputs {
|
|
883
898
|
return new RootRollupPublicInputs(
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
fr(seed
|
|
887
|
-
|
|
888
|
-
fr(seed + 0x500),
|
|
889
|
-
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => fr(seed), 0x650),
|
|
890
|
-
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => makeFeeRecipient(seed), 0x600),
|
|
899
|
+
fr(seed + 0x100),
|
|
900
|
+
fr(seed + 0x200),
|
|
901
|
+
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => fr(seed), 0x300),
|
|
902
|
+
makeTuple(AZTEC_MAX_EPOCH_DURATION, () => makeFeeRecipient(seed), 0x500),
|
|
891
903
|
fr(seed + 0x700),
|
|
892
904
|
fr(seed + 0x701),
|
|
893
905
|
fr(seed + 0x702),
|
|
@@ -1158,7 +1170,7 @@ function makePublicTubeData(seed = 1) {
|
|
|
1158
1170
|
function makeAvmProofData(seed = 1) {
|
|
1159
1171
|
return new AvmProofData(
|
|
1160
1172
|
makeAvmCircuitPublicInputs(seed),
|
|
1161
|
-
makeRecursiveProof<typeof
|
|
1173
|
+
makeRecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, seed + 0x100),
|
|
1162
1174
|
makeVkWitnessData(seed + 0x200),
|
|
1163
1175
|
);
|
|
1164
1176
|
}
|
package/src/tx/tx_effect.ts
CHANGED
|
@@ -232,15 +232,33 @@ export class TxEffect {
|
|
|
232
232
|
return thisLayer[0];
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
static async random(
|
|
235
|
+
static async random(
|
|
236
|
+
numPublicCallsPerTx = 3,
|
|
237
|
+
numPublicLogsPerCall = 1,
|
|
238
|
+
maxEffects: number | undefined = undefined,
|
|
239
|
+
): Promise<TxEffect> {
|
|
236
240
|
return new TxEffect(
|
|
237
241
|
RevertCode.random(),
|
|
238
242
|
TxHash.random(),
|
|
239
243
|
new Fr(Math.floor(Math.random() * 100_000)),
|
|
240
|
-
makeTuple(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
+
makeTuple(
|
|
245
|
+
maxEffects === undefined ? MAX_NOTE_HASHES_PER_TX : Math.min(maxEffects, MAX_NOTE_HASHES_PER_TX),
|
|
246
|
+
Fr.random,
|
|
247
|
+
),
|
|
248
|
+
makeTuple(
|
|
249
|
+
maxEffects === undefined ? MAX_NULLIFIERS_PER_TX : Math.min(maxEffects, MAX_NULLIFIERS_PER_TX),
|
|
250
|
+
Fr.random,
|
|
251
|
+
),
|
|
252
|
+
makeTuple(
|
|
253
|
+
maxEffects === undefined ? MAX_L2_TO_L1_MSGS_PER_TX : Math.min(maxEffects, MAX_L2_TO_L1_MSGS_PER_TX),
|
|
254
|
+
Fr.random,
|
|
255
|
+
),
|
|
256
|
+
makeTuple(
|
|
257
|
+
maxEffects === undefined
|
|
258
|
+
? MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX
|
|
259
|
+
: Math.min(maxEffects, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX),
|
|
260
|
+
PublicDataWrite.random,
|
|
261
|
+
),
|
|
244
262
|
makeTuple(MAX_PRIVATE_LOGS_PER_TX, () => PrivateLog.random()),
|
|
245
263
|
await makeTupleAsync(numPublicCallsPerTx * numPublicLogsPerCall, async () => await PublicLog.random()),
|
|
246
264
|
await makeTupleAsync(MAX_CONTRACT_CLASS_LOGS_PER_TX, ContractClassLog.random),
|
|
@@ -11,7 +11,7 @@ export const TX_ERROR_DUPLICATE_NULLIFIER_IN_TX = 'Duplicate nullifier in tx';
|
|
|
11
11
|
export const TX_ERROR_EXISTING_NULLIFIER = 'Existing nullifier';
|
|
12
12
|
|
|
13
13
|
// Metadata
|
|
14
|
-
export const
|
|
14
|
+
export const TX_ERROR_INVALID_MAX_BLOCK_NUMBER = 'Invalid max block number';
|
|
15
15
|
export const TX_ERROR_INCORRECT_L1_CHAIN_ID = 'Incorrect L1 chain id';
|
|
16
16
|
export const TX_ERROR_INCORRECT_ROLLUP_VERSION = 'Incorrect rollup version';
|
|
17
17
|
export const TX_ERROR_INCORRECT_VK_TREE_ROOT = 'Incorrect protocol circuits tree root';
|