sync(engine): Wave 11a-ii-B — permissionless_progress dispatcher (minimal port, recovery deferred) - #99
Conversation
…imal port, recovery deferred)
Wave 11a-ii-B ports the engine-side permissionless-progress entry point and
its request/outcome types so the wrapper KeeperCrank port (Wave 7c) can
land. The recovery branches (active-close continuation / account-B
dispatch / 5-reason global recovery loop) are intentionally deferred to a
later wave — they would require porting an additional ~1500 LOC of helpers
(price-step, accrual-segment, recovery resolvers, B-dispatch + validators)
beyond the scope of this PR.
The wrapper's only behavioral dependence on the outcome is
matches!(outcome, Cranked(_)) for post-crank fee logic, so stubbing
recovery is safe — recovery-eligible markets surface a stable
RecoveryRequired error instead of being terminally recovered in-engine.
Production callers don't currently reach a state where active_close is
set (the Wave 11a-ii-A setters have no production caller yet), so on
this branch the gate is dead code; defense-in-depth only.
Types added (toly-engine src/percolator.rs equivalents in parens):
- RecoveryReason enum (270-302) — 7 variants
- PermissionlessProgressOutcome enum (950-958) — 6 variants
- KeeperCrankRequest struct (1036-1050)
- PermissionlessProgressRequest struct (1057-1073)
Functions added:
- force_close_resolved_cursor_with_fee_not_atomic (toly:9731-9774):
bounded resolved-close cursor progress; advances rr_cursor_position
across missing slots, reconciles the first materialized account in the
window via force_close_resolved_with_fee_not_atomic.
- force_close_resolved_cursor_not_atomic (toly:9719-9724): zero-fee
convenience delegate.
- keeper_crank_with_request_not_atomic (toly:8848-9069 at the
request-shape level): thin adapter around the fork's existing
positional-arg keeper_crank_not_atomic. The two toly-only request
fields not consumed by fork's keeper (max_candidate_inspections,
rr_scan_limit) are forwarded structurally but ignored.
- permissionless_progress_not_atomic (toly:8754-8845 at the dispatcher
level): Resolved -> force_close_resolved_cursor_with_fee; Live ->
keeper_crank_with_request; active_close_present -> RecoveryRequired
(defense-in-depth); otherwise Unauthorized. The recovery middle 3
branches (toly:8787-8829) are deferred — see KEEP_LIST.
Kani harnesses (342 -> 346, +4):
- proof_permissionless_progress_resolved_routes_to_resolved_close
- proof_permissionless_progress_rejects_when_active_close_present
- proof_force_close_resolved_cursor_rejects_live_market
- proof_force_close_resolved_cursor_rejects_zero_scan_limit
Wrappers (Wave 7c) can now call
engine.permissionless_progress_not_atomic(PermissionlessProgressRequest
{...}) and match on PermissionlessProgressOutcome::Cranked(_).
Verifications: cargo build --release clean; verify-engine-preservation.sh
silent; verify-engine-deferred-absent.sh silent; cargo test --release
--features test: 49 + 3 + 283 tests pass.
Deferred to a future wave (still under KL-FORK-ENGINE-B-TRACKING-1 /
KL-FORK-ENGINE-BANKRUPT-CLOSE-1):
- try_permissionless_account_b_dispatch / _b_progress
- try_permissionless_global_recovery (5 reasons)
- permissionless_recovery_resolve_p_last_not_atomic /
resolve_account_b_p_last_not_atomic
- validate_permissionless_p_last_recovery_reason /
validate_permissionless_account_b_recovery_reason
- bounded_price_step_cap_abs / bounded_price_step_toward_raw_target /
bounded_accrual_slot_for_now / plan_accrual_segment
- resolve_counter_or_epoch_overflow_recovery_not_atomic
- exposed_market_has_oi
- begin_terminal_epoch_exhaustion_reset
- Integration of the Wave 11a-ii-A setters into trade / accrue / resolve
/ fee-sync hot paths
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a permissionless progress dispatcher and cursor-based resolved-account closure APIs. Introduces ChangesWave 11a-ii-B Permissionless Progress API
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Wave 11a-ii-B ports the engine-side permissionless-progress entry point + request/outcome types so the wrapper KeeperCrank port (Wave 7c) can land. Recovery branches (active-close continuation / account-B dispatch / 5-reason global recovery loop) are intentionally deferred to a follow-up wave — they require porting an additional ~1500 LOC of helpers beyond the scope of this PR.
The wrapper's only behavioral dependence on the outcome is
matches!(outcome, Cranked(_))for post-crank fee logic, so stubbing recovery is safe: recovery-eligible markets surface a stableRecoveryRequirederror instead of being terminally recovered in-engine.Types added (toly:engine refs in parens)
RecoveryReasonenum (270-302) — 7 variantsPermissionlessProgressOutcomeenum (950-958) — 6 variantsKeeperCrankRequeststruct (1036-1050)PermissionlessProgressRequeststruct (1057-1073)Functions added
force_close_resolved_cursor_with_fee_not_atomic(toly:9731-9774): bounded resolved-close cursor progress; advancesrr_cursor_positionacross missing slots, reconciles the first materialized account in the window via the existingforce_close_resolved_with_fee_not_atomic.force_close_resolved_cursor_not_atomic(toly:9719-9724): zero-fee convenience delegate.keeper_crank_with_request_not_atomic(toly:8848-9069 at the request-shape level): thin adapter around fork's existing positional-argkeeper_crank_not_atomic. The two toly-only request fields not consumed by the fork's keeper (max_candidate_inspections,rr_scan_limit) are forwarded structurally but ignored.permissionless_progress_not_atomic(toly:8754-8845 at the dispatcher level):force_close_resolved_cursor_with_feekeeper_crank_with_requestactive_close_present != 0→RecoveryRequired(defense-in-depth, dead code on this branch since Wave 11a-ii-A setters have no production caller yet)UnauthorizedThe recovery middle 3 branches (toly:8787-8829) are deferred.
Kani harnesses (342 → 346, +4)
Risk on this branch
Wave 7c (wrapper KeeperCrank port) can now call `engine.permissionless_progress_not_atomic(PermissionlessProgressRequest {...})` and match on `PermissionlessProgressOutcome::Cranked(_)` exactly as toly's wrapper does.
Deferred to a future wave (KL-FORK-ENGINE-B-TRACKING-1 / KL-FORK-ENGINE-BANKRUPT-CLOSE-1)
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests