@aztec/stdlib 5.0.0-nightly.20260320 → 5.0.0-nightly.20260322

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 (38) hide show
  1. package/dest/abi/buffer.d.ts +14 -4
  2. package/dest/abi/buffer.d.ts.map +1 -1
  3. package/dest/abi/buffer.js +25 -4
  4. package/dest/avm/avm.d.ts +300 -300
  5. package/dest/block/l2_block_source.d.ts +5 -3
  6. package/dest/block/l2_block_source.d.ts.map +1 -1
  7. package/dest/contract/index.d.ts +1 -3
  8. package/dest/contract/index.d.ts.map +1 -1
  9. package/dest/contract/index.js +0 -2
  10. package/dest/contract/interfaces/contract_class.d.ts +3 -156
  11. package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
  12. package/dest/contract/interfaces/contract_class.js +1 -28
  13. package/dest/epoch-helpers/index.d.ts +3 -1
  14. package/dest/epoch-helpers/index.d.ts.map +1 -1
  15. package/dest/epoch-helpers/index.js +6 -0
  16. package/dest/interfaces/proving-job.d.ts +34 -34
  17. package/dest/tests/factories.d.ts +2 -4
  18. package/dest/tests/factories.d.ts.map +1 -1
  19. package/dest/tests/factories.js +0 -27
  20. package/dest/tx/validator/error_texts.d.ts +5 -1
  21. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  22. package/dest/tx/validator/error_texts.js +6 -0
  23. package/package.json +8 -8
  24. package/src/abi/buffer.ts +25 -4
  25. package/src/block/l2_block_source.ts +4 -2
  26. package/src/contract/index.ts +0 -2
  27. package/src/contract/interfaces/contract_class.ts +2 -82
  28. package/src/epoch-helpers/index.ts +11 -0
  29. package/src/tests/factories.ts +0 -33
  30. package/src/tx/validator/error_texts.ts +8 -0
  31. package/dest/contract/private_function_membership_proof.d.ts +0 -32
  32. package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
  33. package/dest/contract/private_function_membership_proof.js +0 -124
  34. package/dest/contract/utility_function_membership_proof.d.ts +0 -27
  35. package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
  36. package/dest/contract/utility_function_membership_proof.js +0 -87
  37. package/src/contract/private_function_membership_proof.ts +0 -167
  38. package/src/contract/utility_function_membership_proof.ts +0 -118
@@ -8,9 +8,19 @@ import { Fr } from '@aztec/foundation/curves/bn254';
8
8
  */
9
9
  export declare function bufferAsFields(input: Buffer, targetLength: number): Fr[];
10
10
  /**
11
- * Recovers a buffer from an array of fields.
12
- * @param fields - An output from bufferAsFields.
13
- * @returns The recovered buffer.
11
+ * Recovers a buffer from an array of fields previously encoded with bufferAsFields.
12
+ *
13
+ * The first field encodes the byte length of the original buffer. The remaining fields
14
+ * each carry 31 bytes of payload (the leading byte of each 32-byte field element is skipped).
15
+ *
16
+ * If the declared byte length exceeds the bytes available from the payload fields, the result
17
+ * is zero-padded to the full declared length. This is important for correctness when the field
18
+ * array has been truncated (e.g. contract class logs reconstructed from blobs using a short
19
+ * emittedLength): without padding, the resulting buffer would be shorter than declared, causing
20
+ * bytecode commitment computations to diverge from what the circuit produced.
21
+ *
22
+ * @param fields - An output from bufferAsFields: [byteLength, ...payloadFields].
23
+ * @returns A buffer of exactly `byteLength` bytes.
14
24
  */
15
25
  export declare function bufferFromFields(fields: Fr[]): Buffer;
16
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVmZmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYWJpL2J1ZmZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFJcEQ7Ozs7OztHQU1HO0FBQ0gsd0JBQWdCLGNBQWMsQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFFLFlBQVksRUFBRSxNQUFNLEdBQUcsRUFBRSxFQUFFLENBY3hFO0FBRUQ7Ozs7R0FJRztBQUNILHdCQUFnQixnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsRUFBRSxFQUFFLEdBQUcsTUFBTSxDQUdyRCJ9
26
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVmZmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYWJpL2J1ZmZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFJcEQ7Ozs7OztHQU1HO0FBQ0gsd0JBQWdCLGNBQWMsQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFFLFlBQVksRUFBRSxNQUFNLEdBQUcsRUFBRSxFQUFFLENBY3hFO0FBRUQ7Ozs7Ozs7Ozs7Ozs7O0dBY0c7QUFDSCx3QkFBZ0IsZ0JBQWdCLENBQUMsTUFBTSxFQUFFLEVBQUUsRUFBRSxHQUFHLE1BQU0sQ0FjckQifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../src/abi/buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAIpD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,EAAE,EAAE,CAcxE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAGrD"}
1
+ {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../src/abi/buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAIpD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,EAAE,EAAE,CAcxE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAcrD"}
@@ -25,10 +25,31 @@ import chunk from 'lodash.chunk';
25
25
  ];
26
26
  }
27
27
  /**
28
- * Recovers a buffer from an array of fields.
29
- * @param fields - An output from bufferAsFields.
30
- * @returns The recovered buffer.
28
+ * Recovers a buffer from an array of fields previously encoded with bufferAsFields.
29
+ *
30
+ * The first field encodes the byte length of the original buffer. The remaining fields
31
+ * each carry 31 bytes of payload (the leading byte of each 32-byte field element is skipped).
32
+ *
33
+ * If the declared byte length exceeds the bytes available from the payload fields, the result
34
+ * is zero-padded to the full declared length. This is important for correctness when the field
35
+ * array has been truncated (e.g. contract class logs reconstructed from blobs using a short
36
+ * emittedLength): without padding, the resulting buffer would be shorter than declared, causing
37
+ * bytecode commitment computations to diverge from what the circuit produced.
38
+ *
39
+ * @param fields - An output from bufferAsFields: [byteLength, ...payloadFields].
40
+ * @returns A buffer of exactly `byteLength` bytes.
31
41
  */ export function bufferFromFields(fields) {
32
42
  const [length, ...payload] = fields;
33
- return Buffer.concat(payload.map((f)=>f.toBuffer().subarray(1))).subarray(0, length.toNumber());
43
+ const byteLength = length.toNumber();
44
+ const raw = Buffer.concat(payload.map((f)=>f.toBuffer().subarray(1)));
45
+ if (raw.length >= byteLength) {
46
+ return raw.subarray(0, byteLength);
47
+ }
48
+ // Pad with zeros if the declared length exceeds the available payload bytes.
49
+ // This ensures the returned buffer always matches the declared length, so that
50
+ // downstream bytecode commitment computations are consistent even when the
51
+ // source field array was truncated (e.g. reconstructed from blob with a short emittedLength).
52
+ const result = Buffer.alloc(byteLength);
53
+ raw.copy(result);
54
+ return result;
34
55
  }