@aztec/stdlib 3.0.0-nightly.20251118 → 3.0.0-nightly.20251120

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 (40) hide show
  1. package/dest/avm/avm.d.ts +5 -11
  2. package/dest/avm/avm.d.ts.map +1 -1
  3. package/dest/avm/avm.js +11 -9
  4. package/dest/kernel/hints/build_transient_data_hints.d.ts +1 -1
  5. package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
  6. package/dest/kernel/hints/build_transient_data_hints.js +2 -2
  7. package/dest/kernel/hints/private_kernel_reset_hints.d.ts +1 -11
  8. package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
  9. package/dest/kernel/hints/private_kernel_reset_hints.js +4 -9
  10. package/dest/kernel/private_circuit_public_inputs.d.ts +17 -1
  11. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  12. package/dest/kernel/private_circuit_public_inputs.js +16 -4
  13. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +9 -1
  14. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  15. package/dest/kernel/private_kernel_circuit_public_inputs.js +8 -4
  16. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +9 -1
  17. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
  18. package/dest/kernel/private_kernel_init_circuit_private_inputs.js +7 -3
  19. package/dest/kernel/private_validation_requests.d.ts +1 -14
  20. package/dest/kernel/private_validation_requests.d.ts.map +1 -1
  21. package/dest/kernel/private_validation_requests.js +5 -13
  22. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +5 -5
  23. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
  24. package/dest/rollup/checkpoint_root_rollup_private_inputs.js +4 -4
  25. package/dest/tests/factories.d.ts.map +1 -1
  26. package/dest/tests/factories.js +2 -0
  27. package/dest/tx/public_simulation_output.d.ts +2 -0
  28. package/dest/tx/public_simulation_output.d.ts.map +1 -1
  29. package/dest/tx/public_simulation_output.js +8 -1
  30. package/package.json +8 -8
  31. package/src/avm/avm.ts +10 -17
  32. package/src/kernel/hints/build_transient_data_hints.ts +2 -2
  33. package/src/kernel/hints/private_kernel_reset_hints.ts +0 -8
  34. package/src/kernel/private_circuit_public_inputs.ts +20 -0
  35. package/src/kernel/private_kernel_circuit_public_inputs.ts +7 -0
  36. package/src/kernel/private_kernel_init_circuit_private_inputs.ts +6 -0
  37. package/src/kernel/private_validation_requests.ts +1 -13
  38. package/src/rollup/checkpoint_root_rollup_private_inputs.ts +5 -5
  39. package/src/tests/factories.ts +2 -0
  40. package/src/tx/public_simulation_output.ts +18 -1
@@ -34,6 +34,10 @@ export class PrivateKernelInitCircuitPrivateInputs {
34
34
  * A hint to what will be the first nullifier of the transaction, used for nonce generation.
35
35
  */
36
36
  public firstNullifierHint: Fr,
37
+ /**
38
+ * A claim to the final min revertible side effect counter of a tx.
39
+ */
40
+ public revertibleCounterHint: number,
37
41
  ) {}
38
42
 
39
43
  /**
@@ -47,6 +51,7 @@ export class PrivateKernelInitCircuitPrivateInputs {
47
51
  this.protocolContracts,
48
52
  this.privateCall,
49
53
  this.firstNullifierHint,
54
+ this.revertibleCounterHint,
50
55
  );
51
56
  }
52
57
 
@@ -64,6 +69,7 @@ export class PrivateKernelInitCircuitPrivateInputs {
64
69
  reader.readObject(PrivateCallData),
65
70
  reader.readBoolean(),
66
71
  Fr.fromBuffer(reader),
72
+ reader.readNumber(),
67
73
  );
68
74
  }
69
75
  }
@@ -11,7 +11,6 @@ import { inspect } from 'util';
11
11
  import { ScopedKeyValidationRequestAndGenerator } from '../kernel/hints/scoped_key_validation_request_and_generator.js';
12
12
  import { ClaimedLengthArray, ClaimedLengthArrayFromBuffer } from './claimed_length_array.js';
13
13
  import { ScopedReadRequest } from './hints/read_request.js';
14
- import { OptionalNumber } from './utils/optional_number.js';
15
14
 
16
15
  /**
17
16
  * Validation requests accumulated during the execution of the transaction.
@@ -33,20 +32,13 @@ export class PrivateValidationRequests {
33
32
  ScopedKeyValidationRequestAndGenerator,
34
33
  typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX
35
34
  >,
36
- /**
37
- * The counter to split the data for squashing.
38
- * A revertible nullifier and a non-revertible note hash will not be squashed.
39
- * It should be the "final" minRevertibleSideEffectCounter of a tx.
40
- */
41
- public splitCounter: OptionalNumber,
42
35
  ) {}
