@aztec/aztec-node 0.0.1-commit.b655e406 → 0.0.1-commit.d1f2d6c

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.
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
2
  export {};
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iaW4vaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
package/dest/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './aztec-node/config.js';
2
2
  export * from './aztec-node/server.js';
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHdCQUF3QixDQUFDO0FBQ3ZDLGNBQWMsd0JBQXdCLENBQUMifQ==
@@ -5,4 +5,4 @@ export type SentinelConfig = {
5
5
  sentinelEnabled: boolean;
6
6
  };
7
7
  export declare const sentinelConfigMappings: ConfigMappingsType<SentinelConfig>;
8
- //# sourceMappingURL=config.d.ts.map
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2VudGluZWwvY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUEyQyxNQUFNLDBCQUEwQixDQUFDO0FBRTVHLE1BQU0sTUFBTSxjQUFjLEdBQUc7SUFDM0IsNkJBQTZCLEVBQUUsTUFBTSxDQUFDO0lBQ3RDLCtDQUErQyxFQUFFLE1BQU0sQ0FBQztJQUN4RCxlQUFlLEVBQUUsT0FBTyxDQUFDO0NBQzFCLENBQUM7QUFFRixlQUFPLE1BQU0sc0JBQXNCLEVBQUUsa0JBQWtCLENBQUMsY0FBYyxDQTRCckUsQ0FBQyJ9
@@ -6,4 +6,4 @@ import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
6
6
  import type { SentinelConfig } from './config.js';
7
7
  import { Sentinel } from './sentinel.js';
8
8
  export declare function createSentinel(epochCache: EpochCache, archiver: L2BlockSource, p2p: P2PClient, config: SentinelConfig & DataStoreConfig & SlasherConfig, logger?: import("@aztec/foundation/log").Logger): Promise<Sentinel | undefined>;
9
- //# sourceMappingURL=factory.d.ts.map
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlbnRpbmVsL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFckQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFOUQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBQzVDLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXJFLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNsRCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBR3pDLHdCQUFzQixjQUFjLENBQ2xDLFVBQVUsRUFBRSxVQUFVLEVBQ3RCLFFBQVEsRUFBRSxhQUFhLEVBQ3ZCLEdBQUcsRUFBRSxTQUFTLEVBQ2QsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLEdBQUcsYUFBYSxFQUN4RCxNQUFNLHlDQUFnQyxHQUNyQyxPQUFPLENBQUMsUUFBUSxHQUFHLFNBQVMsQ0FBQyxDQWlCL0IifQ==
@@ -1,3 +1,3 @@
1
1
  export { Sentinel } from './sentinel.js';
2
2
  export type { ValidatorsStats, ValidatorStats, ValidatorStatusHistory, ValidatorStatusInSlot, } from '@aztec/stdlib/validators';
3
- //# sourceMappingURL=index.d.ts.map
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZW50aW5lbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRXpDLFlBQVksRUFDVixlQUFlLEVBQ2YsY0FBYyxFQUNkLHNCQUFzQixFQUN0QixxQkFBcUIsR0FDdEIsTUFBTSwwQkFBMEIsQ0FBQyJ9
@@ -1,4 +1,5 @@
1
1
  import type { EpochCache } from '@aztec/epoch-cache';
