@aztec/stdlib 1.0.0-nightly.20250730 → 1.0.0-nightly.20250805

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 (41) hide show
  1. package/dest/block/l2_block.d.ts +1 -0
  2. package/dest/block/l2_block.d.ts.map +1 -1
  3. package/dest/block/l2_block.js +1 -0
  4. package/dest/block/l2_block_source.d.ts +446 -2
  5. package/dest/block/l2_block_source.d.ts.map +1 -1
  6. package/dest/block/l2_block_source.js +29 -0
  7. package/dest/interfaces/archiver.d.ts.map +1 -1
  8. package/dest/interfaces/archiver.js +4 -2
  9. package/dest/interfaces/aztec-node-admin.d.ts +73 -2
  10. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  11. package/dest/interfaces/aztec-node-admin.js +5 -2
  12. package/dest/interfaces/configs.d.ts +17 -0
  13. package/dest/interfaces/configs.d.ts.map +1 -1
  14. package/dest/interfaces/configs.js +4 -1
  15. package/dest/interfaces/server.d.ts +2 -1
  16. package/dest/interfaces/server.d.ts.map +1 -1
  17. package/dest/interfaces/server.js +2 -1
  18. package/dest/interfaces/slasher.d.ts +86 -0
  19. package/dest/interfaces/slasher.d.ts.map +1 -0
  20. package/dest/interfaces/slasher.js +23 -0
  21. package/dest/messaging/l2_to_l1_membership.d.ts +4 -1
  22. package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
  23. package/dest/messaging/l2_to_l1_membership.js +49 -54
  24. package/dest/slashing/index.d.ts +51 -0
  25. package/dest/slashing/index.d.ts.map +1 -0
  26. package/dest/slashing/index.js +54 -0
  27. package/dest/tx/tx_effect.d.ts +2 -2
  28. package/dest/tx/tx_effect.d.ts.map +1 -1
  29. package/dest/tx/tx_effect.js +3 -18
  30. package/dest/tx/validator/tx_validator.d.ts +4 -4
  31. package/package.json +9 -8
  32. package/src/block/l2_block.ts +2 -0
  33. package/src/block/l2_block_source.ts +70 -1
  34. package/src/interfaces/archiver.ts +3 -1
  35. package/src/interfaces/aztec-node-admin.ts +10 -4
  36. package/src/interfaces/configs.ts +11 -0
  37. package/src/interfaces/server.ts +2 -1
  38. package/src/interfaces/slasher.ts +49 -0
  39. package/src/messaging/l2_to_l1_membership.ts +76 -85
  40. package/src/slashing/index.ts +74 -0
  41. package/src/tx/tx_effect.ts +5 -20
@@ -116,6 +116,7 @@ export declare class L2Block {
116
116
  equals(other: L2Block): boolean;
117
117
  }