43
36
 
44
37
  getSize() {
45
38
  return (
46
39
  this.noteHashReadRequests.getSize() +
47
40
  this.nullifierReadRequests.getSize() +
48
- this.scopedKeyValidationRequestsAndGenerators.getSize() +
49
- this.splitCounter.getSize()
41
+ this.scopedKeyValidationRequestsAndGenerators.getSize()
50
42
  );
51
43
  }
52
44
 
@@ -55,7 +47,6 @@ export class PrivateValidationRequests {
55
47
  this.noteHashReadRequests,
56
48
  this.nullifierReadRequests,
57
49
  this.scopedKeyValidationRequestsAndGenerators,
58
- this.splitCounter,
59
50
  );
60
51
  }
61
52
 
@@ -76,7 +67,6 @@ export class PrivateValidationRequests {
76
67
  reader.readObject(
77
68
  ClaimedLengthArrayFromBuffer(ScopedKeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_TX),
78
69
  ),
79
- reader.readObject(OptionalNumber),
80
70
  );
81
71
  }
82
72
 
@@ -94,7 +84,6 @@ export class PrivateValidationRequests {
94
84
  ClaimedLengthArray.empty(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX),
95
85
  ClaimedLengthArray.empty(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX),
96
86
  ClaimedLengthArray.empty(ScopedKeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_TX),
97
- OptionalNumber.empty(),
98
87
  );
99
88
  }
100
89
 
