Skip to content

Commit

Permalink
fix: Fr overflow in FunctionL2Logs.random
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Aug 4, 2023
1 parent ba176c4 commit 576716f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion yarn-project/types/src/logs/function_l2_logs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { sha256 } from '@aztec/foundation/crypto';
import { Point } from '@aztec/foundation/fields';
import { BufferReader, serializeBufferToVector } from '@aztec/foundation/serialize';

import { randomBytes } from 'crypto';
Expand Down Expand Up @@ -69,7 +70,9 @@ export class FunctionL2Logs {
public static random(numLogs: number): FunctionL2Logs {
const logs: Buffer[] = [];
for (let i = 0; i < numLogs; i++) {
logs.push(randomBytes(144));
const randomEphPubKey = Point.random();
const randomLogContent = randomBytes(144 - Point.SIZE_IN_BYTES);
logs.push(Buffer.concat([randomLogContent, randomEphPubKey.toBuffer()]));
}
return new FunctionL2Logs(logs);
}
Expand Down

0 comments on commit 576716f

Please sign in to comment.