@aztec/stdlib 1.0.0-nightly.20250605 → 1.0.0-nightly.20250607

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 (89) hide show
  1. package/dest/avm/avm.d.ts +304 -406
  2. package/dest/avm/avm.d.ts.map +1 -1
  3. package/dest/avm/avm_accumulated_data.d.ts +0 -8
  4. package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
  5. package/dest/avm/avm_circuit_public_inputs.d.ts +60 -90
  6. package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
  7. package/dest/avm/avm_proving_request.d.ts +184 -251
  8. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  9. package/dest/avm/message_pack.d.ts.map +1 -1
  10. package/dest/avm/message_pack.js +2 -1
  11. package/dest/block/l2_block_code_to_purge.js +1 -1
  12. package/dest/block/l2_block_source.d.ts +2 -0
  13. package/dest/block/l2_block_source.d.ts.map +1 -1
  14. package/dest/config/node-rpc-config.d.ts +2 -0
  15. package/dest/config/node-rpc-config.d.ts.map +1 -1
  16. package/dest/config/node-rpc-config.js +5 -0
  17. package/dest/fees/transaction_fee.js +3 -3
  18. package/dest/gas/gas.js +1 -1
  19. package/dest/gas/gas_fees.d.ts +15 -14
  20. package/dest/gas/gas_fees.d.ts.map +1 -1
  21. package/dest/gas/gas_fees.js +17 -18
  22. package/dest/gas/gas_settings.d.ts +24 -24
  23. package/dest/gas/gas_settings.d.ts.map +1 -1
  24. package/dest/gas/gas_settings.js +1 -1
  25. package/dest/hash/hash.d.ts +2 -3
  26. package/dest/hash/hash.d.ts.map +1 -1
  27. package/dest/hash/hash.js +3 -4
  28. package/dest/interfaces/archiver.d.ts.map +1 -1
  29. package/dest/interfaces/archiver.js +1 -0
  30. package/dest/interfaces/proving-job.d.ts +184 -251
  31. package/dest/interfaces/proving-job.d.ts.map +1 -1
  32. package/dest/interfaces/server_circuit_prover.d.ts +4 -0
  33. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  34. package/dest/interfaces/service.d.ts +1 -2
  35. package/dest/interfaces/service.d.ts.map +1 -1
  36. package/dest/interfaces/service.js +0 -7
  37. package/dest/kernel/private_accumulated_data.d.ts +3 -3
  38. package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
  39. package/dest/kernel/private_accumulated_data.js +3 -3
  40. package/dest/kernel/private_circuit_public_inputs.d.ts +4 -4
  41. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  42. package/dest/kernel/private_circuit_public_inputs.js +4 -4
  43. package/dest/kernel/private_to_avm_accumulated_data.d.ts +0 -8
  44. package/dest/kernel/private_to_avm_accumulated_data.d.ts.map +1 -1
  45. package/dest/messaging/l2_to_l1_message.d.ts +108 -16
  46. package/dest/messaging/l2_to_l1_message.d.ts.map +1 -1
  47. package/dest/messaging/l2_to_l1_message.js +76 -37
  48. package/dest/note/extended_note.d.ts +8 -8
  49. package/dest/note/extended_note.d.ts.map +1 -1
  50. package/dest/note/extended_note.js +9 -9
  51. package/dest/tests/factories.d.ts +1 -2
  52. package/dest/tests/factories.d.ts.map +1 -1
  53. package/dest/tests/factories.js +11 -8
  54. package/dest/tests/mocks.d.ts +1 -1
  55. package/dest/tests/mocks.d.ts.map +1 -1
  56. package/dest/tests/mocks.js +2 -2
  57. package/dest/tx/global_variables.d.ts +12 -12
  58. package/dest/tx/global_variables.js +2 -2
  59. package/dest/tx/proposed_block_header.d.ts +2 -2
  60. package/dest/tx/proposed_block_header.js +1 -1
  61. package/dest/tx/tx_context.d.ts +32 -32
  62. package/dest/types/shared.d.ts +4 -0
  63. package/dest/types/shared.d.ts.map +1 -1
  64. package/dest/zkpassport/index.d.ts +31 -0
  65. package/dest/zkpassport/index.d.ts.map +1 -0
  66. package/dest/zkpassport/index.js +81 -0
  67. package/package.json +9 -8
  68. package/src/avm/message_pack.ts +1 -0
  69. package/src/block/l2_block_code_to_purge.ts +1 -1
  70. package/src/block/l2_block_source.ts +3 -0
  71. package/src/config/node-rpc-config.ts +7 -0
  72. package/src/fees/transaction_fee.ts +5 -5
  73. package/src/gas/gas.ts +1 -1
  74. package/src/gas/gas_fees.ts +27 -23
  75. package/src/gas/gas_settings.ts +1 -5
  76. package/src/hash/hash.ts +3 -4
  77. package/src/interfaces/archiver.ts +1 -0
  78. package/src/interfaces/server_circuit_prover.ts +5 -0
  79. package/src/interfaces/service.ts +1 -11
  80. package/src/kernel/private_accumulated_data.ts +4 -4
  81. package/src/kernel/private_circuit_public_inputs.ts +5 -5
  82. package/src/messaging/l2_to_l1_message.ts +88 -39
  83. package/src/note/extended_note.ts +8 -8
  84. package/src/tests/factories.ts +13 -9
  85. package/src/tests/mocks.ts +2 -2
  86. package/src/tx/global_variables.ts +2 -2
  87. package/src/tx/proposed_block_header.ts +1 -1
  88. package/src/types/shared.ts +5 -0
  89. package/src/zkpassport/index.ts +115 -0