118
118
  export type BlockInfo = {
119
+ blockHash?: string;
119
120
  archive: string;
120
121
  blockNumber: number;
121
122
  slotNumber: number;
@@ -1 +1 @@
1
- {"version":3,"file":"l2_block.d.ts","sourceRoot":"","sources":["../../src/block/l2_block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAG9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;GAEG;AACH,qBAAa,OAAO;IAEhB,2DAA2D;IACpD,OAAO,EAAE,sBAAsB;IACtC,uBAAuB;IAChB,MAAM,EAAE,WAAW;IAC1B,qBAAqB;IACd,IAAI,EAAE,IAAI;IACjB,OAAO,CAAC,SAAS;;IANjB,2DAA2D;IACpD,OAAO,EAAE,sBAAsB;IACtC,uBAAuB;IAChB,MAAM,EAAE,WAAW;IAC1B,qBAAqB;IACd,IAAI,EAAE,IAAI,EACT,SAAS,GAAE,EAAE,GAAG,SAAqB;IAG/C,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAQhB;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY;IAS5C;;;OAGG;IAC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AO,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -103,6 +103,7 @@ import { makeAppendOnlyTreeSnapshot, makeHeader } from './l2_block_code_to_purge
103
103
  }
104
104
  toBlockInfo() {
105
105
  return {
106
+ blockHash: this.blockHash?.toString(),
106
107
  archive: this.archive.root.toString(),
107
108
  blockNumber: this.number,
108
109
  slotNumber: Number(this.header.getSlot()),
@@ -1,13 +1,15 @@
1
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { type ZodFor } from '@aztec/foundation/schemas';
2
3
  import type { TypedEventEmitter } from '@aztec/foundation/types';
3
4
  import { z } from 'zod';
4
5
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
6
+ import { BlockAttestation } from '../p2p/block_attestation.js';
5
7
  import type { BlockHeader } from '../tx/block_header.js';
6
8
  import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
7
9
  import type { TxHash } from '../tx/tx_hash.js';
8
10
  import type { TxReceipt } from '../tx/tx_receipt.js';
9
11
  import type { L2Block } from './l2_block.js';
10
- import type { PublishedL2Block } from './published_l2_block.js';
12
+ import { PublishedL2Block } from './published_l2_block.js';
11
13
  /**
12
14
  * Interface of classes allowing for the retrieval of L2 blocks.
13
15
  */
@@ -101,9 +103,445 @@ export interface L2BlockSource {
101
103
  getL1Constants(): Promise<L1RollupConstants>;
102
104
  /** Latest synced L1 timestamp. */
103
105
  getL1Timestamp(): Promise<bigint>;
106
+ /**
107
+ * Returns whether the latest block in the pending chain on L1 is invalid (ie its attestations are incorrect).
108
+ * Note that invalid blocks do not get synced, so the latest block returned by the block source is always a valid one.
109
+ */
110
+ isPendingChainInvalid(): Promise<boolean>;
111
+ /**
112
+ * Returns the status of the pending chain validation. If the chain is invalid, reports the earliest consecutive block
113
+ * that is invalid, along with the reason for being invalid, which can be used to trigger an invalidation.
114
+ */
115
+ getPendingChainValidationStatus(): Promise<ValidateBlockResult>;
104
116
  /** Force a sync. */
105
117
  syncImmediate(): Promise<void>;
106
118
  }
119
+ /** Subtype for invalid block validation results */
120
+ export type ValidateBlockNegativeResult = {
121
+ valid: false;
122
+ block: PublishedL2Block;
123
+ committee: EthAddress[];
124
+ epoch: bigint;
125
+ seed: bigint;
126
+ attestations: BlockAttestation[];
127
+ reason: 'insufficient-attestations';
128
+ } | {
129
+ valid: false;
130
+ block: PublishedL2Block;
131
+ committee: EthAddress[];
132
+ epoch: bigint;
133
+ seed: bigint;
134
+ reason: 'invalid-attestation';
135
+ attestations: BlockAttestation[];
136
+ invalidIndex: number;
137
+ };
138
+ /** Result type for validating a block attestations */
139
+ export type ValidateBlockResult = {
140
+ valid: true;
141
+ } | ValidateBlockNegativeResult;
142
+ export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
143
+ valid: z.ZodLiteral<true>;
144
+ block: z.ZodOptional<z.ZodObject<{
145
+ block: z.ZodEffects<z.ZodObject<{
146
+ archive: z.ZodEffects<z.ZodObject<{
147
+ root: z.ZodType<import("@aztec/foundation/schemas").Fr, any, string>;
148
+ nextAvailableLeafIndex: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ root: import("@aztec/foundation/schemas").Fr;
151
+ nextAvailableLeafIndex: number;
152
+ }, {
153
+ root: string;
154
+ nextAvailableLeafIndex: string | number | bigint;
155
+ }>, import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot, {
156
+ root: string;
157
+ nextAvailableLeafIndex: string | number | bigint;
158
+ }>;
159
+ header: ZodFor<BlockHeader>;
160
+ body: ZodFor<import("./body.js").Body>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ archive: import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot;
163
+ header: BlockHeader;
164
+ body: import("./body.js").Body;
165
+ }, {
166
+ archive: {
167
+ root: string;
168
+ nextAvailableLeafIndex: string | number | bigint;
169
+ };
170
+ header?: any;
171
+ body?: any;
172
+ }>, L2Block, {
173
+ archive: {
174
+ root: string;
175
+ nextAvailableLeafIndex: string | number | bigint;
176
+ };
177
+ header?: any;
178
+ body?: any;
179
+ }>;
180
+ l1: z.ZodObject<{
181
+ blockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
182
+ timestamp: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
183
+ blockHash: z.ZodString;
184
+ }, "strip", z.ZodTypeAny, {
185
+ blockNumber: bigint;
186
+ timestamp: bigint;
187
+ blockHash: string;
188
+ }, {
189
+ blockNumber: string | number | bigint;
190
+ timestamp: string | number | bigint;
191
+ blockHash: string;
192
+ }>;
193
+ attestations: z.ZodArray<z.ZodEffects<z.ZodObject<{
194
+ address: z.ZodType<EthAddress, any, string>;
195
+ signature: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>, import("./index.js").Signature, string>;
196
+ }, "strip", z.ZodTypeAny, {
197
+ address: EthAddress;
198
+ signature: import("./index.js").Signature;
199
+ }, {
200
+ address: string;
201
+ signature: string;
202
+ }>, import("./index.js").CommitteeAttestation, {
203
+ address: string;
204
+ signature: string;
205
+ }>, "many">;
206
+ }, "strip", z.ZodTypeAny, {
207
+ block: L2Block;
208
+ l1: {
209
+ blockNumber: bigint;
210
+ timestamp: bigint;
211
+ blockHash: string;
212
+ };
213
+ attestations: import("./index.js").CommitteeAttestation[];
214
+ }, {
215
+ block: {
216
+ archive: {
217
+ root: string;
218
+ nextAvailableLeafIndex: string | number | bigint;
219
+ };
220
+ header?: any;
221
+ body?: any;
222
+ };
223
+ l1: {
224
+ blockNumber: string | number | bigint;
225
+ timestamp: string | number | bigint;
226
+ blockHash: string;
227
+ };
228
+ attestations: {
229
+ address: string;
230
+ signature: string;
231
+ }[];
232
+ }>>;
233
+ }, "strip", z.ZodTypeAny, {
234
+ valid: true;
235
+ block?: {
236
+ block: L2Block;
237
+ l1: {
238
+ blockNumber: bigint;
239
+ timestamp: bigint;
240
+ blockHash: string;
241
+ };
242
+ attestations: import("./index.js").CommitteeAttestation[];
243
+ } | undefined;
244
+ }, {
245
+ valid: true;
246
+ block?: {
247
+ block: {
248
+ archive: {
249
+ root: string;
250
+ nextAvailableLeafIndex: string | number | bigint;
251
+ };
252
+ header?: any;
253
+ body?: any;
254
+ };
255
+ l1: {
256
+ blockNumber: string | number | bigint;
257
+ timestamp: string | number | bigint;
258
+ blockHash: string;
259
+ };
260
+ attestations: {
261
+ address: string;
262
+ signature: string;
263
+ }[];
264
+ } | undefined;
265
+ }>, z.ZodObject<{
266
+ valid: z.ZodLiteral<false>;
267
+ block: z.ZodObject<{
268
+ block: z.ZodEffects<z.ZodObject<{
269
+ archive: z.ZodEffects<z.ZodObject<{
270
+ root: z.ZodType<import("@aztec/foundation/schemas").Fr, any, string>;
271
+ nextAvailableLeafIndex: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
272
+ }, "strip", z.ZodTypeAny, {
273
+ root: import("@aztec/foundation/schemas").Fr;
274
+ nextAvailableLeafIndex: number;
275
+ }, {
276
+ root: string;
277
+ nextAvailableLeafIndex: string | number | bigint;
278
+ }>, import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot, {
279
+ root: string;
280
+ nextAvailableLeafIndex: string | number | bigint;
281
+ }>;
282
+ header: ZodFor<BlockHeader>;
283
+ body: ZodFor<import("./body.js").Body>;
284
+ }, "strip", z.ZodTypeAny, {
285
+ archive: import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot;
286
+ header: BlockHeader;
287
+ body: import("./body.js").Body;
288
+ }, {
289
+ archive: {
290
+ root: string;
291
+ nextAvailableLeafIndex: string | number | bigint;
292
+ };
293
+ header?: any;
294
+ body?: any;
295
+ }>, L2Block, {
296
+ archive: {
297
+ root: string;
298
+ nextAvailableLeafIndex: string | number | bigint;
299
+ };
300
+ header?: any;
301
+ body?: any;
302
+ }>;
303
+ l1: z.ZodObject<{
304
+ blockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
305
+ timestamp: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
306
+ blockHash: z.ZodString;
307
+ }, "strip", z.ZodTypeAny, {
308
+ blockNumber: bigint;
309
+ timestamp: bigint;
310
+ blockHash: string;
311
+ }, {
312
+ blockNumber: string | number | bigint;
313
+ timestamp: string | number | bigint;
314
+ blockHash: string;
315
+ }>;
316
+ attestations: z.ZodArray<z.ZodEffects<z.ZodObject<{
317
+ address: z.ZodType<EthAddress, any, string>;
318
+ signature: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>, import("./index.js").Signature, string>;
319
+ }, "strip", z.ZodTypeAny, {
320
+ address: EthAddress;
321
+ signature: import("./index.js").Signature;
322
+ }, {
323
+ address: string;
324
+ signature: string;
325
+ }>, import("./index.js").CommitteeAttestation, {
326
+ address: string;
327
+ signature: string;
328
+ }>, "many">;
329
+ }, "strip", z.ZodTypeAny, {
330
+ block: L2Block;
331
+ l1: {
332
+ blockNumber: bigint;
333
+ timestamp: bigint;
334
+ blockHash: string;
335
+ };
336
+ attestations: import("./index.js").CommitteeAttestation[];
337
+ }, {
338
+ block: {
339
+ archive: {
340
+ root: string;
341
+ nextAvailableLeafIndex: string | number | bigint;
342
+ };
343
+ header?: any;
344
+ body?: any;
345
+ };
346
+ l1: {
347
+ blockNumber: string | number | bigint;
348
+ timestamp: string | number | bigint;
349
+ blockHash: string;
350
+ };
351
+ attestations: {
352
+ address: string;
353
+ signature: string;
354
+ }[];
355
+ }>;
356
+ committee: z.ZodArray<z.ZodType<EthAddress, any, string>, "many">;
357
+ epoch: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
358
+ seed: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
359
+ attestations: z.ZodArray<ZodFor<BlockAttestation>, "many">;
360
+ reason: z.ZodLiteral<"insufficient-attestations">;
361
+ }, "strip", z.ZodTypeAny, {
362
+ valid: false;
363
+ block: {
364
+ block: L2Block;
365
+ l1: {
366
+ blockNumber: bigint;
367
+ timestamp: bigint;
368
+ blockHash: string;
369
+ };
370
+ attestations: import("./index.js").CommitteeAttestation[];
371
+ };
372
+ attestations: BlockAttestation[];
373
+ committee: EthAddress[];
374
+ epoch: bigint;
375
+ seed: bigint;
376
+ reason: "insufficient-attestations";
377
+ }, {
378
+ valid: false;
379
+ block: {
380
+ block: {
381
+ archive: {
382
+ root: string;
383
+ nextAvailableLeafIndex: string | number | bigint;
384
+ };
385
+ header?: any;
386
+ body?: any;
387
+ };
388
+ l1: {
389
+ blockNumber: string | number | bigint;
390
+ timestamp: string | number | bigint;
391
+ blockHash: string;
392
+ };
393
+ attestations: {
394
+ address: string;
395
+ signature: string;
396
+ }[];
397
+ };
398
+ attestations: any[];
399
+ committee: string[];
400
+ epoch: string | number | bigint;
401
+ seed: string | number | bigint;
402
+ reason: "insufficient-attestations";
403
+ }>, z.ZodObject<{
404
+ valid: z.ZodLiteral<false>;
405
+ block: z.ZodObject<{
406
+ block: z.ZodEffects<z.ZodObject<{
407
+ archive: z.ZodEffects<z.ZodObject<{
408
+ root: z.ZodType<import("@aztec/foundation/schemas").Fr, any, string>;
409
+ nextAvailableLeafIndex: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
410
+ }, "strip", z.ZodTypeAny, {
411
+ root: import("@aztec/foundation/schemas").Fr;
412
+ nextAvailableLeafIndex: number;
413
+ }, {
414
+ root: string;
415
+ nextAvailableLeafIndex: string | number | bigint;
416
+ }>, import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot, {
417
+ root: string;
418
+ nextAvailableLeafIndex: string | number | bigint;
419
+ }>;
420
+ header: ZodFor<BlockHeader>;
421
+ body: ZodFor<import("./body.js").Body>;
422
+ }, "strip", z.ZodTypeAny, {
423
+ archive: import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot;
424
+ header: BlockHeader;
425
+ body: import("./body.js").Body;
426
+ }, {
427
+ archive: {
428
+ root: string;
429
+ nextAvailableLeafIndex: string | number | bigint;
430
+ };
431
+ header?: any;
432
+ body?: any;
433
+ }>, L2Block, {
434
+ archive: {
435
+ root: string;
436
+ nextAvailableLeafIndex: string | number | bigint;
437
+ };
438
+ header?: any;
439
+ body?: any;
440
+ }>;
441
+ l1: z.ZodObject<{
442
+ blockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
443
+ timestamp: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
444
+ blockHash: z.ZodString;
445
+ }, "strip", z.ZodTypeAny, {
446
+ blockNumber: bigint;
447
+ timestamp: bigint;
448
+ blockHash: string;
449
+ }, {
450
+ blockNumber: string | number | bigint;
451
+ timestamp: string | number | bigint;
452
+ blockHash: string;
453
+ }>;
454
+ attestations: z.ZodArray<z.ZodEffects<z.ZodObject<{
455
+ address: z.ZodType<EthAddress, any, string>;
456
+ signature: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>, import("./index.js").Signature, string>;
457
+ }, "strip", z.ZodTypeAny, {
458
+ address: EthAddress;
459
+ signature: import("./index.js").Signature;
460
+ }, {
461
+ address: string;
462
+ signature: string;
463
+ }>, import("./index.js").CommitteeAttestation, {
464
+ address: string;
465
+ signature: string;
466
+ }>, "many">;
467
+ }, "strip", z.ZodTypeAny, {
468
+ block: L2Block;
469
+ l1: {
470
+ blockNumber: bigint;
471
+ timestamp: bigint;
472
+ blockHash: string;
473
+ };
474
+ attestations: import("./index.js").CommitteeAttestation[];
475
+ }, {
476
+ block: {
477
+ archive: {
478
+ root: string;
479
+ nextAvailableLeafIndex: string | number | bigint;
480
+ };
481
+ header?: any;
482
+ body?: any;
483
+ };
484
+ l1: {
485
+ blockNumber: string | number | bigint;
486
+ timestamp: string | number | bigint;
487
+ blockHash: string;
488
+ };
489
+ attestations: {
490
+ address: string;
491
+ signature: string;
492
+ }[];
493
+ }>;
494
+ committee: z.ZodArray<z.ZodType<EthAddress, any, string>, "many">;
495
+ epoch: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
496
+ seed: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
497
+ attestations: z.ZodArray<ZodFor<BlockAttestation>, "many">;
498
+ reason: z.ZodLiteral<"invalid-attestation">;
499
+ invalidIndex: z.ZodNumber;
500
+ }, "strip", z.ZodTypeAny, {
501
+ valid: false;
502
+ block: {
503
+ block: L2Block;
504
+ l1: {
505
+ blockNumber: bigint;
506
+ timestamp: bigint;
507
+ blockHash: string;
508
+ };
509
+ attestations: import("./index.js").CommitteeAttestation[];
510
+ };
511
+ attestations: BlockAttestation[];
512
+ committee: EthAddress[];
513
+ epoch: bigint;
514
+ seed: bigint;
515
+ reason: "invalid-attestation";
516
+ invalidIndex: number;
517
+ }, {
518
+ valid: false;
519
+ block: {
520
+ block: {
521
+ archive: {
522
+ root: string;
523
+ nextAvailableLeafIndex: string | number | bigint;
524
+ };
525
+ header?: any;
526
+ body?: any;
527
+ };
528
+ l1: {
529
+ blockNumber: string | number | bigint;
530
+ timestamp: string | number | bigint;
531
+ blockHash: string;
532
+ };
533
+ attestations: {
534
+ address: string;
535
+ signature: string;
536
+ }[];
537
+ };
538
+ attestations: any[];
539
+ committee: string[];
540
+ epoch: string | number | bigint;
541
+ seed: string | number | bigint;
542
+ reason: "invalid-attestation";
543
+ invalidIndex: number;
544
+ }>]>;
107
545
  /**
108
546
  * L2BlockSource that emits events upon pending / proven chain changes.
109
547
  * see L2BlockSourceEvents for the events emitted.
@@ -111,6 +549,7 @@ export interface L2BlockSource {
111
549
  export type ArchiverEmitter = TypedEventEmitter<{
112
550
  [L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockPruneEvent) => void;
113
551
  [L2BlockSourceEvents.L2BlockProven]: (args: L2BlockProvenEvent) => void;
552
+ [L2BlockSourceEvents.InvalidAttestationsBlockDetected]: (args: InvalidBlockDetectedEvent) => void;
114
553
  }>;
115
554
  export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {
116
555
  }
@@ -251,7 +690,8 @@ export declare const L2TipsSchema: z.ZodObject<{
251
690
  }>;
252
691
  export declare enum L2BlockSourceEvents {
253
692
  L2PruneDetected = "l2PruneDetected",
254
- L2BlockProven = "l2BlockProven"
693
+ L2BlockProven = "l2BlockProven",
694
+ InvalidAttestationsBlockDetected = "invalidBlockDetected"
255
695
  }
256
696
  export type L2BlockProvenEvent = {
257
697
  type: 'l2BlockProven';
@@ -264,5 +704,9 @@ export type L2BlockPruneEvent = {
264
704
  epochNumber: bigint;
265
705
  blocks: L2Block[];
266
706
  };
707
+ export type InvalidBlockDetectedEvent = {
708
+ type: 'invalidBlockDetected';
709
+ validationResult: ValidateBlockNegativeResult;
710
+ };
267
711
  export {};
268
712
  //# sourceMappingURL=l2_block_source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"l2_block_source.d.ts","sourceRoot":"","sources":["../../src/block/l2_block_source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK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2p/block_attestation.js';
4
+ import { PublishedL2Block } from './published_l2_block.js';
5
+ export const ValidateBlockResultSchema = z.union([
6
+ z.object({
7
+ valid: z.literal(true),
8
+ block: PublishedL2Block.schema.optional()
9
+ }),
10
+ z.object({
11
+ valid: z.literal(false),
12
+ block: PublishedL2Block.schema,
13
+ committee: z.array(schemas.EthAddress),
14
+ epoch: schemas.BigInt,
15
+ seed: schemas.BigInt,
16
+ attestations: z.array(BlockAttestation.schema),
17
+ reason: z.literal('insufficient-attestations')
18
+ }),
19
+ z.object({
20
+ valid: z.literal(false),
21
+ block: PublishedL2Block.schema,
22
+ committee: z.array(schemas.EthAddress),
23
+ epoch: schemas.BigInt,
24
+ seed: schemas.BigInt,
25
+ attestations: z.array(BlockAttestation.schema),
26
+ reason: z.literal('invalid-attestation'),
27
+ invalidIndex: z.number()
28
+ })
29
+ ]);
2
30
  /** Creates an L2 block id */ export function makeL2BlockId(number, hash) {
3
31
  if (number !== 0 && !hash) {
4
32
  throw new Error(`Hash is required for non-genesis blocks (got block number ${number})`);
@@ -27,5 +55,6 @@ export const L2TipsSchema = z.object({
27
55
  export var L2BlockSourceEvents = /*#__PURE__*/ function(L2BlockSourceEvents) {
28
56
  L2BlockSourceEvents["L2PruneDetected"] = "l2PruneDetected";
29
57
  L2BlockSourceEvents["L2BlockProven"] = "l2BlockProven";
58
+ L2BlockSourceEvents["InvalidAttestationsBlockDetected"] = "invalidBlockDetected";
30
59
  return L2BlockSourceEvents;
31
60
  }({});
@@ -1 +1 @@
1
- {"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/interfaces/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,6BAA6B,CAAC;AAE/E,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAOnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,aAAa,GAAG,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,EACvE,OAAO,GAAG,MAAM,CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,CA+CvD,CAAC"}
1
+ {"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/interfaces/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D,OAAO,EAAE,KAAK,aAAa,EAA2C,MAAM,6BAA6B,CAAC;AAE1G,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAOnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,aAAa,GAAG,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,EACvE,OAAO,GAAG,MAAM,CACjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,CAiDvD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { L2Block } from '../block/l2_block.js';
3
- import { L2TipsSchema } from '../block/l2_block_source.js';
3
+ import { L2TipsSchema, ValidateBlockResultSchema } from '../block/l2_block_source.js';
4
4
  import { PublishedL2Block } from '../block/published_l2_block.js';
5
5
  import { ContractClassPublicSchema, ContractInstanceWithAddressSchema } from '../contract/index.js';
6
6
  import { L1RollupConstantsSchema } from '../epoch-helpers/index.js';
@@ -47,5 +47,7 @@ export const ArchiverApiSchema = {
47
47
  getDebugFunctionName: z.function().args(schemas.AztecAddress, schemas.FunctionSelector).returns(optional(z.string())),
48
48
  getL1Constants: z.function().args().returns(L1RollupConstantsSchema),
49
49
  getL1Timestamp: z.function().args().returns(schemas.BigInt),
50
- syncImmediate: z.function().args().returns(z.void())
50
+ syncImmediate: z.function().args().returns(z.void()),
51
+ isPendingChainInvalid: z.function().args().returns(z.boolean()),
52
+ getPendingChainValidationStatus: z.function().args().returns(ValidateBlockResultSchema)
51
53
  };