@aztec/aztec-node 2.0.0-rc.8 → 2.0.2-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.
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +10 -19
- package/dest/aztec-node/server.d.ts +3 -2
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +13 -3
- package/dest/sentinel/config.d.ts +1 -0
- package/dest/sentinel/config.d.ts.map +1 -1
- package/dest/sentinel/config.js +16 -0
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +3 -1
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +4 -1
- package/dest/sentinel/store.d.ts +2 -0
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +5 -2
- package/package.json +24 -24
- package/src/aztec-node/config.ts +14 -30
- package/src/aztec-node/server.ts +15 -6
- package/src/sentinel/config.ts +18 -0
- package/src/sentinel/factory.ts +5 -1
- package/src/sentinel/sentinel.ts +5 -1
- package/src/sentinel/store.ts +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/aztec-node/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,kBAAkB,EAA8C,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/aztec-node/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,iBAAiB,CAAC;A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B,EAAE,kBAAkB,CAAC,eAAe,CAuBvE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,CAElD;AAoED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,cAAc,GAAG,qBAAqB,GAAG,gBAAgB,wBAM3G"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { archiverConfigMappings } from '@aztec/archiver/config';
|
|
2
2
|
import { genesisStateConfigMappings, l1ContractAddressesMapping } from '@aztec/ethereum';
|
|
3
3
|
import { booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import { dataConfigMappings } from '@aztec/kv-store/config';
|
|
5
|
-
import { keyStoreConfigMappings } from '@aztec/node-keystore';
|
|
6
|
+
import { ethPrivateKeySchema, keyStoreConfigMappings } from '@aztec/node-keystore';
|
|
6
7
|
import { sharedNodeConfigMappings } from '@aztec/node-lib/config';
|
|
7
8
|
import { p2pConfigMappings } from '@aztec/p2p/config';
|
|
8
9
|
import { proverClientConfigMappings } from '@aztec/prover-client/config';
|
|
@@ -50,16 +51,12 @@ function createKeyStoreFromWeb3Signer(config) {
|
|
|
50
51
|
if (config.web3SignerUrl === undefined || config.web3SignerUrl.length === 0 || config.validatorAddresses === undefined || config.validatorAddresses.length === 0) {
|
|
51
52
|
return undefined;
|
|
52
53
|
}
|
|
53
|
-
const coinbase = config.coinbase ? config.coinbase.toString() : config.validatorAddresses[0].toString();
|
|
54
|
-
const feeRecipient = config.feeRecipient ? config.feeRecipient.toString() : AztecAddress.ZERO.toString();
|
|
55
|
-
const publisherAddresses = config.publisherAddresses && config.publisherAddresses.length > 0 ? config.publisherAddresses.map((k)=>k.toChecksumString()) : [];
|
|
56
|
-
const attestors = config.validatorAddresses.map((k)=>k.toChecksumString());
|
|
57
54
|
validatorKeyStores.push({
|
|
58
|
-
attester:
|
|
59
|
-
feeRecipient: feeRecipient,
|
|
60
|
-
coinbase: coinbase,
|
|
55
|
+
attester: config.validatorAddresses,
|
|
56
|
+
feeRecipient: config.feeRecipient ?? AztecAddress.ZERO,
|
|
57
|
+
coinbase: config.coinbase ?? config.validatorAddresses[0],
|
|
61
58
|
remoteSigner: config.web3SignerUrl,
|
|
62
|
-
publisher: publisherAddresses
|
|
59
|
+
publisher: config.publisherAddresses ?? []
|
|
63
60
|
});
|
|
64
61
|
const keyStore = {
|
|
65
62
|
schemaVersion: 1,
|
|
@@ -72,19 +69,13 @@ function createKeyStoreFromWeb3Signer(config) {
|
|
|
72
69
|
}
|
|
73
70
|
function createKeyStoreFromPrivateKeys(config) {
|
|
74
71
|
const validatorKeyStores = [];
|
|
75
|
-
const ethPrivateKeys = [];
|
|
76
|
-
const validatorKeys = config.validatorPrivateKeys ? config.validatorPrivateKeys.getValue() : [];
|
|
77
|
-
for(let i = 0; i < validatorKeys.length; i++){
|
|
78
|
-
const key = validatorKeys[i];
|
|
79
|
-
const ethPrivateKey = key;
|
|
80
|
-
ethPrivateKeys.push(ethPrivateKey);
|
|
81
|
-
}
|
|
72
|
+
const ethPrivateKeys = config.validatorPrivateKeys ? config.validatorPrivateKeys.getValue().map((x)=>ethPrivateKeySchema.parse(x)) : [];
|
|
82
73
|
if (!ethPrivateKeys.length) {
|
|
83
74
|
return undefined;
|
|
84
75
|
}
|
|
85
|
-
const coinbase = config.coinbase
|
|
86
|
-
const feeRecipient = config.feeRecipient
|
|
87
|
-
const publisherKeys = config.publisherPrivateKeys ? config.publisherPrivateKeys.map((k)=>k.getValue()) : [];
|
|
76
|
+
const coinbase = config.coinbase ?? EthAddress.fromString(privateKeyToAddress(ethPrivateKeys[0]));
|
|
77
|
+
const feeRecipient = config.feeRecipient ?? AztecAddress.ZERO;
|
|
78
|
+
const publisherKeys = config.publisherPrivateKeys ? config.publisherPrivateKeys.map((k)=>ethPrivateKeySchema.parse(k.getValue())) : [];
|
|
88
79
|
validatorKeyStores.push({
|
|
89
80
|
attester: ethPrivateKeys,
|
|
90
81
|
feeRecipient: feeRecipient,
|
|
@@ -17,7 +17,7 @@ import type { GasFees } from '@aztec/stdlib/gas';
|
|
|
17
17
|
import { type AztecNode, type AztecNodeAdmin, type AztecNodeAdminConfig, type GetContractClassLogsResponse, type GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
18
18
|
import { type ClientProtocolCircuitVerifier, type L2LogsSource, type Service, type WorldStateSyncStatus, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
19
19
|
import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
20
|
-
import type
|
|
20
|
+
import { type L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
21
21
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
22
22
|
import type { Offense, SlashPayloadRound } from '@aztec/stdlib/slashing';
|
|
23
23
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
@@ -99,7 +99,7 @@ export declare class AztecNodeService implements AztecNode, AztecNodeAdmin, Trac
|
|
|
99
99
|
* @param number - The block number being requested.
|
|
100
100
|
* @returns The requested block.
|
|
101
101
|
*/
|
|
102
|
-
getBlock(number:
|
|
102
|
+
getBlock(number: L2BlockNumber): Promise<L2Block | undefined>;
|
|
103
103
|
/**
|
|
104
104
|
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
105
105
|
* @param from - The start of the range of blocks to return.
|
|
@@ -226,6 +226,7 @@ export declare class AztecNodeService implements AztecNode, AztecNodeAdmin, Trac
|
|
|
226
226
|
* @returns A tuple of the index and the sibling path of the L1ToL2Message (undefined if not found).
|
|
227
227
|
*/
|
|
228
228
|
getL1ToL2MessageMembershipWitness(blockNumber: L2BlockNumber, l1ToL2Message: Fr): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined>;
|
|
229
|
+
getL1ToL2MessageBlock(l1ToL2Message: Fr): Promise<number | undefined>;
|
|
229
230
|
/**
|
|
230
231
|
* Returns whether an L1 to L2 message is synced by archiver and if it's ready to be included in a block.
|
|
231
232
|
* @param l1ToL2Message - The L1 to L2 message to check.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/aztec-node/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EACL,cAAc,EAEd,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAEL,KAAK,mBAAmB,EAKzB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAS,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGzE,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,aAAa,EAAoD,MAAM,YAAY,CAAC;AAE5G,OAAO,EAGL,eAAe,EACf,KAAK,kBAAkB,EAExB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,iBAAiB,EACjB,KAAK,sBAAsB,EAG5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,mBAAmB,EACnB,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kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAI9C,iBAAiB,CACtB,gBAAgB,EAAE,UAAU,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAI/B,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqCpD,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC/D,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAOhD,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAiD/E"}
|
|
@@ -32,6 +32,7 @@ import { L2BlockHash } from '@aztec/stdlib/block';
|
|
|
32
32
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
33
33
|
import { AztecNodeAdminConfigSchema } from '@aztec/stdlib/interfaces/client';
|
|
34
34
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
35
|
+
import { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
35
36
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
36
37
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
37
38
|
import { PublicSimulationOutput, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
@@ -328,7 +329,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
328
329
|
* @param number - The block number being requested.
|
|
329
330
|
* @returns The requested block.
|
|
330
331
|
*/ async getBlock(number) {
|
|
331
|
-
|
|
332
|
+
const blockNumber = number === 'latest' ? await this.getBlockNumber() : number;
|
|
333
|
+
return await this.blockSource.getBlock(blockNumber);
|
|
332
334
|
}
|
|
333
335
|
/**
|
|
334
336
|
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
@@ -600,12 +602,17 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
600
602
|
witness.path
|
|
601
603
|
];
|
|
602
604
|
}
|
|
605
|
+
async getL1ToL2MessageBlock(l1ToL2Message) {
|
|
606
|
+
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
607
|
+
return messageIndex ? InboxLeaf.l2BlockFromIndex(messageIndex) : undefined;
|
|
608
|
+
}
|
|
603
609
|
/**
|
|
604
610
|
* Returns whether an L1 to L2 message is synced by archiver and if it's ready to be included in a block.
|
|
605
611
|
* @param l1ToL2Message - The L1 to L2 message to check.
|
|
606
612
|
* @returns Whether the message is synced and ready to be included in a block.
|
|
607
613
|
*/ async isL1ToL2MessageSynced(l1ToL2Message) {
|
|
608
|
-
|
|
614
|
+
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
615
|
+
return messageIndex !== undefined;
|
|
609
616
|
}
|
|
610
617
|
/**
|
|
611
618
|
* Returns all the L2 to L1 messages in a block.
|
|
@@ -791,8 +798,11 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
791
798
|
this.sequencer?.updateConfig(config);
|
|
792
799
|
this.slasherClient?.updateConfig(config);
|
|
793
800
|
this.validatorsSentinel?.updateConfig(config);
|
|
794
|
-
// this.blockBuilder.updateConfig(config); // TODO: Spyros has a PR to add the builder to `this`, so we can do this
|
|
795
801
|
await this.p2pClient.updateP2PConfig(config);
|
|
802
|
+
const archiver = this.blockSource;
|
|
803
|
+
if ('updateConfig' in archiver) {
|
|
804
|
+
archiver.updateConfig(config);
|
|
805
|
+
}
|
|
796
806
|
if (newConfig.realProofs !== this.config.realProofs) {
|
|
797
807
|
this.proofVerifier = config.realProofs ? await BBCircuitVerifier.new(newConfig) : new TestCircuitVerifier();
|
|
798
808
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
2
2
|
export type SentinelConfig = {
|
|
3
3
|
sentinelHistoryLengthInEpochs: number;
|
|
4
|
+
sentinelHistoricProvenPerformanceLengthInEpochs: number;
|
|
4
5
|
sentinelEnabled: boolean;
|
|
5
6
|
};
|
|
6
7
|
export declare const sentinelConfigMappings: ConfigMappingsType<SentinelConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/sentinel/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA2C,MAAM,0BAA0B,CAAC;AAE5G,MAAM,MAAM,cAAc,GAAG;IAC3B,6BAA6B,EAAE,MAAM,CAAC;IACtC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/sentinel/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA2C,MAAM,0BAA0B,CAAC;AAE5G,MAAM,MAAM,cAAc,GAAG;IAC3B,6BAA6B,EAAE,MAAM,CAAC;IACtC,+CAA+C,EAAE,MAAM,CAAC;IACxD,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,CA4BrE,CAAC"}
|
package/dest/sentinel/config.js
CHANGED
|
@@ -5,6 +5,22 @@ export const sentinelConfigMappings = {
|
|
|
5
5
|
env: 'SENTINEL_HISTORY_LENGTH_IN_EPOCHS',
|
|
6
6
|
...numberConfigHelper(24)
|
|
7
7
|
},
|
|
8
|
+
/**
|
|
9
|
+
* The number of L2 epochs kept of proven performance history for each validator.
|
|
10
|
+
* This value must be large enough so that we have proven performance for every validator
|
|
11
|
+
* for at least slashInactivityConsecutiveEpochThreshold. Assuming this value is 3,
|
|
12
|
+
* and the committee size is 48, and we have 10k validators, then we pick 48 out of 10k each draw.
|
|
13
|
+
* For any fixed element, per-draw prob = 48/10000 = 0.0048.
|
|
14
|
+
* After n draws, count ~ Binomial(n, 0.0048). We want P(X >= 3).
|
|
15
|
+
* Results (exact binomial):
|
|
16
|
+
* - 90% chance: n = 1108
|
|
17
|
+
* - 95% chance: n = 1310
|
|
18
|
+
* - 99% chance: n = 1749
|
|
19
|
+
*/ sentinelHistoricProvenPerformanceLengthInEpochs: {
|
|
20
|
+
description: 'The number of L2 epochs kept of proven performance history for each validator.',
|
|
21
|
+
env: 'SENTINEL_HISTORIC_PROVEN_PERFORMANCE_LENGTH_IN_EPOCHS',
|
|
22
|
+
...numberConfigHelper(2000)
|
|
23
|
+
},
|
|
8
24
|
sentinelEnabled: {
|
|
9
25
|
description: 'Whether the sentinel is enabled or not.',
|
|
10
26
|
env: 'SENTINEL_ENABLED',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/sentinel/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,wBAAsB,cAAc,CAClC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,cAAc,GAAG,eAAe,GAAG,aAAa,EACxD,MAAM,yCAAgC,GACrC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/sentinel/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,wBAAsB,cAAc,CAClC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,cAAc,GAAG,eAAe,GAAG,aAAa,EACxD,MAAM,yCAAgC,GACrC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAiB/B"}
|
package/dest/sentinel/factory.js
CHANGED
|
@@ -8,8 +8,10 @@ export async function createSentinel(epochCache, archiver, p2p, config, logger =
|
|
|
8
8
|
}
|
|
9
9
|
const kvStore = await createStore('sentinel', SentinelStore.SCHEMA_VERSION, config, createLogger('node:sentinel:lmdb'));
|
|
10
10
|
const storeHistoryLength = config.sentinelHistoryLengthInEpochs * epochCache.getL1Constants().epochDuration;
|
|
11
|
+
const storeHistoricProvenPerformanceLength = config.sentinelHistoricProvenPerformanceLengthInEpochs;
|
|
11
12
|
const sentinelStore = new SentinelStore(kvStore, {
|
|
12
|
-
historyLength: storeHistoryLength
|
|
13
|
+
historyLength: storeHistoryLength,
|
|
14
|
+
historicProvenPerformanceLength: storeHistoricProvenPerformanceLength
|
|
13
15
|
});
|
|
14
16
|
return new Sentinel(epochCache, archiver, p2p, sentinelStore, config, logger);
|
|
15
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel.d.ts","sourceRoot":"","sources":["../../src/sentinel/sentinel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAE/B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;6BAEI,UAAU,cAAc;AAAvE,qBAAa,QAAS,SAAQ,aAA2C,YAAW,yBAAyB,EAAE,OAAO;IAWlH,SAAS,CAAC,UAAU,EAAE,UAAU;IAChC,SAAS,CAAC,QAAQ,EAAE,aAAa;IACjC,SAAS,CAAC,GAAG,EAAE,SAAS;IACxB,SAAS,CAAC,KAAK,EAAE,aAAa;IAC9B,SAAS,CAAC,MA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,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE;;;IA2D1G,wDAAwD;IACxD,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAIxG,0DAA0D;IAC7C,YAAY,CAAC,EACxB,QAAQ,EACR,MAAM,EACN,UAAU,GACX,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAA;KAAO,GAAG,OAAO,CAAC,eAAe,CAAC;IAqBpG,6CAA6C;IAChC,iBAAiB,CAC5B,gBAAgB,EAAE,UAAU,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAoC5C,SAAS,CAAC,wBAAwB,CAChC,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,UAAU,EAAE,sBAAsB,EAClC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,cAAc;IAgBjB,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,sBAAsB,EAC/B,iBAAiB,EAAE,mBAAmB,GAAG,SAAS,EAClD,MAAM,EAAE,qBAAqB,EAAE;;;;;;IAYjC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;;;;;CAOnD"}
|
|
@@ -140,6 +140,9 @@ export class Sentinel extends EventEmitter {
|
|
|
140
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);
|
|
141
141
|
}
|
|
142
142
|
async handleProvenPerformance(epoch, performance) {
|
|
143
|
+
if (this.config.slashInactivityPenalty === 0n) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
143
146
|
const inactiveValidators = getEntries(performance).filter(([_, { missed, total }])=>missed / total >= this.config.slashInactivityTargetPercentage).map(([address])=>address);
|
|
144
147
|
this.logger.debug(`Found ${inactiveValidators.length} inactive validators in epoch ${epoch}`, {
|
|
145
148
|
inactiveValidators,
|
|
@@ -155,7 +158,7 @@ export class Sentinel extends EventEmitter {
|
|
|
155
158
|
epochOrSlot: epoch
|
|
156
159
|
}));
|
|
157
160
|
if (criminals.length > 0) {
|
|
158
|
-
this.logger.
|
|
161
|
+
this.logger.verbose(`Identified ${criminals.length} validators to slash due to inactivity in at least ${epochThreshold} consecutive epochs`, {
|
|
159
162
|
...args,
|
|
160
163
|
epochThreshold
|
|
161
164
|
});
|
package/dest/sentinel/store.d.ts
CHANGED
|
@@ -9,8 +9,10 @@ export declare class SentinelStore {
|
|
|
9
9
|
private readonly provenMap;
|
|
10
10
|
constructor(store: AztecAsyncKVStore, config: {
|
|
11
11
|
historyLength: number;
|
|
12
|
+
historicProvenPerformanceLength: number;
|
|
12
13
|
});
|
|
13
14
|
getHistoryLength(): number;
|
|
15
|
+
getHistoricProvenPerformanceLength(): number;
|
|
14
16
|
updateProvenPerformance(epoch: bigint, performance: ValidatorsEpochPerformance): Promise<void>;
|
|
15
17
|
getProvenPerformance(who: EthAddress): Promise<{
|
|
16
18
|
missed: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sentinel/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAElC,qBAAa,aAAa;IAWtB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAA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AAC,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC;IAQtE,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAKzF,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,gBAAgB;CAgBzB"}
|
package/dest/sentinel/store.js
CHANGED
|
@@ -18,6 +18,9 @@ export class SentinelStore {
|
|
|
18
18
|
getHistoryLength() {
|
|
19
19
|
return this.config.historyLength;
|
|
20
20
|
}
|
|
21
|
+
getHistoricProvenPerformanceLength() {
|
|
22
|
+
return this.config.historicProvenPerformanceLength;
|
|
23
|
+
}
|
|
21
24
|
async updateProvenPerformance(epoch, performance) {
|
|
22
25
|
await this.store.transactionAsync(async ()=>{
|
|
23
26
|
for (const [who, { missed, total }] of Object.entries(performance)){
|
|
@@ -53,8 +56,8 @@ export class SentinelStore {
|
|
|
53
56
|
// This should be sorted by epoch, but just in case.
|
|
54
57
|
// Since we keep the size small, this is not a big deal.
|
|
55
58
|
currentPerformance.sort((a, b)=>Number(a.epoch - b.epoch));
|
|
56
|
-
// keep the most recent `
|
|
57
|
-
const performanceToKeep = currentPerformance.slice(-this.config.
|
|
59
|
+
// keep the most recent `historicProvenPerformanceLength` entries.
|
|
60
|
+
const performanceToKeep = currentPerformance.slice(-this.config.historicProvenPerformanceLength);
|
|
58
61
|
await this.provenMap.set(who.toString(), this.serializePerformance(performanceToKeep));
|
|
59
62
|
}
|
|
60
63
|
async updateValidators(slot, statuses) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2-rc.1",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -66,29 +66,29 @@
|
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@aztec/archiver": "2.0.
|
|
70
|
-
"@aztec/bb-prover": "2.0.
|
|
71
|
-
"@aztec/blob-sink": "2.0.
|
|
72
|
-
"@aztec/constants": "2.0.
|
|
73
|
-
"@aztec/epoch-cache": "2.0.
|
|
74
|
-
"@aztec/ethereum": "2.0.
|
|
75
|
-
"@aztec/foundation": "2.0.
|
|
76
|
-
"@aztec/kv-store": "2.0.
|
|
77
|
-
"@aztec/l1-artifacts": "2.0.
|
|
78
|
-
"@aztec/merkle-tree": "2.0.
|
|
79
|
-
"@aztec/node-keystore": "2.0.
|
|
80
|
-
"@aztec/node-lib": "2.0.
|
|
81
|
-
"@aztec/noir-protocol-circuits-types": "2.0.
|
|
82
|
-
"@aztec/p2p": "2.0.
|
|
83
|
-
"@aztec/protocol-contracts": "2.0.
|
|
84
|
-
"@aztec/prover-client": "2.0.
|
|
85
|
-
"@aztec/sequencer-client": "2.0.
|
|
86
|
-
"@aztec/simulator": "2.0.
|
|
87
|
-
"@aztec/slasher": "2.0.
|
|
88
|
-
"@aztec/stdlib": "2.0.
|
|
89
|
-
"@aztec/telemetry-client": "2.0.
|
|
90
|
-
"@aztec/validator-client": "2.0.
|
|
91
|
-
"@aztec/world-state": "2.0.
|
|
69
|
+
"@aztec/archiver": "2.0.2-rc.1",
|
|
70
|
+
"@aztec/bb-prover": "2.0.2-rc.1",
|
|
71
|
+
"@aztec/blob-sink": "2.0.2-rc.1",
|
|
72
|
+
"@aztec/constants": "2.0.2-rc.1",
|
|
73
|
+
"@aztec/epoch-cache": "2.0.2-rc.1",
|
|
74
|
+
"@aztec/ethereum": "2.0.2-rc.1",
|
|
75
|
+
"@aztec/foundation": "2.0.2-rc.1",
|
|
76
|
+
"@aztec/kv-store": "2.0.2-rc.1",
|
|
77
|
+
"@aztec/l1-artifacts": "2.0.2-rc.1",
|
|
78
|
+
"@aztec/merkle-tree": "2.0.2-rc.1",
|
|
79
|
+
"@aztec/node-keystore": "2.0.2-rc.1",
|
|
80
|
+
"@aztec/node-lib": "2.0.2-rc.1",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "2.0.2-rc.1",
|
|
82
|
+
"@aztec/p2p": "2.0.2-rc.1",
|
|
83
|
+
"@aztec/protocol-contracts": "2.0.2-rc.1",
|
|
84
|
+
"@aztec/prover-client": "2.0.2-rc.1",
|
|
85
|
+
"@aztec/sequencer-client": "2.0.2-rc.1",
|
|
86
|
+
"@aztec/simulator": "2.0.2-rc.1",
|
|
87
|
+
"@aztec/slasher": "2.0.2-rc.1",
|
|
88
|
+
"@aztec/stdlib": "2.0.2-rc.1",
|
|
89
|
+
"@aztec/telemetry-client": "2.0.2-rc.1",
|
|
90
|
+
"@aztec/validator-client": "2.0.2-rc.1",
|
|
91
|
+
"@aztec/world-state": "2.0.2-rc.1",
|
|
92
92
|
"koa": "^2.16.1",
|
|
93
93
|
"koa-router": "^12.0.0",
|
|
94
94
|
"tslib": "^2.4.0",
|
package/src/aztec-node/config.ts
CHANGED
|
@@ -6,16 +6,13 @@ import {
|
|
|
6
6
|
l1ContractAddressesMapping,
|
|
7
7
|
} from '@aztec/ethereum';
|
|
8
8
|
import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
|
|
9
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
10
|
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
10
11
|
import {
|
|
11
|
-
type AztecAddressHex,
|
|
12
|
-
type EthAddressHex,
|
|
13
|
-
type EthPrivateKey,
|
|
14
|
-
type EthRemoteSignerAccount,
|
|
15
|
-
type Hex,
|
|
16
12
|
type KeyStore,
|
|
17
13
|
type KeyStoreConfig,
|
|
18
14
|
type ValidatorKeyStore,
|
|
15
|
+
ethPrivateKeySchema,
|
|
19
16
|
keyStoreConfigMappings,
|
|
20
17
|
} from '@aztec/node-keystore';
|
|
21
18
|
import { type SharedNodeConfig, sharedNodeConfigMappings } from '@aztec/node-lib/config';
|
|
@@ -108,22 +105,13 @@ function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore) {
|
|
|
108
105
|
) {
|
|
109
106
|
return undefined;
|
|
110
107
|
}
|
|
111
|
-
const coinbase = config.coinbase ? config.coinbase.toString() : config.validatorAddresses[0].toString();
|
|
112
|
-
const feeRecipient = config.feeRecipient ? config.feeRecipient.toString() : AztecAddress.ZERO.toString();
|
|
113
|
-
|
|
114
|
-
const publisherAddresses =
|
|
115
|
-
config.publisherAddresses && config.publisherAddresses.length > 0
|
|
116
|
-
? config.publisherAddresses.map(k => k.toChecksumString() as EthRemoteSignerAccount)
|
|
117
|
-
: [];
|
|
118
|
-
|
|
119
|
-
const attestors = config.validatorAddresses.map(k => k.toChecksumString() as EthRemoteSignerAccount);
|
|
120
108
|
|
|
121
109
|
validatorKeyStores.push({
|
|
122
|
-
attester:
|
|
123
|
-
feeRecipient: feeRecipient
|
|
124
|
-
coinbase: coinbase
|
|
110
|
+
attester: config.validatorAddresses,
|
|
111
|
+
feeRecipient: config.feeRecipient ?? AztecAddress.ZERO,
|
|
112
|
+
coinbase: config.coinbase ?? config.validatorAddresses[0],
|
|
125
113
|
remoteSigner: config.web3SignerUrl,
|
|
126
|
-
publisher: publisherAddresses,
|
|
114
|
+
publisher: config.publisherAddresses ?? [],
|
|
127
115
|
});
|
|
128
116
|
|
|
129
117
|
const keyStore: KeyStore = {
|
|
@@ -138,28 +126,24 @@ function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore) {
|
|
|
138
126
|
|
|
139
127
|
function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore) {
|
|
140
128
|
const validatorKeyStores: ValidatorKeyStore[] = [];
|
|
141
|
-
const ethPrivateKeys
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const key = validatorKeys[i];
|
|
145
|
-
const ethPrivateKey: EthPrivateKey = key as Hex<32>;
|
|
146
|
-
ethPrivateKeys.push(ethPrivateKey);
|
|
147
|
-
}
|
|
129
|
+
const ethPrivateKeys = config.validatorPrivateKeys
|
|
130
|
+
? config.validatorPrivateKeys.getValue().map(x => ethPrivateKeySchema.parse(x))
|
|
131
|
+
: [];
|
|
148
132
|
|
|
149
133
|
if (!ethPrivateKeys.length) {
|
|
150
134
|
return undefined;
|
|
151
135
|
}
|
|
152
|
-
const coinbase = config.coinbase
|
|
153
|
-
const feeRecipient = config.feeRecipient
|
|
136
|
+
const coinbase = config.coinbase ?? EthAddress.fromString(privateKeyToAddress(ethPrivateKeys[0]));
|
|
137
|
+
const feeRecipient = config.feeRecipient ?? AztecAddress.ZERO;
|
|
154
138
|
|
|
155
139
|
const publisherKeys = config.publisherPrivateKeys
|
|
156
|
-
? config.publisherPrivateKeys.map(k => k.getValue()
|
|
140
|
+
? config.publisherPrivateKeys.map(k => ethPrivateKeySchema.parse(k.getValue()))
|
|
157
141
|
: [];
|
|
158
142
|
|
|
159
143
|
validatorKeyStores.push({
|
|
160
144
|
attester: ethPrivateKeys,
|
|
161
|
-
feeRecipient: feeRecipient
|
|
162
|
-
coinbase: coinbase
|
|
145
|
+
feeRecipient: feeRecipient,
|
|
146
|
+
coinbase: coinbase,
|
|
163
147
|
remoteSigner: undefined,
|
|
164
148
|
publisher: publisherKeys,
|
|
165
149
|
});
|
package/src/aztec-node/server.ts
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
tryStop,
|
|
83
83
|
} from '@aztec/stdlib/interfaces/server';
|
|
84
84
|
import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
85
|
-
import type
|
|
85
|
+
import { InboxLeaf, type L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
86
86
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
87
87
|
import type { Offense, SlashPayloadRound } from '@aztec/stdlib/slashing';
|
|
88
88
|
import type { NullifierLeafPreimage, PublicDataTreeLeaf, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
@@ -508,8 +508,9 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
508
508
|
* @param number - The block number being requested.
|
|
509
509
|
* @returns The requested block.
|
|
510
510
|
*/
|
|
511
|
-
public async getBlock(number:
|
|
512
|
-
|
|
511
|
+
public async getBlock(number: L2BlockNumber): Promise<L2Block | undefined> {
|
|
512
|
+
const blockNumber = number === 'latest' ? await this.getBlockNumber() : number;
|
|
513
|
+
return await this.blockSource.getBlock(blockNumber);
|
|
513
514
|
}
|
|
514
515
|
|
|
515
516
|
/**
|
|
@@ -858,13 +859,19 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
858
859
|
return [witness.index, witness.path];
|
|
859
860
|
}
|
|
860
861
|
|
|
862
|
+
public async getL1ToL2MessageBlock(l1ToL2Message: Fr): Promise<number | undefined> {
|
|
863
|
+
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
864
|
+
return messageIndex ? InboxLeaf.l2BlockFromIndex(messageIndex) : undefined;
|
|
865
|
+
}
|
|
866
|
+
|
|
861
867
|
/**
|
|
862
868
|
* Returns whether an L1 to L2 message is synced by archiver and if it's ready to be included in a block.
|
|
863
869
|
* @param l1ToL2Message - The L1 to L2 message to check.
|
|
864
870
|
* @returns Whether the message is synced and ready to be included in a block.
|
|
865
871
|
*/
|
|
866
872
|
public async isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean> {
|
|
867
|
-
|
|
873
|
+
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
874
|
+
return messageIndex !== undefined;
|
|
868
875
|
}
|
|
869
876
|
|
|
870
877
|
/**
|
|
@@ -1125,9 +1132,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1125
1132
|
this.sequencer?.updateConfig(config);
|
|
1126
1133
|
this.slasherClient?.updateConfig(config);
|
|
1127
1134
|
this.validatorsSentinel?.updateConfig(config);
|
|
1128
|
-
// this.blockBuilder.updateConfig(config); // TODO: Spyros has a PR to add the builder to `this`, so we can do this
|
|
1129
1135
|
await this.p2pClient.updateP2PConfig(config);
|
|
1130
|
-
|
|
1136
|
+
const archiver = this.blockSource as Archiver;
|
|
1137
|
+
if ('updateConfig' in archiver) {
|
|
1138
|
+
archiver.updateConfig(config);
|
|
1139
|
+
}
|
|
1131
1140
|
if (newConfig.realProofs !== this.config.realProofs) {
|
|
1132
1141
|
this.proofVerifier = config.realProofs ? await BBCircuitVerifier.new(newConfig) : new TestCircuitVerifier();
|
|
1133
1142
|
}
|
package/src/sentinel/config.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type ConfigMappingsType, booleanConfigHelper, numberConfigHelper } from
|
|
|
2
2
|
|
|
3
3
|
export type SentinelConfig = {
|
|
4
4
|
sentinelHistoryLengthInEpochs: number;
|
|
5
|
+
sentinelHistoricProvenPerformanceLengthInEpochs: number;
|
|
5
6
|
sentinelEnabled: boolean;
|
|
6
7
|
};
|
|
7
8
|
|
|
@@ -11,6 +12,23 @@ export const sentinelConfigMappings: ConfigMappingsType<SentinelConfig> = {
|
|
|
11
12
|
env: 'SENTINEL_HISTORY_LENGTH_IN_EPOCHS',
|
|
12
13
|
...numberConfigHelper(24),
|
|
13
14
|
},
|
|
15
|
+
/**
|
|
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
|
|
18
|
+
* for at least slashInactivityConsecutiveEpochThreshold. Assuming this value is 3,
|
|
19
|
+
* and the committee size is 48, and we have 10k validators, then we pick 48 out of 10k each draw.
|
|
20
|
+
* For any fixed element, per-draw prob = 48/10000 = 0.0048.
|
|
21
|
+
* After n draws, count ~ Binomial(n, 0.0048). We want P(X >= 3).
|
|
22
|
+
* Results (exact binomial):
|
|
23
|
+
* - 90% chance: n = 1108
|
|
24
|
+
* - 95% chance: n = 1310
|
|
25
|
+
* - 99% chance: n = 1749
|
|
26
|
+
*/
|
|
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',
|
|
30
|
+
...numberConfigHelper(2000),
|
|
31
|
+
},
|
|
14
32
|
sentinelEnabled: {
|
|
15
33
|
description: 'Whether the sentinel is enabled or not.',
|
|
16
34
|
env: 'SENTINEL_ENABLED',
|
package/src/sentinel/factory.ts
CHANGED
|
@@ -27,6 +27,10 @@ export async function createSentinel(
|
|
|
27
27
|
createLogger('node:sentinel:lmdb'),
|
|
28
28
|
);
|
|
29
29
|
const storeHistoryLength = config.sentinelHistoryLengthInEpochs * epochCache.getL1Constants().epochDuration;
|
|
30
|
-
const
|
|
30
|
+
const storeHistoricProvenPerformanceLength = config.sentinelHistoricProvenPerformanceLengthInEpochs;
|
|
31
|
+
const sentinelStore = new SentinelStore(kvStore, {
|
|
32
|
+
historyLength: storeHistoryLength,
|
|
33
|
+
historicProvenPerformanceLength: storeHistoricProvenPerformanceLength,
|
|
34
|
+
});
|
|
31
35
|
return new Sentinel(epochCache, archiver, p2p, sentinelStore, config, logger);
|
|
32
36
|
}
|
package/src/sentinel/sentinel.ts
CHANGED
|
@@ -190,6 +190,10 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
protected async handleProvenPerformance(epoch: bigint, performance: ValidatorsEpochPerformance) {
|
|
193
|
+
if (this.config.slashInactivityPenalty === 0n) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
193
197
|
const inactiveValidators = getEntries(performance)
|
|
194
198
|
.filter(([_, { missed, total }]) => missed / total >= this.config.slashInactivityTargetPercentage)
|
|
195
199
|
.map(([address]) => address);
|
|
@@ -213,7 +217,7 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
213
217
|
}));
|
|
214
218
|
|
|
215
219
|
if (criminals.length > 0) {
|
|
216
|
-
this.logger.
|
|
220
|
+
this.logger.verbose(
|
|
217
221
|
`Identified ${criminals.length} validators to slash due to inactivity in at least ${epochThreshold} consecutive epochs`,
|
|
218
222
|
{ ...args, epochThreshold },
|
|
219
223
|
);
|
package/src/sentinel/store.ts
CHANGED
|
@@ -19,7 +19,7 @@ export class SentinelStore {
|
|
|
19
19
|
|
|
20
20
|
constructor(
|
|
21
21
|
private store: AztecAsyncKVStore,
|
|
22
|
-
private config: { historyLength: number },
|
|
22
|
+
private config: { historyLength: number; historicProvenPerformanceLength: number },
|
|
23
23
|
) {
|
|
24
24
|
this.historyMap = store.openMap('sentinel-validator-status');
|
|
25
25
|
this.provenMap = store.openMap('sentinel-validator-proven');
|
|
@@ -29,6 +29,10 @@ export class SentinelStore {
|
|
|
29
29
|
return this.config.historyLength;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
public getHistoricProvenPerformanceLength() {
|
|
33
|
+
return this.config.historicProvenPerformanceLength;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
public async updateProvenPerformance(epoch: bigint, performance: ValidatorsEpochPerformance) {
|
|
33
37
|
await this.store.transactionAsync(async () => {
|
|
34
38
|
for (const [who, { missed, total }] of Object.entries(performance)) {
|
|
@@ -65,8 +69,8 @@ export class SentinelStore {
|
|
|
65
69
|
// Since we keep the size small, this is not a big deal.
|
|
66
70
|
currentPerformance.sort((a, b) => Number(a.epoch - b.epoch));
|
|
67
71
|
|
|
68
|
-
// keep the most recent `
|
|
69
|
-
const performanceToKeep = currentPerformance.slice(-this.config.
|
|
72
|
+
// keep the most recent `historicProvenPerformanceLength` entries.
|
|
73
|
+
const performanceToKeep = currentPerformance.slice(-this.config.historicProvenPerformanceLength);
|
|
70
74
|
|
|
71
75
|
await this.provenMap.set(who.toString(), this.serializePerformance(performanceToKeep));
|
|
72
76
|
}
|