Skip to content

Commit

Permalink
Fix random encrypted log generation
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Mar 26, 2024
1 parent c3dfd8c commit bdc3eea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions yarn-project/circuit-types/src/logs/encrypted_l2_log.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Fr, Point } from '@aztec/circuits.js';
import { randomBytes } from '@aztec/foundation/crypto';

/**
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit bdc3eea

Please sign in to comment.