@aztec/stdlib 3.0.0-nightly.20250925 → 3.0.0-nightly.20250927

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 (118) hide show
  1. package/dest/abi/event_metadata_definition.d.ts +8 -0
  2. package/dest/abi/event_metadata_definition.d.ts.map +1 -0
  3. package/dest/abi/event_metadata_definition.js +1 -0
  4. package/dest/abi/index.d.ts +1 -0
  5. package/dest/abi/index.d.ts.map +1 -1
  6. package/dest/abi/index.js +1 -0
  7. package/dest/avm/avm_accumulated_data.d.ts +1 -0
  8. package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
  9. package/dest/avm/avm_accumulated_data.js +4 -0
  10. package/dest/avm/index.d.ts +0 -1
  11. package/dest/avm/index.d.ts.map +1 -1
  12. package/dest/avm/index.js +0 -1
  13. package/dest/block/body.d.ts.map +1 -1
  14. package/dest/block/body.js +0 -5
  15. package/dest/contract/contract_class_metadata.d.ts +8 -0
  16. package/dest/contract/contract_class_metadata.d.ts.map +1 -0
  17. package/dest/contract/contract_class_metadata.js +1 -0
  18. package/dest/contract/contract_metadata.d.ts +7 -0
  19. package/dest/contract/contract_metadata.d.ts.map +1 -0
  20. package/dest/contract/contract_metadata.js +1 -0
  21. package/dest/contract/index.d.ts +2 -0
  22. package/dest/contract/index.d.ts.map +1 -1
  23. package/dest/contract/index.js +2 -0
  24. package/dest/file-store/factory.d.ts.map +1 -1
  25. package/dest/file-store/factory.js +18 -0
  26. package/dest/file-store/s3.d.ts +25 -0
  27. package/dest/file-store/s3.d.ts.map +1 -0
  28. package/dest/file-store/s3.js +187 -0
  29. package/dest/interfaces/aztec-node-admin.d.ts +6 -0
  30. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  31. package/dest/interfaces/client.d.ts +0 -1
  32. package/dest/interfaces/client.d.ts.map +1 -1
  33. package/dest/interfaces/client.js +0 -1
  34. package/dest/interfaces/proving-job.d.ts +5 -5
  35. package/dest/interfaces/proving-job.d.ts.map +1 -1
  36. package/dest/interfaces/proving-job.js +3 -3
  37. package/dest/interfaces/server_circuit_prover.d.ts +2 -2
  38. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  39. package/dest/interfaces/slasher.d.ts +4 -0
  40. package/dest/interfaces/slasher.d.ts.map +1 -1
  41. package/dest/interfaces/slasher.js +1 -0
  42. package/dest/interfaces/validator.d.ts +6 -1
  43. package/dest/interfaces/validator.d.ts.map +1 -1
  44. package/dest/interfaces/validator.js +2 -1
  45. package/dest/logs/contract_class_log.d.ts +1 -1
  46. package/dest/logs/contract_class_log.d.ts.map +1 -1
  47. package/dest/logs/contract_class_log.js +1 -3
  48. package/dest/rollup/avm_proof_data.d.ts +2 -12
  49. package/dest/rollup/avm_proof_data.d.ts.map +1 -1
  50. package/dest/rollup/avm_proof_data.js +0 -24
  51. package/dest/rollup/base_rollup_hints.d.ts +16 -25
  52. package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
  53. package/dest/rollup/base_rollup_hints.js +26 -32
  54. package/dest/rollup/block_root_rollup_private_inputs.d.ts +13 -13
  55. package/dest/rollup/block_root_rollup_private_inputs.d.ts.map +1 -1
  56. package/dest/rollup/block_root_rollup_private_inputs.js +20 -20
  57. package/dest/rollup/index.d.ts +2 -1
  58. package/dest/rollup/index.d.ts.map +1 -1
  59. package/dest/rollup/index.js +2 -1
  60. package/dest/rollup/public_tube_private_inputs.d.ts +4 -2
  61. package/dest/rollup/public_tube_private_inputs.d.ts.map +1 -1
  62. package/dest/rollup/public_tube_private_inputs.js +7 -3
  63. package/dest/rollup/public_tube_public_inputs.d.ts +20 -0
  64. package/dest/rollup/public_tube_public_inputs.d.ts.map +1 -0
  65. package/dest/rollup/public_tube_public_inputs.js +41 -0
  66. package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts +5 -5
  67. package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts.map +1 -1
  68. package/dest/rollup/public_tx_base_rollup_private_inputs.js +3 -3
  69. package/dest/rollup/{state_diff_hints.d.ts → tree_snapshot_diff_hints.d.ts} +22 -38
  70. package/dest/rollup/tree_snapshot_diff_hints.d.ts.map +1 -0
  71. package/dest/rollup/tree_snapshot_diff_hints.js +75 -0
  72. package/dest/rollup/tx_rollup_public_inputs.d.ts +4 -4
  73. package/dest/rollup/tx_rollup_public_inputs.d.ts.map +1 -1
  74. package/dest/rollup/tx_rollup_public_inputs.js +7 -7
  75. package/dest/tests/factories.d.ts +6 -4
  76. package/dest/tests/factories.d.ts.map +1 -1
  77. package/dest/tests/factories.js +26 -28
  78. package/dest/tx/tx_effect.d.ts +3 -33
  79. package/dest/tx/tx_effect.d.ts.map +1 -1
  80. package/dest/tx/tx_effect.js +58 -191
  81. package/package.json +9 -8
  82. package/src/abi/event_metadata_definition.ts +8 -0
  83. package/src/abi/index.ts +1 -0
  84. package/src/avm/avm_accumulated_data.ts +10 -0
  85. package/src/avm/index.ts +0 -1
  86. package/src/block/body.ts +1 -7
  87. package/src/contract/contract_class_metadata.ts +8 -0
  88. package/src/contract/contract_metadata.ts +7 -0
  89. package/src/contract/index.ts +2 -0
  90. package/src/file-store/factory.ts +15 -0
  91. package/src/file-store/s3.ts +186 -0
  92. package/src/interfaces/client.ts +0 -1
  93. package/src/interfaces/proving-job.ts +4 -4
  94. package/src/interfaces/server_circuit_prover.ts +2 -7
  95. package/src/interfaces/slasher.ts +2 -0
  96. package/src/interfaces/validator.ts +5 -1
  97. package/src/logs/contract_class_log.ts +2 -3
  98. package/src/rollup/avm_proof_data.ts +2 -31
  99. package/src/rollup/base_rollup_hints.ts +20 -28
  100. package/src/rollup/block_root_rollup_private_inputs.ts +14 -14
  101. package/src/rollup/index.ts +2 -1
  102. package/src/rollup/public_tube_private_inputs.ts +10 -3
  103. package/src/rollup/public_tube_public_inputs.ts +52 -0
  104. package/src/rollup/public_tx_base_rollup_private_inputs.ts +6 -5
  105. package/src/rollup/{state_diff_hints.ts → tree_snapshot_diff_hints.ts} +26 -41
  106. package/src/rollup/tx_rollup_public_inputs.ts +4 -4
  107. package/src/tests/factories.ts +31 -43
  108. package/src/tx/tx_effect.ts +59 -204
  109. package/dest/avm/public_data_hint.d.ts +0 -16
  110. package/dest/avm/public_data_hint.d.ts.map +0 -1
  111. package/dest/avm/public_data_hint.js +0 -27
  112. package/dest/interfaces/pxe.d.ts +0 -235
  113. package/dest/interfaces/pxe.d.ts.map +0 -1
  114. package/dest/interfaces/pxe.js +0 -13
  115. package/dest/rollup/state_diff_hints.d.ts.map +0 -1
  116. package/dest/rollup/state_diff_hints.js +0 -85
  117. package/src/avm/public_data_hint.ts +0 -38
  118. package/src/interfaces/pxe.ts +0 -284
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "3.0.0-nightly.20250925",
3
+ "version": "3.0.0-nightly.20250927",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -69,13 +69,14 @@
69
69
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
70
70
  },
