@aztec/aztec-node 0.0.1-commit.8f9871590 → 0.0.1-commit.934299a21
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 +18 -4
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +166 -30
- 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 +219 -36
- 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,14 @@ 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
|
}
|
|
@@ -933,18 +994,20 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
933
994
|
const isKnownToPool = txPoolStatus === 'pending' || txPoolStatus === 'mined';
|
|
934
995
|
// Then get the actual tx from the archiver, which tracks every tx in a mined block.
|
|
935
996
|
const settledTxReceipt = await this.blockSource.getSettledTxReceipt(txHash);
|
|
997
|
+
let receipt;
|
|
936
998
|
if (settledTxReceipt) {
|
|
937
|
-
|
|
938
|
-
return settledTxReceipt;
|
|
999
|
+
receipt = settledTxReceipt;
|
|
939
1000
|
} else if (isKnownToPool) {
|
|
940
1001
|
// If the tx is in the pool but not in the archiver, it's pending.
|
|
941
1002
|
// This handles race conditions between archiver and p2p, where the archiver
|
|
942
1003
|
// has pruned the block in which a tx was mined, but p2p has not caught up yet.
|
|
943
|
-
|
|
1004
|
+
receipt = new TxReceipt(txHash, TxStatus.PENDING, undefined, undefined);
|
|
944
1005
|
} else {
|
|
945
1006
|
// Otherwise, if we don't know the tx, we consider it dropped.
|
|
946
|
-
|
|
1007
|
+
receipt = new TxReceipt(txHash, TxStatus.DROPPED, undefined, 'Tx dropped by P2P node');
|
|
947
1008
|
}
|
|
1009
|
+
this.debugLogStore.decorateReceiptWithLogs(txHash.toString(), receipt);
|
|
1010
|
+
return receipt;
|
|
948
1011
|
}
|
|
949
1012
|
getTxEffect(txHash) {
|
|
950
1013
|
return this.blockSource.getTxEffect(txHash);
|
|
@@ -958,6 +1021,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
958
1021
|
await tryStop(this.slasherClient);
|
|
959
1022
|
await tryStop(this.proofVerifier);
|
|
960
1023
|
await tryStop(this.sequencer);
|
|
1024
|
+
await tryStop(this.proverNode);
|
|
961
1025
|
await tryStop(this.p2pClient);
|
|
962
1026
|
await tryStop(this.worldStateSynchronizer);
|
|
963
1027
|
await tryStop(this.blockSource);
|
|
@@ -1195,6 +1259,12 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1195
1259
|
*/ async getBlockHeaderByArchive(archive) {
|
|
1196
1260
|
return await this.blockSource.getBlockHeaderByArchive(archive);
|
|
1197
1261
|
}
|
|
1262
|
+
getBlockData(number) {
|
|
1263
|
+
return this.blockSource.getBlockData(number);
|
|
1264
|
+
}
|
|
1265
|
+
getBlockDataByArchive(archive) {
|
|
1266
|
+
return this.blockSource.getBlockDataByArchive(archive);
|
|
1267
|
+
}
|
|
1198
1268
|
/**
|
|
1199
1269
|
* Simulates the public part of a transaction with the current state.
|
|
1200
1270
|
* @param tx - The transaction to simulate.
|
|
@@ -1207,7 +1277,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1207
1277
|
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
1208
1278
|
}
|
|
1209
1279
|
const txHash = tx.getTxHash();
|
|
1210
|
-
const
|
|
1280
|
+
const latestBlockNumber = await this.blockSource.getBlockNumber();
|
|
1281
|
+
const blockNumber = BlockNumber.add(latestBlockNumber, 1);
|
|
1211
1282
|
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
1212
1283
|
const coinbase = EthAddress.ZERO;
|
|
1213
1284
|
const feeRecipient = AztecAddress.ZERO;
|
|
@@ -1218,10 +1289,8 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1218
1289
|
txHash,
|
|
1219
1290
|
blockNumber
|
|
1220
1291
|
});
|
|
1221
|
-
// Ensure world
|
|
1222
|
-
|
|
1223
|
-
// (e.g. L1-to-L2 message existence checks) to fail against stale state.
|
|
1224
|
-
await this.#syncWorldState();
|
|
1292
|
+
// Ensure world-state has caught up with the latest block we loaded from the archiver
|
|
1293
|
+
await this.worldStateSynchronizer.syncImmediate(latestBlockNumber);
|
|
1225
1294
|
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
1226
1295
|
try {
|
|
1227
1296
|
const config = PublicSimulatorConfig.from({
|
|
@@ -1236,7 +1305,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1236
1305
|
});
|
|
1237
1306
|
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, config);
|
|
1238
1307
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
1239
|
-
const [processedTxs, failedTxs, _usedTxs, returns] = await processor.process([
|
|
1308
|
+
const [processedTxs, failedTxs, _usedTxs, returns, _blobFields, debugLogs] = await processor.process([
|
|
1240
1309
|
tx
|
|
1241
1310
|
]);
|
|
1242
1311
|
// REFACTOR: Consider returning the error rather than throwing
|
|
@@ -1247,7 +1316,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1247
1316
|
throw failedTxs[0].error;
|
|
1248
1317
|
}
|
|
1249
1318
|
const [processedTx] = processedTxs;
|
|
1250
|
-
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);
|
|
1251
1320
|
} finally{
|
|
1252
1321
|
await merkleTreeFork.close();
|
|
1253
1322
|
}
|
|
@@ -1258,7 +1327,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1258
1327
|
// We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field)
|
|
1259
1328
|
const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
1260
1329
|
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
1261
|
-
const validator =
|
|
1330
|
+
const validator = createTxValidatorForAcceptingTxsOverRPC(db, this.contractDataSource, verifier, {
|
|
1262
1331
|
timestamp: nextSlotTimestamp,
|
|
1263
1332
|
blockNumber,
|
|
1264
1333
|
l1ChainId: this.l1ChainId,
|
|
@@ -1409,6 +1478,73 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1409
1478
|
return this.slasherClient.gatherOffensesForRound(round === 'current' ? undefined : BigInt(round));
|
|
1410
1479
|
}
|
|
1411
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
|
+
}
|
|
1412
1548
|
#getInitialHeaderHash() {
|
|
1413
1549
|
if (!this.initialHeaderHashPromise) {
|
|
1414
1550
|
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 {};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,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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.934299a21",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,30 +65,32 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
69
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
70
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
71
|
-
"@aztec/
|
|
72
|
-
"@aztec/
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
78
|
-
"@aztec/
|
|
79
|
-
"@aztec/node-
|
|
80
|
-
"@aztec/
|
|
81
|
-
"@aztec/
|
|
82
|
-
"@aztec/
|
|
83
|
-
"@aztec/
|
|
84
|
-
"@aztec/
|
|
85
|
-
"@aztec/
|
|
86
|
-
"@aztec/
|
|
87
|
-
"@aztec/
|
|
88
|
-
"@aztec/
|
|
89
|
-
"@aztec/
|
|
90
|
-
"@aztec/
|
|
91
|
-
"@aztec/
|
|
68
|
+
"@aztec/archiver": "0.0.1-commit.934299a21",
|
|
69
|
+
"@aztec/bb-prover": "0.0.1-commit.934299a21",
|
|
70
|
+
"@aztec/blob-client": "0.0.1-commit.934299a21",
|
|
71
|
+
"@aztec/blob-lib": "0.0.1-commit.934299a21",
|
|
72
|
+
"@aztec/constants": "0.0.1-commit.934299a21",
|
|
73
|
+
"@aztec/epoch-cache": "0.0.1-commit.934299a21",
|
|
74
|
+
"@aztec/ethereum": "0.0.1-commit.934299a21",
|
|
75
|
+
"@aztec/foundation": "0.0.1-commit.934299a21",
|
|
76
|
+
"@aztec/kv-store": "0.0.1-commit.934299a21",
|
|
77
|
+
"@aztec/l1-artifacts": "0.0.1-commit.934299a21",
|
|
78
|
+
"@aztec/merkle-tree": "0.0.1-commit.934299a21",
|
|
79
|
+
"@aztec/node-keystore": "0.0.1-commit.934299a21",
|
|
80
|
+
"@aztec/node-lib": "0.0.1-commit.934299a21",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.934299a21",
|
|
82
|
+
"@aztec/p2p": "0.0.1-commit.934299a21",
|
|
83
|
+
"@aztec/protocol-contracts": "0.0.1-commit.934299a21",
|
|
84
|
+
"@aztec/prover-client": "0.0.1-commit.934299a21",
|
|
85
|
+
"@aztec/prover-node": "0.0.1-commit.934299a21",
|
|
86
|
+
"@aztec/sequencer-client": "0.0.1-commit.934299a21",
|
|
87
|
+
"@aztec/simulator": "0.0.1-commit.934299a21",
|
|
88
|
+
"@aztec/slasher": "0.0.1-commit.934299a21",
|
|
89
|
+
"@aztec/stdlib": "0.0.1-commit.934299a21",
|
|
90
|
+
"@aztec/telemetry-client": "0.0.1-commit.934299a21",
|
|
91
|
+
"@aztec/validator-client": "0.0.1-commit.934299a21",
|
|
92
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.934299a21",
|
|
93
|
+
"@aztec/world-state": "0.0.1-commit.934299a21",
|
|
92
94
|
"koa": "^2.16.1",
|
|
93
95
|
"koa-router": "^13.1.1",
|
|
94
96
|
"tslib": "^2.4.0",
|