@aztec/aztec-node 0.0.1-commit.42ee6df9b → 0.0.1-commit.431c48d

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 (75) 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 +16 -4
  5. package/dest/aztec-node/config.d.ts.map +1 -1
  6. package/dest/aztec-node/config.js +15 -5
  7. package/dest/aztec-node/node_public_calls_simulator.d.ts +90 -0
  8. package/dest/aztec-node/node_public_calls_simulator.d.ts.map +1 -0
  9. package/dest/aztec-node/node_public_calls_simulator.js +346 -0
  10. package/dest/aztec-node/public_data_overrides.d.ts +13 -0
  11. package/dest/aztec-node/public_data_overrides.d.ts.map +1 -0
  12. package/dest/aztec-node/public_data_overrides.js +21 -0
  13. package/dest/aztec-node/register_node_rpc_handlers.d.ts +11 -0
  14. package/dest/aztec-node/register_node_rpc_handlers.d.ts.map +1 -0
  15. package/dest/aztec-node/register_node_rpc_handlers.js +48 -0
  16. package/dest/aztec-node/server.d.ts +126 -133
  17. package/dest/aztec-node/server.d.ts.map +1 -1
  18. package/dest/aztec-node/server.js +400 -855
  19. package/dest/bin/index.js +31 -15
  20. package/dest/factory.d.ts +33 -0
  21. package/dest/factory.d.ts.map +1 -0
  22. package/dest/factory.js +523 -0
  23. package/dest/index.d.ts +3 -1
  24. package/dest/index.d.ts.map +1 -1
  25. package/dest/index.js +2 -0
  26. package/dest/modules/block_parameter.d.ts +25 -0
  27. package/dest/modules/block_parameter.d.ts.map +1 -0
  28. package/dest/modules/block_parameter.js +100 -0
  29. package/dest/modules/node_block_provider.d.ts +21 -0
  30. package/dest/modules/node_block_provider.d.ts.map +1 -0
  31. package/dest/modules/node_block_provider.js +114 -0
  32. package/dest/modules/node_tx_receipt.d.ts +24 -0
  33. package/dest/modules/node_tx_receipt.d.ts.map +1 -0
  34. package/dest/modules/node_tx_receipt.js +70 -0
  35. package/dest/modules/node_world_state_queries.d.ts +68 -0
  36. package/dest/modules/node_world_state_queries.d.ts.map +1 -0
  37. package/dest/modules/node_world_state_queries.js +272 -0
  38. package/dest/modules/unseen_block_hold_off.d.ts +52 -0
  39. package/dest/modules/unseen_block_hold_off.d.ts.map +1 -0
  40. package/dest/modules/unseen_block_hold_off.js +150 -0
  41. package/dest/sentinel/config.d.ts +3 -2
  42. package/dest/sentinel/config.d.ts.map +1 -1
  43. package/dest/sentinel/config.js +15 -5
  44. package/dest/sentinel/factory.d.ts +5 -3
  45. package/dest/sentinel/factory.d.ts.map +1 -1
  46. package/dest/sentinel/factory.js +12 -5
  47. package/dest/sentinel/sentinel.d.ts +145 -21
  48. package/dest/sentinel/sentinel.d.ts.map +1 -1
  49. package/dest/sentinel/sentinel.js +226 -104
  50. package/dest/sentinel/store.d.ts +8 -8
  51. package/dest/sentinel/store.d.ts.map +1 -1
  52. package/dest/sentinel/store.js +25 -17
  53. package/dest/test/index.d.ts +3 -3
  54. package/dest/test/index.d.ts.map +1 -1
  55. package/package.json +28 -26
  56. package/src/aztec-node/block_response_helpers.ts +161 -0
  57. package/src/aztec-node/config.ts +30 -7
  58. package/src/aztec-node/node_public_calls_simulator.ts +383 -0
  59. package/src/aztec-node/public_data_overrides.ts +35 -0
  60. package/src/aztec-node/register_node_rpc_handlers.ts +41 -0
  61. package/src/aztec-node/server.ts +528 -1100
  62. package/src/bin/index.ts +39 -16
  63. package/src/factory.ts +688 -0
  64. package/src/index.ts +2 -0
  65. package/src/modules/block_parameter.ts +93 -0
  66. package/src/modules/node_block_provider.ts +153 -0
  67. package/src/modules/node_tx_receipt.ts +115 -0
  68. package/src/modules/node_world_state_queries.ts +376 -0
  69. package/src/modules/unseen_block_hold_off.ts +199 -0
  70. package/src/sentinel/README.md +103 -0
  71. package/src/sentinel/config.ts +18 -6
  72. package/src/sentinel/factory.ts +21 -6
  73. package/src/sentinel/sentinel.ts +276 -129
  74. package/src/sentinel/store.ts +26 -18
  75. package/src/test/index.ts +2 -2
@@ -2,8 +2,9 @@ import { type ConfigMappingsType, booleanConfigHelper, numberConfigHelper } from
2
2
 
3
3
  export type SentinelConfig = {
4
4
  sentinelHistoryLengthInEpochs: number;
5
- sentinelHistoricProvenPerformanceLengthInEpochs: number;
5
+ sentinelHistoricEpochPerformanceLengthInEpochs: number;
6
6
  sentinelEnabled: boolean;
7
+ sentinelEpochEndBufferSlots: number;
7
8
  };
8
9
 
