@aztec/aztec-node 0.0.1-commit.8f9871590 → 0.0.1-commit.9117c5f5a
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 +7 -4
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +10 -2
- package/dest/aztec-node/server.d.ts +19 -6
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +226 -80
- package/dest/sentinel/sentinel.d.ts +1 -1
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +15 -8
- package/package.json +27 -25
- package/src/aztec-node/config.ts +24 -8
- package/src/aztec-node/server.ts +293 -98
- package/src/sentinel/sentinel.ts +15 -6
|
@@ -374,12 +374,13 @@ var _dec, _initProto;
|
|
|
374
374
|
import { createArchiver } from '@aztec/archiver';
|
|
375
375
|
import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
376
376
|
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
377
|
+
import { Blob } from '@aztec/blob-lib';
|
|
377
378
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
378
379
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
379
380
|
import { getPublicClient } from '@aztec/ethereum/client';
|
|
380
381
|
import { RegistryContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
381
382
|
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
382
|
-
import { compactArray, pick } from '@aztec/foundation/collection';
|
|
383
|
+
import { compactArray, pick, unique } from '@aztec/foundation/collection';
|
|
383
384
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
384
385
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
385
386
|
import { BadRequestError } from '@aztec/foundation/json-rpc';
|
|
@@ -389,9 +390,11 @@ import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
|
389
390
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
390
391
|
import { KeystoreManager, loadKeystores, mergeKeystores } from '@aztec/node-keystore';
|
|
391
392
|
import { trySnapshotSync, uploadSnapshot } from '@aztec/node-lib/actions';
|
|
392
|
-
import {
|
|
393
|
-
import { createP2PClient, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
393
|
+
import { createForwarderL1TxUtilsFromSigners, createL1TxUtilsFromSigners } from '@aztec/node-lib/factories';
|
|
394
|
+
import { createP2PClient, createTxValidatorForAcceptingTxsOverRPC, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
394
395
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
396
|
+
import { createProverNode } from '@aztec/prover-node';
|
|
397
|
+
import { createKeyStoreForProver } from '@aztec/prover-node/config';
|
|
395
398
|
import { GlobalVariableBuilder, SequencerClient } from '@aztec/sequencer-client';
|
|
396
399
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
397
400
|
import { AttestationsBlockWatcher, EpochPruneWatcher, createSlasher } from '@aztec/slasher';
|
|
@@ -402,13 +405,13 @@ import { GasFees } from '@aztec/stdlib/gas';
|
|
|
402
405
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
403
406
|
import { AztecNodeAdminConfigSchema } from '@aztec/stdlib/interfaces/client';
|
|
404
407
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
408
|
+
import { InMemoryDebugLogStore, NullDebugLogStore } from '@aztec/stdlib/logs';
|
|
405
409
|
import { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
406
|
-
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
407
410
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
408
411
|
import { PublicSimulationOutput, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
409
412
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
410
413
|
import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
411
|
-
import { FullNodeCheckpointsBuilder as CheckpointsBuilder, FullNodeCheckpointsBuilder, NodeKeystoreAdapter, ValidatorClient, createBlockProposalHandler, createValidatorClient
|
|
414
|
+
import { FullNodeCheckpointsBuilder as CheckpointsBuilder, FullNodeCheckpointsBuilder, NodeKeystoreAdapter, ValidatorClient, createBlockProposalHandler, createValidatorClient } from '@aztec/validator-client';
|
|
412
415
|
import { createWorldStateSynchronizer } from '@aztec/world-state';
|
|
413
416
|
import { createPublicClient, fallback, http } from 'viem';
|
|
414
417
|
import { createSentinel } from '../sentinel/factory.js';
|
|
@@ -428,6 +431,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
428
431
|
l1ToL2MessageSource;
|
|
429
432
|
worldStateSynchronizer;
|
|
430
433
|
sequencer;
|
|
434
|
+
proverNode;
|
|
431
435
|
slasherClient;
|
|
432
436
|
validatorsSentinel;
|
|
433
437
|
epochPruneWatcher;
|
|
@@ -440,6 +444,9 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
440
444
|
telemetry;
|
|
441
445
|
log;
|
|
442
446
|
blobClient;
|
|
447
|
+
validatorClient;
|
|
448
|
+
keyStoreManager;
|
|
449
|
+
debugLogStore;
|
|
443
450
|
static{
|
|
444
451
|
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
445
452
|
[
|
|
@@ -454,7 +461,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
454
461
|
// Prevent two snapshot operations to happen simultaneously
|
|
455
462
|
isUploadingSnapshot;
|
|
456
463
|
tracer;
|
|
457
|
-
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource, worldStateSynchronizer, sequencer, slasherClient, validatorsSentinel, epochPruneWatcher, l1ChainId, version, globalVariableBuilder, epochCache, packageVersion, proofVerifier, telemetry = getTelemetryClient(), log = createLogger('node'), blobClient){
|
|
464
|
+
constructor(config, p2pClient, blockSource, logsSource, contractDataSource, l1ToL2MessageSource, worldStateSynchronizer, sequencer, proverNode, slasherClient, validatorsSentinel, epochPruneWatcher, l1ChainId, version, globalVariableBuilder, epochCache, packageVersion, proofVerifier, telemetry = getTelemetryClient(), log = createLogger('node'), blobClient, validatorClient, keyStoreManager, debugLogStore = new NullDebugLogStore()){
|
|
458
465
|
this.config = config;
|
|
459
466
|
this.p2pClient = p2pClient;
|
|
460
467
|
this.blockSource = blockSource;
|
|
@@ -463,6 +470,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
463
470
|
this.l1ToL2MessageSource = l1ToL2MessageSource;
|
|
464
471
|
this.worldStateSynchronizer = worldStateSynchronizer;
|
|
465
472
|
this.sequencer = sequencer;
|
|
473
|
+
this.proverNode = proverNode;
|
|
466
474
|
this.slasherClient = slasherClient;
|
|
467
475
|
this.validatorsSentinel = validatorsSentinel;
|
|
468
476
|
this.epochPruneWatcher = epochPruneWatcher;
|
|
@@ -475,12 +483,21 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
475
483
|
this.telemetry = telemetry;
|
|
476
484
|
this.log = log;
|
|
477
485
|
this.blobClient = blobClient;
|
|
486
|
+
this.validatorClient = validatorClient;
|
|
487
|
+
this.keyStoreManager = keyStoreManager;
|
|
488
|
+
this.debugLogStore = debugLogStore;
|
|
478
489
|
this.initialHeaderHashPromise = (_initProto(this), undefined);
|
|
479
490
|
this.isUploadingSnapshot = false;
|
|
480
491
|
this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
|
|
481
492
|
this.tracer = telemetry.getTracer('AztecNodeService');
|
|
482
493
|
this.log.info(`Aztec Node version: ${this.packageVersion}`);
|
|
483
494
|
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config.l1Contracts);
|
|
495
|
+
// A defensive check that protects us against introducing a bug in the complex `createAndSync` function. We must
|
|
496
|
+
// never have debugLogStore enabled when not in test mode because then we would be accumulating debug logs in
|
|
497
|
+
// memory which could be a DoS vector on the sequencer (since no fees are paid for debug logs).
|
|
498
|
+
if (debugLogStore.isEnabled && config.realProofs) {
|
|
499
|
+
throw new Error('debugLogStore should never be enabled when realProofs are set');
|
|
500
|
+
}
|
|
484
501
|
}
|
|
485
502
|
async getWorldStateSyncStatus() {
|
|
486
503
|
const status = await this.worldStateSynchronizer.status();
|
|
@@ -502,16 +519,27 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
502
519
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
503
520
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
504
521
|
const ethereumChain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
505
|
-
// Build a key store from file if given or from environment otherwise
|
|
522
|
+
// Build a key store from file if given or from environment otherwise.
|
|
523
|
+
// We keep the raw KeyStore available so we can merge with prover keys if enableProverNode is set.
|
|
506
524
|
let keyStoreManager;
|
|
507
525
|
const keyStoreProvided = config.keyStoreDirectory !== undefined && config.keyStoreDirectory.length > 0;
|
|
508
526
|
if (keyStoreProvided) {
|
|
509
527
|
const keyStores = loadKeystores(config.keyStoreDirectory);
|
|
510
528
|
keyStoreManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
511
529
|
} else {
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
|
|
530
|
+
const rawKeyStores = [];
|
|
531
|
+
const validatorKeyStore = createKeyStoreForValidator(config);
|
|
532
|
+
if (validatorKeyStore) {
|
|
533
|
+
rawKeyStores.push(validatorKeyStore);
|
|
534
|
+
}
|
|
535
|
+
if (config.enableProverNode) {
|
|
536
|
+
const proverKeyStore = createKeyStoreForProver(config);
|
|
537
|
+
if (proverKeyStore) {
|
|
538
|
+
rawKeyStores.push(proverKeyStore);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (rawKeyStores.length > 0) {
|
|
542
|
+
keyStoreManager = new KeystoreManager(rawKeyStores.length === 1 ? rawKeyStores[0] : mergeKeystores(rawKeyStores));
|
|
515
543
|
}
|
|
516
544
|
}
|
|
517
545
|
await keyStoreManager?.validateSigners();
|
|
@@ -520,8 +548,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
520
548
|
if (keyStoreManager === undefined) {
|
|
521
549
|
throw new Error('Failed to create key store, a requirement for running a validator');
|
|
522
550
|
}
|
|
523
|
-
if (!keyStoreProvided) {
|
|
524
|
-
log.warn(
|
|
551
|
+
if (!keyStoreProvided && process.env.NODE_ENV !== 'test') {
|
|
552
|
+
log.warn("Keystore created from env: it's recommended to use a file-based key store for production");
|
|
525
553
|
}
|
|
526
554
|
ValidatorClient.validateKeyStoreConfiguration(keyStoreManager, log);
|
|
527
555
|
}
|
|
@@ -552,7 +580,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
552
580
|
if (config.rollupVersion !== Number(rollupVersionFromRollup)) {
|
|
553
581
|
log.warn(`Registry looked up and returned a rollup with version (${config.rollupVersion}), but this does not match with version detected from the rollup directly: (${rollupVersionFromRollup}).`);
|
|
554
582
|
}
|
|
555
|
-
const blobClient = await createBlobClientWithFileStores(config,
|
|
583
|
+
const blobClient = await createBlobClientWithFileStores(config, log.createChild('blob-client'));
|
|
556
584
|
// attempt snapshot sync if possible
|
|
557
585
|
await trySnapshotSync(config, log);
|
|
558
586
|
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, {
|
|
@@ -569,77 +597,92 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
569
597
|
// now create the merkle trees and the world state synchronizer
|
|
570
598
|
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, options.prefilledPublicData, telemetry);
|
|
571
599
|
const circuitVerifier = config.realProofs || config.debugForceTxProofVerification ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier(config.proverTestVerificationDelayMs);
|
|
600
|
+
let debugLogStore;
|
|
572
601
|
if (!config.realProofs) {
|
|
573
602
|
log.warn(`Aztec node is accepting fake proofs`);
|
|
603
|
+
debugLogStore = new InMemoryDebugLogStore();
|
|
604
|
+
log.info('Aztec node started in test mode (realProofs set to false) hence debug logs from public functions will be collected and served');
|
|
605
|
+
} else {
|
|
606
|
+
debugLogStore = new NullDebugLogStore();
|
|
574
607
|
}
|
|
575
608
|
const proofVerifier = new QueuedIVCVerifier(config, circuitVerifier);
|
|
609
|
+
const proverOnly = config.enableProverNode && config.disableValidator;
|
|
610
|
+
if (proverOnly) {
|
|
611
|
+
log.info('Starting in prover-only mode: skipping validator, sequencer, sentinel, and slasher subsystems');
|
|
612
|
+
}
|
|
576
613
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
577
|
-
const p2pClient = await createP2PClient(
|
|
614
|
+
const p2pClient = await createP2PClient(config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, dateProvider, telemetry, deps.p2pClientDeps);
|
|
578
615
|
// We should really not be modifying the config object
|
|
579
616
|
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
|
|
580
|
-
//
|
|
617
|
+
// We'll accumulate sentinel watchers here
|
|
618
|
+
const watchers = [];
|
|
619
|
+
// Create FullNodeCheckpointsBuilder for block proposal handling and tx validation
|
|
581
620
|
const validatorCheckpointsBuilder = new FullNodeCheckpointsBuilder({
|
|
582
621
|
...config,
|
|
583
622
|
l1GenesisTime,
|
|
584
623
|
slotDuration: Number(slotDuration)
|
|
585
624
|
}, worldStateSynchronizer, archiver, dateProvider, telemetry);
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
checkpointsBuilder: validatorCheckpointsBuilder,
|
|
591
|
-
worldState: worldStateSynchronizer,
|
|
592
|
-
p2pClient,
|
|
593
|
-
telemetry,
|
|
594
|
-
dateProvider,
|
|
595
|
-
epochCache,
|
|
596
|
-
blockSource: archiver,
|
|
597
|
-
l1ToL2MessageSource: archiver,
|
|
598
|
-
keyStoreManager,
|
|
599
|
-
blobClient
|
|
600
|
-
});
|
|
601
|
-
// If we have a validator client, register it as a source of offenses for the slasher,
|
|
602
|
-
// and have it register callbacks on the p2p client *before* we start it, otherwise messages
|
|
603
|
-
// like attestations or auths will fail.
|
|
604
|
-
if (validatorClient) {
|
|
605
|
-
watchers.push(validatorClient);
|
|
606
|
-
if (!options.dontStartSequencer) {
|
|
607
|
-
await validatorClient.registerHandlers();
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
// If there's no validator client but alwaysReexecuteBlockProposals is enabled,
|
|
611
|
-
// create a BlockProposalHandler to reexecute block proposals for monitoring
|
|
612
|
-
if (!validatorClient && config.alwaysReexecuteBlockProposals) {
|
|
613
|
-
log.info('Setting up block proposal reexecution for monitoring');
|
|
614
|
-
createBlockProposalHandler(config, {
|
|
625
|
+
let validatorClient;
|
|
626
|
+
if (!proverOnly) {
|
|
627
|
+
// Create validator client if required
|
|
628
|
+
validatorClient = await createValidatorClient(config, {
|
|
615
629
|
checkpointsBuilder: validatorCheckpointsBuilder,
|
|
616
630
|
worldState: worldStateSynchronizer,
|
|
631
|
+
p2pClient,
|
|
632
|
+
telemetry,
|
|
633
|
+
dateProvider,
|
|
617
634
|
epochCache,
|
|
618
635
|
blockSource: archiver,
|
|
619
636
|
l1ToL2MessageSource: archiver,
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
637
|
+
keyStoreManager,
|
|
638
|
+
blobClient
|
|
639
|
+
});
|
|
640
|
+
// If we have a validator client, register it as a source of offenses for the slasher,
|
|
641
|
+
// and have it register callbacks on the p2p client *before* we start it, otherwise messages
|
|
642
|
+
// like attestations or auths will fail.
|
|
643
|
+
if (validatorClient) {
|
|
644
|
+
watchers.push(validatorClient);
|
|
645
|
+
if (!options.dontStartSequencer) {
|
|
646
|
+
await validatorClient.registerHandlers();
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// If there's no validator client but alwaysReexecuteBlockProposals is enabled,
|
|
650
|
+
// create a BlockProposalHandler to reexecute block proposals for monitoring
|
|
651
|
+
if (!validatorClient && config.alwaysReexecuteBlockProposals) {
|
|
652
|
+
log.info('Setting up block proposal reexecution for monitoring');
|
|
653
|
+
createBlockProposalHandler(config, {
|
|
654
|
+
checkpointsBuilder: validatorCheckpointsBuilder,
|
|
655
|
+
worldState: worldStateSynchronizer,
|
|
656
|
+
epochCache,
|
|
657
|
+
blockSource: archiver,
|
|
658
|
+
l1ToL2MessageSource: archiver,
|
|
659
|
+
p2pClient,
|
|
660
|
+
dateProvider,
|
|
661
|
+
telemetry
|
|
662
|
+
}).registerForReexecution(p2pClient);
|
|
663
|
+
}
|
|
624
664
|
}
|
|
625
665
|
// Start world state and wait for it to sync to the archiver.
|
|
626
666
|
await worldStateSynchronizer.start();
|
|
627
667
|
// Start p2p. Note that it depends on world state to be running.
|
|
628
668
|
await p2pClient.start();
|
|
629
|
-
|
|
630
|
-
if (validatorsSentinel && config.slashInactivityPenalty > 0n) {
|
|
631
|
-
watchers.push(validatorsSentinel);
|
|
632
|
-
}
|
|
669
|
+
let validatorsSentinel;
|
|
633
670
|
let epochPruneWatcher;
|
|
634
|
-
if (config.slashPrunePenalty > 0n || config.slashDataWithholdingPenalty > 0n) {
|
|
635
|
-
epochPruneWatcher = new EpochPruneWatcher(archiver, archiver, epochCache, p2pClient.getTxProvider(), validatorCheckpointsBuilder, config);
|
|
636
|
-
watchers.push(epochPruneWatcher);
|
|
637
|
-
}
|
|
638
|
-
// We assume we want to slash for invalid attestations unless all max penalties are set to 0
|
|
639
671
|
let attestationsBlockWatcher;
|
|
640
|
-
if (
|
|
641
|
-
|
|
642
|
-
|
|
672
|
+
if (!proverOnly) {
|
|
673
|
+
validatorsSentinel = await createSentinel(epochCache, archiver, p2pClient, config);
|
|
674
|
+
if (validatorsSentinel && config.slashInactivityPenalty > 0n) {
|
|
675
|
+
watchers.push(validatorsSentinel);
|
|
676
|
+
}
|
|
677
|
+
if (config.slashPrunePenalty > 0n || config.slashDataWithholdingPenalty > 0n) {
|
|
678
|
+
epochPruneWatcher = new EpochPruneWatcher(archiver, archiver, epochCache, p2pClient.getTxProvider(), validatorCheckpointsBuilder, config);
|
|
679
|
+
watchers.push(epochPruneWatcher);
|
|
680
|
+
}
|
|
681
|
+
// We assume we want to slash for invalid attestations unless all max penalties are set to 0
|
|
682
|
+
if (config.slashProposeInvalidAttestationsPenalty > 0n || config.slashAttestDescendantOfInvalidPenalty > 0n) {
|
|
683
|
+
attestationsBlockWatcher = new AttestationsBlockWatcher(archiver, epochCache, config);
|
|
684
|
+
watchers.push(attestationsBlockWatcher);
|
|
685
|
+
}
|
|
643
686
|
}
|
|
644
687
|
// Start p2p-related services once the archiver has completed sync
|
|
645
688
|
void archiver.waitForInitialSync().then(async ()=>{
|
|
@@ -658,27 +701,29 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
658
701
|
const validatorAddresses = keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager).getAddresses() : [];
|
|
659
702
|
slasherClient = await createSlasher(config, config.l1Contracts, getPublicClient(config), watchers, dateProvider, epochCache, validatorAddresses, undefined);
|
|
660
703
|
await slasherClient.start();
|
|
661
|
-
const l1TxUtils = config.
|
|
704
|
+
const l1TxUtils = config.sequencerPublisherForwarderAddress ? await createForwarderL1TxUtilsFromSigners(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), config.sequencerPublisherForwarderAddress, {
|
|
662
705
|
...config,
|
|
663
706
|
scope: 'sequencer'
|
|
664
707
|
}, {
|
|
665
708
|
telemetry,
|
|
666
709
|
logger: log.createChild('l1-tx-utils'),
|
|
667
|
-
dateProvider
|
|
668
|
-
|
|
710
|
+
dateProvider,
|
|
711
|
+
kzg: Blob.getViemKzgInstance()
|
|
712
|
+
}) : await createL1TxUtilsFromSigners(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), {
|
|
669
713
|
...config,
|
|
670
714
|
scope: 'sequencer'
|
|
671
715
|
}, {
|
|
672
716
|
telemetry,
|
|
673
717
|
logger: log.createChild('l1-tx-utils'),
|
|
674
|
-
dateProvider
|
|
718
|
+
dateProvider,
|
|
719
|
+
kzg: Blob.getViemKzgInstance()
|
|
675
720
|
});
|
|
676
721
|
// Create and start the sequencer client
|
|
677
722
|
const checkpointsBuilder = new CheckpointsBuilder({
|
|
678
723
|
...config,
|
|
679
724
|
l1GenesisTime,
|
|
680
725
|
slotDuration: Number(slotDuration)
|
|
681
|
-
}, worldStateSynchronizer, archiver, dateProvider, telemetry);
|
|
726
|
+
}, worldStateSynchronizer, archiver, dateProvider, telemetry, debugLogStore);
|
|
682
727
|
sequencer = await SequencerClient.new(config, {
|
|
683
728
|
...deps,
|
|
684
729
|
epochCache,
|
|
@@ -702,13 +747,35 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
702
747
|
} else if (sequencer) {
|
|
703
748
|
log.warn(`Sequencer created but not started`);
|
|
704
749
|
}
|
|
750
|
+
// Create prover node subsystem if enabled
|
|
751
|
+
let proverNode;
|
|
752
|
+
if (config.enableProverNode) {
|
|
753
|
+
proverNode = await createProverNode(config, {
|
|
754
|
+
...deps.proverNodeDeps,
|
|
755
|
+
telemetry,
|
|
756
|
+
dateProvider,
|
|
757
|
+
archiver,
|
|
758
|
+
worldStateSynchronizer,
|
|
759
|
+
p2pClient,
|
|
760
|
+
epochCache,
|
|
761
|
+
blobClient,
|
|
762
|
+
keyStoreManager
|
|
763
|
+
});
|
|
764
|
+
if (!options.dontStartProverNode) {
|
|
765
|
+
await proverNode.start();
|
|
766
|
+
log.info(`Prover node subsystem started`);
|
|
767
|
+
} else {
|
|
768
|
+
log.info(`Prover node subsystem created but not started`);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
705
771
|
const globalVariableBuilder = new GlobalVariableBuilder({
|
|
706
772
|
...config,
|
|
707
773
|
rollupVersion: BigInt(config.rollupVersion),
|
|
708
774
|
l1GenesisTime,
|
|
709
775
|
slotDuration: Number(slotDuration)
|
|
710
776
|
});
|
|
711
|
-
|
|
777
|
+
const node = new AztecNodeService(config, p2pClient, archiver, archiver, archiver, archiver, worldStateSynchronizer, sequencer, proverNode, slasherClient, validatorsSentinel, epochPruneWatcher, ethereumChain.chainInfo.id, config.rollupVersion, globalVariableBuilder, epochCache, packageVersion, proofVerifier, telemetry, log, blobClient, validatorClient, keyStoreManager, debugLogStore);
|
|
778
|
+
return node;
|
|
712
779
|
}
|
|
713
780
|
/**
|
|
714
781
|
* Returns the sequencer client instance.
|
|
@@ -716,6 +783,9 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
716
783
|
*/ getSequencer() {
|
|
717
784
|
return this.sequencer;
|
|
718
785
|
}
|
|
786
|
+
/** Returns the prover node subsystem, if enabled. */ getProverNode() {
|
|
787
|
+
return this.proverNode;
|
|
788
|
+
}
|
|
719
789
|
getBlockSource() {
|
|
720
790
|
return this.blockSource;
|
|
721
791
|
}
|
|
@@ -921,8 +991,9 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
921
991
|
throw new Error(`Invalid tx: ${reason}`);
|
|
922
992
|
}
|
|
923
993
|
await this.p2pClient.sendTx(tx);
|
|
924
|
-
|
|
925
|
-
this.
|
|
994
|
+
const duration = timer.ms();
|
|
995
|
+
this.metrics.receivedTx(duration, true);
|
|
996
|
+
this.log.info(`Received tx ${txHash} in ${duration}ms`, {
|
|
926
997
|
txHash
|
|
927
998
|
});
|
|
928
999
|
}
|
|
@@ -933,18 +1004,20 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
933
1004
|
const isKnownToPool = txPoolStatus === 'pending' || txPoolStatus === 'mined';
|
|
934
1005
|
// Then get the actual tx from the archiver, which tracks every tx in a mined block.
|
|
935
1006
|
const settledTxReceipt = await this.blockSource.getSettledTxReceipt(txHash);
|
|
1007
|
+
let receipt;
|
|
936
1008
|
if (settledTxReceipt) {
|
|
937
|
-
|
|
938
|
-
return settledTxReceipt;
|
|
1009
|
+
receipt = settledTxReceipt;
|
|
939
1010
|
} else if (isKnownToPool) {
|
|
940
1011
|
// If the tx is in the pool but not in the archiver, it's pending.
|
|
941
1012
|
// This handles race conditions between archiver and p2p, where the archiver
|
|
942
1013
|
// has pruned the block in which a tx was mined, but p2p has not caught up yet.
|
|
943
|
-
|
|
1014
|
+
receipt = new TxReceipt(txHash, TxStatus.PENDING, undefined, undefined);
|
|
944
1015
|
} else {
|
|
945
1016
|
// Otherwise, if we don't know the tx, we consider it dropped.
|
|
946
|
-
|
|
1017
|
+
receipt = new TxReceipt(txHash, TxStatus.DROPPED, undefined, 'Tx dropped by P2P node');
|
|
947
1018
|
}
|
|
1019
|
+
this.debugLogStore.decorateReceiptWithLogs(txHash.toString(), receipt);
|
|
1020
|
+
return receipt;
|
|
948
1021
|
}
|
|
949
1022
|
getTxEffect(txHash) {
|
|
950
1023
|
return this.blockSource.getTxEffect(txHash);
|
|
@@ -958,6 +1031,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
958
1031
|
await tryStop(this.slasherClient);
|
|
959
1032
|
await tryStop(this.proofVerifier);
|
|
960
1033
|
await tryStop(this.sequencer);
|
|
1034
|
+
await tryStop(this.proverNode);
|
|
961
1035
|
await tryStop(this.p2pClient);
|
|
962
1036
|
await tryStop(this.worldStateSynchronizer);
|
|
963
1037
|
await tryStop(this.blockSource);
|
|
@@ -1195,6 +1269,12 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1195
1269
|
*/ async getBlockHeaderByArchive(archive) {
|
|
1196
1270
|
return await this.blockSource.getBlockHeaderByArchive(archive);
|
|
1197
1271
|
}
|
|
1272
|
+
getBlockData(number) {
|
|
1273
|
+
return this.blockSource.getBlockData(number);
|
|
1274
|
+
}
|
|
1275
|
+
getBlockDataByArchive(archive) {
|
|
1276
|
+
return this.blockSource.getBlockDataByArchive(archive);
|
|
1277
|
+
}
|
|
1198
1278
|
/**
|
|
1199
1279
|
* Simulates the public part of a transaction with the current state.
|
|
1200
1280
|
* @param tx - The transaction to simulate.
|
|
@@ -1207,7 +1287,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1207
1287
|
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
1208
1288
|
}
|
|
1209
1289
|
const txHash = tx.getTxHash();
|
|
1210
|
-
const
|
|
1290
|
+
const latestBlockNumber = await this.blockSource.getBlockNumber();
|
|
1291
|
+
const blockNumber = BlockNumber.add(latestBlockNumber, 1);
|
|
1211
1292
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
1212
1293
|
const coinbase = EthAddress.ZERO;
|
|
1213
1294
|
const feeRecipient = AztecAddress.ZERO;
|
|
@@ -1218,10 +1299,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1218
1299
|
txHash,
|
|
1219
1300
|
blockNumber
|
|
1220
1301
|
});
|
|
1221
|
-
// Ensure world
|
|
1222
|
-
|
|
1223
|
-
// (e.g. L1-to-L2 message existence checks) to fail against stale state.
|
|
1224
|
-
await this.#syncWorldState();
|
|
1302
|
+
// Ensure world-state has caught up with the latest block we loaded from the archiver
|
|
1303
|
+
await this.worldStateSynchronizer.syncImmediate(latestBlockNumber);
|
|
1225
1304
|
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
1226
1305
|
try {
|
|
1227
1306
|
const config = PublicSimulatorConfig.from({
|
|
@@ -1236,7 +1315,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1236
1315
|
});
|
|
1237
1316
|
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, config);
|
|
1238
1317
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
1239
|
-
const [processedTxs, failedTxs, _usedTxs, returns] = await processor.process([
|
|
1318
|
+
const [processedTxs, failedTxs, _usedTxs, returns, _blobFields, debugLogs] = await processor.process([
|
|
1240
1319
|
tx
|
|
1241
1320
|
]);
|
|
1242
1321
|
// REFACTOR: Consider returning the error rather than throwing
|
|
@@ -1247,7 +1326,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1247
1326
|
throw failedTxs[0].error;
|
|
1248
1327
|
}
|
|
1249
1328
|
const [processedTx] = processedTxs;
|
|
1250
|
-
return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed);
|
|
1329
|
+
return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed, debugLogs);
|
|
1251
1330
|
} finally{
|
|
1252
1331
|
await merkleTreeFork.close();
|
|
1253
1332
|
}
|
|
@@ -1258,7 +1337,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1258
1337
|
// We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field)
|
|
1259
1338
|
const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
1260
1339
|
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
1261
|
-
const validator =
|
|
1340
|
+
const validator = createTxValidatorForAcceptingTxsOverRPC(db, this.contractDataSource, verifier, {
|
|
1262
1341
|
timestamp: nextSlotTimestamp,
|
|
1263
1342
|
blockNumber,
|
|
1264
1343
|
l1ChainId: this.l1ChainId,
|
|
@@ -1409,6 +1488,73 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1409
1488
|
return this.slasherClient.gatherOffensesForRound(round === 'current' ? undefined : BigInt(round));
|
|
1410
1489
|
}
|
|
1411
1490
|
}
|
|
1491
|
+
async reloadKeystore() {
|
|
1492
|
+
if (!this.config.keyStoreDirectory?.length) {
|
|
1493
|
+
throw new BadRequestError('Cannot reload keystore: node is not using a file-based keystore. ' + 'Set KEY_STORE_DIRECTORY to use file-based keystores.');
|
|
1494
|
+
}
|
|
1495
|
+
if (!this.validatorClient) {
|
|
1496
|
+
throw new BadRequestError('Cannot reload keystore: validator is not enabled.');
|
|
1497
|
+
}
|
|
1498
|
+
this.log.info('Reloading keystore from disk');
|
|
1499
|
+
// Re-read and validate keystore files
|
|
1500
|
+
const keyStores = loadKeystores(this.config.keyStoreDirectory);
|
|
1501
|
+
const newManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
1502
|
+
await newManager.validateSigners();
|
|
1503
|
+
ValidatorClient.validateKeyStoreConfiguration(newManager, this.log);
|
|
1504
|
+
// Validate that every validator's publisher keys overlap with the L1 signers
|
|
1505
|
+
// that were initialized at startup. Publishers cannot be hot-reloaded, so a
|
|
1506
|
+
// validator with a publisher key that doesn't match any existing L1 signer
|
|
1507
|
+
// would silently fail on every proposer slot.
|
|
1508
|
+
if (this.keyStoreManager && this.sequencer) {
|
|
1509
|
+
const oldAdapter = NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager);
|
|
1510
|
+
const availablePublishers = new Set(oldAdapter.getAttesterAddresses().flatMap((a)=>oldAdapter.getPublisherAddresses(a).map((p)=>p.toString().toLowerCase())));
|
|
1511
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1512
|
+
for (const attester of newAdapter.getAttesterAddresses()){
|
|
1513
|
+
const pubs = newAdapter.getPublisherAddresses(attester);
|
|
1514
|
+
if (pubs.length > 0 && !pubs.some((p)=>availablePublishers.has(p.toString().toLowerCase()))) {
|
|
1515
|
+
throw new BadRequestError(`Cannot reload keystore: validator ${attester} has publisher keys ` + `[${pubs.map((p)=>p.toString()).join(', ')}] but none match the L1 signers initialized at startup ` + `[${[
|
|
1516
|
+
...availablePublishers
|
|
1517
|
+
].join(', ')}]. Publishers cannot be hot-reloaded — ` + `use an existing publisher key or restart the node.`);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
// Build adapters for old and new keystores to compute diff
|
|
1522
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1523
|
+
const newAddresses = newAdapter.getAttesterAddresses();
|
|
1524
|
+
const oldAddresses = this.keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager).getAttesterAddresses() : [];
|
|
1525
|
+
const oldSet = new Set(oldAddresses.map((a)=>a.toString()));
|
|
1526
|
+
const newSet = new Set(newAddresses.map((a)=>a.toString()));
|
|
1527
|
+
const added = newAddresses.filter((a)=>!oldSet.has(a.toString()));
|
|
1528
|
+
const removed = oldAddresses.filter((a)=>!newSet.has(a.toString()));
|
|
1529
|
+
if (added.length > 0) {
|
|
1530
|
+
this.log.info(`Keystore reload: adding attester keys: ${added.map((a)=>a.toString()).join(', ')}`);
|
|
1531
|
+
}
|
|
1532
|
+
if (removed.length > 0) {
|
|
1533
|
+
this.log.info(`Keystore reload: removing attester keys: ${removed.map((a)=>a.toString()).join(', ')}`);
|
|
1534
|
+
}
|
|
1535
|
+
if (added.length === 0 && removed.length === 0) {
|
|
1536
|
+
this.log.info('Keystore reload: attester keys unchanged');
|
|
1537
|
+
}
|
|
1538
|
+
// Update the validator client (coinbase, feeRecipient, attester keys)
|
|
1539
|
+
this.validatorClient.reloadKeystore(newManager);
|
|
1540
|
+
// Update the publisher factory's keystore so newly-added validators
|
|
1541
|
+
// can be matched to existing publisher keys when proposing blocks.
|
|
1542
|
+
if (this.sequencer) {
|
|
1543
|
+
this.sequencer.updatePublisherNodeKeyStore(newAdapter);
|
|
1544
|
+
}
|
|
1545
|
+
// Update slasher's "don't-slash-self" list with new validator addresses
|
|
1546
|
+
if (this.slasherClient && !this.config.slashSelfAllowed) {
|
|
1547
|
+
const slashValidatorsNever = unique([
|
|
1548
|
+
...this.config.slashValidatorsNever ?? [],
|
|
1549
|
+
...newAddresses
|
|
1550
|
+
].map((a)=>a.toString())).map(EthAddress.fromString);
|
|
1551
|
+
this.slasherClient.updateConfig({
|
|
1552
|
+
slashValidatorsNever
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
this.keyStoreManager = newManager;
|
|
1556
|
+
this.log.info('Keystore reloaded: coinbase, feeRecipient, and attester keys updated');
|
|
1557
|
+
}
|
|
1412
1558
|
#getInitialHeaderHash() {
|
|
1413
1559
|
if (!this.initialHeaderHashPromise) {
|
|
1414
1560
|
this.initialHeaderHashPromise = this.worldStateSynchronizer.getCommitted().getInitialHeader().hash();
|
|
@@ -90,4 +90,4 @@ export declare class Sentinel extends Sentinel_base implements L2BlockStreamEven
|
|
|
90
90
|
} | undefined;
|
|
91
91
|
}
|
|
92
92
|
export {};
|
|
93
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
93
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VudGluZWwuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZW50aW5lbC9zZW50aW5lbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUNyRCxPQUFPLEVBQWUsZ0JBQWdCLEVBQUUsV0FBVyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXpHLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUUzRCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDbkUsT0FBTyxFQUFxQixLQUFLLFdBQVcsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzdFLE9BQU8sS0FBSyxFQUFFLFNBQVM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AQ,EACR,MAAM,EACN,UAAU,EACX,GAAE;QAAE,QAAQ,CAAC,EAAE,UAAU,CAAC;QAAC,MAAM,CAAC,EAAE,UAAU,CAAC;QAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAA;KAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAmB3G;IAED,6CAA6C;IAChC,iBAAiB,CAC5B,gBAAgB,EAAE,UAAU,EAC5B,QAAQ,CAAC,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAkC3C;IAED,SAAS,CAAC,wBAAwB,CAChC,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,UAAU,EAAE,sBAAsB,EAClC,QAAQ,CAAC,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,UAAU,GAClB,cAAc,CAgBhB;IAED,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,sBAAsB,EAC/B,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,EACpD,MAAM,EAAE,qBAAqB,EAAE;;;;;MAYhC;IAED,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;;;;kBAMrD;CACF"}
|
|
@@ -91,16 +91,14 @@ export class Sentinel extends EventEmitter {
|
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
const blockNumber = event.block.number;
|
|
94
|
-
const
|
|
95
|
-
if (!
|
|
96
|
-
this.logger.error(`Failed to get block ${blockNumber}
|
|
97
|
-
block
|
|
98
|
-
});
|
|
94
|
+
const header = await this.archiver.getBlockHeader(blockNumber);
|
|
95
|
+
if (!header) {
|
|
96
|
+
this.logger.error(`Failed to get block header ${blockNumber}`);
|
|
99
97
|
return;
|
|
100
98
|
}
|
|
101
99
|
// TODO(palla/slash): We should only be computing proven performance if this is
|
|
102
100
|
// a full proof epoch and not a partial one, otherwise we'll end up with skewed stats.
|
|
103
|
-
const epoch = getEpochAtSlot(
|
|
101
|
+
const epoch = getEpochAtSlot(header.getSlot(), this.epochCache.getL1Constants());
|
|
104
102
|
this.logger.debug(`Computing proven performance for epoch ${epoch}`);
|
|
105
103
|
const performance = await this.computeProvenPerformance(epoch);
|
|
106
104
|
this.logger.info(`Computed proven performance for epoch ${epoch}`, performance);
|
|
@@ -109,7 +107,11 @@ export class Sentinel extends EventEmitter {
|
|
|
109
107
|
}
|
|
110
108
|
async computeProvenPerformance(epoch) {
|
|
111
109
|
const [fromSlot, toSlot] = getSlotRangeForEpoch(epoch, this.epochCache.getL1Constants());
|
|
112
|
-
const { committee } = await this.epochCache.getCommittee(fromSlot);
|
|
110
|
+
const { committee, isEscapeHatchOpen } = await this.epochCache.getCommittee(fromSlot);
|
|
111
|
+
if (isEscapeHatchOpen) {
|
|
112
|
+
this.logger.info(`Skipping proven performance for epoch ${epoch} - escape hatch is open`);
|
|
113
|
+
return {};
|
|
114
|
+
}
|
|
113
115
|
if (!committee) {
|
|
114
116
|
this.logger.trace(`No committee found for slot ${fromSlot}`);
|
|
115
117
|
return {};
|
|
@@ -251,7 +253,12 @@ export class Sentinel extends EventEmitter {
|
|
|
251
253
|
* Gathers committee and proposer data for a given slot, computes slot stats,
|
|
252
254
|
* and updates overall stats.
|
|
253
255
|
*/ async processSlot(slot) {
|
|
254
|
-
const { epoch, seed, committee } = await this.epochCache.getCommittee(slot);
|
|
256
|
+
const { epoch, seed, committee, isEscapeHatchOpen } = await this.epochCache.getCommittee(slot);
|
|
257
|
+
if (isEscapeHatchOpen) {
|
|
258
|
+
this.logger.info(`Skipping slot ${slot} at epoch ${epoch} - escape hatch is open`);
|
|
259
|
+
this.lastProcessedSlot = slot;
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
255
262
|
if (!committee || committee.length === 0) {
|
|
256
263
|
this.logger.trace(`No committee found for slot ${slot} at epoch ${epoch}`);
|
|
257
264
|
this.lastProcessedSlot = slot;
|