2
+ import { CheckpointNumber, EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
2
3
  import { EthAddress } from '@aztec/foundation/eth-address';
3
4
  import { RunningPromise } from '@aztec/foundation/running-promise';
4
5
  import { type L2TipsStore } from '@aztec/kv-store/stores';
@@ -19,10 +20,10 @@ export declare class Sentinel extends Sentinel_base implements L2BlockStreamEven
19
20
  protected runningPromise: RunningPromise;
20
21
  protected blockStream: L2BlockStream;
21
22
  protected l2TipsStore: L2TipsStore;
22
- protected initialSlot: bigint | undefined;
23
- protected lastProcessedSlot: bigint | undefined;
24
- protected slotNumberToBlock: Map<bigint, {
25
- blockNumber: number;
23
+ protected initialSlot: SlotNumber | undefined;
24
+ protected lastProcessedSlot: SlotNumber | undefined;
25
+ protected slotNumberToCheckpoint: Map<SlotNumber, {
26
+ checkpointNumber: CheckpointNumber;
26
27
  archive: string;
27
28
  attestors: EthAddress[];
28
29
  }>;
@@ -33,16 +34,17 @@ export declare class Sentinel extends Sentinel_base implements L2BlockStreamEven
33
34
  protected init(): Promise<void>;
34
35
  stop(): Promise<void>;
35
36
  handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void>;
37
+ protected handleCheckpoint(event: L2BlockStreamEvent): void;
36
38
  protected handleChainProven(event: L2BlockStreamEvent): Promise<void>;
37
- protected computeProvenPerformance(epoch: bigint): Promise<ValidatorsEpochPerformance>;
39
+ protected computeProvenPerformance(epoch: EpochNumber): Promise<ValidatorsEpochPerformance>;
38
40
  /**
39
41
  * Checks if a validator has been inactive for the specified number of consecutive epochs for which we have data on it.
40
42
  * @param validator The validator address to check
41
43
  * @param currentEpoch Epochs strictly before the current one are evaluated only
42
44
  * @param requiredConsecutiveEpochs Number of consecutive epochs required for slashing
43
45
  */
44
- protected checkPastInactivity(validator: EthAddress, currentEpoch: bigint, requiredConsecutiveEpochs: number): Promise<boolean>;
45
- protected handleProvenPerformance(epoch: bigint, performance: ValidatorsEpochPerformance): Promise<void>;
46
+ protected checkPastInactivity(validator: EthAddress, currentEpoch: EpochNumber, requiredConsecutiveEpochs: number): Promise<boolean>;
47
+ protected handleProvenPerformance(epoch: EpochNumber, performance: ValidatorsEpochPerformance): Promise<void>;
46
48
  /**
47
49
  * Process data for two L2 slots ago.
48
50
  * Note that we do not process historical data, since we rely on p2p data for processing,
@@ -54,38 +56,38 @@ export declare class Sentinel extends Sentinel_base implements L2BlockStreamEven
54
56
  * We also don't move past the archiver last synced L2 slot, as we don't want to process data that is not yet available.
55
57
  * Last, we check the p2p is synced with the archiver, so it has pulled all attestations from it.
56
58
  */
57
- protected isReadyToProcess(currentSlot: bigint): Promise<bigint | false>;
59
+ protected isReadyToProcess(currentSlot: SlotNumber): Promise<SlotNumber | false>;
58
60
  /**
59
61
  * Gathers committee and proposer data for a given slot, computes slot stats,
60
62
  * and updates overall stats.
61
63
  */
62
- protected processSlot(slot: bigint): Promise<void>;
64
+ protected processSlot(slot: SlotNumber): Promise<void>;
63
65
  /** Computes activity for a given slot. */
64
- protected getSlotActivity(slot: bigint, epoch: bigint, proposer: EthAddress, committee: EthAddress[]): Promise<{
66
+ protected getSlotActivity(slot: SlotNumber, epoch: EpochNumber, proposer: EthAddress, committee: EthAddress[]): Promise<{
65
67
  [k: string]: ValidatorStatusInSlot | undefined;
66
68
  }>;
67
69
  /** Push the status for each slot for each validator. */
68
- protected updateValidators(slot: bigint, stats: Record<`0x${string}`, ValidatorStatusInSlot | undefined>): Promise<void>;
70
+ protected updateValidators(slot: SlotNumber, stats: Record<`0x${string}`, ValidatorStatusInSlot | undefined>): Promise<void>;
69
71
  /** Computes stats to be returned based on stored data. */
70
- computeStats({ fromSlot, toSlot, validators, }?: {
71
- fromSlot?: bigint;
72
- toSlot?: bigint;
72
+ computeStats({ fromSlot, toSlot, validators }?: {
73
+ fromSlot?: SlotNumber;
74
+ toSlot?: SlotNumber;
73
75
  validators?: EthAddress[];
74
76
  }): Promise<ValidatorsStats>;
75
77
  /** Computes stats for a single validator. */
76
- getValidatorStats(validatorAddress: EthAddress, fromSlot?: bigint, toSlot?: bigint): Promise<SingleValidatorStats | undefined>;
77
- protected computeStatsForValidator(address: `0x${string}`, allHistory: ValidatorStatusHistory, fromSlot?: bigint, toSlot?: bigint): ValidatorStats;
78
+ getValidatorStats(validatorAddress: EthAddress, fromSlot?: SlotNumber, toSlot?: SlotNumber): Promise<SingleValidatorStats | undefined>;
79
+ protected computeStatsForValidator(address: `0x${string}`, allHistory: ValidatorStatusHistory, fromSlot?: SlotNumber, toSlot?: SlotNumber): ValidatorStats;
78
80
  protected computeMissed(history: ValidatorStatusHistory, computeOverPrefix: ValidatorStatusType | undefined, filter: ValidatorStatusInSlot[]): {
79
81
  currentStreak: number;
80
82
  rate: number | undefined;
81
83
  count: number;
82
84
  total: number;
83
85
  };
84
- protected computeFromSlot(slot: bigint | undefined): {
86
+ protected computeFromSlot(slot: SlotNumber | undefined): {
85
87
  timestamp: bigint;
86
- slot: bigint;
88
+ slot: SlotNumber;
87
89
  date: string;
88
90
  } | undefined;
89
91
  }
90
92
  export {};
91
- //# sourceMappingURL=sentinel.d.ts.map
93
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VudGluZWwuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZW50aW5lbC9zZW50aW5lbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUNyRCxPQUFPLEVBQWUsZ0JBQWdCLEVBQUUsV0FBVyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXpHLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUUzRCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDbkUsT0FBTyxFQUFxQixLQUFLLFdBQVcsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzdFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUM1QyxPQUFPLEVBSUwsS0FBSyxPQUFPLEVBQ1osS0FBSyxjQUFjLEVBQ3BCLE1BQU0sZ0JBQWdCLENBQUM7QUFDeEIsT0FBTyxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sdUJBQ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AC,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAkC3C;IAED,SAAS,CAAC,wBAAwB,CAChC,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,UAAU,EAAE,sBAAsB,EAClC,QAAQ,CAAC,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,UAAU,GAClB,cAAc,CAchB;IAED,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,sBAAsB,EAC/B,iBAAiB,EAAE,mBAAmB,GAAG,SAAS,EAClD,MAAM,EAAE,qBAAqB,EAAE;;;;;MAUhC;IAED,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;;;;kBAMrD;CACF"}
@@ -1,10 +1,11 @@
1
+ import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import { countWhile, filterAsync, fromEntries, getEntries, mapValues } from '@aztec/foundation/collection';
2
3
  import { EthAddress } from '@aztec/foundation/eth-address';
3
4
  import { createLogger } from '@aztec/foundation/log';
4
5
  import { RunningPromise } from '@aztec/foundation/running-promise';
5
6
  import { L2TipsMemoryStore } from '@aztec/kv-store/stores';
6
7
  import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
7
- import { L2BlockStream, getAttestationInfoFromPublishedL2Block } from '@aztec/stdlib/block';
8
+ import { L2BlockStream, getAttestationInfoFromPublishedCheckpoint } from '@aztec/stdlib/block';
8
9
  import { getEpochAtSlot, getSlotRangeForEpoch, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
9
10
  import EventEmitter from 'node:events';
10
11
  export class Sentinel extends EventEmitter {
@@ -19,9 +20,10 @@ export class Sentinel extends EventEmitter {
19
20
  l2TipsStore;
20
21
  initialSlot;
21
22
  lastProcessedSlot;
22
- slotNumberToBlock;
23
+ // eslint-disable-next-line aztec-custom/no-non-primitive-in-collections
24
+ slotNumberToCheckpoint;
23
25
  constructor(epochCache, archiver, p2p, store, config, logger = createLogger('node:sentinel')){
24
- super(), this.epochCache = epochCache, this.archiver = archiver, this.p2p = p2p, this.store = store, this.config = config, this.logger = logger, this.slotNumberToBlock = new Map();
26
+ super(), this.epochCache = epochCache, this.archiver = archiver, this.p2p = p2p, this.store = store, this.config = config, this.logger = logger, this.slotNumberToCheckpoint = new Map();
25
27
  this.l2TipsStore = new L2TipsMemoryStore();
26
28
  const interval = epochCache.getL1Constants().ethereumSlotDuration * 1000 / 4;
27
29
  this.runningPromise = new RunningPromise(this.work.bind(this), logger, interval);
@@ -38,7 +40,7 @@ export class Sentinel extends EventEmitter {
38
40
  }
39
41
  /** Loads initial slot and initializes blockstream. We will not process anything at or before the initial slot. */ async init() {
40
42
  this.initialSlot = this.epochCache.getEpochAndSlotNow().slot;
41
- const startingBlock = await this.archiver.getBlockNumber();
43
+ const startingBlock = BlockNumber(await this.archiver.getBlockNumber());
42
44
  this.logger.info(`Starting validator sentinel with initial slot ${this.initialSlot} and block ${startingBlock}`);
43
45
  this.blockStream = new L2BlockStream(this.archiver, this.l2TipsStore, this, this.logger, {
44
46
  startingBlock
@@ -49,33 +51,38 @@ export class Sentinel extends EventEmitter {
49
51
  }
50
52
  async handleBlockStreamEvent(event) {
51
53
  await this.l2TipsStore.handleBlockStreamEvent(event);
52
- if (event.type === 'blocks-added') {
53
- // Store mapping from slot to archive, block number, and attestors
54
- for (const block of event.blocks){
55
- this.slotNumberToBlock.set(block.block.header.getSlot(), {
56
- blockNumber: block.block.number,
57
- archive: block.block.archive.root.toString(),
58
- attestors: getAttestationInfoFromPublishedL2Block(block).filter((a)=>a.status === 'recovered-from-signature').map((a)=>a.address)
59
- });
60
- }
61
- // Prune the archive map to only keep at most N entries
62
- const historyLength = this.store.getHistoryLength();
63
- if (this.slotNumberToBlock.size > historyLength) {
64
- const toDelete = Array.from(this.slotNumberToBlock.keys()).sort((a, b)=>Number(a - b)).slice(0, this.slotNumberToBlock.size - historyLength);
65
- for (const key of toDelete){
66
- this.slotNumberToBlock.delete(key);
67
- }
68
- }
54
+ if (event.type === 'chain-checkpointed') {
55
+ this.handleCheckpoint(event);
69
56
  } else if (event.type === 'chain-proven') {
70
57
  await this.handleChainProven(event);
71
58
  }
72
59
  }
60
+ handleCheckpoint(event) {
61
+ if (event.type !== 'chain-checkpointed') {
62
+ return;
63
+ }
64
+ const checkpoint = event.checkpoint;
65
+ // Store mapping from slot to archive, checkpoint number, and attestors
66
+ this.slotNumberToCheckpoint.set(checkpoint.checkpoint.header.slotNumber, {
67
+ checkpointNumber: checkpoint.checkpoint.number,
68
+ archive: checkpoint.checkpoint.archive.root.toString(),
69
+ attestors: getAttestationInfoFromPublishedCheckpoint(checkpoint).filter((a)=>a.status === 'recovered-from-signature').map((a)=>a.address)
70
+ });
71
+ // Prune the archive map to only keep at most N entries
72
+ const historyLength = this.store.getHistoryLength();
73
+ if (this.slotNumberToCheckpoint.size > historyLength) {
74
+ const toDelete = Array.from(this.slotNumberToCheckpoint.keys()).sort((a, b)=>Number(a - b)).slice(0, this.slotNumberToCheckpoint.size - historyLength);
75
+ for (const key of toDelete){
76
+ this.slotNumberToCheckpoint.delete(key);
77
+ }
78
+ }
79
+ }
73
80
  async handleChainProven(event) {
74
81
  if (event.type !== 'chain-proven') {
75
82
  return;
76
83
  }
77
84
  const blockNumber = event.block.number;
78
- const block = await this.archiver.getBlock(blockNumber);
85
+ const block = await this.archiver.getL2Block(blockNumber);
79
86
  if (!block) {
80
87
  this.logger.error(`Failed to get block ${blockNumber}`, {
81
88
  block
@@ -131,13 +138,15 @@ export class Sentinel extends EventEmitter {
131
138
  }
132
139
  // Get all historical performance for this validator
133
140
  const allPerformance = await this.store.getProvenPerformance(validator);
141
+ // Sort by epoch descending to get most recent first, keep only epochs strictly before the current one, and get the first N
142
+ const pastEpochs = allPerformance.sort((a, b)=>Number(b.epoch - a.epoch)).filter((p)=>p.epoch < currentEpoch);
134
143
  // If we don't have enough historical data, don't slash
135
- if (allPerformance.length < requiredConsecutiveEpochs) {
144
+ if (pastEpochs.length < requiredConsecutiveEpochs) {
136
145
  this.logger.debug(`Not enough historical data for slashing ${validator} for inactivity (${allPerformance.length} epochs < ${requiredConsecutiveEpochs} required)`);
137
146
  return false;
138
147
  }
139
- // Sort by epoch descending to get most recent first, keep only epochs strictly before the current one, and get the first N
140
- return allPerformance.sort((a, b)=>Number(b.epoch - a.epoch)).filter((p)=>p.epoch < currentEpoch).slice(0, requiredConsecutiveEpochs).every((p)=>p.missed / p.total >= this.config.slashInactivityTargetPercentage);
148
+ // Check that we have at least requiredConsecutiveEpochs and that all of them are above the inactivity threshold
149
+ return pastEpochs.slice(0, requiredConsecutiveEpochs).every((p)=>p.missed / p.total >= this.config.slashInactivityTargetPercentage);
141
150
  }
142
151
  async handleProvenPerformance(epoch, performance) {
143
152
  if (this.config.slashInactivityPenalty === 0n) {
@@ -155,7 +164,7 @@ export class Sentinel extends EventEmitter {
155
164
  validator: EthAddress.fromString(address),
156
165
  amount: this.config.slashInactivityPenalty,
157
166
  offenseType: OffenseType.INACTIVITY,
158
- epochOrSlot: epoch
167
+ epochOrSlot: BigInt(epoch)
159
168
  }));
160
169
  if (criminals.length > 0) {
161
170
  this.logger.verbose(`Identified ${criminals.length} validators to slash due to inactivity in at least ${epochThreshold} consecutive epochs`, {
@@ -190,7 +199,11 @@ export class Sentinel extends EventEmitter {
190
199
  * We also don't move past the archiver last synced L2 slot, as we don't want to process data that is not yet available.
191
200
  * Last, we check the p2p is synced with the archiver, so it has pulled all attestations from it.
192
201
  */ async isReadyToProcess(currentSlot) {
193
- const targetSlot = currentSlot - 2n;
202
+ if (currentSlot < 2) {
203
+ this.logger.trace(`Current slot ${currentSlot} too early.`);
204
+ return false;
205
+ }
206
+ const targetSlot = SlotNumber(currentSlot - 2);
194
207
  if (this.lastProcessedSlot && this.lastProcessedSlot >= targetSlot) {
195
208
  this.logger.trace(`Already processed slot ${targetSlot}`, {
196
209
  lastProcessedSlot: this.lastProcessedSlot
@@ -213,8 +226,8 @@ export class Sentinel extends EventEmitter {
213
226
  });
214
227
  return false;
215
228
  }
216
- const archiverLastBlockHash = await this.l2TipsStore.getL2Tips().then((tip)=>tip.latest.hash);
217
- const p2pLastBlockHash = await this.p2p.getL2Tips().then((tips)=>tips.latest.hash);
229
+ const archiverLastBlockHash = await this.l2TipsStore.getL2Tips().then((tip)=>tip.proposed.hash);
230
+ const p2pLastBlockHash = await this.p2p.getL2Tips().then((tips)=>tips.proposed.hash);
218
231
  const isP2pSynced = archiverLastBlockHash === p2pLastBlockHash;
219
232
  if (!isP2pSynced) {
220
233
  this.logger.debug(`Waiting for P2P client to sync with archiver`, {
@@ -254,8 +267,8 @@ export class Sentinel extends EventEmitter {
254
267
  // or all attestations for all proposals in the slot if no block was mined.
255
268
  // We gather from both p2p (contains the ones seen on the p2p layer) and archiver
256
269
  // (contains the ones synced from mined blocks, which we may have missed from p2p).
257
- const block = this.slotNumberToBlock.get(slot);
258
- const p2pAttested = await this.p2p.getAttestationsForSlot(slot, block?.archive);
270
+ const block = this.slotNumberToCheckpoint.get(slot);
271
+ const p2pAttested = await this.p2p.getCheckpointAttestationsForSlot(slot, block?.archive);
259
272
  // Filter out attestations with invalid signatures
260
273
  const p2pAttestors = p2pAttested.map((a)=>a.getSender()).filter((s)=>s !== undefined);
261
274
  const attestors = new Set([
@@ -314,7 +327,7 @@ export class Sentinel extends EventEmitter {
314
327
  await this.store.getHistory(v)
315
328
  ]))) : await this.store.getHistories();
316
329
  const slotNow = this.epochCache.getEpochAndSlotNow().slot;
317
- fromSlot ??= (this.lastProcessedSlot ?? slotNow) - BigInt(this.store.getHistoryLength());
330
+ fromSlot ??= SlotNumber(Math.max((this.lastProcessedSlot ?? slotNow) - this.store.getHistoryLength(), 0));
318
331
  toSlot ??= this.lastProcessedSlot ?? slotNow;
319
332
  const stats = mapValues(histories, (history, address)=>this.computeStatsForValidator(address, history ?? [], fromSlot, toSlot));
320
333
  return {
@@ -330,25 +343,24 @@ export class Sentinel extends EventEmitter {
330
343
  return undefined;
331
344
  }
332
345
  const slotNow = this.epochCache.getEpochAndSlotNow().slot;
333
- const effectiveFromSlot = fromSlot ?? (this.lastProcessedSlot ?? slotNow) - BigInt(this.store.getHistoryLength());
346
+ const effectiveFromSlot = fromSlot ?? SlotNumber(Math.max((this.lastProcessedSlot ?? slotNow) - this.store.getHistoryLength(), 0));
334
347
  const effectiveToSlot = toSlot ?? this.lastProcessedSlot ?? slotNow;
335
348
  const historyLength = BigInt(this.store.getHistoryLength());
336
- if (effectiveToSlot - effectiveFromSlot > historyLength) {
337
- throw new Error(`Slot range (${effectiveToSlot - effectiveFromSlot}) exceeds history length (${historyLength}). ` + `Requested range: ${effectiveFromSlot} to ${effectiveToSlot}.`);
349
+ if (BigInt(effectiveToSlot) - BigInt(effectiveFromSlot) > historyLength) {
350
+ throw new Error(`Slot range (${BigInt(effectiveToSlot) - BigInt(effectiveFromSlot)}) exceeds history length (${historyLength}). ` + `Requested range: ${effectiveFromSlot} to ${effectiveToSlot}.`);
338
351
  }
339
352
  const validator = this.computeStatsForValidator(validatorAddress.toString(), history, effectiveFromSlot, effectiveToSlot);
340
- const allTimeProvenPerformance = await this.store.getProvenPerformance(validatorAddress);
341
353
  return {
342
354
  validator,
343
- allTimeProvenPerformance,
355
+ allTimeProvenPerformance: await this.store.getProvenPerformance(validatorAddress),
344
356
  lastProcessedSlot: this.lastProcessedSlot,
345
357
  initialSlot: this.initialSlot,
346
358
  slotWindow: this.store.getHistoryLength()
347
359
  };
348
360
  }
349
361
  computeStatsForValidator(address, allHistory, fromSlot, toSlot) {
350
- let history = fromSlot ? allHistory.filter((h)=>h.slot >= fromSlot) : allHistory;
351
- history = toSlot ? history.filter((h)=>h.slot <= toSlot) : history;
362
+ let history = fromSlot ? allHistory.filter((h)=>BigInt(h.slot) >= fromSlot) : allHistory;
363
+ history = toSlot ? history.filter((h)=>BigInt(h.slot) <= toSlot) : history;
352
364
  const lastProposal = history.filter((h)=>h.status === 'block-proposed' || h.status === 'block-mined').at(-1);
353
365
  const lastAttestation = history.filter((h)=>h.status === 'attestation-sent').at(-1);
354
366
  return {
@@ -1,3 +1,4 @@
1
+ import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import { EthAddress } from '@aztec/foundation/eth-address';
2
3
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
3
4
  import type { ValidatorStatusHistory, ValidatorStatusInSlot, ValidatorsEpochPerformance } from '@aztec/stdlib/validators';
@@ -13,14 +14,14 @@ export declare class SentinelStore {
13
14
  });
14
15
  getHistoryLength(): number;
15
16
  getHistoricProvenPerformanceLength(): number;
16
- updateProvenPerformance(epoch: bigint, performance: ValidatorsEpochPerformance): Promise<void>;
17
+ updateProvenPerformance(epoch: EpochNumber, performance: ValidatorsEpochPerformance): Promise<void>;
17
18
  getProvenPerformance(who: EthAddress): Promise<{
18
19
  missed: number;
19
20
  total: number;
20
- epoch: bigint;
21
+ epoch: EpochNumber;
21
22
  }[]>;
22
23
  private pushValidatorProvenPerformanceForEpoch;
23
- updateValidators(slot: bigint, statuses: Record<`0x${string}`, ValidatorStatusInSlot | undefined>): Promise<void>;
24
+ updateValidators(slot: SlotNumber, statuses: Record<`0x${string}`, ValidatorStatusInSlot | undefined>): Promise<void>;
24
25
  private pushValidatorStatusForSlot;
25
26
  getHistories(): Promise<Record<`0x${string}`, ValidatorStatusHistory>>;
26
27
  getHistory(address: EthAddress): Promise<ValidatorStatusHistory | undefined>;
@@ -31,4 +32,4 @@ export declare class SentinelStore {
31
32
  private statusToNumber;
32
33
  private statusFromNumber;
33
34
  }
34
- //# sourceMappingURL=store.d.ts.map
35
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZW50aW5lbC9zdG9yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0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ACxB,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,+BAA+B,EAAE,MAAM,CAAA;KAAE,EAInF;IAEM,gBAAgB,WAEtB;IAEM,kCAAkC,WAExC;IAEY,uBAAuB,CAAC,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,0BAA0B,iBAM/F;IAEY,oBAAoB,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC,CAGnH;YAEa,sCAAsC;IA6BvC,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,qBAAqB,GAAG,SAAS,CAAC,iBAQjH;YAEa,0BAA0B;IAY3B,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAMlF;IAEY,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAGxF;IAED,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,gBAAgB;CAgBzB"}
@@ -1,3 +1,4 @@
1
+ import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import { EthAddress } from '@aztec/foundation/eth-address';
2
3
  import { BufferReader, numToUInt8, numToUInt32BE, serializeToBuffer } from '@aztec/foundation/serialize';
3
4
  export class SentinelStore {
@@ -105,7 +106,7 @@ export class SentinelStore {
105
106
  const performance = [];
106
107
  while(!reader.isEmpty()){
107
108
  performance.push({
108
- epoch: BigInt(reader.readNumber()),
109
+ epoch: EpochNumber(reader.readNumber()),
109
110
  missed: reader.readNumber(),
110
111
  total: reader.readNumber()
111
112
  });
@@ -122,7 +123,7 @@ export class SentinelStore {
122
123
  const reader = new BufferReader(buffer);
123
124
  const history = [];
124
125
  while(!reader.isEmpty()){
125
- const slot = BigInt(reader.readNumber());
126
+ const slot = SlotNumber(reader.readNumber());
126
127
  const status = this.statusFromNumber(reader.readUInt8());
127
128
  history.push({
128
129
  slot,
@@ -28,4 +28,4 @@ export declare class TestAztecNodeService extends AztecNodeService {
28
28
  epochCache: EpochCacheInterface;
29
29
  packageVersion: string;
30
30
  }
31
- //# sourceMappingURL=index.d.ts.map
31
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDOUQsT0FBTyxLQUFLLEVBQUUsR0FBRyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBQ3RDLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMxRCxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsS0FBSyxzQkFBc0IsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2hGLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ3JHLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDb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
2
  "name": "@aztec/aztec-node",
3
- "version": "0.0.1-commit.b655e406",
3
+ "version": "0.0.1-commit.d1f2d6c",
4
4
  "main": "dest/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,7 +9,6 @@
9
9
  "./sentinel": "./dest/aztec-node/sentinel.js",
10
10
  "./test": "./dest/test/index.js"
11
11
  },
12
- "bin": "./dest/bin/index.js",
13
12
  "typedocOptions": {
14
13
  "entryPoints": [
15
14
  "./src/index.ts"
@@ -20,8 +19,8 @@
20
19
  "scripts": {
21
20
  "start": "node --no-warnings ./dest/bin",
22
21
  "start:debug": "node --no-warnings --inspect ./dest/bin",
23
- "build": "yarn clean && tsc -b",
24
- "build:dev": "tsc -b --watch",
22
+ "build": "yarn clean && ../scripts/tsc.sh",
23
+ "build:dev": "../scripts/tsc.sh --watch",
25
24
  "clean": "rm -rf ./dest .tsbuildinfo",
26
25
  "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
27
26
  },
@@ -66,38 +65,40 @@
66
65
  ]
67
66
  },
68
67
  "dependencies": {
69
- "@aztec/archiver": "0.0.1-commit.b655e406",
70
- "@aztec/bb-prover": "0.0.1-commit.b655e406",
71
- "@aztec/blob-sink": "0.0.1-commit.b655e406",
72
- "@aztec/constants": "0.0.1-commit.b655e406",
73
- "@aztec/epoch-cache": "0.0.1-commit.b655e406",
74
- "@aztec/ethereum": "0.0.1-commit.b655e406",
75
- "@aztec/foundation": "0.0.1-commit.b655e406",
76
- "@aztec/kv-store": "0.0.1-commit.b655e406",
77
- "@aztec/l1-artifacts": "0.0.1-commit.b655e406",
78
- "@aztec/merkle-tree": "0.0.1-commit.b655e406",
79
- "@aztec/node-keystore": "0.0.1-commit.b655e406",
80
- "@aztec/node-lib": "0.0.1-commit.b655e406",
81
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b655e406",
82
- "@aztec/p2p": "0.0.1-commit.b655e406",
83
- "@aztec/protocol-contracts": "0.0.1-commit.b655e406",
84
- "@aztec/prover-client": "0.0.1-commit.b655e406",
85
- "@aztec/sequencer-client": "0.0.1-commit.b655e406",
86
- "@aztec/simulator": "0.0.1-commit.b655e406",
87
- "@aztec/slasher": "0.0.1-commit.b655e406",
88
- "@aztec/stdlib": "0.0.1-commit.b655e406",
89
- "@aztec/telemetry-client": "0.0.1-commit.b655e406",
90
- "@aztec/validator-client": "0.0.1-commit.b655e406",
91
- "@aztec/world-state": "0.0.1-commit.b655e406",
68
+ "@aztec/archiver": "0.0.1-commit.d1f2d6c",
69
+ "@aztec/bb-prover": "0.0.1-commit.d1f2d6c",
70
+ "@aztec/blob-client": "0.0.1-commit.d1f2d6c",
71
+ "@aztec/constants": "0.0.1-commit.d1f2d6c",
72
+ "@aztec/epoch-cache": "0.0.1-commit.d1f2d6c",
73
+ "@aztec/ethereum": "0.0.1-commit.d1f2d6c",
74
+ "@aztec/foundation": "0.0.1-commit.d1f2d6c",
75
+ "@aztec/kv-store": "0.0.1-commit.d1f2d6c",
76
+ "@aztec/l1-artifacts": "0.0.1-commit.d1f2d6c",
77
+ "@aztec/merkle-tree": "0.0.1-commit.d1f2d6c",
78
+ "@aztec/node-keystore": "0.0.1-commit.d1f2d6c",
79
+ "@aztec/node-lib": "0.0.1-commit.d1f2d6c",
80
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.d1f2d6c",
81
+ "@aztec/p2p": "0.0.1-commit.d1f2d6c",
82
+ "@aztec/protocol-contracts": "0.0.1-commit.d1f2d6c",
83
+ "@aztec/prover-client": "0.0.1-commit.d1f2d6c",
84
+ "@aztec/sequencer-client": "0.0.1-commit.d1f2d6c",
85
+ "@aztec/simulator": "0.0.1-commit.d1f2d6c",
86
+ "@aztec/slasher": "0.0.1-commit.d1f2d6c",
87
+ "@aztec/stdlib": "0.0.1-commit.d1f2d6c",
88
+ "@aztec/telemetry-client": "0.0.1-commit.d1f2d6c",
89
+ "@aztec/validator-client": "0.0.1-commit.d1f2d6c",
90
+ "@aztec/validator-ha-signer": "0.0.1-commit.d1f2d6c",
91
+ "@aztec/world-state": "0.0.1-commit.d1f2d6c",
92
92
  "koa": "^2.16.1",
93
93
  "koa-router": "^13.1.1",
94
94
  "tslib": "^2.4.0",
95
- "viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
95
+ "viem": "npm:@aztec/viem@2.38.2"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@jest/globals": "^30.0.0",
99
99
  "@types/jest": "^30.0.0",
100
100
  "@types/node": "^22.15.17",
101
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
101
102
  "jest": "^30.0.0",
102
103
  "jest-mock-extended": "^4.0.0",
103
104
  "ts-node": "^10.9.1",
@@ -1,10 +1,6 @@
1
1
  import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config';
2
- import {
3
- type GenesisStateConfig,
4
- type L1ContractAddresses,
5
- genesisStateConfigMappings,
6
- l1ContractAddressesMapping,
7
- } from '@aztec/ethereum';
2
+ import { type GenesisStateConfig, genesisStateConfigMappings } from '@aztec/ethereum/config';
3
+ import { type L1ContractAddresses, l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
8
4
  import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
9
5
  import { EthAddress } from '@aztec/foundation/eth-address';
10
6
  import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
@@ -57,6 +53,9 @@ export type AztecNodeConfig = ArchiverConfig &
57
53
  disableValidator: boolean;
58
54
  /** Whether to skip waiting for the archiver to be fully synced before starting other services */
59
55
  skipArchiverInitialSync: boolean;
56
+
57
+ /** A flag to force verification of tx Chonk proofs. Only used for testnet */
58
+ debugForceTxProofVerification: boolean;
60
59
  };
61
60
 
62
61
  export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
@@ -87,6 +86,11 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
87
86
  description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
88
87
  ...booleanConfigHelper(false),
89
88
  },
89
+ debugForceTxProofVerification: {
90
+ env: 'DEBUG_FORCE_TX_PROOF_VERIFICATION',
91
+ description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
92
+ ...booleanConfigHelper(false),
93
+ },
90
94
  };
91
95
 
92
96
  /**
@@ -132,7 +136,7 @@ function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore): Ke
132
136
  function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore): KeyStore | undefined {
133
137
  const validatorKeyStores: ValidatorKeyStore[] = [];
134
138
  const ethPrivateKeys = config.validatorPrivateKeys
135
- ? config.validatorPrivateKeys.getValue().map(x => ethPrivateKeySchema.parse(x))
139
+ ? config.validatorPrivateKeys.getValue().map((x: string) => ethPrivateKeySchema.parse(x))
136
140
  : [];
137
141
 
138
142
  if (!ethPrivateKeys.length) {
@@ -142,7 +146,7 @@ function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore): K
142
146
  const feeRecipient = config.feeRecipient ?? AztecAddress.ZERO;
143
147
 
144
148
  const publisherKeys = config.publisherPrivateKeys
145
- ? config.publisherPrivateKeys.map(k => ethPrivateKeySchema.parse(k.getValue()))
149
+ ? config.publisherPrivateKeys.map((k: { getValue: () => string }) => ethPrivateKeySchema.parse(k.getValue()))
146
150
  : [];
147
151
 
148
152
  validatorKeyStores.push({
@@ -1,11 +1,4 @@
1
- import {
2
- Attributes,
3
- type Histogram,
4
- Metrics,
5
- type TelemetryClient,
6
- type UpDownCounter,
7
- ValueType,
8
- } from '@aztec/telemetry-client';
1
+ import { Attributes, type Histogram, Metrics, type TelemetryClient, type UpDownCounter } from '@aztec/telemetry-client';
9
2
 
10
3
  export class NodeMetrics {
11
4
  private receiveTxCount: UpDownCounter;
@@ -16,23 +9,12 @@ export class NodeMetrics {
16
9
 
17
10
  constructor(client: TelemetryClient, name = 'AztecNode') {
18
11
  const meter = client.getMeter(name);
19
- this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT, {});
20
- this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION, {
21
- description: 'The duration of the receiveTx method',
22
- unit: 'ms',
23
- valueType: ValueType.INT,
24
- });
12
+ this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT);
13
+ this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION);
25
14
 
26
- this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION, {
27
- description: 'How long taking a snapshot takes',
28
- unit: 'ms',
29
- valueType: ValueType.INT,
30
- });
15
+ this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION);
31
16
 
32
- this.snapshotErrorCount = meter.createUpDownCounter(Metrics.NODE_SNAPSHOT_ERROR_COUNT, {
33
- description: 'How many snapshot errors have happened',
34
- valueType: ValueType.INT,
35
- });
17
+ this.snapshotErrorCount = meter.createUpDownCounter(Metrics.NODE_SNAPSHOT_ERROR_COUNT);
36
18
 
37
19
  this.snapshotErrorCount.add(0);
38
20
  }