@aztec/stdlib 2.0.0-nightly.20250901 → 2.0.0-nightly.20250903

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.
@@ -108,6 +108,7 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
108
108
  slashValidatorsAlways: z.ZodArray<z.ZodType<import("@aztec/foundation/schemas").EthAddress, any, string>, "many">;
109
109
  slashValidatorsNever: z.ZodArray<z.ZodType<import("@aztec/foundation/schemas").EthAddress, any, string>, "many">;
110
110
  slashPrunePenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
111
+ slashDataWithholdingPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
111
112
  slashInactivityTargetPercentage: z.ZodNumber;
112
113
  slashInactivityPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
113
114
  slashProposeInvalidAttestationsPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
@@ -128,6 +129,7 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
128
129
  slashValidatorsAlways: import("@aztec/foundation/schemas").EthAddress[];
129
130
  slashValidatorsNever: import("@aztec/foundation/schemas").EthAddress[];
130
131
  slashPrunePenalty: bigint;
132
+ slashDataWithholdingPenalty: bigint;
131
133
  slashInactivityTargetPercentage: number;
132
134
  slashInactivityPenalty: bigint;
133
135
  slashProposeInvalidAttestationsPenalty: bigint;
@@ -183,6 +185,7 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
183
185
  slashValidatorsAlways: string[];
184
186
  slashValidatorsNever: string[];
185
187
  slashPrunePenalty: string | number | bigint;
188
+ slashDataWithholdingPenalty: string | number | bigint;
186
189
  slashInactivityTargetPercentage: number;
187
190
  slashInactivityPenalty: string | number | bigint;
188
191
  slashProposeInvalidAttestationsPenalty: string | number | bigint;