71
71
  "dependencies": {
72
- "@aztec/bb.js": "3.0.0-nightly.20250925",
73
- "@aztec/blob-lib": "3.0.0-nightly.20250925",
74
- "@aztec/constants": "3.0.0-nightly.20250925",
75
- "@aztec/ethereum": "3.0.0-nightly.20250925",
76
- "@aztec/foundation": "3.0.0-nightly.20250925",
77
- "@aztec/l1-artifacts": "3.0.0-nightly.20250925",
78
- "@aztec/noir-noirc_abi": "3.0.0-nightly.20250925",
72
+ "@aws-sdk/client-s3": "^3.892.0",
73
+ "@aztec/bb.js": "3.0.0-nightly.20250927",
74
+ "@aztec/blob-lib": "3.0.0-nightly.20250927",
75
+ "@aztec/constants": "3.0.0-nightly.20250927",
76
+ "@aztec/ethereum": "3.0.0-nightly.20250927",
77
+ "@aztec/foundation": "3.0.0-nightly.20250927",
78
+ "@aztec/l1-artifacts": "3.0.0-nightly.20250927",
79
+ "@aztec/noir-noirc_abi": "3.0.0-nightly.20250927",
79
80
  "@google-cloud/storage": "^7.15.0",
80
81
  "axios": "^1.9.0",
81
82
  "json-stringify-deterministic": "1.0.12",
@@ -0,0 +1,8 @@
1
+ import type { AbiType } from './abi.js';
2
+ import type { EventSelector } from './event_selector.js';
3
+
4
+ export type EventMetadataDefinition = {
5
+ eventSelector: EventSelector;
6
+ abiType: AbiType;
7
+ fieldNames: string[];
8
+ };
package/src/abi/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './buffer.js';
3
3
  export * from './decoder.js';
4
4
  export * from './encoder.js';
5
5
  export * from './authorization_selector.js';
6
+ export * from './event_metadata_definition.js';
6
7
  export * from './event_selector.js';
7
8
  export * from './function_selector.js';
8
9
  export * from './note_selector.js';
@@ -22,6 +22,7 @@ import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
22
22
  import { inspect } from 'util';
23
23
  import { z } from 'zod';
24
24
 
25
+ import { countAccumulatedItems } from '../kernel/utils/index.js';
25
26
  import { FlatPublicLogs } from '../logs/public_log.js';
26
27
  import { ScopedL2ToL1Message } from '../messaging/l2_to_l1_message.js';
27
28
  import { PublicDataWrite } from './public_data_write.js';
@@ -184,6 +185,15 @@ export class AvmAccumulatedData {
184
185
  .join(', ')}],
