Repository navigation
test(sim): resubmit executed mutations - #82
Merged
Merged
Conversation
A step drawn at `SIM.generator.resubmitRate` executes its mutation twice, concurrently. The first submission is forked with `startImmediately`, so it is queued before the second starts, as in production. The second fails with `InvalidNonce`, or with the step's own revert when the first one reverts. The validator takes a resubmission's `received` and `rejected` events apart from the first submission's, and counts only the first `received` of a key as its arrival. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The simulation plan now resubmits mutations. A step drawn at
SIM.generator.resubmitRate(0, 0.01, 0.1 or 1) callsexecutetwice, concurrently, with the same mutation. The first call must get the usual result. The second must fail withInvalidNonce, or with the step's own revert when the step is planned to revert, since a reverted mutation does not use its nonce.Only steps sent through
executeare resubmitted. A duplicateenqueueis an onchain transaction that is force-included and rejected, which needs a different event model.Ordering
The first call is forked with
Effect.forkChild(..., { startImmediately: true }). It runs at once, outside the sim's scheduler, until it waits on its result, which is afterQueue.offer. Only then does the second call start. Production gives the same order, since the default scheduler starts fibers in fork order andexecutereachesQueue.offerwithout suspending. WithoutstartImmediately, the sim's seeded scheduler picks a random ready fiber, so either call could be queued first.Validation
rejectedevent no longer counts as its original settling.receivedand the lastrejectedas the resubmission's events, checks they exist, and checks the rest against the usual expected statuses.receivedof each key.The new draw in
makePlanshifts later draws, so existing seeds will not reproduce the same runs.Testing
tsc --noEmitandbiome checkpass.0x80ff88d7d7c613a74ea464ffcde8c40c49cf44f9612656a0e7ab87851d227c99(rate 1, 196 steps, batch),0x51bc4127979feb9330845c0fd5795b63aea7c243a5edf0aa3977b99c26f91e0e(rate 0.1, FIFO),0x4e21c5d7fdcdb68411066f7f2c5dc5f9d99f71e4933ba493b054faf148527aee(rate 1, batch).startImmediatelyoff,0x4e21…fails withstep 0 (resubmit A): got success, want InvalidNonce.🤖 Generated with Claude Code