fix/prevent expired task from been approved - #99
Open
EmmyKay0026 wants to merge 1 commit into
Open
Conversation
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.
Description
Prevents proofs submitted after a task’s expiration deadline from transitioning to
APPROVEDor generating a reward payout.This change introduces a centralized proof approval eligibility rule and applies it consistently across:
The task deadline is evaluated against
proof.createdAtusing an inclusive cutoff:task.expiresAtremain eligible, even if the task expires before finalization.task.expiresAtare forced toREJECTED.ACTIVEtoEXPIRED.Fixes #55
Type of Change
How Has This Been Tested?
npm testpassesnpm run buildsucceedsManual/targeted verification performed:
ACTIVEtasks with a past deadline reject new submissions.The complete proof route suite currently has an unrelated
ECONNRESETfailure on its first unauthenticated request. The remaining route tests pass, including all tests added by this change.Checklist
Additional Context
The cutoff is based on the proof submission timestamp rather than the finalization timestamp. This prevents asynchronous verification or review latency from invalidating legitimate work submitted while the task was still open.
The completion-slot database update also enforces the task deadline and allowed task states, providing defense in depth against races or stale expiry-sweep state.