From ef505494b0bbd8101e210a62104025f61f72a27e Mon Sep 17 00:00:00 2001 From: kyscott18 <43524469+kyscott18@users.noreply.github.com> Date: Mon, 26 Oct 2026 22:41:29 +0000 Subject: [PATCH] fix(typewriter): prune the journal of a replayed enqueue `enqueueMutation` replays a ForceInclusionQueued log in revm but never pruned the journal that the `execute` created. Nothing reverts or replays an enqueue, since it is already onchain, so each log kept a journal in the EVM for the life of the process. Prune it as soon as the enqueue succeeds. Co-Authored-By: Claude Opus 5.5 --- packages/typewriter/src/typewriter.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/typewriter/src/typewriter.ts b/packages/typewriter/src/typewriter.ts index 8aed1b3..d1a8904 100644 --- a/packages/typewriter/src/typewriter.ts +++ b/packages/typewriter/src/typewriter.ts @@ -457,15 +457,22 @@ export function enqueueMutation(params: { mutation: EnqueuedMutation; }): Effect.Effect { return Effect.gen(function* () { - // TODO(kyle) prune the enqueue's journal. Nothing reverts or replays it, - // so it stays in the EVM's journal map for the life of the process. const enqueueCalldata = encodeEnqueueCalldata(params.mutation); - return yield* params.evm.execute({ + const executeResult = yield* params.evm.execute({ from: "0x0000000000000000000000000000000000000000", to: params.app.address, data: enqueueCalldata, }); + + // The enqueue is already onchain, so a settlement never rewinds it. + if (executeResult.status === "success") { + yield* params.evm.pruneJournals({ + journal_ids: [executeResult.journal_id], + }); + } + + return executeResult; }); }