@aztec/aztec-node 0.0.1-commit.f295ac2 → 0.0.1-commit.f8ca9b2f3

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.
@@ -6,4 +6,4 @@ import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
6
6
  import type { SentinelConfig } from './config.js';
7
7
  import { Sentinel } from './sentinel.js';
8
8
  export declare function createSentinel(epochCache: EpochCache, archiver: L2BlockSource, p2p: P2PClient, config: SentinelConfig & DataStoreConfig & SlasherConfig, logger?: import("@aztec/foundation/log").Logger): Promise<Sentinel | undefined>;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlbnRpbmVsL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFckQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFOUQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBQzVDLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXJFLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNsRCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBR3pDLHdCQUFzQixjQUFjLENBQ2xDLFVBQVUsRUFBRSxVQUFVLEVBQ3RCLFFBQVEsRUFBRSxhQUFhLEVBQ3ZCLEdBQUcsRUFBRSxTQUFTLEVBQ2QsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLEdBQUcsYUFBYSxFQUN4RCxNQUFNLHlDQUFnQyxHQUNyQyxPQUFPLENBQUMsUUFBUSxHQUFHLFNBQVMsQ0FBQyxDQWlCL0IifQ==
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlbnRpbmVsL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFckQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFOUQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sWUFBWSxDQUFDO0FBQzVDLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXJFLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNsRCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBR3pDLHdCQUFzQixjQUFjLENBQ2xDLFVBQVUsRUFBRSxVQUFVLEVBQ3RCLFFBQVEsRUFBRSxhQUFhLEVBQ3ZCLEdBQUcsRUFBRSxTQUFTLEVBQ2QsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLEdBQUcsYUFBYSxFQUN4RCxNQUFNLHlDQUFnQyxHQUNyQyxPQUFPLENBQUMsUUFBUSxHQUFHLFNBQVMsQ0FBQyxDQVkvQiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/sentinel/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,wBAAsB,cAAc,CAClC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,cAAc,GAAG,eAAe,GAAG,aAAa,EACxD,MAAM,yCAAgC,GACrC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAiB/B"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/sentinel/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,wBAAsB,cAAc,CAClC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,cAAc,GAAG,eAAe,GAAG,aAAa,EACxD,MAAM,yCAAgC,GACrC,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAY/B"}
@@ -6,7 +6,7 @@ export async function createSentinel(epochCache, archiver, p2p, config, logger =
6
6
  if (!config.sentinelEnabled) {
7
7
  return undefined;
8
8
  }
9
- const kvStore = await createStore('sentinel', SentinelStore.SCHEMA_VERSION, config, createLogger('node:sentinel:lmdb'));
9
+ const kvStore = await createStore('sentinel', SentinelStore.SCHEMA_VERSION, config, logger.getBindings());
10
10
  const storeHistoryLength = config.sentinelHistoryLengthInEpochs * epochCache.getL1Constants().epochDuration;
11
11
  const storeHistoricProvenPerformanceLength = config.sentinelHistoricProvenPerformanceLengthInEpochs;
12
12
  const sentinelStore = new SentinelStore(kvStore, {
@@ -82,7 +82,7 @@ export class Sentinel extends EventEmitter {
82
82
  return;
83
83
  }
84
84
  const blockNumber = event.block.number;
85
- const block = await this.archiver.getL2BlockNew(blockNumber);
85
+ const block = await this.archiver.getL2Block(blockNumber);
86
86
  if (!block) {
87
87
  this.logger.error(`Failed to get block ${blockNumber}`, {
88
88
  block
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec-node",
3
- "version": "0.0.1-commit.f295ac2",
3
+ "version": "0.0.1-commit.f8ca9b2f3",
4
4
  "main": "dest/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -65,30 +65,30 @@
65
65
  ]
66
66
  },
67
67
  "dependencies": {
68
- "@aztec/archiver": "0.0.1-commit.f295ac2",
69
- "@aztec/bb-prover": "0.0.1-commit.f295ac2",
70
- "@aztec/blob-client": "0.0.1-commit.f295ac2",
71
- "@aztec/constants": "0.0.1-commit.f295ac2",
72
- "@aztec/epoch-cache": "0.0.1-commit.f295ac2",
73
- "@aztec/ethereum": "0.0.1-commit.f295ac2",
74
- "@aztec/foundation": "0.0.1-commit.f295ac2",
75
- "@aztec/kv-store": "0.0.1-commit.f295ac2",
76
- "@aztec/l1-artifacts": "0.0.1-commit.f295ac2",
77
- "@aztec/merkle-tree": "0.0.1-commit.f295ac2",
78
- "@aztec/node-keystore": "0.0.1-commit.f295ac2",
79
- "@aztec/node-lib": "0.0.1-commit.f295ac2",
80
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f295ac2",
81
- "@aztec/p2p": "0.0.1-commit.f295ac2",
82
- "@aztec/protocol-contracts": "0.0.1-commit.f295ac2",
83
- "@aztec/prover-client": "0.0.1-commit.f295ac2",
84
- "@aztec/sequencer-client": "0.0.1-commit.f295ac2",
85
- "@aztec/simulator": "0.0.1-commit.f295ac2",
86
- "@aztec/slasher": "0.0.1-commit.f295ac2",
87
- "@aztec/stdlib": "0.0.1-commit.f295ac2",
88
- "@aztec/telemetry-client": "0.0.1-commit.f295ac2",
89
- "@aztec/validator-client": "0.0.1-commit.f295ac2",
90
- "@aztec/validator-ha-signer": "0.0.1-commit.f295ac2",
91
- "@aztec/world-state": "0.0.1-commit.f295ac2",
68
+ "@aztec/archiver": "0.0.1-commit.f8ca9b2f3",
69
+ "@aztec/bb-prover": "0.0.1-commit.f8ca9b2f3",
70
+ "@aztec/blob-client": "0.0.1-commit.f8ca9b2f3",
71
+ "@aztec/constants": "0.0.1-commit.f8ca9b2f3",
72
+ "@aztec/epoch-cache": "0.0.1-commit.f8ca9b2f3",
73
+ "@aztec/ethereum": "0.0.1-commit.f8ca9b2f3",
74
+ "@aztec/foundation": "0.0.1-commit.f8ca9b2f3",
75
+ "@aztec/kv-store": "0.0.1-commit.f8ca9b2f3",
76
+ "@aztec/l1-artifacts": "0.0.1-commit.f8ca9b2f3",
77
+ "@aztec/merkle-tree": "0.0.1-commit.f8ca9b2f3",
78
+ "@aztec/node-keystore": "0.0.1-commit.f8ca9b2f3",
79
+ "@aztec/node-lib": "0.0.1-commit.f8ca9b2f3",
80
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f8ca9b2f3",
81
+ "@aztec/p2p": "0.0.1-commit.f8ca9b2f3",
82
+ "@aztec/protocol-contracts": "0.0.1-commit.f8ca9b2f3",
83
+ "@aztec/prover-client": "0.0.1-commit.f8ca9b2f3",
84
+ "@aztec/sequencer-client": "0.0.1-commit.f8ca9b2f3",
85
+ "@aztec/simulator": "0.0.1-commit.f8ca9b2f3",
86
+ "@aztec/slasher": "0.0.1-commit.f8ca9b2f3",
87
+ "@aztec/stdlib": "0.0.1-commit.f8ca9b2f3",
88
+ "@aztec/telemetry-client": "0.0.1-commit.f8ca9b2f3",
89
+ "@aztec/validator-client": "0.0.1-commit.f8ca9b2f3",
90
+ "@aztec/validator-ha-signer": "0.0.1-commit.f8ca9b2f3",
91
+ "@aztec/world-state": "0.0.1-commit.f8ca9b2f3",
92
92
  "koa": "^2.16.1",
93
93
  "koa-router": "^13.1.1",
94
94
  "tslib": "^2.4.0",
@@ -1,4 +1,11 @@
1
- import { Attributes, type Histogram, Metrics, type TelemetryClient, type UpDownCounter } from '@aztec/telemetry-client';
1
+ import {
2
+ Attributes,
3
+ type Histogram,
4
+ Metrics,
5
+ type TelemetryClient,
6
+ type UpDownCounter,
7
+ createUpDownCounterWithDefault,
8
+ } from '@aztec/telemetry-client';
2
9
 
3
10
  export class NodeMetrics {
4
11
  private receiveTxCount: UpDownCounter;
@@ -9,14 +16,14 @@ export class NodeMetrics {
9
16
 
10
17
  constructor(client: TelemetryClient, name = 'AztecNode') {
11
18
  const meter = client.getMeter(name);
12
- this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT);
19
+ this.receiveTxCount = createUpDownCounterWithDefault(meter, Metrics.NODE_RECEIVE_TX_COUNT, {
20
+ [Attributes.OK]: [true, false],
21
+ });
13
22
  this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION);
14
23
 
15
24
  this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION);
16
25
 
17
- this.snapshotErrorCount = meter.createUpDownCounter(Metrics.NODE_SNAPSHOT_ERROR_COUNT);
18
-
19
- this.snapshotErrorCount.add(0);
26
+ this.snapshotErrorCount = createUpDownCounterWithDefault(meter, Metrics.NODE_SNAPSHOT_ERROR_COUNT);
20
27
  }
21
28
 
22
29
  receivedTx(durationMs: number, isAccepted: boolean) {
@@ -1,13 +1,7 @@
1
1
  import { Archiver, createArchiver } from '@aztec/archiver';
2
2
  import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
3
3
  import { type BlobClientInterface, createBlobClientWithFileStores } from '@aztec/blob-client/client';
4
- import {
5
- ARCHIVE_HEIGHT,
6
- type L1_TO_L2_MSG_TREE_HEIGHT,
7
- type NOTE_HASH_TREE_HEIGHT,
8
- type NULLIFIER_TREE_HEIGHT,
9
- type PUBLIC_DATA_TREE_HEIGHT,
10
- } from '@aztec/constants';
4
+ import { ARCHIVE_HEIGHT, type L1_TO_L2_MSG_TREE_HEIGHT, type NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
11
5
  import { EpochCache, type EpochCacheInterface } from '@aztec/epoch-cache';
12
6
  import { createEthereumChain } from '@aztec/ethereum/chain';
13
7
  import { getPublicClient } from '@aztec/ethereum/client';
@@ -41,14 +35,7 @@ import {
41
35
  } from '@aztec/slasher';
42
36
  import { CollectionLimitsConfig, PublicSimulatorConfig } from '@aztec/stdlib/avm';
43
37
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
44
- import {
45
- type BlockParameter,
46
- type CheckpointedL2Block,
47
- type DataInBlock,
48
- L2BlockHash,
49
- L2BlockNew,
50
- type L2BlockSource,
51
- } from '@aztec/stdlib/block';
38
+ import { BlockHash, type BlockParameter, type DataInBlock, L2Block, type L2BlockSource } from '@aztec/stdlib/block';
52
39
  import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
53
40
  import type {
54
41
  ContractClassPublic,
@@ -126,7 +113,7 @@ import { NodeMetrics } from './node_metrics.js';
126
113
  */
127
114
  export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
128
115
  private metrics: NodeMetrics;
129
- private initialHeaderHashPromise: Promise<L2BlockHash> | undefined = undefined;
116
+ private initialHeaderHashPromise: Promise<BlockHash> | undefined = undefined;
130
117
 
131
118
  // Prevent two snapshot operations to happen simultaneously
132
119
  private isUploadingSnapshot = false;
@@ -566,6 +553,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
566
553
  enr,
567
554
  l1ContractAddresses: contractAddresses,
568
555
  protocolContractAddresses: protocolContractAddresses,
556
+ realProofs: !!this.config.realProofs,
569
557
  };
570
558
 
571
559
  return nodeInfo;
@@ -576,15 +564,15 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
576
564
  * @param block - The block parameter (block number, block hash, or 'latest').
577
565
  * @returns The requested block.
578
566
  */
579
- public async getBlock(block: BlockParameter): Promise<L2BlockNew | undefined> {
580
- if (L2BlockHash.isL2BlockHash(block)) {
581
- return this.getBlockByHash(Fr.fromBuffer(block.toBuffer()));
567
+ public async getBlock(block: BlockParameter): Promise<L2Block | undefined> {
568
+ if (BlockHash.isBlockHash(block)) {
569
+ return this.getBlockByHash(block);
582
570
  }
583
571
  const blockNumber = block === 'latest' ? await this.getBlockNumber() : (block as BlockNumber);
584
572
  if (blockNumber === BlockNumber.ZERO) {
585
573
  return this.buildInitialBlock();
586
574
  }
587
- return await this.blockSource.getL2BlockNew(blockNumber);
575
+ return await this.blockSource.getL2Block(blockNumber);
588
576
  }
589
577
 
590
578
  /**
@@ -592,17 +580,17 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
592
580
  * @param blockHash - The block hash being requested.
593
581
  * @returns The requested block.
594
582
  */
595
- public async getBlockByHash(blockHash: Fr): Promise<L2BlockNew | undefined> {
583
+ public async getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined> {
596
584
  const initialBlockHash = await this.#getInitialHeaderHash();
597
- if (blockHash.equals(Fr.fromBuffer(initialBlockHash.toBuffer()))) {
585
+ if (blockHash.equals(initialBlockHash)) {
598
586
  return this.buildInitialBlock();
599
587
  }
600
- return await this.blockSource.getL2BlockNewByHash(blockHash);
588
+ return await this.blockSource.getL2BlockByHash(blockHash);
601
589
  }
602
590
 
603
- private buildInitialBlock(): L2BlockNew {
591
+ private buildInitialBlock(): L2Block {
604
592
  const initialHeader = this.worldStateSynchronizer.getCommitted().getInitialHeader();
605
- return L2BlockNew.empty(initialHeader);
593
+ return L2Block.empty(initialHeader);
606
594
  }
607
595
 
608
596
  /**
@@ -610,8 +598,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
610
598
  * @param archive - The archive root being requested.
611
599
  * @returns The requested block.
612
600
  */
613
- public async getBlockByArchive(archive: Fr): Promise<L2BlockNew | undefined> {
614
- return await this.blockSource.getL2BlockNewByArchive(archive);
601
+ public async getBlockByArchive(archive: Fr): Promise<L2Block | undefined> {
602
+ return await this.blockSource.getL2BlockByArchive(archive);
615
603
  }
616
604
 
617
605
  /**
@@ -620,24 +608,16 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
620
608
  * @param limit - The maximum number of blocks to obtain.
621
609
  * @returns The blocks requested.
622
610
  */
623
- public async getBlocks(from: BlockNumber, limit: number): Promise<L2BlockNew[]> {
624
- return (await this.blockSource.getL2BlocksNew(from, limit)) ?? [];
611
+ public async getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]> {
612
+ return (await this.blockSource.getBlocks(from, BlockNumber(limit))) ?? [];
625
613
  }
626
614
 
627
- public async getPublishedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]> {
628
- return (await this.blockSource.getPublishedBlocks(from, limit)) ?? [];
615
+ public async getCheckpoints(from: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]> {
616
+ return (await this.blockSource.getCheckpoints(from, limit)) ?? [];
629
617
  }
630
618
 
631
- public async getPublishedCheckpoints(from: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]> {
632
- return (await this.blockSource.getPublishedCheckpoints(from, limit)) ?? [];
633
- }
634
-
635
- public async getL2BlocksNew(from: BlockNumber, limit: number): Promise<L2BlockNew[]> {
636
- return (await this.blockSource.getL2BlocksNew(from, limit)) ?? [];
637
- }
638
-
639
- public async getCheckpointedBlocks(from: BlockNumber, limit: number, proven?: boolean) {
640
- return (await this.blockSource.getCheckpointedBlocks(from, limit, proven)) ?? [];
619
+ public async getCheckpointedBlocks(from: BlockNumber, limit: number) {
620
+ return (await this.blockSource.getCheckpointedBlocks(from, limit)) ?? [];
641
621
  }
642
622
 
643
623
  /**
@@ -668,6 +648,10 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
668
648
  return await this.blockSource.getProvenBlockNumber();
669
649
  }
670
650
 
651
+ public async getCheckpointedBlockNumber(): Promise<BlockNumber> {
652
+ return await this.blockSource.getCheckpointedL2BlockNumber();
653
+ }
654
+
671
655
  /**
672
656
  * Method to fetch the version of the package.
673
657
  * @returns The node package version
@@ -700,12 +684,43 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
700
684
  return this.contractDataSource.getContract(address);
701
685
  }
702
686
 
703
- public getPrivateLogsByTags(tags: SiloedTag[]): Promise<TxScopedL2Log[][]> {
704
- return this.logsSource.getPrivateLogsByTags(tags);
687
+ public async getPrivateLogsByTags(
688
+ tags: SiloedTag[],
689
+ page?: number,
690
+ referenceBlock?: BlockHash,
691
+ ): Promise<TxScopedL2Log[][]> {
692
+ if (referenceBlock) {
693
+ const initialBlockHash = await this.#getInitialHeaderHash();
694
+ if (!referenceBlock.equals(initialBlockHash)) {
695
+ const header = await this.blockSource.getBlockHeaderByHash(referenceBlock);
696
+ if (!header) {
697
+ throw new Error(
698
+ `Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`,
699
+ );
700
+ }
701
+ }
702
+ }
703
+ return this.logsSource.getPrivateLogsByTags(tags, page);
705
704
  }
706
705
 
707
- public getPublicLogsByTagsFromContract(contractAddress: AztecAddress, tags: Tag[]): Promise<TxScopedL2Log[][]> {
708
- return this.logsSource.getPublicLogsByTagsFromContract(contractAddress, tags);
706
+ public async getPublicLogsByTagsFromContract(
707
+ contractAddress: AztecAddress,
708
+ tags: Tag[],
709
+ page?: number,
710
+ referenceBlock?: BlockHash,
711
+ ): Promise<TxScopedL2Log[][]> {
712
+ if (referenceBlock) {
713
+ const initialBlockHash = await this.#getInitialHeaderHash();
714
+ if (!referenceBlock.equals(initialBlockHash)) {
715
+ const header = await this.blockSource.getBlockHeaderByHash(referenceBlock);
716
+ if (!header) {
717
+ throw new Error(
718
+ `Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`,
719
+ );
720
+ }
721
+ }
722
+ }
723
+ return this.logsSource.getPublicLogsByTagsFromContract(contractAddress, tags, page);
709
724
  }
710
725
 
711
726
  /**
@@ -752,21 +767,26 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
752
767
  }
753
768
 
754
769
  public async getTxReceipt(txHash: TxHash): Promise<TxReceipt> {
755
- let txReceipt = new TxReceipt(txHash, TxStatus.DROPPED, 'Tx dropped by P2P node.');
756
-
757
- // We first check if the tx is in pending (instead of first checking if it is mined) because if we first check
758
- // for mined and then for pending there could be a race condition where the tx is mined between the two checks
759
- // and we would incorrectly return a TxReceipt with status DROPPED
760
- if ((await this.p2pClient.getTxStatus(txHash)) === 'pending') {
761
- txReceipt = new TxReceipt(txHash, TxStatus.PENDING, '');
762
- }
770
+ // Check the tx pool status first. If the tx is known to the pool (pending or mined), we'll use that
771
+ // as a fallback if we don't find a settled receipt in the archiver.
772
+ const txPoolStatus = await this.p2pClient.getTxStatus(txHash);
773
+ const isKnownToPool = txPoolStatus === 'pending' || txPoolStatus === 'mined';
763
774
 
775
+ // Then get the actual tx from the archiver, which tracks every tx in a mined block.
764
776
  const settledTxReceipt = await this.blockSource.getSettledTxReceipt(txHash);
777
+
765
778
  if (settledTxReceipt) {
766
- txReceipt = settledTxReceipt;
779
+ // If the archiver has the receipt then return it.
780
+ return settledTxReceipt;
781
+ } else if (isKnownToPool) {
782
+ // If the tx is in the pool but not in the archiver, it's pending.
783
+ // This handles race conditions between archiver and p2p, where the archiver
784
+ // has pruned the block in which a tx was mined, but p2p has not caught up yet.
785
+ return new TxReceipt(txHash, TxStatus.PENDING, undefined, undefined);
786
+ } else {
787
+ // Otherwise, if we don't know the tx, we consider it dropped.
788
+ return new TxReceipt(txHash, TxStatus.DROPPED, undefined, 'Tx dropped by P2P node');
767
789
  }
768
-
769
- return txReceipt;
770
790
  }
771
791
 
772
792
  public getTxEffect(txHash: TxHash): Promise<IndexedTxEffect | undefined> {
@@ -832,11 +852,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
832
852
  }
833
853
 
834
854
  public async findLeavesIndexes(
835
- block: BlockParameter,
855
+ referenceBlock: BlockParameter,
836
856
  treeId: MerkleTreeId,
837
857
  leafValues: Fr[],
838
858
  ): Promise<(DataInBlock<bigint> | undefined)[]> {
839
- const committedDb = await this.#getWorldState(block);
859
+ const committedDb = await this.#getWorldState(referenceBlock);
840
860
  const maybeIndices = await committedDb.findLeafIndices(
841
861
  treeId,
842
862
  leafValues.map(x => x.toBuffer()),
@@ -888,44 +908,28 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
888
908
  }
889
909
  return {
890
910
  l2BlockNumber: BlockNumber(Number(blockNumber)),
891
- l2BlockHash: L2BlockHash.fromField(blockHash),
911
+ l2BlockHash: new BlockHash(blockHash),
892
912
  data: index,
893
913
  };
894
914
  });
895
915
  }
896
916
 
897
- public async getNullifierSiblingPath(
898
- block: BlockParameter,
899
- leafIndex: bigint,
900
- ): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>> {
901
- const committedDb = await this.#getWorldState(block);
902
- return committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, leafIndex);
903
- }
904
-
905
- public async getNoteHashSiblingPath(
906
- block: BlockParameter,
907
- leafIndex: bigint,
908
- ): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>> {
909
- const committedDb = await this.#getWorldState(block);
910
- return committedDb.getSiblingPath(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
911
- }
912
-
913
- public async getArchiveMembershipWitness(
914
- block: BlockParameter,
915
- archive: Fr,
917
+ public async getBlockHashMembershipWitness(
918
+ referenceBlock: BlockParameter,
919
+ blockHash: BlockHash,
916
920
  ): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined> {
917
- const committedDb = await this.#getWorldState(block);
918
- const [pathAndIndex] = await committedDb.findSiblingPaths<MerkleTreeId.ARCHIVE>(MerkleTreeId.ARCHIVE, [archive]);
921
+ const committedDb = await this.#getWorldState(referenceBlock);
922
+ const [pathAndIndex] = await committedDb.findSiblingPaths<MerkleTreeId.ARCHIVE>(MerkleTreeId.ARCHIVE, [blockHash]);
919
923
  return pathAndIndex === undefined
920
924
  ? undefined
921
925
  : MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
922
926
  }
923
927
 
924
928
  public async getNoteHashMembershipWitness(
925
- block: BlockParameter,
929
+ referenceBlock: BlockParameter,
926
930
  noteHash: Fr,
927
931
  ): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined> {
928
- const committedDb = await this.#getWorldState(block);
932
+ const committedDb = await this.#getWorldState(referenceBlock);
929
933
  const [pathAndIndex] = await committedDb.findSiblingPaths<MerkleTreeId.NOTE_HASH_TREE>(
930
934
  MerkleTreeId.NOTE_HASH_TREE,
931
935
  [noteHash],
@@ -936,10 +940,10 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
936
940
  }
937
941
 
938
942
  public async getL1ToL2MessageMembershipWitness(
939
- block: BlockParameter,
943
+ referenceBlock: BlockParameter,
940
944
  l1ToL2Message: Fr,
941
945
  ): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined> {
942
- const db = await this.#getWorldState(block);
946
+ const db = await this.#getWorldState(referenceBlock);
943
947
  const [witness] = await db.findSiblingPaths(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, [l1ToL2Message]);
944
948
  if (!witness) {
945
949
  return undefined;
@@ -972,12 +976,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
972
976
  * @returns The L2 to L1 messages (empty array if the epoch is not found).
973
977
  */
974
978
  public async getL2ToL1Messages(epoch: EpochNumber): Promise<Fr[][][][]> {
975
- // Assumes `getBlocksForEpoch` returns blocks in ascending order of block number.
976
- const blocks = await this.blockSource.getBlocksForEpoch(epoch);
977
- const blocksInCheckpoints: L2BlockNew[][] = [];
979
+ // Assumes `getCheckpointedBlocksForEpoch` returns blocks in ascending order of block number.
980
+ const checkpointedBlocks = await this.blockSource.getCheckpointedBlocksForEpoch(epoch);
981
+ const blocksInCheckpoints: L2Block[][] = [];
978
982
  let previousSlotNumber = SlotNumber.ZERO;
979
983
  let checkpointIndex = -1;
980
- for (const block of blocks) {
984
+ for (const checkpointedBlock of checkpointedBlocks) {
985
+ const block = checkpointedBlock.block;
981
986
  const slotNumber = block.header.globalVariables.slotNumber;
982
987
  if (slotNumber !== previousSlotNumber) {
983
988
  checkpointIndex++;
@@ -991,27 +996,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
991
996
  );
992
997
  }
993
998
 
994
- public async getArchiveSiblingPath(
995
- block: BlockParameter,
996
- leafIndex: bigint,
997
- ): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>> {
998
- const committedDb = await this.#getWorldState(block);
999
- return committedDb.getSiblingPath(MerkleTreeId.ARCHIVE, leafIndex);
1000
- }
1001
-
1002
- public async getPublicDataSiblingPath(
1003
- block: BlockParameter,
1004
- leafIndex: bigint,
1005
- ): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>> {
1006
- const committedDb = await this.#getWorldState(block);
1007
- return committedDb.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, leafIndex);
1008
- }
1009
-
1010
999
  public async getNullifierMembershipWitness(
1011
- block: BlockParameter,
1000
+ referenceBlock: BlockParameter,
1012
1001
  nullifier: Fr,
1013
1002
  ): Promise<NullifierMembershipWitness | undefined> {
1014
- const db = await this.#getWorldState(block);
1003
+ const db = await this.#getWorldState(referenceBlock);
1015
1004
  const [witness] = await db.findSiblingPaths(MerkleTreeId.NULLIFIER_TREE, [nullifier.toBuffer()]);
1016
1005
  if (!witness) {
1017
1006
  return undefined;
@@ -1028,7 +1017,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1028
1017
 
1029
1018
  /**
1030
1019
  * Returns a low nullifier membership witness for a given nullifier at a given block.
1031
- * @param block - The block parameter (block number, block hash, or 'latest') at which to get the data.
1020
+ * @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data
1021
+ * (which contains the root of the nullifier tree in which we are searching for the nullifier).
1032
1022
  * @param nullifier - Nullifier we try to find the low nullifier witness for.
1033
1023
  * @returns The low nullifier membership witness (if found).
1034
1024
  * @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
@@ -1041,10 +1031,10 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1041
1031
  * TODO: This is a confusing behavior and we should eventually address that.
1042
1032
  */
1043
1033
  public async getLowNullifierMembershipWitness(
1044
- block: BlockParameter,
1034
+ referenceBlock: BlockParameter,
1045
1035
  nullifier: Fr,
1046
1036
  ): Promise<NullifierMembershipWitness | undefined> {
1047
- const committedDb = await this.#getWorldState(block);
1037
+ const committedDb = await this.#getWorldState(referenceBlock);
1048
1038
  const findResult = await committedDb.getPreviousValueIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBigInt());
1049
1039
  if (!findResult) {
1050
1040
  return undefined;
@@ -1059,8 +1049,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1059
1049
  return new NullifierMembershipWitness(BigInt(index), preimageData as NullifierLeafPreimage, siblingPath);
1060
1050
  }
1061
1051
 
1062
- async getPublicDataWitness(block: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
1063
- const committedDb = await this.#getWorldState(block);
1052
+ async getPublicDataWitness(referenceBlock: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
1053
+ const committedDb = await this.#getWorldState(referenceBlock);
1064
1054
  const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
1065
1055
  if (!lowLeafResult) {
1066
1056
  return undefined;
@@ -1074,8 +1064,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1074
1064
  }
1075
1065
  }
1076
1066
 
1077
- public async getPublicStorageAt(block: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr> {
1078
- const committedDb = await this.#getWorldState(block);
1067
+ public async getPublicStorageAt(referenceBlock: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr> {
1068
+ const committedDb = await this.#getWorldState(referenceBlock);
1079
1069
  const leafSlot = await computePublicDataTreeLeafSlot(contract, slot);
1080
1070
 
1081
1071
  const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
@@ -1090,14 +1080,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1090
1080
  }
1091
1081
 
1092
1082
  public async getBlockHeader(block: BlockParameter = 'latest'): Promise<BlockHeader | undefined> {
1093
- if (L2BlockHash.isL2BlockHash(block)) {
1083
+ if (BlockHash.isBlockHash(block)) {
1094
1084
  const initialBlockHash = await this.#getInitialHeaderHash();
1095
1085
  if (block.equals(initialBlockHash)) {
1096
1086
  // Block source doesn't handle initial header so we need to handle the case separately.
1097
1087
  return this.worldStateSynchronizer.getCommitted().getInitialHeader();
1098
1088
  }
1099
- const blockHashFr = Fr.fromBuffer(block.toBuffer());
1100
- return this.blockSource.getBlockHeaderByHash(blockHashFr);
1089
+ return this.blockSource.getBlockHeaderByHash(block);
1101
1090
  } else {
1102
1091
  // Block source doesn't handle initial header so we need to handle the case separately.
1103
1092
  const blockNumber = block === 'latest' ? await this.getBlockNumber() : (block as BlockNumber);
@@ -1155,6 +1144,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1155
1144
  this.contractDataSource,
1156
1145
  new DateProvider(),
1157
1146
  this.telemetry,
1147
+ this.log.getBindings(),
1158
1148
  );
1159
1149
 
1160
1150
  this.log.verbose(`Simulating public calls for tx ${txHash}`, {
@@ -1208,16 +1198,22 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1208
1198
  // We accept transactions if they are not expired by the next slot (checked based on the IncludeByTimestamp field)
1209
1199
  const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
1210
1200
  const blockNumber = BlockNumber((await this.blockSource.getBlockNumber()) + 1);
1211
- const validator = createValidatorForAcceptingTxs(db, this.contractDataSource, verifier, {
1212
- timestamp: nextSlotTimestamp,
1213
- blockNumber,
1214
- l1ChainId: this.l1ChainId,
1215
- rollupVersion: this.version,
1216
- setupAllowList: this.config.txPublicSetupAllowList ?? (await getDefaultAllowedSetupFunctions()),
1217
- gasFees: await this.getCurrentMinFees(),
1218
- skipFeeEnforcement,
1219
- txsPermitted: !this.config.disableTransactions,
1220
- });
1201
+ const validator = createValidatorForAcceptingTxs(
1202
+ db,
1203
+ this.contractDataSource,
1204
+ verifier,
1205
+ {
1206
+ timestamp: nextSlotTimestamp,
1207
+ blockNumber,
1208
+ l1ChainId: this.l1ChainId,
1209
+ rollupVersion: this.version,
1210
+ setupAllowList: this.config.txPublicSetupAllowList ?? (await getDefaultAllowedSetupFunctions()),
1211
+ gasFees: await this.getCurrentMinFees(),
1212
+ skipFeeEnforcement,
1213
+ txsPermitted: !this.config.disableTransactions,
1214
+ },
1215
+ this.log.getBindings(),
1216
+ );
1221
1217
 
1222
1218
  return await validator.validateTx(tx);
1223
1219
  }
@@ -1381,13 +1377,9 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1381
1377
  }
1382
1378
  }
1383
1379
 
1384
- #getInitialHeaderHash(): Promise<L2BlockHash> {
1380
+ #getInitialHeaderHash(): Promise<BlockHash> {
1385
1381
  if (!this.initialHeaderHashPromise) {
1386
- this.initialHeaderHashPromise = this.worldStateSynchronizer
1387
- .getCommitted()
1388
- .getInitialHeader()
1389
- .hash()
1390
- .then(hash => L2BlockHash.fromField(hash));
1382
+ this.initialHeaderHashPromise = this.worldStateSynchronizer.getCommitted().getInitialHeader().hash();
1391
1383
  }
1392
1384
  return this.initialHeaderHashPromise;
1393
1385
  }
@@ -1411,15 +1403,14 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
1411
1403
  return this.worldStateSynchronizer.getCommitted();
1412
1404
  }
1413
1405
 
1414
- if (L2BlockHash.isL2BlockHash(block)) {
1406
+ if (BlockHash.isBlockHash(block)) {
1415
1407
  const initialBlockHash = await this.#getInitialHeaderHash();
1416
1408
  if (block.equals(initialBlockHash)) {
1417
1409
  // Block source doesn't handle initial header so we need to handle the case separately.
1418
1410
  return this.worldStateSynchronizer.getSnapshot(BlockNumber.ZERO);
1419
1411
  }
1420
1412
 
1421
- const blockHashFr = Fr.fromBuffer(block.toBuffer());
1422
- const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
1413
+ const header = await this.blockSource.getBlockHeaderByHash(block);
1423
1414
  if (!header) {
1424
1415
  throw new Error(
1425
1416
  `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.`,
@@ -20,12 +20,7 @@ export async function createSentinel(
20
20
  if (!config.sentinelEnabled) {
21
21
  return undefined;
22
22
  }
23
- const kvStore = await createStore(
24
- 'sentinel',
25
- SentinelStore.SCHEMA_VERSION,
26
- config,
27
- createLogger('node:sentinel:lmdb'),
28
- );
23
+ const kvStore = await createStore('sentinel', SentinelStore.SCHEMA_VERSION, config, logger.getBindings());
29
24
  const storeHistoryLength = config.sentinelHistoryLengthInEpochs * epochCache.getL1Constants().epochDuration;
30
25
  const storeHistoricProvenPerformanceLength = config.sentinelHistoricProvenPerformanceLengthInEpochs;
31
26
  const sentinelStore = new SentinelStore(kvStore, {
@@ -128,7 +128,7 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
128
128
  return;
129
129
  }
130
130
  const blockNumber = event.block.number;
131
- const block = await this.archiver.getL2BlockNew(blockNumber);
131
+ const block = await this.archiver.getL2Block(blockNumber);
132
132
  if (!block) {
133
133
  this.logger.error(`Failed to get block ${blockNumber}`, { block });
134
134
  return;