185
186
  }`;
186
187
  }
188
+
189
+ getArrayLengths() {
190
+ return new AvmAccumulatedDataArrayLengths(
191
+ countAccumulatedItems(this.noteHashes),
192
+ countAccumulatedItems(this.nullifiers),
193
+ countAccumulatedItems(this.l2ToL1Msgs),
194
+ countAccumulatedItems(this.publicDataWrites),
195
+ );
196
+ }
187
197
  }
188
198
 
189
199
  /**
package/src/avm/index.ts CHANGED
@@ -3,7 +3,6 @@ export * from './avm_accumulated_data.js';
3
3
  export * from './avm_circuit_public_inputs.js';
4
4
  export * from './revert_code.js';
5
5
  export * from './public_data_write.js';
6
- export * from './public_data_hint.js';
7
6
  export * from './public_data_update_request.js';
8
7
  export * from './contract_storage_update_request.js';
9
8
  export * from './contract_storage_read.js';
package/src/block/body.ts CHANGED
@@ -19,13 +19,7 @@ export function getBlockBlobFields(txEffects: TxEffect[]) {
19
19
  }
20
20
 
21
21
  export class Body {
22
- constructor(public txEffects: TxEffect[]) {
23
- txEffects.forEach(txEffect => {
24
- if (txEffect.isEmpty()) {
25
- throw new Error('Empty tx effect not allowed in Body');
26
- }
27
- });
28
- }
22
+ constructor(public txEffects: TxEffect[]) {}
29
23
 
30
24
  equals(other: Body) {
31
25
  return (
@@ -0,0 +1,8 @@
1
+ import type { ContractArtifact } from '../abi/abi.js';
2
+ import type { ContractClassWithId } from './interfaces/contract_class.js';
3
+
4
+ export interface ContractClassMetadata {
5
+ contractClass?: ContractClassWithId | undefined;
6
+ isContractClassPubliclyRegistered: boolean;
7
+ artifact?: ContractArtifact | undefined;
8
+ }
@@ -0,0 +1,7 @@
1
+ import type { ContractInstanceWithAddress } from './interfaces/contract_instance.js';
2
+
3
+ export interface ContractMetadata {
4
+ contractInstance?: ContractInstanceWithAddress | undefined;
5
+ isContractInitialized: boolean;
6
+ isContractPublished: boolean;
7
+ }
@@ -1,8 +1,10 @@
1
1
  export * from './artifact_hash.js';
2
2
  export * from './contract_address.js';
3
3
  export * from './contract_class.js';
4
+ export * from './contract_class_metadata.js';
4
5
  export * from './contract_class_id.js';
5
6
  export * from './contract_instance.js';
7
+ export * from './contract_metadata.js';
6
8
  export * from './contract_instance_update.js';
7
9
  export * from './private_function.js';
8
10
  export * from './private_function_membership_proof.js';
@@ -4,9 +4,11 @@ import { GoogleCloudFileStore } from './gcs.js';
4
4
  import { HttpFileStore } from './http.js';
5
5
  import type { FileStore, ReadOnlyFileStore } from './interface.js';
6
6
  import { LocalFileStore } from './local.js';
7
+ import { S3FileStore } from './s3.js';
7
8
 
8
9
  const supportedExamples = [
9
10
  `gs://bucket-name/path/to/store`,
11
+ `s3://bucket-name/path/to/store`,
10
12
  `file:///absolute/local/path/to/store`,
11
13
  `https://host/path`,
12
14
  ];
@@ -39,6 +41,19 @@ export async function createFileStore(
39
41
  } catch {
40
42
  throw new Error(`Invalid google cloud store definition: '${config}'.`);
41
43
  }
44
+ } else if (config.startsWith('s3://')) {
45
+ try {
46
+ const url = new URL(config);
47
+ const bucket = url.host;
48
+ const path = url.pathname.replace(/^\/+/, '');
49
+ const endpoint = url.searchParams.get('endpoint');
50
+ const publicBaseUrl = url.searchParams.get('publicBaseUrl') ?? undefined;
51
+ logger.info(`Creating S3 file store at ${bucket} ${path}`);
52
+ const store = new S3FileStore(bucket, path, { endpoint: endpoint ?? undefined, publicBaseUrl });
53
+ return store;
54
+ } catch {
55
+ throw new Error(`Invalid S3 store definition: '${config}'.`);
56
+ }
42
57
  } else {
43
58
  throw new Error(`Unknown file store config: '${config}'. Supported values are ${supportedExamples.join(', ')}.`);
44
59
  }
