From d7b3d9b83cb44328becc641fd31da2044027d4e5 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Tue, 9 Apr 2024 17:15:50 +0200 Subject: [PATCH] Compare blobs as buffer not as strings --- .../test/utils/simulation/assertions/blobsAssertion.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/test/utils/simulation/assertions/blobsAssertion.ts b/packages/cli/test/utils/simulation/assertions/blobsAssertion.ts index 915c2ed7210b..dc6bb6656c7c 100644 --- a/packages/cli/test/utils/simulation/assertions/blobsAssertion.ts +++ b/packages/cli/test/utils/simulation/assertions/blobsAssertion.ts @@ -12,7 +12,7 @@ const sentBlobs: string[] = []; export function createBlobsAssertion( nodes: NodePair[], {sendBlobsAtSlot, validateBlobsAt}: {sendBlobsAtSlot: number; validateBlobsAt: number} -): SimulationAssertion { +): SimulationAssertion { return { id: `blobs-${nodes.map((n) => n.id).join("-")}`, match: ({slot}) => { @@ -52,13 +52,13 @@ export function createBlobsAssertion( const blobSideCars = await node.beacon.api.beacon.getBlobSidecars(slot); ApiError.assert(blobSideCars); - return blobSideCars.response.data.map((b) => toHex(b.blob)); + return blobSideCars.response.data.map((b) => b.blob); }, assert: async ({store}) => { const errors: AssertionResult[] = []; - const blobs: string[] = []; + const blobs: Uint8Array[] = []; for (let slot = sendBlobsAtSlot; slot <= validateBlobsAt; slot++) { blobs.push(...(store[slot] ?? [])); @@ -75,7 +75,7 @@ export function createBlobsAssertion( } for (let i = 0; i < blobs.length; i++) { - if (blobs[i] !== sentBlobs[i]) { + if (!Buffer.from(blobs[i]).equals(Buffer.from(sentBlobs[i]))) { errors.push([ "Node does not have the right blobs", {