Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions yarn-project/archiver/src/archiver/archiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ import {
} from '@aztec/stdlib/epoch-helpers';
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
import type { L2LogsSource } from '@aztec/stdlib/interfaces/server';
import { ContractClassLog, type LogFilter, type PrivateLog, type PublicLog, TxScopedL2Log } from '@aztec/stdlib/logs';
import {
ContractClassLog,
type LogFilter,
type PrivateLog,
type PublicLog,
type SiloedTag,
Tag,
TxScopedL2Log,
} from '@aztec/stdlib/logs';
import { type L1ToL2MessageSource, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
import type { CheckpointHeader } from '@aztec/stdlib/rollup';
import { type BlockHeader, type IndexedTxEffect, TxHash, TxReceipt } from '@aztec/stdlib/tx';
Expand Down Expand Up @@ -1407,14 +1415,16 @@ export class Archiver
return this.store.getSettledTxReceipt(txHash);
}

/**
* Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
* @param tags - The tags to filter the logs by.
* @returns For each received tag, an array of matching logs is returned. An empty array implies no logs match
* that tag.
*/
getLogsByTags(tags: Fr[]): Promise<TxScopedL2Log[][]> {
return this.store.getLogsByTags(tags);
getPrivateLogsByTags(tags: SiloedTag[], logsPerTag?: number): Promise<TxScopedL2Log[][]> {
return this.store.getPrivateLogsByTags(tags, logsPerTag);
}

getPublicLogsByTagsFromContract(
contractAddress: AztecAddress,
tags: Tag[],
logsPerTag?: number,
): Promise<TxScopedL2Log[][]> {
return this.store.getPublicLogsByTagsFromContract(contractAddress, tags, logsPerTag);
}

/**
Expand Down Expand Up @@ -2072,8 +2082,15 @@ export class ArchiverStoreHelper
getL1ToL2MessageIndex(l1ToL2Message: Fr): Promise<bigint | undefined> {
return this.store.getL1ToL2MessageIndex(l1ToL2Message);
}
getLogsByTags(tags: Fr[], logsPerTag?: number): Promise<TxScopedL2Log[][]> {
return this.store.getLogsByTags(tags, logsPerTag);
getPrivateLogsByTags(tags: SiloedTag[], logsPerTag?: number): Promise<TxScopedL2Log[][]> {
return this.store.getPrivateLogsByTags(tags, logsPerTag);
}
getPublicLogsByTagsFromContract(
contractAddress: AztecAddress,
tags: Tag[],
logsPerTag?: number,
): Promise<TxScopedL2Log[][]> {
return this.store.getPublicLogsByTagsFromContract(contractAddress, tags, logsPerTag);
}
getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse> {
return this.store.getPublicLogs(filter);
Expand Down
24 changes: 19 additions & 5 deletions yarn-project/archiver/src/archiver/archiver_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
UtilityFunctionWithMembershipProof,
} from '@aztec/stdlib/contract';
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
import type { LogFilter, TxScopedL2Log } from '@aztec/stdlib/logs';
import type { LogFilter, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
import { BlockHeader, type IndexedTxEffect, type TxHash, type TxReceipt } from '@aztec/stdlib/tx';
import type { UInt64 } from '@aztec/stdlib/types';

Expand Down Expand Up @@ -206,13 +206,27 @@ export interface ArchiverDataStore {
getTotalL1ToL2MessageCount(): Promise<bigint>;

/**
* Gets all logs that match any of the received tags (i.e. logs with their first field equal to a tag).
* @param tags - The tags to filter the logs by.
* Gets all private logs that match any of the received tags (i.e. logs with their first field equal to a SiloedTag).
* @param tags - The SiloedTags to filter the logs by.
* @param logsPerTag - The number of logs to return per tag. Defaults to everything
* @returns For each received tag, an array of matching logs is returned. An empty array implies no logs match
* @returns For each received tag, an array of matching private logs is returned. An empty array implies no logs match
* that tag.
*/
getLogsByTags(tags: Fr[], logsPerTag?: number): Promise<TxScopedL2Log[][]>;
getPrivateLogsByTags(tags: SiloedTag[], logsPerTag?: number): Promise<TxScopedL2Log[][]>;

/**
* Gets all public logs that match any of the received tags from the specified contract (i.e. logs with their first field equal to a Tag).
* @param contractAddress - The contract that emitted the public logs.
* @param tags - The Tags to filter the logs by.
* @param logsPerTag - The number of logs to return per tag. Defaults to everything
* @returns For each received tag, an array of matching public logs is returned. An empty array implies no logs match
* that tag.
*/
getPublicLogsByTagsFromContract(
contractAddress: AztecAddress,
tags: Tag[],
logsPerTag?: number,
): Promise<TxScopedL2Log[][]>;

/**
* Gets public logs based on the provided filter.
Expand Down
Loading
Loading