@@ -49,30 +49,30 @@ export declare class TxContext {
49
49
  l2Gas: string | number | bigint;
50
50
  }>;
51
51
  maxFeesPerGas: z.ZodEffects<z.ZodObject<{
52
- feePerDaGas: z.ZodType<Fr, any, string>;
53
- feePerL2Gas: z.ZodType<Fr, any, string>;
52
+ feePerDaGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
53
+ feePerL2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
54
54
  }, "strip", z.ZodTypeAny, {
55
- feePerDaGas: Fr;
56
- feePerL2Gas: Fr;
55
+ feePerDaGas: bigint;
56
+ feePerL2Gas: bigint;
57
57
  }, {
58
- feePerDaGas: string;
59
- feePerL2Gas: string;
58
+ feePerDaGas: string | number | bigint;
59
+ feePerL2Gas: string | number | bigint;
60
60
  }>, import("../gas/gas_fees.js").GasFees, {
61
- feePerDaGas: string;
62
- feePerL2Gas: string;
61
+ feePerDaGas: string | number | bigint;
62
+ feePerL2Gas: string | number | bigint;
63
63
  }>;
64
64
  maxPriorityFeesPerGas: z.ZodEffects<z.ZodObject<{
65
- feePerDaGas: z.ZodType<Fr, any, string>;
66
- feePerL2Gas: z.ZodType<Fr, any, string>;
65
+ feePerDaGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
66
+ feePerL2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
67
67
  }, "strip", z.ZodTypeAny, {
68
- feePerDaGas: Fr;
69
- feePerL2Gas: Fr;
68
+ feePerDaGas: bigint;
69
+ feePerL2Gas: bigint;
70
70
  }, {
71
- feePerDaGas: string;
72
- feePerL2Gas: string;
71
+ feePerDaGas: string | number | bigint;
72
+ feePerL2Gas: string | number | bigint;
73
73
  }>, import("../gas/gas_fees.js").GasFees, {
74
- feePerDaGas: string;
75
- feePerL2Gas: string;
74
+ feePerDaGas: string | number | bigint;
75
+ feePerL2Gas: string | number | bigint;
76
76
  }>;
77
77
  }, "strip", z.ZodTypeAny, {
78
78
  gasLimits: import("../gas/gas.js").Gas;
@@ -89,12 +89,12 @@ export declare class TxContext {
89
89
  l2Gas: string | number | bigint;
90
90
  };
91
91
  maxFeesPerGas: {
92
- feePerDaGas: string;
93
- feePerL2Gas: string;
92
+ feePerDaGas: string | number | bigint;
93
+ feePerL2Gas: string | number | bigint;
94
94
  };
95
95
  maxPriorityFeesPerGas: {
96
- feePerDaGas: string;
97
- feePerL2Gas: string;
96
+ feePerDaGas: string | number | bigint;
97
+ feePerL2Gas: string | number | bigint;
98
98
  };
99
99
  }>, GasSettings, {
100
100
  gasLimits: {
@@ -106,12 +106,12 @@ export declare class TxContext {
106
106
  l2Gas: string | number | bigint;
107
107
  };
108
108
  maxFeesPerGas: {
109
- feePerDaGas: string;
110
- feePerL2Gas: string;
109
+ feePerDaGas: string | number | bigint;
110
+ feePerL2Gas: string | number | bigint;
111
111
  };
112
112
  maxPriorityFeesPerGas: {
113
- feePerDaGas: string;
114
- feePerL2Gas: string;
113
+ feePerDaGas: string | number | bigint;
114
+ feePerL2Gas: string | number | bigint;
115
115
  };
116
116
  }>;
117
117
  }, "strip", z.ZodTypeAny, {
@@ -131,12 +131,12 @@ export declare class TxContext {
131
131
  l2Gas: string | number | bigint;
132
132
  };
133
133
  maxFeesPerGas: {
134
- feePerDaGas: string;
135
- feePerL2Gas: string;
134
+ feePerDaGas: string | number | bigint;
135
+ feePerL2Gas: string | number | bigint;
136
136
  };
137
137
  maxPriorityFeesPerGas: {
138
- feePerDaGas: string;
139
- feePerL2Gas: string;
138
+ feePerDaGas: string | number | bigint;
139
+ feePerL2Gas: string | number | bigint;
140
140
  };
141
141
  };
142
142
  }>, TxContext, {
@@ -152,12 +152,12 @@ export declare class TxContext {
152
152
  l2Gas: string | number | bigint;
153
153
  };
154
154
  maxFeesPerGas: {
155
- feePerDaGas: string;
156
- feePerL2Gas: string;
155
+ feePerDaGas: string | number | bigint;
156
+ feePerL2Gas: string | number | bigint;
157
157
  };
158
158
  maxPriorityFeesPerGas: {
159
- feePerDaGas: string;
160
- feePerL2Gas: string;
159
+ feePerDaGas: string | number | bigint;
160
+ feePerL2Gas: string | number | bigint;
161
161
  };
162
162
  };
