From bdc3eea2fb8c5700efdfb3a4153808df8f9150c8 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Tue, 26 Mar 2024 16:26:18 -0300 Subject: [PATCH] Fix random encrypted log generation --- yarn-project/circuit-types/src/logs/encrypted_l2_log.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yarn-project/circuit-types/src/logs/encrypted_l2_log.ts b/yarn-project/circuit-types/src/logs/encrypted_l2_log.ts index c067035fb98..4e11c696d2f 100644 --- a/yarn-project/circuit-types/src/logs/encrypted_l2_log.ts +++ b/yarn-project/circuit-types/src/logs/encrypted_l2_log.ts @@ -1,3 +1,4 @@ +import { Fr, Point } from '@aztec/circuits.js'; import { randomBytes } from '@aztec/foundation/crypto'; /** @@ -47,8 +48,9 @@ export class EncryptedL2Log { * @returns A random log. */ public static random(): EncryptedL2Log { - const dataLength = randomBytes(1)[0]; - const data = randomBytes(dataLength); + const randomEphPubKey = Point.random(); + const randomLogContent = randomBytes(144 - Point.SIZE_IN_BYTES); + const data = Buffer.concat([Fr.random().toBuffer(), randomLogContent, randomEphPubKey.toBuffer()]); return new EncryptedL2Log(data); }