@aztec/aztec-node 1.2.1 → 2.0.0-nightly.20250813
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/server.d.ts +6 -4
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +56 -42
- package/dest/sentinel/sentinel.d.ts +2 -2
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +10 -7
- package/package.json +23 -23
- package/src/aztec-node/server.ts +80 -63
- package/src/sentinel/sentinel.ts +8 -10
|
@@ -13,11 +13,12 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
13
13
|
import { type InBlock, type L2Block, type L2BlockNumber, type L2BlockSource, type PublishedL2Block } from '@aztec/stdlib/block';
|
|
14
14
|
import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress, NodeInfo, ProtocolContractAddresses } from '@aztec/stdlib/contract';
|
|
15
15
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
16
|
-
import type
|
|
17
|
-
import { type ClientProtocolCircuitVerifier, type L2LogsSource, type
|
|
16
|
+
import { type AztecNode, type AztecNodeAdmin, type AztecNodeAdminConfig, type GetContractClassLogsResponse, type GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
17
|
+
import { type ClientProtocolCircuitVerifier, type L2LogsSource, type Service, type WorldStateSyncStatus, type WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
18
18
|
import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
19
19
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
20
20
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
21
|
+
import type { MonitoredSlashPayload } from '@aztec/stdlib/slashing';
|
|
21
22
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
22
23
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
23
24
|
import { type BlockHeader, type GlobalVariableBuilder as GlobalVariableBuilderInterface, type IndexedTxEffect, PublicSimulationOutput, Tx, type TxHash, TxReceipt, type TxValidationResult } from '@aztec/stdlib/tx';
|
|
@@ -299,14 +300,15 @@ export declare class AztecNodeService implements AztecNode, AztecNodeAdmin, Trac
|
|
|
299
300
|
isSimulation?: boolean;
|
|
300
301
|
skipFeeEnforcement?: boolean;
|
|
301
302
|
}): Promise<TxValidationResult>;
|
|
302
|
-
|
|
303
|
+
getConfig(): Promise<AztecNodeAdminConfig>;
|
|
304
|
+
setConfig(config: Partial<AztecNodeAdminConfig>): Promise<void>;
|
|
303
305
|
getProtocolContractAddresses(): Promise<ProtocolContractAddresses>;
|
|
304
306
|
registerContractFunctionSignatures(signatures: string[]): Promise<void>;
|
|
305
|
-
flushTxs(): Promise<void>;
|
|
306
307
|
getValidatorsStats(): Promise<ValidatorsStats>;
|
|
307
308
|
startSnapshotUpload(location: string): Promise<void>;
|
|
308
309
|
rollbackTo(targetBlock: number, force?: boolean): Promise<void>;
|
|
309
310
|
pauseSync(): Promise<void>;
|
|
310
311
|
resumeSync(): Promise<void>;
|
|
312
|
+
getSlasherMonitoredPayloads(): Promise<MonitoredSlashPayload[]>;
|
|
311
313
|
}
|
|
312
314
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -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,
|
|
1
|
+
{"version":3,"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SAAS,CAAC;IAMpG;;;QAGI;IAIS,mBAAmB,CAAC,EAAE,EAAE,EAAE,EAAE,kBAAkB,UAAQ,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAqExF,SAAS,CACpB,EAAE,EAAE,EAAE,EACN,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;KAAO,GAClG,OAAO,CAAC,kBAAkB,CAAC;IAoBvB,SAAS,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAMpC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAerE,4BAA4B,IAAI,OAAO,CAAC,yBAAyB,CAAC;IASlE,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAIxC,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,2BAA2B,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;CA6CvE"}
|
|
@@ -9,9 +9,9 @@ import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@azte
|
|
|
9
9
|
import { createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
10
10
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
11
11
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
12
|
-
import { NULL_KEY, RegistryContract, RollupContract, createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
12
|
+
import { L1TxUtils, NULL_KEY, RegistryContract, RollupContract, createEthereumChain, createExtendedL1Client, getPublicClient, isExtendedClient } from '@aztec/ethereum';
|
|
13
13
|
import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
14
|
-
import { compactArray } from '@aztec/foundation/collection';
|
|
14
|
+
import { compactArray, pick } from '@aztec/foundation/collection';
|
|
15
15
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
16
16
|
import { Fr } from '@aztec/foundation/fields';
|
|
17
17
|
import { BadRequestError } from '@aztec/foundation/json-rpc';
|
|
@@ -21,14 +21,15 @@ import { count } from '@aztec/foundation/string';
|
|
|
21
21
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
22
22
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
23
23
|
import { trySnapshotSync, uploadSnapshot } from '@aztec/node-lib/actions';
|
|
24
|
-
import {
|
|
24
|
+
import { createP2PClient, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
25
25
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
26
26
|
import { BlockBuilder, GlobalVariableBuilder, SequencerClient, createValidatorForAcceptingTxs } from '@aztec/sequencer-client';
|
|
27
27
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
28
|
-
import { EpochPruneWatcher, SlasherClient } from '@aztec/slasher';
|
|
28
|
+
import { AttestationsBlockWatcher, EpochPruneWatcher, SlasherClient } from '@aztec/slasher';
|
|
29
29
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
30
30
|
import { L2BlockHash } from '@aztec/stdlib/block';
|
|
31
31
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
32
|
+
import { AztecNodeAdminConfigSchema } from '@aztec/stdlib/interfaces/client';
|
|
32
33
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
33
34
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
34
35
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
@@ -146,9 +147,17 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
146
147
|
}
|
|
147
148
|
// attempt snapshot sync if possible
|
|
148
149
|
await trySnapshotSync(config, log);
|
|
149
|
-
const
|
|
150
|
+
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, {
|
|
151
|
+
dateProvider
|
|
152
|
+
});
|
|
153
|
+
const archiver = await createArchiver(config, {
|
|
154
|
+
blobSinkClient,
|
|
155
|
+
epochCache,
|
|
156
|
+
telemetry,
|
|
157
|
+
dateProvider
|
|
158
|
+
}, {
|
|
150
159
|
blockUntilSync: true
|
|
151
|
-
}
|
|
160
|
+
});
|
|
152
161
|
// now create the merkle trees and the world state synchronizer
|
|
153
162
|
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, options.prefilledPublicData, telemetry);
|
|
154
163
|
const circuitVerifier = config.realProofs ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier();
|
|
@@ -156,22 +165,17 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
156
165
|
log.warn(`Aztec node is accepting fake proofs`);
|
|
157
166
|
}
|
|
158
167
|
const proofVerifier = new QueuedIVCVerifier(config, circuitVerifier);
|
|
159
|
-
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, {
|
|
160
|
-
dateProvider
|
|
161
|
-
});
|
|
162
168
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
163
|
-
const p2pClient = await createP2PClient(P2PClientType.Full, config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, telemetry, deps.p2pClientDeps);
|
|
169
|
+
const p2pClient = await createP2PClient(P2PClientType.Full, config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, dateProvider, telemetry, deps.p2pClientDeps);
|
|
164
170
|
// Start world state and wait for it to sync to the archiver.
|
|
165
171
|
await worldStateSynchronizer.start();
|
|
166
172
|
// Start p2p. Note that it depends on world state to be running.
|
|
167
173
|
await p2pClient.start();
|
|
168
174
|
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
|
|
169
175
|
const blockBuilder = new BlockBuilder({
|
|
176
|
+
...config,
|
|
170
177
|
l1GenesisTime,
|
|
171
|
-
slotDuration: Number(slotDuration)
|
|
172
|
-
rollupVersion: config.rollupVersion,
|
|
173
|
-
l1ChainId: config.l1ChainId,
|
|
174
|
-
txPublicSetupAllowList: config.txPublicSetupAllowList
|
|
178
|
+
slotDuration: Number(slotDuration)
|
|
175
179
|
}, worldStateSynchronizer, archiver, dateProvider, telemetry);
|
|
176
180
|
const watchers = [];
|
|
177
181
|
const validatorsSentinel = await createSentinel(epochCache, archiver, p2pClient, config);
|
|
@@ -184,11 +188,17 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
184
188
|
}
|
|
185
189
|
let epochPruneWatcher;
|
|
186
190
|
if (config.slashPruneEnabled) {
|
|
187
|
-
|
|
188
|
-
epochPruneWatcher = new EpochPruneWatcher(archiver, archiver, epochCache, txCollector, blockBuilder, config.slashPrunePenalty, config.slashPruneMaxPenalty);
|
|
191
|
+
epochPruneWatcher = new EpochPruneWatcher(archiver, archiver, epochCache, p2pClient.getTxProvider(), blockBuilder, config.slashPrunePenalty, config.slashPruneMaxPenalty);
|
|
189
192
|
await epochPruneWatcher.start();
|
|
190
193
|
watchers.push(epochPruneWatcher);
|
|
191
194
|
}
|
|
195
|
+
// We assume we want to slash for invalid attestations unless all max penalties are set to 0
|
|
196
|
+
let attestationsBlockWatcher;
|
|
197
|
+
if (config.slashProposeInvalidAttestationsMaxPenalty > 0n || config.slashAttestDescendantOfInvalidMaxPenalty > 0n) {
|
|
198
|
+
attestationsBlockWatcher = new AttestationsBlockWatcher(archiver, epochCache, config);
|
|
199
|
+
await attestationsBlockWatcher.start();
|
|
200
|
+
watchers.push(attestationsBlockWatcher);
|
|
201
|
+
}
|
|
192
202
|
const validatorClient = createValidatorClient(config, {
|
|
193
203
|
p2pClient,
|
|
194
204
|
telemetry,
|
|
@@ -202,23 +212,22 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
202
212
|
watchers.push(validatorClient);
|
|
203
213
|
}
|
|
204
214
|
log.verbose(`All Aztec Node subsystems synced`);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
l1Client = createExtendedL1Client(config.l1RpcUrls, config.publisherPrivateKey.getValue(), ethereumChain.chainInfo);
|
|
212
|
-
l1TxUtils = new L1TxUtilsWithBlobs(l1Client, log, config);
|
|
213
|
-
slasherClient = await SlasherClient.new(config, config.l1Contracts, l1TxUtils, watchers, dateProvider);
|
|
214
|
-
slasherClient.start();
|
|
215
|
-
}
|
|
215
|
+
const { slasherPrivateKey, l1RpcUrls } = config;
|
|
216
|
+
const slasherPrivateKeyString = slasherPrivateKey.getValue();
|
|
217
|
+
const slasherL1Client = slasherPrivateKeyString && slasherPrivateKeyString !== NULL_KEY ? createExtendedL1Client(l1RpcUrls, slasherPrivateKeyString, ethereumChain.chainInfo) : getPublicClient(config);
|
|
218
|
+
const slasherL1TxUtils = isExtendedClient(slasherL1Client) ? new L1TxUtils(slasherL1Client, log, dateProvider, config) : undefined;
|
|
219
|
+
const slasherClient = await SlasherClient.new(config, config.l1Contracts, slasherL1TxUtils, slasherL1Client, watchers, dateProvider);
|
|
220
|
+
await slasherClient.start();
|
|
216
221
|
// Validator enabled, create/start relevant service
|
|
222
|
+
let sequencer;
|
|
217
223
|
if (!config.disableValidator) {
|
|
218
224
|
// This shouldn't happen, validators need a publisher private key.
|
|
219
|
-
|
|
225
|
+
const { publisherPrivateKey } = config;
|
|
226
|
+
if (!publisherPrivateKey?.getValue() || publisherPrivateKey?.getValue() === NULL_KEY) {
|
|
220
227
|
throw new Error('A publisher private key is required to run a validator');
|
|
221
228
|
}
|
|
229
|
+
const l1Client = createExtendedL1Client(l1RpcUrls, publisherPrivateKey.getValue(), ethereumChain.chainInfo);
|
|
230
|
+
const l1TxUtils = new L1TxUtilsWithBlobs(l1Client, log, dateProvider, config);
|
|
222
231
|
sequencer = await SequencerClient.new(config, {
|
|
223
232
|
// if deps were provided, they should override the defaults,
|
|
224
233
|
// or things that we created in this function
|
|
@@ -228,7 +237,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
228
237
|
validatorClient,
|
|
229
238
|
p2pClient,
|
|
230
239
|
worldStateSynchronizer,
|
|
231
|
-
slasherClient
|
|
240
|
+
slasherClient,
|
|
232
241
|
blockBuilder,
|
|
233
242
|
l2BlockSource: archiver,
|
|
234
243
|
l1ToL2MessageSource: archiver,
|
|
@@ -388,7 +397,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
388
397
|
}
|
|
389
398
|
async #sendTx(tx) {
|
|
390
399
|
const timer = new Timer();
|
|
391
|
-
const txHash =
|
|
400
|
+
const txHash = tx.getTxHash().toString();
|
|
392
401
|
const valid = await this.isValidTx(tx);
|
|
393
402
|
if (valid.result !== 'valid') {
|
|
394
403
|
const reason = valid.reason.join(', ');
|
|
@@ -697,7 +706,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
697
706
|
if (txGasLimit + teardownGasLimit > this.config.rpcSimulatePublicMaxGasLimit) {
|
|
698
707
|
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
699
708
|
}
|
|
700
|
-
const txHash =
|
|
709
|
+
const txHash = tx.getTxHash();
|
|
701
710
|
const blockNumber = await this.blockSource.getBlockNumber() + 1;
|
|
702
711
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
703
712
|
const coinbase = this.sequencer?.coinbase || EthAddress.ZERO;
|
|
@@ -746,6 +755,11 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
746
755
|
});
|
|
747
756
|
return await validator.validateTx(tx);
|
|
748
757
|
}
|
|
758
|
+
getConfig() {
|
|
759
|
+
const schema = AztecNodeAdminConfigSchema;
|
|
760
|
+
const keys = schema.keyof().options;
|
|
761
|
+
return Promise.resolve(pick(this.config, ...keys));
|
|
762
|
+
}
|
|
749
763
|
async setConfig(config) {
|
|
750
764
|
const newConfig = {
|
|
751
765
|
...this.config,
|
|
@@ -753,6 +767,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
753
767
|
};
|
|
754
768
|
this.sequencer?.updateSequencerConfig(config);
|
|
755
769
|
this.slasherClient?.updateConfig(config);
|
|
770
|
+
this.validatorsSentinel?.updateConfig(config);
|
|
756
771
|
// this.blockBuilder.updateConfig(config); // TODO: Spyros has a PR to add the builder to `this`, so we can do this
|
|
757
772
|
await this.p2pClient.updateP2PConfig(config);
|
|
758
773
|
if (newConfig.realProofs !== this.config.realProofs) {
|
|
@@ -762,22 +777,15 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
762
777
|
}
|
|
763
778
|
getProtocolContractAddresses() {
|
|
764
779
|
return Promise.resolve({
|
|
765
|
-
|
|
780
|
+
classRegistry: ProtocolContractAddress.ContractClassRegistry,
|
|
766
781
|
feeJuice: ProtocolContractAddress.FeeJuice,
|
|
767
|
-
|
|
782
|
+
instanceRegistry: ProtocolContractAddress.ContractInstanceRegistry,
|
|
768
783
|
multiCallEntrypoint: ProtocolContractAddress.MultiCallEntrypoint
|
|
769
784
|
});
|
|
770
785
|
}
|
|
771
786
|
registerContractFunctionSignatures(signatures) {
|
|
772
787
|
return this.contractDataSource.registerContractFunctionSignatures(signatures);
|
|
773
788
|
}
|
|
774
|
-
flushTxs() {
|
|
775
|
-
if (!this.sequencer) {
|
|
776
|
-
throw new Error(`Sequencer is not initialized`);
|
|
777
|
-
}
|
|
778
|
-
this.sequencer.flush();
|
|
779
|
-
return Promise.resolve();
|
|
780
|
-
}
|
|
781
789
|
getValidatorsStats() {
|
|
782
790
|
return this.validatorsSentinel?.computeStats() ?? Promise.resolve({
|
|
783
791
|
stats: {},
|
|
@@ -857,6 +865,12 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
857
865
|
this.blockSource.resume();
|
|
858
866
|
return Promise.resolve();
|
|
859
867
|
}
|
|
868
|
+
getSlasherMonitoredPayloads() {
|
|
869
|
+
if (!this.slasherClient) {
|
|
870
|
+
throw new Error('Slasher client is not initialized.');
|
|
871
|
+
}
|
|
872
|
+
return Promise.resolve(this.slasherClient.getMonitoredPayloads());
|
|
873
|
+
}
|
|
860
874
|
/**
|
|
861
875
|
* Returns an instance of MerkleTreeOperations having first ensured the world state is fully synched
|
|
862
876
|
* @param blockNumber - The block number at which to get the data.
|
|
@@ -892,7 +906,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
892
906
|
}
|
|
893
907
|
}
|
|
894
908
|
_ts_decorate([
|
|
895
|
-
trackSpan('AztecNodeService.simulatePublicCalls',
|
|
896
|
-
[Attributes.TX_HASH]:
|
|
909
|
+
trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
910
|
+
[Attributes.TX_HASH]: tx.getTxHash().toString()
|
|
897
911
|
}))
|
|
898
912
|
], AztecNodeService.prototype, "simulatePublicCalls", null);
|
|
@@ -3,9 +3,8 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
4
4
|
import { type L2TipsStore } from '@aztec/kv-store/stores';
|
|
5
5
|
import type { P2PClient } from '@aztec/p2p';
|
|
6
|
-
import type { WantToSlashArgs, Watcher, WatcherEmitter } from '@aztec/slasher/config';
|
|
6
|
+
import type { SlasherConfig, WantToSlashArgs, Watcher, WatcherEmitter } from '@aztec/slasher/config';
|
|
7
7
|
import { type L2BlockSource, L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
|
|
8
|
-
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
9
8
|
import type { ValidatorStats, ValidatorStatusHistory, ValidatorStatusInSlot, ValidatorStatusType, ValidatorsEpochPerformance, ValidatorsStats } from '@aztec/stdlib/validators';
|
|
10
9
|
import { SentinelStore } from './store.js';
|
|
11
10
|
declare const Sentinel_base: new () => WatcherEmitter;
|
|
@@ -27,6 +26,7 @@ export declare class Sentinel extends Sentinel_base implements L2BlockStreamEven
|
|
|
27
26
|
attestors: EthAddress[];
|
|
28
27
|
}>;
|
|
29
28
|
constructor(epochCache: EpochCache, archiver: L2BlockSource, p2p: P2PClient, store: SentinelStore, config: Pick<SlasherConfig, 'slashInactivityCreateTargetPercentage' | 'slashInactivityCreatePenalty' | 'slashInactivitySignalTargetPercentage' | 'slashInactivityMaxPenalty' | 'slashPayloadTtlSeconds'>, logger?: import("@aztec/foundation/log").Logger);
|
|
29
|
+
updateConfig(config: Partial<SlasherConfig>): void;
|
|
30
30
|
start(): Promise<void>;
|
|
31
31
|
/** Loads initial slot and initializes blockstream. We will not process anything at or before the initial slot. */
|
|
32
32
|
protected init(): Promise<void>;
|
|
@@ -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;
|
|
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,mCA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Y,CAAC,EACxB,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAE,OAAO,GAChB,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,eAAe,CAAC;IAkBzE,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,EACtC,MAAM,EAAE,qBAAqB;;;;;IAW/B,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;;;;;CAOnD"}
|
|
@@ -3,7 +3,8 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
5
|
import { L2TipsMemoryStore } from '@aztec/kv-store/stores';
|
|
6
|
-
import { Offense
|
|
6
|
+
import { Offense } from '@aztec/slasher';
|
|
7
|
+
import { WANT_TO_SLASH_EVENT } from '@aztec/slasher/config';
|
|
7
8
|
import { L2BlockStream, getAttestationsFromPublishedL2Block } from '@aztec/stdlib/block';
|
|
8
9
|
import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
9
10
|
import EventEmitter from 'node:events';
|
|
@@ -26,6 +27,12 @@ export class Sentinel extends EventEmitter {
|
|
|
26
27
|
const interval = epochCache.getL1Constants().ethereumSlotDuration * 1000 / 4;
|
|
27
28
|
this.runningPromise = new RunningPromise(this.work.bind(this), logger, interval);
|
|
28
29
|
}
|
|
30
|
+
updateConfig(config) {
|
|
31
|
+
this.config = {
|
|
32
|
+
...this.config,
|
|
33
|
+
...config
|
|
34
|
+
};
|
|
35
|
+
}
|
|
29
36
|
async start() {
|
|
30
37
|
await this.init();
|
|
31
38
|
this.runningPromise.start();
|
|
@@ -135,12 +142,8 @@ export class Sentinel extends EventEmitter {
|
|
|
135
142
|
amount: this.config.slashInactivityCreatePenalty,
|
|
136
143
|
offense: Offense.INACTIVITY
|
|
137
144
|
}));
|
|
138
|
-
this.logger.info(`Criminals
|
|
139
|
-
|
|
140
|
-
validator,
|
|
141
|
-
amount,
|
|
142
|
-
offense: Offense[offense]
|
|
143
|
-
}))
|
|
145
|
+
this.logger.info(`Criminals: ${criminals.length}`, {
|
|
146
|
+
args
|
|
144
147
|
});
|
|
145
148
|
if (criminals.length > 0) {
|
|
146
149
|
this.emit(WANT_TO_SLASH_EVENT, args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-nightly.20250813",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,28 +65,28 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/archiver": "
|
|
69
|
-
"@aztec/bb-prover": "
|
|
70
|
-
"@aztec/blob-sink": "
|
|
71
|
-
"@aztec/constants": "
|
|
72
|
-
"@aztec/epoch-cache": "
|
|
73
|
-
"@aztec/ethereum": "
|
|
74
|
-
"@aztec/foundation": "
|
|
75
|
-
"@aztec/kv-store": "
|
|
76
|
-
"@aztec/l1-artifacts": "
|
|
77
|
-
"@aztec/merkle-tree": "
|
|
78
|
-
"@aztec/node-lib": "
|
|
79
|
-
"@aztec/noir-protocol-circuits-types": "
|
|
80
|
-
"@aztec/p2p": "
|
|
81
|
-
"@aztec/protocol-contracts": "
|
|
82
|
-
"@aztec/prover-client": "
|
|
83
|
-
"@aztec/sequencer-client": "
|
|
84
|
-
"@aztec/simulator": "
|
|
85
|
-
"@aztec/slasher": "
|
|
86
|
-
"@aztec/stdlib": "
|
|
87
|
-
"@aztec/telemetry-client": "
|
|
88
|
-
"@aztec/validator-client": "
|
|
89
|
-
"@aztec/world-state": "
|
|
68
|
+
"@aztec/archiver": "2.0.0-nightly.20250813",
|
|
69
|
+
"@aztec/bb-prover": "2.0.0-nightly.20250813",
|
|
70
|
+
"@aztec/blob-sink": "2.0.0-nightly.20250813",
|
|
71
|
+
"@aztec/constants": "2.0.0-nightly.20250813",
|
|
72
|
+
"@aztec/epoch-cache": "2.0.0-nightly.20250813",
|
|
73
|
+
"@aztec/ethereum": "2.0.0-nightly.20250813",
|
|
74
|
+
"@aztec/foundation": "2.0.0-nightly.20250813",
|
|
75
|
+
"@aztec/kv-store": "2.0.0-nightly.20250813",
|
|
76
|
+
"@aztec/l1-artifacts": "2.0.0-nightly.20250813",
|
|
77
|
+
"@aztec/merkle-tree": "2.0.0-nightly.20250813",
|
|
78
|
+
"@aztec/node-lib": "2.0.0-nightly.20250813",
|
|
79
|
+
"@aztec/noir-protocol-circuits-types": "2.0.0-nightly.20250813",
|
|
80
|
+
"@aztec/p2p": "2.0.0-nightly.20250813",
|
|
81
|
+
"@aztec/protocol-contracts": "2.0.0-nightly.20250813",
|
|
82
|
+
"@aztec/prover-client": "2.0.0-nightly.20250813",
|
|
83
|
+
"@aztec/sequencer-client": "2.0.0-nightly.20250813",
|
|
84
|
+
"@aztec/simulator": "2.0.0-nightly.20250813",
|
|
85
|
+
"@aztec/slasher": "2.0.0-nightly.20250813",
|
|
86
|
+
"@aztec/stdlib": "2.0.0-nightly.20250813",
|
|
87
|
+
"@aztec/telemetry-client": "2.0.0-nightly.20250813",
|
|
88
|
+
"@aztec/validator-client": "2.0.0-nightly.20250813",
|
|
89
|
+
"@aztec/world-state": "2.0.0-nightly.20250813",
|
|
90
90
|
"koa": "^2.16.1",
|
|
91
91
|
"koa-router": "^12.0.0",
|
|
92
92
|
"tslib": "^2.4.0",
|
package/src/aztec-node/server.ts
CHANGED
|
@@ -11,16 +11,18 @@ import {
|
|
|
11
11
|
} from '@aztec/constants';
|
|
12
12
|
import { EpochCache, type EpochCacheInterface } from '@aztec/epoch-cache';
|
|
13
13
|
import {
|
|
14
|
-
type ExtendedViemWalletClient,
|
|
15
14
|
type L1ContractAddresses,
|
|
15
|
+
L1TxUtils,
|
|
16
16
|
NULL_KEY,
|
|
17
17
|
RegistryContract,
|
|
18
18
|
RollupContract,
|
|
19
19
|
createEthereumChain,
|
|
20
20
|
createExtendedL1Client,
|
|
21
|
+
getPublicClient,
|
|
22
|
+
isExtendedClient,
|
|
21
23
|
} from '@aztec/ethereum';
|
|
22
24
|
import { L1TxUtilsWithBlobs } from '@aztec/ethereum/l1-tx-utils-with-blobs';
|
|
23
|
-
import { compactArray } from '@aztec/foundation/collection';
|
|
25
|
+
import { compactArray, pick } from '@aztec/foundation/collection';
|
|
24
26
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
25
27
|
import { Fr } from '@aztec/foundation/fields';
|
|
26
28
|
import { BadRequestError } from '@aztec/foundation/json-rpc';
|
|
@@ -30,13 +32,7 @@ import { count } from '@aztec/foundation/string';
|
|
|
30
32
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
31
33
|
import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
|
|
32
34
|
import { trySnapshotSync, uploadSnapshot } from '@aztec/node-lib/actions';
|
|
33
|
-
import {
|
|
34
|
-
type P2P,
|
|
35
|
-
type P2PClientDeps,
|
|
36
|
-
TxCollector,
|
|
37
|
-
createP2PClient,
|
|
38
|
-
getDefaultAllowedSetupFunctions,
|
|
39
|
-
} from '@aztec/p2p';
|
|
35
|
+
import { type P2P, type P2PClientDeps, createP2PClient, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
40
36
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
41
37
|
import {
|
|
42
38
|
BlockBuilder,
|
|
@@ -46,7 +42,7 @@ import {
|
|
|
46
42
|
createValidatorForAcceptingTxs,
|
|
47
43
|
} from '@aztec/sequencer-client';
|
|
48
44
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
49
|
-
import { EpochPruneWatcher, SlasherClient, type Watcher } from '@aztec/slasher';
|
|
45
|
+
import { AttestationsBlockWatcher, EpochPruneWatcher, SlasherClient, type Watcher } from '@aztec/slasher';
|
|
50
46
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
51
47
|
import {
|
|
52
48
|
type InBlock,
|
|
@@ -65,19 +61,18 @@ import type {
|
|
|
65
61
|
} from '@aztec/stdlib/contract';
|
|
66
62
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
67
63
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
68
|
-
import
|
|
69
|
-
AztecNode,
|
|
70
|
-
AztecNodeAdmin,
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
import {
|
|
65
|
+
type AztecNode,
|
|
66
|
+
type AztecNodeAdmin,
|
|
67
|
+
type AztecNodeAdminConfig,
|
|
68
|
+
AztecNodeAdminConfigSchema,
|
|
69
|
+
type GetContractClassLogsResponse,
|
|
70
|
+
type GetPublicLogsResponse,
|
|
73
71
|
} from '@aztec/stdlib/interfaces/client';
|
|
74
72
|
import {
|
|
75
73
|
type ClientProtocolCircuitVerifier,
|
|
76
74
|
type L2LogsSource,
|
|
77
|
-
type ProverConfig,
|
|
78
|
-
type SequencerConfig,
|
|
79
75
|
type Service,
|
|
80
|
-
type SlasherConfig,
|
|
81
76
|
type WorldStateSyncStatus,
|
|
82
77
|
type WorldStateSynchronizer,
|
|
83
78
|
tryStop,
|
|
@@ -85,6 +80,7 @@ import {
|
|
|
85
80
|
import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
86
81
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
87
82
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
83
|
+
import type { MonitoredSlashPayload } from '@aztec/stdlib/slashing';
|
|
88
84
|
import type { NullifierLeafPreimage, PublicDataTreeLeaf, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
89
85
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
90
86
|
import {
|
|
@@ -239,7 +235,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
239
235
|
// attempt snapshot sync if possible
|
|
240
236
|
await trySnapshotSync(config, log);
|
|
241
237
|
|
|
242
|
-
const
|
|
238
|
+
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, { dateProvider });
|
|
239
|
+
|
|
240
|
+
const archiver = await createArchiver(
|
|
241
|
+
config,
|
|
242
|
+
{ blobSinkClient, epochCache, telemetry, dateProvider },
|
|
243
|
+
{ blockUntilSync: true },
|
|
244
|
+
);
|
|
243
245
|
|
|
244
246
|
// now create the merkle trees and the world state synchronizer
|
|
245
247
|
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
@@ -254,8 +256,6 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
254
256
|
}
|
|
255
257
|
const proofVerifier = new QueuedIVCVerifier(config, circuitVerifier);
|
|
256
258
|
|
|
257
|
-
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, { dateProvider });
|
|
258
|
-
|
|
259
259
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
260
260
|
const p2pClient = await createP2PClient(
|
|
261
261
|
P2PClientType.Full,
|
|
@@ -265,6 +265,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
265
265
|
worldStateSynchronizer,
|
|
266
266
|
epochCache,
|
|
267
267
|
packageVersion,
|
|
268
|
+
dateProvider,
|
|
268
269
|
telemetry,
|
|
269
270
|
deps.p2pClientDeps,
|
|
270
271
|
);
|
|
@@ -278,13 +279,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
278
279
|
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? (await getDefaultAllowedSetupFunctions());
|
|
279
280
|
|
|
280
281
|
const blockBuilder = new BlockBuilder(
|
|
281
|
-
{
|
|
282
|
-
l1GenesisTime,
|
|
283
|
-
slotDuration: Number(slotDuration),
|
|
284
|
-
rollupVersion: config.rollupVersion,
|
|
285
|
-
l1ChainId: config.l1ChainId,
|
|
286
|
-
txPublicSetupAllowList: config.txPublicSetupAllowList,
|
|
287
|
-
},
|
|
282
|
+
{ ...config, l1GenesisTime, slotDuration: Number(slotDuration) },
|
|
288
283
|
worldStateSynchronizer,
|
|
289
284
|
archiver,
|
|
290
285
|
dateProvider,
|
|
@@ -304,12 +299,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
304
299
|
|
|
305
300
|
let epochPruneWatcher: EpochPruneWatcher | undefined;
|
|
306
301
|
if (config.slashPruneEnabled) {
|
|
307
|
-
const txCollector = new TxCollector(p2pClient);
|
|
308
302
|
epochPruneWatcher = new EpochPruneWatcher(
|
|
309
303
|
archiver,
|
|
310
304
|
archiver,
|
|
311
305
|
epochCache,
|
|
312
|
-
|
|
306
|
+
p2pClient.getTxProvider(),
|
|
313
307
|
blockBuilder,
|
|
314
308
|
config.slashPrunePenalty,
|
|
315
309
|
config.slashPruneMaxPenalty,
|
|
@@ -317,6 +311,15 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
317
311
|
await epochPruneWatcher.start();
|
|
318
312
|
watchers.push(epochPruneWatcher);
|
|
319
313
|
}
|
|
314
|
+
|
|
315
|
+
// We assume we want to slash for invalid attestations unless all max penalties are set to 0
|
|
316
|
+
let attestationsBlockWatcher: AttestationsBlockWatcher | undefined;
|
|
317
|
+
if (config.slashProposeInvalidAttestationsMaxPenalty > 0n || config.slashAttestDescendantOfInvalidMaxPenalty > 0n) {
|
|
318
|
+
attestationsBlockWatcher = new AttestationsBlockWatcher(archiver, epochCache, config);
|
|
319
|
+
await attestationsBlockWatcher.start();
|
|
320
|
+
watchers.push(attestationsBlockWatcher);
|
|
321
|
+
}
|
|
322
|
+
|
|
320
323
|
const validatorClient = createValidatorClient(config, {
|
|
321
324
|
p2pClient,
|
|
322
325
|
telemetry,
|
|
@@ -333,30 +336,38 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
333
336
|
|
|
334
337
|
log.verbose(`All Aztec Node subsystems synced`);
|
|
335
338
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
339
|
+
const { slasherPrivateKey, l1RpcUrls } = config;
|
|
340
|
+
const slasherPrivateKeyString = slasherPrivateKey.getValue();
|
|
341
|
+
const slasherL1Client =
|
|
342
|
+
slasherPrivateKeyString && slasherPrivateKeyString !== NULL_KEY
|
|
343
|
+
? createExtendedL1Client(l1RpcUrls, slasherPrivateKeyString, ethereumChain.chainInfo)
|
|
344
|
+
: getPublicClient(config);
|
|
345
|
+
const slasherL1TxUtils = isExtendedClient(slasherL1Client)
|
|
346
|
+
? new L1TxUtils(slasherL1Client, log, dateProvider, config)
|
|
347
|
+
: undefined;
|
|
348
|
+
|
|
349
|
+
const slasherClient = await SlasherClient.new(
|
|
350
|
+
config,
|
|
351
|
+
config.l1Contracts,
|
|
352
|
+
slasherL1TxUtils,
|
|
353
|
+
slasherL1Client,
|
|
354
|
+
watchers,
|
|
355
|
+
dateProvider,
|
|
356
|
+
);
|
|
357
|
+
await slasherClient.start();
|
|
352
358
|
|
|
353
359
|
// Validator enabled, create/start relevant service
|
|
360
|
+
let sequencer: SequencerClient | undefined;
|
|
354
361
|
if (!config.disableValidator) {
|
|
355
362
|
// This shouldn't happen, validators need a publisher private key.
|
|
356
|
-
|
|
363
|
+
const { publisherPrivateKey } = config;
|
|
364
|
+
if (!publisherPrivateKey?.getValue() || publisherPrivateKey?.getValue() === NULL_KEY) {
|
|
357
365
|
throw new Error('A publisher private key is required to run a validator');
|
|
358
366
|
}
|
|
359
367
|
|
|
368
|
+
const l1Client = createExtendedL1Client(l1RpcUrls, publisherPrivateKey.getValue(), ethereumChain.chainInfo);
|
|
369
|
+
const l1TxUtils = new L1TxUtilsWithBlobs(l1Client, log, dateProvider, config);
|
|
370
|
+
|
|
360
371
|
sequencer = await SequencerClient.new(config, {
|
|
361
372
|
// if deps were provided, they should override the defaults,
|
|
362
373
|
// or things that we created in this function
|
|
@@ -366,7 +377,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
366
377
|
validatorClient,
|
|
367
378
|
p2pClient,
|
|
368
379
|
worldStateSynchronizer,
|
|
369
|
-
slasherClient
|
|
380
|
+
slasherClient,
|
|
370
381
|
blockBuilder,
|
|
371
382
|
l2BlockSource: archiver,
|
|
372
383
|
l1ToL2MessageSource: archiver,
|
|
@@ -590,7 +601,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
590
601
|
|
|
591
602
|
async #sendTx(tx: Tx) {
|
|
592
603
|
const timer = new Timer();
|
|
593
|
-
const txHash =
|
|
604
|
+
const txHash = tx.getTxHash().toString();
|
|
594
605
|
|
|
595
606
|
const valid = await this.isValidTx(tx);
|
|
596
607
|
if (valid.result !== 'valid') {
|
|
@@ -981,8 +992,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
981
992
|
* Simulates the public part of a transaction with the current state.
|
|
982
993
|
* @param tx - The transaction to simulate.
|
|
983
994
|
**/
|
|
984
|
-
@trackSpan('AztecNodeService.simulatePublicCalls',
|
|
985
|
-
[Attributes.TX_HASH]:
|
|
995
|
+
@trackSpan('AztecNodeService.simulatePublicCalls', (tx: Tx) => ({
|
|
996
|
+
[Attributes.TX_HASH]: tx.getTxHash().toString(),
|
|
986
997
|
}))
|
|
987
998
|
public async simulatePublicCalls(tx: Tx, skipFeeEnforcement = false): Promise<PublicSimulationOutput> {
|
|
988
999
|
// Check total gas limit for simulation
|
|
@@ -999,7 +1010,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
999
1010
|
);
|
|
1000
1011
|
}
|
|
1001
1012
|
|
|
1002
|
-
const txHash =
|
|
1013
|
+
const txHash = tx.getTxHash();
|
|
1003
1014
|
const blockNumber = (await this.blockSource.getBlockNumber()) + 1;
|
|
1004
1015
|
|
|
1005
1016
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
@@ -1076,10 +1087,17 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1076
1087
|
return await validator.validateTx(tx);
|
|
1077
1088
|
}
|
|
1078
1089
|
|
|
1079
|
-
public
|
|
1090
|
+
public getConfig(): Promise<AztecNodeAdminConfig> {
|
|
1091
|
+
const schema = AztecNodeAdminConfigSchema;
|
|
1092
|
+
const keys = schema.keyof().options;
|
|
1093
|
+
return Promise.resolve(pick(this.config, ...keys));
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
public async setConfig(config: Partial<AztecNodeAdminConfig>): Promise<void> {
|
|
1080
1097
|
const newConfig = { ...this.config, ...config };
|
|
1081
1098
|
this.sequencer?.updateSequencerConfig(config);
|
|
1082
1099
|
this.slasherClient?.updateConfig(config);
|
|
1100
|
+
this.validatorsSentinel?.updateConfig(config);
|
|
1083
1101
|
// this.blockBuilder.updateConfig(config); // TODO: Spyros has a PR to add the builder to `this`, so we can do this
|
|
1084
1102
|
await this.p2pClient.updateP2PConfig(config);
|
|
1085
1103
|
|
|
@@ -1092,9 +1110,9 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1092
1110
|
|
|
1093
1111
|
public getProtocolContractAddresses(): Promise<ProtocolContractAddresses> {
|
|
1094
1112
|
return Promise.resolve({
|
|
1095
|
-
|
|
1113
|
+
classRegistry: ProtocolContractAddress.ContractClassRegistry,
|
|
1096
1114
|
feeJuice: ProtocolContractAddress.FeeJuice,
|
|
1097
|
-
|
|
1115
|
+
instanceRegistry: ProtocolContractAddress.ContractInstanceRegistry,
|
|
1098
1116
|
multiCallEntrypoint: ProtocolContractAddress.MultiCallEntrypoint,
|
|
1099
1117
|
});
|
|
1100
1118
|
}
|
|
@@ -1103,14 +1121,6 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1103
1121
|
return this.contractDataSource.registerContractFunctionSignatures(signatures);
|
|
1104
1122
|
}
|
|
1105
1123
|
|
|
1106
|
-
public flushTxs(): Promise<void> {
|
|
1107
|
-
if (!this.sequencer) {
|
|
1108
|
-
throw new Error(`Sequencer is not initialized`);
|
|
1109
|
-
}
|
|
1110
|
-
this.sequencer.flush();
|
|
1111
|
-
return Promise.resolve();
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
1124
|
public getValidatorsStats(): Promise<ValidatorsStats> {
|
|
1115
1125
|
return this.validatorsSentinel?.computeStats() ?? Promise.resolve({ stats: {}, slotWindow: 0 });
|
|
1116
1126
|
}
|
|
@@ -1201,6 +1211,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1201
1211
|
return Promise.resolve();
|
|
1202
1212
|
}
|
|
1203
1213
|
|
|
1214
|
+
public getSlasherMonitoredPayloads(): Promise<MonitoredSlashPayload[]> {
|
|
1215
|
+
if (!this.slasherClient) {
|
|
1216
|
+
throw new Error('Slasher client is not initialized.');
|
|
1217
|
+
}
|
|
1218
|
+
return Promise.resolve(this.slasherClient.getMonitoredPayloads());
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1204
1221
|
/**
|
|
1205
1222
|
* Returns an instance of MerkleTreeOperations having first ensured the world state is fully synched
|
|
1206
1223
|
* @param blockNumber - The block number at which to get the data.
|
package/src/sentinel/sentinel.ts
CHANGED
|
@@ -5,8 +5,9 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
5
5
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
6
6
|
import { L2TipsMemoryStore, type L2TipsStore } from '@aztec/kv-store/stores';
|
|
7
7
|
import type { P2PClient } from '@aztec/p2p';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
8
|
+
import { Offense } from '@aztec/slasher';
|
|
9
|
+
import type { SlasherConfig, WantToSlashArgs, Watcher, WatcherEmitter } from '@aztec/slasher/config';
|
|
10
|
+
import { WANT_TO_SLASH_EVENT } from '@aztec/slasher/config';
|
|
10
11
|
import {
|
|
11
12
|
type L2BlockSource,
|
|
12
13
|
L2BlockStream,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
getAttestationsFromPublishedL2Block,
|
|
16
17
|
} from '@aztec/stdlib/block';
|
|
17
18
|
import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
18
|
-
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
19
19
|
import type {
|
|
20
20
|
ValidatorStats,
|
|
21
21
|
ValidatorStatusHistory,
|
|
@@ -60,6 +60,10 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
60
60
|
this.runningPromise = new RunningPromise(this.work.bind(this), logger, interval);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
public updateConfig(config: Partial<SlasherConfig>) {
|
|
64
|
+
this.config = { ...this.config, ...config };
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
public async start() {
|
|
64
68
|
await this.init();
|
|
65
69
|
this.runningPromise.start();
|
|
@@ -177,13 +181,7 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
177
181
|
offense: Offense.INACTIVITY,
|
|
178
182
|
}));
|
|
179
183
|
|
|
180
|
-
this.logger.info(`Criminals
|
|
181
|
-
validators: args.map(({ validator, amount, offense }) => ({
|
|
182
|
-
validator,
|
|
183
|
-
amount,
|
|
184
|
-
offense: Offense[offense],
|
|
185
|
-
})),
|
|
186
|
-
});
|
|
184
|
+
this.logger.info(`Criminals: ${criminals.length}`, { args });
|
|
187
185
|
|
|
188
186
|
if (criminals.length > 0) {
|
|
189
187
|
this.emit(WANT_TO_SLASH_EVENT, args);
|