163
163
  }>;
@@ -23,6 +23,10 @@ export type UInt32 = number;
23
23
  * A type alias for a 64-bit unsigned integer.
24
24
  */
25
25
  export type UInt64 = bigint;
26
+ /**
27
+ * A type alias for a 128-bit unsigned integer.
28
+ */
29
+ export type UInt128 = bigint;
26
30
  /**
27
31
  * CircuitType replaces ComposerType for now. When using Plonk, CircuitType is equivalent to the information of the proving system that will be used
28
32
  * to construct a proof. In the future Aztec zk stack, more information must be specified (e.g., the curve over which circuits are constructed;
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/types/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,6BAA6B,CAAC;AAEjF;;GAEG;AACH,qBAAa,MAAM,CAAC,CAAC,SAAS,UAAU;IAEpC;;OAEG;IACI,KAAK,EAAE,CAAC,EAAE;;IAHjB;;OAEG;IACI,KAAK,EAAE,CAAC,EAAE;IAGnB,QAAQ;IAIR,cAAc;CAGf;AAED;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;;;GAIG;AACH,oBAAY,WAAW;IACrB,QAAQ,IAAI;IACZ,KAAK,IAAI;CACV;AAED;;GAEG;AACH,oBAAY,WAAW;IACrB,IAAI,IAAI;IACR,KAAK,IAAI;IACT,IAAI,IAAI;CACT"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/types/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,6BAA6B,CAAC;AAEjF;;GAEG;AACH,qBAAa,MAAM,CAAC,CAAC,SAAS,UAAU;IAEpC;;OAEG;IACI,KAAK,EAAE,CAAC,EAAE;;IAHjB;;OAEG;IACI,KAAK,EAAE,CAAC,EAAE;IAGnB,QAAQ;IAIR,cAAc;CAGf;AAED;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;;;GAIG;AACH,oBAAY,WAAW;IACrB,QAAQ,IAAI;IACZ,KAAK,IAAI;CACV;AAED;;GAEG;AACH,oBAAY,WAAW;IACrB,IAAI,IAAI;IACR,KAAK,IAAI;IACT,IAAI,IAAI;CACT"}
@@ -0,0 +1,31 @@
1
+ import { Buffer32 } from '@aztec/foundation/buffer';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+ export type ViemZkPassportProofParams = {
4
+ vkeyHash: `0x${string}`;
5
+ proof: `0x${string}`;
6
+ publicInputs: `0x${string}`[];
7
+ committedInputs: `0x${string}`;
8
+ committedInputCounts: bigint[];
9
+ validityPeriodInDays: bigint;
10
+ scope: string;
11
+ subscope: string;
12
+ devMode: boolean;
13
+ };
14
+ export declare class ZkPassportProofParams {
15
+ devMode: boolean;
16
+ vkeyHash: Buffer32;
17
+ proof: Buffer;
18
+ publicInputs: Fr[];
19
+ committedInputs: Buffer;
20
+ committedInputCounts: bigint[];
21
+ validityPeriodInDays: bigint;
22
+ scope: string;
23
+ subscope: string;
24
+ constructor(devMode: boolean, vkeyHash: Buffer32, proof: Buffer, publicInputs: Fr[], committedInputs: Buffer, committedInputCounts: bigint[], validityPeriodInDays: bigint, scope: string, subscope: string);
25
+ toBuffer(): Buffer<ArrayBufferLike>;
26
+ static random(): ZkPassportProofParams;
27
+ static fromBuffer(buffer: Buffer): ZkPassportProofParams;
28
+ static fromViem(params: ViemZkPassportProofParams): ZkPassportProofParams;
29
+ toViem(): ViemZkPassportProofParams;
30
+ }
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zkpassport/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,KAAK,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,KAAK,MAAM,EAAE,EAAE,CAAC;IAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAIF,qBAAa,qBAAqB;IAEvB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,MAAM;IACb,YAAY,EAAE,EAAE,EAAE;IAClB,eAAe,EAAE,MAAM;IACvB,oBAAoB,EAAE,MAAM,EAAE;IAC9B,oBAAoB,EAAE,MAAM;IAC5B,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;gBARhB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,EAAE,EAAE,EAClB,eAAe,EAAE,MAAM,EACvB,oBAAoB,EAAE,MAAM,EAAE,EAC9B,oBAAoB,EAAE,MAAM,EAC5B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM;IAGzB,QAAQ;IAkBR,MAAM,CAAC,MAAM;IAqBb,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;IAehC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,yBAAyB;IAcjD,MAAM,IAAI,yBAAyB;CAapC"}
@@ -0,0 +1,81 @@
1
+ import { Buffer32 } from '@aztec/foundation/buffer';
2
+ import { randomBytes } from '@aztec/foundation/crypto';
3
+ import { Fr } from '@aztec/foundation/fields';
4
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
+ import { withoutHexPrefix } from '@aztec/foundation/string';
6
+ // NOTE: Must match the ZkPassportProofParams struct in the zkpassport verifier contract
7
+ // find here: ROOT/l1-contracts/lib/circuits/src/solidity/src/ZKPassportVerifier.sol
8
+ export class ZkPassportProofParams {
9
+ devMode;
10
+ vkeyHash;
11
+ proof;
12
+ publicInputs;
13
+ committedInputs;
14
+ committedInputCounts;
15
+ validityPeriodInDays;
16
+ scope;
17
+ subscope;
18
+ constructor(devMode, vkeyHash, proof, publicInputs, committedInputs, committedInputCounts, validityPeriodInDays, scope, subscope){
19
+ this.devMode = devMode;
20
+ this.vkeyHash = vkeyHash;
21
+ this.proof = proof;
22
+ this.publicInputs = publicInputs;
23
+ this.committedInputs = committedInputs;
24
+ this.committedInputCounts = committedInputCounts;
25
+ this.validityPeriodInDays = validityPeriodInDays;
26
+ this.scope = scope;
27
+ this.subscope = subscope;
28
+ }
29
+ toBuffer() {
30
+ return serializeToBuffer([
31
+ this.devMode,
32
+ this.vkeyHash,
33
+ this.proof.length,
34
+ this.proof,
35
+ this.publicInputs.length,
36
+ this.publicInputs,
37
+ this.committedInputs.length,
38
+ this.committedInputs,
39
+ this.committedInputCounts.length,
40
+ this.committedInputCounts,
41
+ this.validityPeriodInDays,
42
+ this.scope,
43
+ this.subscope
44
+ ]);
45
+ }
46
+ static random() {
47
+ const committedInputCounts = [
48
+ BigInt(1),
49
+ BigInt(2),
50
+ BigInt(3),
51
+ BigInt(4)
52
+ ];
53
+ const numberOfCommittedInputs = committedInputCounts.reduce((acc, count)=>acc + count, BigInt(0));
54
+ const committedInputs = randomBytes(Number(numberOfCommittedInputs) * 32);
55
+ const publicInputsCount = numberOfCommittedInputs + 16n;
56
+ const publicInputs = Array.from({
57
+ length: Number(publicInputsCount)
58
+ }, ()=>Fr.random());
59
+ return new ZkPassportProofParams(false, Buffer32.random(), randomBytes(1024), publicInputs, committedInputs, committedInputCounts, BigInt(100), 'sequencer.alpha-testnet.aztec.network', 'personhood');
60
+ }
61
+ static fromBuffer(buffer) {
62
+ const reader = BufferReader.asReader(buffer);
63
+ return new ZkPassportProofParams(reader.readBoolean(), reader.readObject(Buffer32), reader.readBuffer(), reader.readVector(Fr), reader.readBuffer(), reader.readUint256Vector(), reader.readUInt256(), reader.readString(), reader.readString());
64
+ }
65
+ static fromViem(params) {
66
+ return new ZkPassportProofParams(params.devMode, Buffer32.fromString(params.vkeyHash), Buffer.from(withoutHexPrefix(params.proof), 'hex'), params.publicInputs.map((input)=>Fr.fromString(input)), Buffer.from(withoutHexPrefix(params.committedInputs), 'hex'), params.committedInputCounts, params.validityPeriodInDays, params.scope, params.subscope);
67
+ }
68
+ toViem() {
69
+ return {
70
+ devMode: this.devMode,
71
+ vkeyHash: this.vkeyHash.toString(),
72
+ proof: `0x${this.proof.toString('hex')}`,
73
+ publicInputs: this.publicInputs.map((input)=>input.toString()),
74
+ committedInputs: `0x${this.committedInputs.toString('hex')}`,
75
+ committedInputCounts: this.committedInputCounts,
76
+ validityPeriodInDays: this.validityPeriodInDays,
77
+ scope: this.scope,
78
+ subscope: this.subscope
79
+ };
80
+ }
81
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "1.0.0-nightly.20250605",
3
+ "version": "1.0.0-nightly.20250607",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -50,7 +50,8 @@
50
50
  "./validators": "./dest/validators/index.js",
51
51
  "./file-store": "./dest/file-store/index.js",
52
52
  "./snapshots": "./dest/snapshots/index.js",
53
- "./update-checker": "./dest/update-checker/index.js"
53
+ "./update-checker": "./dest/update-checker/index.js",
54
+ "./zkpassport": "./dest/zkpassport/index.js"
54
55
  },
55
56
  "typedocOptions": {
56
57
  "entryPoints": [
@@ -67,12 +68,12 @@
67
68
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
68
69
  },
69
70
  "dependencies": {
70
- "@aztec/bb.js": "1.0.0-nightly.20250605",
71
- "@aztec/blob-lib": "1.0.0-nightly.20250605",
72
- "@aztec/constants": "1.0.0-nightly.20250605",
73
- "@aztec/ethereum": "1.0.0-nightly.20250605",
74
- "@aztec/foundation": "1.0.0-nightly.20250605",
75
- "@aztec/noir-noirc_abi": "1.0.0-nightly.20250605",
71
+ "@aztec/bb.js": "1.0.0-nightly.20250607",
72
+ "@aztec/blob-lib": "1.0.0-nightly.20250607",
73
+ "@aztec/constants": "1.0.0-nightly.20250607",
74
+ "@aztec/ethereum": "1.0.0-nightly.20250607",
75
+ "@aztec/foundation": "1.0.0-nightly.20250607",
76
+ "@aztec/noir-noirc_abi": "1.0.0-nightly.20250607",
76
77
  "@google-cloud/storage": "^7.15.0",
77
78
  "axios": "^1.9.0",
78
79
  "json-stringify-deterministic": "1.0.12",
@@ -13,6 +13,7 @@ export function serializeWithMessagePack(obj: any): Buffer {
13
13
  // this makes it compatible with other MessagePack decoders
14
14
  useRecords: false,
15
15
  int64AsType: 'bigint',
16
+ largeBigIntToString: true,
16
17
  });
17
18
  return encoder.encode(obj);
18
19
  }
@@ -98,6 +98,6 @@ export function makeGlobalVariables(
98
98
  new Fr(seed + 4),
99
99
  EthAddress.fromField(new Fr(seed + 5)),
100
100
  AztecAddress.fromField(new Fr(seed + 6)),
101
- new GasFees(new Fr(seed + 7), new Fr(seed + 8)),
101
+ new GasFees(seed + 7, seed + 8),
102
102
  );
103
103
  }
@@ -119,6 +119,9 @@ export interface L2BlockSource {
119
119
  */
