@aztec/aztec-node 0.0.1-commit.2ed92850 → 0.0.1-commit.3100065
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/block_response_helpers.d.ts +25 -0
- package/dest/aztec-node/block_response_helpers.d.ts.map +1 -0
- package/dest/aztec-node/block_response_helpers.js +112 -0
- package/dest/aztec-node/config.d.ts +23 -8
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +26 -8
- 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/node_public_calls_simulator.d.ts +90 -0
- package/dest/aztec-node/node_public_calls_simulator.d.ts.map +1 -0
- package/dest/aztec-node/node_public_calls_simulator.js +346 -0
- package/dest/aztec-node/public_data_overrides.d.ts +13 -0
- package/dest/aztec-node/public_data_overrides.d.ts.map +1 -0
- package/dest/aztec-node/public_data_overrides.js +21 -0
- package/dest/aztec-node/register_node_rpc_handlers.d.ts +10 -0
- package/dest/aztec-node/register_node_rpc_handlers.d.ts.map +1 -0
- package/dest/aztec-node/register_node_rpc_handlers.js +31 -0
- package/dest/aztec-node/server.d.ts +148 -146
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +490 -749
- package/dest/bin/index.js +15 -10
- package/dest/factory.d.ts +33 -0
- package/dest/factory.d.ts.map +1 -0
- package/dest/factory.js +509 -0
- package/dest/index.d.ts +3 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +2 -0
- package/dest/modules/block_parameter.d.ts +25 -0
- package/dest/modules/block_parameter.d.ts.map +1 -0
- package/dest/modules/block_parameter.js +100 -0
- package/dest/modules/node_block_provider.d.ts +19 -0
- package/dest/modules/node_block_provider.d.ts.map +1 -0
- package/dest/modules/node_block_provider.js +112 -0
- package/dest/modules/node_tx_receipt.d.ts +24 -0
- package/dest/modules/node_tx_receipt.d.ts.map +1 -0
- package/dest/modules/node_tx_receipt.js +70 -0
- package/dest/modules/node_world_state_queries.d.ts +65 -0
- package/dest/modules/node_world_state_queries.d.ts.map +1 -0
- package/dest/modules/node_world_state_queries.js +272 -0
- package/dest/sentinel/config.d.ts +3 -2
- package/dest/sentinel/config.d.ts.map +1 -1
- package/dest/sentinel/config.js +15 -5
- package/dest/sentinel/factory.d.ts +6 -4
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +13 -6
- package/dest/sentinel/sentinel.d.ts +146 -22
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +266 -118
- package/dest/sentinel/store.d.ts +8 -8
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +33 -21
- package/dest/test/index.d.ts +3 -3
- package/dest/test/index.d.ts.map +1 -1
- package/package.json +28 -25
- package/src/aztec-node/block_response_helpers.ts +161 -0
- package/src/aztec-node/config.ts +55 -16
- package/src/aztec-node/node_metrics.ts +12 -5
- package/src/aztec-node/node_public_calls_simulator.ts +383 -0
- package/src/aztec-node/public_data_overrides.ts +35 -0
- package/src/aztec-node/register_node_rpc_handlers.ts +29 -0
- package/src/aztec-node/server.ts +652 -993
- package/src/bin/index.ts +19 -12
- package/src/factory.ts +673 -0
- package/src/index.ts +2 -0
- package/src/modules/block_parameter.ts +93 -0
- package/src/modules/node_block_provider.ts +149 -0
- package/src/modules/node_tx_receipt.ts +115 -0
- package/src/modules/node_world_state_queries.ts +374 -0
- package/src/sentinel/README.md +103 -0
- package/src/sentinel/config.ts +18 -6
- package/src/sentinel/factory.ts +23 -13
- package/src/sentinel/sentinel.ts +316 -136
- package/src/sentinel/store.ts +35 -27
- package/src/test/index.ts +2 -2
|
@@ -371,55 +371,59 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
|
|
|
371
371
|
return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
|
|
372
372
|
}
|
|
373
373
|
var _dec, _initProto;
|
|
374
|
-
import {
|
|
375
|
-
import {
|
|
376
|
-
import {
|
|
377
|
-
import {
|
|
378
|
-
import {
|
|
379
|
-
import { getPublicClient } from '@aztec/ethereum/client';
|
|
380
|
-
import { RegistryContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
381
|
-
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
382
|
-
import { compactArray, pick } from '@aztec/foundation/collection';
|
|
383
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
374
|
+
import { BBCircuitVerifier, BatchChonkVerifier, QueuedIVCVerifier } from '@aztec/bb-prover';
|
|
375
|
+
import { TestCircuitVerifier } from '@aztec/bb-prover/test';
|
|
376
|
+
import { pickL1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
377
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
378
|
+
import { compactArray, pick, unique } from '@aztec/foundation/collection';
|
|
384
379
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
385
380
|
import { BadRequestError } from '@aztec/foundation/json-rpc';
|
|
386
381
|
import { createLogger } from '@aztec/foundation/log';
|
|
382
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
387
383
|
import { count } from '@aztec/foundation/string';
|
|
388
|
-
import {
|
|
389
|
-
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
384
|
+
import { Timer } from '@aztec/foundation/timer';
|
|
390
385
|
import { KeystoreManager, loadKeystores, mergeKeystores } from '@aztec/node-keystore';
|
|
391
|
-
import {
|
|
392
|
-
import {
|
|
393
|
-
import { createP2PClient, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
386
|
+
import { uploadSnapshot } from '@aztec/node-lib/actions';
|
|
387
|
+
import { createTxValidatorForAcceptingTxsOverRPC, getDefaultAllowedSetupFunctions } from '@aztec/p2p';
|
|
394
388
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
395
|
-
import {
|
|
396
|
-
import {
|
|
397
|
-
import {
|
|
398
|
-
import { CollectionLimitsConfig, PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
399
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
400
|
-
import { L2Block, L2BlockHash } from '@aztec/stdlib/block';
|
|
401
|
-
import { GasFees } from '@aztec/stdlib/gas';
|
|
402
|
-
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
389
|
+
import { STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS } from '@aztec/standard-contracts/multi-call-entrypoint';
|
|
390
|
+
import { inspectBlockParameter } from '@aztec/stdlib/block';
|
|
391
|
+
import { GasFees, getNetworkTxGasLimits } from '@aztec/stdlib/gas';
|
|
403
392
|
import { AztecNodeAdminConfigSchema } from '@aztec/stdlib/interfaces/client';
|
|
404
393
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
405
|
-
import {
|
|
406
|
-
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
407
|
-
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
408
|
-
import { PublicSimulationOutput, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
409
|
-
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
394
|
+
import { NullDebugLogStore } from '@aztec/stdlib/logs';
|
|
410
395
|
import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
411
|
-
import {
|
|
412
|
-
import {
|
|
413
|
-
import {
|
|
414
|
-
import {
|
|
415
|
-
import { createKeyStoreForValidator } from './config.js';
|
|
396
|
+
import { NodeKeystoreAdapter, ValidatorClient } from '@aztec/validator-client';
|
|
397
|
+
import { NodeBlockProvider } from '../modules/node_block_provider.js';
|
|
398
|
+
import { NodeTxReceiptBuilder } from '../modules/node_tx_receipt.js';
|
|
399
|
+
import { NodeWorldStateQueries } from '../modules/node_world_state_queries.js';
|
|
416
400
|
import { NodeMetrics } from './node_metrics.js';
|
|
401
|
+
import { NodePublicCallsSimulator } from './node_public_calls_simulator.js';
|
|
417
402
|
_dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
418
403
|
[Attributes.TX_HASH]: tx.getTxHash().toString()
|
|
419
404
|
}));
|
|
420
405
|
/**
|
|
421
406
|
* The aztec node.
|
|
422
407
|
*/ export class AztecNodeService {
|
|
408
|
+
static{
|
|
409
|
+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
|
|
410
|
+
[
|
|
411
|
+
_dec,
|
|
412
|
+
2,
|
|
413
|
+
"simulatePublicCalls"
|
|
414
|
+
]
|
|
415
|
+
], []));
|
|
416
|
+
}
|
|
417
|
+
metrics;
|
|
418
|
+
// Prevent two snapshot operations to happen simultaneously
|
|
419
|
+
isUploadingSnapshot = (_initProto(this), false);
|
|
420
|
+
// Saved minTxsPerBlock used by `pauseSequencer` to restore production-sequencer config on resume.
|
|
421
|
+
sequencerPausedMinTxsPerBlock;
|
|
422
|
+
nodePublicCallsSimulator;
|
|
423
|
+
worldStateQueries;
|
|
424
|
+
blockProvider;
|
|
425
|
+
txReceiptBuilder;
|
|
426
|
+
tracer;
|
|
423
427
|
config;
|
|
424
428
|
p2pClient;
|
|
425
429
|
blockSource;
|
|
@@ -428,287 +432,155 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
428
432
|
l1ToL2MessageSource;
|
|
429
433
|
worldStateSynchronizer;
|
|
430
434
|
sequencer;
|
|
435
|
+
proverNode;
|
|
431
436
|
slasherClient;
|
|
432
437
|
validatorsSentinel;
|
|
433
|
-
|
|
438
|
+
stopStartedWatchers;
|
|
434
439
|
l1ChainId;
|
|
435
440
|
version;
|
|
436
441
|
globalVariableBuilder;
|
|
442
|
+
rollupContract;
|
|
443
|
+
feeProvider;
|
|
437
444
|
epochCache;
|
|
438
445
|
packageVersion;
|
|
439
|
-
|
|
446
|
+
peerProofVerifier;
|
|
447
|
+
rpcProofVerifier;
|
|
440
448
|
telemetry;
|
|
441
449
|
log;
|
|
442
450
|
blobClient;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
this.
|
|
459
|
-
this.
|
|
460
|
-
this.
|
|
461
|
-
this.
|
|
462
|
-
this.
|
|
463
|
-
this.
|
|
464
|
-
this.
|
|
465
|
-
this.
|
|
466
|
-
this.
|
|
467
|
-
this.
|
|
468
|
-
this.
|
|
469
|
-
this.
|
|
470
|
-
this.
|
|
471
|
-
this.
|
|
472
|
-
this.
|
|
473
|
-
this.
|
|
474
|
-
this.
|
|
475
|
-
this.
|
|
476
|
-
this.
|
|
477
|
-
this.
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
this.
|
|
481
|
-
|
|
451
|
+
validatorClient;
|
|
452
|
+
keyStoreManager;
|
|
453
|
+
debugLogStore;
|
|
454
|
+
automineSequencer;
|
|
455
|
+
constructor(deps){
|
|
456
|
+
this.config = deps.config;
|
|
457
|
+
this.p2pClient = deps.p2pClient;
|
|
458
|
+
this.blockSource = deps.blockSource;
|
|
459
|
+
this.logsSource = deps.logsSource;
|
|
460
|
+
this.contractDataSource = deps.contractDataSource;
|
|
461
|
+
this.l1ToL2MessageSource = deps.l1ToL2MessageSource;
|
|
462
|
+
this.worldStateSynchronizer = deps.worldStateSynchronizer;
|
|
463
|
+
this.sequencer = deps.sequencer;
|
|
464
|
+
this.proverNode = deps.proverNode;
|
|
465
|
+
this.slasherClient = deps.slasherClient;
|
|
466
|
+
this.validatorsSentinel = deps.validatorsSentinel;
|
|
467
|
+
this.stopStartedWatchers = deps.stopStartedWatchers;
|
|
468
|
+
this.l1ChainId = deps.l1ChainId;
|
|
469
|
+
this.version = deps.version;
|
|
470
|
+
this.globalVariableBuilder = deps.globalVariableBuilder;
|
|
471
|
+
this.rollupContract = deps.rollupContract;
|
|
472
|
+
this.feeProvider = deps.feeProvider;
|
|
473
|
+
this.epochCache = deps.epochCache;
|
|
474
|
+
this.packageVersion = deps.packageVersion;
|
|
475
|
+
this.peerProofVerifier = deps.peerProofVerifier;
|
|
476
|
+
this.rpcProofVerifier = deps.rpcProofVerifier;
|
|
477
|
+
this.telemetry = deps.telemetry ?? getTelemetryClient();
|
|
478
|
+
this.log = deps.log ?? createLogger('node');
|
|
479
|
+
this.blobClient = deps.blobClient;
|
|
480
|
+
this.validatorClient = deps.validatorClient;
|
|
481
|
+
this.keyStoreManager = deps.keyStoreManager;
|
|
482
|
+
this.debugLogStore = deps.debugLogStore ?? new NullDebugLogStore();
|
|
483
|
+
this.automineSequencer = deps.automineSequencer;
|
|
484
|
+
this.metrics = new NodeMetrics(this.telemetry, 'AztecNodeService');
|
|
485
|
+
this.tracer = this.telemetry.getTracer('AztecNodeService');
|
|
486
|
+
// The node never represents a proposer's payout addresses, so the simulator zeroes coinbase and
|
|
487
|
+
// fee recipient. The signature context only needs chain id + rollup address (see signature_utils).
|
|
488
|
+
this.nodePublicCallsSimulator = new NodePublicCallsSimulator({
|
|
489
|
+
blockSource: this.blockSource,
|
|
490
|
+
worldStateSynchronizer: this.worldStateSynchronizer,
|
|
491
|
+
l1ToL2MessageSource: this.l1ToL2MessageSource,
|
|
492
|
+
contractDataSource: this.contractDataSource,
|
|
493
|
+
globalVariableBuilder: this.globalVariableBuilder,
|
|
494
|
+
rollupContract: this.rollupContract,
|
|
495
|
+
epochCache: this.epochCache,
|
|
496
|
+
signatureContext: {
|
|
497
|
+
chainId: this.l1ChainId,
|
|
498
|
+
rollupAddress: this.config.rollupAddress
|
|
499
|
+
},
|
|
500
|
+
config: this.config,
|
|
501
|
+
telemetry: this.telemetry,
|
|
502
|
+
log: this.log.createChild('public-calls-simulator')
|
|
503
|
+
});
|
|
504
|
+
this.worldStateQueries = new NodeWorldStateQueries({
|
|
505
|
+
worldStateSynchronizer: this.worldStateSynchronizer,
|
|
506
|
+
blockSource: this.blockSource,
|
|
507
|
+
l1ToL2MessageSource: this.l1ToL2MessageSource,
|
|
508
|
+
log: this.log.createChild('world-state-queries')
|
|
509
|
+
});
|
|
510
|
+
this.blockProvider = new NodeBlockProvider(this.blockSource);
|
|
511
|
+
this.txReceiptBuilder = new NodeTxReceiptBuilder({
|
|
512
|
+
p2pClient: this.p2pClient,
|
|
513
|
+
blockSource: this.blockSource,
|
|
514
|
+
debugLogStore: this.debugLogStore
|
|
515
|
+
});
|
|
482
516
|
this.log.info(`Aztec Node version: ${this.packageVersion}`);
|
|
483
|
-
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config
|
|
517
|
+
this.log.info(`Aztec Node started on chain 0x${this.l1ChainId.toString(16)}`, pickL1ContractAddresses(this.config));
|
|
518
|
+
// A defensive check that protects us against introducing a bug in the complex node creation flow. We must
|
|
519
|
+
// never have debugLogStore enabled when not in test mode because then we would be accumulating debug logs in
|
|
520
|
+
// memory which could be a DoS vector on the sequencer (since no fees are paid for debug logs).
|
|
521
|
+
if (this.debugLogStore.isEnabled && this.config.realProofs) {
|
|
522
|
+
throw new Error('debugLogStore should never be enabled when realProofs are set');
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
/** @internal Exposed for testing — returns the RPC proof verifier. */ getProofVerifier() {
|
|
526
|
+
return this.rpcProofVerifier;
|
|
484
527
|
}
|
|
485
528
|
async getWorldStateSyncStatus() {
|
|
486
529
|
const status = await this.worldStateSynchronizer.status();
|
|
487
530
|
return status.syncSummary;
|
|
488
531
|
}
|
|
489
|
-
|
|
532
|
+
getChainTips() {
|
|
490
533
|
return this.blockSource.getL2Tips();
|
|
491
534
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
if (
|
|
509
|
-
|
|
510
|
-
keyStoreManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
511
|
-
} else {
|
|
512
|
-
const keyStore = createKeyStoreForValidator(config);
|
|
513
|
-
if (keyStore) {
|
|
514
|
-
keyStoreManager = new KeystoreManager(keyStore);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
await keyStoreManager?.validateSigners();
|
|
518
|
-
// If we are a validator, verify our configuration before doing too much more.
|
|
519
|
-
if (!config.disableValidator) {
|
|
520
|
-
if (keyStoreManager === undefined) {
|
|
521
|
-
throw new Error('Failed to create key store, a requirement for running a validator');
|
|
522
|
-
}
|
|
523
|
-
if (!keyStoreProvided) {
|
|
524
|
-
log.warn('KEY STORE CREATED FROM ENVIRONMENT, IT IS RECOMMENDED TO USE A FILE-BASED KEY STORE IN PRODUCTION ENVIRONMENTS');
|
|
525
|
-
}
|
|
526
|
-
ValidatorClient.validateKeyStoreConfiguration(keyStoreManager, log);
|
|
527
|
-
}
|
|
528
|
-
// validate that the actual chain id matches that specified in configuration
|
|
529
|
-
if (config.l1ChainId !== ethereumChain.chainInfo.id) {
|
|
530
|
-
throw new Error(`RPC URL configured for chain id ${ethereumChain.chainInfo.id} but expected id ${config.l1ChainId}`);
|
|
531
|
-
}
|
|
532
|
-
const publicClient = createPublicClient({
|
|
533
|
-
chain: ethereumChain.chainInfo,
|
|
534
|
-
transport: fallback(config.l1RpcUrls.map((url)=>http(url, {
|
|
535
|
-
batch: false
|
|
536
|
-
}))),
|
|
537
|
-
pollingInterval: config.viemPollingIntervalMS
|
|
538
|
-
});
|
|
539
|
-
const l1ContractsAddresses = await RegistryContract.collectAddresses(publicClient, config.l1Contracts.registryAddress, config.rollupVersion ?? 'canonical');
|
|
540
|
-
// Overwrite the passed in vars.
|
|
541
|
-
config.l1Contracts = {
|
|
542
|
-
...config.l1Contracts,
|
|
543
|
-
...l1ContractsAddresses
|
|
544
|
-
};
|
|
545
|
-
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
546
|
-
const [l1GenesisTime, slotDuration, rollupVersionFromRollup] = await Promise.all([
|
|
547
|
-
rollupContract.getL1GenesisTime(),
|
|
548
|
-
rollupContract.getSlotDuration(),
|
|
549
|
-
rollupContract.getVersion()
|
|
550
|
-
]);
|
|
551
|
-
config.rollupVersion ??= Number(rollupVersionFromRollup);
|
|
552
|
-
if (config.rollupVersion !== Number(rollupVersionFromRollup)) {
|
|
553
|
-
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
|
-
}
|
|
555
|
-
const blobClient = await createBlobClientWithFileStores(config, createLogger('node:blob-client:client'));
|
|
556
|
-
// attempt snapshot sync if possible
|
|
557
|
-
await trySnapshotSync(config, log);
|
|
558
|
-
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config, {
|
|
559
|
-
dateProvider
|
|
560
|
-
});
|
|
561
|
-
const archiver = await createArchiver(config, {
|
|
562
|
-
blobClient,
|
|
563
|
-
epochCache,
|
|
564
|
-
telemetry,
|
|
565
|
-
dateProvider
|
|
566
|
-
}, {
|
|
567
|
-
blockUntilSync: !config.skipArchiverInitialSync
|
|
568
|
-
});
|
|
569
|
-
// now create the merkle trees and the world state synchronizer
|
|
570
|
-
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, options.prefilledPublicData, telemetry);
|
|
571
|
-
const circuitVerifier = config.realProofs || config.debugForceTxProofVerification ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier(config.proverTestVerificationDelayMs);
|
|
572
|
-
if (!config.realProofs) {
|
|
573
|
-
log.warn(`Aztec node is accepting fake proofs`);
|
|
574
|
-
}
|
|
575
|
-
const proofVerifier = new QueuedIVCVerifier(config, circuitVerifier);
|
|
576
|
-
// create the tx pool and the p2p client, which will need the l2 block source
|
|
577
|
-
const p2pClient = await createP2PClient(P2PClientType.Full, config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, dateProvider, telemetry, deps.p2pClientDeps);
|
|
578
|
-
// We should really not be modifying the config object
|
|
579
|
-
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
|
|
580
|
-
// Create FullNodeCheckpointsBuilder for validator and non-validator block proposal handling
|
|
581
|
-
const validatorCheckpointsBuilder = new FullNodeCheckpointsBuilder({
|
|
582
|
-
...config,
|
|
583
|
-
l1GenesisTime,
|
|
584
|
-
slotDuration: Number(slotDuration)
|
|
585
|
-
}, worldStateSynchronizer, archiver, dateProvider, telemetry);
|
|
586
|
-
// We'll accumulate sentinel watchers here
|
|
587
|
-
const watchers = [];
|
|
588
|
-
// Create validator client if required
|
|
589
|
-
const validatorClient = await createValidatorClient(config, {
|
|
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, {
|
|
615
|
-
checkpointsBuilder: validatorCheckpointsBuilder,
|
|
616
|
-
worldState: worldStateSynchronizer,
|
|
617
|
-
epochCache,
|
|
618
|
-
blockSource: archiver,
|
|
619
|
-
l1ToL2MessageSource: archiver,
|
|
620
|
-
p2pClient,
|
|
621
|
-
dateProvider,
|
|
622
|
-
telemetry
|
|
623
|
-
}).registerForReexecution(p2pClient);
|
|
624
|
-
}
|
|
625
|
-
// Start world state and wait for it to sync to the archiver.
|
|
626
|
-
await worldStateSynchronizer.start();
|
|
627
|
-
// Start p2p. Note that it depends on world state to be running.
|
|
628
|
-
await p2pClient.start();
|
|
629
|
-
const validatorsSentinel = await createSentinel(epochCache, archiver, p2pClient, config);
|
|
630
|
-
if (validatorsSentinel && config.slashInactivityPenalty > 0n) {
|
|
631
|
-
watchers.push(validatorsSentinel);
|
|
632
|
-
}
|
|
633
|
-
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
|
-
let attestationsBlockWatcher;
|
|
640
|
-
if (config.slashProposeInvalidAttestationsPenalty > 0n || config.slashAttestDescendantOfInvalidPenalty > 0n) {
|
|
641
|
-
attestationsBlockWatcher = new AttestationsBlockWatcher(archiver, epochCache, config);
|
|
642
|
-
watchers.push(attestationsBlockWatcher);
|
|
643
|
-
}
|
|
644
|
-
// Start p2p-related services once the archiver has completed sync
|
|
645
|
-
void archiver.waitForInitialSync().then(async ()=>{
|
|
646
|
-
await p2pClient.start();
|
|
647
|
-
await validatorsSentinel?.start();
|
|
648
|
-
await epochPruneWatcher?.start();
|
|
649
|
-
await attestationsBlockWatcher?.start();
|
|
650
|
-
log.info(`All p2p services started`);
|
|
651
|
-
}).catch((err)=>log.error('Failed to start p2p services after archiver sync', err));
|
|
652
|
-
// Validator enabled, create/start relevant service
|
|
653
|
-
let sequencer;
|
|
654
|
-
let slasherClient;
|
|
655
|
-
if (!config.disableValidator && validatorClient) {
|
|
656
|
-
// We create a slasher only if we have a sequencer, since all slashing actions go through the sequencer publisher
|
|
657
|
-
// as they are executed when the node is selected as proposer.
|
|
658
|
-
const validatorAddresses = keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager).getAddresses() : [];
|
|
659
|
-
slasherClient = await createSlasher(config, config.l1Contracts, getPublicClient(config), watchers, dateProvider, epochCache, validatorAddresses, undefined);
|
|
660
|
-
await slasherClient.start();
|
|
661
|
-
const l1TxUtils = config.publisherForwarderAddress ? await createForwarderL1TxUtilsFromEthSigner(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), config.publisherForwarderAddress, {
|
|
662
|
-
...config,
|
|
663
|
-
scope: 'sequencer'
|
|
664
|
-
}, {
|
|
665
|
-
telemetry,
|
|
666
|
-
logger: log.createChild('l1-tx-utils'),
|
|
667
|
-
dateProvider
|
|
668
|
-
}) : await createL1TxUtilsWithBlobsFromEthSigner(publicClient, keyStoreManager.createAllValidatorPublisherSigners(), {
|
|
669
|
-
...config,
|
|
670
|
-
scope: 'sequencer'
|
|
671
|
-
}, {
|
|
672
|
-
telemetry,
|
|
673
|
-
logger: log.createChild('l1-tx-utils'),
|
|
674
|
-
dateProvider
|
|
675
|
-
});
|
|
676
|
-
// Create and start the sequencer client
|
|
677
|
-
const checkpointsBuilder = new CheckpointsBuilder({
|
|
678
|
-
...config,
|
|
679
|
-
l1GenesisTime,
|
|
680
|
-
slotDuration: Number(slotDuration)
|
|
681
|
-
}, worldStateSynchronizer, archiver, dateProvider, telemetry);
|
|
682
|
-
sequencer = await SequencerClient.new(config, {
|
|
683
|
-
...deps,
|
|
684
|
-
epochCache,
|
|
685
|
-
l1TxUtils,
|
|
686
|
-
validatorClient,
|
|
687
|
-
p2pClient,
|
|
688
|
-
worldStateSynchronizer,
|
|
689
|
-
slasherClient,
|
|
690
|
-
checkpointsBuilder,
|
|
691
|
-
l2BlockSource: archiver,
|
|
692
|
-
l1ToL2MessageSource: archiver,
|
|
693
|
-
telemetry,
|
|
694
|
-
dateProvider,
|
|
695
|
-
blobClient,
|
|
696
|
-
nodeKeyStore: keyStoreManager
|
|
697
|
-
});
|
|
535
|
+
getL1Constants() {
|
|
536
|
+
return this.blockSource.getL1Constants();
|
|
537
|
+
}
|
|
538
|
+
getSyncedL2SlotNumber() {
|
|
539
|
+
return this.blockSource.getSyncedL2SlotNumber();
|
|
540
|
+
}
|
|
541
|
+
getSyncedL2EpochNumber() {
|
|
542
|
+
return this.blockSource.getSyncedL2EpochNumber();
|
|
543
|
+
}
|
|
544
|
+
getSyncedL1Timestamp() {
|
|
545
|
+
return this.blockSource.getL1Timestamp();
|
|
546
|
+
}
|
|
547
|
+
getCheckpointsData(query) {
|
|
548
|
+
return this.blockSource.getCheckpointsData(query);
|
|
549
|
+
}
|
|
550
|
+
async getBlockNumber(tip) {
|
|
551
|
+
if (tip === undefined || tip === 'proposed') {
|
|
552
|
+
return this.blockSource.getBlockNumber();
|
|
698
553
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
554
|
+
return await this.blockSource.getBlockNumber({
|
|
555
|
+
tag: tip
|
|
556
|
+
}) ?? BlockNumber.ZERO;
|
|
557
|
+
}
|
|
558
|
+
async getCheckpointNumber(tip) {
|
|
559
|
+
const tips = await this.blockSource.getL2Tips();
|
|
560
|
+
switch(tip){
|
|
561
|
+
case undefined:
|
|
562
|
+
case 'checkpointed':
|
|
563
|
+
return tips.checkpointed.checkpoint.number;
|
|
564
|
+
case 'proven':
|
|
565
|
+
return tips.proven.checkpoint.number;
|
|
566
|
+
case 'finalized':
|
|
567
|
+
return tips.finalized.checkpoint.number;
|
|
704
568
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
569
|
+
}
|
|
570
|
+
getBlock(param, options = {}) {
|
|
571
|
+
return this.blockProvider.getBlock(param, options);
|
|
572
|
+
}
|
|
573
|
+
getBlockData(param) {
|
|
574
|
+
return this.blockProvider.getBlockData(param);
|
|
575
|
+
}
|
|
576
|
+
getBlocks(from, limit, options = {}) {
|
|
577
|
+
return this.blockProvider.getBlocks(from, limit, options);
|
|
578
|
+
}
|
|
579
|
+
getCheckpoint(param, options = {}) {
|
|
580
|
+
return this.blockProvider.getCheckpoint(param, options);
|
|
581
|
+
}
|
|
582
|
+
getCheckpoints(from, limit, options = {}) {
|
|
583
|
+
return this.blockProvider.getCheckpoints(from, limit, options);
|
|
712
584
|
}
|
|
713
585
|
/**
|
|
714
586
|
* Returns the sequencer client instance.
|
|
@@ -716,6 +588,12 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
716
588
|
*/ getSequencer() {
|
|
717
589
|
return this.sequencer;
|
|
718
590
|
}
|
|
591
|
+
/** Test-only: returns the AutomineSequencer when wired via `useAutomineSequencer`. */ getAutomineSequencer() {
|
|
592
|
+
return this.automineSequencer;
|
|
593
|
+
}
|
|
594
|
+
/** Returns the prover node subsystem, if enabled. */ getProverNode() {
|
|
595
|
+
return this.proverNode;
|
|
596
|
+
}
|
|
719
597
|
getBlockSource() {
|
|
720
598
|
return this.blockSource;
|
|
721
599
|
}
|
|
@@ -729,13 +607,16 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
729
607
|
* Method to return the currently deployed L1 contract addresses.
|
|
730
608
|
* @returns - The currently deployed L1 contract addresses.
|
|
731
609
|
*/ getL1ContractAddresses() {
|
|
732
|
-
return Promise.resolve(this.config
|
|
610
|
+
return Promise.resolve(pickL1ContractAddresses(this.config));
|
|
733
611
|
}
|
|
734
612
|
getEncodedEnr() {
|
|
735
613
|
return Promise.resolve(this.p2pClient.getEnr()?.encodeTxt());
|
|
736
614
|
}
|
|
737
615
|
async getAllowedPublicSetup() {
|
|
738
|
-
return
|
|
616
|
+
return [
|
|
617
|
+
...await getDefaultAllowedSetupFunctions(),
|
|
618
|
+
...this.config.txPublicSetupAllowListExtend ?? []
|
|
619
|
+
];
|
|
739
620
|
}
|
|
740
621
|
/**
|
|
741
622
|
* Method to determine if the node is ready to accept transactions.
|
|
@@ -744,82 +625,47 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
744
625
|
return Promise.resolve(this.p2pClient.isReady() ?? false);
|
|
745
626
|
}
|
|
746
627
|
async getNodeInfo() {
|
|
747
|
-
const [nodeVersion, rollupVersion, chainId, enr, contractAddresses, protocolContractAddresses] = await Promise.all([
|
|
628
|
+
const [nodeVersion, rollupVersion, chainId, enr, contractAddresses, protocolContractAddresses, l1Constants] = await Promise.all([
|
|
748
629
|
this.getNodeVersion(),
|
|
749
630
|
this.getVersion(),
|
|
750
631
|
this.getChainId(),
|
|
751
632
|
this.getEncodedEnr(),
|
|
752
633
|
this.getL1ContractAddresses(),
|
|
753
|
-
this.getProtocolContractAddresses()
|
|
634
|
+
this.getProtocolContractAddresses(),
|
|
635
|
+
this.blockSource.getL1Constants()
|
|
754
636
|
]);
|
|
637
|
+
// Gas limits a single tx may declare on this network, derived from network-wide constants only (the
|
|
638
|
+
// timetable's blocks-per-checkpoint and the network-minimum per-block multipliers) — never this node's
|
|
639
|
+
// local caps or configured multipliers, which can make the node stricter at block-building time but
|
|
640
|
+
// cannot define what the network accepts for relay. Clients read txsLimits to set fallback gas limits.
|
|
641
|
+
const maxTxGas = getNetworkTxGasLimits(this.config, l1Constants);
|
|
755
642
|
const nodeInfo = {
|
|
756
643
|
nodeVersion,
|
|
757
644
|
l1ChainId: chainId,
|
|
758
645
|
rollupVersion,
|
|
759
646
|
enr,
|
|
760
647
|
l1ContractAddresses: contractAddresses,
|
|
761
|
-
protocolContractAddresses: protocolContractAddresses
|
|
648
|
+
protocolContractAddresses: protocolContractAddresses,
|
|
649
|
+
realProofs: !!this.config.realProofs,
|
|
650
|
+
txsLimits: {
|
|
651
|
+
gas: {
|
|
652
|
+
daGas: maxTxGas.daGas,
|
|
653
|
+
l2Gas: maxTxGas.l2Gas
|
|
654
|
+
}
|
|
655
|
+
}
|
|
762
656
|
};
|
|
763
657
|
return nodeInfo;
|
|
764
658
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
* @param block - The block parameter (block number, block hash, or 'latest').
|
|
768
|
-
* @returns The requested block.
|
|
769
|
-
*/ async getBlock(block) {
|
|
770
|
-
if (L2BlockHash.isL2BlockHash(block)) {
|
|
771
|
-
return this.getBlockByHash(Fr.fromBuffer(block.toBuffer()));
|
|
772
|
-
}
|
|
773
|
-
const blockNumber = block === 'latest' ? await this.getBlockNumber() : block;
|
|
774
|
-
if (blockNumber === BlockNumber.ZERO) {
|
|
775
|
-
return this.buildInitialBlock();
|
|
776
|
-
}
|
|
777
|
-
return await this.blockSource.getL2Block(blockNumber);
|
|
659
|
+
async getCurrentMinFees() {
|
|
660
|
+
return await this.feeProvider.getCurrentMinFees();
|
|
778
661
|
}
|
|
779
|
-
/**
|
|
780
|
-
|
|
781
|
-
* @param blockHash - The block hash being requested.
|
|
782
|
-
* @returns The requested block.
|
|
783
|
-
*/ async getBlockByHash(blockHash) {
|
|
784
|
-
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
785
|
-
if (blockHash.equals(Fr.fromBuffer(initialBlockHash.toBuffer()))) {
|
|
786
|
-
return this.buildInitialBlock();
|
|
787
|
-
}
|
|
788
|
-
return await this.blockSource.getL2BlockByHash(blockHash);
|
|
789
|
-
}
|
|
790
|
-
buildInitialBlock() {
|
|
791
|
-
const initialHeader = this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
792
|
-
return L2Block.empty(initialHeader);
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* Get a block specified by its archive root.
|
|
796
|
-
* @param archive - The archive root being requested.
|
|
797
|
-
* @returns The requested block.
|
|
798
|
-
*/ async getBlockByArchive(archive) {
|
|
799
|
-
return await this.blockSource.getL2BlockByArchive(archive);
|
|
800
|
-
}
|
|
801
|
-
/**
|
|
802
|
-
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
803
|
-
* @param from - The start of the range of blocks to return.
|
|
804
|
-
* @param limit - The maximum number of blocks to obtain.
|
|
805
|
-
* @returns The blocks requested.
|
|
806
|
-
*/ async getBlocks(from, limit) {
|
|
807
|
-
return await this.blockSource.getBlocks(from, BlockNumber(limit)) ?? [];
|
|
808
|
-
}
|
|
809
|
-
async getCheckpoints(from, limit) {
|
|
810
|
-
return await this.blockSource.getCheckpoints(from, limit) ?? [];
|
|
811
|
-
}
|
|
812
|
-
async getCheckpointedBlocks(from, limit) {
|
|
813
|
-
return await this.blockSource.getCheckpointedBlocks(from, limit) ?? [];
|
|
814
|
-
}
|
|
815
|
-
/**
|
|
816
|
-
* Method to fetch the current min L2 fees.
|
|
817
|
-
* @returns The current min L2 fees.
|
|
818
|
-
*/ async getCurrentMinFees() {
|
|
819
|
-
return await this.globalVariableBuilder.getCurrentMinFees();
|
|
662
|
+
/** Returns predicted min fees for the current slot and next N slots. */ async getPredictedMinFees(manaUsage) {
|
|
663
|
+
return await this.feeProvider.getPredictedMinFees(manaUsage);
|
|
820
664
|
}
|
|
821
665
|
async getMaxPriorityFees() {
|
|
822
|
-
for await (const tx of this.p2pClient.iteratePendingTxs(
|
|
666
|
+
for await (const tx of this.p2pClient.iteratePendingTxs({
|
|
667
|
+
includeProof: false
|
|
668
|
+
})){
|
|
823
669
|
return tx.getGasSettings().maxPriorityFeesPerGas;
|
|
824
670
|
}
|
|
825
671
|
return GasFees.from({
|
|
@@ -828,18 +674,6 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
828
674
|
});
|
|
829
675
|
}
|
|
830
676
|
/**
|
|
831
|
-
* Method to fetch the latest block number synchronized by the node.
|
|
832
|
-
* @returns The block number.
|
|
833
|
-
*/ async getBlockNumber() {
|
|
834
|
-
return await this.blockSource.getBlockNumber();
|
|
835
|
-
}
|
|
836
|
-
async getProvenBlockNumber() {
|
|
837
|
-
return await this.blockSource.getProvenBlockNumber();
|
|
838
|
-
}
|
|
839
|
-
async getCheckpointedBlockNumber() {
|
|
840
|
-
return await this.blockSource.getCheckpointedL2BlockNumber();
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
677
|
* Method to fetch the version of the package.
|
|
844
678
|
* @returns The node package version
|
|
845
679
|
*/ getNodeVersion() {
|
|
@@ -860,48 +694,18 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
860
694
|
getContractClass(id) {
|
|
861
695
|
return this.contractDataSource.getContractClass(id);
|
|
862
696
|
}
|
|
863
|
-
getContract(address) {
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
if (referenceBlock) {
|
|
868
|
-
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
869
|
-
if (!referenceBlock.equals(initialBlockHash)) {
|
|
870
|
-
const blockHashFr = Fr.fromBuffer(referenceBlock.toBuffer());
|
|
871
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
872
|
-
if (!header) {
|
|
873
|
-
throw new Error(`Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
return this.logsSource.getPrivateLogsByTags(tags, page);
|
|
878
|
-
}
|
|
879
|
-
async getPublicLogsByTagsFromContract(contractAddress, tags, page, referenceBlock) {
|
|
880
|
-
if (referenceBlock) {
|
|
881
|
-
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
882
|
-
if (!referenceBlock.equals(initialBlockHash)) {
|
|
883
|
-
const blockHashFr = Fr.fromBuffer(referenceBlock.toBuffer());
|
|
884
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
885
|
-
if (!header) {
|
|
886
|
-
throw new Error(`Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
697
|
+
async getContract(address, referenceBlock = 'latest') {
|
|
698
|
+
const blockData = await this.getBlockData(referenceBlock);
|
|
699
|
+
if (!blockData) {
|
|
700
|
+
throw new Error(`Reference block ${inspectBlockParameter(referenceBlock)} not found when querying contract ${address}. If the node API has been queried with an anchor block hash, possibly a reorg has occurred.`);
|
|
889
701
|
}
|
|
890
|
-
return this.
|
|
702
|
+
return this.contractDataSource.getContract(address, blockData.header.globalVariables.timestamp);
|
|
891
703
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
* @param filter - The filter to apply to the logs.
|
|
895
|
-
* @returns The requested logs.
|
|
896
|
-
*/ getPublicLogs(filter) {
|
|
897
|
-
return this.logsSource.getPublicLogs(filter);
|
|
704
|
+
getPrivateLogsByTags(query) {
|
|
705
|
+
return this.logsSource.getPrivateLogsByTags(query);
|
|
898
706
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
* @param filter - The filter to apply to the logs.
|
|
902
|
-
* @returns The requested logs.
|
|
903
|
-
*/ getContractClassLogs(filter) {
|
|
904
|
-
return this.logsSource.getContractClassLogs(filter);
|
|
707
|
+
getPublicLogsByTags(query) {
|
|
708
|
+
return this.logsSource.getPublicLogsByTags(query);
|
|
905
709
|
}
|
|
906
710
|
/**
|
|
907
711
|
* Method to submit a transaction to the p2p pool.
|
|
@@ -921,31 +725,23 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
921
725
|
});
|
|
922
726
|
throw new Error(`Invalid tx: ${reason}`);
|
|
923
727
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
728
|
+
try {
|
|
729
|
+
await this.p2pClient.sendTx(tx);
|
|
730
|
+
} catch (err) {
|
|
731
|
+
this.metrics.receivedTx(timer.ms(), false);
|
|
732
|
+
this.log.warn(`Mempool rejected tx ${txHash}: ${err.message}`, {
|
|
733
|
+
txHash
|
|
734
|
+
});
|
|
735
|
+
throw err;
|
|
736
|
+
}
|
|
737
|
+
const duration = timer.ms();
|
|
738
|
+
this.metrics.receivedTx(duration, true);
|
|
739
|
+
this.log.info(`Received tx ${txHash} in ${duration}ms`, {
|
|
927
740
|
txHash
|
|
928
741
|
});
|
|
929
742
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
// as a fallback if we don't find a settled receipt in the archiver.
|
|
933
|
-
const txPoolStatus = await this.p2pClient.getTxStatus(txHash);
|
|
934
|
-
const isKnownToPool = txPoolStatus === 'pending' || txPoolStatus === 'mined';
|
|
935
|
-
// Then get the actual tx from the archiver, which tracks every tx in a mined block.
|
|
936
|
-
const settledTxReceipt = await this.blockSource.getSettledTxReceipt(txHash);
|
|
937
|
-
if (settledTxReceipt) {
|
|
938
|
-
// If the archiver has the receipt then return it.
|
|
939
|
-
return settledTxReceipt;
|
|
940
|
-
} else if (isKnownToPool) {
|
|
941
|
-
// If the tx is in the pool but not in the archiver, it's pending.
|
|
942
|
-
// This handles race conditions between archiver and p2p, where the archiver
|
|
943
|
-
// has pruned the block in which a tx was mined, but p2p has not caught up yet.
|
|
944
|
-
return new TxReceipt(txHash, TxStatus.PENDING, undefined, undefined);
|
|
945
|
-
} else {
|
|
946
|
-
// Otherwise, if we don't know the tx, we consider it dropped.
|
|
947
|
-
return new TxReceipt(txHash, TxStatus.DROPPED, undefined, 'Tx dropped by P2P node');
|
|
948
|
-
}
|
|
743
|
+
getTxReceipt(txHash, options) {
|
|
744
|
+
return this.txReceiptBuilder.getTxReceipt(txHash, options);
|
|
949
745
|
}
|
|
950
746
|
getTxEffect(txHash) {
|
|
951
747
|
return this.blockSource.getTxEffect(txHash);
|
|
@@ -954,11 +750,15 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
954
750
|
* Method to stop the aztec node.
|
|
955
751
|
*/ async stop() {
|
|
956
752
|
this.log.info(`Stopping Aztec Node`);
|
|
957
|
-
await
|
|
958
|
-
await tryStop(this.epochPruneWatcher);
|
|
753
|
+
await this.stopStartedWatchers();
|
|
959
754
|
await tryStop(this.slasherClient);
|
|
960
|
-
await
|
|
755
|
+
await Promise.all([
|
|
756
|
+
tryStop(this.peerProofVerifier),
|
|
757
|
+
tryStop(this.rpcProofVerifier)
|
|
758
|
+
]);
|
|
961
759
|
await tryStop(this.sequencer);
|
|
760
|
+
await tryStop(this.automineSequencer);
|
|
761
|
+
await tryStop(this.proverNode);
|
|
962
762
|
await tryStop(this.p2pClient);
|
|
963
763
|
await tryStop(this.worldStateSynchronizer);
|
|
964
764
|
await tryStop(this.blockSource);
|
|
@@ -977,310 +777,121 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
977
777
|
* @param limit - The number of items to returns
|
|
978
778
|
* @param after - The last known pending tx. Used for pagination
|
|
979
779
|
* @returns - The pending txs.
|
|
980
|
-
*/ getPendingTxs(limit, after) {
|
|
981
|
-
return this.p2pClient.getPendingTxs(limit, after);
|
|
780
|
+
*/ getPendingTxs(limit, after, options) {
|
|
781
|
+
return this.p2pClient.getPendingTxs(limit, after, options);
|
|
982
782
|
}
|
|
983
783
|
getPendingTxCount() {
|
|
984
784
|
return this.p2pClient.getPendingTxCount();
|
|
985
785
|
}
|
|
786
|
+
getPeers(includePending) {
|
|
787
|
+
return this.p2pClient.getPeers(includePending);
|
|
788
|
+
}
|
|
789
|
+
getCheckpointAttestationsForSlot(slot, proposalPayloadHash) {
|
|
790
|
+
return this.p2pClient.getCheckpointAttestationsForSlot(slot, proposalPayloadHash);
|
|
791
|
+
}
|
|
792
|
+
getProposalsForSlot(slot) {
|
|
793
|
+
return this.p2pClient.getProposalsForSlot(slot);
|
|
794
|
+
}
|
|
986
795
|
/**
|
|
987
|
-
* Method to retrieve a single tx from the mempool or unfinalized chain.
|
|
796
|
+
* Method to retrieve a single tx from the mempool or unfinalized chain. The tx's proof is only loaded and returned
|
|
797
|
+
* when `includeProof` is set.
|
|
988
798
|
* @param txHash - The transaction hash to return.
|
|
799
|
+
* @param options - Options for the returned tx (eg whether to include its proof).
|
|
989
800
|
* @returns - The tx if it exists.
|
|
990
|
-
*/ getTxByHash(txHash) {
|
|
991
|
-
return
|
|
801
|
+
*/ getTxByHash(txHash, options) {
|
|
802
|
+
return this.p2pClient.getTxByHashFromPool(txHash, {
|
|
803
|
+
includeProof: !!options?.includeProof
|
|
804
|
+
});
|
|
992
805
|
}
|
|
993
806
|
/**
|
|
994
|
-
* Method to retrieve txs from the mempool or unfinalized chain.
|
|
807
|
+
* Method to retrieve txs from the mempool or unfinalized chain. The txs' proofs are only loaded and returned when
|
|
808
|
+
* `includeProof` is set.
|
|
995
809
|
* @param txHash - The transaction hash to return.
|
|
810
|
+
* @param options - Options for the returned txs (eg whether to include their proofs).
|
|
996
811
|
* @returns - The txs if it exists.
|
|
997
|
-
*/ async getTxsByHash(txHashes) {
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
async findLeavesIndexes(block, treeId, leafValues) {
|
|
1001
|
-
const committedDb = await this.#getWorldState(block);
|
|
1002
|
-
const maybeIndices = await committedDb.findLeafIndices(treeId, leafValues.map((x)=>x.toBuffer()));
|
|
1003
|
-
// We filter out undefined values
|
|
1004
|
-
const indices = maybeIndices.filter((x)=>x !== undefined);
|
|
1005
|
-
// Now we find the block numbers for the indices
|
|
1006
|
-
const blockNumbers = await committedDb.getBlockNumbersForLeafIndices(treeId, indices);
|
|
1007
|
-
// If any of the block numbers are undefined, we throw an error.
|
|
1008
|
-
for(let i = 0; i < indices.length; i++){
|
|
1009
|
-
if (blockNumbers[i] === undefined) {
|
|
1010
|
-
throw new Error(`Block number is undefined for leaf index ${indices[i]} in tree ${MerkleTreeId[treeId]}`);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
// Get unique block numbers in order to optimize num calls to getLeafValue function.
|
|
1014
|
-
const uniqueBlockNumbers = [
|
|
1015
|
-
...new Set(blockNumbers.filter((x)=>x !== undefined))
|
|
1016
|
-
];
|
|
1017
|
-
// Now we obtain the block hashes from the archive tree by calling await `committedDb.getLeafValue(treeId, index)`
|
|
1018
|
-
// (note that block number corresponds to the leaf index in the archive tree).
|
|
1019
|
-
const blockHashes = await Promise.all(uniqueBlockNumbers.map((blockNumber)=>{
|
|
1020
|
-
return committedDb.getLeafValue(MerkleTreeId.ARCHIVE, BigInt(blockNumber));
|
|
1021
|
-
}));
|
|
1022
|
-
// If any of the block hashes are undefined, we throw an error.
|
|
1023
|
-
for(let i = 0; i < uniqueBlockNumbers.length; i++){
|
|
1024
|
-
if (blockHashes[i] === undefined) {
|
|
1025
|
-
throw new Error(`Block hash is undefined for block number ${uniqueBlockNumbers[i]}`);
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
// Create DataInBlock objects by combining indices, blockNumbers and blockHashes and return them.
|
|
1029
|
-
return maybeIndices.map((index, i)=>{
|
|
1030
|
-
if (index === undefined) {
|
|
1031
|
-
return undefined;
|
|
1032
|
-
}
|
|
1033
|
-
const blockNumber = blockNumbers[i];
|
|
1034
|
-
if (blockNumber === undefined) {
|
|
1035
|
-
return undefined;
|
|
1036
|
-
}
|
|
1037
|
-
const blockHashIndex = uniqueBlockNumbers.indexOf(blockNumber);
|
|
1038
|
-
const blockHash = blockHashes[blockHashIndex];
|
|
1039
|
-
if (!blockHash) {
|
|
1040
|
-
return undefined;
|
|
1041
|
-
}
|
|
1042
|
-
return {
|
|
1043
|
-
l2BlockNumber: BlockNumber(Number(blockNumber)),
|
|
1044
|
-
l2BlockHash: L2BlockHash.fromField(blockHash),
|
|
1045
|
-
data: index
|
|
1046
|
-
};
|
|
812
|
+
*/ async getTxsByHash(txHashes, options) {
|
|
813
|
+
const txs = await this.p2pClient.getTxsByHashFromPool(txHashes, {
|
|
814
|
+
includeProof: !!options?.includeProof
|
|
1047
815
|
});
|
|
816
|
+
return compactArray(txs);
|
|
1048
817
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
return committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, leafIndex);
|
|
818
|
+
findLeavesIndexes(referenceBlock, treeId, leafValues) {
|
|
819
|
+
return this.worldStateQueries.findLeavesIndexes(referenceBlock, treeId, leafValues);
|
|
1052
820
|
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
return committedDb.getSiblingPath(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
|
|
821
|
+
getBlockHashMembershipWitness(referenceBlock, blockHash) {
|
|
822
|
+
return this.worldStateQueries.getBlockHashMembershipWitness(referenceBlock, blockHash);
|
|
1056
823
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
const [pathAndIndex] = await committedDb.findSiblingPaths(MerkleTreeId.ARCHIVE, [
|
|
1060
|
-
archive
|
|
1061
|
-
]);
|
|
1062
|
-
return pathAndIndex === undefined ? undefined : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
824
|
+
getNoteHashMembershipWitness(referenceBlock, noteHash) {
|
|
825
|
+
return this.worldStateQueries.getNoteHashMembershipWitness(referenceBlock, noteHash);
|
|
1063
826
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
const [pathAndIndex] = await committedDb.findSiblingPaths(MerkleTreeId.NOTE_HASH_TREE, [
|
|
1067
|
-
noteHash
|
|
1068
|
-
]);
|
|
1069
|
-
return pathAndIndex === undefined ? undefined : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
827
|
+
getL1ToL2MessageMembershipWitness(referenceBlock, l1ToL2Message) {
|
|
828
|
+
return this.worldStateQueries.getL1ToL2MessageMembershipWitness(referenceBlock, l1ToL2Message);
|
|
1070
829
|
}
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
const [witness] = await db.findSiblingPaths(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, [
|
|
1074
|
-
l1ToL2Message
|
|
1075
|
-
]);
|
|
1076
|
-
if (!witness) {
|
|
1077
|
-
return undefined;
|
|
1078
|
-
}
|
|
1079
|
-
// REFACTOR: Return a MembershipWitness object
|
|
1080
|
-
return [
|
|
1081
|
-
witness.index,
|
|
1082
|
-
witness.path
|
|
1083
|
-
];
|
|
1084
|
-
}
|
|
1085
|
-
async getL1ToL2MessageBlock(l1ToL2Message) {
|
|
1086
|
-
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
1087
|
-
return messageIndex ? BlockNumber.fromCheckpointNumber(InboxLeaf.checkpointNumberFromIndex(messageIndex)) : undefined;
|
|
1088
|
-
}
|
|
1089
|
-
/**
|
|
1090
|
-
* Returns whether an L1 to L2 message is synced by archiver and if it's ready to be included in a block.
|
|
1091
|
-
* @param l1ToL2Message - The L1 to L2 message to check.
|
|
1092
|
-
* @returns Whether the message is synced and ready to be included in a block.
|
|
1093
|
-
*/ async isL1ToL2MessageSynced(l1ToL2Message) {
|
|
1094
|
-
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
1095
|
-
return messageIndex !== undefined;
|
|
830
|
+
getL1ToL2MessageCheckpoint(l1ToL2Message) {
|
|
831
|
+
return this.worldStateQueries.getL1ToL2MessageCheckpoint(l1ToL2Message);
|
|
1096
832
|
}
|
|
1097
833
|
/**
|
|
1098
834
|
* Returns all the L2 to L1 messages in an epoch.
|
|
835
|
+
*
|
|
836
|
+
* @deprecated Use {@link getL2ToL1MembershipWitness} to get an L2-to-L1 message witness directly.
|
|
837
|
+
*
|
|
1099
838
|
* @param epoch - The epoch at which to get the data.
|
|
1100
839
|
* @returns The L2 to L1 messages (empty array if the epoch is not found).
|
|
1101
|
-
*/
|
|
1102
|
-
|
|
1103
|
-
const checkpointedBlocks = await this.blockSource.getCheckpointedBlocksForEpoch(epoch);
|
|
1104
|
-
const blocksInCheckpoints = [];
|
|
1105
|
-
let previousSlotNumber = SlotNumber.ZERO;
|
|
1106
|
-
let checkpointIndex = -1;
|
|
1107
|
-
for (const checkpointedBlock of checkpointedBlocks){
|
|
1108
|
-
const block = checkpointedBlock.block;
|
|
1109
|
-
const slotNumber = block.header.globalVariables.slotNumber;
|
|
1110
|
-
if (slotNumber !== previousSlotNumber) {
|
|
1111
|
-
checkpointIndex++;
|
|
1112
|
-
blocksInCheckpoints.push([]);
|
|
1113
|
-
previousSlotNumber = slotNumber;
|
|
1114
|
-
}
|
|
1115
|
-
blocksInCheckpoints[checkpointIndex].push(block);
|
|
1116
|
-
}
|
|
1117
|
-
return blocksInCheckpoints.map((blocks)=>blocks.map((block)=>block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs)));
|
|
840
|
+
*/ getL2ToL1Messages(epoch) {
|
|
841
|
+
return this.worldStateQueries.getL2ToL1Messages(epoch);
|
|
1118
842
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
const committedDb = await this.#getWorldState(block);
|
|
1125
|
-
return committedDb.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, leafIndex);
|
|
843
|
+
/**
|
|
844
|
+
* Returns the L2-to-L1 membership witness for a message in `txHash`. Passthrough to the
|
|
845
|
+
* archiver's locally-cached resolver — see {@link Archiver.getL2ToL1MembershipWitness}.
|
|
846
|
+
*/ getL2ToL1MembershipWitness(txHash, message, messageIndexInTx) {
|
|
847
|
+
return this.worldStateQueries.getL2ToL1MembershipWitness(txHash, message, messageIndexInTx);
|
|
1126
848
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
const [witness] = await db.findSiblingPaths(MerkleTreeId.NULLIFIER_TREE, [
|
|
1130
|
-
nullifier.toBuffer()
|
|
1131
|
-
]);
|
|
1132
|
-
if (!witness) {
|
|
1133
|
-
return undefined;
|
|
1134
|
-
}
|
|
1135
|
-
const { index, path } = witness;
|
|
1136
|
-
const leafPreimage = await db.getLeafPreimage(MerkleTreeId.NULLIFIER_TREE, index);
|
|
1137
|
-
if (!leafPreimage) {
|
|
1138
|
-
return undefined;
|
|
1139
|
-
}
|
|
1140
|
-
return new NullifierMembershipWitness(index, leafPreimage, path);
|
|
849
|
+
getNullifierMembershipWitness(referenceBlock, nullifier) {
|
|
850
|
+
return this.worldStateQueries.getNullifierMembershipWitness(referenceBlock, nullifier);
|
|
1141
851
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
* @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
1145
|
-
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
1146
|
-
* @returns The low nullifier membership witness (if found).
|
|
1147
|
-
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
1148
|
-
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
1149
|
-
* we are trying to prove non-inclusion for.
|
|
1150
|
-
*
|
|
1151
|
-
* Note: This function returns the membership witness of the nullifier itself and not the low nullifier when
|
|
1152
|
-
* the nullifier already exists in the tree. This is because the `getPreviousValueIndex` function returns the
|
|
1153
|
-
* index of the nullifier itself when it already exists in the tree.
|
|
1154
|
-
* TODO: This is a confusing behavior and we should eventually address that.
|
|
1155
|
-
*/ async getLowNullifierMembershipWitness(block, nullifier) {
|
|
1156
|
-
const committedDb = await this.#getWorldState(block);
|
|
1157
|
-
const findResult = await committedDb.getPreviousValueIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBigInt());
|
|
1158
|
-
if (!findResult) {
|
|
1159
|
-
return undefined;
|
|
1160
|
-
}
|
|
1161
|
-
const { index, alreadyPresent } = findResult;
|
|
1162
|
-
if (alreadyPresent) {
|
|
1163
|
-
this.log.warn(`Nullifier ${nullifier.toBigInt()} already exists in the tree`);
|
|
1164
|
-
}
|
|
1165
|
-
const preimageData = await committedDb.getLeafPreimage(MerkleTreeId.NULLIFIER_TREE, index);
|
|
1166
|
-
const siblingPath = await committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, BigInt(index));
|
|
1167
|
-
return new NullifierMembershipWitness(BigInt(index), preimageData, siblingPath);
|
|
1168
|
-
}
|
|
1169
|
-
async getPublicDataWitness(block, leafSlot) {
|
|
1170
|
-
const committedDb = await this.#getWorldState(block);
|
|
1171
|
-
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
1172
|
-
if (!lowLeafResult) {
|
|
1173
|
-
return undefined;
|
|
1174
|
-
} else {
|
|
1175
|
-
const preimage = await committedDb.getLeafPreimage(MerkleTreeId.PUBLIC_DATA_TREE, lowLeafResult.index);
|
|
1176
|
-
const path = await committedDb.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, lowLeafResult.index);
|
|
1177
|
-
return new PublicDataWitness(lowLeafResult.index, preimage, path);
|
|
1178
|
-
}
|
|
852
|
+
getLowNullifierMembershipWitness(referenceBlock, nullifier) {
|
|
853
|
+
return this.worldStateQueries.getLowNullifierMembershipWitness(referenceBlock, nullifier);
|
|
1179
854
|
}
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
const leafSlot = await computePublicDataTreeLeafSlot(contract, slot);
|
|
1183
|
-
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
1184
|
-
if (!lowLeafResult || !lowLeafResult.alreadyPresent) {
|
|
1185
|
-
return Fr.ZERO;
|
|
1186
|
-
}
|
|
1187
|
-
const preimage = await committedDb.getLeafPreimage(MerkleTreeId.PUBLIC_DATA_TREE, lowLeafResult.index);
|
|
1188
|
-
return preimage.leaf.value;
|
|
1189
|
-
}
|
|
1190
|
-
async getBlockHeader(block = 'latest') {
|
|
1191
|
-
if (L2BlockHash.isL2BlockHash(block)) {
|
|
1192
|
-
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
1193
|
-
if (block.equals(initialBlockHash)) {
|
|
1194
|
-
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1195
|
-
return this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
1196
|
-
}
|
|
1197
|
-
const blockHashFr = Fr.fromBuffer(block.toBuffer());
|
|
1198
|
-
return this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
1199
|
-
} else {
|
|
1200
|
-
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1201
|
-
const blockNumber = block === 'latest' ? await this.getBlockNumber() : block;
|
|
1202
|
-
if (blockNumber === BlockNumber.ZERO) {
|
|
1203
|
-
return this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
1204
|
-
}
|
|
1205
|
-
return this.blockSource.getBlockHeader(block);
|
|
1206
|
-
}
|
|
855
|
+
getPublicDataWitness(referenceBlock, leafSlot) {
|
|
856
|
+
return this.worldStateQueries.getPublicDataWitness(referenceBlock, leafSlot);
|
|
1207
857
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
* @param archive - The archive root being requested.
|
|
1211
|
-
* @returns The requested block header.
|
|
1212
|
-
*/ async getBlockHeaderByArchive(archive) {
|
|
1213
|
-
return await this.blockSource.getBlockHeaderByArchive(archive);
|
|
858
|
+
getPublicStorageAt(referenceBlock, contract, slot) {
|
|
859
|
+
return this.worldStateQueries.getPublicStorageAt(referenceBlock, contract, slot);
|
|
1214
860
|
}
|
|
1215
861
|
/**
|
|
1216
862
|
* Simulates the public part of a transaction with the current state.
|
|
1217
863
|
* @param tx - The transaction to simulate.
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
const teardownGasLimit = gasSettings.teardownGasLimits.l2Gas;
|
|
1223
|
-
if (txGasLimit + teardownGasLimit > this.config.rpcSimulatePublicMaxGasLimit) {
|
|
1224
|
-
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
1225
|
-
}
|
|
1226
|
-
const txHash = tx.getTxHash();
|
|
1227
|
-
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
1228
|
-
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
1229
|
-
const coinbase = EthAddress.ZERO;
|
|
1230
|
-
const feeRecipient = AztecAddress.ZERO;
|
|
1231
|
-
const newGlobalVariables = await this.globalVariableBuilder.buildGlobalVariables(blockNumber, coinbase, feeRecipient);
|
|
1232
|
-
const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, new DateProvider(), this.telemetry);
|
|
1233
|
-
this.log.verbose(`Simulating public calls for tx ${txHash}`, {
|
|
1234
|
-
globalVariables: newGlobalVariables.toInspect(),
|
|
1235
|
-
txHash,
|
|
1236
|
-
blockNumber
|
|
1237
|
-
});
|
|
1238
|
-
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
1239
|
-
try {
|
|
1240
|
-
const config = PublicSimulatorConfig.from({
|
|
1241
|
-
skipFeeEnforcement,
|
|
1242
|
-
collectDebugLogs: true,
|
|
1243
|
-
collectHints: false,
|
|
1244
|
-
collectCallMetadata: true,
|
|
1245
|
-
collectStatistics: false,
|
|
1246
|
-
collectionLimits: CollectionLimitsConfig.from({
|
|
1247
|
-
maxDebugLogMemoryReads: this.config.rpcSimulatePublicMaxDebugLogMemoryReads
|
|
1248
|
-
})
|
|
1249
|
-
});
|
|
1250
|
-
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, config);
|
|
1251
|
-
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
1252
|
-
const [processedTxs, failedTxs, _usedTxs, returns] = await processor.process([
|
|
1253
|
-
tx
|
|
1254
|
-
]);
|
|
1255
|
-
// REFACTOR: Consider returning the error rather than throwing
|
|
1256
|
-
if (failedTxs.length) {
|
|
1257
|
-
this.log.warn(`Simulated tx ${txHash} fails: ${failedTxs[0].error}`, {
|
|
1258
|
-
txHash
|
|
1259
|
-
});
|
|
1260
|
-
throw failedTxs[0].error;
|
|
1261
|
-
}
|
|
1262
|
-
const [processedTx] = processedTxs;
|
|
1263
|
-
return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed);
|
|
1264
|
-
} finally{
|
|
1265
|
-
await merkleTreeFork.close();
|
|
1266
|
-
}
|
|
864
|
+
* @param skipFeeEnforcement - If true, fee enforcement is skipped.
|
|
865
|
+
* @param overrides - Optional pre-simulation overrides applied to the ephemeral fork and contract DB.
|
|
866
|
+
**/ simulatePublicCalls(tx, skipFeeEnforcement = false, overrides) {
|
|
867
|
+
return this.nodePublicCallsSimulator.simulate(tx, skipFeeEnforcement, overrides);
|
|
1267
868
|
}
|
|
1268
869
|
async isValidTx(tx, { isSimulation, skipFeeEnforcement } = {}) {
|
|
1269
870
|
const db = this.worldStateSynchronizer.getCommitted();
|
|
1270
|
-
const verifier = isSimulation ? undefined : this.
|
|
1271
|
-
// We accept transactions if they are not expired by the next slot (checked based on the
|
|
871
|
+
const verifier = isSimulation ? undefined : this.rpcProofVerifier;
|
|
872
|
+
// We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field)
|
|
1272
873
|
const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
1273
874
|
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
1274
|
-
const
|
|
875
|
+
const l1Constants = await this.blockSource.getL1Constants();
|
|
876
|
+
// Enforce the same network admission limit the node advertises in getNodeInfo (network-wide, not this
|
|
877
|
+
// node's local caps), so a tx the wallet sized against txsLimits is not rejected here.
|
|
878
|
+
const networkTxGasLimits = getNetworkTxGasLimits(this.config, l1Constants);
|
|
879
|
+
const validator = createTxValidatorForAcceptingTxsOverRPC(db, this.contractDataSource, verifier, {
|
|
1275
880
|
timestamp: nextSlotTimestamp,
|
|
1276
881
|
blockNumber,
|
|
1277
882
|
l1ChainId: this.l1ChainId,
|
|
1278
883
|
rollupVersion: this.version,
|
|
1279
|
-
setupAllowList:
|
|
884
|
+
setupAllowList: [
|
|
885
|
+
...await getDefaultAllowedSetupFunctions(),
|
|
886
|
+
...this.config.txPublicSetupAllowListExtend ?? []
|
|
887
|
+
],
|
|
1280
888
|
gasFees: await this.getCurrentMinFees(),
|
|
1281
889
|
skipFeeEnforcement,
|
|
1282
|
-
|
|
1283
|
-
|
|
890
|
+
isSimulation,
|
|
891
|
+
txsPermitted: !this.config.disableTransactions,
|
|
892
|
+
maxTxL2Gas: networkTxGasLimits.l2Gas,
|
|
893
|
+
maxTxDAGas: networkTxGasLimits.daGas
|
|
894
|
+
}, this.log.getBindings());
|
|
1284
895
|
return await validator.validateTx(tx);
|
|
1285
896
|
}
|
|
1286
897
|
getConfig() {
|
|
@@ -1293,7 +904,20 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1293
904
|
...this.config,
|
|
1294
905
|
...config
|
|
1295
906
|
};
|
|
1296
|
-
|
|
907
|
+
// If the sequencer is currently paused via pauseSequencer(), record the caller's desired
|
|
908
|
+
// minTxsPerBlock as the restore value (so resumeSequencer applies it) and keep the freeze
|
|
909
|
+
// (MAX_SAFE_INTEGER) applied to the underlying sequencer. Without this guard, forwarding
|
|
910
|
+
// the new minTxsPerBlock to the sequencer would silently unpause block production while
|
|
911
|
+
// pauseSequencer() still considers it paused.
|
|
912
|
+
const sequencerUpdate = {
|
|
913
|
+
...config
|
|
914
|
+
};
|
|
915
|
+
if (this.sequencerPausedMinTxsPerBlock !== undefined && sequencerUpdate.minTxsPerBlock !== undefined) {
|
|
916
|
+
this.sequencerPausedMinTxsPerBlock = sequencerUpdate.minTxsPerBlock;
|
|
917
|
+
delete sequencerUpdate.minTxsPerBlock;
|
|
918
|
+
}
|
|
919
|
+
this.sequencer?.updateConfig(sequencerUpdate);
|
|
920
|
+
this.automineSequencer?.updateConfig(sequencerUpdate);
|
|
1297
921
|
this.slasherClient?.updateConfig(config);
|
|
1298
922
|
this.validatorsSentinel?.updateConfig(config);
|
|
1299
923
|
await this.p2pClient.updateP2PConfig(config);
|
|
@@ -1302,7 +926,18 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1302
926
|
archiver.updateConfig(config);
|
|
1303
927
|
}
|
|
1304
928
|
if (newConfig.realProofs !== this.config.realProofs) {
|
|
1305
|
-
|
|
929
|
+
await Promise.all([
|
|
930
|
+
tryStop(this.peerProofVerifier),
|
|
931
|
+
tryStop(this.rpcProofVerifier)
|
|
932
|
+
]);
|
|
933
|
+
if (newConfig.realProofs) {
|
|
934
|
+
this.peerProofVerifier = await BatchChonkVerifier.new(newConfig, newConfig.bbChonkVerifyMaxBatch, 'peer');
|
|
935
|
+
const rpcVerifier = await BBCircuitVerifier.new(newConfig);
|
|
936
|
+
this.rpcProofVerifier = new QueuedIVCVerifier(rpcVerifier, newConfig.numConcurrentIVCVerifiers);
|
|
937
|
+
} else {
|
|
938
|
+
this.peerProofVerifier = new TestCircuitVerifier();
|
|
939
|
+
this.rpcProofVerifier = new TestCircuitVerifier();
|
|
940
|
+
}
|
|
1306
941
|
}
|
|
1307
942
|
this.config = newConfig;
|
|
1308
943
|
}
|
|
@@ -1311,7 +946,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1311
946
|
classRegistry: ProtocolContractAddress.ContractClassRegistry,
|
|
1312
947
|
feeJuice: ProtocolContractAddress.FeeJuice,
|
|
1313
948
|
instanceRegistry: ProtocolContractAddress.ContractInstanceRegistry,
|
|
1314
|
-
multiCallEntrypoint:
|
|
949
|
+
multiCallEntrypoint: STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS
|
|
1315
950
|
});
|
|
1316
951
|
}
|
|
1317
952
|
registerContractFunctionSignatures(signatures) {
|
|
@@ -1362,7 +997,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1362
997
|
});
|
|
1363
998
|
return Promise.resolve();
|
|
1364
999
|
}
|
|
1365
|
-
async rollbackTo(targetBlock, force) {
|
|
1000
|
+
async rollbackTo(targetBlock, force, resumeSync = true) {
|
|
1366
1001
|
const archiver = this.blockSource;
|
|
1367
1002
|
if (!('rollbackTo' in archiver)) {
|
|
1368
1003
|
throw new Error('Archiver implementation does not support rollbacks.');
|
|
@@ -1390,9 +1025,13 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1390
1025
|
this.log.error(`Error during rollback`, err);
|
|
1391
1026
|
throw err;
|
|
1392
1027
|
} finally{
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1028
|
+
if (resumeSync) {
|
|
1029
|
+
this.log.info(`Resuming world state and archiver sync.`);
|
|
1030
|
+
this.worldStateSynchronizer.resumeSync();
|
|
1031
|
+
archiver.resume();
|
|
1032
|
+
} else {
|
|
1033
|
+
this.log.info(`Sync left paused after rollback (resumeSync=false).`);
|
|
1034
|
+
}
|
|
1396
1035
|
}
|
|
1397
1036
|
}
|
|
1398
1037
|
async pauseSync() {
|
|
@@ -1406,74 +1045,176 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1406
1045
|
this.blockSource.resume();
|
|
1407
1046
|
return Promise.resolve();
|
|
1408
1047
|
}
|
|
1409
|
-
|
|
1410
|
-
if (
|
|
1411
|
-
|
|
1048
|
+
pauseSequencer() {
|
|
1049
|
+
if (this.automineSequencer) {
|
|
1050
|
+
this.automineSequencer.pause();
|
|
1051
|
+
return Promise.resolve();
|
|
1412
1052
|
}
|
|
1413
|
-
|
|
1053
|
+
if (this.sequencer) {
|
|
1054
|
+
if (this.sequencerPausedMinTxsPerBlock === undefined) {
|
|
1055
|
+
this.sequencerPausedMinTxsPerBlock = this.sequencer.getSequencer().getConfig().minTxsPerBlock ?? 0;
|
|
1056
|
+
this.sequencer.updateConfig({
|
|
1057
|
+
minTxsPerBlock: Number.MAX_SAFE_INTEGER
|
|
1058
|
+
});
|
|
1059
|
+
this.log.info(`Sequencer paused (minTxsPerBlock set to MAX_SAFE_INTEGER)`, {
|
|
1060
|
+
previousMinTxsPerBlock: this.sequencerPausedMinTxsPerBlock
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
return Promise.resolve();
|
|
1064
|
+
}
|
|
1065
|
+
throw new BadRequestError('Cannot pause sequencer: no sequencer is running');
|
|
1066
|
+
}
|
|
1067
|
+
resumeSequencer() {
|
|
1068
|
+
if (this.automineSequencer) {
|
|
1069
|
+
this.automineSequencer.resume();
|
|
1070
|
+
return Promise.resolve();
|
|
1071
|
+
}
|
|
1072
|
+
if (this.sequencer) {
|
|
1073
|
+
if (this.sequencerPausedMinTxsPerBlock !== undefined) {
|
|
1074
|
+
const restored = this.sequencerPausedMinTxsPerBlock;
|
|
1075
|
+
this.sequencerPausedMinTxsPerBlock = undefined;
|
|
1076
|
+
this.sequencer.updateConfig({
|
|
1077
|
+
minTxsPerBlock: restored
|
|
1078
|
+
});
|
|
1079
|
+
this.log.info(`Sequencer resumed (minTxsPerBlock restored)`, {
|
|
1080
|
+
minTxsPerBlock: restored
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
return Promise.resolve();
|
|
1084
|
+
}
|
|
1085
|
+
throw new BadRequestError('Cannot resume sequencer: no sequencer is running');
|
|
1414
1086
|
}
|
|
1415
1087
|
getSlashOffenses(round) {
|
|
1416
1088
|
if (!this.slasherClient) {
|
|
1417
1089
|
throw new Error(`Slasher client not enabled`);
|
|
1418
1090
|
}
|
|
1419
1091
|
if (round === 'all') {
|
|
1420
|
-
return this.slasherClient.
|
|
1092
|
+
return this.slasherClient.getOffenses();
|
|
1421
1093
|
} else {
|
|
1422
1094
|
return this.slasherClient.gatherOffensesForRound(round === 'current' ? undefined : BigInt(round));
|
|
1423
1095
|
}
|
|
1424
1096
|
}
|
|
1425
|
-
|
|
1426
|
-
if (!this.
|
|
1427
|
-
|
|
1097
|
+
async reloadKeystore() {
|
|
1098
|
+
if (!this.config.keyStoreDirectory?.length) {
|
|
1099
|
+
throw new BadRequestError('Cannot reload keystore: node is not using a file-based keystore. ' + 'Set KEY_STORE_DIRECTORY to use file-based keystores.');
|
|
1100
|
+
}
|
|
1101
|
+
if (!this.validatorClient) {
|
|
1102
|
+
throw new BadRequestError('Cannot reload keystore: validator is not enabled.');
|
|
1103
|
+
}
|
|
1104
|
+
this.log.info('Reloading keystore from disk');
|
|
1105
|
+
// Re-read and validate keystore files
|
|
1106
|
+
const keyStores = loadKeystores(this.config.keyStoreDirectory);
|
|
1107
|
+
const newManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
1108
|
+
await newManager.validateSigners();
|
|
1109
|
+
ValidatorClient.validateKeyStoreConfiguration(newManager, this.log);
|
|
1110
|
+
// Validate that every validator's publisher keys overlap with the L1 signers
|
|
1111
|
+
// that were initialized at startup. Publishers cannot be hot-reloaded, so a
|
|
1112
|
+
// validator with a publisher key that doesn't match any existing L1 signer
|
|
1113
|
+
// would silently fail on every proposer slot.
|
|
1114
|
+
if (this.keyStoreManager && this.sequencer) {
|
|
1115
|
+
const oldAdapter = NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager);
|
|
1116
|
+
const availablePublishers = new Set(oldAdapter.getAttesterAddresses().flatMap((a)=>oldAdapter.getPublisherAddresses(a).map((p)=>p.toString().toLowerCase())));
|
|
1117
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1118
|
+
for (const attester of newAdapter.getAttesterAddresses()){
|
|
1119
|
+
const pubs = newAdapter.getPublisherAddresses(attester);
|
|
1120
|
+
if (pubs.length > 0 && !pubs.some((p)=>availablePublishers.has(p.toString().toLowerCase()))) {
|
|
1121
|
+
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 ` + `[${[
|
|
1122
|
+
...availablePublishers
|
|
1123
|
+
].join(', ')}]. Publishers cannot be hot-reloaded — ` + `use an existing publisher key or restart the node.`);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1428
1126
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1127
|
+
// Build adapters for old and new keystores to compute diff
|
|
1128
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1129
|
+
const newAddresses = newAdapter.getAttesterAddresses();
|
|
1130
|
+
const oldAddresses = this.keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager).getAttesterAddresses() : [];
|
|
1131
|
+
const oldSet = new Set(oldAddresses.map((a)=>a.toString()));
|
|
1132
|
+
const newSet = new Set(newAddresses.map((a)=>a.toString()));
|
|
1133
|
+
const added = newAddresses.filter((a)=>!oldSet.has(a.toString()));
|
|
1134
|
+
const removed = oldAddresses.filter((a)=>!newSet.has(a.toString()));
|
|
1135
|
+
if (added.length > 0) {
|
|
1136
|
+
this.log.info(`Keystore reload: adding attester keys: ${added.map((a)=>a.toString()).join(', ')}`);
|
|
1137
|
+
}
|
|
1138
|
+
if (removed.length > 0) {
|
|
1139
|
+
this.log.info(`Keystore reload: removing attester keys: ${removed.map((a)=>a.toString()).join(', ')}`);
|
|
1140
|
+
}
|
|
1141
|
+
if (added.length === 0 && removed.length === 0) {
|
|
1142
|
+
this.log.info('Keystore reload: attester keys unchanged');
|
|
1143
|
+
}
|
|
1144
|
+
// Update the validator client (coinbase, feeRecipient, attester keys)
|
|
1145
|
+
this.validatorClient.reloadKeystore(newManager);
|
|
1146
|
+
// Update the publisher factory's keystore so newly-added validators
|
|
1147
|
+
// can be matched to existing publisher keys when proposing blocks.
|
|
1148
|
+
if (this.sequencer) {
|
|
1149
|
+
this.sequencer.updatePublisherNodeKeyStore(newAdapter);
|
|
1150
|
+
}
|
|
1151
|
+
// Update slasher's "don't-slash-self" list with new validator addresses
|
|
1152
|
+
if (this.slasherClient && !this.config.slashSelfAllowed) {
|
|
1153
|
+
const slashValidatorsNever = unique([
|
|
1154
|
+
...this.config.slashValidatorsNever ?? [],
|
|
1155
|
+
...newAddresses
|
|
1156
|
+
].map((a)=>a.toString())).map(EthAddress.fromString);
|
|
1157
|
+
this.slasherClient.updateConfig({
|
|
1158
|
+
slashValidatorsNever
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
this.keyStoreManager = newManager;
|
|
1162
|
+
this.log.info('Keystore reloaded: coinbase, feeRecipient, and attester keys updated');
|
|
1163
|
+
}
|
|
1164
|
+
async mineBlock() {
|
|
1165
|
+
if (this.automineSequencer) {
|
|
1166
|
+
await this.automineSequencer.buildEmptyBlock();
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
if (!this.sequencer) {
|
|
1170
|
+
throw new BadRequestError('Cannot mine block: no sequencer is running');
|
|
1171
|
+
}
|
|
1172
|
+
const currentBlockNumber = await this.getBlockNumber();
|
|
1173
|
+
// Use slot duration + 50% buffer as the timeout so this works on running networks too
|
|
1174
|
+
const { slotDuration } = await this.blockSource.getL1Constants();
|
|
1175
|
+
const timeoutSeconds = Math.ceil(slotDuration * 1.5);
|
|
1176
|
+
// Temporarily set minTxsPerBlock to 0 so the sequencer produces a block even with no txs
|
|
1177
|
+
const originalMinTxsPerBlock = this.sequencer.getSequencer().getConfig().minTxsPerBlock;
|
|
1178
|
+
this.sequencer.updateConfig({
|
|
1179
|
+
minTxsPerBlock: 0
|
|
1180
|
+
});
|
|
1437
1181
|
try {
|
|
1438
|
-
//
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1182
|
+
// Trigger the sequencer to produce a block immediately
|
|
1183
|
+
void this.sequencer.trigger();
|
|
1184
|
+
// Wait for the new L2 block to appear
|
|
1185
|
+
await retryUntil(async ()=>{
|
|
1186
|
+
const newBlockNumber = await this.getBlockNumber();
|
|
1187
|
+
return newBlockNumber > currentBlockNumber ? true : undefined;
|
|
1188
|
+
}, 'mineBlock', timeoutSeconds, 0.1);
|
|
1189
|
+
} finally{
|
|
1190
|
+
this.sequencer.updateConfig({
|
|
1191
|
+
minTxsPerBlock: originalMinTxsPerBlock
|
|
1192
|
+
});
|
|
1442
1193
|
}
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1194
|
+
}
|
|
1195
|
+
async prove(upToCheckpoint) {
|
|
1196
|
+
if (!this.automineSequencer) {
|
|
1197
|
+
throw new BadRequestError('Cannot prove checkpoint: no automine sequencer is running');
|
|
1446
1198
|
}
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
}
|
|
1453
|
-
const blockHashFr = Fr.fromBuffer(block.toBuffer());
|
|
1454
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
1455
|
-
if (!header) {
|
|
1456
|
-
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
|
-
}
|
|
1458
|
-
const blockNumber = header.getBlockNumber();
|
|
1459
|
-
this.log.debug(`Using snapshot for block ${blockNumber}, world state synced upto ${blockSyncedTo}`);
|
|
1460
|
-
return this.worldStateSynchronizer.getSnapshot(blockNumber);
|
|
1199
|
+
return await this.automineSequencer.prove(upToCheckpoint);
|
|
1200
|
+
}
|
|
1201
|
+
async warpL2TimeAtLeastTo(targetTimestamp) {
|
|
1202
|
+
if (!this.automineSequencer) {
|
|
1203
|
+
throw new BadRequestError('Cannot warp L2 time: no automine sequencer is running');
|
|
1461
1204
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
}
|
|
1468
|
-
this.log.debug(`Using snapshot for block ${blockNumber}, world state synced upto ${blockSyncedTo}`);
|
|
1469
|
-
return this.worldStateSynchronizer.getSnapshot(blockNumber);
|
|
1205
|
+
await this.automineSequencer.warpTo(targetTimestamp);
|
|
1206
|
+
}
|
|
1207
|
+
async warpL2TimeAtLeastBy(duration) {
|
|
1208
|
+
if (!this.automineSequencer) {
|
|
1209
|
+
throw new BadRequestError('Cannot warp L2 time: no automine sequencer is running');
|
|
1470
1210
|
}
|
|
1211
|
+
await this.automineSequencer.warpBy(duration);
|
|
1471
1212
|
}
|
|
1472
1213
|
/**
|
|
1473
|
-
*
|
|
1474
|
-
* @
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
return
|
|
1214
|
+
* Returns a committed world-state view at `block`, driving sync first. Delegates to
|
|
1215
|
+
* {@link NodeWorldStateQueries.getWorldState}; kept as a protected method so subclasses and tests can
|
|
1216
|
+
* exercise the node's block-resolution and reorg-aware sync behavior.
|
|
1217
|
+
*/ getWorldState(block) {
|
|
1218
|
+
return this.worldStateQueries.getWorldState(block);
|
|
1478
1219
|
}
|
|
1479
1220
|
}
|