@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.
- package/dest/aztec-node/block_response_helpers.d.ts +25 -0
- package/dest/aztec-node/block_response_helpers.d.ts.map +1 -0
- package/dest/aztec-node/block_response_helpers.js +112 -0
- package/dest/aztec-node/config.d.ts +16 -4
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +15 -5
- package/dest/aztec-node/node_public_calls_simulator.d.ts +90 -0
- package/dest/aztec-node/node_public_calls_simulator.d.ts.map +1 -0
- package/dest/aztec-node/node_public_calls_simulator.js +346 -0
- package/dest/aztec-node/public_data_overrides.d.ts +13 -0
- package/dest/aztec-node/public_data_overrides.d.ts.map +1 -0
- package/dest/aztec-node/public_data_overrides.js +21 -0
- package/dest/aztec-node/register_node_rpc_handlers.d.ts +11 -0
- package/dest/aztec-node/register_node_rpc_handlers.d.ts.map +1 -0
- package/dest/aztec-node/register_node_rpc_handlers.js +48 -0
- package/dest/aztec-node/server.d.ts +126 -133
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +400 -855
- package/dest/bin/index.js +31 -15
- package/dest/factory.d.ts +33 -0
- package/dest/factory.d.ts.map +1 -0
- package/dest/factory.js +523 -0
- package/dest/index.d.ts +3 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +2 -0
- package/dest/modules/block_parameter.d.ts +25 -0
- package/dest/modules/block_parameter.d.ts.map +1 -0
- package/dest/modules/block_parameter.js +100 -0
- package/dest/modules/node_block_provider.d.ts +21 -0
- package/dest/modules/node_block_provider.d.ts.map +1 -0
- package/dest/modules/node_block_provider.js +114 -0
- package/dest/modules/node_tx_receipt.d.ts +24 -0
- package/dest/modules/node_tx_receipt.d.ts.map +1 -0
- package/dest/modules/node_tx_receipt.js +70 -0
- package/dest/modules/node_world_state_queries.d.ts +68 -0
- package/dest/modules/node_world_state_queries.d.ts.map +1 -0
- package/dest/modules/node_world_state_queries.js +272 -0
- package/dest/modules/unseen_block_hold_off.d.ts +52 -0
- package/dest/modules/unseen_block_hold_off.d.ts.map +1 -0
- package/dest/modules/unseen_block_hold_off.js +150 -0
- package/dest/sentinel/config.d.ts +3 -2
- package/dest/sentinel/config.d.ts.map +1 -1
- package/dest/sentinel/config.js +15 -5
- package/dest/sentinel/factory.d.ts +5 -3
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +12 -5
- package/dest/sentinel/sentinel.d.ts +145 -21
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +226 -104
- package/dest/sentinel/store.d.ts +8 -8
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +25 -17
- package/dest/test/index.d.ts +3 -3
- package/dest/test/index.d.ts.map +1 -1
- package/package.json +28 -26
- package/src/aztec-node/block_response_helpers.ts +161 -0
- package/src/aztec-node/config.ts +30 -7
- package/src/aztec-node/node_public_calls_simulator.ts +383 -0
- package/src/aztec-node/public_data_overrides.ts +35 -0
- package/src/aztec-node/register_node_rpc_handlers.ts +41 -0
- package/src/aztec-node/server.ts +528 -1100
- package/src/bin/index.ts +39 -16
- package/src/factory.ts +688 -0
- package/src/index.ts +2 -0
- package/src/modules/block_parameter.ts +93 -0
- package/src/modules/node_block_provider.ts +153 -0
- package/src/modules/node_tx_receipt.ts +115 -0
- package/src/modules/node_world_state_queries.ts +376 -0
- package/src/modules/unseen_block_hold_off.ts +199 -0
- package/src/sentinel/README.md +103 -0
- package/src/sentinel/config.ts +18 -6
- package/src/sentinel/factory.ts +21 -6
- package/src/sentinel/sentinel.ts +276 -129
- package/src/sentinel/store.ts +26 -18
- package/src/test/index.ts +2 -2
package/src/sentinel/config.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { type ConfigMappingsType, booleanConfigHelper, numberConfigHelper } from
|
|
|
2
2
|
|
|
3
3
|
export type SentinelConfig = {
|
|
4
4
|
sentinelHistoryLengthInEpochs: number;
|
|
5
|
-
|
|
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
|
|
17
|
-
*
|
|
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
|
-
|
|
28
|
-
description: 'The number of L2 epochs kept of
|
|
29
|
-
env: '
|
|
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
|
};
|
package/src/sentinel/factory.ts
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
40
|
+
const storeHistoricEpochPerformanceLength = config.sentinelHistoricEpochPerformanceLengthInEpochs;
|
|
26
41
|
const sentinelStore = new SentinelStore(kvStore, {
|
|
27
42
|
historyLength: storeHistoryLength,
|
|
28
|
-
|
|
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
|
}
|