@aztec/stdlib 1.0.0-nightly.20250801 → 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.
@@ -3,6 +3,7 @@ import { type ZodFor } from '@aztec/foundation/schemas';
3
3
  import type { TypedEventEmitter } from '@aztec/foundation/types';
4
4
  import { z } from 'zod';
5
5
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
6
+ import { BlockAttestation } from '../p2p/block_attestation.js';
6
7
  import type { BlockHeader } from '../tx/block_header.js';
7
8
  import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
8
9
  import type { TxHash } from '../tx/tx_hash.js';
@@ -108,29 +109,36 @@ export interface L2BlockSource {
108
109
  */
109
110
  isPendingChainInvalid(): Promise<boolean>;
110
111
  /**
111
- * Returns the status of the pending chain validation.
112
- * This includes whether the chain is valid, and if not, the reason for invalidation.
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.
113
114
  */
114
115
  getPendingChainValidationStatus(): Promise<ValidateBlockResult>;
115
116
  /** Force a sync. */
116
117
  syncImmediate(): Promise<void>;
117
118
  }
118
- /** Result type for validating a block attestations */
119
- export type ValidateBlockResult = {
120
- valid: true;
121
- block?: PublishedL2Block;
122
- } | {
119
+ /** Subtype for invalid block validation results */
120
+ export type ValidateBlockNegativeResult = {
123
121
  valid: false;
124
122
  block: PublishedL2Block;
125
123
  committee: EthAddress[];
124
+ epoch: bigint;
125
+ seed: bigint;
126
+ attestations: BlockAttestation[];
126
127
  reason: 'insufficient-attestations';
127
128
  } | {
128
129
  valid: false;
129
130
  block: PublishedL2Block;
130
131
  committee: EthAddress[];
132
+ epoch: bigint;
133
+ seed: bigint;
131
134
  reason: 'invalid-attestation';
135
+ attestations: BlockAttestation[];
132
136
  invalidIndex: number;
133
137
  };
138
+ /** Result type for validating a block attestations */
139
+ export type ValidateBlockResult = {
140
+ valid: true;
141
+ } | ValidateBlockNegativeResult;
134
142
  export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
135
143
  valid: z.ZodLiteral<true>;
136
144
  block: z.ZodOptional<z.ZodObject<{
@@ -346,6 +354,9 @@ export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
346
354
  }[];
347
355
  }>;
348
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">;
349
360
  reason: z.ZodLiteral<"insufficient-attestations">;
350
361
  }, "strip", z.ZodTypeAny, {
351
362
  valid: false;
@@ -358,7 +369,10 @@ export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
358
369
  };
359
370
  attestations: import("./index.js").CommitteeAttestation[];
360
371
  };
372
+ attestations: BlockAttestation[];
361
373
  committee: EthAddress[];
374
+ epoch: bigint;
375
+ seed: bigint;
362
376
  reason: "insufficient-attestations";
363
377
  }, {
364
378
  valid: false;
@@ -381,7 +395,10 @@ export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
381
395
  signature: string;
382
396
  }[];
383
397
  };
398
+ attestations: any[];
384
399
  committee: string[];
400
+ epoch: string | number | bigint;
401
+ seed: string | number | bigint;
385
402
  reason: "insufficient-attestations";
386
403
  }>, z.ZodObject<{
387
404
  valid: z.ZodLiteral<false>;
@@ -475,6 +492,9 @@ export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
475
492
  }[];
476
493
  }>;
477
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">;
478
498
  reason: z.ZodLiteral<"invalid-attestation">;
479
499
  invalidIndex: z.ZodNumber;
480
500
  }, "strip", z.ZodTypeAny, {
@@ -488,7 +508,10 @@ export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
488
508
  };
489
509
  attestations: import("./index.js").CommitteeAttestation[];
490
510
  };
511
+ attestations: BlockAttestation[];
491
512
  committee: EthAddress[];
513
+ epoch: bigint;
514
+ seed: bigint;
492
515
  reason: "invalid-attestation";
493
516
  invalidIndex: number;
494
517
  }, {
@@ -512,7 +535,10 @@ export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
512
535
  signature: string;
513
536
  }[];
514
537
  };
538
+ attestations: any[];
515
539
  committee: string[];
540
+ epoch: string | number | bigint;
541
+ seed: string | number | bigint;
516
542
  reason: "invalid-attestation";
517
543
  invalidIndex: number;
518
544
  }>]>;
