Skip to content

Commit e1f00b4

Browse files
committed
Cleanup.
1 parent cd84849 commit e1f00b4

5 files changed

Lines changed: 11 additions & 12 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { sleep } from '@aztec/foundation/sleep';
1515
import { bufferToHex, withoutHexPrefix } from '@aztec/foundation/string';
1616
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
1717
import { type InboxAbi, RollupAbi } from '@aztec/l1-artifacts';
18-
import { CommitteeAttestation, L2Block, L2BlockSourceEvents, getBlockBlobFields } from '@aztec/stdlib/block';
18+
import { CommitteeAttestation, L2Block, L2BlockSourceEvents } from '@aztec/stdlib/block';
1919
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
2020
import { PrivateLog } from '@aztec/stdlib/logs';
2121
import { InboxLeaf } from '@aztec/stdlib/messaging';
@@ -1005,7 +1005,7 @@ async function makeRollupTx(l2Block: L2Block, signers: Secp256k1Signer[] = []) {
10051005
* @returns Versioned blob hashes.
10061006
*/
10071007
async function makeVersionedBlobHashes(l2Block: L2Block): Promise<`0x${string}`[]> {
1008-
const blobFields = getBlockBlobFields(l2Block.body.txEffects);
1008+
const blobFields = l2Block.body.toBlobFields();
10091009
const blobs = await Blob.getBlobsPerBlock(blobFields);
10101010
const blobHashes = blobs.map(b => b.getEthVersionedBlobHash());
10111011
return blobHashes.map(h => `0x${h.toString('hex')}` as `0x${string})`);
@@ -1017,7 +1017,7 @@ async function makeVersionedBlobHashes(l2Block: L2Block): Promise<`0x${string}`[
10171017
* @returns The blobs.
10181018
*/
10191019
async function makeBlobsFromBlock(block: L2Block) {
1020-
const blobFields = getBlockBlobFields(block.body.txEffects);
1020+
const blobFields = block.body.toBlobFields();
10211021
const blobs = await Blob.getBlobsPerBlock(blobFields);
10221022
return blobs.map((blob, index) => new BlobWithIndex(blob, index));
10231023
}

yarn-project/archiver/src/archiver/data_retrieval.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
1414
import { Fr } from '@aztec/foundation/fields';
1515
import { type Logger, createLogger } from '@aztec/foundation/log';
1616
import { type InboxAbi, RollupAbi } from '@aztec/l1-artifacts';
17-
import { Body, CommitteeAttestation, L2Block, L2BlockHeader, getBlockBlobFields } from '@aztec/stdlib/block';
17+
import { Body, CommitteeAttestation, L2Block, L2BlockHeader } from '@aztec/stdlib/block';
1818
import { Proof } from '@aztec/stdlib/proofs';
1919
import { CheckpointHeader } from '@aztec/stdlib/rollup';
2020
import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
@@ -78,7 +78,7 @@ export async function retrievedBlockToPublishedL2Block(retrievedBlock: Retrieved
7878

7979
// This works when there's only one block in the checkpoint.
8080
// If there's more than one block, we need to build the spongeBlob from the endSpongeBlob of the previous block.
81-
const blobFields = getBlockBlobFields(body.txEffects);
81+
const blobFields = body.toBlobFields();
8282
const spongeBlob = SpongeBlob.init(blobFields.length);
8383
await spongeBlob.absorb(blobFields);
8484
const spongeBlobHash = await spongeBlob.squeeze();

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,10 @@ export class BlockStore {
201201
*/
202202
async *getBlockHeaders(start: number, limit: number): AsyncIterableIterator<BlockHeader> {
203203
for await (const [blockNumber, blockStorage] of this.getBlockStorages(start, limit)) {
204-
const block = await this.getBlockFromBlockStorage(blockNumber, blockStorage);
205-
const header = block?.block.getBlockHeader();
206-
if (header?.getBlockNumber() !== blockNumber) {
204+
const header = L2BlockHeader.fromBuffer(blockStorage.header).toBlockHeader();
205+
if (header.getBlockNumber() !== blockNumber) {
207206
throw new Error(
208-
`Block number mismatch when retrieving block header from archive (expected ${blockNumber} but got ${header?.getBlockNumber()})`,
207+
`Block number mismatch when retrieving block header from archive (expected ${blockNumber} but got ${header.getBlockNumber()})`,
209208
);
210209
}
211210
yield header;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
133133

134134
async getBlockHeadersForEpoch(epochNumber: bigint): Promise<BlockHeader[]> {
135135
const blocks = await this.getBlocksForEpoch(epochNumber);
136-
return await Promise.all(blocks.map(b => b.getBlockHeader()));
136+
return blocks.map(b => b.getBlockHeader());
137137
}
138138

139139
/**

yarn-project/prover-client/src/orchestrator/block-building-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,14 @@ export const buildHeaderAndBodyFromTxs = runInSpan(
329329
const outHash = txOutHashes.length === 0 ? Fr.ZERO : new Fr(computeUnbalancedMerkleTreeRoot(txOutHashes));
330330

331331
const parityShaRoot = await computeInHashFromL1ToL2Messages(l1ToL2Messages);
332-
const blobsHash = getBlobsHashFromBlobs(await Blob.getBlobsPerBlock(body.toBlobFields()));
332+
const blobFields = body.toBlobFields();
333+
const blobsHash = getBlobsHashFromBlobs(await Blob.getBlobsPerBlock(blobFields));
333334

334335
const contentCommitment = new ContentCommitment(blobsHash, parityShaRoot, outHash);
335336

336337
const fees = txEffects.reduce((acc, tx) => acc.add(tx.transactionFee), Fr.ZERO);
337338
const manaUsed = txs.reduce((acc, tx) => acc.add(new Fr(tx.gasUsed.billedGas.l2Gas)), Fr.ZERO);
338339

339-
const blobFields = getBlockBlobFields(txs.map(tx => tx.txEffect));
340340
const endSpongeBlob = startSpongeBlob?.clone() ?? SpongeBlob.init(blobFields.length);
341341
await endSpongeBlob.absorb(blobFields);
342342
const spongeBlobHash = await endSpongeBlob.squeeze();

0 commit comments

Comments
 (0)