You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: This PR correctly identifies and fixes a real user-funds issue — when stopAll() was called, in-flight WorkerHandler requests were silently cancelled at the scheduler level but their EVM counterparts remained stuck in PROCESSING state indefinitely, preventing refunds. The fix is directionally correct, but there is one functional bug introduced and a documentation inconsistency.
Bug: Missing precondition for WorkerHandler in stopAll()
cadence/contracts/FlowYieldVaultsEVMWorkerOps.cdc, line 273
// pre block only checks:// _getManagerFromStorage() != nil// _getFlowTokenVaultFromStorage() != nil// _getSchedulerHandlerFromStorage() != nil// ...but then unconditionally:letworkerHandler = FlowYieldVaultsEVMWorkerOps._getWorkerHandlerFromStorage()!
The force-unwrap on line 273 is executed unconditionally — even when scheduledRequests is empty. If WorkerHandler is not in storage, this panics, and due to Cadence's transaction atomicity, the pauseScheduler() call on line 269 also reverts. The scheduler remains unpaused despite the caller expecting stopAll() to have succeeded.
Contrast this with SchedulerHandler.executeTransaction, which already has this guard:
pre {
FlowYieldVaultsEVMWorkerOps._getWorkerHandlerFromStorage() !=nil: "WorkerHandler resource not found"// ...
}
The same precondition should be added to stopAll():
FlowYieldVaultsEVMWorkerOps._getWorkerHandlerFromStorage() !=nil: "WorkerHandler resource not found"
This docstring is incorrect as written. If the intent was to distinguish between cancelling the transaction (which does happen) versus clearing the nextSchedulerTransactionIdfield on the SchedulerHandler resource (which is not done), that nuance should be stated explicitly. As-is, the note is misleading.
No test coverage for the new behavior
There are no tests in cadence/tests/ covering the stopAll() fix:
No test verifying that cancelled requests are marked FAILED on EVM
No test exercising the StopAllMarkFailedSkipped event path (i.e., when markRequestAsFailed returns false)
Given that this is a critical admin function that handles user funds, test coverage would significantly increase confidence in correctness.
markRequestAsFailed returns Bool but no diagnostic info. When this event fires, operators have no indication of why the EVM call failed (e.g., request was already in a terminal state, EVM call reverted). Adding a message: String field, or having Worker expose more diagnostic context, would make this easier to triage in production.
Positive observations
Correct access control: borrowWorker() is access(contract), consistent with how _checkForFailedWorkerRequests accesses it — external callers cannot directly borrow the Worker capability.
Graceful degradation: emitting StopAllMarkFailedSkipped rather than panicking on failure is the right approach; it lets the cancellation loop continue for other requests rather than reverting everything.
Consistent pattern: the new stopAll() logic mirrors _checkForFailedWorkerRequests (line 596), keeping the failure-marking pattern uniform across both admin-initiated and scheduler-detected panics.
Test refactoring: the _startProcessingBatch helper in tests is clean and the rename from test_StartProcessing_* to test_StartProcessingBatch_* is thorough.
Doc cleanup: the startProcessing → startProcessingBatch updates across all markdown files and scripts are consistent and complete.
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
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.
Summary
stopAll()so each canceled WorkerHandler request is markedFAILEDbefore removing it fromscheduledRequestsWorkerHandlercapability instopAll()to keep access model consistentFlowYieldVaultsEVMWorkerOps.cdcscheduler/stopAll comments with implementationcadence/scripts/get_request_details.cdccommentsCommits in this PR
a694d8echore: checkpoint staged PR changesdb84303docs: align scheduler stopAll comments with implementation03f34e2docs: fix get_request_details script commentsad7610afix(cadence): fail canceled worker requests in stopAllBase
navid/new-worker-arch