120
120
  getL1Constants(): Promise<L1RollupConstants>;
121
121
 
122
+ /** Latest synced L1 timestamp. */
123
+ getL1Timestamp(): Promise<bigint>;
124
+
122
125
  /** Force a sync. */
123
126
  syncImmediate(): Promise<void>;
124
127
  }
@@ -6,9 +6,16 @@ export const nodeRpcConfigMappings: ConfigMappingsType<NodeRPCConfig> = {
6
6
  description: 'Maximum gas limit for public tx simulation in the node on `simulatePublicCalls`.',
7
7
  ...numberConfigHelper(10e9),
8
8
  },
9
+ rpcMaxBatchSize: {
10
+ env: 'RPC_MAX_BATCH_SIZE',
11
+ description: 'Maximum allowed batch size for JSON RPC batch requests.',
12
+ ...numberConfigHelper(100),
13
+ },
9
14
  };
10
15
 
11
16
  export type NodeRPCConfig = {
12
17
  /** Maximum gas limit for public tx simulation in the node on `simulatePublicCalls`. */
13
18
  rpcSimulatePublicMaxGasLimit: number;
19
+ /** Maximum allowed batch size for JSON RPC batch requests. */
20
+ rpcMaxBatchSize: number;
14
21
  };
@@ -10,15 +10,15 @@ import type { GasSettings } from '../gas/gas_settings.js';
10
10
  */