@@ -103,7 +92,6 @@ export class PrivateValidationRequests {
103
92
  noteHashReadRequests: ${inspect(this.noteHashReadRequests)},
104
93
  nullifierReadRequests: ${inspect(this.nullifierReadRequests)},
105
94
  scopedKeyValidationRequestsAndGenerators: ${inspect(this.scopedKeyValidationRequestsAndGenerators)},
106
- splitCounter: ${this.splitCounter.getSize()}
107
95
  `;
108
96
  }
109
97
  }
@@ -1,5 +1,5 @@
1
1
  import { BlobAccumulator, FinalBlobBatchingChallenges } from '@aztec/blob-lib/types';
2
- import { ARCHIVE_HEIGHT, BLOBS_PER_BLOCK, FIELDS_PER_BLOB } from '@aztec/constants';
2
+ import { ARCHIVE_HEIGHT, BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB } from '@aztec/constants';
3
3
  import { BLS12Point, Fr } from '@aztec/foundation/fields';
4
4
  import { bufferSchemaFor } from '@aztec/foundation/schemas';
5
5
  import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
@@ -31,13 +31,13 @@ export class CheckpointRootRollupHints {
31
31
  /**
32
32
  * Flat list of all tx effects which will be added to the blob.
33
33
  * Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
34
- * Tuple<Fr, FIELDS_PER_BLOB * BLOBS_PER_BLOCK>
34
+ * Tuple<Fr, FIELDS_PER_BLOB * BLOBS_PER_CHECKPOINT>
35
35
  */
36
36
  public blobFields: Fr[],
37
37
  /**
38
38
  * KZG commitments representing the blob (precomputed in ts, injected to use inside circuit).
39
39
  */
40
- public blobCommitments: Tuple<BLS12Point, typeof BLOBS_PER_BLOCK>,
40
+ public blobCommitments: Tuple<BLS12Point, typeof BLOBS_PER_CHECKPOINT>,
41
41
  /**
42
42
  * The hash of eth blob hashes for this block
43
43
  * See yarn-project/foundation/src/blob/index.ts or body.ts for calculation
@@ -74,8 +74,8 @@ export class CheckpointRootRollupHints {
74
74
  reader.readObject(FinalBlobBatchingChallenges),
75
75
  // Below line gives error 'Type instantiation is excessively deep and possibly infinite. ts(2589)'
76
76
  // reader.readArray(FIELDS_PER_BLOB, Fr),
77
- Array.from({ length: FIELDS_PER_BLOB * BLOBS_PER_BLOCK }, () => Fr.fromBuffer(reader)),
78
- reader.readArray(BLOBS_PER_BLOCK, BLS12Point),
77
+ Array.from({ length: FIELDS_PER_BLOB * BLOBS_PER_CHECKPOINT }, () => Fr.fromBuffer(reader)),
78
+ reader.readArray(BLOBS_PER_CHECKPOINT, BLS12Point),
79
79
  Fr.fromBuffer(reader),
80
80
  );
81
81
  }
@@ -663,6 +663,8 @@ export function makePrivateCircuitPublicInputs(seed = 0): PrivateCircuitPublicIn
663
663
  contractClassLogsHashes: makeClaimedLengthArray(MAX_CONTRACT_CLASS_LOGS_PER_TX, makeCountedLogHash, seed + 0xa00),
664
664
  startSideEffectCounter: fr(seed + 0x849),
665
665
  endSideEffectCounter: fr(seed + 0x850),
666
+ expectedNonRevertibleSideEffectCounter: fr(seed + 0x860),
667
+ expectedRevertibleSideEffectCounter: fr(seed + 0x861),
666
668
  anchorBlockHeader: makeHeader(seed + 0xd00, undefined),
667
669
  txContext: makeTxContext(seed + 0x1400),
668
670
  isFeePayer: false,
@@ -7,6 +7,7 @@ import { z } from 'zod';
7
7
  import { SimulationError } from '../errors/simulation_error.js';
8
8
  import { Gas } from '../gas/gas.js';
9
9
  import type { GasUsed } from '../gas/gas_used.js';
10
+ import { NullishToUndefined } from '../schemas/schemas.js';
10
11
  import { TxEffect } from '../tx/tx_effect.js';
11
12
  import { GlobalVariables } from './global_variables.js';
12
13
 
@@ -23,15 +24,31 @@ export class NestedProcessReturnValues {
23
24
  this.nested = nested ?? [];
24
25
  }
25
26
 
27
+ equals(other: NestedProcessReturnValues): boolean {
28
+ return (
29
+ this.values?.length === other.values?.length &&
30
+ this.nested.length === other.nested.length &&
31
+ (this.values === undefined || this.values.every((v, i) => v.equals(other.values![i]))) &&
32
+ this.nested.every((n, i) => n.equals(other.nested[i]))
33
+ );
34
+ }
35
+
26
36
  static get schema(): ZodFor<NestedProcessReturnValues> {
27
37
  return z
28
38
  .object({
29
- values: z.array(schemas.Fr).optional(),
39
+ values: NullishToUndefined(z.array(schemas.Fr)),
30
40
  nested: z.array(z.lazy(() => NestedProcessReturnValues.schema)),
31
41
  })
32
42
  .transform(({ values, nested }) => new NestedProcessReturnValues(values, nested));
33
43
  }
34
44
 
45
+ static fromPlainObject(obj: any): NestedProcessReturnValues {
46
+ return new NestedProcessReturnValues(
47
+ obj.values?.map(Fr.fromPlainObject),
48
+ obj.nested?.map(NestedProcessReturnValues.fromPlainObject),
49
+ );
50
+ }
51
+
35
52
  static empty() {
36
53
  return new NestedProcessReturnValues([]);
37
54
  }