Skip to content

Commit b54dd8f

Browse files
author
AztecBot
committed
Merge branch 'next' into merge-train/barretenberg
2 parents 629219e + c060777 commit b54dd8f

82 files changed

Lines changed: 535 additions & 594 deletions

File tree

Some content is hidden

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

yarn-project/archiver/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
5050
},
5151
archiverStoreMapSizeKb: {
5252
env: 'ARCHIVER_STORE_MAP_SIZE_KB',
53-
parseEnv: (val: string | undefined) => (val ? +val : undefined),
53+
parseEnv: (val: string) => +val,
5454
description: 'The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKb.',
5555
},
5656
skipValidateCheckpointAttestations: {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ export class BlockStore {
976976
return {
977977
header: BlockHeader.fromBuffer(blockStorage.header),
978978
archive: AppendOnlyTreeSnapshot.fromBuffer(blockStorage.archive),
979-
blockHash: Fr.fromBuffer(blockStorage.blockHash),
979+
blockHash: BlockHash.fromBuffer(blockStorage.blockHash),
980980
checkpointNumber: CheckpointNumber(blockStorage.checkpointNumber),
981981
indexWithinCheckpoint: IndexWithinCheckpoint(blockStorage.indexWithinCheckpoint),
982982
};

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { GENESIS_BLOCK_HEADER_HASH, INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
1+
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
22
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3-
import { type BlockData, type CheckpointId, GENESIS_CHECKPOINT_HEADER_HASH, type L2Tips } from '@aztec/stdlib/block';
3+
import {
4+
type BlockData,
5+
type CheckpointId,
6+
GENESIS_BLOCK_HEADER_HASH,
7+
GENESIS_CHECKPOINT_HEADER_HASH,
8+
type L2Tips,
9+
} from '@aztec/stdlib/block';
410

511
import type { BlockStore } from './block_store.js';
612

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
22
import { BlockNumber } from '@aztec/foundation/branded-types';
33
import { compactArray, filterAsync } from '@aztec/foundation/collection';
4-
import { Fr } from '@aztec/foundation/curves/bn254';
54
import { createLogger } from '@aztec/foundation/log';
65
import { BufferReader, numToUInt32BE } from '@aztec/foundation/serialize';
76
import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
@@ -302,13 +301,11 @@ export class LogStore {
302301
}
303302

304303
#unpackBlockHash(reader: BufferReader): BlockHash {
305-
const blockHash = reader.remainingBytes() > 0 ? reader.readObject(Fr) : undefined;
306-
307-
if (!blockHash) {
304+
if (reader.remainingBytes() === 0) {
308305
throw new Error('Failed to read block hash from log entry buffer');
309306
}
310307

311-
return new BlockHash(blockHash);
308+
return BlockHash.fromBuffer(reader);
312309
}
313310

314311
deleteLogs(blocks: L2Block[]): Promise<boolean> {

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ describe('aztec node', () => {
638638
});
639639

640640
it('returns snapshot at block 0 for initial header hash', async () => {
641-
const initialHash = await initialHeader.hash();
642-
const initialBlockHash = new BlockHash(initialHash);
641+
const initialBlockHash = await initialHeader.hash();
643642

644643
const result = await node.getWorldState(initialBlockHash);
645644
expect(worldState.getSnapshot).toHaveBeenCalledWith(BlockNumber.ZERO);
@@ -662,8 +661,7 @@ describe('aztec node', () => {
662661
// The initial block (block 0) has an empty archive — no block hashes exist in it.
663662
// getBlockHashMembershipWitness computes referenceBlockNumber - 1, which would be 0 - 1 = -1.
664663
// This should return undefined (empty archive has no witnesses) rather than crashing.
665-
const initialHash = await initialHeader.hash();
666-
const initialBlockHash = new BlockHash(initialHash);
664+
const initialBlockHash = await initialHeader.hash();
667665
const someBlockHash = BlockHash.random();
668666

669667
const result = await node.getBlockHashMembershipWitness(initialBlockHash, someBlockHash);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
10611061
);
10621062

10631063
// Build a map from block number to block hash
1064-
const blockNumberToHash = new Map<BlockNumber, Fr>();
1064+
const blockNumberToHash = new Map<BlockNumber, BlockHash>();
10651065
for (let i = 0; i < uniqueBlockNumbers.length; i++) {
10661066
const blockHash = blockHashes[i];
10671067
if (blockHash === undefined) {
@@ -1079,13 +1079,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
10791079
if (blockNumber === undefined) {
10801080
throw new Error(`Block number not found for leaf index ${index} in tree ${MerkleTreeId[treeId]}`);
10811081
}
1082-
const blockHash = blockNumberToHash.get(blockNumber);
1083-
if (blockHash === undefined) {
1082+
const l2BlockHash = blockNumberToHash.get(blockNumber);
1083+
if (l2BlockHash === undefined) {
10841084
throw new Error(`Block hash not found for block number ${blockNumber}`);
10851085
}
10861086
return {
10871087
l2BlockNumber: blockNumber,
1088-
l2BlockHash: new BlockHash(blockHash),
1088+
l2BlockHash,
10891089
data: index,
10901090
};
10911091
});
@@ -1741,7 +1741,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb
17411741
// Double-check world-state synced to the same block hash as was requested
17421742
if (BlockHash.isBlockHash(block)) {
17431743
const blockHash = await snapshot.getLeafValue(MerkleTreeId.ARCHIVE, BigInt(blockNumber));
1744-
if (!blockHash || !new BlockHash(blockHash).equals(block)) {
1744+
if (!blockHash || !block.equals(blockHash)) {
17451745
throw new Error(
17461746
`Block hash ${block.toString()} not found in world state at block number ${blockNumber}. If the node API has been queried with anchor block hash possibly a reorg has occurred.`,
17471747
);

yarn-project/aztec/src/cli/aztec_start_options.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface AztecStartOption {
3636
parseVal?: (val: string) => any;
3737
}
3838

39-
export const getOptions = (namespace: string, configMappings: Record<string, ConfigMapping>) => {
39+
export const getOptions = (namespace: string, configMappings: Record<string, ConfigMapping<unknown>>) => {
4040
const options: AztecStartOption[] = [];
4141
for (const [key, { env, defaultValue: def, parseEnv, description, printDefault, fallback }] of Object.entries(
4242
configMappings,
@@ -58,7 +58,11 @@ export const getOptions = (namespace: string, configMappings: Record<string, Con
5858
return options;
5959
};
6060

61-
const configToFlag = (flag: string, configMapping: ConfigMapping, overrideDefaultValue?: any): AztecStartOption => {
61+
const configToFlag = (
62+
flag: string,
63+
configMapping: ConfigMapping<unknown>,
64+
overrideDefaultValue?: any,
65+
): AztecStartOption => {
6266
if (!configMapping.isBoolean) {
6367
flag += ' <value>';
6468
}

yarn-project/aztec/src/cli/cmds/start_archiver.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ export async function startArchiver(
2020
const envConfig = getArchiverConfigFromEnv();
2121
const cliOptions = extractRelevantOptions<ArchiverConfig & DataStoreConfig & BlobClientConfig>(
2222
options,
23-
{ ...archiverConfigMappings, ...dataConfigMappings, ...blobClientConfigMapping },
23+
{
24+
// dataConfigMappings must come first: its l1Contracts only maps rollupAddress,
25+
// while archiverConfigMappings (spread later) maps all L1 contract addresses.
26+
...dataConfigMappings,
27+
...archiverConfigMappings,
28+
...blobClientConfigMapping,
29+
},
2430
'archiver',
2531
);
2632

yarn-project/blob-client/src/client/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const blobClientConfigMapping: ConfigMappingsType<BlobClientConfig> = {
9393
blobSinkMapSizeKb: {
9494
env: 'BLOB_SINK_MAP_SIZE_KB',
9595
description: 'The maximum possible size of the blob sink DB in KB. Overwrites the general dataStoreMapSizeKb.',
96-
parseEnv: (val: string | undefined) => (val ? +val : undefined),
96+
parseEnv: (val: string) => +val,
9797
},
9898
blobAllowEmptySources: {
9999
env: 'BLOB_ALLOW_EMPTY_SOURCES',
@@ -116,7 +116,7 @@ export const blobClientConfigMapping: ConfigMappingsType<BlobClientConfig> = {
116116
blobHealthcheckUploadIntervalMinutes: {
117117
env: 'BLOB_HEALTHCHECK_UPLOAD_INTERVAL_MINUTES',
118118
description: 'Interval in minutes for uploading healthcheck file to file store (default: 60 = 1 hour)',
119-
parseEnv: (val: string | undefined) => (val ? +val : undefined),
119+
parseEnv: (val: string) => +val,
120120
},
121121
l1HttpTimeoutMS: {
122122
env: 'ETHEREUM_HTTP_TIMEOUT_MS',

yarn-project/end-to-end/src/bench/node_rpc_perf.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,14 @@ describe('e2e_node_rpc_perf', () => {
563563
});
564564

565565
it('benchmarks getPrivateLogsByTags', async () => {
566-
const tags = [new SiloedTag(Fr.random())];
566+
const tags = [SiloedTag.random()];
567567
const { stats } = await benchmark('getPrivateLogsByTags', () => aztecNode.getPrivateLogsByTags(tags));
568568
addResult('getPrivateLogsByTags', stats);
569569
expect(stats.avg).toBeLessThan(3000);
570570
});
571571

572572
it('benchmarks getPublicLogsByTagsFromContract', async () => {
573-
const tags = [new Tag(Fr.random())];
573+
const tags = [Tag.random()];
574574
const { stats } = await benchmark('getPublicLogsByTagsFromContract', () =>
575575
aztecNode.getPublicLogsByTagsFromContract(contractAddress, tags),
576576
);

0 commit comments

Comments
 (0)