@aztec/aztec-node 5.0.0-private.20260319 → 5.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dest/aztec-node/block_response_helpers.d.ts +25 -0
  2. package/dest/aztec-node/block_response_helpers.d.ts.map +1 -0
  3. package/dest/aztec-node/block_response_helpers.js +112 -0
  4. package/dest/aztec-node/config.d.ts +14 -4
  5. package/dest/aztec-node/config.d.ts.map +1 -1
  6. package/dest/aztec-node/config.js +10 -5
  7. package/dest/aztec-node/public_data_overrides.d.ts +13 -0
  8. package/dest/aztec-node/public_data_overrides.d.ts.map +1 -0
  9. package/dest/aztec-node/public_data_overrides.js +21 -0
  10. package/dest/aztec-node/register_node_rpc_handlers.d.ts +10 -0
  11. package/dest/aztec-node/register_node_rpc_handlers.d.ts.map +1 -0
  12. package/dest/aztec-node/register_node_rpc_handlers.js +31 -0
  13. package/dest/aztec-node/server.d.ts +91 -100
  14. package/dest/aztec-node/server.d.ts.map +1 -1
  15. package/dest/aztec-node/server.js +1073 -492
  16. package/dest/bin/index.js +14 -9
  17. package/dest/index.d.ts +2 -1
  18. package/dest/index.d.ts.map +1 -1
  19. package/dest/index.js +1 -0
  20. package/dest/sentinel/config.d.ts +3 -2
  21. package/dest/sentinel/config.d.ts.map +1 -1
  22. package/dest/sentinel/config.js +15 -5
  23. package/dest/sentinel/factory.d.ts +4 -2
  24. package/dest/sentinel/factory.d.ts.map +1 -1
  25. package/dest/sentinel/factory.js +4 -4
  26. package/dest/sentinel/sentinel.d.ts +133 -9
  27. package/dest/sentinel/sentinel.d.ts.map +1 -1
  28. package/dest/sentinel/sentinel.js +212 -70
  29. package/dest/sentinel/store.d.ts +8 -8
  30. package/dest/sentinel/store.d.ts.map +1 -1
  31. package/dest/sentinel/store.js +25 -17
  32. package/dest/test/index.d.ts +3 -3
  33. package/dest/test/index.d.ts.map +1 -1
  34. package/package.json +27 -26
  35. package/src/aztec-node/block_response_helpers.ts +161 -0
  36. package/src/aztec-node/config.ts +23 -7
  37. package/src/aztec-node/public_data_overrides.ts +35 -0
  38. package/src/aztec-node/register_node_rpc_handlers.ts +29 -0
  39. package/src/aztec-node/server.ts +1190 -625
  40. package/src/bin/index.ts +13 -11
  41. package/src/index.ts +1 -0
  42. package/src/sentinel/README.md +103 -0
  43. package/src/sentinel/config.ts +18 -6
  44. package/src/sentinel/factory.ts +7 -4
  45. package/src/sentinel/sentinel.ts +267 -82
  46. package/src/sentinel/store.ts +26 -18
  47. package/src/test/index.ts +2 -2
@@ -9,45 +9,45 @@ import type {
9
9
  } from '@aztec/stdlib/validators';
10
10
 
