Skip to content

Commit 54bf161

Browse files
committed
feat: aligning class name with file name
1 parent 6be0df0 commit 54bf161

File tree

49 files changed

+201
-206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+201
-206
lines changed

yarn-project/archiver/src/store/block_store.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import { isDefined } from '@aztec/foundation/types';
99
import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncSingleton, Range } from '@aztec/kv-store';
1010
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
1111
import {
12+
BlockHash,
1213
Body,
1314
CheckpointedL2Block,
1415
CommitteeAttestation,
1516
L2Block,
16-
L2BlockHash,
1717
type ValidateCheckpointResult,
1818
deserializeValidateCheckpointResult,
1919
serializeValidateCheckpointResult,
@@ -351,7 +351,7 @@ export class BlockStore {
351351
}
352352

353353
private async addBlockToDatabase(block: L2Block, checkpointNumber: number, indexWithinCheckpoint: number) {
354-
const blockHash = L2BlockHash.fromField(await block.hash());
354+
const blockHash = BlockHash.fromField(await block.hash());
355355

356356
await this.#blocks.set(block.number, {
357357
header: block.header.toBuffer(),
@@ -673,7 +673,7 @@ export class BlockStore {
673673
* @param blockHash - The hash of the block to return.
674674
* @returns The requested L2 block.
675675
*/
676-
async getBlockByHash(blockHash: L2BlockHash): Promise<L2Block | undefined> {
676+
async getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined> {
677677
const blockNumber = await this.#blockHashIndex.getAsync(blockHash.toString());
678678
if (blockNumber === undefined) {
679679
return undefined;
@@ -699,7 +699,7 @@ export class BlockStore {
699699
* @param blockHash - The hash of the block to return.
700700
* @returns The requested block header.
701701
*/
702-
async getBlockHeaderByHash(blockHash: L2BlockHash): Promise<BlockHeader | undefined> {
702+
async getBlockHeaderByHash(blockHash: BlockHash): Promise<BlockHeader | undefined> {
703703
const blockNumber = await this.#blockHashIndex.getAsync(blockHash.toString());
704704
if (blockNumber === undefined) {
705705
return undefined;

yarn-project/archiver/src/store/kv_archiver_store.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import { sleep } from '@aztec/foundation/sleep';
1515
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
1616
import { AztecAddress } from '@aztec/stdlib/aztec-address';
1717
import {
18+
BlockHash,
1819
CheckpointedL2Block,
1920
CommitteeAttestation,
2021
EthAddress,
2122
L2Block,
22-
L2BlockHash,
2323
type ValidateCheckpointResult,
2424
} from '@aztec/stdlib/block';
2525
import { Checkpoint, PublishedCheckpoint, randomCheckpointInfo } from '@aztec/stdlib/checkpoint';
@@ -2819,7 +2819,7 @@ describe('KVArchiverDataStore', () => {
28192819
it('"txHash" filter param is ignored when "afterLog" is set', async () => {
28202820
// Get random txHash
28212821
const txHash = TxHash.random();
2822-
const afterLog = new LogId(BlockNumber(1), L2BlockHash.random(), 0, 0);
2822+
const afterLog = new LogId(BlockNumber(1), BlockHash.random(), 0, 0);
28232823

28242824
const response = await store.getPublicLogs({ txHash, afterLog });
28252825
expect(response.logs.length).toBeGreaterThan(1);
@@ -2851,7 +2851,7 @@ describe('KVArchiverDataStore', () => {
28512851
await store.getPublicLogs({
28522852
fromBlock: BlockNumber(2),
28532853
toBlock: BlockNumber(5),
2854-
afterLog: new LogId(BlockNumber(4), L2BlockHash.random(), 0, 0),
2854+
afterLog: new LogId(BlockNumber(4), BlockHash.random(), 0, 0),
28552855
})
28562856
).logs;
28572857
blockNumbers = new Set(logs.map(log => log.id.blockNumber));
@@ -2860,7 +2860,7 @@ describe('KVArchiverDataStore', () => {
28602860
logs = (
28612861
await store.getPublicLogs({
28622862
toBlock: BlockNumber(5),
2863-
afterLog: new LogId(BlockNumber(5), L2BlockHash.random(), 1, 0),
2863+
afterLog: new LogId(BlockNumber(5), BlockHash.random(), 1, 0),
28642864
})
28652865
).logs;
28662866
expect(logs.length).toBe(0);
@@ -2869,7 +2869,7 @@ describe('KVArchiverDataStore', () => {
28692869
await store.getPublicLogs({
28702870
fromBlock: BlockNumber(2),
28712871
toBlock: BlockNumber(5),
2872-
afterLog: new LogId(BlockNumber(100), L2BlockHash.random(), 0, 0),
2872+
afterLog: new LogId(BlockNumber(100), BlockHash.random(), 0, 0),
28732873
})
28742874
).logs;
28752875
expect(logs.length).toBe(0);

yarn-project/archiver/src/store/kv_archiver_store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createLogger } from '@aztec/foundation/log';
66
import type { AztecAsyncKVStore, CustomRange, StoreSize } from '@aztec/kv-store';
77
import { FunctionSelector } from '@aztec/stdlib/abi';
88
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
9-
import { CheckpointedL2Block, L2Block, L2BlockHash, type ValidateCheckpointResult } from '@aztec/stdlib/block';
9+
import { BlockHash, CheckpointedL2Block, L2Block, type ValidateCheckpointResult } from '@aztec/stdlib/block';
1010
import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
1111
import type {
1212
ContractClassPublic,
@@ -313,7 +313,7 @@ export class KVArchiverDataStore implements ContractDataSource {
313313
* @param blockHash - The block hash to return.
314314
*/
315315
getBlockByHash(blockHash: Fr): Promise<L2Block | undefined> {
316-
return this.#blockStore.getBlockByHash(L2BlockHash.fromField(blockHash));
316+
return this.#blockStore.getBlockByHash(BlockHash.fromField(blockHash));
317317
}
318318
/**
319319
* Returns the block for the given archive root, or undefined if not exists.
@@ -358,7 +358,7 @@ export class KVArchiverDataStore implements ContractDataSource {
358358
* @param blockHash - The block hash to return.
359359
*/
360360
getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined> {
361-
return this.#blockStore.getBlockHeaderByHash(L2BlockHash.fromField(blockHash));
361+
return this.#blockStore.getBlockHeaderByHash(BlockHash.fromField(blockHash));
362362
}
363363

364364
/**

yarn-project/archiver/src/store/log_store.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { createLogger } from '@aztec/foundation/log';
66
import { BufferReader, numToUInt32BE } from '@aztec/foundation/serialize';
77
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
88
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
9-
import { L2Block, L2BlockHash } from '@aztec/stdlib/block';
9+
import { BlockHash, L2Block } from '@aztec/stdlib/block';
1010
import { MAX_LOGS_PER_TAG } from '@aztec/stdlib/interfaces/api-limit';
1111
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
1212
import {
@@ -275,14 +275,14 @@ export class LogStore {
275275
return Buffer.concat([blockHash.toBuffer(), ...data]);
276276
}
277277

278-
#unpackBlockHash(reader: BufferReader): L2BlockHash {
278+
#unpackBlockHash(reader: BufferReader): BlockHash {
279279
const blockHash = reader.remainingBytes() > 0 ? reader.readObject(Fr) : undefined;
280280

281281
if (!blockHash) {
282282
throw new Error('Failed to read block hash from log entry buffer');
283283
}
284284

285-
return L2BlockHash.fromField(blockHash);
285+
return BlockHash.fromField(blockHash);
286286
}
287287

288288
deleteLogs(blocks: L2Block[]): Promise<boolean> {
@@ -543,7 +543,7 @@ export class LogStore {
543543
#accumulateLogs(
544544
results: (ExtendedContractClassLog | ExtendedPublicLog)[],
545545
blockNumber: number,
546-
blockHash: L2BlockHash,
546+
blockHash: BlockHash,
547547
txIndex: number,
548548
txLogs: (ContractClassLog | PublicLog)[],
549549
filter: LogFilter = {},

yarn-project/archiver/src/test/mock_l2_block_source.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import { createLogger } from '@aztec/foundation/log';
88
import type { FunctionSelector } from '@aztec/stdlib/abi';
99
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
1010
import {
11+
BlockHash,
1112
CheckpointedL2Block,
1213
L2Block,
13-
L2BlockHash,
1414
type L2BlockSource,
1515
type L2Tips,
1616
type ValidateCheckpointResult,
@@ -322,7 +322,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
322322
return {
323323
data: txEffect,
324324
l2BlockNumber: block.number,
325-
l2BlockHash: L2BlockHash.fromField(await block.hash()),
325+
l2BlockHash: BlockHash.fromField(await block.hash()),
326326
txIndexInBlock: block.body.txEffects.indexOf(txEffect),
327327
};
328328
}
@@ -343,7 +343,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
343343
TxExecutionResult.SUCCESS,
344344
undefined,
345345
txEffect.transactionFee.toBigInt(),
346-
L2BlockHash.fromField(await block.hash()),
346+
BlockHash.fromField(await block.hash()),
347347
block.number,
348348
);
349349
}

yarn-project/aztec-node/src/aztec-node/server.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
} from '@aztec/slasher';
4242
import { CollectionLimitsConfig, PublicSimulatorConfig } from '@aztec/stdlib/avm';
4343
import { AztecAddress } from '@aztec/stdlib/aztec-address';
44-
import { type BlockParameter, type DataInBlock, L2Block, L2BlockHash, type L2BlockSource } from '@aztec/stdlib/block';
44+
import { BlockHash, type BlockParameter, type DataInBlock, L2Block, type L2BlockSource } from '@aztec/stdlib/block';
4545
import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
4646
import type {
4747
ContractClassPublic,
@@ -119,7 +119,7 @@ import { NodeMetrics } from './node_metrics.js';
119119
*/
120120
export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
121121
private metrics: NodeMetrics;
122-
private initialHeaderHashPromise: Promise<L2BlockHash> | undefined = undefined;
122+
private initialHeaderHashPromise: Promise<BlockHash> | undefined = undefined;
123123

124124
// Prevent two snapshot operations to happen simultaneously
125125
private isUploadingSnapshot = false;
@@ -570,7 +570,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
570570
* @returns The requested block.
571571
*/
572572
public async getBlock(block: BlockParameter): Promise<L2Block | undefined> {
573-
if (L2BlockHash.isL2BlockHash(block)) {
573+
if (BlockHash.isL2BlockHash(block)) {
574574
return this.getBlockByHash(Fr.fromBuffer(block.toBuffer()));
575575
}
576576
const blockNumber = block === 'latest' ? await this.getBlockNumber() : (block as BlockNumber);
@@ -692,7 +692,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
692692
public async getPrivateLogsByTags(
693693
tags: SiloedTag[],
694694
page?: number,
695-
referenceBlock?: L2BlockHash,
695+
referenceBlock?: BlockHash,
696696
): Promise<TxScopedL2Log[][]> {
697697
if (referenceBlock) {
698698
const initialBlockHash = await this.#getInitialHeaderHash();
@@ -713,7 +713,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
713713
contractAddress: AztecAddress,
714714
tags: Tag[],
715715
page?: number,
716-
referenceBlock?: L2BlockHash,
716+
referenceBlock?: BlockHash,
717717
): Promise<TxScopedL2Log[][]> {
718718
if (referenceBlock) {
719719
const initialBlockHash = await this.#getInitialHeaderHash();
@@ -915,7 +915,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
915915
}
916916
return {
917917
l2BlockNumber: BlockNumber(Number(blockNumber)),
918-
l2BlockHash: L2BlockHash.fromField(blockHash),
918+
l2BlockHash: BlockHash.fromField(blockHash),
919919
data: index,
920920
};
921921
});
@@ -1118,7 +1118,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
11181118
}
11191119

11201120
public async getBlockHeader(block: BlockParameter = 'latest'): Promise<BlockHeader | undefined> {
1121-
if (L2BlockHash.isL2BlockHash(block)) {
1121+
if (BlockHash.isL2BlockHash(block)) {
11221122
const initialBlockHash = await this.#getInitialHeaderHash();
11231123
if (block.equals(initialBlockHash)) {
11241124
// Block source doesn't handle initial header so we need to handle the case separately.
@@ -1409,7 +1409,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
14091409
}
14101410
}
14111411

1412-
#getInitialHeaderHash(): Promise<L2BlockHash> {
1412+
#getInitialHeaderHash(): Promise<BlockHash> {
14131413
if (!this.initialHeaderHashPromise) {
14141414
this.initialHeaderHashPromise = this.worldStateSynchronizer.getCommitted().getInitialHeader().hash();
14151415
}
@@ -1435,7 +1435,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
14351435
return this.worldStateSynchronizer.getCommitted();
14361436
}
14371437

1438-
if (L2BlockHash.isL2BlockHash(block)) {
1438+
if (BlockHash.isL2BlockHash(block)) {
14391439
const initialBlockHash = await this.#getInitialHeaderHash();
14401440
if (block.equals(initialBlockHash)) {
14411441
// Block source doesn't handle initial header so we need to handle the case separately.

yarn-project/aztec.js/src/wallet/wallet.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { ContractArtifact, EventMetadataDefinition } from '@aztec/stdlib/ab
66
import { EventSelector, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
77
import { AuthWitness } from '@aztec/stdlib/auth-witness';
88
import { AztecAddress } from '@aztec/stdlib/aztec-address';
9-
import { L2BlockHash } from '@aztec/stdlib/block';
9+
import { BlockHash } from '@aztec/stdlib/block';
1010
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
1111
import { PublicKeys } from '@aztec/stdlib/keys';
1212
import {
@@ -346,7 +346,7 @@ class MockWallet implements Wallet {
346346
},
347347
metadata: {
348348
l2BlockNumber: BlockNumber(1),
349-
l2BlockHash: L2BlockHash.random(),
349+
l2BlockHash: BlockHash.random(),
350350
txHash: TxHash.random(),
351351
},
352352
},

yarn-project/pxe/src/block_synchronizer/block_synchronizer.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
44
import type { AztecAsyncKVStore } from '@aztec/kv-store';
55
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
66
import { L2TipsKVStore } from '@aztec/kv-store/stores';
7-
import { GENESIS_CHECKPOINT_HEADER_HASH, L2Block, L2BlockHash, type L2BlockStream } from '@aztec/stdlib/block';
7+
import { BlockHash, GENESIS_CHECKPOINT_HEADER_HASH, L2Block, type L2BlockStream } from '@aztec/stdlib/block';
88
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
99
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
1010

@@ -61,7 +61,7 @@ describe('BlockSynchronizer', () => {
6161
const block3Hash = Fr.fromString('0x3');
6262
aztecNode.getBlockHeader.mockImplementation(async block => {
6363
// For the test, when block hash matches block 3, return block header for block 3
64-
if (block instanceof L2BlockHash && Fr.fromBuffer(block.toBuffer()).equals(block3Hash)) {
64+
if (block instanceof BlockHash && Fr.fromBuffer(block.toBuffer()).equals(block3Hash)) {
6565
return (await L2Block.random(BlockNumber(3))).header;
6666
}
6767
return undefined;
@@ -85,7 +85,7 @@ describe('BlockSynchronizer', () => {
8585
const block3Hash = Fr.fromString('0x3');
8686
aztecNode.getBlockHeader.mockImplementation(async block => {
8787
// For the test, when block hash matches block 3, return block header for block 3
88-
if (block instanceof L2BlockHash && Fr.fromBuffer(block.toBuffer()).equals(block3Hash)) {
88+
if (block instanceof BlockHash && Fr.fromBuffer(block.toBuffer()).equals(block3Hash)) {
8989
return (await L2Block.random(BlockNumber(3))).header;
9090
}
9191
return undefined;

yarn-project/pxe/src/block_synchronizer/block_synchronizer.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
22
import { type Logger, createLogger } from '@aztec/foundation/log';
33
import type { AztecAsyncKVStore } from '@aztec/kv-store';
44
import type { L2TipsKVStore } from '@aztec/kv-store/stores';
5-
import {
6-
L2BlockHash,
7-
L2BlockStream,
8-
type L2BlockStreamEvent,
9-
type L2BlockStreamEventHandler,
10-
} from '@aztec/stdlib/block';
5+
import { BlockHash, L2BlockStream, type L2BlockStreamEvent, type L2BlockStreamEventHandler } from '@aztec/stdlib/block';
116
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
127
import type { BlockHeader } from '@aztec/stdlib/tx';
138

@@ -106,7 +101,7 @@ export class BlockSynchronizer implements L2BlockStreamEventHandler {
106101
// Note that the following is not necessarily the anchor block that will be used in the transaction - if
107102
// the chain has already moved past the reorg, we'll also see blocks-added events that will push the anchor
108103
// forward.
109-
const newAnchorBlockHeader = await this.node.getBlockHeader(L2BlockHash.fromString(event.block.hash));
104+
const newAnchorBlockHeader = await this.node.getBlockHeader(BlockHash.fromString(event.block.hash));
110105

111106
if (!newAnchorBlockHeader) {
112107
throw new Error(

yarn-project/pxe/src/contract_function_simulator/oracle/interfaces.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Point } from '@aztec/foundation/curves/grumpkin';
55
import { MembershipWitness } from '@aztec/foundation/trees';
66
import type { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
77
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8-
import { L2BlockHash } from '@aztec/stdlib/block';
8+
import { BlockHash } from '@aztec/stdlib/block';
99
import type { CompleteAddress, ContractInstance } from '@aztec/stdlib/contract';
1010
import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
1111
import type { ContractClassLog, Tag } from '@aztec/stdlib/logs';
@@ -68,20 +68,20 @@ export interface IUtilityExecutionOracle {
6868
utilityGetKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest>;
6969
utilityGetContractInstance(address: AztecAddress): Promise<ContractInstance>;
7070
utilityGetNoteHashMembershipWitness(
71-
blockHash: L2BlockHash,
71+
blockHash: BlockHash,
7272
leafValue: Fr,
7373
): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined>;
7474
utilityGetArchiveMembershipWitness(
75-
blockHash: L2BlockHash,
75+
blockHash: BlockHash,
7676
leafValue: Fr,
7777
): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined>;
7878
utilityGetNullifierMembershipWitness(
79-
blockHash: L2BlockHash,
79+
blockHash: BlockHash,
8080
nullifier: Fr,
8181
): Promise<NullifierMembershipWitness | undefined>;
82-
utilityGetPublicDataWitness(blockHash: L2BlockHash, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
82+
utilityGetPublicDataWitness(blockHash: BlockHash, leafSlot: Fr): Promise<PublicDataWitness | undefined>;
8383
utilityGetLowNullifierMembershipWitness(
84-
blockHash: L2BlockHash,
84+
blockHash: BlockHash,
8585
nullifier: Fr,
8686
): Promise<NullifierMembershipWitness | undefined>;
8787
utilityGetBlockHeader(blockNumber: BlockNumber): Promise<BlockHeader | undefined>;
@@ -111,7 +111,7 @@ export interface IUtilityExecutionOracle {
111111
secret: Fr,
112112
): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>>;
113113
utilityStorageRead(
114-
blockHash: L2BlockHash,
114+
blockHash: BlockHash,
115115
contractAddress: AztecAddress,
116116
startStorageSlot: Fr,
117117
numberOfElements: number,

0 commit comments

Comments
 (0)