@@ -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,OAAO,EAAiB,KAAK,iBAAiB,EAA2B,MAAM,sBAAsB,CAAC;AACpH,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,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhE;;;OAGG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD;;;;OAIG;IACH,UAAU,CAAC,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtE,+CAA+C;IAC/C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B,gDAAgD;IAChD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,2EAA2E;IAC3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uB,EAAE,YAAY,CAAC,cAAc,CAYhE,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,OAAO,CAAC,kBAAkB,CAAM,EAC1C,KAAK,sBAAe,GACnB,cAAc,CAMhB"}
@@ -10,6 +10,7 @@ export interface SlasherConfig {
10
10
  slashValidatorsNever: EthAddress[];
11
11
  slashInactivityTargetPercentage: number;
12
12
  slashPrunePenalty: bigint;
13
+ slashDataWithholdingPenalty: bigint;
13
14
  slashInactivityPenalty: bigint;
14
15
  slashBroadcastedInvalidBlockPenalty: bigint;
15
16
  slashProposeInvalidAttestationsPenalty: bigint;
@@ -26,6 +27,7 @@ export declare const SlasherConfigSchema: z.ZodObject<{
26
27
  slashValidatorsAlways: z.ZodArray<z.ZodType<EthAddress, any, string>, "many">;
27
28
  slashValidatorsNever: z.ZodArray<z.ZodType<EthAddress, any, string>, "many">;
28
29
  slashPrunePenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
30
+ slashDataWithholdingPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
29
31
  slashInactivityTargetPercentage: z.ZodNumber;
30
32
  slashInactivityPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
31
33
  slashProposeInvalidAttestationsPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
@@ -42,6 +44,7 @@ export declare const SlasherConfigSchema: z.ZodObject<{
42
44
  slashValidatorsAlways: EthAddress[];
43
45
  slashValidatorsNever: EthAddress[];
44
46
  slashPrunePenalty: bigint;
47
+ slashDataWithholdingPenalty: bigint;
45
48
  slashInactivityTargetPercentage: number;
46
49
  slashInactivityPenalty: bigint;
47
50
  slashProposeInvalidAttestationsPenalty: bigint;
@@ -59,6 +62,7 @@ export declare const SlasherConfigSchema: z.ZodObject<{
59
62
  slashValidatorsAlways: string[];
60
63
  slashValidatorsNever: string[];
61
64
  slashPrunePenalty: string | number | bigint;
65
+ slashDataWithholdingPenalty: string | number | bigint;
62
66
  slashInactivityTargetPercentage: number;
63
67
  slashInactivityPenalty: string | number | bigint;
64
68
  slashProposeInvalidAttestationsPenalty: string | number | bigint;
@@ -1 +1 @@
1
- {"version":3,"file":"slasher.d.ts","sourceRoot":"","sources":["../../src/interfaces/slasher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,UAAU,EAAE,CAAC;IACpC,oBAAoB,EAAE,UAAU,EAAE,CAAC;IACnC,+BAA+B,EAAE,MAAM,CAAC;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mCAAmC,EAAE,MAAM,CAAC;IAC5C,sCAAsC,EAAE,MAAM,CAAC;IAC/C,qCAAqC,EAAE,MAAM,CAAC;IAC9C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,4BAA4B,EAAE,MAAM,CAAC;IACrC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBE,CAAC"}
1
+ {"version":3,"file":"slasher.d.ts","sourceRoot":"","sources":["../../src/interfaces/slasher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,UAAU,EAAE,CAAC;IACpC,oBAAoB,EAAE,UAAU,EAAE,CAAC;IACnC,+BAA+B,EAAE,MAAM,CAAC;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2BAA2B,EAAE,MAAM,CAAC;IACpC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mCAAmC,EAAE,MAAM,CAAC;IAC5C,sCAAsC,EAAE,MAAM,CAAC;IAC/C,qCAAqC,EAAE,MAAM,CAAC;IAC9C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,4BAA4B,EAAE,MAAM,CAAC;IACrC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBE,CAAC"}
@@ -7,6 +7,7 @@ export const SlasherConfigSchema = z.object({
7
7
  slashValidatorsAlways: z.array(schemas.EthAddress),
8
8
  slashValidatorsNever: z.array(schemas.EthAddress),
9
9
  slashPrunePenalty: schemas.BigInt,
10
+ slashDataWithholdingPenalty: schemas.BigInt,
10
11
  slashInactivityTargetPercentage: z.number(),
11
12
  slashInactivityPenalty: schemas.BigInt,
12
13
  slashProposeInvalidAttestationsPenalty: schemas.BigInt,
@@ -19,13 +19,14 @@ export declare function getEpochsForRound(round: bigint, constants: {
19
19
  epochDuration: number;
20
20
  }): bigint[];
21
21
  /** Reads the configured penalty for a given offense type from a slasher config struct */
22
- export declare function getPenaltyForOffense(offense: OffenseType, config: Pick<SlasherConfig, 'slashAttestDescendantOfInvalidPenalty' | 'slashBroadcastedInvalidBlockPenalty' | 'slashPrunePenalty' | 'slashUnknownPenalty' | 'slashInactivityPenalty' | 'slashProposeInvalidAttestationsPenalty'>): bigint;
22
+ export declare function getPenaltyForOffense(offense: OffenseType, config: Pick<SlasherConfig, 'slashAttestDescendantOfInvalidPenalty' | 'slashBroadcastedInvalidBlockPenalty' | 'slashPrunePenalty' | 'slashDataWithholdingPenalty' | 'slashUnknownPenalty' | 'slashInactivityPenalty' | 'slashProposeInvalidAttestationsPenalty'>): bigint;
23
23
  /** Returns whether the `epochOrSlot` field for an offense references an epoch or a slot */
24
24
  export declare function getTimeUnitForOffense(offense: OffenseType): 'epoch' | 'slot';
25
25
  /** Returns the slot for a given offense. If the offense references an epoch, returns the first slot of the epoch. */
26
26
  export declare function getSlotForOffense(offense: Pick<Offense, 'epochOrSlot' | 'offenseType'>, constants: Pick<L1RollupConstants, 'epochDuration'>): bigint;
27
- /** Returns the epoch for a given offense. */
27
+ /** Returns the epoch for a given offense. If the offense type or epoch is not defined, returns undefined. */
28
28
  export declare function getEpochForOffense(offense: Pick<Offense, 'epochOrSlot' | 'offenseType'>, constants: Pick<L1RollupConstants, 'epochDuration'>): bigint;
29
+ export declare function getEpochForOffense(offense: Partial<Pick<Offense, 'epochOrSlot' | 'offenseType'>>, constants: Pick<L1RollupConstants, 'epochDuration'>): bigint | undefined;
29
30
  /** Returns the slashing round in which a given offense occurred. */
30
31
  export declare function getRoundForOffense(offense: Pick<Offense, 'epochOrSlot' | 'offenseType'>, constants: {
31
32
  slashingRoundSize: number;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/slashing/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AW,EACpB,MAAM,EAAE,IAAI,CACV,aAAa,EACX,uCAAuC,GACvC,qCAAqC,GACrC,mBAAmB,GACnB,6BAA6B,GAC7B,qBAAqB,GACrB,wBAAwB,GACxB,wCAAwC,CAC3C,UAuBF;AAED,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,GAAG,MAAM,CAiB5E;AAED,qHAAqH;AACrH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAAC,EACrD,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAClD,MAAM,CAGR;AAED,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAAC,EACrD,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAClD,MAAM,CAAC;AACV,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAAC,CAAC,EAC9D,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAClD,MAAM,GAAG,SAAS,CAAC;AAYtB,oEAAoE;AACpE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAAC,EACrD,SAAS,EAAE;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAC9D,MAAM,CAGR"}
@@ -32,8 +32,9 @@ import { OffenseType } from './types.js';
32
32
  /** Reads the configured penalty for a given offense type from a slasher config struct */ export function getPenaltyForOffense(offense, config) {
33
33
  switch(offense){
34
34
  case OffenseType.VALID_EPOCH_PRUNED:
35
- case OffenseType.DATA_WITHHOLDING:
36
35
  return config.slashPrunePenalty;
36
+ case OffenseType.DATA_WITHHOLDING:
37
+ return config.slashDataWithholdingPenalty;
37
38
  case OffenseType.INACTIVITY:
38
39
  return config.slashInactivityPenalty;
39
40
  case OffenseType.PROPOSED_INSUFFICIENT_ATTESTATIONS:
@@ -47,8 +48,8 @@ import { OffenseType } from './types.js';
47
48
  return config.slashUnknownPenalty;
48
49
  default:
49
50
  {
50
- const _ = offense;
51
- throw new Error(`Unknown offense type: ${offense}`);
51
+ const _exhaustiveCheck = offense;
52
+ throw new Error(`Unknown offense type: ${_exhaustiveCheck}`);
52
53
  }
53
54
  }
54
55
  }
@@ -66,8 +67,8 @@ import { OffenseType } from './types.js';
66
67
  return 'epoch';
67
68
  default:
68
69
  {
69
- const _ = offense;
70
- throw new Error(`Unknown offense type: ${offense}`);
70
+ const _exhaustiveCheck = offense;
71
+ throw new Error(`Unknown offense type: ${_exhaustiveCheck}`);
71
72
  }
72
73
  }
73
74
  }
@@ -75,8 +76,11 @@ import { OffenseType } from './types.js';
75
76
  const { epochOrSlot, offenseType } = offense;
76
77
  return getTimeUnitForOffense(offenseType) === 'epoch' ? epochOrSlot * BigInt(constants.epochDuration) : epochOrSlot;
77
78
  }
78
- /** Returns the epoch for a given offense. */ export function getEpochForOffense(offense, constants) {
79
+ export function getEpochForOffense(offense, constants) {
79
80
  const { epochOrSlot, offenseType } = offense;
81
+ if (epochOrSlot === undefined || offenseType === undefined) {
82
+ return undefined;
83
+ }
80
84
  return getTimeUnitForOffense(offenseType) === 'epoch' ? epochOrSlot : epochOrSlot / BigInt(constants.epochDuration);
81
85
  }
82
86
  /** Returns the slashing round in which a given offense occurred. */ export function getRoundForOffense(offense, constants) {
@@ -1,14 +1,17 @@
1
1
  import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import type { PartialBy } from '@aztec/foundation/types';
2
3
  import type { Offense, ValidatorSlashVote } from './types.js';
3
4
  /**
4
5
  * Creates a consensus-slash vote for a given set of committees based on a set of Offenses
5
6
  * @param offenses - Array of offenses to consider
6
7
  * @param committees - Array of committees (each containing array of validator addresses)
8
+ * @param epochsForCommittees - Array of epochs corresponding to each committee
7
9
  * @param settings - Settings including slashingAmounts and optional validator override lists
8
10
  * @returns Array of ValidatorSlashVote, where each vote is how many slash units the validator in that position should be slashed
9
11
  */
10
- export declare function getSlashConsensusVotesFromOffenses(offenses: Pick<Offense, 'validator' | 'amount'>[], committees: EthAddress[][], settings: {
12
+ export declare function getSlashConsensusVotesFromOffenses(offenses: PartialBy<Offense, 'epochOrSlot'>[], committees: EthAddress[][], epochsForCommittees: bigint[], settings: {
11
13
  slashingAmounts: [bigint, bigint, bigint];
14
+ epochDuration: number;
12
15
  }): ValidatorSlashVote[];
13
16
  /**
14
17
  * Encodes a set of slash votes into a Buffer for use in a consensus slashing vote transaction.
@@ -1 +1 @@
1
- {"version":3,"file":"tally.d.ts","sourceRoot":"","sources":["../../src/slashing/tally.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,QAAQ,CAAC,EAAE,EACjD,UAAU,EAAE,UAAU,EAAE,EAAE,EAC1B,QAAQ,EAAE;IACR,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C,GACA,kBAAkB,EAAE,CAuBtB;AAeD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAe7E"}
1
+ {"version":3,"file":"tally.d.ts","sourceRoot":"","sources":["../../src/slashing/tally.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,EAC7C,UAAU,EAAE,UAAU,EAAE,EAAE,EAC1B,mBAAmB,EAAE,MAAM,EAAE,EAC7B,QAAQ,EAAE;IACR,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,aAAa,EAAE,MAAM,CAAC;CACvB,GACA,kBAAkB,EAAE,CA2BtB;AAeD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAe7E"}
@@ -1,26 +1,29 @@
1
1
  import { sumBigint } from '@aztec/foundation/bigint';
2
+ import { getEpochForOffense } from './helpers.js';
2
3
  /**
3
4
  * Creates a consensus-slash vote for a given set of committees based on a set of Offenses
4
5
  * @param offenses - Array of offenses to consider
5
6
  * @param committees - Array of committees (each containing array of validator addresses)
7
+ * @param epochsForCommittees - Array of epochs corresponding to each committee
6
8
  * @param settings - Settings including slashingAmounts and optional validator override lists
7
9
  * @returns Array of ValidatorSlashVote, where each vote is how many slash units the validator in that position should be slashed
8
- */ export function getSlashConsensusVotesFromOffenses(offenses, committees, settings) {
10
+ */ export function getSlashConsensusVotesFromOffenses(offenses, committees, epochsForCommittees, settings) {
9
11
  const { slashingAmounts } = settings;
10
- const slashedSet = new Set();
11
- const votes = committees.flatMap((committee)=>committee.map((validator)=>{
12
- const validatorStr = validator.toString();
13
- // If already voted for slashing this validator, skip
14
- if (slashedSet.has(validatorStr)) {
15
- return 0;
16
- }
17
- // Normal offense-based slashing logic
18
- const validatorOffenses = offenses.filter((o)=>o.validator.equals(validator));
12
+ if (committees.length !== epochsForCommittees.length) {
13
+ throw new Error('committees and epochsForCommittees must have the same length');
14
+ }
15
+ const votes = committees.flatMap((committee, committeeIndex)=>{
16
+ const committeeEpoch = epochsForCommittees[committeeIndex];
17
+ return committee.map((validator)=>{
18
+ // Find offenses for this validator in this specific epoch.
19
+ // If an offense has no epoch, it is considered for all epochs due to a slashAlways setting.
20
+ const validatorOffenses = offenses.filter((o)=>o.validator.equals(validator) && (o.epochOrSlot === undefined || getEpochForOffense(o, settings) === committeeEpoch));
21
+ // Sum up the penalties for this validator in this epoch
19
22
  const slashAmount = sumBigint(validatorOffenses.map((o)=>o.amount));
20
23
  const slashUnits = getSlashUnitsForAmount(slashAmount, slashingAmounts);
21
- slashedSet.add(validatorStr);
22
24
  return Number(slashUnits);
23
- }));
25
+ });
26
+ });
24
27
  return votes;
25
28
  }
26
29
  /** Returns the slash vote for the given amount to slash. */ function getSlashUnitsForAmount(amountToSlash, slashingAmounts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "2.0.0-nightly.20250901",
3
+ "version": "2.0.0-nightly.20250903",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -69,13 +69,13 @@
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": "2.0.0-nightly.20250901",
73
- "@aztec/blob-lib": "2.0.0-nightly.20250901",
74
- "@aztec/constants": "2.0.0-nightly.20250901",
75
- "@aztec/ethereum": "2.0.0-nightly.20250901",
76
- "@aztec/foundation": "2.0.0-nightly.20250901",
77
- "@aztec/l1-artifacts": "2.0.0-nightly.20250901",
78
- "@aztec/noir-noirc_abi": "2.0.0-nightly.20250901",
72
+ "@aztec/bb.js": "2.0.0-nightly.20250903",
73
+ "@aztec/blob-lib": "2.0.0-nightly.20250903",
74
+ "@aztec/constants": "2.0.0-nightly.20250903",
75
+ "@aztec/ethereum": "2.0.0-nightly.20250903",
76
+ "@aztec/foundation": "2.0.0-nightly.20250903",
77
+ "@aztec/l1-artifacts": "2.0.0-nightly.20250903",
78
+ "@aztec/noir-noirc_abi": "2.0.0-nightly.20250903",
79
79
  "@google-cloud/storage": "^7.15.0",
80
80
  "axios": "^1.9.0",
81
81
  "json-stringify-deterministic": "1.0.12",
@@ -14,6 +14,7 @@ export interface SlasherConfig {
14
14
  slashValidatorsNever: EthAddress[]; // Array of validator addresses
15
15
  slashInactivityTargetPercentage: number; // 0-1, 0.9 means 90%. Must be greater than 0
16
16
  slashPrunePenalty: bigint;
17
+ slashDataWithholdingPenalty: bigint;
17
18
  slashInactivityPenalty: bigint;
18
19
  slashBroadcastedInvalidBlockPenalty: bigint;
19
20
  slashProposeInvalidAttestationsPenalty: bigint;
@@ -31,6 +32,7 @@ export const SlasherConfigSchema = z.object({
31
32
  slashValidatorsAlways: z.array(schemas.EthAddress),
32
33
  slashValidatorsNever: z.array(schemas.EthAddress),
33
34
  slashPrunePenalty: schemas.BigInt,
35
+ slashDataWithholdingPenalty: schemas.BigInt,
34
36
  slashInactivityTargetPercentage: z.number(),
35
37
  slashInactivityPenalty: schemas.BigInt,
36
38
  slashProposeInvalidAttestationsPenalty: schemas.BigInt,
@@ -48,6 +48,7 @@ export function getPenaltyForOffense(
48
48
  | 'slashAttestDescendantOfInvalidPenalty'
49
49
  | 'slashBroadcastedInvalidBlockPenalty'
50
50
  | 'slashPrunePenalty'
51
+ | 'slashDataWithholdingPenalty'
51
52
  | 'slashUnknownPenalty'
52
53
  | 'slashInactivityPenalty'
53
54
  | 'slashProposeInvalidAttestationsPenalty'
@@ -55,8 +56,9 @@ export function getPenaltyForOffense(
55
56
  ) {
56
57
  switch (offense) {
57
58
  case OffenseType.VALID_EPOCH_PRUNED:
58
- case OffenseType.DATA_WITHHOLDING:
59
59
  return config.slashPrunePenalty;
60
+ case OffenseType.DATA_WITHHOLDING:
61
+ return config.slashDataWithholdingPenalty;
60
62
  case OffenseType.INACTIVITY:
61
63
  return config.slashInactivityPenalty;
62
64
  case OffenseType.PROPOSED_INSUFFICIENT_ATTESTATIONS:
@@ -69,8 +71,8 @@ export function getPenaltyForOffense(
69
71
  case OffenseType.UNKNOWN:
70
72
  return config.slashUnknownPenalty;
71
73
  default: {
72
- const _: never = offense;
73
- throw new Error(`Unknown offense type: ${offense}`);
74
+ const _exhaustiveCheck: never = offense;
75
+ throw new Error(`Unknown offense type: ${_exhaustiveCheck}`);
74
76
  }
75
77
  }
76
78
  }
@@ -89,8 +91,8 @@ export function getTimeUnitForOffense(offense: OffenseType): 'epoch' | 'slot' {
89
91
  case OffenseType.VALID_EPOCH_PRUNED:
90
92
  return 'epoch';
91
93
  default: {
92
- const _: never = offense;
93
- throw new Error(`Unknown offense type: ${offense}`);
94
+ const _exhaustiveCheck: never = offense;
95
+ throw new Error(`Unknown offense type: ${_exhaustiveCheck}`);
94
96
  }
95
97
  }
96
98
  }
@@ -104,12 +106,23 @@ export function getSlotForOffense(
104
106
  return getTimeUnitForOffense(offenseType) === 'epoch' ? epochOrSlot * BigInt(constants.epochDuration) : epochOrSlot;
105
107
  }
106
108
 
107
- /** Returns the epoch for a given offense. */
109
+ /** Returns the epoch for a given offense. If the offense type or epoch is not defined, returns undefined. */
108
110
  export function getEpochForOffense(
109
111
  offense: Pick<Offense, 'epochOrSlot' | 'offenseType'>,
110
112
  constants: Pick<L1RollupConstants, 'epochDuration'>,
111
- ): bigint {
113
+ ): bigint;
114
+ export function getEpochForOffense(
115
+ offense: Partial<Pick<Offense, 'epochOrSlot' | 'offenseType'>>,
116
+ constants: Pick<L1RollupConstants, 'epochDuration'>,
117
+ ): bigint | undefined;
118
+ export function getEpochForOffense(
119
+ offense: Partial<Pick<Offense, 'epochOrSlot' | 'offenseType'>>,
120
+ constants: Pick<L1RollupConstants, 'epochDuration'>,
121
+ ): bigint | undefined {
112
122
  const { epochOrSlot, offenseType } = offense;
123
+ if (epochOrSlot === undefined || offenseType === undefined) {
124
+ return undefined;
125
+ }
113
126
  return getTimeUnitForOffense(offenseType) === 'epoch' ? epochOrSlot : epochOrSlot / BigInt(constants.epochDuration);
114
127
  }
115
128
 
@@ -1,43 +1,52 @@
1
1
  import { sumBigint } from '@aztec/foundation/bigint';
2
2
  import { EthAddress } from '@aztec/foundation/eth-address';
3
+ import type { PartialBy } from '@aztec/foundation/types';
3
4
 
5
+ import { getEpochForOffense } from './helpers.js';
4
6
  import type { Offense, ValidatorSlashVote } from './types.js';
5
7
 
6
8
  /**
7
9
  * Creates a consensus-slash vote for a given set of committees based on a set of Offenses
8
10
  * @param offenses - Array of offenses to consider
9
11
  * @param committees - Array of committees (each containing array of validator addresses)
12
+ * @param epochsForCommittees - Array of epochs corresponding to each committee
10
13
  * @param settings - Settings including slashingAmounts and optional validator override lists
11
14
  * @returns Array of ValidatorSlashVote, where each vote is how many slash units the validator in that position should be slashed
12
15
  */
13
16
  export function getSlashConsensusVotesFromOffenses(
14
- offenses: Pick<Offense, 'validator' | 'amount'>[],
17
+ offenses: PartialBy<Offense, 'epochOrSlot'>[],
15
18
  committees: EthAddress[][],
19
+ epochsForCommittees: bigint[],
16
20
  settings: {
17
21
  slashingAmounts: [bigint, bigint, bigint];
22
+ epochDuration: number;
18
23
  },
19
24
  ): ValidatorSlashVote[] {
20
25
  const { slashingAmounts } = settings;
21
26
 
22
- const slashedSet: Set<string> = new Set();
27
+ if (committees.length !== epochsForCommittees.length) {
28
+ throw new Error('committees and epochsForCommittees must have the same length');
29
+ }
23
30
 
24
- const votes = committees.flatMap(committee =>
25
- committee.map(validator => {
26
- const validatorStr = validator.toString();
31
+ const votes = committees.flatMap((committee, committeeIndex) => {
32
+ const committeeEpoch = epochsForCommittees[committeeIndex];
27
33
 
28
- // If already voted for slashing this validator, skip
29
- if (slashedSet.has(validatorStr)) {
30
- return 0;
31
- }
34
+ return committee.map(validator => {
35
+ // Find offenses for this validator in this specific epoch.
36
+ // If an offense has no epoch, it is considered for all epochs due to a slashAlways setting.
37
+ const validatorOffenses = offenses.filter(
38
+ o =>
39
+ o.validator.equals(validator) &&
40
+ (o.epochOrSlot === undefined || getEpochForOffense(o, settings) === committeeEpoch),
41
+ );
32
42
 
33
- // Normal offense-based slashing logic
34
- const validatorOffenses = offenses.filter(o => o.validator.equals(validator));
43
+ // Sum up the penalties for this validator in this epoch
35
44
  const slashAmount = sumBigint(validatorOffenses.map(o => o.amount));
36
45
  const slashUnits = getSlashUnitsForAmount(slashAmount, slashingAmounts);
37
- slashedSet.add(validatorStr);
38
46
  return Number(slashUnits);
39
- }),
40
- );
47
+ });
48
+ });
49
+
41
50
  return votes;
42
51
  }
43
52