feat(contract): add 24-hour grace period for proof disputes#192
Merged
ayomideadeniran merged 2 commits intoSoroLabs:mainfrom Mar 30, 2026
Merged
Conversation
- Split verify_and_release into verify_proof + claim_funds - Add Verified status to ProjectStatus FSM - Store last_proof_time in ProjectState for grace period tracking - Add GRACE_PERIOD constant (86400s / 24h) - Add GracePeriodActive error (code 34) - Add FundsClaimed event - claim_funds is permissionless, callable after grace period - Fix pre-existing duplicate error discriminants - Fix pre-existing missing categories arg in test register_project calls - Add comprehensive test_grace_period test suite (9 tests)
|
@GazzyLee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Thanks for the PR! This is currently under review and I will get back to you shortly. |
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.
Summary
Introduces a mandatory 24-hour cooling-off period between proof verification and fund release to allow community members time to dispute fraudulent proofs before funds become irreversibly claimable.
Motivation
Previously,
verify_and_releaseatomically verified proof and transferred funds in a single transaction, leaving zero window for dispute. This change splits the flow into two steps with a configurable grace period, aligning with the issue requirement to protect donors against fraudulent claims.Changes
Contract logic (
lib.rs)verify_and_releaseinto two entry points:verify_proof— Oracle-only; validates the proof hash, transitions project toVerified, recordslast_proof_timeclaim_funds— Permissionless; callable by anyone after the 24h grace period has elapsed; deducts protocol fee and transfers funds to creator, transitions toCompletedGRACE_PERIOD: u64 = 86_400constant (24 hours in seconds)Types (
types.rs)Verifiedvariant toProjectStatusenum (FSM:Active → Verified → Completed)last_proof_time: u64field toProjectStateandProjectErrors (
errors.rs)GracePeriodActive = 34— returned whenclaim_fundsis called before the grace period elapsesEvents (
events.rs)FundsClaimedevent (topic:fnd_clm) emitted on successful fund claimStorage (
storage.rs)save_project/load_project/maybe_load_projectto persistlast_proof_timeInvariants (
invariants_checker.rs)Verifiedto valid status transitions incheck_inv7_status_transitionTests
test_grace_period.rswith 9 targeted tests:test_verify_proof_sets_verified_status_and_timestamptest_claim_funds_after_grace_period_succeedstest_claim_funds_before_grace_period_failstest_claim_funds_one_second_before_grace_period_failstest_claim_funds_on_funding_project_failstest_claim_funds_on_completed_project_failstest_verify_proof_twice_failstest_expire_verified_project_failstest_claim_funds_permissionlessPre-existing fixes (bundled)
errors.rs(codes 28/29 were each used twice)categoriesargument in ~35register_projecttest callsget_super_adminimport ininvariants_checker.rsMigration notes
verify_and_releaseno longer exists. Callers must useverify_prooffollowed byclaim_funds(after 24h).backend/oracle/referencesverify_and_releaseand will need a follow-up update.Closes #125