11
11
  export function computeEffectiveGasFees(gasFees: GasFees, gasSettings: GasSettings): GasFees {
12
12
  const { maxFeesPerGas, maxPriorityFeesPerGas } = gasSettings;
13
- const minField = (f1: Fr, f2: Fr) => (f1.lt(f2) ? f1 : f2);
13
+ const minBigInt = (f1: bigint, f2: bigint) => (f1 < f2 ? f1 : f2);
14
14
  const priorityFees = new GasFees(
15
- minField(maxPriorityFeesPerGas.feePerDaGas, maxFeesPerGas.feePerDaGas.sub(gasFees.feePerDaGas)),
16
- minField(maxPriorityFeesPerGas.feePerL2Gas, maxFeesPerGas.feePerL2Gas.sub(gasFees.feePerL2Gas)),
15
+ minBigInt(maxPriorityFeesPerGas.feePerDaGas, maxFeesPerGas.feePerDaGas - gasFees.feePerDaGas),
16
+ minBigInt(maxPriorityFeesPerGas.feePerL2Gas, maxFeesPerGas.feePerL2Gas - gasFees.feePerL2Gas),
17
17
  );
18
18
 
19
19
  const effectiveFees = new GasFees(
20
- gasFees.feePerDaGas.add(priorityFees.feePerDaGas),
21
- gasFees.feePerL2Gas.add(priorityFees.feePerL2Gas),
20
+ gasFees.feePerDaGas + priorityFees.feePerDaGas,
21
+ gasFees.feePerL2Gas + priorityFees.feePerL2Gas,
22
22
  );
23
23
 
24
24
  return effectiveFees;
package/src/gas/gas.ts CHANGED
@@ -88,7 +88,7 @@ export class Gas {
88
88
 
89
89
  computeFee(gasFees: GasFees) {
90
90
  return GasDimensions.reduce(
91
- (acc, dimension) => acc.add(gasFees.get(dimension).mul(new Fr(this.get(dimension)))),
91
+ (acc, dimension) => acc.add(new Fr(gasFees.get(dimension)).mul(new Fr(this.get(dimension)))),
92
92
  Fr.ZERO,
93
93
  );
94
94
  }
@@ -1,28 +1,35 @@
1
1
  import { Fr } from '@aztec/foundation/fields';
2
2
  import { schemas } from '@aztec/foundation/schemas';
3
- import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
3
+ import {
4
+ BufferReader,
5
+ FieldReader,
6
+ bigintToUInt128BE,
7
+ serializeToBuffer,
8
+ serializeToFields,
9
+ } from '@aztec/foundation/serialize';
4
10
  import type { FieldsOf } from '@aztec/foundation/types';
5
11
 
6
12
  import { inspect } from 'util';
7
13
  import { z } from 'zod';
8
14
 
15
+ import type { UInt128 } from '../types/shared.js';
9
16
  import type { GasDimensions } from './gas.js';
10
17
 
11
18
  /** Gas prices for each dimension. */
12
19
  export class GasFees {
13
- public readonly feePerDaGas: Fr;
14
- public readonly feePerL2Gas: Fr;
20
+ public readonly feePerDaGas: UInt128;
21
+ public readonly feePerL2Gas: UInt128;
15
22
 
16
- constructor(feePerDaGas: Fr | number | bigint, feePerL2Gas: Fr | number | bigint) {
17
- this.feePerDaGas = new Fr(feePerDaGas);
18
- this.feePerL2Gas = new Fr(feePerL2Gas);
23
+ constructor(feePerDaGas: number | bigint, feePerL2Gas: number | bigint) {
24
+ this.feePerDaGas = BigInt(feePerDaGas);
25
+ this.feePerL2Gas = BigInt(feePerL2Gas);
19
26
  }
20
27
 
21
28
  static get schema() {
22
29
  return z
23
30
  .object({
24
- feePerDaGas: schemas.Fr,
25
- feePerL2Gas: schemas.Fr,
31
+ feePerDaGas: schemas.BigInt,
32
+ feePerL2Gas: schemas.BigInt,
26
33
  })
27
34
  .transform(GasFees.from);
28
35
  }
@@ -32,7 +39,7 @@ export class GasFees {
32
39
  }
33
40
 
34
41
  equals(other: GasFees) {
35
- return this.feePerDaGas.equals(other.feePerDaGas) && this.feePerL2Gas.equals(other.feePerL2Gas);
42
+ return this.feePerDaGas === other.feePerDaGas && this.feePerL2Gas === other.feePerL2Gas;
36
43
  }
37
44
 
38
45
  get(dimension: GasDimensions) {
@@ -48,12 +55,9 @@ export class GasFees {
48
55
  if (scalar === 1 || scalar === 1n) {
49
56
  return this.clone();
50
57
  } else if (typeof scalar === 'bigint') {
51
- return new GasFees(new Fr(this.feePerDaGas.toBigInt() * scalar), new Fr(this.feePerL2Gas.toBigInt() * scalar));
58
+ return new GasFees(this.feePerDaGas * scalar, this.feePerL2Gas * scalar);
52
59
  } else {
53
- return new GasFees(
54
- new Fr(this.feePerDaGas.toNumberUnsafe() * scalar),
55
- new Fr(this.feePerL2Gas.toNumberUnsafe() * scalar),
56
- );
60
+ return new GasFees(Number(this.feePerDaGas) * scalar, Number(this.feePerL2Gas) * scalar);
57
61
  }
58
62
  }
59
63
 
@@ -62,29 +66,29 @@ export class GasFees {
62
66
  }
63
67
 
64
68
  static random() {
65
- return new GasFees(Fr.random(), Fr.random());
69
+ return new GasFees(Math.floor(Math.random() * 1e9), Math.floor(Math.random() * 1e9));
66
70
  }
67
71
 
68
72
  static empty() {
69
- return new GasFees(Fr.ZERO, Fr.ZERO);
73
+ return new GasFees(0, 0);
70
74
  }
71
75
 
72
76
  isEmpty() {
73
- return this.feePerDaGas.isZero() && this.feePerL2Gas.isZero();
77
+ return this.feePerDaGas === 0n && this.feePerL2Gas === 0n;
74
78
  }
75
79
 
76
80
  static fromBuffer(buffer: Buffer | BufferReader): GasFees {
77
81
  const reader = BufferReader.asReader(buffer);
78
- return new GasFees(reader.readObject(Fr), reader.readObject(Fr));
82
+ return new GasFees(reader.readUInt128(), reader.readUInt128());
79
83
  }
80
84
 
81
85
  toBuffer() {
82
- return serializeToBuffer(this.feePerDaGas, this.feePerL2Gas);
86
+ return serializeToBuffer(bigintToUInt128BE(this.feePerDaGas), bigintToUInt128BE(this.feePerL2Gas));
83
87
  }
84
88
 
85
89
  static fromFields(fields: Fr[] | FieldReader) {
86
90
  const reader = FieldReader.asReader(fields);
87
- return new GasFees(reader.readField(), reader.readField());
91
+ return new GasFees(reader.readField().toBigInt(), reader.readField().toBigInt());
88
92
  }
89
93
 
90
94
  toFields() {
@@ -93,12 +97,12 @@ export class GasFees {
93
97
 
94
98
  toInspect() {
95
99
  return {
96
- feePerDaGas: this.feePerDaGas.toNumberUnsafe(),
97
- feePerL2Gas: this.feePerL2Gas.toNumberUnsafe(),
100
+ feePerDaGas: this.feePerDaGas,
101
+ feePerL2Gas: this.feePerL2Gas,
98
102
  };
99
103
  }
100
104
 
101
105
  [inspect.custom]() {
102
- return `GasFees { feePerDaGas=${this.feePerDaGas.toBigInt()} feePerL2Gas=${this.feePerL2Gas.toBigInt()} }`;
106
+ return `GasFees { feePerDaGas=${this.feePerDaGas} feePerL2Gas=${this.feePerL2Gas} }`;
103
107
  }
104
108
  }
@@ -60,11 +60,7 @@ export class GasSettings {
60
60
  /** Returns the maximum fee to be paid according to gas limits and max fees set. */
61
61
  getFeeLimit() {
62
62
  return GasDimensions.reduce(
63
- (acc, dimension) =>
64
- this.maxFeesPerGas
65
- .get(dimension)
66
- .mul(new Fr(this.gasLimits.get(dimension)))
67
- .add(acc),
63
+ (acc, dimension) => new Fr(this.maxFeesPerGas.get(dimension)).mul(new Fr(this.gasLimits.get(dimension))).add(acc),
68
64
  Fr.ZERO,
69
65
  );
70
66
  }
package/src/hash/hash.ts CHANGED
@@ -37,13 +37,12 @@ export function siloNoteHash(contract: AztecAddress, noteHash: Fr): Promise<Fr>
37
37
 
38
38
  /**
39
39
  * Computes a unique note hash.
40
- * @dev Includes a nonce which contains data that guarantees the resulting note hash will be unique.
41
- * @param nonce - A nonce (typically derived from tx hash and note hash index in the tx).
40
+ * @param noteNonce - The nonce that was injected into the note hash preimage in order to guarantee uniqueness.
42
41
  * @param siloedNoteHash - A siloed note hash.
43
42
  * @returns A unique note hash.
44
43
  */
45
- export function computeUniqueNoteHash(nonce: Fr, siloedNoteHash: Fr): Promise<Fr> {
46
- return poseidon2HashWithSeparator([nonce, siloedNoteHash], GeneratorIndex.UNIQUE_NOTE_HASH);
44
+ export function computeUniqueNoteHash(noteNonce: Fr, siloedNoteHash: Fr): Promise<Fr> {
45
+ return poseidon2HashWithSeparator([noteNonce, siloedNoteHash], GeneratorIndex.UNIQUE_NOTE_HASH);
47
46
  }
48
47
 
49
48
  /**
@@ -73,5 +73,6 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
73
73
  getL1ToL2MessageIndex: z.function().args(schemas.Fr).returns(schemas.BigInt.optional()),
74
74
  getDebugFunctionName: z.function().args(schemas.AztecAddress, schemas.FunctionSelector).returns(optional(z.string())),
75
75
  getL1Constants: z.function().args().returns(L1RollupConstantsSchema),
76
+ getL1Timestamp: z.function().args().returns(schemas.BigInt),
76
77
  syncImmediate: z.function().args().returns(z.void()),
77
78
  };
@@ -165,4 +165,9 @@ export interface ClientProtocolCircuitVerifier {
165
165
  * @returns True if the proof is valid, false otherwise
166
166
  */
167
167
  verifyProof(tx: Tx): Promise<boolean>;
168
+
169
+ /**
170
+ * Stop the verifier.
171
+ */
172
+ stop(): Promise<void>;
168
173
  }
@@ -16,7 +16,7 @@ export interface Service {
16
16
  }
17
17
 
18
18
  /** Tries to call stop on a given object and awaits it. Logs any errors and does not rethrow. */
19
- export async function tryStop(service?: Partial<Service>, logger?: Logger): Promise<void> {
19
+ export async function tryStop(service?: Partial<Pick<Service, 'stop'>>, logger?: Logger): Promise<void> {
20
20
  try {
21
21
  return typeof service === 'object' && service && 'stop' in service && typeof service.stop === 'function'
22
22
  ? await service.stop()
@@ -25,13 +25,3 @@ export async function tryStop(service?: Partial<Service>, logger?: Logger): Prom
25
25
  logger?.error(`Error stopping service ${(service as object).constructor?.name}: ${err}`);
26
26
  }
27
27
  }
28
-
29
- export function tryRestart(service?: Partial<Service>, logger?: Logger) {
30
- try {
31
- return typeof service === 'object' && service && 'restart' in service && typeof service.restart === 'function'
32
- ? service.restart()
33
- : Promise.resolve();
34
- } catch (err) {
35
- logger?.error(`Error restarting service ${(service as object).constructor?.name}: ${err}`);
36
- }
37
- }
@@ -11,7 +11,7 @@ import { makeTuple } from '@aztec/foundation/array';
11
11
  import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
12
12
  import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
13
13
 
14
- import { ScopedL2ToL1Message } from '../messaging/l2_to_l1_message.js';
14
+ import { ScopedCountedL2ToL1Message } from '../messaging/l2_to_l1_message.js';
15
15
  import { ScopedCountedLogHash } from './log_hash.js';
16
16
  import { ScopedNoteHash } from './note_hash.js';
17
17
  import { ScopedNullifier } from './nullifier.js';
@@ -36,7 +36,7 @@ export class PrivateAccumulatedData {
36
36
  /**
37
37
  * All the new L2 to L1 messages created in this transaction.
38
38
  */
39
- public l2ToL1Msgs: Tuple<ScopedL2ToL1Message, typeof MAX_L2_TO_L1_MSGS_PER_TX>,
39
+ public l2ToL1Msgs: Tuple<ScopedCountedL2ToL1Message, typeof MAX_L2_TO_L1_MSGS_PER_TX>,
40
40
  /**
41
41
  * Accumulated logs from all the previous kernel iterations.
42
42
  */
@@ -82,7 +82,7 @@ export class PrivateAccumulatedData {
82
82
  return new PrivateAccumulatedData(
83
83
  reader.readArray(MAX_NOTE_HASHES_PER_TX, ScopedNoteHash),
84
84
  reader.readArray(MAX_NULLIFIERS_PER_TX, ScopedNullifier),
85
- reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message),
85
+ reader.readArray(MAX_L2_TO_L1_MSGS_PER_TX, ScopedCountedL2ToL1Message),
86
86
  reader.readArray(MAX_PRIVATE_LOGS_PER_TX, ScopedPrivateLogData),
87
87
  reader.readArray(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedCountedLogHash),
88
88
  reader.readArray(MAX_ENQUEUED_CALLS_PER_TX, CountedPublicCallRequest),
@@ -103,7 +103,7 @@ export class PrivateAccumulatedData {
103
103
  return new PrivateAccumulatedData(
104
104
  makeTuple(MAX_NOTE_HASHES_PER_TX, ScopedNoteHash.empty),
105
105
  makeTuple(MAX_NULLIFIERS_PER_TX, ScopedNullifier.empty),
106
- makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedL2ToL1Message.empty),
106
+ makeTuple(MAX_L2_TO_L1_MSGS_PER_TX, ScopedCountedL2ToL1Message.empty),
107
107
  makeTuple(MAX_PRIVATE_LOGS_PER_TX, ScopedPrivateLogData.empty),
108
108
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ScopedCountedLogHash.empty),
109
109
  makeTuple(MAX_ENQUEUED_CALLS_PER_TX, CountedPublicCallRequest.empty),
@@ -27,7 +27,7 @@ import { KeyValidationRequestAndGenerator } from '../kernel/hints/key_validation
27
27
  import { CountedLogHash } from '../kernel/log_hash.js';
28
28
  import { PrivateCallRequest } from '../kernel/private_call_request.js';
29
29
  import { PrivateLogData } from '../kernel/private_log_data.js';
30
- import { L2ToL1Message } from '../messaging/l2_to_l1_message.js';
30
+ import { CountedL2ToL1Message } from '../messaging/l2_to_l1_message.js';
31
31
  import { BlockHeader } from '../tx/block_header.js';
32
32
  import { CallContext } from '../tx/call_context.js';
33
33
  import { MaxBlockNumber } from '../tx/max_block_number.js';
@@ -105,7 +105,7 @@ export class PrivateCircuitPublicInputs {
105
105
  /**
106
106
  * New L2 to L1 messages created by the corresponding function call.
107
107
  */
108
- public l2ToL1Msgs: Tuple<L2ToL1Message, typeof MAX_L2_TO_L1_MSGS_PER_CALL>,
108
+ public l2ToL1Msgs: Tuple<CountedL2ToL1Message, typeof MAX_L2_TO_L1_MSGS_PER_CALL>,
109
109
  /**
110
110
  * Logs emitted in this function call.
111
111
  */
@@ -167,7 +167,7 @@ export class PrivateCircuitPublicInputs {
167
167
  reader.readArray(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, PrivateCallRequest),
168
168
  reader.readArray(MAX_ENQUEUED_CALLS_PER_CALL, CountedPublicCallRequest),
169
169
  reader.readObject(PublicCallRequest),
170
- reader.readArray(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message),
170
+ reader.readArray(MAX_L2_TO_L1_MSGS_PER_CALL, CountedL2ToL1Message),
171
171
  reader.readArray(MAX_PRIVATE_LOGS_PER_CALL, PrivateLogData),
172
172
  reader.readArray(MAX_CONTRACT_CLASS_LOGS_PER_CALL, CountedLogHash),
173
173
  reader.readObject(Fr),
@@ -194,7 +194,7 @@ export class PrivateCircuitPublicInputs {
194
194
  reader.readArray(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, PrivateCallRequest),
195
195
  reader.readArray(MAX_ENQUEUED_CALLS_PER_CALL, CountedPublicCallRequest),
196
196
  reader.readObject(PublicCallRequest),
197
- reader.readArray(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message),
197
+ reader.readArray(MAX_L2_TO_L1_MSGS_PER_CALL, CountedL2ToL1Message),
198
198
  reader.readArray(MAX_PRIVATE_LOGS_PER_CALL, PrivateLogData),
199
199
  reader.readArray(MAX_CONTRACT_CLASS_LOGS_PER_CALL, CountedLogHash),
200
200
  reader.readField(),
@@ -224,7 +224,7 @@ export class PrivateCircuitPublicInputs {
224
224
  makeTuple(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL, PrivateCallRequest.empty),
225
225
  makeTuple(MAX_ENQUEUED_CALLS_PER_CALL, CountedPublicCallRequest.empty),
226
226
  PublicCallRequest.empty(),
227
- makeTuple(MAX_L2_TO_L1_MSGS_PER_CALL, L2ToL1Message.empty),
227
+ makeTuple(MAX_L2_TO_L1_MSGS_PER_CALL, CountedL2ToL1Message.empty),
228
228
  makeTuple(MAX_PRIVATE_LOGS_PER_CALL, PrivateLogData.empty),
229
229
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_CALL, CountedLogHash.empty),
230
230
  Fr.ZERO,