9
10
  export const sentinelConfigMappings: ConfigMappingsType<SentinelConfig> = {
@@ -13,8 +14,9 @@ export const sentinelConfigMappings: ConfigMappingsType<SentinelConfig> = {
13
14
  ...numberConfigHelper(24),
14
15
  },
15
16
  /**
16
- * The number of L2 epochs kept of proven performance history for each validator.
17
- * This value must be large enough so that we have proven performance for every validator
17
+ * The number of L2 epochs kept of per-epoch performance history for each validator. End-of-epoch
18
+ * activity is recorded here and used to decide consecutive-epoch inactivity slashing.
19
+ * This value must be large enough so that we have epoch performance for every validator
18
20
  * for at least slashInactivityConsecutiveEpochThreshold. Assuming this value is 3,
19
21
  * and the committee size is 48, and we have 10k validators, then we pick 48 out of 10k each draw.
20
22
  * For any fixed element, per-draw prob = 48/10000 = 0.0048.
@@ -24,9 +26,9 @@ export const sentinelConfigMappings: ConfigMappingsType<SentinelConfig> = {
24
26
  * - 95% chance: n = 1310
25
27
  * - 99% chance: n = 1749
26
28
  */
27
- sentinelHistoricProvenPerformanceLengthInEpochs: {
28
- description: 'The number of L2 epochs kept of proven performance history for each validator.',
29
- env: 'SENTINEL_HISTORIC_PROVEN_PERFORMANCE_LENGTH_IN_EPOCHS',
29
+ sentinelHistoricEpochPerformanceLengthInEpochs: {
30
+ description: 'The number of L2 epochs kept of per-epoch performance history for each validator.',
31
+ env: 'SENTINEL_HISTORIC_EPOCH_PERFORMANCE_LENGTH_IN_EPOCHS',
30
32
  ...numberConfigHelper(2000),
31
33
  },
32
34
  sentinelEnabled: {
@@ -34,4 +36,14 @@ export const sentinelConfigMappings: ConfigMappingsType<SentinelConfig> = {
34
36
  env: 'SENTINEL_ENABLED',
35
37
  ...booleanConfigHelper(false),
36
38
  },
39
+ /**
40
+ * Number of L2 slots to wait after the end of an epoch before computing the epoch's performance.
41
+ * The buffer allows P2P attestations and the local archiver to settle. Higher values reduce the
42
+ * risk of misjudging late-arriving activity at the cost of delayed slashing.
43
+ */
44
+ sentinelEpochEndBufferSlots: {
45
+ description: 'Number of L2 slots after the end of an epoch before the sentinel evaluates it.',
46
+ env: 'SENTINEL_EPOCH_END_BUFFER_SLOTS',
47
+ ...numberConfigHelper(2),
48
+ },
37
49
  };
@@ -3,7 +3,9 @@ import { createLogger } from '@aztec/foundation/log';
3
3
  import { createStore } from '@aztec/kv-store/lmdb-v2';
4
4
  import type { P2PClient } from '@aztec/p2p';
5
5
  import type { L2BlockSource } from '@aztec/stdlib/block';
6
- import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
6
+ import type { CheckpointReexecutionTracker } from '@aztec/stdlib/checkpoint';
7
+ import type { ChainConfig } from '@aztec/stdlib/config';
8
+ import type { SlasherConfig, ValidatorClientConfig } from '@aztec/stdlib/interfaces/server';
7
9
  import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
8
10
 
9
11
  import type { SentinelConfig } from './config.js';
@@ -14,18 +16,31 @@ export async function createSentinel(
14
16
  epochCache: EpochCache,
15
17
  archiver: L2BlockSource,
16
18
  p2p: P2PClient,
17
- config: SentinelConfig & DataStoreConfig & SlasherConfig,
19
+ reexecutionTracker: CheckpointReexecutionTracker,
20
+ config: SentinelConfig &
21
+ DataStoreConfig &
22
+ SlasherConfig &
23
+ Pick<ChainConfig, 'l1ChainId' | 'rollupAddress'> &
24
+ Pick<ValidatorClientConfig, 'disableValidator'>,
18
25
  logger = createLogger('node:sentinel'),
19
26
  ): Promise<Sentinel | undefined> {
20
- if (!config.sentinelEnabled) {
27
+ const runsValidator = !config.disableValidator;
28
+ if (!runsValidator && !config.sentinelEnabled) {
29
+ logger.verbose('Sentinel is disabled');
21
30
  return undefined;
22
31
  }
32
+ if (runsValidator) {
33
+ logger.info('Enabling sentinel since this node runs a validator');
34
+ } else {
35
+ logger.info('Enabling sentinel from SENTINEL_ENABLED configuration');
36
+ }
37
+
23
38
  const kvStore = await createStore('sentinel', SentinelStore.SCHEMA_VERSION, config, logger.getBindings());
24
39
  const storeHistoryLength = config.sentinelHistoryLengthInEpochs * epochCache.getL1Constants().epochDuration;
25
- const storeHistoricProvenPerformanceLength = config.sentinelHistoricProvenPerformanceLengthInEpochs;
40
+ const storeHistoricEpochPerformanceLength = config.sentinelHistoricEpochPerformanceLengthInEpochs;
26
41
  const sentinelStore = new SentinelStore(kvStore, {
27
42
  historyLength: storeHistoryLength,
28
- historicProvenPerformanceLength: storeHistoricProvenPerformanceLength,
43
+ historicEpochPerformanceLength: storeHistoricEpochPerformanceLength,
29
44
  });
30
- return new Sentinel(epochCache, archiver, p2p, sentinelStore, config, logger);
45
+ return new Sentinel(epochCache, archiver, p2p, sentinelStore, reexecutionTracker, config, logger);
31
46
  }