@@ -0,0 +1,186 @@
1
+ import { type Logger, createLogger } from '@aztec/foundation/log';
2
+
3
+ import {
4
+ GetObjectCommand,
5
+ type GetObjectCommandOutput,
6
+ HeadObjectCommand,
7
+ PutObjectCommand,
8
+ S3Client,
9
+ } from '@aws-sdk/client-s3';
10
+ import { createReadStream, createWriteStream } from 'fs';
11
+ import { mkdir } from 'fs/promises';
12
+ import { dirname, join } from 'path';
13
+ import { Readable } from 'stream';
14
+ import { finished } from 'stream/promises';
15
+ import { createGzip } from 'zlib';
16
+
17
+ import type { FileStore, FileStoreSaveOptions } from './interface.js';
18
+
19
+ function normalizeBasePath(path: string): string {
20
+ return path?.replace(/^\/+|\/+$/g, '') ?? '';
21
+ }
22
+
23
+ export class S3FileStore implements FileStore {
24
+ private readonly s3: S3Client;
25
+ private readonly region: string;
26
+ private readonly endpoint?: string;
27
+ private readonly publicBaseUrl?: string;
28
+
29
+ constructor(
30
+ private readonly bucketName: string,
31
+ private readonly basePath: string,
32
+ opts: { endpoint?: string; publicBaseUrl?: string },
33
+ private readonly log: Logger = createLogger('stdlib:s3-file-store'),
34
+ ) {
35
+ this.endpoint = opts.endpoint;
36
+ this.region = this.endpoint ? 'auto' : (process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? 'us-east-1');
37
+ this.publicBaseUrl = opts.publicBaseUrl;
38
+
39
+ const clientOptions: any = {};
40
+ if (this.endpoint) {
41
+ clientOptions.region = 'auto';
42
+ clientOptions.endpoint = this.endpoint;
43
+ clientOptions.forcePathStyle = true;
44
+ } else {
45
+ clientOptions.region = this.region;
46
+ }
47
+ this.s3 = new S3Client(clientOptions);
48
+ }
49
+
50
+ public async save(path: string, data: Buffer, opts: FileStoreSaveOptions = {}): Promise<string> {
51
+ const key = this.getFullPath(path);
52
+ const shouldCompress = !opts.compress;
53
+ const body = shouldCompress ? (await import('zlib')).gzipSync(data) : data;
54
+ const put = new PutObjectCommand({
55
+ Bucket: this.bucketName,
56
+ Key: key,
57
+ Body: body,
58
+ ContentEncoding: shouldCompress ? 'gzip' : undefined,
59
+ CacheControl: opts.metadata?.['Cache-control'],
60
+ Metadata: this.extractUserMetadata(opts.metadata),
61
+ });
62
+ await this.s3.send(put);
63
+ return this.buildReturnedUrl(key, !!opts.public);
64
+ }
65
+
66
+ public async upload(destPath: string, srcPath: string, opts: FileStoreSaveOptions = {}): Promise<string> {
67
+ const key = this.getFullPath(destPath);
68
+ const shouldCompress = opts.compress !== false; // default true like GCS impl
69
+
70
+ await mkdir(dirname(srcPath), { recursive: true }).catch(() => undefined);
71
+
72
+ const source = createReadStream(srcPath);
73
+ const bodyStream = shouldCompress ? source.pipe(createGzip()) : source;
74
+ const put = new PutObjectCommand({
75
+ Bucket: this.bucketName,
76
+ Key: key,
77
+ Body: bodyStream as any,
78
+ ContentEncoding: shouldCompress ? 'gzip' : undefined,
79
+ CacheControl: opts.metadata?.['Cache-control'],
80
+ Metadata: this.extractUserMetadata(opts.metadata),
81
+ });
82
+ await this.s3.send(put);
83
+ return this.buildReturnedUrl(key, !!opts.public);
84
+ }
85
+
86
+ public async read(pathOrUrlStr: string): Promise<Buffer> {
87
+ const { bucket, key } = this.getBucketAndKey(pathOrUrlStr);
88
+ const out: GetObjectCommandOutput = await this.s3.send(new GetObjectCommand({ Bucket: bucket, Key: key }));
89
+ const stream = out.Body as Readable;
90
+ const chunks: Buffer[] = [];
91
+ for await (const chunk of stream) {
92
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
93
+ }
94
+ return Buffer.concat(chunks);
95
+ }
96
+
97
+ public async download(pathOrUrlStr: string, destPath: string): Promise<void> {
98
+ const { bucket, key } = this.getBucketAndKey(pathOrUrlStr);
99
+ const out: GetObjectCommandOutput = await this.s3.send(new GetObjectCommand({ Bucket: bucket, Key: key }));
100
+ await mkdir(dirname(destPath), { recursive: true });
101
+ const write = createWriteStream(destPath);
102
+ await finished((out.Body as Readable).pipe(write));
103
+ }
104
+
105
+ public async exists(pathOrUrlStr: string): Promise<boolean> {
106
+ try {
107
+ const { bucket, key } = this.getBucketAndKey(pathOrUrlStr);
108
+ await this.s3.send(new HeadObjectCommand({ Bucket: bucket, Key: key }));
109
+ return true;
110
+ } catch (err: any) {
111
+ const code = err?.$metadata?.httpStatusCode ?? err?.name ?? err?.Code;
112
+ if (code === 404 || code === 'NotFound' || code === 'NoSuchKey') {
113
+ return false;
114
+ }
115
+ this.log.warn(`Error checking existence for ${pathOrUrlStr}: ${err?.message ?? String(err)}`);
116
+ return false;
117
+ }
118
+ }
119
+
120
+ private extractUserMetadata(meta?: Record<string, string>): Record<string, string> | undefined {
121
+ if (!meta) {
122
+ return undefined;
123
+ }
124
+ const { ['Cache-control']: _ignored, ...rest } = meta;
125
+ return Object.keys(rest).length ? rest : undefined;
126
+ }
127
+
128
+ private buildReturnedUrl(key: string, makePublic: boolean): string {
129
+ if (!makePublic) {
130
+ return `s3://${this.bucketName}/${key}`;
131
+ }
132
+
133
+ if (this.publicBaseUrl) {
134
+ const base = this.publicBaseUrl.replace(/\/$/, '');
135
+ // key already includes basePath via getFullPath, so do not prefix basePath again
136
+ const full = key.replace(/^\/+/, '');
137
+ return `${base}/${full}`;
138
+ }
139
+
140
+ // Try to synthesize a URL from endpoint if available (works for public R2 buckets)
141
+ if (this.endpoint) {
142
+ try {
143
+ const url = new URL(this.endpoint);
144
+ return `https://${this.bucketName}.${url.host}/${key}`;
145
+ } catch {
146
+ // fallthrough
147
+ }
148
+ }
149
+
150
+ // Fallback to AWS style URL if region looks valid
151
+ return `https://${this.bucketName}.s3.${this.region}.amazonaws.com/${key}`;
152
+ }
153
+
154
+ private getBucketAndKey(pathOrUrlStr: string): { bucket: string; key: string } {
155
+ if (URL.canParse(pathOrUrlStr)) {
156
+ const url = new URL(pathOrUrlStr);
157
+ if (url.protocol === 's3:') {
158
+ return { bucket: url.host, key: url.pathname.replace(/^\/+/, '') };
159
+ }
160
+ // For https URLs, try to infer virtual-hosted or path-style
161
+ if (url.protocol === 'https:' || url.protocol === 'http:') {
162
+ // If the URL matches the configured publicBaseUrl host, map back to our bucket and key
163
+ if (this.publicBaseUrl && url.host === new URL(this.publicBaseUrl).host) {
164
+ return { bucket: this.bucketName, key: url.pathname.replace(/^\/+/, '') };
165
+ }
166
+ const hostParts = url.host.split('.');
167
+ if (hostParts.length > 3 && (hostParts[1] === 's3' || hostParts[hostParts.length - 2] === 'r2')) {
168
+ // virtual hosted
169
+ return { bucket: hostParts[0], key: url.pathname.replace(/^\/+/, '') };
170
+ } else if (this.endpoint && url.host === new URL(this.endpoint).host) {
171
+ // path-style at custom endpoint
172
+ const [bucket, ...rest] = url.pathname.replace(/^\/+/, '').split('/');
173
+ return { bucket, key: rest.join('/') };
174
+ }
175
+ }
176
+ }
177
+ // Treat as path
178
+ return { bucket: this.bucketName, key: this.getFullPath(pathOrUrlStr) };
179
+ }
180
+
181
+ private getFullPath(path: string): string {
182
+ const base = normalizeBasePath(this.basePath);
183
+ const rel = path.replace(/^\/+/, '');
184
+ return base ? join(base, rel) : rel;
185
+ }
186
+ }
@@ -1,4 +1,3 @@
1
- export * from './pxe.js';
2
1
  export * from './aztec-node.js';
