@aztec/aztec-node 0.0.1-commit.2ed92850 → 0.0.1-commit.358457c
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/node_metrics.d.ts +1 -1
- package/dest/aztec-node/node_metrics.d.ts.map +1 -1
- package/dest/aztec-node/node_metrics.js +8 -4
- package/dest/aztec-node/server.d.ts +32 -21
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +201 -79
- package/dest/sentinel/factory.d.ts +1 -1
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +1 -1
- package/dest/sentinel/sentinel.d.ts +2 -2
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +53 -27
- package/dest/sentinel/store.d.ts +2 -2
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +11 -7
- package/package.json +27 -25
- package/src/aztec-node/config.ts +24 -8
- package/src/aztec-node/node_metrics.ts +12 -5
- package/src/aztec-node/server.ts +274 -120
- package/src/sentinel/factory.ts +1 -6
- package/src/sentinel/sentinel.ts +56 -23
- package/src/sentinel/store.ts +12 -12
|
@@ -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,26 +390,29 @@ 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';
|
|
398
401
|
import { CollectionLimitsConfig, PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
399
402
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
400
|
-
import {
|
|
403
|
+
import { BlockHash, L2Block } from '@aztec/stdlib/block';
|
|
401
404
|
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
410
|
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
407
411
|
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
408
412
|
import { PublicSimulationOutput, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
409
413
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
410
414
|
import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
411
|
-
import { FullNodeCheckpointsBuilder as CheckpointsBuilder, FullNodeCheckpointsBuilder, NodeKeystoreAdapter, ValidatorClient, createBlockProposalHandler, createValidatorClient
|
|
415
|
+
import { FullNodeCheckpointsBuilder as CheckpointsBuilder, FullNodeCheckpointsBuilder, NodeKeystoreAdapter, ValidatorClient, createBlockProposalHandler, createValidatorClient } from '@aztec/validator-client';
|
|
412
416
|
import { createWorldStateSynchronizer } from '@aztec/world-state';
|
|
413
417
|
import { createPublicClient, fallback, http } from 'viem';
|
|
414
418
|
import { createSentinel } from '../sentinel/factory.js';
|
|
@@ -428,6 +432,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
428
432
|
l1ToL2MessageSource;
|
|
429
433
|
worldStateSynchronizer;
|
|
430
434
|
sequencer;
|
|
435
|
+
proverNode;
|
|
431
436
|
slasherClient;
|
|
432
437
|
validatorsSentinel;
|
|
433
438
|
epochPruneWatcher;
|
|
@@ -440,6 +445,9 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
440
445
|
telemetry;
|
|
441
446
|
log;
|
|
442
447
|
blobClient;
|
|
448
|
+
validatorClient;
|
|
449
|
+
keyStoreManager;
|
|
450
|
+
debugLogStore;
|
|
443
451
|
static{
|
|
444
452
|
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
445
453
|
[
|
|
@@ -454,7 +462,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
454
462
|
// Prevent two snapshot operations to happen simultaneously
|
|
455
463
|
isUploadingSnapshot;
|
|
456
464
|
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){
|
|
465
|
+
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
466
|
this.config = config;
|
|
459
467
|
this.p2pClient = p2pClient;
|
|
460
468
|
this.blockSource = blockSource;
|
|
@@ -463,6 +471,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
463
471
|
this.l1ToL2MessageSource = l1ToL2MessageSource;
|
|
464
472
|
this.worldStateSynchronizer = worldStateSynchronizer;
|
|
465
473
|
this.sequencer = sequencer;
|
|
474
|
+
this.proverNode = proverNode;
|
|
466
475
|
this.slasherClient = slasherClient;
|
|
467
476
|
this.validatorsSentinel = validatorsSentinel;
|
|
468
477
|
this.epochPruneWatcher = epochPruneWatcher;
|
|
@@ -475,12 +484,21 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
475
484
|
this.telemetry = telemetry;
|
|
476
485
|
this.log = log;
|
|
477
486
|
this.blobClient = blobClient;
|
|
487
|
+
this.validatorClient = validatorClient;
|
|
488
|
+
this.keyStoreManager = keyStoreManager;
|
|
489
|
+
this.debugLogStore = debugLogStore;
|
|
478
490
|
this.initialHeaderHashPromise = (_initProto(this), undefined);
|
|
479
491
|
this.isUploadingSnapshot = false;
|
|
480
492
|
this.metrics = new NodeMetrics(telemetry, 'AztecNodeService');
|
|
481
493
|
this.tracer = telemetry.getTracer('AztecNodeService');
|
|
482
494
|
this.log.info(`Aztec Node version: ${this.packageVersion}`);
|
|
483
495
|
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config.l1Contracts);
|
|
496
|
+
// A defensive check that protects us against introducing a bug in the complex `createAndSync` function. We must
|
|
497
|
+
// never have debugLogStore enabled when not in test mode because then we would be accumulating debug logs in
|
|
498
|
+
// memory which could be a DoS vector on the sequencer (since no fees are paid for debug logs).
|
|
499
|
+
if (debugLogStore.isEnabled && config.realProofs) {
|
|
500
|
+
throw new Error('debugLogStore should never be enabled when realProofs are set');
|
|
501
|
+
}
|
|
484
502
|
}
|
|
485
503
|
async getWorldStateSyncStatus() {
|
|
486
504
|
const status = await this.worldStateSynchronizer.status();
|
|
@@ -502,16 +520,27 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
502
520
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
503
521
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
504
522
|
const ethereumChain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
505
|
-
// Build a key store from file if given or from environment otherwise
|
|
523
|
+
// Build a key store from file if given or from environment otherwise.
|
|
524
|
+
// We keep the raw KeyStore available so we can merge with prover keys if enableProverNode is set.
|
|
506
525
|
let keyStoreManager;
|
|
507
526
|
const keyStoreProvided = config.keyStoreDirectory !== undefined && config.keyStoreDirectory.length > 0;
|
|
508
527
|
if (keyStoreProvided) {
|
|
509
528
|
const keyStores = loadKeystores(config.keyStoreDirectory);
|
|
510
529
|
keyStoreManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
511
530
|
} else {
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
|
|
531
|
+
const rawKeyStores = [];
|
|
532
|
+
const validatorKeyStore = createKeyStoreForValidator(config);
|
|
533
|
+
if (validatorKeyStore) {
|
|
534
|
+
rawKeyStores.push(validatorKeyStore);
|
|
535
|
+
}
|
|
536
|
+
if (config.enableProverNode) {
|
|
537
|
+
const proverKeyStore = createKeyStoreForProver(config);
|
|
538
|
+
if (proverKeyStore) {
|
|
539
|
+
rawKeyStores.push(proverKeyStore);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (rawKeyStores.length > 0) {
|
|
543
|
+
keyStoreManager = new KeystoreManager(rawKeyStores.length === 1 ? rawKeyStores[0] : mergeKeystores(rawKeyStores));
|
|
515
544
|
}
|
|
516
545
|
}
|
|
517
546
|
await keyStoreManager?.validateSigners();
|
|
@@ -520,8 +549,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
520
549
|
if (keyStoreManager === undefined) {
|
|
521
550
|
throw new Error('Failed to create key store, a requirement for running a validator');
|
|
522
551
|
}
|
|
523
|
-
if (!keyStoreProvided) {
|
|
524
|
-
log.warn(
|
|
552
|
+
if (!keyStoreProvided && process.env.NODE_ENV !== 'test') {
|
|
553
|
+
log.warn("Keystore created from env: it's recommended to use a file-based key store for production");
|
|
525
554
|
}
|
|
526
555
|
ValidatorClient.validateKeyStoreConfiguration(keyStoreManager, log);
|
|
527
556
|
}
|
|
@@ -552,7 +581,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
552
581
|
if (config.rollupVersion !== Number(rollupVersionFromRollup)) {
|
|
553
582
|
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
583
|
}
|
|
555
|
-
const blobClient = await createBlobClientWithFileStores(config,
|
|
584
|
+
const blobClient = await createBlobClientWithFileStores(config, log.createChild('blob-client'));
|
|
556
585
|
// attempt snapshot sync if possible
|
|
557
586
|
await trySnapshotSync(config, log);
|
|
558
587
|
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, {
|
|
@@ -569,8 +598,13 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
569
598
|
// now create the merkle trees and the world state synchronizer
|
|
570
599
|
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, options.prefilledPublicData, telemetry);
|
|
571
600
|
const circuitVerifier = config.realProofs || config.debugForceTxProofVerification ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier(config.proverTestVerificationDelayMs);
|
|
601
|
+
let debugLogStore;
|
|
572
602
|
if (!config.realProofs) {
|
|
573
603
|
log.warn(`Aztec node is accepting fake proofs`);
|
|
604
|
+
debugLogStore = new InMemoryDebugLogStore();
|
|
605
|
+
log.info('Aztec node started in test mode (realProofs set to false) hence debug logs from public functions will be collected and served');
|
|
606
|
+
} else {
|
|
607
|
+
debugLogStore = new NullDebugLogStore();
|
|
574
608
|
}
|
|
575
609
|
const proofVerifier = new QueuedIVCVerifier(config, circuitVerifier);
|
|
576
610
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
@@ -658,27 +692,29 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
658
692
|
const validatorAddresses = keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager).getAddresses() : [];
|
|
659
693
|
slasherClient = await createSlasher(config, config.l1Contracts, getPublicClient(config), watchers, dateProvider, epochCache, validatorAddresses, undefined);
|
|
660
694
|
await slasherClient.start();
|
|
661
|
-
const l1TxUtils = config.
|
|
695
|
+
const l1TxUtils = config.sequencerPublisherForwarderAddress ? await createForwarderL1TxUtilsFromSigners(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), config.sequencerPublisherForwarderAddress, {
|
|
662
696
|
...config,
|
|
663
697
|
scope: 'sequencer'
|
|
664
698
|
}, {
|
|
665
699
|
telemetry,
|
|
666
700
|
logger: log.createChild('l1-tx-utils'),
|
|
667
|
-
dateProvider
|
|
668
|
-
|
|
701
|
+
dateProvider,
|
|
702
|
+
kzg: Blob.getViemKzgInstance()
|
|
703
|
+
}) : await createL1TxUtilsFromSigners(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), {
|
|
669
704
|
...config,
|
|
670
705
|
scope: 'sequencer'
|
|
671
706
|
}, {
|
|
672
707
|
telemetry,
|
|
673
708
|
logger: log.createChild('l1-tx-utils'),
|
|
674
|
-
dateProvider
|
|
709
|
+
dateProvider,
|
|
710
|
+
kzg: Blob.getViemKzgInstance()
|
|
675
711
|
});
|
|
676
712
|
// Create and start the sequencer client
|
|
677
713
|
const checkpointsBuilder = new CheckpointsBuilder({
|
|
678
714
|
...config,
|
|
679
715
|
l1GenesisTime,
|
|
680
716
|
slotDuration: Number(slotDuration)
|
|
681
|
-
}, worldStateSynchronizer, archiver, dateProvider, telemetry);
|
|
717
|
+
}, worldStateSynchronizer, archiver, dateProvider, telemetry, debugLogStore);
|
|
682
718
|
sequencer = await SequencerClient.new(config, {
|
|
683
719
|
...deps,
|
|
684
720
|
epochCache,
|
|
@@ -702,13 +738,35 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
702
738
|
} else if (sequencer) {
|
|
703
739
|
log.warn(`Sequencer created but not started`);
|
|
704
740
|
}
|
|
741
|
+
// Create prover node subsystem if enabled
|
|
742
|
+
let proverNode;
|
|
743
|
+
if (config.enableProverNode) {
|
|
744
|
+
proverNode = await createProverNode(config, {
|
|
745
|
+
...deps.proverNodeDeps,
|
|
746
|
+
telemetry,
|
|
747
|
+
dateProvider,
|
|
748
|
+
archiver,
|
|
749
|
+
worldStateSynchronizer,
|
|
750
|
+
p2pClient,
|
|
751
|
+
epochCache,
|
|
752
|
+
blobClient,
|
|
753
|
+
keyStoreManager
|
|
754
|
+
});
|
|
755
|
+
if (!options.dontStartProverNode) {
|
|
756
|
+
await proverNode.start();
|
|
757
|
+
log.info(`Prover node subsystem started`);
|
|
758
|
+
} else {
|
|
759
|
+
log.info(`Prover node subsystem created but not started`);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
705
762
|
const globalVariableBuilder = new GlobalVariableBuilder({
|
|
706
763
|
...config,
|
|
707
764
|
rollupVersion: BigInt(config.rollupVersion),
|
|
708
765
|
l1GenesisTime,
|
|
709
766
|
slotDuration: Number(slotDuration)
|
|
710
767
|
});
|
|
711
|
-
|
|
768
|
+
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);
|
|
769
|
+
return node;
|
|
712
770
|
}
|
|
713
771
|
/**
|
|
714
772
|
* Returns the sequencer client instance.
|
|
@@ -716,6 +774,9 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
716
774
|
*/ getSequencer() {
|
|
717
775
|
return this.sequencer;
|
|
718
776
|
}
|
|
777
|
+
/** Returns the prover node subsystem, if enabled. */ getProverNode() {
|
|
778
|
+
return this.proverNode;
|
|
779
|
+
}
|
|
719
780
|
getBlockSource() {
|
|
720
781
|
return this.blockSource;
|
|
721
782
|
}
|
|
@@ -758,7 +819,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
758
819
|
rollupVersion,
|
|
759
820
|
enr,
|
|
760
821
|
l1ContractAddresses: contractAddresses,
|
|
761
|
-
protocolContractAddresses: protocolContractAddresses
|
|
822
|
+
protocolContractAddresses: protocolContractAddresses,
|
|
823
|
+
realProofs: !!this.config.realProofs
|
|
762
824
|
};
|
|
763
825
|
return nodeInfo;
|
|
764
826
|
}
|
|
@@ -767,8 +829,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
767
829
|
* @param block - The block parameter (block number, block hash, or 'latest').
|
|
768
830
|
* @returns The requested block.
|
|
769
831
|
*/ async getBlock(block) {
|
|
770
|
-
if (
|
|
771
|
-
return this.getBlockByHash(
|
|
832
|
+
if (BlockHash.isBlockHash(block)) {
|
|
833
|
+
return this.getBlockByHash(block);
|
|
772
834
|
}
|
|
773
835
|
const blockNumber = block === 'latest' ? await this.getBlockNumber() : block;
|
|
774
836
|
if (blockNumber === BlockNumber.ZERO) {
|
|
@@ -782,7 +844,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
782
844
|
* @returns The requested block.
|
|
783
845
|
*/ async getBlockByHash(blockHash) {
|
|
784
846
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
785
|
-
if (blockHash.equals(
|
|
847
|
+
if (blockHash.equals(initialBlockHash)) {
|
|
786
848
|
return this.buildInitialBlock();
|
|
787
849
|
}
|
|
788
850
|
return await this.blockSource.getL2BlockByHash(blockHash);
|
|
@@ -867,8 +929,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
867
929
|
if (referenceBlock) {
|
|
868
930
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
869
931
|
if (!referenceBlock.equals(initialBlockHash)) {
|
|
870
|
-
const
|
|
871
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
932
|
+
const header = await this.blockSource.getBlockHeaderByHash(referenceBlock);
|
|
872
933
|
if (!header) {
|
|
873
934
|
throw new Error(`Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`);
|
|
874
935
|
}
|
|
@@ -880,8 +941,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
880
941
|
if (referenceBlock) {
|
|
881
942
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
882
943
|
if (!referenceBlock.equals(initialBlockHash)) {
|
|
883
|
-
const
|
|
884
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
944
|
+
const header = await this.blockSource.getBlockHeaderByHash(referenceBlock);
|
|
885
945
|
if (!header) {
|
|
886
946
|
throw new Error(`Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`);
|
|
887
947
|
}
|
|
@@ -934,18 +994,20 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
934
994
|
const isKnownToPool = txPoolStatus === 'pending' || txPoolStatus === 'mined';
|
|
935
995
|
// Then get the actual tx from the archiver, which tracks every tx in a mined block.
|
|
936
996
|
const settledTxReceipt = await this.blockSource.getSettledTxReceipt(txHash);
|
|
997
|
+
let receipt;
|
|
937
998
|
if (settledTxReceipt) {
|
|
938
|
-
|
|
939
|
-
return settledTxReceipt;
|
|
999
|
+
receipt = settledTxReceipt;
|
|
940
1000
|
} else if (isKnownToPool) {
|
|
941
1001
|
// If the tx is in the pool but not in the archiver, it's pending.
|
|
942
1002
|
// This handles race conditions between archiver and p2p, where the archiver
|
|
943
1003
|
// has pruned the block in which a tx was mined, but p2p has not caught up yet.
|
|
944
|
-
|
|
1004
|
+
receipt = new TxReceipt(txHash, TxStatus.PENDING, undefined, undefined);
|
|
945
1005
|
} else {
|
|
946
1006
|
// Otherwise, if we don't know the tx, we consider it dropped.
|
|
947
|
-
|
|
1007
|
+
receipt = new TxReceipt(txHash, TxStatus.DROPPED, undefined, 'Tx dropped by P2P node');
|
|
948
1008
|
}
|
|
1009
|
+
this.debugLogStore.decorateReceiptWithLogs(txHash.toString(), receipt);
|
|
1010
|
+
return receipt;
|
|
949
1011
|
}
|
|
950
1012
|
getTxEffect(txHash) {
|
|
951
1013
|
return this.blockSource.getTxEffect(txHash);
|
|
@@ -959,6 +1021,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
959
1021
|
await tryStop(this.slasherClient);
|
|
960
1022
|
await tryStop(this.proofVerifier);
|
|
961
1023
|
await tryStop(this.sequencer);
|
|
1024
|
+
await tryStop(this.proverNode);
|
|
962
1025
|
await tryStop(this.p2pClient);
|
|
963
1026
|
await tryStop(this.worldStateSynchronizer);
|
|
964
1027
|
await tryStop(this.blockSource);
|
|
@@ -997,8 +1060,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
997
1060
|
*/ async getTxsByHash(txHashes) {
|
|
998
1061
|
return compactArray(await Promise.all(txHashes.map((txHash)=>this.getTxByHash(txHash))));
|
|
999
1062
|
}
|
|
1000
|
-
async findLeavesIndexes(
|
|
1001
|
-
const committedDb = await this.#getWorldState(
|
|
1063
|
+
async findLeavesIndexes(referenceBlock, treeId, leafValues) {
|
|
1064
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1002
1065
|
const maybeIndices = await committedDb.findLeafIndices(treeId, leafValues.map((x)=>x.toBuffer()));
|
|
1003
1066
|
// We filter out undefined values
|
|
1004
1067
|
const indices = maybeIndices.filter((x)=>x !== undefined);
|
|
@@ -1041,35 +1104,27 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1041
1104
|
}
|
|
1042
1105
|
return {
|
|
1043
1106
|
l2BlockNumber: BlockNumber(Number(blockNumber)),
|
|
1044
|
-
l2BlockHash:
|
|
1107
|
+
l2BlockHash: new BlockHash(blockHash),
|
|
1045
1108
|
data: index
|
|
1046
1109
|
};
|
|
1047
1110
|
});
|
|
1048
1111
|
}
|
|
1049
|
-
async
|
|
1050
|
-
const committedDb = await this.#getWorldState(
|
|
1051
|
-
return committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, leafIndex);
|
|
1052
|
-
}
|
|
1053
|
-
async getNoteHashSiblingPath(block, leafIndex) {
|
|
1054
|
-
const committedDb = await this.#getWorldState(block);
|
|
1055
|
-
return committedDb.getSiblingPath(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
|
|
1056
|
-
}
|
|
1057
|
-
async getArchiveMembershipWitness(block, archive) {
|
|
1058
|
-
const committedDb = await this.#getWorldState(block);
|
|
1112
|
+
async getBlockHashMembershipWitness(referenceBlock, blockHash) {
|
|
1113
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1059
1114
|
const [pathAndIndex] = await committedDb.findSiblingPaths(MerkleTreeId.ARCHIVE, [
|
|
1060
|
-
|
|
1115
|
+
blockHash
|
|
1061
1116
|
]);
|
|
1062
1117
|
return pathAndIndex === undefined ? undefined : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
1063
1118
|
}
|
|
1064
|
-
async getNoteHashMembershipWitness(
|
|
1065
|
-
const committedDb = await this.#getWorldState(
|
|
1119
|
+
async getNoteHashMembershipWitness(referenceBlock, noteHash) {
|
|
1120
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1066
1121
|
const [pathAndIndex] = await committedDb.findSiblingPaths(MerkleTreeId.NOTE_HASH_TREE, [
|
|
1067
1122
|
noteHash
|
|
1068
1123
|
]);
|
|
1069
1124
|
return pathAndIndex === undefined ? undefined : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
1070
1125
|
}
|
|
1071
|
-
async getL1ToL2MessageMembershipWitness(
|
|
1072
|
-
const db = await this.#getWorldState(
|
|
1126
|
+
async getL1ToL2MessageMembershipWitness(referenceBlock, l1ToL2Message) {
|
|
1127
|
+
const db = await this.#getWorldState(referenceBlock);
|
|
1073
1128
|
const [witness] = await db.findSiblingPaths(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, [
|
|
1074
1129
|
l1ToL2Message
|
|
1075
1130
|
]);
|
|
@@ -1116,16 +1171,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1116
1171
|
}
|
|
1117
1172
|
return blocksInCheckpoints.map((blocks)=>blocks.map((block)=>block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs)));
|
|
1118
1173
|
}
|
|
1119
|
-
async
|
|
1120
|
-
const
|
|
1121
|
-
return committedDb.getSiblingPath(MerkleTreeId.ARCHIVE, leafIndex);
|
|
1122
|
-
}
|
|
1123
|
-
async getPublicDataSiblingPath(block, leafIndex) {
|
|
1124
|
-
const committedDb = await this.#getWorldState(block);
|
|
1125
|
-
return committedDb.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, leafIndex);
|
|
1126
|
-
}
|
|
1127
|
-
async getNullifierMembershipWitness(block, nullifier) {
|
|
1128
|
-
const db = await this.#getWorldState(block);
|
|
1174
|
+
async getNullifierMembershipWitness(referenceBlock, nullifier) {
|
|
1175
|
+
const db = await this.#getWorldState(referenceBlock);
|
|
1129
1176
|
const [witness] = await db.findSiblingPaths(MerkleTreeId.NULLIFIER_TREE, [
|
|
1130
1177
|
nullifier.toBuffer()
|
|
1131
1178
|
]);
|
|
@@ -1141,7 +1188,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1141
1188
|
}
|
|
1142
1189
|
/**
|
|
1143
1190
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
1144
|
-
* @param
|
|
1191
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data
|
|
1192
|
+
* (which contains the root of the nullifier tree in which we are searching for the nullifier).
|
|
1145
1193
|
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
1146
1194
|
* @returns The low nullifier membership witness (if found).
|
|
1147
1195
|
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
@@ -1152,8 +1200,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1152
1200
|
* the nullifier already exists in the tree. This is because the `getPreviousValueIndex` function returns the
|
|
1153
1201
|
* index of the nullifier itself when it already exists in the tree.
|
|
1154
1202
|
* TODO: This is a confusing behavior and we should eventually address that.
|
|
1155
|
-
*/ async getLowNullifierMembershipWitness(
|
|
1156
|
-
const committedDb = await this.#getWorldState(
|
|
1203
|
+
*/ async getLowNullifierMembershipWitness(referenceBlock, nullifier) {
|
|
1204
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1157
1205
|
const findResult = await committedDb.getPreviousValueIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBigInt());
|
|
1158
1206
|
if (!findResult) {
|
|
1159
1207
|
return undefined;
|
|
@@ -1166,8 +1214,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1166
1214
|
const siblingPath = await committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, BigInt(index));
|
|
1167
1215
|
return new NullifierMembershipWitness(BigInt(index), preimageData, siblingPath);
|
|
1168
1216
|
}
|
|
1169
|
-
async getPublicDataWitness(
|
|
1170
|
-
const committedDb = await this.#getWorldState(
|
|
1217
|
+
async getPublicDataWitness(referenceBlock, leafSlot) {
|
|
1218
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1171
1219
|
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
1172
1220
|
if (!lowLeafResult) {
|
|
1173
1221
|
return undefined;
|
|
@@ -1177,8 +1225,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1177
1225
|
return new PublicDataWitness(lowLeafResult.index, preimage, path);
|
|
1178
1226
|
}
|
|
1179
1227
|
}
|
|
1180
|
-
async getPublicStorageAt(
|
|
1181
|
-
const committedDb = await this.#getWorldState(
|
|
1228
|
+
async getPublicStorageAt(referenceBlock, contract, slot) {
|
|
1229
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1182
1230
|
const leafSlot = await computePublicDataTreeLeafSlot(contract, slot);
|
|
1183
1231
|
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
1184
1232
|
if (!lowLeafResult || !lowLeafResult.alreadyPresent) {
|
|
@@ -1188,14 +1236,13 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1188
1236
|
return preimage.leaf.value;
|
|
1189
1237
|
}
|
|
1190
1238
|
async getBlockHeader(block = 'latest') {
|
|
1191
|
-
if (
|
|
1239
|
+
if (BlockHash.isBlockHash(block)) {
|
|
1192
1240
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
1193
1241
|
if (block.equals(initialBlockHash)) {
|
|
1194
1242
|
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1195
1243
|
return this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
1196
1244
|
}
|
|
1197
|
-
|
|
1198
|
-
return this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
1245
|
+
return this.blockSource.getBlockHeaderByHash(block);
|
|
1199
1246
|
} else {
|
|
1200
1247
|
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1201
1248
|
const blockNumber = block === 'latest' ? await this.getBlockNumber() : block;
|
|
@@ -1212,6 +1259,12 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1212
1259
|
*/ async getBlockHeaderByArchive(archive) {
|
|
1213
1260
|
return await this.blockSource.getBlockHeaderByArchive(archive);
|
|
1214
1261
|
}
|
|
1262
|
+
getBlockData(number) {
|
|
1263
|
+
return this.blockSource.getBlockData(number);
|
|
1264
|
+
}
|
|
1265
|
+
getBlockDataByArchive(archive) {
|
|
1266
|
+
return this.blockSource.getBlockDataByArchive(archive);
|
|
1267
|
+
}
|
|
1215
1268
|
/**
|
|
1216
1269
|
* Simulates the public part of a transaction with the current state.
|
|
1217
1270
|
* @param tx - The transaction to simulate.
|
|
@@ -1224,17 +1277,20 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1224
1277
|
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
1225
1278
|
}
|
|
1226
1279
|
const txHash = tx.getTxHash();
|
|
1227
|
-
const
|
|
1280
|
+
const latestBlockNumber = await this.blockSource.getBlockNumber();
|
|
1281
|
+
const blockNumber = BlockNumber.add(latestBlockNumber, 1);
|
|
1228
1282
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
1229
1283
|
const coinbase = EthAddress.ZERO;
|
|
1230
1284
|
const feeRecipient = AztecAddress.ZERO;
|
|
1231
1285
|
const newGlobalVariables = await this.globalVariableBuilder.buildGlobalVariables(blockNumber, coinbase, feeRecipient);
|
|
1232
|
-
const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, new DateProvider(), this.telemetry);
|
|
1286
|
+
const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, new DateProvider(), this.telemetry, this.log.getBindings());
|
|
1233
1287
|
this.log.verbose(`Simulating public calls for tx ${txHash}`, {
|
|
1234
1288
|
globalVariables: newGlobalVariables.toInspect(),
|
|
1235
1289
|
txHash,
|
|
1236
1290
|
blockNumber
|
|
1237
1291
|
});
|
|
1292
|
+
// Ensure world-state has caught up with the latest block we loaded from the archiver
|
|
1293
|
+
await this.worldStateSynchronizer.syncImmediate(latestBlockNumber);
|
|
1238
1294
|
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
1239
1295
|
try {
|
|
1240
1296
|
const config = PublicSimulatorConfig.from({
|
|
@@ -1249,7 +1305,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1249
1305
|
});
|
|
1250
1306
|
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, config);
|
|
1251
1307
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
1252
|
-
const [processedTxs, failedTxs, _usedTxs, returns] = await processor.process([
|
|
1308
|
+
const [processedTxs, failedTxs, _usedTxs, returns, _blobFields, debugLogs] = await processor.process([
|
|
1253
1309
|
tx
|
|
1254
1310
|
]);
|
|
1255
1311
|
// REFACTOR: Consider returning the error rather than throwing
|
|
@@ -1260,7 +1316,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1260
1316
|
throw failedTxs[0].error;
|
|
1261
1317
|
}
|
|
1262
1318
|
const [processedTx] = processedTxs;
|
|
1263
|
-
return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed);
|
|
1319
|
+
return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed, debugLogs);
|
|
1264
1320
|
} finally{
|
|
1265
1321
|
await merkleTreeFork.close();
|
|
1266
1322
|
}
|
|
@@ -1268,10 +1324,10 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1268
1324
|
async isValidTx(tx, { isSimulation, skipFeeEnforcement } = {}) {
|
|
1269
1325
|
const db = this.worldStateSynchronizer.getCommitted();
|
|
1270
1326
|
const verifier = isSimulation ? undefined : this.proofVerifier;
|
|
1271
|
-
// We accept transactions if they are not expired by the next slot (checked based on the
|
|
1327
|
+
// We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field)
|
|
1272
1328
|
const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
1273
1329
|
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
1274
|
-
const validator =
|
|
1330
|
+
const validator = createTxValidatorForAcceptingTxsOverRPC(db, this.contractDataSource, verifier, {
|
|
1275
1331
|
timestamp: nextSlotTimestamp,
|
|
1276
1332
|
blockNumber,
|
|
1277
1333
|
l1ChainId: this.l1ChainId,
|
|
@@ -1280,7 +1336,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1280
1336
|
gasFees: await this.getCurrentMinFees(),
|
|
1281
1337
|
skipFeeEnforcement,
|
|
1282
1338
|
txsPermitted: !this.config.disableTransactions
|
|
1283
|
-
});
|
|
1339
|
+
}, this.log.getBindings());
|
|
1284
1340
|
return await validator.validateTx(tx);
|
|
1285
1341
|
}
|
|
1286
1342
|
getConfig() {
|
|
@@ -1422,6 +1478,73 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1422
1478
|
return this.slasherClient.gatherOffensesForRound(round === 'current' ? undefined : BigInt(round));
|
|
1423
1479
|
}
|
|
1424
1480
|
}
|
|
1481
|
+
async reloadKeystore() {
|
|
1482
|
+
if (!this.config.keyStoreDirectory?.length) {
|
|
1483
|
+
throw new BadRequestError('Cannot reload keystore: node is not using a file-based keystore. ' + 'Set KEY_STORE_DIRECTORY to use file-based keystores.');
|
|
1484
|
+
}
|
|
1485
|
+
if (!this.validatorClient) {
|
|
1486
|
+
throw new BadRequestError('Cannot reload keystore: validator is not enabled.');
|
|
1487
|
+
}
|
|
1488
|
+
this.log.info('Reloading keystore from disk');
|
|
1489
|
+
// Re-read and validate keystore files
|
|
1490
|
+
const keyStores = loadKeystores(this.config.keyStoreDirectory);
|
|
1491
|
+
const newManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
1492
|
+
await newManager.validateSigners();
|
|
1493
|
+
ValidatorClient.validateKeyStoreConfiguration(newManager, this.log);
|
|
1494
|
+
// Validate that every validator's publisher keys overlap with the L1 signers
|
|
1495
|
+
// that were initialized at startup. Publishers cannot be hot-reloaded, so a
|
|
1496
|
+
// validator with a publisher key that doesn't match any existing L1 signer
|
|
1497
|
+
// would silently fail on every proposer slot.
|
|
1498
|
+
if (this.keyStoreManager && this.sequencer) {
|
|
1499
|
+
const oldAdapter = NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager);
|
|
1500
|
+
const availablePublishers = new Set(oldAdapter.getAttesterAddresses().flatMap((a)=>oldAdapter.getPublisherAddresses(a).map((p)=>p.toString().toLowerCase())));
|
|
1501
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1502
|
+
for (const attester of newAdapter.getAttesterAddresses()){
|
|
1503
|
+
const pubs = newAdapter.getPublisherAddresses(attester);
|
|
1504
|
+
if (pubs.length > 0 && !pubs.some((p)=>availablePublishers.has(p.toString().toLowerCase()))) {
|
|
1505
|
+
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 ` + `[${[
|
|
1506
|
+
...availablePublishers
|
|
1507
|
+
].join(', ')}]. Publishers cannot be hot-reloaded — ` + `use an existing publisher key or restart the node.`);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
// Build adapters for old and new keystores to compute diff
|
|
1512
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1513
|
+
const newAddresses = newAdapter.getAttesterAddresses();
|
|
1514
|
+
const oldAddresses = this.keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager).getAttesterAddresses() : [];
|
|
1515
|
+
const oldSet = new Set(oldAddresses.map((a)=>a.toString()));
|
|
1516
|
+
const newSet = new Set(newAddresses.map((a)=>a.toString()));
|
|
1517
|
+
const added = newAddresses.filter((a)=>!oldSet.has(a.toString()));
|
|
1518
|
+
const removed = oldAddresses.filter((a)=>!newSet.has(a.toString()));
|
|
1519
|
+
if (added.length > 0) {
|
|
1520
|
+
this.log.info(`Keystore reload: adding attester keys: ${added.map((a)=>a.toString()).join(', ')}`);
|
|
1521
|
+
}
|
|
1522
|
+
if (removed.length > 0) {
|
|
1523
|
+
this.log.info(`Keystore reload: removing attester keys: ${removed.map((a)=>a.toString()).join(', ')}`);
|
|
1524
|
+
}
|
|
1525
|
+
if (added.length === 0 && removed.length === 0) {
|
|
1526
|
+
this.log.info('Keystore reload: attester keys unchanged');
|
|
1527
|
+
}
|
|
1528
|
+
// Update the validator client (coinbase, feeRecipient, attester keys)
|
|
1529
|
+
this.validatorClient.reloadKeystore(newManager);
|
|
1530
|
+
// Update the publisher factory's keystore so newly-added validators
|
|
1531
|
+
// can be matched to existing publisher keys when proposing blocks.
|
|
1532
|
+
if (this.sequencer) {
|
|
1533
|
+
this.sequencer.updatePublisherNodeKeyStore(newAdapter);
|
|
1534
|
+
}
|
|
1535
|
+
// Update slasher's "don't-slash-self" list with new validator addresses
|
|
1536
|
+
if (this.slasherClient && !this.config.slashSelfAllowed) {
|
|
1537
|
+
const slashValidatorsNever = unique([
|
|
1538
|
+
...this.config.slashValidatorsNever ?? [],
|
|
1539
|
+
...newAddresses
|
|
1540
|
+
].map((a)=>a.toString())).map(EthAddress.fromString);
|
|
1541
|
+
this.slasherClient.updateConfig({
|
|
1542
|
+
slashValidatorsNever
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
this.keyStoreManager = newManager;
|
|
1546
|
+
this.log.info('Keystore reloaded: coinbase, feeRecipient, and attester keys updated');
|
|
1547
|
+
}
|
|
1425
1548
|
#getInitialHeaderHash() {
|
|
1426
1549
|
if (!this.initialHeaderHashPromise) {
|
|
1427
1550
|
this.initialHeaderHashPromise = this.worldStateSynchronizer.getCommitted().getInitialHeader().hash();
|
|
@@ -1444,14 +1567,13 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1444
1567
|
this.log.debug(`Using committed db for block 'latest', world state synced upto ${blockSyncedTo}`);
|
|
1445
1568
|
return this.worldStateSynchronizer.getCommitted();
|
|
1446
1569
|
}
|
|
1447
|
-
if (
|
|
1570
|
+
if (BlockHash.isBlockHash(block)) {
|
|
1448
1571
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
1449
1572
|
if (block.equals(initialBlockHash)) {
|
|
1450
1573
|
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1451
1574
|
return this.worldStateSynchronizer.getSnapshot(BlockNumber.ZERO);
|
|
1452
1575
|
}
|
|
1453
|
-
const
|
|
1454
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
1576
|
+
const header = await this.blockSource.getBlockHeaderByHash(block);
|
|
1455
1577
|
if (!header) {
|
|
1456
1578
|
throw new Error(`Block hash ${block.toString()} not found when querying world state. If the node API has been queried with anchor block hash possibly a reorg has occurred.`);
|
|
1457
1579
|
}
|
|
@@ -6,4 +6,4 @@ 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>;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlbnRpbmVsL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFckQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFOUQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBQzVDLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXJFLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNsRCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBR3pDLHdCQUFzQixjQUFjLENBQ2xDLFVBQVUsRUFBRSxVQUFVLEVBQ3RCLFFBQVEsRUFBRSxhQUFhLEVBQ3ZCLEdBQUcsRUFBRSxTQUFTLEVBQ2QsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLEdBQUcsYUFBYSxFQUN4RCxNQUFNLHlDQUFnQyxHQUNyQyxPQUFPLENBQUMsUUFBUSxHQUFHLFNBQVMsQ0FBQyxDQVkvQiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/sentinel/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,wBAAsB,cAAc,CAClC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,cAAc,GAAG,eAAe,GAAG,aAAa,EACxD,MAAM,yCAAgC,GACrC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/sentinel/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,wBAAsB,cAAc,CAClC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,cAAc,GAAG,eAAe,GAAG,aAAa,EACxD,MAAM,yCAAgC,GACrC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAY/B"}
|