Skip to content

fix(f02-mocks): apply complete f02 validation to write queue - #22

Merged
wjmelements merged 3 commits into
mainfrom
rvagg/f02-mock-queue-slots
Aug 11, 2026
Merged

fix(f02-mocks): apply complete f02 validation to write queue#22
wjmelements merged 3 commits into
mainfrom
rvagg/f02-mock-queue-slots

Conversation

@rvagg

@rvagg rvagg commented Aug 10, 2026

Copy link
Copy Markdown
Member

This is almost a reimplementation of the queue validation logic in f02, so any weight write operation should be validated as if it were hitting the real f02.

In here is:

fix(f02-mocks): give the weight ops one schedule-wide queue slot each 

SetWeightRecords and StepWeightRecords key their slot by op alone and hold
the whole batch as a single entry, so a second batch is rejected while one
is pending even when it names entirely different streams. The three
per-stream ops keep (id, op). A batch applies as one unit.

CancelPending addresses the weight slots with a null id, and rejects the
id/op shape mismatch in both directions.

and, taking it the whole-hog:

fix(f02-mocks): validate the projected queue 

A queued write walks the pending queue in effective-epoch order, applying each
entry to a candidate projection and validating from its own effective epoch.
Failing entries drop. The call is refused when the write does not survive its
position, or when the walk accepts fewer slots than it did without it.

Due writes are checked again at settle, since a cancellation can take away what
one depended on, and dropped if they no longer hold.

The weight sum is sampled at every breakpoint: clamped linears peak on a kink or
at the limit.

@FilOzzy FilOzzy added this to FOC Aug 10, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Aug 10, 2026
@rvagg
rvagg requested review from wjmelements and a lite review from Copilot August 10, 2026 10:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the f02 Reward Actor mock to validate queued write operations using a projected-queue walk that mirrors f02 behavior, with special handling for schedule-wide weight-write slots so weight writes are admitted/settled according to full schedule validation.

Changes:

  • Model SetWeightRecords / StepWeightRecords as schedule-wide, per-op queue slots (batch as a single pending entry) and adjust cancellation addressing (null-id shape).
  • Add projected-schedule admission logic: walk pending writes in effective-epoch order, apply to a candidate projection, validate from each write’s effective epoch, and refuse writes that would strand previously-accepted entries.
  • Re-check due writes at settle-time and drop (with an event) writes that no longer validate due to intervening cancellations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/mocks/FVMRewardActor.sol Implements schedule-wide weight batching and projected-queue validation, plus settle-time dropping of invalid due writes.
test/mocks/FVMRewardActor.t.sol Adds/updates tests to cover schedule-wide weight slots, cancellation shape rules, and projected-schedule validation behaviors.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/mocks/FVMRewardActor.sol Outdated
@rvagg
rvagg force-pushed the rvagg/f02-mock-queue-slots branch from 737361a to d4f2313 Compare August 10, 2026 10:56
@rvagg rvagg mentioned this pull request Aug 10, 2026
@rvagg
rvagg force-pushed the rvagg/f02-mock-queue-slots branch from d4f2313 to 1474c8d Compare August 10, 2026 11:21
@wjmelements
wjmelements force-pushed the rvagg/f02-mock-queue-slots branch from 1474c8d to 5b23b77 Compare August 10, 2026 15:21
@github-project-automation github-project-automation Bot moved this from 📌 Triage to ✔️ Approved by reviewer in FOC Aug 10, 2026
Base automatically changed from rvagg/f02-mock-wireformat to main August 11, 2026 14:48
rvagg added 2 commits August 11, 2026 09:48
SetWeightRecords and StepWeightRecords key their slot by op alone and hold
the whole batch as a single entry, so a second batch is rejected while one
is pending even when it names entirely different streams. The three
per-stream ops keep (id, op). A batch applies as one unit.

CancelPending addresses the weight slots with a null id, and rejects the
id/op shape mismatch in both directions.
A queued write walks the pending queue in effective-epoch order, applying each
entry to a candidate projection and validating from its own effective epoch.
Failing entries drop. The call is refused when the write does not survive its
position, or when the walk accepts fewer slots than it did without it.

Due writes are checked again at settle, since a cancellation can take away what
one depended on, and dropped if they no longer hold.

The weight sum is sampled at every breakpoint: clamped linears peak on a kink or
at the limit.
@wjmelements
wjmelements force-pushed the rvagg/f02-mock-queue-slots branch from 5b23b77 to 8309043 Compare August 11, 2026 14:48
@wjmelements
wjmelements merged commit 9892de8 into main Aug 11, 2026
3 checks passed
@wjmelements
wjmelements deleted the rvagg/f02-mock-queue-slots branch August 11, 2026 18:31
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Aug 11, 2026
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.

4 participants