@aztec/aztec-node 0.0.1-commit.d431d1c → 0.0.1-commit.d58ff9d0
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 +97 -0
- package/dest/aztec-node/node_public_calls_simulator.d.ts.map +1 -0
- package/dest/aztec-node/node_public_calls_simulator.js +351 -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 +151 -147
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +498 -726
- 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 +523 -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 +394 -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 +660 -969
- package/src/bin/index.ts +19 -12
- package/src/factory.ts +688 -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 { L2BlockHash, L2BlockNew } 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,158 @@ _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
|
-
this.
|
|
479
|
-
this.
|
|
480
|
-
|
|
481
|
-
|
|
451
|
+
validatorClient;
|
|
452
|
+
keyStoreManager;
|
|
453
|
+
debugLogStore;
|
|
454
|
+
automineSequencer;
|
|
455
|
+
avmSimulator;
|
|
456
|
+
constructor(deps){
|
|
457
|
+
this.config = deps.config;
|
|
458
|
+
this.p2pClient = deps.p2pClient;
|
|
459
|
+
this.blockSource = deps.blockSource;
|
|
460
|
+
this.logsSource = deps.logsSource;
|
|
461
|
+
this.contractDataSource = deps.contractDataSource;
|
|
462
|
+
this.l1ToL2MessageSource = deps.l1ToL2MessageSource;
|
|
463
|
+
this.worldStateSynchronizer = deps.worldStateSynchronizer;
|
|
464
|
+
this.sequencer = deps.sequencer;
|
|
465
|
+
this.proverNode = deps.proverNode;
|
|
466
|
+
this.slasherClient = deps.slasherClient;
|
|
467
|
+
this.validatorsSentinel = deps.validatorsSentinel;
|
|
468
|
+
this.stopStartedWatchers = deps.stopStartedWatchers;
|
|
469
|
+
this.l1ChainId = deps.l1ChainId;
|
|
470
|
+
this.version = deps.version;
|
|
471
|
+
this.globalVariableBuilder = deps.globalVariableBuilder;
|
|
472
|
+
this.rollupContract = deps.rollupContract;
|
|
473
|
+
this.feeProvider = deps.feeProvider;
|
|
474
|
+
this.epochCache = deps.epochCache;
|
|
475
|
+
this.packageVersion = deps.packageVersion;
|
|
476
|
+
this.peerProofVerifier = deps.peerProofVerifier;
|
|
477
|
+
this.rpcProofVerifier = deps.rpcProofVerifier;
|
|
478
|
+
this.telemetry = deps.telemetry ?? getTelemetryClient();
|
|
479
|
+
this.log = deps.log ?? createLogger('node');
|
|
480
|
+
this.blobClient = deps.blobClient;
|
|
481
|
+
this.validatorClient = deps.validatorClient;
|
|
482
|
+
this.keyStoreManager = deps.keyStoreManager;
|
|
483
|
+
this.debugLogStore = deps.debugLogStore ?? new NullDebugLogStore();
|
|
484
|
+
this.automineSequencer = deps.automineSequencer;
|
|
485
|
+
this.avmSimulator = deps.avmSimulator;
|
|
486
|
+
this.metrics = new NodeMetrics(this.telemetry, 'AztecNodeService');
|
|
487
|
+
this.tracer = this.telemetry.getTracer('AztecNodeService');
|
|
488
|
+
// The node never represents a proposer's payout addresses, so the simulator zeroes coinbase and
|
|
489
|
+
// fee recipient. The signature context only needs chain id + rollup address (see signature_utils).
|
|
490
|
+
this.nodePublicCallsSimulator = new NodePublicCallsSimulator({
|
|
491
|
+
blockSource: this.blockSource,
|
|
492
|
+
worldStateSynchronizer: this.worldStateSynchronizer,
|
|
493
|
+
l1ToL2MessageSource: this.l1ToL2MessageSource,
|
|
494
|
+
contractDataSource: this.contractDataSource,
|
|
495
|
+
globalVariableBuilder: this.globalVariableBuilder,
|
|
496
|
+
rollupContract: this.rollupContract,
|
|
497
|
+
epochCache: this.epochCache,
|
|
498
|
+
signatureContext: {
|
|
499
|
+
chainId: this.l1ChainId,
|
|
500
|
+
rollupAddress: this.config.rollupAddress
|
|
501
|
+
},
|
|
502
|
+
config: this.config,
|
|
503
|
+
avmSimulator: this.avmSimulator,
|
|
504
|
+
telemetry: this.telemetry,
|
|
505
|
+
log: this.log.createChild('public-calls-simulator')
|
|
506
|
+
});
|
|
507
|
+
this.worldStateQueries = new NodeWorldStateQueries({
|
|
508
|
+
worldStateSynchronizer: this.worldStateSynchronizer,
|
|
509
|
+
blockSource: this.blockSource,
|
|
510
|
+
l1ToL2MessageSource: this.l1ToL2MessageSource,
|
|
511
|
+
log: this.log.createChild('world-state-queries')
|
|
512
|
+
});
|
|
513
|
+
this.blockProvider = new NodeBlockProvider(this.blockSource);
|
|
514
|
+
this.txReceiptBuilder = new NodeTxReceiptBuilder({
|
|
515
|
+
p2pClient: this.p2pClient,
|
|
516
|
+
blockSource: this.blockSource,
|
|
517
|
+
debugLogStore: this.debugLogStore
|
|
518
|
+
});
|
|
482
519
|
this.log.info(`Aztec Node version: ${this.packageVersion}`);
|
|
483
|
-
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config
|
|
520
|
+
this.log.info(`Aztec Node started on chain 0x${this.l1ChainId.toString(16)}`, pickL1ContractAddresses(this.config));
|
|
521
|
+
// A defensive check that protects us against introducing a bug in the complex node creation flow. We must
|
|
522
|
+
// never have debugLogStore enabled when not in test mode because then we would be accumulating debug logs in
|
|
523
|
+
// memory which could be a DoS vector on the sequencer (since no fees are paid for debug logs).
|
|
524
|
+
if (this.debugLogStore.isEnabled && this.config.realProofs) {
|
|
525
|
+
throw new Error('debugLogStore should never be enabled when realProofs are set');
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
/** @internal Exposed for testing — returns the RPC proof verifier. */ getProofVerifier() {
|
|
529
|
+
return this.rpcProofVerifier;
|
|
484
530
|
}
|
|
485
531
|
async getWorldStateSyncStatus() {
|
|
486
532
|
const status = await this.worldStateSynchronizer.status();
|
|
487
533
|
return status.syncSummary;
|
|
488
534
|
}
|
|
489
|
-
|
|
535
|
+
getChainTips() {
|
|
490
536
|
return this.blockSource.getL2Tips();
|
|
491
537
|
}
|
|
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
|
-
});
|
|
538
|
+
getL1Constants() {
|
|
539
|
+
return this.blockSource.getL1Constants();
|
|
540
|
+
}
|
|
541
|
+
getSyncedL2SlotNumber() {
|
|
542
|
+
return this.blockSource.getSyncedL2SlotNumber();
|
|
543
|
+
}
|
|
544
|
+
getSyncedL2EpochNumber() {
|
|
545
|
+
return this.blockSource.getSyncedL2EpochNumber();
|
|
546
|
+
}
|
|
547
|
+
getSyncedL1Timestamp() {
|
|
548
|
+
return this.blockSource.getL1Timestamp();
|
|
549
|
+
}
|
|
550
|
+
getCheckpointsData(query) {
|
|
551
|
+
return this.blockSource.getCheckpointsData(query);
|
|
552
|
+
}
|
|
553
|
+
async getBlockNumber(tip) {
|
|
554
|
+
if (tip === undefined || tip === 'proposed') {
|
|
555
|
+
return this.blockSource.getBlockNumber();
|
|
698
556
|
}
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
557
|
+
return await this.blockSource.getBlockNumber({
|
|
558
|
+
tag: tip
|
|
559
|
+
}) ?? BlockNumber.ZERO;
|
|
560
|
+
}
|
|
561
|
+
async getCheckpointNumber(tip) {
|
|
562
|
+
const tips = await this.blockSource.getL2Tips();
|
|
563
|
+
switch(tip){
|
|
564
|
+
case undefined:
|
|
565
|
+
case 'checkpointed':
|
|
566
|
+
return tips.checkpointed.checkpoint.number;
|
|
567
|
+
case 'proven':
|
|
568
|
+
return tips.proven.checkpoint.number;
|
|
569
|
+
case 'finalized':
|
|
570
|
+
return tips.finalized.checkpoint.number;
|
|
704
571
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
572
|
+
}
|
|
573
|
+
getBlock(param, options = {}) {
|
|
574
|
+
return this.blockProvider.getBlock(param, options);
|
|
575
|
+
}
|
|
576
|
+
getBlockData(param) {
|
|
577
|
+
return this.blockProvider.getBlockData(param);
|
|
578
|
+
}
|
|
579
|
+
getBlocks(from, limit, options = {}) {
|
|
580
|
+
return this.blockProvider.getBlocks(from, limit, options);
|
|
581
|
+
}
|
|
582
|
+
getCheckpoint(param, options = {}) {
|
|
583
|
+
return this.blockProvider.getCheckpoint(param, options);
|
|
584
|
+
}
|
|
585
|
+
getCheckpoints(from, limit, options = {}) {
|
|
586
|
+
return this.blockProvider.getCheckpoints(from, limit, options);
|
|
712
587
|
}
|
|
713
588
|
/**
|
|
714
589
|
* Returns the sequencer client instance.
|
|
@@ -716,6 +591,12 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
716
591
|
*/ getSequencer() {
|
|
717
592
|
return this.sequencer;
|
|
718
593
|
}
|
|
594
|
+
/** Test-only: returns the AutomineSequencer when wired via `useAutomineSequencer`. */ getAutomineSequencer() {
|
|
595
|
+
return this.automineSequencer;
|
|
596
|
+
}
|
|
597
|
+
/** Returns the prover node subsystem, if enabled. */ getProverNode() {
|
|
598
|
+
return this.proverNode;
|
|
599
|
+
}
|
|
719
600
|
getBlockSource() {
|
|
720
601
|
return this.blockSource;
|
|
721
602
|
}
|
|
@@ -729,13 +610,16 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
729
610
|
* Method to return the currently deployed L1 contract addresses.
|
|
730
611
|
* @returns - The currently deployed L1 contract addresses.
|
|
731
612
|
*/ getL1ContractAddresses() {
|
|
732
|
-
return Promise.resolve(this.config
|
|
613
|
+
return Promise.resolve(pickL1ContractAddresses(this.config));
|
|
733
614
|
}
|
|
734
615
|
getEncodedEnr() {
|
|
735
616
|
return Promise.resolve(this.p2pClient.getEnr()?.encodeTxt());
|
|
736
617
|
}
|
|
737
618
|
async getAllowedPublicSetup() {
|
|
738
|
-
return
|
|
619
|
+
return [
|
|
620
|
+
...await getDefaultAllowedSetupFunctions(),
|
|
621
|
+
...this.config.txPublicSetupAllowListExtend ?? []
|
|
622
|
+
];
|
|
739
623
|
}
|
|
740
624
|
/**
|
|
741
625
|
* Method to determine if the node is ready to accept transactions.
|
|
@@ -744,88 +628,47 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
744
628
|
return Promise.resolve(this.p2pClient.isReady() ?? false);
|
|
745
629
|
}
|
|
746
630
|
async getNodeInfo() {
|
|
747
|
-
const [nodeVersion, rollupVersion, chainId, enr, contractAddresses, protocolContractAddresses] = await Promise.all([
|
|
631
|
+
const [nodeVersion, rollupVersion, chainId, enr, contractAddresses, protocolContractAddresses, l1Constants] = await Promise.all([
|
|
748
632
|
this.getNodeVersion(),
|
|
749
633
|
this.getVersion(),
|
|
750
634
|
this.getChainId(),
|
|
751
635
|
this.getEncodedEnr(),
|
|
752
636
|
this.getL1ContractAddresses(),
|
|
753
|
-
this.getProtocolContractAddresses()
|
|
637
|
+
this.getProtocolContractAddresses(),
|
|
638
|
+
this.blockSource.getL1Constants()
|
|
754
639
|
]);
|
|
640
|
+
// Gas limits a single tx may declare on this network, derived from network-wide constants only (the
|
|
641
|
+
// timetable's blocks-per-checkpoint and the network-minimum per-block multipliers) — never this node's
|
|
642
|
+
// local caps or configured multipliers, which can make the node stricter at block-building time but
|
|
643
|
+
// cannot define what the network accepts for relay. Clients read txsLimits to set fallback gas limits.
|
|
644
|
+
const maxTxGas = getNetworkTxGasLimits(this.config, l1Constants);
|
|
755
645
|
const nodeInfo = {
|
|
756
646
|
nodeVersion,
|
|
757
647
|
l1ChainId: chainId,
|
|
758
648
|
rollupVersion,
|
|
759
649
|
enr,
|
|
760
650
|
l1ContractAddresses: contractAddresses,
|
|
761
|
-
protocolContractAddresses: protocolContractAddresses
|
|
651
|
+
protocolContractAddresses: protocolContractAddresses,
|
|
652
|
+
realProofs: !!this.config.realProofs,
|
|
653
|
+
txsLimits: {
|
|
654
|
+
gas: {
|
|
655
|
+
daGas: maxTxGas.daGas,
|
|
656
|
+
l2Gas: maxTxGas.l2Gas
|
|
657
|
+
}
|
|
658
|
+
}
|
|
762
659
|
};
|
|
763
660
|
return nodeInfo;
|
|
764
661
|
}
|
|
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.getL2BlockNew(blockNumber);
|
|
662
|
+
async getCurrentMinFees() {
|
|
663
|
+
return await this.feeProvider.getCurrentMinFees();
|
|
778
664
|
}
|
|
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.getL2BlockNewByHash(blockHash);
|
|
789
|
-
}
|
|
790
|
-
buildInitialBlock() {
|
|
791
|
-
const initialHeader = this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
792
|
-
return L2BlockNew.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.getL2BlockNewByArchive(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.getL2BlocksNew(from, limit) ?? [];
|
|
808
|
-
}
|
|
809
|
-
async getPublishedBlocks(from, limit) {
|
|
810
|
-
return await this.blockSource.getPublishedBlocks(from, limit) ?? [];
|
|
811
|
-
}
|
|
812
|
-
async getPublishedCheckpoints(from, limit) {
|
|
813
|
-
return await this.blockSource.getPublishedCheckpoints(from, limit) ?? [];
|
|
814
|
-
}
|
|
815
|
-
async getL2BlocksNew(from, limit) {
|
|
816
|
-
return await this.blockSource.getL2BlocksNew(from, limit) ?? [];
|
|
817
|
-
}
|
|
818
|
-
async getCheckpointedBlocks(from, limit, proven) {
|
|
819
|
-
return await this.blockSource.getCheckpointedBlocks(from, limit, proven) ?? [];
|
|
820
|
-
}
|
|
821
|
-
/**
|
|
822
|
-
* Method to fetch the current min L2 fees.
|
|
823
|
-
* @returns The current min L2 fees.
|
|
824
|
-
*/ async getCurrentMinFees() {
|
|
825
|
-
return await this.globalVariableBuilder.getCurrentMinFees();
|
|
665
|
+
/** Returns predicted min fees for the current slot and next N slots. */ async getPredictedMinFees(manaUsage) {
|
|
666
|
+
return await this.feeProvider.getPredictedMinFees(manaUsage);
|
|
826
667
|
}
|
|
827
668
|
async getMaxPriorityFees() {
|
|
828
|
-
for await (const tx of this.p2pClient.iteratePendingTxs(
|
|
669
|
+
for await (const tx of this.p2pClient.iteratePendingTxs({
|
|
670
|
+
includeProof: false
|
|
671
|
+
})){
|
|
829
672
|
return tx.getGasSettings().maxPriorityFeesPerGas;
|
|
830
673
|
}
|
|
831
674
|
return GasFees.from({
|
|
@@ -834,15 +677,6 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
834
677
|
});
|
|
835
678
|
}
|
|
836
679
|
/**
|
|
837
|
-
* Method to fetch the latest block number synchronized by the node.
|
|
838
|
-
* @returns The block number.
|
|
839
|
-
*/ async getBlockNumber() {
|
|
840
|
-
return await this.blockSource.getBlockNumber();
|
|
841
|
-
}
|
|
842
|
-
async getProvenBlockNumber() {
|
|
843
|
-
return await this.blockSource.getProvenBlockNumber();
|
|
844
|
-
}
|
|
845
|
-
/**
|
|
846
680
|
* Method to fetch the version of the package.
|
|
847
681
|
* @returns The node package version
|
|
848
682
|
*/ getNodeVersion() {
|
|
@@ -863,28 +697,18 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
863
697
|
getContractClass(id) {
|
|
864
698
|
return this.contractDataSource.getContractClass(id);
|
|
865
699
|
}
|
|
866
|
-
getContract(address) {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
getPublicLogsByTagsFromContract(contractAddress, tags, page) {
|
|
873
|
-
return this.logsSource.getPublicLogsByTagsFromContract(contractAddress, tags, page);
|
|
700
|
+
async getContract(address, referenceBlock = 'latest') {
|
|
701
|
+
const blockData = await this.getBlockData(referenceBlock);
|
|
702
|
+
if (!blockData) {
|
|
703
|
+
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.`);
|
|
704
|
+
}
|
|
705
|
+
return this.contractDataSource.getContract(address, blockData.header.globalVariables.timestamp);
|
|
874
706
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
* @param filter - The filter to apply to the logs.
|
|
878
|
-
* @returns The requested logs.
|
|
879
|
-
*/ getPublicLogs(filter) {
|
|
880
|
-
return this.logsSource.getPublicLogs(filter);
|
|
707
|
+
getPrivateLogsByTags(query) {
|
|
708
|
+
return this.logsSource.getPrivateLogsByTags(query);
|
|
881
709
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
* @param filter - The filter to apply to the logs.
|
|
885
|
-
* @returns The requested logs.
|
|
886
|
-
*/ getContractClassLogs(filter) {
|
|
887
|
-
return this.logsSource.getContractClassLogs(filter);
|
|
710
|
+
getPublicLogsByTags(query) {
|
|
711
|
+
return this.logsSource.getPublicLogsByTags(query);
|
|
888
712
|
}
|
|
889
713
|
/**
|
|
890
714
|
* Method to submit a transaction to the p2p pool.
|
|
@@ -904,25 +728,23 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
904
728
|
});
|
|
905
729
|
throw new Error(`Invalid tx: ${reason}`);
|
|
906
730
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
731
|
+
try {
|
|
732
|
+
await this.p2pClient.sendTx(tx);
|
|
733
|
+
} catch (err) {
|
|
734
|
+
this.metrics.receivedTx(timer.ms(), false);
|
|
735
|
+
this.log.warn(`Mempool rejected tx ${txHash}: ${err.message}`, {
|
|
736
|
+
txHash
|
|
737
|
+
});
|
|
738
|
+
throw err;
|
|
739
|
+
}
|
|
740
|
+
const duration = timer.ms();
|
|
741
|
+
this.metrics.receivedTx(duration, true);
|
|
742
|
+
this.log.info(`Received tx ${txHash} in ${duration}ms`, {
|
|
910
743
|
txHash
|
|
911
744
|
});
|
|
912
745
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
// We first check if the tx is in pending (instead of first checking if it is mined) because if we first check
|
|
916
|
-
// for mined and then for pending there could be a race condition where the tx is mined between the two checks
|
|
917
|
-
// and we would incorrectly return a TxReceipt with status DROPPED
|
|
918
|
-
if (await this.p2pClient.getTxStatus(txHash) === 'pending') {
|
|
919
|
-
txReceipt = new TxReceipt(txHash, TxStatus.PENDING, '');
|
|
920
|
-
}
|
|
921
|
-
const settledTxReceipt = await this.blockSource.getSettledTxReceipt(txHash);
|
|
922
|
-
if (settledTxReceipt) {
|
|
923
|
-
txReceipt = settledTxReceipt;
|
|
924
|
-
}
|
|
925
|
-
return txReceipt;
|
|
746
|
+
getTxReceipt(txHash, options) {
|
|
747
|
+
return this.txReceiptBuilder.getTxReceipt(txHash, options);
|
|
926
748
|
}
|
|
927
749
|
getTxEffect(txHash) {
|
|
928
750
|
return this.blockSource.getTxEffect(txHash);
|
|
@@ -931,12 +753,20 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
931
753
|
* Method to stop the aztec node.
|
|
932
754
|
*/ async stop() {
|
|
933
755
|
this.log.info(`Stopping Aztec Node`);
|
|
934
|
-
await
|
|
935
|
-
await tryStop(this.epochPruneWatcher);
|
|
756
|
+
await this.stopStartedWatchers();
|
|
936
757
|
await tryStop(this.slasherClient);
|
|
937
|
-
await
|
|
758
|
+
await Promise.all([
|
|
759
|
+
tryStop(this.peerProofVerifier),
|
|
760
|
+
tryStop(this.rpcProofVerifier)
|
|
761
|
+
]);
|
|
938
762
|
await tryStop(this.sequencer);
|
|
763
|
+
await tryStop(this.automineSequencer);
|
|
764
|
+
await tryStop(this.proverNode);
|
|
939
765
|
await tryStop(this.p2pClient);
|
|
766
|
+
// Dispose the AVM backend before world state: it kills the bb-avm-sim processes and closes the CDB IPC
|
|
767
|
+
// server, releasing their connections to the WSDB so it shuts down cleanly (and freeing the
|
|
768
|
+
// Server/Socket/ChildProcess handles that would otherwise keep the process alive after teardown).
|
|
769
|
+
await this.avmSimulator?.[Symbol.asyncDispose]();
|
|
940
770
|
await tryStop(this.worldStateSynchronizer);
|
|
941
771
|
await tryStop(this.blockSource);
|
|
942
772
|
await tryStop(this.blobClient);
|
|
@@ -954,309 +784,121 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
954
784
|
* @param limit - The number of items to returns
|
|
955
785
|
* @param after - The last known pending tx. Used for pagination
|
|
956
786
|
* @returns - The pending txs.
|
|
957
|
-
*/ getPendingTxs(limit, after) {
|
|
958
|
-
return this.p2pClient.getPendingTxs(limit, after);
|
|
787
|
+
*/ getPendingTxs(limit, after, options) {
|
|
788
|
+
return this.p2pClient.getPendingTxs(limit, after, options);
|
|
959
789
|
}
|
|
960
790
|
getPendingTxCount() {
|
|
961
791
|
return this.p2pClient.getPendingTxCount();
|
|
962
792
|
}
|
|
793
|
+
getPeers(includePending) {
|
|
794
|
+
return this.p2pClient.getPeers(includePending);
|
|
795
|
+
}
|
|
796
|
+
getCheckpointAttestationsForSlot(slot, proposalPayloadHash) {
|
|
797
|
+
return this.p2pClient.getCheckpointAttestationsForSlot(slot, proposalPayloadHash);
|
|
798
|
+
}
|
|
799
|
+
getProposalsForSlot(slot) {
|
|
800
|
+
return this.p2pClient.getProposalsForSlot(slot);
|
|
801
|
+
}
|
|
963
802
|
/**
|
|
964
|
-
* Method to retrieve a single tx from the mempool or unfinalized chain.
|
|
803
|
+
* Method to retrieve a single tx from the mempool or unfinalized chain. The tx's proof is only loaded and returned
|
|
804
|
+
* when `includeProof` is set.
|
|
965
805
|
* @param txHash - The transaction hash to return.
|
|
806
|
+
* @param options - Options for the returned tx (eg whether to include its proof).
|
|
966
807
|
* @returns - The tx if it exists.
|
|
967
|
-
*/ getTxByHash(txHash) {
|
|
968
|
-
return
|
|
808
|
+
*/ getTxByHash(txHash, options) {
|
|
809
|
+
return this.p2pClient.getTxByHashFromPool(txHash, {
|
|
810
|
+
includeProof: !!options?.includeProof
|
|
811
|
+
});
|
|
969
812
|
}
|
|
970
813
|
/**
|
|
971
|
-
* Method to retrieve txs from the mempool or unfinalized chain.
|
|
814
|
+
* Method to retrieve txs from the mempool or unfinalized chain. The txs' proofs are only loaded and returned when
|
|
815
|
+
* `includeProof` is set.
|
|
972
816
|
* @param txHash - The transaction hash to return.
|
|
817
|
+
* @param options - Options for the returned txs (eg whether to include their proofs).
|
|
973
818
|
* @returns - The txs if it exists.
|
|
974
|
-
*/ async getTxsByHash(txHashes) {
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
async findLeavesIndexes(block, treeId, leafValues) {
|
|
978
|
-
const committedDb = await this.#getWorldState(block);
|
|
979
|
-
const maybeIndices = await committedDb.findLeafIndices(treeId, leafValues.map((x)=>x.toBuffer()));
|
|
980
|
-
// We filter out undefined values
|
|
981
|
-
const indices = maybeIndices.filter((x)=>x !== undefined);
|
|
982
|
-
// Now we find the block numbers for the indices
|
|
983
|
-
const blockNumbers = await committedDb.getBlockNumbersForLeafIndices(treeId, indices);
|
|
984
|
-
// If any of the block numbers are undefined, we throw an error.
|
|
985
|
-
for(let i = 0; i < indices.length; i++){
|
|
986
|
-
if (blockNumbers[i] === undefined) {
|
|
987
|
-
throw new Error(`Block number is undefined for leaf index ${indices[i]} in tree ${MerkleTreeId[treeId]}`);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
// Get unique block numbers in order to optimize num calls to getLeafValue function.
|
|
991
|
-
const uniqueBlockNumbers = [
|
|
992
|
-
...new Set(blockNumbers.filter((x)=>x !== undefined))
|
|
993
|
-
];
|
|
994
|
-
// Now we obtain the block hashes from the archive tree by calling await `committedDb.getLeafValue(treeId, index)`
|
|
995
|
-
// (note that block number corresponds to the leaf index in the archive tree).
|
|
996
|
-
const blockHashes = await Promise.all(uniqueBlockNumbers.map((blockNumber)=>{
|
|
997
|
-
return committedDb.getLeafValue(MerkleTreeId.ARCHIVE, BigInt(blockNumber));
|
|
998
|
-
}));
|
|
999
|
-
// If any of the block hashes are undefined, we throw an error.
|
|
1000
|
-
for(let i = 0; i < uniqueBlockNumbers.length; i++){
|
|
1001
|
-
if (blockHashes[i] === undefined) {
|
|
1002
|
-
throw new Error(`Block hash is undefined for block number ${uniqueBlockNumbers[i]}`);
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
// Create DataInBlock objects by combining indices, blockNumbers and blockHashes and return them.
|
|
1006
|
-
return maybeIndices.map((index, i)=>{
|
|
1007
|
-
if (index === undefined) {
|
|
1008
|
-
return undefined;
|
|
1009
|
-
}
|
|
1010
|
-
const blockNumber = blockNumbers[i];
|
|
1011
|
-
if (blockNumber === undefined) {
|
|
1012
|
-
return undefined;
|
|
1013
|
-
}
|
|
1014
|
-
const blockHashIndex = uniqueBlockNumbers.indexOf(blockNumber);
|
|
1015
|
-
const blockHash = blockHashes[blockHashIndex];
|
|
1016
|
-
if (!blockHash) {
|
|
1017
|
-
return undefined;
|
|
1018
|
-
}
|
|
1019
|
-
return {
|
|
1020
|
-
l2BlockNumber: BlockNumber(Number(blockNumber)),
|
|
1021
|
-
l2BlockHash: L2BlockHash.fromField(blockHash),
|
|
1022
|
-
data: index
|
|
1023
|
-
};
|
|
819
|
+
*/ async getTxsByHash(txHashes, options) {
|
|
820
|
+
const txs = await this.p2pClient.getTxsByHashFromPool(txHashes, {
|
|
821
|
+
includeProof: !!options?.includeProof
|
|
1024
822
|
});
|
|
823
|
+
return compactArray(txs);
|
|
1025
824
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
return committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, leafIndex);
|
|
825
|
+
findLeavesIndexes(referenceBlock, treeId, leafValues) {
|
|
826
|
+
return this.worldStateQueries.findLeavesIndexes(referenceBlock, treeId, leafValues);
|
|
1029
827
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
return committedDb.getSiblingPath(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
|
|
828
|
+
getBlockHashMembershipWitness(referenceBlock, blockHash) {
|
|
829
|
+
return this.worldStateQueries.getBlockHashMembershipWitness(referenceBlock, blockHash);
|
|
1033
830
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
const [pathAndIndex] = await committedDb.findSiblingPaths(MerkleTreeId.ARCHIVE, [
|
|
1037
|
-
archive
|
|
1038
|
-
]);
|
|
1039
|
-
return pathAndIndex === undefined ? undefined : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
831
|
+
getNoteHashMembershipWitness(referenceBlock, noteHash) {
|
|
832
|
+
return this.worldStateQueries.getNoteHashMembershipWitness(referenceBlock, noteHash);
|
|
1040
833
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
const [pathAndIndex] = await committedDb.findSiblingPaths(MerkleTreeId.NOTE_HASH_TREE, [
|
|
1044
|
-
noteHash
|
|
1045
|
-
]);
|
|
1046
|
-
return pathAndIndex === undefined ? undefined : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
834
|
+
getL1ToL2MessageMembershipWitness(referenceBlock, l1ToL2Message) {
|
|
835
|
+
return this.worldStateQueries.getL1ToL2MessageMembershipWitness(referenceBlock, l1ToL2Message);
|
|
1047
836
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
const [witness] = await db.findSiblingPaths(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, [
|
|
1051
|
-
l1ToL2Message
|
|
1052
|
-
]);
|
|
1053
|
-
if (!witness) {
|
|
1054
|
-
return undefined;
|
|
1055
|
-
}
|
|
1056
|
-
// REFACTOR: Return a MembershipWitness object
|
|
1057
|
-
return [
|
|
1058
|
-
witness.index,
|
|
1059
|
-
witness.path
|
|
1060
|
-
];
|
|
1061
|
-
}
|
|
1062
|
-
async getL1ToL2MessageBlock(l1ToL2Message) {
|
|
1063
|
-
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
1064
|
-
return messageIndex ? BlockNumber.fromCheckpointNumber(InboxLeaf.checkpointNumberFromIndex(messageIndex)) : undefined;
|
|
1065
|
-
}
|
|
1066
|
-
/**
|
|
1067
|
-
* Returns whether an L1 to L2 message is synced by archiver and if it's ready to be included in a block.
|
|
1068
|
-
* @param l1ToL2Message - The L1 to L2 message to check.
|
|
1069
|
-
* @returns Whether the message is synced and ready to be included in a block.
|
|
1070
|
-
*/ async isL1ToL2MessageSynced(l1ToL2Message) {
|
|
1071
|
-
const messageIndex = await this.l1ToL2MessageSource.getL1ToL2MessageIndex(l1ToL2Message);
|
|
1072
|
-
return messageIndex !== undefined;
|
|
837
|
+
getL1ToL2MessageCheckpoint(l1ToL2Message) {
|
|
838
|
+
return this.worldStateQueries.getL1ToL2MessageCheckpoint(l1ToL2Message);
|
|
1073
839
|
}
|
|
1074
840
|
/**
|
|
1075
841
|
* Returns all the L2 to L1 messages in an epoch.
|
|
842
|
+
*
|
|
843
|
+
* @deprecated Use {@link getL2ToL1MembershipWitness} to get an L2-to-L1 message witness directly.
|
|
844
|
+
*
|
|
1076
845
|
* @param epoch - The epoch at which to get the data.
|
|
1077
846
|
* @returns The L2 to L1 messages (empty array if the epoch is not found).
|
|
1078
|
-
*/
|
|
1079
|
-
|
|
1080
|
-
const blocks = await this.blockSource.getBlocksForEpoch(epoch);
|
|
1081
|
-
const blocksInCheckpoints = [];
|
|
1082
|
-
let previousSlotNumber = SlotNumber.ZERO;
|
|
1083
|
-
let checkpointIndex = -1;
|
|
1084
|
-
for (const block of blocks){
|
|
1085
|
-
const slotNumber = block.header.globalVariables.slotNumber;
|
|
1086
|
-
if (slotNumber !== previousSlotNumber) {
|
|
1087
|
-
checkpointIndex++;
|
|
1088
|
-
blocksInCheckpoints.push([]);
|
|
1089
|
-
previousSlotNumber = slotNumber;
|
|
1090
|
-
}
|
|
1091
|
-
blocksInCheckpoints[checkpointIndex].push(block);
|
|
1092
|
-
}
|
|
1093
|
-
return blocksInCheckpoints.map((blocks)=>blocks.map((block)=>block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs)));
|
|
847
|
+
*/ getL2ToL1Messages(epoch) {
|
|
848
|
+
return this.worldStateQueries.getL2ToL1Messages(epoch);
|
|
1094
849
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
850
|
+
/**
|
|
851
|
+
* Returns the L2-to-L1 membership witness for a message in `txHash`. Passthrough to the
|
|
852
|
+
* archiver's locally-cached resolver — see {@link Archiver.getL2ToL1MembershipWitness}.
|
|
853
|
+
*/ getL2ToL1MembershipWitness(txHash, message, messageIndexInTx) {
|
|
854
|
+
return this.worldStateQueries.getL2ToL1MembershipWitness(txHash, message, messageIndexInTx);
|
|
1098
855
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
return committedDb.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, leafIndex);
|
|
856
|
+
getNullifierMembershipWitness(referenceBlock, nullifier) {
|
|
857
|
+
return this.worldStateQueries.getNullifierMembershipWitness(referenceBlock, nullifier);
|
|
1102
858
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
const [witness] = await db.findSiblingPaths(MerkleTreeId.NULLIFIER_TREE, [
|
|
1106
|
-
nullifier.toBuffer()
|
|
1107
|
-
]);
|
|
1108
|
-
if (!witness) {
|
|
1109
|
-
return undefined;
|
|
1110
|
-
}
|
|
1111
|
-
const { index, path } = witness;
|
|
1112
|
-
const leafPreimage = await db.getLeafPreimage(MerkleTreeId.NULLIFIER_TREE, index);
|
|
1113
|
-
if (!leafPreimage) {
|
|
1114
|
-
return undefined;
|
|
1115
|
-
}
|
|
1116
|
-
return new NullifierMembershipWitness(index, leafPreimage, path);
|
|
859
|
+
getLowNullifierMembershipWitness(referenceBlock, nullifier) {
|
|
860
|
+
return this.worldStateQueries.getLowNullifierMembershipWitness(referenceBlock, nullifier);
|
|
1117
861
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
* @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
|
|
1121
|
-
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
1122
|
-
* @returns The low nullifier membership witness (if found).
|
|
1123
|
-
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
1124
|
-
* list structure" of leaves and proving that a lower nullifier is pointing to a bigger next value than the nullifier
|
|
1125
|
-
* we are trying to prove non-inclusion for.
|
|
1126
|
-
*
|
|
1127
|
-
* Note: This function returns the membership witness of the nullifier itself and not the low nullifier when
|
|
1128
|
-
* the nullifier already exists in the tree. This is because the `getPreviousValueIndex` function returns the
|
|
1129
|
-
* index of the nullifier itself when it already exists in the tree.
|
|
1130
|
-
* TODO: This is a confusing behavior and we should eventually address that.
|
|
1131
|
-
*/ async getLowNullifierMembershipWitness(block, nullifier) {
|
|
1132
|
-
const committedDb = await this.#getWorldState(block);
|
|
1133
|
-
const findResult = await committedDb.getPreviousValueIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBigInt());
|
|
1134
|
-
if (!findResult) {
|
|
1135
|
-
return undefined;
|
|
1136
|
-
}
|
|
1137
|
-
const { index, alreadyPresent } = findResult;
|
|
1138
|
-
if (alreadyPresent) {
|
|
1139
|
-
this.log.warn(`Nullifier ${nullifier.toBigInt()} already exists in the tree`);
|
|
1140
|
-
}
|
|
1141
|
-
const preimageData = await committedDb.getLeafPreimage(MerkleTreeId.NULLIFIER_TREE, index);
|
|
1142
|
-
const siblingPath = await committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, BigInt(index));
|
|
1143
|
-
return new NullifierMembershipWitness(BigInt(index), preimageData, siblingPath);
|
|
1144
|
-
}
|
|
1145
|
-
async getPublicDataWitness(block, leafSlot) {
|
|
1146
|
-
const committedDb = await this.#getWorldState(block);
|
|
1147
|
-
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
1148
|
-
if (!lowLeafResult) {
|
|
1149
|
-
return undefined;
|
|
1150
|
-
} else {
|
|
1151
|
-
const preimage = await committedDb.getLeafPreimage(MerkleTreeId.PUBLIC_DATA_TREE, lowLeafResult.index);
|
|
1152
|
-
const path = await committedDb.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, lowLeafResult.index);
|
|
1153
|
-
return new PublicDataWitness(lowLeafResult.index, preimage, path);
|
|
1154
|
-
}
|
|
862
|
+
getPublicDataWitness(referenceBlock, leafSlot) {
|
|
863
|
+
return this.worldStateQueries.getPublicDataWitness(referenceBlock, leafSlot);
|
|
1155
864
|
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
const leafSlot = await computePublicDataTreeLeafSlot(contract, slot);
|
|
1159
|
-
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
1160
|
-
if (!lowLeafResult || !lowLeafResult.alreadyPresent) {
|
|
1161
|
-
return Fr.ZERO;
|
|
1162
|
-
}
|
|
1163
|
-
const preimage = await committedDb.getLeafPreimage(MerkleTreeId.PUBLIC_DATA_TREE, lowLeafResult.index);
|
|
1164
|
-
return preimage.leaf.value;
|
|
1165
|
-
}
|
|
1166
|
-
async getBlockHeader(block = 'latest') {
|
|
1167
|
-
if (L2BlockHash.isL2BlockHash(block)) {
|
|
1168
|
-
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
1169
|
-
if (block.equals(initialBlockHash)) {
|
|
1170
|
-
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1171
|
-
return this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
1172
|
-
}
|
|
1173
|
-
const blockHashFr = Fr.fromBuffer(block.toBuffer());
|
|
1174
|
-
return this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
1175
|
-
} else {
|
|
1176
|
-
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1177
|
-
const blockNumber = block === 'latest' ? await this.getBlockNumber() : block;
|
|
1178
|
-
if (blockNumber === BlockNumber.ZERO) {
|
|
1179
|
-
return this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
1180
|
-
}
|
|
1181
|
-
return this.blockSource.getBlockHeader(block);
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
/**
|
|
1185
|
-
* Get a block header specified by its archive root.
|
|
1186
|
-
* @param archive - The archive root being requested.
|
|
1187
|
-
* @returns The requested block header.
|
|
1188
|
-
*/ async getBlockHeaderByArchive(archive) {
|
|
1189
|
-
return await this.blockSource.getBlockHeaderByArchive(archive);
|
|
865
|
+
getPublicStorageAt(referenceBlock, contract, slot) {
|
|
866
|
+
return this.worldStateQueries.getPublicStorageAt(referenceBlock, contract, slot);
|
|
1190
867
|
}
|
|
1191
868
|
/**
|
|
1192
869
|
* Simulates the public part of a transaction with the current state.
|
|
1193
870
|
* @param tx - The transaction to simulate.
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
const teardownGasLimit = gasSettings.teardownGasLimits.l2Gas;
|
|
1199
|
-
if (txGasLimit + teardownGasLimit > this.config.rpcSimulatePublicMaxGasLimit) {
|
|
1200
|
-
throw new BadRequestError(`Transaction total gas limit ${txGasLimit + teardownGasLimit} (${txGasLimit} + ${teardownGasLimit}) exceeds maximum gas limit ${this.config.rpcSimulatePublicMaxGasLimit} for simulation`);
|
|
1201
|
-
}
|
|
1202
|
-
const txHash = tx.getTxHash();
|
|
1203
|
-
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
1204
|
-
// If sequencer is not initialized, we just set these values to zero for simulation.
|
|
1205
|
-
const coinbase = EthAddress.ZERO;
|
|
1206
|
-
const feeRecipient = AztecAddress.ZERO;
|
|
1207
|
-
const newGlobalVariables = await this.globalVariableBuilder.buildGlobalVariables(blockNumber, coinbase, feeRecipient);
|
|
1208
|
-
const publicProcessorFactory = new PublicProcessorFactory(this.contractDataSource, new DateProvider(), this.telemetry);
|
|
1209
|
-
this.log.verbose(`Simulating public calls for tx ${txHash}`, {
|
|
1210
|
-
globalVariables: newGlobalVariables.toInspect(),
|
|
1211
|
-
txHash,
|
|
1212
|
-
blockNumber
|
|
1213
|
-
});
|
|
1214
|
-
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
1215
|
-
try {
|
|
1216
|
-
const config = PublicSimulatorConfig.from({
|
|
1217
|
-
skipFeeEnforcement,
|
|
1218
|
-
collectDebugLogs: true,
|
|
1219
|
-
collectHints: false,
|
|
1220
|
-
collectCallMetadata: true,
|
|
1221
|
-
collectStatistics: false,
|
|
1222
|
-
collectionLimits: CollectionLimitsConfig.from({
|
|
1223
|
-
maxDebugLogMemoryReads: this.config.rpcSimulatePublicMaxDebugLogMemoryReads
|
|
1224
|
-
})
|
|
1225
|
-
});
|
|
1226
|
-
const processor = publicProcessorFactory.create(merkleTreeFork, newGlobalVariables, config);
|
|
1227
|
-
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
1228
|
-
const [processedTxs, failedTxs, _usedTxs, returns] = await processor.process([
|
|
1229
|
-
tx
|
|
1230
|
-
]);
|
|
1231
|
-
// REFACTOR: Consider returning the error rather than throwing
|
|
1232
|
-
if (failedTxs.length) {
|
|
1233
|
-
this.log.warn(`Simulated tx ${txHash} fails: ${failedTxs[0].error}`, {
|
|
1234
|
-
txHash
|
|
1235
|
-
});
|
|
1236
|
-
throw failedTxs[0].error;
|
|
1237
|
-
}
|
|
1238
|
-
const [processedTx] = processedTxs;
|
|
1239
|
-
return new PublicSimulationOutput(processedTx.revertReason, processedTx.globalVariables, processedTx.txEffect, returns, processedTx.gasUsed);
|
|
1240
|
-
} finally{
|
|
1241
|
-
await merkleTreeFork.close();
|
|
1242
|
-
}
|
|
871
|
+
* @param skipFeeEnforcement - If true, fee enforcement is skipped.
|
|
872
|
+
* @param overrides - Optional pre-simulation overrides applied to the ephemeral fork and contract DB.
|
|
873
|
+
**/ simulatePublicCalls(tx, skipFeeEnforcement = false, overrides) {
|
|
874
|
+
return this.nodePublicCallsSimulator.simulate(tx, skipFeeEnforcement, overrides);
|
|
1243
875
|
}
|
|
1244
876
|
async isValidTx(tx, { isSimulation, skipFeeEnforcement } = {}) {
|
|
1245
877
|
const db = this.worldStateSynchronizer.getCommitted();
|
|
1246
|
-
const verifier = isSimulation ? undefined : this.
|
|
1247
|
-
// We accept transactions if they are not expired by the next slot (checked based on the
|
|
878
|
+
const verifier = isSimulation ? undefined : this.rpcProofVerifier;
|
|
879
|
+
// We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field)
|
|
1248
880
|
const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
1249
881
|
const blockNumber = BlockNumber(await this.blockSource.getBlockNumber() + 1);
|
|
1250
|
-
const
|
|
882
|
+
const l1Constants = await this.blockSource.getL1Constants();
|
|
883
|
+
// Enforce the same network admission limit the node advertises in getNodeInfo (network-wide, not this
|
|
884
|
+
// node's local caps), so a tx the wallet sized against txsLimits is not rejected here.
|
|
885
|
+
const networkTxGasLimits = getNetworkTxGasLimits(this.config, l1Constants);
|
|
886
|
+
const validator = createTxValidatorForAcceptingTxsOverRPC(db, this.contractDataSource, verifier, {
|
|
1251
887
|
timestamp: nextSlotTimestamp,
|
|
1252
888
|
blockNumber,
|
|
1253
889
|
l1ChainId: this.l1ChainId,
|
|
1254
890
|
rollupVersion: this.version,
|
|
1255
|
-
setupAllowList:
|
|
891
|
+
setupAllowList: [
|
|
892
|
+
...await getDefaultAllowedSetupFunctions(),
|
|
893
|
+
...this.config.txPublicSetupAllowListExtend ?? []
|
|
894
|
+
],
|
|
1256
895
|
gasFees: await this.getCurrentMinFees(),
|
|
1257
896
|
skipFeeEnforcement,
|
|
1258
|
-
|
|
1259
|
-
|
|
897
|
+
isSimulation,
|
|
898
|
+
txsPermitted: !this.config.disableTransactions,
|
|
899
|
+
maxTxL2Gas: networkTxGasLimits.l2Gas,
|
|
900
|
+
maxTxDAGas: networkTxGasLimits.daGas
|
|
901
|
+
}, this.log.getBindings());
|
|
1260
902
|
return await validator.validateTx(tx);
|
|
1261
903
|
}
|
|
1262
904
|
getConfig() {
|
|
@@ -1269,7 +911,20 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1269
911
|
...this.config,
|
|
1270
912
|
...config
|
|
1271
913
|
};
|
|
1272
|
-
|
|
914
|
+
// If the sequencer is currently paused via pauseSequencer(), record the caller's desired
|
|
915
|
+
// minTxsPerBlock as the restore value (so resumeSequencer applies it) and keep the freeze
|
|
916
|
+
// (MAX_SAFE_INTEGER) applied to the underlying sequencer. Without this guard, forwarding
|
|
917
|
+
// the new minTxsPerBlock to the sequencer would silently unpause block production while
|
|
918
|
+
// pauseSequencer() still considers it paused.
|
|
919
|
+
const sequencerUpdate = {
|
|
920
|
+
...config
|
|
921
|
+
};
|
|
922
|
+
if (this.sequencerPausedMinTxsPerBlock !== undefined && sequencerUpdate.minTxsPerBlock !== undefined) {
|
|
923
|
+
this.sequencerPausedMinTxsPerBlock = sequencerUpdate.minTxsPerBlock;
|
|
924
|
+
delete sequencerUpdate.minTxsPerBlock;
|
|
925
|
+
}
|
|
926
|
+
this.sequencer?.updateConfig(sequencerUpdate);
|
|
927
|
+
this.automineSequencer?.updateConfig(sequencerUpdate);
|
|
1273
928
|
this.slasherClient?.updateConfig(config);
|
|
1274
929
|
this.validatorsSentinel?.updateConfig(config);
|
|
1275
930
|
await this.p2pClient.updateP2PConfig(config);
|
|
@@ -1278,7 +933,18 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1278
933
|
archiver.updateConfig(config);
|
|
1279
934
|
}
|
|
1280
935
|
if (newConfig.realProofs !== this.config.realProofs) {
|
|
1281
|
-
|
|
936
|
+
await Promise.all([
|
|
937
|
+
tryStop(this.peerProofVerifier),
|
|
938
|
+
tryStop(this.rpcProofVerifier)
|
|
939
|
+
]);
|
|
940
|
+
if (newConfig.realProofs) {
|
|
941
|
+
this.peerProofVerifier = await BatchChonkVerifier.new(newConfig, newConfig.bbChonkVerifyMaxBatch, 'peer');
|
|
942
|
+
const rpcVerifier = await BBCircuitVerifier.new(newConfig);
|
|
943
|
+
this.rpcProofVerifier = new QueuedIVCVerifier(rpcVerifier, newConfig.numConcurrentIVCVerifiers);
|
|
944
|
+
} else {
|
|
945
|
+
this.peerProofVerifier = new TestCircuitVerifier();
|
|
946
|
+
this.rpcProofVerifier = new TestCircuitVerifier();
|
|
947
|
+
}
|
|
1282
948
|
}
|
|
1283
949
|
this.config = newConfig;
|
|
1284
950
|
}
|
|
@@ -1287,7 +953,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1287
953
|
classRegistry: ProtocolContractAddress.ContractClassRegistry,
|
|
1288
954
|
feeJuice: ProtocolContractAddress.FeeJuice,
|
|
1289
955
|
instanceRegistry: ProtocolContractAddress.ContractInstanceRegistry,
|
|
1290
|
-
multiCallEntrypoint:
|
|
956
|
+
multiCallEntrypoint: STANDARD_MULTI_CALL_ENTRYPOINT_ADDRESS
|
|
1291
957
|
});
|
|
1292
958
|
}
|
|
1293
959
|
registerContractFunctionSignatures(signatures) {
|
|
@@ -1338,7 +1004,7 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1338
1004
|
});
|
|
1339
1005
|
return Promise.resolve();
|
|
1340
1006
|
}
|
|
1341
|
-
async rollbackTo(targetBlock, force) {
|
|
1007
|
+
async rollbackTo(targetBlock, force, resumeSync = true) {
|
|
1342
1008
|
const archiver = this.blockSource;
|
|
1343
1009
|
if (!('rollbackTo' in archiver)) {
|
|
1344
1010
|
throw new Error('Archiver implementation does not support rollbacks.');
|
|
@@ -1366,9 +1032,13 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1366
1032
|
this.log.error(`Error during rollback`, err);
|
|
1367
1033
|
throw err;
|
|
1368
1034
|
} finally{
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1035
|
+
if (resumeSync) {
|
|
1036
|
+
this.log.info(`Resuming world state and archiver sync.`);
|
|
1037
|
+
this.worldStateSynchronizer.resumeSync();
|
|
1038
|
+
archiver.resume();
|
|
1039
|
+
} else {
|
|
1040
|
+
this.log.info(`Sync left paused after rollback (resumeSync=false).`);
|
|
1041
|
+
}
|
|
1372
1042
|
}
|
|
1373
1043
|
}
|
|
1374
1044
|
async pauseSync() {
|
|
@@ -1382,74 +1052,176 @@ _dec = trackSpan('AztecNodeService.simulatePublicCalls', (tx)=>({
|
|
|
1382
1052
|
this.blockSource.resume();
|
|
1383
1053
|
return Promise.resolve();
|
|
1384
1054
|
}
|
|
1385
|
-
|
|
1386
|
-
if (
|
|
1387
|
-
|
|
1055
|
+
pauseSequencer() {
|
|
1056
|
+
if (this.automineSequencer) {
|
|
1057
|
+
this.automineSequencer.pause();
|
|
1058
|
+
return Promise.resolve();
|
|
1059
|
+
}
|
|
1060
|
+
if (this.sequencer) {
|
|
1061
|
+
if (this.sequencerPausedMinTxsPerBlock === undefined) {
|
|
1062
|
+
this.sequencerPausedMinTxsPerBlock = this.sequencer.getSequencer().getConfig().minTxsPerBlock ?? 0;
|
|
1063
|
+
this.sequencer.updateConfig({
|
|
1064
|
+
minTxsPerBlock: Number.MAX_SAFE_INTEGER
|
|
1065
|
+
});
|
|
1066
|
+
this.log.info(`Sequencer paused (minTxsPerBlock set to MAX_SAFE_INTEGER)`, {
|
|
1067
|
+
previousMinTxsPerBlock: this.sequencerPausedMinTxsPerBlock
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
return Promise.resolve();
|
|
1071
|
+
}
|
|
1072
|
+
throw new BadRequestError('Cannot pause sequencer: no sequencer is running');
|
|
1073
|
+
}
|
|
1074
|
+
resumeSequencer() {
|
|
1075
|
+
if (this.automineSequencer) {
|
|
1076
|
+
this.automineSequencer.resume();
|
|
1077
|
+
return Promise.resolve();
|
|
1078
|
+
}
|
|
1079
|
+
if (this.sequencer) {
|
|
1080
|
+
if (this.sequencerPausedMinTxsPerBlock !== undefined) {
|
|
1081
|
+
const restored = this.sequencerPausedMinTxsPerBlock;
|
|
1082
|
+
this.sequencerPausedMinTxsPerBlock = undefined;
|
|
1083
|
+
this.sequencer.updateConfig({
|
|
1084
|
+
minTxsPerBlock: restored
|
|
1085
|
+
});
|
|
1086
|
+
this.log.info(`Sequencer resumed (minTxsPerBlock restored)`, {
|
|
1087
|
+
minTxsPerBlock: restored
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
return Promise.resolve();
|
|
1388
1091
|
}
|
|
1389
|
-
|
|
1092
|
+
throw new BadRequestError('Cannot resume sequencer: no sequencer is running');
|
|
1390
1093
|
}
|
|
1391
1094
|
getSlashOffenses(round) {
|
|
1392
1095
|
if (!this.slasherClient) {
|
|
1393
1096
|
throw new Error(`Slasher client not enabled`);
|
|
1394
1097
|
}
|
|
1395
1098
|
if (round === 'all') {
|
|
1396
|
-
return this.slasherClient.
|
|
1099
|
+
return this.slasherClient.getOffenses();
|
|
1397
1100
|
} else {
|
|
1398
1101
|
return this.slasherClient.gatherOffensesForRound(round === 'current' ? undefined : BigInt(round));
|
|
1399
1102
|
}
|
|
1400
1103
|
}
|
|
1401
|
-
|
|
1402
|
-
if (!this.
|
|
1403
|
-
|
|
1104
|
+
async reloadKeystore() {
|
|
1105
|
+
if (!this.config.keyStoreDirectory?.length) {
|
|
1106
|
+
throw new BadRequestError('Cannot reload keystore: node is not using a file-based keystore. ' + 'Set KEY_STORE_DIRECTORY to use file-based keystores.');
|
|
1107
|
+
}
|
|
1108
|
+
if (!this.validatorClient) {
|
|
1109
|
+
throw new BadRequestError('Cannot reload keystore: validator is not enabled.');
|
|
1110
|
+
}
|
|
1111
|
+
this.log.info('Reloading keystore from disk');
|
|
1112
|
+
// Re-read and validate keystore files
|
|
1113
|
+
const keyStores = loadKeystores(this.config.keyStoreDirectory);
|
|
1114
|
+
const newManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
1115
|
+
await newManager.validateSigners();
|
|
1116
|
+
ValidatorClient.validateKeyStoreConfiguration(newManager, this.log);
|
|
1117
|
+
// Validate that every validator's publisher keys overlap with the L1 signers
|
|
1118
|
+
// that were initialized at startup. Publishers cannot be hot-reloaded, so a
|
|
1119
|
+
// validator with a publisher key that doesn't match any existing L1 signer
|
|
1120
|
+
// would silently fail on every proposer slot.
|
|
1121
|
+
if (this.keyStoreManager && this.sequencer) {
|
|
1122
|
+
const oldAdapter = NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager);
|
|
1123
|
+
const availablePublishers = new Set(oldAdapter.getAttesterAddresses().flatMap((a)=>oldAdapter.getPublisherAddresses(a).map((p)=>p.toString().toLowerCase())));
|
|
1124
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1125
|
+
for (const attester of newAdapter.getAttesterAddresses()){
|
|
1126
|
+
const pubs = newAdapter.getPublisherAddresses(attester);
|
|
1127
|
+
if (pubs.length > 0 && !pubs.some((p)=>availablePublishers.has(p.toString().toLowerCase()))) {
|
|
1128
|
+
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 ` + `[${[
|
|
1129
|
+
...availablePublishers
|
|
1130
|
+
].join(', ')}]. Publishers cannot be hot-reloaded — ` + `use an existing publisher key or restart the node.`);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1404
1133
|
}
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1134
|
+
// Build adapters for old and new keystores to compute diff
|
|
1135
|
+
const newAdapter = NodeKeystoreAdapter.fromKeyStoreManager(newManager);
|
|
1136
|
+
const newAddresses = newAdapter.getAttesterAddresses();
|
|
1137
|
+
const oldAddresses = this.keyStoreManager ? NodeKeystoreAdapter.fromKeyStoreManager(this.keyStoreManager).getAttesterAddresses() : [];
|
|
1138
|
+
const oldSet = new Set(oldAddresses.map((a)=>a.toString()));
|
|
1139
|
+
const newSet = new Set(newAddresses.map((a)=>a.toString()));
|
|
1140
|
+
const added = newAddresses.filter((a)=>!oldSet.has(a.toString()));
|
|
1141
|
+
const removed = oldAddresses.filter((a)=>!newSet.has(a.toString()));
|
|
1142
|
+
if (added.length > 0) {
|
|
1143
|
+
this.log.info(`Keystore reload: adding attester keys: ${added.map((a)=>a.toString()).join(', ')}`);
|
|
1144
|
+
}
|
|
1145
|
+
if (removed.length > 0) {
|
|
1146
|
+
this.log.info(`Keystore reload: removing attester keys: ${removed.map((a)=>a.toString()).join(', ')}`);
|
|
1147
|
+
}
|
|
1148
|
+
if (added.length === 0 && removed.length === 0) {
|
|
1149
|
+
this.log.info('Keystore reload: attester keys unchanged');
|
|
1150
|
+
}
|
|
1151
|
+
// Update the validator client (coinbase, feeRecipient, attester keys)
|
|
1152
|
+
this.validatorClient.reloadKeystore(newManager);
|
|
1153
|
+
// Update the publisher factory's keystore so newly-added validators
|
|
1154
|
+
// can be matched to existing publisher keys when proposing blocks.
|
|
1155
|
+
if (this.sequencer) {
|
|
1156
|
+
this.sequencer.updatePublisherNodeKeyStore(newAdapter);
|
|
1157
|
+
}
|
|
1158
|
+
// Update slasher's "don't-slash-self" list with new validator addresses
|
|
1159
|
+
if (this.slasherClient && !this.config.slashSelfAllowed) {
|
|
1160
|
+
const slashValidatorsNever = unique([
|
|
1161
|
+
...this.config.slashValidatorsNever ?? [],
|
|
1162
|
+
...newAddresses
|
|
1163
|
+
].map((a)=>a.toString())).map(EthAddress.fromString);
|
|
1164
|
+
this.slasherClient.updateConfig({
|
|
1165
|
+
slashValidatorsNever
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
this.keyStoreManager = newManager;
|
|
1169
|
+
this.log.info('Keystore reloaded: coinbase, feeRecipient, and attester keys updated');
|
|
1170
|
+
}
|
|
1171
|
+
async mineBlock() {
|
|
1172
|
+
if (this.automineSequencer) {
|
|
1173
|
+
await this.automineSequencer.buildEmptyBlock();
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (!this.sequencer) {
|
|
1177
|
+
throw new BadRequestError('Cannot mine block: no sequencer is running');
|
|
1178
|
+
}
|
|
1179
|
+
const currentBlockNumber = await this.getBlockNumber();
|
|
1180
|
+
// Use slot duration + 50% buffer as the timeout so this works on running networks too
|
|
1181
|
+
const { slotDuration } = await this.blockSource.getL1Constants();
|
|
1182
|
+
const timeoutSeconds = Math.ceil(slotDuration * 1.5);
|
|
1183
|
+
// Temporarily set minTxsPerBlock to 0 so the sequencer produces a block even with no txs
|
|
1184
|
+
const originalMinTxsPerBlock = this.sequencer.getSequencer().getConfig().minTxsPerBlock;
|
|
1185
|
+
this.sequencer.updateConfig({
|
|
1186
|
+
minTxsPerBlock: 0
|
|
1187
|
+
});
|
|
1413
1188
|
try {
|
|
1414
|
-
//
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1189
|
+
// Trigger the sequencer to produce a block immediately
|
|
1190
|
+
void this.sequencer.trigger();
|
|
1191
|
+
// Wait for the new L2 block to appear
|
|
1192
|
+
await retryUntil(async ()=>{
|
|
1193
|
+
const newBlockNumber = await this.getBlockNumber();
|
|
1194
|
+
return newBlockNumber > currentBlockNumber ? true : undefined;
|
|
1195
|
+
}, 'mineBlock', timeoutSeconds, 0.1);
|
|
1196
|
+
} finally{
|
|
1197
|
+
this.sequencer.updateConfig({
|
|
1198
|
+
minTxsPerBlock: originalMinTxsPerBlock
|
|
1199
|
+
});
|
|
1418
1200
|
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1201
|
+
}
|
|
1202
|
+
async prove(upToCheckpoint) {
|
|
1203
|
+
if (!this.automineSequencer) {
|
|
1204
|
+
throw new BadRequestError('Cannot prove checkpoint: no automine sequencer is running');
|
|
1422
1205
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
}
|
|
1429
|
-
const blockHashFr = Fr.fromBuffer(block.toBuffer());
|
|
1430
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
1431
|
-
if (!header) {
|
|
1432
|
-
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.`);
|
|
1433
|
-
}
|
|
1434
|
-
const blockNumber = header.getBlockNumber();
|
|
1435
|
-
this.log.debug(`Using snapshot for block ${blockNumber}, world state synced upto ${blockSyncedTo}`);
|
|
1436
|
-
return this.worldStateSynchronizer.getSnapshot(blockNumber);
|
|
1206
|
+
return await this.automineSequencer.prove(upToCheckpoint);
|
|
1207
|
+
}
|
|
1208
|
+
async warpL2TimeAtLeastTo(targetTimestamp) {
|
|
1209
|
+
if (!this.automineSequencer) {
|
|
1210
|
+
throw new BadRequestError('Cannot warp L2 time: no automine sequencer is running');
|
|
1437
1211
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
}
|
|
1444
|
-
this.log.debug(`Using snapshot for block ${blockNumber}, world state synced upto ${blockSyncedTo}`);
|
|
1445
|
-
return this.worldStateSynchronizer.getSnapshot(blockNumber);
|
|
1212
|
+
await this.automineSequencer.warpTo(targetTimestamp);
|
|
1213
|
+
}
|
|
1214
|
+
async warpL2TimeAtLeastBy(duration) {
|
|
1215
|
+
if (!this.automineSequencer) {
|
|
1216
|
+
throw new BadRequestError('Cannot warp L2 time: no automine sequencer is running');
|
|
1446
1217
|
}
|
|
1218
|
+
await this.automineSequencer.warpBy(duration);
|
|
1447
1219
|
}
|
|
1448
1220
|
/**
|
|
1449
|
-
*
|
|
1450
|
-
* @
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
return
|
|
1221
|
+
* Returns a committed world-state view at `block`, driving sync first. Delegates to
|
|
1222
|
+
* {@link NodeWorldStateQueries.getWorldState}; kept as a protected method so subclasses and tests can
|
|
1223
|
+
* exercise the node's block-resolution and reorg-aware sync behavior.
|
|
1224
|
+
*/ getWorldState(block) {
|
|
1225
|
+
return this.worldStateQueries.getWorldState(block);
|
|
1454
1226
|
}
|
|
1455
1227
|
}
|