@aztec/aztec-node 1.2.0 → 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/config.d.ts +1 -1
- package/dest/aztec-node/config.d.ts.map +1 -1
- 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 +57 -42
- package/dest/sentinel/factory.d.ts +1 -1
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/sentinel.d.ts +1 -0
- 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/config.ts +2 -1
- package/src/aztec-node/server.ts +81 -62
- package/src/sentinel/factory.ts +1 -1
- package/src/sentinel/sentinel.ts +7 -8
|
@@ -6,8 +6,8 @@ import { type SharedNodeConfig } from '@aztec/node-lib/config';
|
|
|
6
6
|
import { type P2PConfig } from '@aztec/p2p/config';
|
|
7
7
|
import { type ProverClientUserConfig } from '@aztec/prover-client/config';
|
|
8
8
|
import { type SequencerClientConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
|
|
9
|
-
import { type SlasherConfig } from '@aztec/slasher';
|
|
10
9
|
import { type NodeRPCConfig } from '@aztec/stdlib/config';
|
|
10
|
+
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
11
11
|
import { type ValidatorClientConfig } from '@aztec/validator-client/config';
|
|
12
12
|
import { type WorldStateConfig } from '@aztec/world-state/config';
|
|
13
13
|
import { type SentinelConfig } from '../sentinel/config.js';
|
|
@@ -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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EAAE,KAAK,cAAc,EAA0B,MAAM,uBAAuB,CAAC;AAEpF,OAAO,EAAE,6BAA6B,EAAE,KAAK,qBAAqB,EAAE,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,GAC1C,qBAAqB,GACrB,qBAAqB,GACrB,sBAAsB,GACtB,gBAAgB,GAChB,IAAI,CAAC,sBAAsB,EAAE,cAAc,GAAG,oBAAoB,GAAG,YAAY,CAAC,GAClF,SAAS,GACT,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,kBAAkB,GAClB,aAAa,GACb,aAAa,GAAG;IACd,6BAA6B;IAC7B,WAAW,EAAE,mBAAmB,CAAC;IACjC,sDAAsD;IACtD,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEJ,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CAsBvE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,CAElD"}
|
|
@@ -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,yBAAy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, 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,12 +755,19 @@ 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,
|
|
752
766
|
...config
|
|
753
767
|
};
|
|
754
768
|
this.sequencer?.updateSequencerConfig(config);
|
|
769
|
+
this.slasherClient?.updateConfig(config);
|
|
770
|
+
this.validatorsSentinel?.updateConfig(config);
|
|
755
771
|
// this.blockBuilder.updateConfig(config); // TODO: Spyros has a PR to add the builder to `this`, so we can do this
|
|
756
772
|
await this.p2pClient.updateP2PConfig(config);
|
|
757
773
|
if (newConfig.realProofs !== this.config.realProofs) {
|
|
@@ -761,22 +777,15 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
761
777
|
}
|
|
762
778
|
getProtocolContractAddresses() {
|
|
763
779
|
return Promise.resolve({
|
|
764
|
-
|
|
780
|
+
classRegistry: ProtocolContractAddress.ContractClassRegistry,
|
|
765
781
|
feeJuice: ProtocolContractAddress.FeeJuice,
|
|
766
|
-
|
|
782
|
+
instanceRegistry: ProtocolContractAddress.ContractInstanceRegistry,
|
|
767
783
|
multiCallEntrypoint: ProtocolContractAddress.MultiCallEntrypoint
|
|
768
784
|
});
|
|
769
785
|
}
|
|
770
786
|
registerContractFunctionSignatures(signatures) {
|
|
771
787
|
return this.contractDataSource.registerContractFunctionSignatures(signatures);
|
|
772
788
|
}
|
|
773
|
-
flushTxs() {
|
|
774
|
-
if (!this.sequencer) {
|
|
775
|
-
throw new Error(`Sequencer is not initialized`);
|
|
776
|
-
}
|
|
777
|
-
this.sequencer.flush();
|
|
778
|
-
return Promise.resolve();
|
|
779
|
-
}
|
|
780
789
|
getValidatorsStats() {
|
|
781
790
|
return this.validatorsSentinel?.computeStats() ?? Promise.resolve({
|
|
782
791
|
stats: {},
|
|
@@ -856,6 +865,12 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
856
865
|
this.blockSource.resume();
|
|
857
866
|
return Promise.resolve();
|
|
858
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
|
+
}
|
|
859
874
|
/**
|
|
860
875
|
* Returns an instance of MerkleTreeOperations having first ensured the world state is fully synched
|
|
861
876
|
* @param blockNumber - The block number at which to get the data.
|
|
@@ -891,7 +906,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
891
906
|
}
|
|
892
907
|
}
|
|
893
908
|
_ts_decorate([
|
|
894
|
-
trackSpan('AztecNodeService.simulatePublicCalls',
|
|
895
|
-
[Attributes.TX_HASH]:
|
|
909
|
+
trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
910
|
+
[Attributes.TX_HASH]: tx.getTxHash().toString()
|
|
896
911
|
}))
|
|
897
912
|
], AztecNodeService.prototype, "simulatePublicCalls", null);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
2
2
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
3
3
|
import type { P2PClient } from '@aztec/p2p';
|
|
4
|
-
import type { SlasherConfig } from '@aztec/slasher/config';
|
|
5
4
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
5
|
+
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
6
6
|
import type { SentinelConfig } from './config.js';
|
|
7
7
|
import { Sentinel } from './sentinel.js';
|
|
8
8
|
export declare function createSentinel(epochCache: EpochCache, archiver: L2BlockSource, p2p: P2PClient, config: SentinelConfig & DataStoreConfig & SlasherConfig, logger?: import("@aztec/foundation/log").Logger): Promise<Sentinel | undefined>;
|
|
@@ -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,
|
|
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,CAa/B"}
|
|
@@ -26,6 +26,7 @@ export declare class Sentinel extends Sentinel_base implements L2BlockStreamEven
|
|
|
26
26
|
attestors: EthAddress[];
|
|
27
27
|
}>;
|
|
28
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;
|
|
29
30
|
start(): Promise<void>;
|
|
30
31
|
/** Loads initial slot and initializes blockstream. We will not process anything at or before the initial slot. */
|
|
31
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,mCAAmC,CAAC;AACnE,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE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,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/config.ts
CHANGED
|
@@ -11,8 +11,9 @@ import { type SharedNodeConfig, sharedNodeConfigMappings } from '@aztec/node-lib
|
|
|
11
11
|
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
12
12
|
import { type ProverClientUserConfig, proverClientConfigMappings } from '@aztec/prover-client/config';
|
|
13
13
|
import { type SequencerClientConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
|
|
14
|
-
import {
|
|
14
|
+
import { slasherConfigMappings } from '@aztec/slasher';
|
|
15
15
|
import { type NodeRPCConfig, nodeRpcConfigMappings } from '@aztec/stdlib/config';
|
|
16
|
+
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
16
17
|
import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
|
|
17
18
|
import { type WorldStateConfig, worldStateConfigMappings } from '@aztec/world-state/config';
|
|
18
19
|
|
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,17 +61,17 @@ 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
76
|
type WorldStateSyncStatus,
|
|
81
77
|
type WorldStateSynchronizer,
|
|
@@ -84,6 +80,7 @@ import {
|
|
|
84
80
|
import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
85
81
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
86
82
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
83
|
+
import type { MonitoredSlashPayload } from '@aztec/stdlib/slashing';
|
|
87
84
|
import type { NullifierLeafPreimage, PublicDataTreeLeaf, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
88
85
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
89
86
|
import {
|
|
@@ -238,7 +235,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
238
235
|
// attempt snapshot sync if possible
|
|
239
236
|
await trySnapshotSync(config, log);
|
|
240
237
|
|
|
241
|
-
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
|
+
);
|
|
242
245
|
|
|
243
246
|
// now create the merkle trees and the world state synchronizer
|
|
244
247
|
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
@@ -253,8 +256,6 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
253
256
|
}
|
|
254
257
|
const proofVerifier = new QueuedIVCVerifier(config, circuitVerifier);
|
|
255
258
|
|
|
256
|
-
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, { dateProvider });
|
|
257
|
-
|
|
258
259
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
259
260
|
const p2pClient = await createP2PClient(
|
|
260
261
|
P2PClientType.Full,
|
|
@@ -264,6 +265,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
264
265
|
worldStateSynchronizer,
|
|
265
266
|
epochCache,
|
|
266
267
|
packageVersion,
|
|
268
|
+
dateProvider,
|
|
267
269
|
telemetry,
|
|
268
270
|
deps.p2pClientDeps,
|
|
269
271
|
);
|
|
@@ -277,13 +279,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
277
279
|
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? (await getDefaultAllowedSetupFunctions());
|
|
278
280
|
|
|
279
281
|
const blockBuilder = new BlockBuilder(
|
|
280
|
-
{
|
|
281
|
-
l1GenesisTime,
|
|
282
|
-
slotDuration: Number(slotDuration),
|
|
283
|
-
rollupVersion: config.rollupVersion,
|
|
284
|
-
l1ChainId: config.l1ChainId,
|
|
285
|
-
txPublicSetupAllowList: config.txPublicSetupAllowList,
|
|
286
|
-
},
|
|
282
|
+
{ ...config, l1GenesisTime, slotDuration: Number(slotDuration) },
|
|
287
283
|
worldStateSynchronizer,
|
|
288
284
|
archiver,
|
|
289
285
|
dateProvider,
|
|
@@ -303,12 +299,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
303
299
|
|
|
304
300
|
let epochPruneWatcher: EpochPruneWatcher | undefined;
|
|
305
301
|
if (config.slashPruneEnabled) {
|
|
306
|
-
const txCollector = new TxCollector(p2pClient);
|
|
307
302
|
epochPruneWatcher = new EpochPruneWatcher(
|
|
308
303
|
archiver,
|
|
309
304
|
archiver,
|
|
310
305
|
epochCache,
|
|
311
|
-
|
|
306
|
+
p2pClient.getTxProvider(),
|
|
312
307
|
blockBuilder,
|
|
313
308
|
config.slashPrunePenalty,
|
|
314
309
|
config.slashPruneMaxPenalty,
|
|
@@ -316,6 +311,15 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
316
311
|
await epochPruneWatcher.start();
|
|
317
312
|
watchers.push(epochPruneWatcher);
|
|
318
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
|
+
|
|
319
323
|
const validatorClient = createValidatorClient(config, {
|
|
320
324
|
p2pClient,
|
|
321
325
|
telemetry,
|
|
@@ -332,30 +336,38 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
332
336
|
|
|
333
337
|
log.verbose(`All Aztec Node subsystems synced`);
|
|
334
338
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
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();
|
|
351
358
|
|
|
352
359
|
// Validator enabled, create/start relevant service
|
|
360
|
+
let sequencer: SequencerClient | undefined;
|
|
353
361
|
if (!config.disableValidator) {
|
|
354
362
|
// This shouldn't happen, validators need a publisher private key.
|
|
355
|
-
|
|
363
|
+
const { publisherPrivateKey } = config;
|
|
364
|
+
if (!publisherPrivateKey?.getValue() || publisherPrivateKey?.getValue() === NULL_KEY) {
|
|
356
365
|
throw new Error('A publisher private key is required to run a validator');
|
|
357
366
|
}
|
|
358
367
|
|
|
368
|
+
const l1Client = createExtendedL1Client(l1RpcUrls, publisherPrivateKey.getValue(), ethereumChain.chainInfo);
|
|
369
|
+
const l1TxUtils = new L1TxUtilsWithBlobs(l1Client, log, dateProvider, config);
|
|
370
|
+
|
|
359
371
|
sequencer = await SequencerClient.new(config, {
|
|
360
372
|
// if deps were provided, they should override the defaults,
|
|
361
373
|
// or things that we created in this function
|
|
@@ -365,7 +377,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
365
377
|
validatorClient,
|
|
366
378
|
p2pClient,
|
|
367
379
|
worldStateSynchronizer,
|
|
368
|
-
slasherClient
|
|
380
|
+
slasherClient,
|
|
369
381
|
blockBuilder,
|
|
370
382
|
l2BlockSource: archiver,
|
|
371
383
|
l1ToL2MessageSource: archiver,
|
|
@@ -589,7 +601,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
589
601
|
|
|
590
602
|
async #sendTx(tx: Tx) {
|
|
591
603
|
const timer = new Timer();
|
|
592
|
-
const txHash =
|
|
604
|
+
const txHash = tx.getTxHash().toString();
|
|
593
605
|
|
|
594
606
|
const valid = await this.isValidTx(tx);
|
|
595
607
|
if (valid.result !== 'valid') {
|
|
@@ -980,8 +992,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
980
992
|
* Simulates the public part of a transaction with the current state.
|
|
981
993
|
* @param tx - The transaction to simulate.
|
|
982
994
|
**/
|
|
983
|
-
@trackSpan('AztecNodeService.simulatePublicCalls',
|
|
984
|
-
[Attributes.TX_HASH]:
|
|
995
|
+
@trackSpan('AztecNodeService.simulatePublicCalls', (tx: Tx) => ({
|
|
996
|
+
[Attributes.TX_HASH]: tx.getTxHash().toString(),
|
|
985
997
|
}))
|
|
986
998
|
public async simulatePublicCalls(tx: Tx, skipFeeEnforcement = false): Promise<PublicSimulationOutput> {
|
|
987
999
|
// Check total gas limit for simulation
|
|
@@ -998,7 +1010,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
998
1010
|
);
|
|
999
1011
|
}
|
|
1000
1012
|
|
|
1001
|
-
const txHash =
|
|
1013
|
+
const txHash = tx.getTxHash();
|
|
1002
1014
|
const blockNumber = (await this.blockSource.getBlockNumber()) + 1;
|
|
1003
1015
|
|
|
1004
1016
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
@@ -1075,9 +1087,17 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1075
1087
|
return await validator.validateTx(tx);
|
|
1076
1088
|
}
|
|
1077
1089
|
|
|
1078
|
-
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> {
|
|
1079
1097
|
const newConfig = { ...this.config, ...config };
|
|
1080
1098
|
this.sequencer?.updateSequencerConfig(config);
|
|
1099
|
+
this.slasherClient?.updateConfig(config);
|
|
1100
|
+
this.validatorsSentinel?.updateConfig(config);
|
|
1081
1101
|
// this.blockBuilder.updateConfig(config); // TODO: Spyros has a PR to add the builder to `this`, so we can do this
|
|
1082
1102
|
await this.p2pClient.updateP2PConfig(config);
|
|
1083
1103
|
|
|
@@ -1090,9 +1110,9 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1090
1110
|
|
|
1091
1111
|
public getProtocolContractAddresses(): Promise<ProtocolContractAddresses> {
|
|
1092
1112
|
return Promise.resolve({
|
|
1093
|
-
|
|
1113
|
+
classRegistry: ProtocolContractAddress.ContractClassRegistry,
|
|
1094
1114
|
feeJuice: ProtocolContractAddress.FeeJuice,
|
|
1095
|
-
|
|
1115
|
+
instanceRegistry: ProtocolContractAddress.ContractInstanceRegistry,
|
|
1096
1116
|
multiCallEntrypoint: ProtocolContractAddress.MultiCallEntrypoint,
|
|
1097
1117
|
});
|
|
1098
1118
|
}
|
|
@@ -1101,14 +1121,6 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1101
1121
|
return this.contractDataSource.registerContractFunctionSignatures(signatures);
|
|
1102
1122
|
}
|
|
1103
1123
|
|
|
1104
|
-
public flushTxs(): Promise<void> {
|
|
1105
|
-
if (!this.sequencer) {
|
|
1106
|
-
throw new Error(`Sequencer is not initialized`);
|
|
1107
|
-
}
|
|
1108
|
-
this.sequencer.flush();
|
|
1109
|
-
return Promise.resolve();
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
1124
|
public getValidatorsStats(): Promise<ValidatorsStats> {
|
|
1113
1125
|
return this.validatorsSentinel?.computeStats() ?? Promise.resolve({ stats: {}, slotWindow: 0 });
|
|
1114
1126
|
}
|
|
@@ -1199,6 +1211,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1199
1211
|
return Promise.resolve();
|
|
1200
1212
|
}
|
|
1201
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
|
+
|
|
1202
1221
|
/**
|
|
1203
1222
|
* Returns an instance of MerkleTreeOperations having first ensured the world state is fully synched
|
|
1204
1223
|
* @param blockNumber - The block number at which to get the data.
|
package/src/sentinel/factory.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
3
3
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
4
4
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
5
5
|
import type { P2PClient } from '@aztec/p2p';
|
|
6
|
-
import type { SlasherConfig } from '@aztec/slasher/config';
|
|
7
6
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
7
|
+
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
8
8
|
|
|
9
9
|
import type { SentinelConfig } from './config.js';
|
|
10
10
|
import { Sentinel } from './sentinel.js';
|
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 { Offense } from '@aztec/slasher';
|
|
8
9
|
import type { SlasherConfig, WantToSlashArgs, Watcher, WatcherEmitter } from '@aztec/slasher/config';
|
|
9
|
-
import {
|
|
10
|
+
import { WANT_TO_SLASH_EVENT } from '@aztec/slasher/config';
|
|
10
11
|
import {
|
|
11
12
|
type L2BlockSource,
|
|
12
13
|
L2BlockStream,
|
|
@@ -59,6 +60,10 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
59
60
|
this.runningPromise = new RunningPromise(this.work.bind(this), logger, interval);
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
public updateConfig(config: Partial<SlasherConfig>) {
|
|
64
|
+
this.config = { ...this.config, ...config };
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
public async start() {
|
|
63
68
|
await this.init();
|
|
64
69
|
this.runningPromise.start();
|
|
@@ -176,13 +181,7 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
176
181
|
offense: Offense.INACTIVITY,
|
|
177
182
|
}));
|
|
178
183
|
|
|
179
|
-
this.logger.info(`Criminals
|
|
180
|
-
validators: args.map(({ validator, amount, offense }) => ({
|
|
181
|
-
validator,
|
|
182
|
-
amount,
|
|
183
|
-
offense: Offense[offense],
|
|
184
|
-
})),
|
|
185
|
-
});
|
|
184
|
+
this.logger.info(`Criminals: ${criminals.length}`, { args });
|
|
186
185
|
|
|
187
186
|
if (criminals.length > 0) {
|
|
188
187
|
this.emit(WANT_TO_SLASH_EVENT, args);
|