From da82b58ff8a84fd12278b5b6bfea90e5521cf6fa Mon Sep 17 00:00:00 2001 From: David Banks <47112877+dbanks12@users.noreply.github.com> Date: Tue, 21 May 2024 19:30:23 -0400 Subject: [PATCH] chore: fix unencrypted logs mismatch for AVM with a +4 (#6580) --- yarn-project/circuit-types/src/logs/unencrypted_l2_log.ts | 1 + yarn-project/simulator/src/avm/journal/journal.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/yarn-project/circuit-types/src/logs/unencrypted_l2_log.ts b/yarn-project/circuit-types/src/logs/unencrypted_l2_log.ts index 40d7e598cf5..b6ba96297b9 100644 --- a/yarn-project/circuit-types/src/logs/unencrypted_l2_log.ts +++ b/yarn-project/circuit-types/src/logs/unencrypted_l2_log.ts @@ -24,6 +24,7 @@ export class UnencryptedL2Log { ) {} get length(): number { + // TODO(6578): explain magic number 4 here return EventSelector.SIZE + this.data.length + AztecAddress.SIZE_IN_BYTES + 4; } diff --git a/yarn-project/simulator/src/avm/journal/journal.ts b/yarn-project/simulator/src/avm/journal/journal.ts index 9645c9f4032..24f682ecbce 100644 --- a/yarn-project/simulator/src/avm/journal/journal.ts +++ b/yarn-project/simulator/src/avm/journal/journal.ts @@ -308,7 +308,8 @@ export class AvmPersistableStateManager { this.transitionalExecutionResult.allUnencryptedLogs.push(ulog); // this duplicates exactly what happens in the trace just for the purpose of transitional integration with the kernel this.transitionalExecutionResult.unencryptedLogsHashes.push( - new LogHash(logHash, this.trace.accessCounter, new Fr(ulog.length)), + // TODO(6578): explain magic number 4 here + new LogHash(logHash, this.trace.accessCounter, new Fr(ulog.length + 4)), ); // TODO(6206): likely need to track this here and not just in the transitional logic.