Skip to content

Commit db55b9c

Browse files
PhilWindleaztec-bot
authored andcommitted
fix: Fix blob encoding when uploaded from proposals (#22045)
.
1 parent 0619f00 commit db55b9c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

yarn-project/validator-client/src/proposal_handler.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { BlobClientInterface } from '@aztec/blob-client/client';
2-
import { type Blob, getBlobsPerL1Block } from '@aztec/blob-lib';
2+
import { type Blob, encodeCheckpointBlobDataFromBlocks, getBlobsPerL1Block } from '@aztec/blob-lib';
33
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
44
import type { EpochCache } from '@aztec/epoch-cache';
55
import { validateFeeAssetPriceModifier } from '@aztec/ethereum/contracts';
@@ -886,7 +886,8 @@ export class ProposalHandler {
886886
return;
887887
}
888888

889-
const blobFields = blocks.flatMap(b => b.toBlobFields());
889+
const blockBlobData = blocks.map(b => b.toBlockBlobData());
890+
const blobFields = encodeCheckpointBlobDataFromBlocks(blockBlobData);
890891
const blobs: Blob[] = await getBlobsPerL1Block(blobFields);
891892
await this.blobClient.sendBlobsToFilestore(blobs);
892893
this.log.debug(`Uploaded ${blobs.length} blobs to filestore for checkpoint at slot ${proposal.slotNumber}`, {

yarn-project/validator-client/src/validator.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
} from '@aztec/p2p';
2424
import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
2525
import { AztecAddress } from '@aztec/stdlib/aztec-address';
26-
import type { BlockData, L2Block, L2BlockSink, L2BlockSource } from '@aztec/stdlib/block';
26+
import { type BlockData, L2Block, type L2BlockSink, type L2BlockSource } from '@aztec/stdlib/block';
2727
import type { getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
2828
import type { SlasherConfig, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
2929
import { type L1ToL2MessageSource, computeInHashFromL1ToL2Messages } from '@aztec/stdlib/messaging';
@@ -903,8 +903,7 @@ describe('ValidatorClient', () => {
903903
const proposalInfo = { slotNumber: 1, archive: '0x00', proposer: '0x00', txCount: 0 };
904904

905905
it('should send blobs from blocks in the slot to filestore', async () => {
906-
const blobFields = [Fr.random(), Fr.random()];
907-
const mockBlock = { toBlobFields: () => blobFields } as unknown as L2Block;
906+
const mockBlock = L2Block.empty();
908907
blockSource.getBlockHeaderByArchive.mockResolvedValue(makeBlockHeader());
909908
blockSource.getBlocksForSlot.mockResolvedValue([mockBlock]);
910909

@@ -931,7 +930,7 @@ describe('ValidatorClient', () => {
931930
});
932931

933932
it('should not throw when blob upload fails', async () => {
934-
const mockBlock = { toBlobFields: () => [Fr.random()] } as unknown as L2Block;
933+
const mockBlock = L2Block.empty();
935934
blockSource.getBlockHeaderByArchive.mockResolvedValue(makeBlockHeader());
936935
blockSource.getBlocksForSlot.mockResolvedValue([mockBlock]);
937936
blobClient.sendBlobsToFilestore.mockRejectedValue(new Error('upload failed'));

0 commit comments

Comments
 (0)