@@ -523,6 +549,7 @@ export declare const ValidateBlockResultSchema: z.ZodUnion<[z.ZodObject<{
523
549
  export type ArchiverEmitter = TypedEventEmitter<{
524
550
  [L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockPruneEvent) => void;
525
551
  [L2BlockSourceEvents.L2BlockProven]: (args: L2BlockProvenEvent) => void;
552
+ [L2BlockSourceEvents.InvalidAttestationsBlockDetected]: (args: InvalidBlockDetectedEvent) => void;
526
553
  }>;
527
554
  export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {
528
555
  }
@@ -663,7 +690,8 @@ export declare const L2TipsSchema: z.ZodObject<{
663
690
  }>;
664
691
  export declare enum L2BlockSourceEvents {
665
692
  L2PruneDetected = "l2PruneDetected",
666
- L2BlockProven = "l2BlockProven"
693
+ L2BlockProven = "l2BlockProven",
694
+ InvalidAttestationsBlockDetected = "invalidBlockDetected"
667
695
  }
668
696
  export type L2BlockProvenEvent = {
669
697
  type: 'l2BlockProven';
@@ -676,5 +704,9 @@ export type L2BlockPruneEvent = {
676
704
  epochNumber: bigint;
677
705
  blocks: L2Block[];
678
706
  };
707
+ export type InvalidBlockDetectedEvent = {
708
+ type: 'invalidBlockDetected';
709
+ validationResult: ValidateBlockNegativeResult;
710
+ };
679
711
  export {};
680
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,EAAE,KAAK,MAAM,EAAW,MAAM,2BAA2B,CAAC;AACjE,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,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAExC;;;OAGG;IACH,kBAAkB,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1C;;;OAGG;IACH,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAElC;;;OAGG;I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,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,iBAAiB,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,gBAAgB,EAAE,2BAA2B,CAAC;CAC/C,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { schemas } from '@aztec/foundation/schemas';
2
2
  import { z } from 'zod';
3
+ import { BlockAttestation } from '../p2p/block_attestation.js';
3
4
  import { PublishedL2Block } from './published_l2_block.js';
4
5
  export const ValidateBlockResultSchema = z.union([
5
6
  z.object({
@@ -10,12 +11,18 @@ export const ValidateBlockResultSchema = z.union([
10
11
  valid: z.literal(false),
11
12
  block: PublishedL2Block.schema,
12
13
  committee: z.array(schemas.EthAddress),
14
+ epoch: schemas.BigInt,
15
+ seed: schemas.BigInt,
16
+ attestations: z.array(BlockAttestation.schema),
13
17
  reason: z.literal('insufficient-attestations')
14
18
  }),
15
19
  z.object({
16
20
  valid: z.literal(false),
17
21
  block: PublishedL2Block.schema,
18
22
  committee: z.array(schemas.EthAddress),
23
+ epoch: schemas.BigInt,
24
+ seed: schemas.BigInt,
25
+ attestations: z.array(BlockAttestation.schema),
19
26
  reason: z.literal('invalid-attestation'),
20
27
  invalidIndex: z.number()
21
28
  })
@@ -48,5 +55,6 @@ export const L2TipsSchema = z.object({
48
55
  export var L2BlockSourceEvents = /*#__PURE__*/ function(L2BlockSourceEvents) {
49
56
  L2BlockSourceEvents["L2PruneDetected"] = "l2PruneDetected";
50
57
  L2BlockSourceEvents["L2BlockProven"] = "l2BlockProven";
58
+ L2BlockSourceEvents["InvalidAttestationsBlockDetected"] = "invalidBlockDetected";
51
59
  return L2BlockSourceEvents;
52
60
  }({});
@@ -1,6 +1,7 @@
1
1
  import { defaultFetch } from '@aztec/foundation/json-rpc/client';
2
2
  import { z } from 'zod';
3
3
  import type { ApiSchemaFor } from '../schemas/schemas.js';
4
+ import { type MonitoredSlashPayload } from '../slashing/index.js';
4
5
  import { type ComponentsVersions } from '../versioning/index.js';
5
6
  import { type SequencerConfig } from './configs.js';
6
7
  import { type ProverConfig } from './prover-client.js';
@@ -33,6 +34,8 @@ export interface AztecNodeAdmin {
33
34
  pauseSync(): Promise<void>;
34
35
  /** Resumes archiver and world state syncing. */
35
36
  resumeSync(): Promise<void>;
37
+ /** Returns all monitored payloads by the slasher. */
38
+ getSlasherMonitoredPayloads(): Promise<MonitoredSlashPayload[]>;
36
39
  }
37
40
  export type AztecNodeAdminConfig = SequencerConfig & ProverConfig & SlasherConfig & {
38
41
  maxTxPoolSize: number;
@@ -86,6 +89,8 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
86
89
  fakeProcessingDelayPerTxMs: z.ZodOptional<z.ZodNumber>;
87
90
  attestationPropagationTime: z.ZodOptional<z.ZodNumber>;
88
91
  skipCollectingAttestations: z.ZodOptional<z.ZodBoolean>;
92
+ secondsBeforeInvalidatingBlockAsCommitteeMember: z.ZodNumber;
93
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.ZodNumber;
89
94
  }, {
90
95
  nodeUrl: z.ZodOptional<z.ZodString>;
91
96
  realProofs: z.ZodBoolean;
@@ -109,10 +114,16 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
109
114
  slashInactivityCreatePenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
110
115
  slashInactivityMaxPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
111
116
  slashProposerRoundPollingIntervalSeconds: z.ZodNumber;
117
+ slashProposeInvalidAttestationsPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
118
+ slashProposeInvalidAttestationsMaxPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
119
+ slashAttestDescendantOfInvalidPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
120
+ slashAttestDescendantOfInvalidMaxPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
112
121
  slasherPrivateKey: z.ZodType<import("@aztec/foundation/config").SecretValue<string | undefined>, any, any>;
113
122
  }>, {
114
123
  maxTxPoolSize: z.ZodNumber;
115
124
  }>, "strip", z.ZodTypeAny, {
125
+ secondsBeforeInvalidatingBlockAsCommitteeMember: number;
126
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: number;
116
127
  realProofs: boolean;
117
128
  proverTestDelayType: "fixed" | "realistic";
118
129
  proverTestDelayMs: number;
@@ -131,6 +142,10 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
131
142
  slashInactivityCreatePenalty: bigint;
132
143
  slashInactivityMaxPenalty: bigint;
133
144
  slashProposerRoundPollingIntervalSeconds: number;
145
+ slashProposeInvalidAttestationsPenalty: bigint;
146
+ slashProposeInvalidAttestationsMaxPenalty: bigint;
147
+ slashAttestDescendantOfInvalidPenalty: bigint;
148
+ slashAttestDescendantOfInvalidMaxPenalty: bigint;
134
149
  slasherPrivateKey: import("@aztec/foundation/config").SecretValue<string | undefined>;
135
150
  maxTxPoolSize: number;
136
151
  coinbase?: import("@aztec/foundation/schemas").EthAddress | undefined;
@@ -165,6 +180,8 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
165
180
  nodeUrl?: string | undefined;
166
181
  slashOverridePayload?: import("@aztec/foundation/schemas").EthAddress | undefined;
167
182
  }, {
183
+ secondsBeforeInvalidatingBlockAsCommitteeMember: number;
184
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: number;
168
185
  realProofs: boolean;
169
186
  proverTestDelayType: "fixed" | "realistic";
170
187
  proverTestDelayMs: number;
@@ -183,6 +200,10 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
183
200
  slashInactivityCreatePenalty: string | number | bigint;
184
201
  slashInactivityMaxPenalty: string | number | bigint;
185
202
  slashProposerRoundPollingIntervalSeconds: number;
203
+ slashProposeInvalidAttestationsPenalty: string | number | bigint;
204
+ slashProposeInvalidAttestationsMaxPenalty: string | number | bigint;
205
+ slashAttestDescendantOfInvalidPenalty: string | number | bigint;
206
+ slashAttestDescendantOfInvalidMaxPenalty: string | number | bigint;
186
207
  maxTxPoolSize: number;
187
208
  coinbase?: any;
188
209
  feeRecipient?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"aztec-node-admin.d.ts","sourceRoot":"","sources":["../../src/interfaces/aztec-node-admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAE1F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,KAAK,kBAAkB,EAAgC,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,cAAc,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAE3C;;;OAGG;IACH,S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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEU,CAAC;AAElD,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAAC,cAAc,CAQhE,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,OAAO,CAAC,kBAAkB,CAAM,EAC1C,KAAK,sBAAe,GACnB,cAAc,CAMhB"}
@@ -1,5 +1,6 @@
1
1
  import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rpc/client';
2
2
  import { z } from 'zod';
3
+ import { MonitoredSlashPayloadSchema } from '../slashing/index.js';
3
4
  import { getVersioningResponseHandler } from '../versioning/index.js';
4
5
  import { SequencerConfigSchema } from './configs.js';
5
6
  import { ProverConfigSchema } from './prover-client.js';
@@ -13,7 +14,8 @@ export const AztecNodeAdminApiSchema = {
13
14
  startSnapshotUpload: z.function().args(z.string()).returns(z.void()),
14
15
  rollbackTo: z.function().args(z.number()).returns(z.void()),
15
16
  pauseSync: z.function().returns(z.void()),
16
- resumeSync: z.function().returns(z.void())
17
+ resumeSync: z.function().returns(z.void()),
18
+ getSlasherMonitoredPayloads: z.function().returns(z.array(MonitoredSlashPayloadSchema))
17
19
  };
18
20
  export function createAztecNodeAdminClient(url, versions = {}, fetch = defaultFetch) {
19
21
  return createSafeJsonRpcClient(url, AztecNodeAdminApiSchema, {
@@ -41,8 +41,14 @@ export interface SequencerConfig {
41
41
  fakeProcessingDelayPerTxMs?: number;
42
42
  /** How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way) */
43
43
  attestationPropagationTime?: number;
44
+ /** How many seconds before invalidating a block as a committee member (zero to never invalidate) */
45
+ secondsBeforeInvalidatingBlockAsCommitteeMember?: number;
46
+ /** How many seconds before invalidating a block as a non-committee member (zero to never invalidate) */
47
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember?: number;
44
48
  /** Skip collecting attestations (for testing only) */
45
49
  skipCollectingAttestations?: boolean;
50
+ /** Do not invalidate the previous block if invalid when we are the proposer (for testing only) */
51
+ skipInvalidateBlockAsProposer?: boolean;
46
52
  }
47
53
  export declare const SequencerConfigSchema: z.ZodObject<{
48
54
  transactionPollingIntervalMS: z.ZodOptional<z.ZodNumber>;
@@ -93,7 +99,11 @@ export declare const SequencerConfigSchema: z.ZodObject<{
93
99
  fakeProcessingDelayPerTxMs: z.ZodOptional<z.ZodNumber>;
94
100
  attestationPropagationTime: z.ZodOptional<z.ZodNumber>;
95
101
  skipCollectingAttestations: z.ZodOptional<z.ZodBoolean>;
102
+ secondsBeforeInvalidatingBlockAsCommitteeMember: z.ZodNumber;
103
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.ZodNumber;
96
104
  }, "strip", z.ZodTypeAny, {
105
+ secondsBeforeInvalidatingBlockAsCommitteeMember: number;
106
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: number;
97
107
  coinbase?: EthAddress | undefined;
98
108
  feeRecipient?: AztecAddress | undefined;
99
109
  transactionPollingIntervalMS?: number | undefined;
@@ -123,6 +133,8 @@ export declare const SequencerConfigSchema: z.ZodObject<{
123
133
  attestationPropagationTime?: number | undefined;
124
134
  skipCollectingAttestations?: boolean | undefined;
125
135
  }, {
136
+ secondsBeforeInvalidatingBlockAsCommitteeMember: number;
137
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: number;
126
138
  coinbase?: any;
127
139
  feeRecipient?: any;
128
140
  transactionPollingIntervalMS?: number | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/interfaces/configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAA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,CAAC;IACpC,wGAAwG;IACxG,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,oGAAoG;IACpG,+CAA+C,CAAC,EAAE,MAAM,CAAC;IACzD,wGAAwG;IACxG,kDAAkD,CAAC,EAAE,MAAM,CAAC;IAC5D,sDAAsD;IACtD,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,kGAAkG;IAClG,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBE,CAAC"}
@@ -19,5 +19,7 @@ export const SequencerConfigSchema = z.object({
19
19
  enforceTimeTable: z.boolean().optional(),
20
20
  fakeProcessingDelayPerTxMs: z.number().optional(),
21
21
  attestationPropagationTime: z.number().optional(),
22
- skipCollectingAttestations: z.boolean().optional()
22
+ skipCollectingAttestations: z.boolean().optional(),
23
+ secondsBeforeInvalidatingBlockAsCommitteeMember: z.number(),
24
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number()
23
25
  });
@@ -16,6 +16,10 @@ export interface SlasherConfig {
16
16
  slashInactivityCreatePenalty: bigint;
17
17
  slashInactivityMaxPenalty: bigint;
18
18
  slashProposerRoundPollingIntervalSeconds: number;
19
+ slashProposeInvalidAttestationsPenalty: bigint;
20
+ slashProposeInvalidAttestationsMaxPenalty: bigint;
21
+ slashAttestDescendantOfInvalidPenalty: bigint;
22
+ slashAttestDescendantOfInvalidMaxPenalty: bigint;
19
23
  slasherPrivateKey: SecretValue<string | undefined>;
20
24
  }
21
25
  export declare const SlasherConfigSchema: z.ZodObject<{
@@ -33,6 +37,10 @@ export declare const SlasherConfigSchema: z.ZodObject<{
33
37
  slashInactivityCreatePenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
34
38
  slashInactivityMaxPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
35
39
  slashProposerRoundPollingIntervalSeconds: z.ZodNumber;
40
+ slashProposeInvalidAttestationsPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
41
+ slashProposeInvalidAttestationsMaxPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
42
+ slashAttestDescendantOfInvalidPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
43
+ slashAttestDescendantOfInvalidMaxPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
36
44
  slasherPrivateKey: z.ZodType<SecretValue<string | undefined>, any, any>;
37
45
  }, "strip", z.ZodTypeAny, {
38
46
  slashPayloadTtlSeconds: number;
@@ -48,6 +56,10 @@ export declare const SlasherConfigSchema: z.ZodObject<{
48
56
  slashInactivityCreatePenalty: bigint;
49
57
  slashInactivityMaxPenalty: bigint;
50
58
  slashProposerRoundPollingIntervalSeconds: number;
59
+ slashProposeInvalidAttestationsPenalty: bigint;
60
+ slashProposeInvalidAttestationsMaxPenalty: bigint;
61
+ slashAttestDescendantOfInvalidPenalty: bigint;
62
+ slashAttestDescendantOfInvalidMaxPenalty: bigint;
51
63
  slasherPrivateKey: SecretValue<string | undefined>;
52
64
  slashOverridePayload?: EthAddress | undefined;
53
65
  }, {
@@ -64,6 +76,10 @@ export declare const SlasherConfigSchema: z.ZodObject<{
64
76
  slashInactivityCreatePenalty: string | number | bigint;
65
77
  slashInactivityMaxPenalty: string | number | bigint;
66
78
  slashProposerRoundPollingIntervalSeconds: number;
79
+ slashProposeInvalidAttestationsPenalty: string | number | bigint;
80
+ slashProposeInvalidAttestationsMaxPenalty: string | number | bigint;
81
+ slashAttestDescendantOfInvalidPenalty: string | number | bigint;
82
+ slashAttestDescendantOfInvalidMaxPenalty: string | number | bigint;
67
83
  slashOverridePayload?: string | undefined;
68
84
  slasherPrivateKey?: any;
69
85
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"slasher.d.ts","sourceRoot":"","sources":["../../src/interfaces/slasher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,aAAa;IAC5B,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,OAAO,CAAC;IAClC,wBAAwB,EAAE,MAAM,CAAC;IACjC,2BAA2B,EAAE,MAAM,CAAC;IACpC,sBAAsB,EAAE,OAAO,CAAC;IAChC,qCAAqC,EAAE,MAAM,CAAC;IAC9C,qCAAqC,EAAE,MAAM,CAAC;IAC9C,4BAA4B,EAAE,MAAM,CAAC;IACrC,yBAAyB,EAAE,MAAM,CAAC;IAClC,wCAAwC,EAAE,MAAM,CAAC;IACjD,iBAAiB,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBE,CAAC"}
1
+ {"version":3,"file":"slasher.d.ts","sourceRoot":"","sources":["../../src/interfaces/slasher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,aAAa;IAC5B,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,OAAO,CAAC;IAClC,wBAAwB,EAAE,MAAM,CAAC;IACjC,2BAA2B,EAAE,MAAM,CAAC;IACpC,sBAAsB,EAAE,OAAO,CAAC;IAChC,qCAAqC,EAAE,MAAM,CAAC;IAC9C,qCAAqC,EAAE,MAAM,CAAC;IAC9C,4BAA4B,EAAE,MAAM,CAAC;IACrC,yBAAyB,EAAE,MAAM,CAAC;IAClC,wCAAwC,EAAE,MAAM,CAAC;IACjD,sCAAsC,EAAE,MAAM,CAAC;IAC/C,yCAAyC,EAAE,MAAM,CAAC;IAClD,qCAAqC,EAAE,MAAM,CAAC;IAC9C,wCAAwC,EAAE,MAAM,CAAC;IACjD,iBAAiB,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBE,CAAC"}
@@ -15,5 +15,9 @@ export const SlasherConfigSchema = z.object({
15
15
  slashInactivityCreatePenalty: schemas.BigInt,
16
16
  slashInactivityMaxPenalty: schemas.BigInt,
17
17
  slashProposerRoundPollingIntervalSeconds: z.number(),
18
+ slashProposeInvalidAttestationsPenalty: schemas.BigInt,
19
+ slashProposeInvalidAttestationsMaxPenalty: schemas.BigInt,
20
+ slashAttestDescendantOfInvalidPenalty: schemas.BigInt,
21
+ slashAttestDescendantOfInvalidMaxPenalty: schemas.BigInt,
18
22
  slasherPrivateKey: schemas.SecretValue(z.string().optional())
19
23
  });
@@ -0,0 +1,51 @@
1
+ import type { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { z } from 'zod';
3
+ import { type ZodFor } from '../schemas/index.js';
4
+ export declare enum Offense {
5
+ UNKNOWN = 0,
6
+ DATA_WITHHOLDING = 1,
7
+ VALID_EPOCH_PRUNED = 2,
8
+ INACTIVITY = 3,
9
+ /** A proposer sent an invalid block proposal over the p2p network to the committee */
10
+ BROADCASTED_INVALID_BLOCK_PROPOSAL = 4,
11
+ /** A proposer pushed to L1 a block with insufficient committee attestations */
12
+ PROPOSED_INSUFFICIENT_ATTESTATIONS = 5,
13
+ /** A proposer pushed to L1 a block with incorrect committee attestations (ie signature from a non-committee member) */
14
+ PROPOSED_INCORRECT_ATTESTATIONS = 6,
15
+ /** A committee member attested to a block that was built as a descendent of an invalid block (as in a block with invalid attestations) */
16
+ ATTESTED_DESCENDANT_OF_INVALID = 7
17
+ }
18
+ export declare const OffenseSchema: z.ZodNativeEnum<typeof Offense>;
19
+ export type MonitoredSlashPayload = {
20
+ payloadAddress: EthAddress;
21
+ validators: readonly EthAddress[];
22
+ amounts: readonly bigint[];
23
+ offenses: readonly Offense[];
24
+ observedAtSeconds: number;
25
+ totalAmount: bigint;
26
+ };
27
+ export declare const MonitoredSlashPayloadSchema: z.ZodObject<{
28
+ payloadAddress: ZodFor<EthAddress>;
29
+ validators: z.ZodArray<ZodFor<EthAddress>, "many">;
30
+ amounts: z.ZodArray<z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>, "many">;
31
+ offenses: z.ZodArray<z.ZodNativeEnum<typeof Offense>, "many">;
32
+ observedAtSeconds: z.ZodNumber;
33
+ totalAmount: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ payloadAddress: EthAddress;
36
+ validators: EthAddress[];
37
+ amounts: bigint[];
38
+ offenses: Offense[];
39
+ observedAtSeconds: number;
40
+ totalAmount: bigint;
41
+ }, {
42
+ validators: any[];
43
+ amounts: (string | number | bigint)[];
44
+ offenses: Offense[];
45
+ observedAtSeconds: number;
46
+ totalAmount: string | number | bigint;
47
+ payloadAddress?: any;
48
+ }>;
49
+ export declare const OffenseToBigInt: Record<Offense, bigint>;
50
+ export declare function bigIntToOffense(offense: bigint): Offense;
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slashing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAE3D,oBAAY,OAAO;IACjB,OAAO,IAAI;IACX,gBAAgB,IAAI;IACpB,kBAAkB,IAAI;IACtB,UAAU,IAAI;IACd,sFAAsF;IACtF,kCAAkC,IAAI;IACtC,+EAA+E;IAC/E,kCAAkC,IAAI;IACtC,uHAAuH;IACvH,+BAA+B,IAAI;IACnC,0IAA0I;IAC1I,8BAA8B,IAAI;CACnC;AAED,eAAO,MAAM,aAAa,iCAAwB,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,cAAc,EAAE,UAAU,CAAC;IAC3B,UAAU,EAAE,SAAS,UAAU,EAAE,CAAC;IAClC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;EAOE,CAAC;AAE3C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CASnD,CAAC;AAEF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAqBxD"}
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ import { schemas } from '../schemas/index.js';
3
+ export var Offense = /*#__PURE__*/ function(Offense) {
4
+ Offense[Offense["UNKNOWN"] = 0] = "UNKNOWN";
5
+ Offense[Offense["DATA_WITHHOLDING"] = 1] = "DATA_WITHHOLDING";
6
+ Offense[Offense["VALID_EPOCH_PRUNED"] = 2] = "VALID_EPOCH_PRUNED";
7
+ Offense[Offense["INACTIVITY"] = 3] = "INACTIVITY";
8
+ /** A proposer sent an invalid block proposal over the p2p network to the committee */ Offense[Offense["BROADCASTED_INVALID_BLOCK_PROPOSAL"] = 4] = "BROADCASTED_INVALID_BLOCK_PROPOSAL";
9
+ /** A proposer pushed to L1 a block with insufficient committee attestations */ Offense[Offense["PROPOSED_INSUFFICIENT_ATTESTATIONS"] = 5] = "PROPOSED_INSUFFICIENT_ATTESTATIONS";
10
+ /** A proposer pushed to L1 a block with incorrect committee attestations (ie signature from a non-committee member) */ Offense[Offense["PROPOSED_INCORRECT_ATTESTATIONS"] = 6] = "PROPOSED_INCORRECT_ATTESTATIONS";
11
+ /** A committee member attested to a block that was built as a descendent of an invalid block (as in a block with invalid attestations) */ Offense[Offense["ATTESTED_DESCENDANT_OF_INVALID"] = 7] = "ATTESTED_DESCENDANT_OF_INVALID";
12
+ return Offense;
13
+ }({});
14
+ export const OffenseSchema = z.nativeEnum(Offense);
15
+ export const MonitoredSlashPayloadSchema = z.object({
16
+ payloadAddress: schemas.EthAddress,
17
+ validators: z.array(schemas.EthAddress),
18
+ amounts: z.array(schemas.BigInt),
19
+ offenses: z.array(OffenseSchema),
20
+ observedAtSeconds: z.number(),
21
+ totalAmount: schemas.BigInt
22
+ });
23
+ export const OffenseToBigInt = {
24
+ [0]: 0n,
25
+ [1]: 1n,
26
+ [2]: 2n,
27
+ [3]: 3n,
28
+ [4]: 4n,
29
+ [5]: 5n,
30
+ [6]: 6n,
31
+ [7]: 7n
32
+ };
33
+ export function bigIntToOffense(offense) {
34
+ switch(offense){
35
+ case 0n:
36
+ return 0;
37
+ case 1n:
38
+ return 1;
39
+ case 2n:
40
+ return 2;
41
+ case 3n:
42
+ return 3;
43
+ case 4n:
44
+ return 4;
45
+ case 5n:
46
+ return 5;
47
+ case 6n:
48
+ return 6;
49
+ case 7n:
50
+ return 7;
51
+ default:
52
+ throw new Error(`Unknown offense: ${offense}`);
53
+ }
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "1.0.0-nightly.20250801",
3
+ "version": "1.0.0-nightly.20250805",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -50,7 +50,8 @@
50
50
  "./file-store": "./dest/file-store/index.js",
51
51
  "./snapshots": "./dest/snapshots/index.js",
52
52
  "./update-checker": "./dest/update-checker/index.js",
53
- "./zkpassport": "./dest/zkpassport/index.js"
53
+ "./zkpassport": "./dest/zkpassport/index.js",
54
+ "./slashing": "./dest/slashing/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.20250801",
71
- "@aztec/blob-lib": "1.0.0-nightly.20250801",
72
- "@aztec/constants": "1.0.0-nightly.20250801",
73
- "@aztec/ethereum": "1.0.0-nightly.20250801",
74
- "@aztec/foundation": "1.0.0-nightly.20250801",
75
- "@aztec/noir-noirc_abi": "1.0.0-nightly.20250801",
71
+ "@aztec/bb.js": "1.0.0-nightly.20250805",
72
+ "@aztec/blob-lib": "1.0.0-nightly.20250805",
73
+ "@aztec/constants": "1.0.0-nightly.20250805",
74
+ "@aztec/ethereum": "1.0.0-nightly.20250805",
75
+ "@aztec/foundation": "1.0.0-nightly.20250805",
76
+ "@aztec/noir-noirc_abi": "1.0.0-nightly.20250805",
76
77
  "@google-cloud/storage": "^7.15.0",
77
78
  "axios": "^1.9.0",
78
79
  "json-stringify-deterministic": "1.0.12",
@@ -5,6 +5,7 @@ import type { TypedEventEmitter } from '@aztec/foundation/types';
5
5
  import { z } from 'zod';
6
6
 
7
7
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
8
+ import { BlockAttestation } from '../p2p/block_attestation.js';
8
9
  import type { BlockHeader } from '../tx/block_header.js';
9
10
  import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
10
11
  import type { TxHash } from '../tx/tx_hash.js';
@@ -130,8 +131,8 @@ export interface L2BlockSource {
130
131
  isPendingChainInvalid(): Promise<boolean>;
131
132
 
132
133
  /**
133
- * Returns the status of the pending chain validation.
134
- * This includes whether the chain is valid, and if not, the reason for invalidation.
134
+ * Returns the status of the pending chain validation. If the chain is invalid, reports the earliest consecutive block
135
+ * that is invalid, along with the reason for being invalid, which can be used to trigger an invalidation.
135
136
  */
136
137
  getPendingChainValidationStatus(): Promise<ValidateBlockResult>;
137
138
 
@@ -139,30 +140,49 @@ export interface L2BlockSource {
139
140
  syncImmediate(): Promise<void>;
140
141
  }
141
142
 
142
- /** Result type for validating a block attestations */
143
- export type ValidateBlockResult =
144
- | { valid: true; block?: PublishedL2Block }
145
- | { valid: false; block: PublishedL2Block; committee: EthAddress[]; reason: 'insufficient-attestations' }
143
+ /** Subtype for invalid block validation results */
144
+ export type ValidateBlockNegativeResult =
145
+ | {
146
+ valid: false;
147
+ block: PublishedL2Block;
148
+ committee: EthAddress[];
149
+ epoch: bigint;
150
+ seed: bigint;
151
+ attestations: BlockAttestation[];
152
+ reason: 'insufficient-attestations';
153
+ }
146
154
  | {
147
155
  valid: false;
148
156
  block: PublishedL2Block;
149
157
  committee: EthAddress[];
158
+ epoch: bigint;
159
+ seed: bigint;
150
160
  reason: 'invalid-attestation';
161
+ attestations: BlockAttestation[];
151
162
  invalidIndex: number;
152
163
  };
153
164
 
165
+ /** Result type for validating a block attestations */
166
+ export type ValidateBlockResult = { valid: true } | ValidateBlockNegativeResult;
167
+
154
168
  export const ValidateBlockResultSchema = z.union([
155
169
  z.object({ valid: z.literal(true), block: PublishedL2Block.schema.optional() }),
156
170
  z.object({
157
171
  valid: z.literal(false),
158
172
  block: PublishedL2Block.schema,
159
173
  committee: z.array(schemas.EthAddress),
174
+ epoch: schemas.BigInt,
175
+ seed: schemas.BigInt,
176
+ attestations: z.array(BlockAttestation.schema),
160
177
  reason: z.literal('insufficient-attestations'),
161
178
  }),
162
179
  z.object({
163
180
  valid: z.literal(false),
164
181
  block: PublishedL2Block.schema,
165
182
  committee: z.array(schemas.EthAddress),
183
+ epoch: schemas.BigInt,
184
+ seed: schemas.BigInt,
185
+ attestations: z.array(BlockAttestation.schema),
166
186
  reason: z.literal('invalid-attestation'),
167
187
  invalidIndex: z.number(),
168
188
  }),
@@ -176,6 +196,7 @@ export const ValidateBlockResultSchema = z.union([
176
196
  export type ArchiverEmitter = TypedEventEmitter<{
177
197
  [L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockPruneEvent) => void;
178
198
  [L2BlockSourceEvents.L2BlockProven]: (args: L2BlockProvenEvent) => void;
199
+ [L2BlockSourceEvents.InvalidAttestationsBlockDetected]: (args: InvalidBlockDetectedEvent) => void;
179
200
  }>;
180
201
  export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {}
181
202
 
@@ -222,6 +243,7 @@ export const L2TipsSchema = z.object({
222
243
  export enum L2BlockSourceEvents {
223
244
  L2PruneDetected = 'l2PruneDetected',
224
245
  L2BlockProven = 'l2BlockProven',
246
+ InvalidAttestationsBlockDetected = 'invalidBlockDetected',
225
247
  }
226
248
 
227
249
  export type L2BlockProvenEvent = {
@@ -236,3 +258,8 @@ export type L2BlockPruneEvent = {
236
258
  epochNumber: bigint;
237
259
  blocks: L2Block[];
238
260
  };
261
+
262
+ export type InvalidBlockDetectedEvent = {
263
+ type: 'invalidBlockDetected';
264
+ validationResult: ValidateBlockNegativeResult;
265
+ };
@@ -3,6 +3,7 @@ import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rp
3
3
  import { z } from 'zod';
4
4
 
5
5
  import type { ApiSchemaFor } from '../schemas/schemas.js';
6
+ import { type MonitoredSlashPayload, MonitoredSlashPayloadSchema } from '../slashing/index.js';
6
7
  import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
7
8
  import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
8
9
  import { type ProverConfig, ProverConfigSchema } from './prover-client.js';
@@ -41,6 +42,9 @@ export interface AztecNodeAdmin {
41
42
 
42
43
  /** Resumes archiver and world state syncing. */
43
44
  resumeSync(): Promise<void>;
45
+
46
+ /** Returns all monitored payloads by the slasher. */
47
+ getSlasherMonitoredPayloads(): Promise<MonitoredSlashPayload[]>;
44
48
  }
45
49
 
46
50
  export type AztecNodeAdminConfig = SequencerConfig & ProverConfig & SlasherConfig & { maxTxPoolSize: number };
@@ -56,6 +60,7 @@ export const AztecNodeAdminApiSchema: ApiSchemaFor<AztecNodeAdmin> = {
56
60
  rollbackTo: z.function().args(z.number()).returns(z.void()),
57
61
  pauseSync: z.function().returns(z.void()),
58
62
  resumeSync: z.function().returns(z.void()),
63
+ getSlasherMonitoredPayloads: z.function().returns(z.array(MonitoredSlashPayloadSchema)),
59
64
  };
60
65
 
61
66
  export function createAztecNodeAdminClient(
@@ -44,8 +44,14 @@ export interface SequencerConfig {
44
44
  fakeProcessingDelayPerTxMs?: number;
45
45
  /** How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way) */
46
46
  attestationPropagationTime?: number;
47
+ /** How many seconds before invalidating a block as a committee member (zero to never invalidate) */
48
+ secondsBeforeInvalidatingBlockAsCommitteeMember?: number;
49
+ /** How many seconds before invalidating a block as a non-committee member (zero to never invalidate) */
50
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember?: number;
47
51
  /** Skip collecting attestations (for testing only) */
48
52
  skipCollectingAttestations?: boolean;
53
+ /** Do not invalidate the previous block if invalid when we are the proposer (for testing only) */
54
+ skipInvalidateBlockAsProposer?: boolean;
49
55
  }
50
56
 
51
57
  export const SequencerConfigSchema = z.object({
@@ -67,4 +73,6 @@ export const SequencerConfigSchema = z.object({
67
73
  fakeProcessingDelayPerTxMs: z.number().optional(),
68
74
  attestationPropagationTime: z.number().optional(),
69
75
  skipCollectingAttestations: z.boolean().optional(),
76
+ secondsBeforeInvalidatingBlockAsCommitteeMember: z.number(),
77
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
70
78
  }) satisfies ZodFor<SequencerConfig>;
@@ -19,6 +19,10 @@ export interface SlasherConfig {
19
19
  slashInactivityCreatePenalty: bigint;
20
20
  slashInactivityMaxPenalty: bigint;
21
21
  slashProposerRoundPollingIntervalSeconds: number;
22
+ slashProposeInvalidAttestationsPenalty: bigint;
23
+ slashProposeInvalidAttestationsMaxPenalty: bigint;
24
+ slashAttestDescendantOfInvalidPenalty: bigint;
25
+ slashAttestDescendantOfInvalidMaxPenalty: bigint;
22
26
  slasherPrivateKey: SecretValue<string | undefined>; // Private key of the slasher account used for creating slash payloads
23
27
  }
24
28
 
@@ -37,5 +41,9 @@ export const SlasherConfigSchema = z.object({
37
41
  slashInactivityCreatePenalty: schemas.BigInt,
38
42
  slashInactivityMaxPenalty: schemas.BigInt,
39
43
  slashProposerRoundPollingIntervalSeconds: z.number(),
44
+ slashProposeInvalidAttestationsPenalty: schemas.BigInt,
45
+ slashProposeInvalidAttestationsMaxPenalty: schemas.BigInt,
46
+ slashAttestDescendantOfInvalidPenalty: schemas.BigInt,
47
+ slashAttestDescendantOfInvalidMaxPenalty: schemas.BigInt,
40
48
  slasherPrivateKey: schemas.SecretValue(z.string().optional()),
41
49
  }) satisfies ZodFor<SlasherConfig>;
@@ -0,0 +1,74 @@
1
+ import type { EthAddress } from '@aztec/foundation/eth-address';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import { type ZodFor, schemas } from '../schemas/index.js';
6
+
7
+ export enum Offense {
8
+ UNKNOWN = 0,
9
+ DATA_WITHHOLDING = 1,
10
+ VALID_EPOCH_PRUNED = 2,
11
+ INACTIVITY = 3,
12
+ /** A proposer sent an invalid block proposal over the p2p network to the committee */
13
+ BROADCASTED_INVALID_BLOCK_PROPOSAL = 4,
14
+ /** A proposer pushed to L1 a block with insufficient committee attestations */
15
+ PROPOSED_INSUFFICIENT_ATTESTATIONS = 5,
16
+ /** A proposer pushed to L1 a block with incorrect committee attestations (ie signature from a non-committee member) */
17
+ PROPOSED_INCORRECT_ATTESTATIONS = 6,
18
+ /** A committee member attested to a block that was built as a descendent of an invalid block (as in a block with invalid attestations) */
19
+ ATTESTED_DESCENDANT_OF_INVALID = 7,
20
+ }
21
+
22
+ export const OffenseSchema = z.nativeEnum(Offense);
23
+
24
+ export type MonitoredSlashPayload = {
25
+ payloadAddress: EthAddress;
26
+ validators: readonly EthAddress[];
27
+ amounts: readonly bigint[];
28
+ offenses: readonly Offense[];
29
+ observedAtSeconds: number;
30
+ totalAmount: bigint;
31
+ };
32
+
33
+ export const MonitoredSlashPayloadSchema = z.object({
34
+ payloadAddress: schemas.EthAddress,
35
+ validators: z.array(schemas.EthAddress),
36
+ amounts: z.array(schemas.BigInt),
37
+ offenses: z.array(OffenseSchema),
38
+ observedAtSeconds: z.number(),
39
+ totalAmount: schemas.BigInt,
40
+ }) satisfies ZodFor<MonitoredSlashPayload>;
41
+
42
+ export const OffenseToBigInt: Record<Offense, bigint> = {
43
+ [Offense.UNKNOWN]: 0n,
44
+ [Offense.DATA_WITHHOLDING]: 1n,
45
+ [Offense.VALID_EPOCH_PRUNED]: 2n,
46
+ [Offense.INACTIVITY]: 3n,
47
+ [Offense.BROADCASTED_INVALID_BLOCK_PROPOSAL]: 4n,
48
+ [Offense.PROPOSED_INSUFFICIENT_ATTESTATIONS]: 5n,
49
+ [Offense.PROPOSED_INCORRECT_ATTESTATIONS]: 6n,
50
+ [Offense.ATTESTED_DESCENDANT_OF_INVALID]: 7n,
51
+ };
52
+
53
+ export function bigIntToOffense(offense: bigint): Offense {
54
+ switch (offense) {
55
+ case 0n:
56
+ return Offense.UNKNOWN;
57
+ case 1n:
58
+ return Offense.DATA_WITHHOLDING;
59
+ case 2n:
60
+ return Offense.VALID_EPOCH_PRUNED;
61
+ case 3n:
62
+ return Offense.INACTIVITY;
63
+ case 4n:
64
+ return Offense.BROADCASTED_INVALID_BLOCK_PROPOSAL;
65
+ case 5n:
66
+ return Offense.PROPOSED_INSUFFICIENT_ATTESTATIONS;
67
+ case 6n:
68
+ return Offense.PROPOSED_INCORRECT_ATTESTATIONS;
69
+ case 7n:
70
+ return Offense.ATTESTED_DESCENDANT_OF_INVALID;
71
+ default:
72
+ throw new Error(`Unknown offense: ${offense}`);
73
+ }
74
+ }