11
11
  export class SentinelStore {
12
- public static readonly SCHEMA_VERSION = 3;
12
+ public static readonly SCHEMA_VERSION = 4;
13
13
 
14
14
  // a map from validator address to their ValidatorStatusHistory
15
15
  private readonly historyMap: AztecAsyncMap<`0x${string}`, Buffer>;
16
16
 
17
- // a map from validator address to their historical proven epoch performance
17
+ // a map from validator address to their historical epoch performance, evaluated at end-of-epoch.
18
18
  // e.g. { validator: [{ epoch: 1, missed: 1, total: 10 }, { epoch: 2, missed: 3, total: 7 }, ...] }
19
- private readonly provenMap: AztecAsyncMap<`0x${string}`, Buffer>;
19
+ private readonly epochMap: AztecAsyncMap<`0x${string}`, Buffer>;
20
20
 
21
21
  constructor(
22
22
  private store: AztecAsyncKVStore,
23
- private config: { historyLength: number; historicProvenPerformanceLength: number },
23
+ private config: { historyLength: number; historicEpochPerformanceLength: number },
24
24
  ) {
25
25
  this.historyMap = store.openMap('sentinel-validator-status');
26
- this.provenMap = store.openMap('sentinel-validator-proven');
26
+ this.epochMap = store.openMap('sentinel-validator-epoch');
27
27
  }
28
28
 
29
29
  public getHistoryLength() {
30
30
  return this.config.historyLength;
31
31
  }
32
32
 
33
- public getHistoricProvenPerformanceLength() {
34
- return this.config.historicProvenPerformanceLength;
33
+ public getHistoricEpochPerformanceLength() {
34
+ return this.config.historicEpochPerformanceLength;
35
35
  }
36
36
 
37
- public async updateProvenPerformance(epoch: EpochNumber, performance: ValidatorsEpochPerformance) {
37
+ public async updateEpochPerformance(epoch: EpochNumber, performance: ValidatorsEpochPerformance) {
38
38
  await this.store.transactionAsync(async () => {
39
39
  for (const [who, { missed, total }] of Object.entries(performance)) {
40
- await this.pushValidatorProvenPerformanceForEpoch({ who: EthAddress.fromString(who), missed, total, epoch });
40
+ await this.pushValidatorEpochPerformance({ who: EthAddress.fromString(who), missed, total, epoch });
41
41
  }
42
42
  });
43
43
  }
44
44
 
45
- public async getProvenPerformance(who: EthAddress): Promise<{ missed: number; total: number; epoch: EpochNumber }[]> {
46
- const currentPerformanceBuffer = await this.provenMap.getAsync(who.toString());
45
+ public async getEpochPerformance(who: EthAddress): Promise<{ missed: number; total: number; epoch: EpochNumber }[]> {
46
+ const currentPerformanceBuffer = await this.epochMap.getAsync(who.toString());
47
47
  return currentPerformanceBuffer ? this.deserializePerformance(currentPerformanceBuffer) : [];
48
48
  }
49
49
 
50
- private async pushValidatorProvenPerformanceForEpoch({
50
+ private async pushValidatorEpochPerformance({
51
51
  who,
52
52
  missed,
53
53
  total,
@@ -58,7 +58,7 @@ export class SentinelStore {
58
58
  total: number;
59
59
  epoch: EpochNumber;
60
60
  }) {
61
- const currentPerformance = await this.getProvenPerformance(who);
61
+ const currentPerformance = await this.getEpochPerformance(who);
62
62
  const existingIndex = currentPerformance.findIndex(p => p.epoch === epoch);
63
63
  if (existingIndex !== -1) {
64
64
  currentPerformance[existingIndex] = { missed, total, epoch };
@@ -70,10 +70,10 @@ export class SentinelStore {
70
70
  // Since we keep the size small, this is not a big deal.
71
71
  currentPerformance.sort((a, b) => Number(a.epoch - b.epoch));
72
72
 
73
- // keep the most recent `historicProvenPerformanceLength` entries.
74
- const performanceToKeep = currentPerformance.slice(-this.config.historicProvenPerformanceLength);
73
+ // keep the most recent `historicEpochPerformanceLength` entries.
74
+ const performanceToKeep = currentPerformance.slice(-this.config.historicEpochPerformanceLength);
75
75
 
76
- await this.provenMap.set(who.toString(), this.serializePerformance(performanceToKeep));
76
+ await this.epochMap.set(who.toString(), this.serializePerformance(performanceToKeep));
77
77
  }
78
78
 
79
79
  public async updateValidators(slot: SlotNumber, statuses: Record<`0x${string}`, ValidatorStatusInSlot | undefined>) {
@@ -147,7 +147,7 @@ export class SentinelStore {
147
147
  switch (status) {
148
148
  case 'checkpoint-mined':
149
149
  return 1;
150
- case 'checkpoint-proposed':
150
+ case 'checkpoint-valid':
151
151
  return 2;
152
152
  case 'checkpoint-missed':
153
153
  return 3;
@@ -157,6 +157,10 @@ export class SentinelStore {
157
157
  return 5;
158
158
  case 'blocks-missed':
159
159
  return 6;
160
+ case 'checkpoint-invalid':
161
+ return 7;
162
+ case 'checkpoint-unvalidated':
163
+ return 8;
160
164
  default: {
161
165
  const _exhaustive: never = status;
162
166
  throw new Error(`Unknown status: ${status}`);
@@ -169,7 +173,7 @@ export class SentinelStore {
169
173
  case 1:
170
174
  return 'checkpoint-mined';
171
175
  case 2:
172
- return 'checkpoint-proposed';
176
+ return 'checkpoint-valid';
173
177
  case 3:
174
178
  return 'checkpoint-missed';
175
179
  case 4:
@@ -178,6 +182,10 @@ export class SentinelStore {
178
182
  return 'attestation-missed';
179
183
  case 6:
180
184
  return 'blocks-missed';
185
+ case 7:
186
+ return 'checkpoint-invalid';
187
+ case 8:
188
+ return 'checkpoint-unvalidated';
181
189
  default:
182
190
  throw new Error(`Unknown status: ${status}`);
183
191
  }
package/src/test/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { EpochCacheInterface } from '@aztec/epoch-cache';
2
2
  import type { P2P } from '@aztec/p2p';
3
3
  import { SequencerClient } from '@aztec/sequencer-client';
4
- import { EpochPruneWatcher, type SlasherClientInterface } from '@aztec/slasher';
4
+ import { DataWithholdingWatcher, type SlasherClientInterface } from '@aztec/slasher';
5
5
  import type { L2BlockSource } from '@aztec/stdlib/block';
6
6
  import type { ContractDataSource } from '@aztec/stdlib/contract';
7
7
  import type { L2LogsSource, Service, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
@@ -23,7 +23,7 @@ export declare class TestAztecNodeService extends AztecNodeService {
23
23
  declare public sequencer: SequencerClient | undefined;
24
24
  declare public slasherClient: SlasherClientInterface | undefined;
25
25
  declare public validatorsSentinel: Sentinel | undefined;
26
- declare public epochPruneWatcher: EpochPruneWatcher | undefined;
26
+ declare public dataWithholdingWatcher: DataWithholdingWatcher | undefined;
27
27
  declare public l1ChainId: number;
28
28
  declare public version: number;
29
29
  declare public globalVariableBuilder: GlobalVariableBuilderInterface;