Skip to content

feat(vara.eth/ethexe): cap task processing - #5583

Draft
grishasobol wants to merge 6 commits into
masterfrom
gsobol/ethexe/announce-task-limits
Draft

feat(vara.eth/ethexe): cap task processing #5583
grishasobol wants to merge 6 commits into
masterfrom
gsobol/ethexe/announce-task-limits

Conversation

@grishasobol

Copy link
Copy Markdown
Member

Closes #5204 (part of the #5203 umbrella)

Summary

An announce commits to Ethereum as a single transaction, so unbounded scheduled-task bursts (e.g. many mailbox expiries landing on one block) could make an announce permanently uncommittable.

  • Cap: process_tasks now drains at most MAX_SCHEDULE_TASKS_PER_MB = 64 due tasks per announce (InBlockTransitions::take_actual_tasks_capped), oldest height first, deterministic order. The excess stays in the schedule at its original heights — it remains due on following blocks (natural re-scheduling) and remove_task(expiry, ...) from claim/reply paths keeps working for deferred entries.
  • Outdated-task cleanup: schedule task handlers (RemoveFromMailbox, SendDispatch, SendUserMessage, WakeMessage) pre-check their target via read-only state lookups and skip with a warning when the program is unknown or the mailbox/waitlist/stash entry is gone — instead of panicking the validator. Skipped tasks register no state modification, so they add nothing to the commitment. Kind mismatches and storage corruption stay loud.
  • Restorer docs updated: a committed schedule may now legitimately contain overdue tasks.

Test plan

  • Unit: capped drain order/limit; leftover keeps original height and stays removable; iterated capped drain == one-shot; future heights untouched; all four task kinds skip cleanly for unknown program and empty state with zero modifications
  • Integration (ethexe-processor): cap+7 backlog → exactly 7 deferred at original height, fully drained next block; dangling tasks at same/past heights don't abort sibling PING/PONG execution
  • Proptest: iterating take_actual_tasks_capped yields exactly the uncapped due-task sequence (nothing lost or reordered), each chunk within the cap
  • cargo nextest run -p "ethexe-*": 530/535 (5 failures = known Anvil flaky set, all pass in isolation)
  • fmt / clippy / shear clean

Notes

🤖 Generated with Claude Code

grishasobol and others added 3 commits June 12, 2026 00:06
take_actual_tasks_capped drains at most MAX_SCHEDULE_TASKS_PER_MB (64)
due tasks oldest-first; the excess stays in the schedule under original
heights and runs in following blocks, keeping per-announce commitment
size and gas bounded (#5204, #5203).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Schedule task handlers now pre-check the target (program known, entry
present in mailbox/waitlist/stash) and skip with a warning when it is
gone — an outdated task must not crash the validator or register a
spurious state modification. Kind mismatches and storage corruption
stay loud (#5204).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Integration: over-cap backlog defers exactly the tail at its original
height and drains next block; a dangling task is skipped without
aborting sibling program execution. Proptest: iterated capped drain
equals the uncapped due-task sequence, each chunk within the cap.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@grishasobol grishasobol added type: feat New functionality or user-visible improvement scope: vara.eth Vara Ethereum application layer (L2) ai-generated Created entirely by an AI agent without direct human authorship labels Jun 11, 2026
grishasobol and others added 3 commits June 12, 2026 11:08
Task processing shares PROGRAM_MODIFICATIONS_SOFT_LIMIT with queue
processing; a 64-task block exhausted the whole budget and skipped
queues entirely. Cap at half the budget (32) so queues always retain
headroom (audit finding).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
many_waits and cross_height_wake_drain schedule more wakes than
MAX_SCHEDULE_TASKS_PER_MB allows per announce — drive process_tasks the
way consecutive blocks would until the backlog is empty.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@grishasobol grishasobol changed the title feat(vara.eth/ethexe): cap task processing per announce, drop outdated tasks feat(vara.eth/ethexe): cap task processing Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Created entirely by an AI agent without direct human authorship scope: vara.eth Vara Ethereum application layer (L2) type: feat New functionality or user-visible improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add task processing limits and clean up outdated tasks

1 participant