3
2
  export * from './aztec-node-admin.js';
4
3
  export * from './private_kernel_prover.js';
@@ -10,7 +10,6 @@ import { z } from 'zod';
10
10
 
11
11
  import { AvmCircuitInputs } from '../avm/avm.js';
12
12
  import { AvmProvingRequestSchema } from '../avm/avm_proving_request.js';
13
- import { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
14
13
  import { ParityBasePrivateInputs } from '../parity/parity_base_private_inputs.js';
15
14
  import { ParityPublicInputs } from '../parity/parity_public_inputs.js';
16
15
  import { ParityRootPrivateInputs } from '../parity/parity_root_private_inputs.js';
@@ -32,8 +31,9 @@ import {
32
31
  CheckpointRootRollupPrivateInputs,
33
32
  CheckpointRootSingleBlockRollupPrivateInputs,
34
33
  } from '../rollup/checkpoint_root_rollup_private_inputs.js';
35
- import { PublicTubePrivateInputs } from '../rollup/index.js';
36
34
  import { PrivateTxBaseRollupPrivateInputs } from '../rollup/private_tx_base_rollup_private_inputs.js';
35
+ import { PublicTubePrivateInputs } from '../rollup/public_tube_private_inputs.js';
36
+ import { PublicTubePublicInputs } from '../rollup/public_tube_public_inputs.js';
37
37
  import { PublicTxBaseRollupPrivateInputs } from '../rollup/public_tx_base_rollup_private_inputs.js';
38
38
  import { RootRollupPrivateInputs } from '../rollup/root_rollup_private_inputs.js';
39
39
  import { RootRollupPublicInputs } from '../rollup/root_rollup_public_inputs.js';
@@ -214,7 +214,7 @@ export const ProvingJobResult = z.discriminatedUnion('type', [
214
214
  z.object({
215
215
  type: z.literal(ProvingRequestType.PUBLIC_TUBE),
216
216
  result: schemaForPublicInputsAndRecursiveProof(
217
- PrivateToPublicKernelCircuitPublicInputs.schema,
217
+ PublicTubePublicInputs.schema,
218
218
  NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
219
219
  ),
220
220
  }),
@@ -326,7 +326,7 @@ export type ProvingJobResult = z.infer<typeof ProvingJobResult>;
326
326
  export type ProvingJobResultsMap = {
327
327
  [ProvingRequestType.PUBLIC_VM]: ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
328
328
  [ProvingRequestType.PUBLIC_TUBE]: PublicInputsAndRecursiveProof<
329
- PrivateToPublicKernelCircuitPublicInputs,
329
+ PublicTubePublicInputs,
330
330
  typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
331
331
  >;
332
332
  [ProvingRequestType.PRIVATE_TX_BASE_ROLLUP]: PublicInputsAndRecursiveProof<
@@ -6,7 +6,6 @@ import type {
6
6
  } from '@aztec/constants';
7
7
 
8
8
  import type { AvmCircuitInputs } from '../avm/avm.js';
9
- import type { PrivateToPublicKernelCircuitPublicInputs } from '../kernel/private_to_public_kernel_circuit_public_inputs.js';
10
9
  import type { ParityBasePrivateInputs } from '../parity/parity_base_private_inputs.js';
11
10
  import type { ParityPublicInputs } from '../parity/parity_public_inputs.js';
12
11
  import type { ParityRootPrivateInputs } from '../parity/parity_root_private_inputs.js';
@@ -28,6 +27,7 @@ import type {
28
27
  } from '../rollup/checkpoint_root_rollup_private_inputs.js';
29
28
  import type { PrivateTxBaseRollupPrivateInputs } from '../rollup/private_tx_base_rollup_private_inputs.js';
30
29
  import type { PublicTubePrivateInputs } from '../rollup/public_tube_private_inputs.js';
30
+ import type { PublicTubePublicInputs } from '../rollup/public_tube_public_inputs.js';
31
31
  import type { PublicTxBaseRollupPrivateInputs } from '../rollup/public_tx_base_rollup_private_inputs.js';
32
32
  import type { RootRollupPrivateInputs } from '../rollup/root_rollup_private_inputs.js';
33
33
  import type { RootRollupPublicInputs } from '../rollup/root_rollup_public_inputs.js';
@@ -64,12 +64,7 @@ export interface ServerCircuitProver {
64
64
  inputs: PublicTubePrivateInputs,
65
65
  signal?: AbortSignal,
66
66
  epochNumber?: number,
67
- ): Promise<
68
- PublicInputsAndRecursiveProof<
69
- PrivateToPublicKernelCircuitPublicInputs,
70
- typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
71
- >
72
- >;
67
+ ): Promise<PublicInputsAndRecursiveProof<PublicTubePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
73
68
 
74
69
  /**
75
70
  * Creates a proof for the given input.
@@ -24,6 +24,7 @@ export interface SlasherConfig {
24
24
  slashOffenseExpirationRounds: number; // Number of rounds after which pending offenses expire
25
25
  slashMaxPayloadSize: number; // Maximum number of offenses to include in a single slash payload
26
26
  slashGracePeriodL2Slots: number; // Number of L2 slots to wait after genesis before slashing for most offenses
27
+ slashExecuteRoundsLookBack: number; // How many rounds to look back when searching for a round to execute
27
28
  }
28
29
 
29
30
  export const SlasherConfigSchema = z.object({
@@ -44,5 +45,6 @@ export const SlasherConfigSchema = z.object({
44
45
  slashMaxPayloadSize: z.number(),
45
46
  slashGracePeriodL2Slots: z.number(),
46
47
  slashBroadcastedInvalidBlockPenalty: schemas.BigInt,
48
+ slashExecuteRoundsLookBack: z.number(),
47
49
  slashSelfAllowed: z.boolean().optional(),
48
50
  }) satisfies ZodFor<SlasherConfig>;
@@ -32,11 +32,14 @@ export interface ValidatorClientConfig {
32
32
  /** Interval between polling for new attestations from peers */
33
33
  attestationPollingIntervalMs: number;
34
34
 
35
- /** Re-execute transactions before attesting */
35
+ /** Whether to re-execute transactions in a block proposal before attesting */
36
36
  validatorReexecute: boolean;
37
37
 
38
38
  /** Will re-execute until this many milliseconds are left in the slot */
39
39
  validatorReexecuteDeadlineMs: number;
40
+
41
+ /** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
42
+ alwaysReexecuteBlockProposals?: boolean;
40
43
  }
41
44
 
42
45
  export type ValidatorClientFullConfig = ValidatorClientConfig &
@@ -50,6 +53,7 @@ export const ValidatorClientConfigSchema = z.object({
50
53
  attestationPollingIntervalMs: z.number().min(0),
51
54
  validatorReexecute: z.boolean(),
52
55
  validatorReexecuteDeadlineMs: z.number().min(0),
56
+ alwaysReexecuteBlockProposals: z.boolean().optional(),
53
57
  }) satisfies ZodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>;
54
58
 
55
59
  export interface Validator {
@@ -133,12 +133,11 @@ export class ContractClassLog {
133
133
  }
134
134
 
135
135
  toBlobFields(): Fr[] {
136
- return [new Fr(this.emittedLength), this.contractAddress.toField()].concat(this.getEmittedFields());
136
+ return [this.contractAddress.toField()].concat(this.getEmittedFields());
137
137
  }
138
138
 
139
- static fromBlobFields(fields: Fr[] | FieldReader) {
139
+ static fromBlobFields(emittedLength: number, fields: Fr[] | FieldReader) {
140
140
  const reader = FieldReader.asReader(fields);
141
- const emittedLength = reader.readU32();
142
141
  const contractAddress = reader.readObject(AztecAddress);
143
142
  const emittedFields = reader.readFieldArray(emittedLength);
144
143
  return new ContractClassLog(
@@ -1,39 +1,10 @@
1
1
  import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED } from '@aztec/constants';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
- import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
3
 
5
4
  import { AvmCircuitPublicInputs } from '../avm/avm_circuit_public_inputs.js';
6
- import { RecursiveProof, makeEmptyRecursiveProof } from '../proofs/recursive_proof.js';
7
- import { VkData } from '../vks/vk_data.js';
5
+ import type { ProofData } from '../proofs/proof_data.js';
8
6
 
9
- export class AvmProofData {
10
- constructor(
11
- public publicInputs: AvmCircuitPublicInputs,
12
- public proof: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>,
13
- public vkData: VkData,
14
- ) {}
15
-
16
- static fromBuffer(buffer: Buffer | BufferReader) {
17
- const reader = BufferReader.asReader(buffer);
18
- return new AvmProofData(
19
- reader.readObject(AvmCircuitPublicInputs),
20
- RecursiveProof.fromBuffer(reader),
21
- reader.readObject(VkData),
22
- );
23
- }
24
-
25
- toBuffer() {
26
- return serializeToBuffer(this.publicInputs, this.proof, this.vkData);
27
- }
28
-
29
- static empty() {
30
- return new AvmProofData(
31
- AvmCircuitPublicInputs.empty(),
32
- makeEmptyRecursiveProof(AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED),
33
- VkData.empty(),
34
- );
35
- }
36
- }
7
+ export type AvmProofData = ProofData<AvmCircuitPublicInputs, typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>;
37
8
 
38
9
  // TODO(#14234)[Unconditional PIs validation]: remove this function.
39
10
  export function enhanceProofWithPiValidationFlag(proof: Fr[], skipPublicInputsValidation: boolean): Fr[] {
@@ -4,15 +4,14 @@ import { makeTuple } from '@aztec/foundation/array';
4
4
  import { Fr } from '@aztec/foundation/fields';
5
5
  import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
6
6
  import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
7
- import { MembershipWitness } from '@aztec/foundation/trees';
8
7
  import type { FieldsOf } from '@aztec/foundation/types';
9
8
 
10
- import { PublicDataHint } from '../avm/public_data_hint.js';
11
9
  import { ContractClassLogFields } from '../logs/index.js';
12
- import { AppendOnlyTreeSnapshot } from '../trees/index.js';
10
+ import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
11
+ import { PublicDataTreeLeafPreimage } from '../trees/public_data_leaf.js';
13
12
  import { PartialStateReference } from '../tx/partial_state_reference.js';
14
13
  import { BlockConstantData } from './block_constant_data.js';
15
- import { PrivateBaseStateDiffHints } from './state_diff_hints.js';
14
+ import { TreeSnapshotDiffHints } from './tree_snapshot_diff_hints.js';
16
15
 
17
16
  export type BaseRollupHints = PrivateBaseRollupHints | PublicBaseRollupHints;
18
17
 
@@ -29,15 +28,15 @@ export class PrivateBaseRollupHints {
29
28
  /**
30
29
  * Hints used while proving state diff validity.
31
30
  */
32
- public stateDiffHints: PrivateBaseStateDiffHints,
31
+ public treeSnapshotDiffHints: TreeSnapshotDiffHints,
33
32
  /**
34
- * Public data read hint for accessing the balance of the fee payer.
33
+ * Public data tree leaf preimage for accessing the balance of the fee payer.
35
34
  */
36
- public feePayerFeeJuiceBalanceReadHint: PublicDataHint,
35
+ public feePayerBalanceLeafPreimage: PublicDataTreeLeafPreimage,
37
36
  /**
38
37
  * Membership witnesses of blocks referred by each of the 2 kernels.
39
38
  */
40
- public archiveRootMembershipWitness: MembershipWitness<typeof ARCHIVE_HEIGHT>,
39
+ public anchorBlockArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
41
40
  /**
42
41
  * Preimages to the kernel's contractClassLogsHashes.
43
42
  */
@@ -56,9 +55,9 @@ export class PrivateBaseRollupHints {
56
55
  return [
57
56
  fields.start,
58
57
  fields.startSpongeBlob,
59
- fields.stateDiffHints,
60
- fields.feePayerFeeJuiceBalanceReadHint,
61
- fields.archiveRootMembershipWitness,
58
+ fields.treeSnapshotDiffHints,
59
+ fields.feePayerBalanceLeafPreimage,
60
+ fields.anchorBlockArchiveSiblingPath,
62
61
  fields.contractClassLogsFields,
63
62
  fields.constants,
64
63
  ] as const;
@@ -85,9 +84,9 @@ export class PrivateBaseRollupHints {
85
84
  return new PrivateBaseRollupHints(
86
85
  reader.readObject(PartialStateReference),
87
86
  reader.readObject(SpongeBlob),
88
- reader.readObject(PrivateBaseStateDiffHints),
89
- reader.readObject(PublicDataHint),
90
- MembershipWitness.fromBuffer(reader, ARCHIVE_HEIGHT),
87
+ reader.readObject(TreeSnapshotDiffHints),
88
+ reader.readObject(PublicDataTreeLeafPreimage),
89
+ reader.readArray(ARCHIVE_HEIGHT, Fr),
91
90
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, () => reader.readObject(ContractClassLogFields)),
92
91
  reader.readObject(BlockConstantData),
93
92
  );
@@ -101,9 +100,9 @@ export class PrivateBaseRollupHints {
101
100
  return new PrivateBaseRollupHints(
102
101
  PartialStateReference.empty(),
103
102
  SpongeBlob.empty(),
104
- PrivateBaseStateDiffHints.empty(),
105
- PublicDataHint.empty(),
106
- MembershipWitness.empty(ARCHIVE_HEIGHT),
103
+ TreeSnapshotDiffHints.empty(),
104
+ PublicDataTreeLeafPreimage.empty(),
105
+ makeTuple(ARCHIVE_HEIGHT, Fr.zero),
107
106
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ContractClassLogFields.empty),
108
107
  BlockConstantData.empty(),
109
108
  );
@@ -123,15 +122,11 @@ export class PublicBaseRollupHints {
123
122
  /**
124
123
  * Membership witnesses of blocks referred by each of the 2 kernels.
125
124
  */
126
- public archiveRootMembershipWitness: MembershipWitness<typeof ARCHIVE_HEIGHT>,
125
+ public anchorBlockArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
127
126
  /**
128
127
  * Preimages to the kernel's contractClassLogsHashes.
129
128
  */
130
129
  public contractClassLogsFields: Tuple<ContractClassLogFields, typeof MAX_CONTRACT_CLASS_LOGS_PER_TX>,
131
- /**
132
- * Identifier of the prover.
133
- */
134
- public proverId: Fr,
135
130
  ) {}
136
131
 
137
132
  static from(fields: FieldsOf<PublicBaseRollupHints>): PublicBaseRollupHints {
@@ -142,9 +137,8 @@ export class PublicBaseRollupHints {
142
137
  return [
143
138
  fields.startSpongeBlob,
144
139
  fields.lastArchive,
145
- fields.archiveRootMembershipWitness,
140
+ fields.anchorBlockArchiveSiblingPath,
146
141
  fields.contractClassLogsFields,
147
- fields.proverId,
148
142
  ] as const;
149
143
  }
150
144
 
@@ -169,9 +163,8 @@ export class PublicBaseRollupHints {
169
163
  return new PublicBaseRollupHints(
170
164
  reader.readObject(SpongeBlob),
171
165
  reader.readObject(AppendOnlyTreeSnapshot),
172
- MembershipWitness.fromBuffer(reader, ARCHIVE_HEIGHT),
166
+ reader.readArray(ARCHIVE_HEIGHT, Fr),
173
167
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, () => reader.readObject(ContractClassLogFields)),
174
- reader.readObject(Fr),
175
168
  );
176
169
  }
177
170
 
@@ -183,9 +176,8 @@ export class PublicBaseRollupHints {
183
176
  return new PublicBaseRollupHints(
184
177
  SpongeBlob.empty(),
185
178
  AppendOnlyTreeSnapshot.empty(),
186
- MembershipWitness.empty(ARCHIVE_HEIGHT),
179
+ makeTuple(ARCHIVE_HEIGHT, Fr.zero),
187
180
  makeTuple(MAX_CONTRACT_CLASS_LOGS_PER_TX, ContractClassLogFields.empty),
188
- Fr.ZERO,
189
181
  );
190
182
  }
191
183
  }