Skip to content

Commit

Permalink
Serialization fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Mar 25, 2024
1 parent eefea09 commit 91cc2d7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions yarn-project/circuit-types/src/logs/encrypted_l2_log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { randomBytes } from '@aztec/foundation/crypto';
import { BufferReader } from '@aztec/foundation/serialize';

/**
* Represents an individual encrypted log entry.
Expand Down Expand Up @@ -36,12 +35,10 @@ export class EncryptedL2Log {

/**
* Deserializes log from a buffer.
* @param buffer - The buffer or buffer reader containing the log.
* @param buffer - The buffer containing the log.
* @returns Deserialized instance of `Log`.
*/
public static fromBuffer(buffer: Buffer | BufferReader): EncryptedL2Log {
const reader = BufferReader.asReader(buffer);
const data = reader.readBuffer();
public static fromBuffer(data: Buffer): EncryptedL2Log {
return new EncryptedL2Log(data);
}

Expand Down
2 changes: 1 addition & 1 deletion yarn-project/circuit-types/src/logs/function_l2_logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class EncryptedFunctionL2Logs extends FunctionL2Logs<EncryptedL2Log> {
const logsBufLength = isLengthPrefixed ? reader.readNumber() : -1;
const logs = reader.readBufferArray(logsBufLength);

return new EncryptedFunctionL2Logs(logs.map(UnencryptedL2Log.fromBuffer));
return new EncryptedFunctionL2Logs(logs.map(EncryptedL2Log.fromBuffer));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/circuit-types/src/logs/unencrypted_l2_log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class UnencryptedL2Log {
) {}

get length(): number {
return EventSelector.SIZE + this.data.length;
return EventSelector.SIZE + this.data.length + AztecAddress.SIZE_IN_BYTES + 4;
}

/**
Expand Down

0 comments on commit 91cc2d7

Please sign in to comment.