Skip to content

fix(typewriter): skip settlement when every enqueued mutation is rejected - #81

Merged
kyscott18 merged 2 commits into
mainfrom
fix/block-finalized-event
Oct 27, 2026
Merged

kyscott18 merged 2 commits into
mainfrom
fix/block-finalized-event

Conversation

@kyscott18

Copy link
Copy Markdown
Collaborator

Problem

submit returned early only when both the accepted-batch queue and the enqueued queue were empty. If there was no batch and acceptMutation rejected every enqueued force-inclusion mutation, submit still sent execute([], []). That spent a nonce and gas, and emitted a block event with no mutations in it. Nothing waits on that block, so a run could shut down before it was finalized.

Fix

After the enqueued mutations are accepted or rejected, return early when there are no batches and no accepted force-included mutations. Nothing is lost by returning early here: rejected mutations have already emitted their rejected events, nothing has been persisted, and commits is empty.

Testing

  • Regression seeds: each fails on main and passes on this branch:
    • 0x7aa621c50ac8152e4120bfb4c74d7a218f75fe7f9b7e00686363f4edfc3816a2
    • 0x99cb123856ae62ade96e3a7d115a83792a1e1bcb738074182e16feab5c0d22e6
    • 0xe7894e413081a714af99107bcdbc1723aa7b0a41a11f7c71c2d4a3ce618ea62f
  • tsc --noEmit and bun test in packages/typewriter pass (27/27).

🤖 Generated with Claude Code

kyscott18 and others added 2 commits October 26, 2026 22:58
…cted

submit returned early only when the accepted-batch and enqueued queues were
both empty. When there was no batch and every enqueued force-inclusion
mutation was rejected by acceptMutation, it still sent an empty execute
transaction and emitted a block event with no mutations. Nothing waits on
that block, so it could go unfinalized before shutdown, and it wasted gas
and a nonce.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyscott18
kyscott18 merged commit d045fe6 into main Oct 27, 2026
@kyscott18
kyscott18 deleted the fix/block-finalized-event branch October 27, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant