Skip to content

Commit 48be067

Browse files
authored
fix(spartan-bench): tolerate older node images in SlasherConfig schema (#23351)
## Summary Fixes `block_capacity.test.ts` (nightly spartan bench) failing against a stale nightly Aztec image. The nightly-spartan-bench workflow checks out test code from `merge-train/spartan` but runs against the prebuilt nightly Aztec docker image, which is built from `next`. `merge-train/spartan` introduced two new required fields on `SlasherConfigSchema`: - `slashDataWithholdingToleranceSlots: z.number()` (PR #23116) - `slashBroadcastedInvalidCheckpointProposalPenalty: schemas.BigInt` The nightly image (built from `next`, which does not yet have these PRs) does not include these fields in its config response. As a result the very first call in the test — `updateSequencersConfig(config, { minTxsPerBlock: 0 })` → `client.getConfig()` — fails Zod validation, every subbench dies on `accountAddresses[0] === undefined` in `beforeAll`, and `block_capacity.test.ts` reports 8/8 failures (see <http://ci.aztec-labs.com/2679b1738ea39752>). ## Fix Make the two new fields tolerate undefined in the response schema by giving them sensible defaults (`3` and `0n`, matching `spartan/environments/network-defaults.yml` and the slasher defaults). The TypeScript `SlasherConfig` interface stays strict (output type is unchanged); only the parse side becomes forgiving, matching the pattern used by the other recently-added schema fields in `configs.ts`, `p2p.ts`, and `validator.ts`. `partial()` (used by `setConfig`) wraps each field with `.optional()` on the outside, which bypasses `.default()` — so partial updates that omit these fields will continue to omit them server-side rather than accidentally clobbering existing values to the defaults. ## Test plan - nightly-spartan-bench → block-capacity-benchmark passes against the stale-image scenario - existing `aztec-node-admin.test.ts` getConfig test continues to pass (fields are present in the mock) --- *Created by [claudebox](https://claudebox.work/v2/sessions/5cbfb8fe5a58619c) · group: `slackbot`*
1 parent 553a8e0 commit 48be067

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

yarn-project/stdlib/src/interfaces/slasher.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ export const SlasherConfigSchema = zodFor<SlasherConfig>()(
3838
slashValidatorsAlways: z.array(schemas.EthAddress),
3939
slashValidatorsNever: z.array(schemas.EthAddress),
4040
slashDataWithholdingPenalty: schemas.BigInt,
41-
slashDataWithholdingToleranceSlots: z.number(),
41+
// Tolerated as undefined to allow validating responses from older node images that
42+
// predate the per-slot data-withholding watcher (PR #23116).
43+
slashDataWithholdingToleranceSlots: z.number().default(3),
4244
slashInactivityTargetPercentage: z.number(),
4345
slashInactivityConsecutiveEpochThreshold: z.number(),
4446
slashInactivityPenalty: schemas.BigInt,
4547
slashProposeInvalidAttestationsPenalty: schemas.BigInt,
46-
slashBroadcastedInvalidCheckpointProposalPenalty: schemas.BigInt,
48+
// Tolerated as undefined to allow validating responses from older node images that
49+
// predate this slasher penalty being added.
50+
slashBroadcastedInvalidCheckpointProposalPenalty: schemas.BigInt.default(0n),
4751
slashDuplicateProposalPenalty: schemas.BigInt,
4852
slashDuplicateAttestationPenalty: schemas.BigInt,
4953
slashAttestDescendantOfInvalidPenalty: schemas.BigInt,

0 commit comments

Comments
 (0)