Skip to content

feat: implement stakeholder voting-to-suspend in MerchantRegistry (decentralized governance) - #564

Merged
Pvsaint merged 2 commits into
MetroLogic:mainfrom
Johnpii1:issue-438
Jul 28, 2026
Merged

feat: implement stakeholder voting-to-suspend in MerchantRegistry (decentralized governance)#564
Pvsaint merged 2 commits into
MetroLogic:mainfrom
Johnpii1:issue-438

Conversation

@Johnpii1

Copy link
Copy Markdown
Contributor

close #438

Motivation
Ensure disputes have a usable computed deadline so escalation and deadline checks can run when operators do not set review_deadline (Issue #177).
Provide decentralized merchant suspension via stakeholder (arbitrator) proposals and voting to replace admin-only suspensions and support governance-driven enforcement (roadmap/Issue #438).

Description
Add dispute deadline constants and configuration: DEFAULT_DISPUTE_DEADLINE_THRESHOLD_AMOUNT, SMALL_DISPUTE_DEADLINE_SECS, and LARGE_DISPUTE_DEADLINE_SECS in fluxapay/src/lib.rs and a persistent DataKey::DisputeDeadlineThresholdAmount fallback.
Wire computed deadline into dispute creation by setting Dispute.computed_deadline_secs using computed_dispute_deadline_secs(env, amount) during create_dispute_inner.
Make maybe_escalate_dispute_due_to_deadline fall back to created_at + computed_deadline_secs when review_deadline is not set.
Add admin API set_dispute_threshold(env, admin, amount) and helpers get_dispute_deadline_threshold and computed_dispute_deadline_secs to allow configuring the small/large threshold at runtime.
Add merchant suspension governance to fluxapay/src/merchant_registry.rs: SuspensionProposal type, persistent proposal/vote counters/keys, propose_merchant_suspension (arbitrator-only), vote_suspension (arbitrator-only) with duplicate-vote rejection, expiration handling, auto-suspend execution when approval votes reach the configured threshold, and emitted events MERCHANT/SUSPENSION_PROPOSED, MERCHANT/SUSPENSION_VOTED, and MERCHANT/SUSPENDED.
Add set_suspension_threshold(env, admin, threshold) and grant_role passthrough and initialize AccessControl in MerchantRegistry::initialize so role-based governance can operate.

Testing
Ran cargo check -q; the build reported failures due to unrelated, pre-existing repository compile issues (e.g. overly long contract symbols/field names and some missing types), so compilation could not be validated in this run.
Ran cargo fmt --check; formatting check failed due to an existing parse error (unclosed delimiter) in fluxapay/src/dispute_test.rs, preventing a clean format pass.
No new unit test suite was executed as part of this rollout because the repo-level compile/format issues blocked running the standard test and build commands.

Johnpii1 added 2 commits July 28, 2026 10:39
…ne-enforcement

feat(dispute): auto-set computed_deadline and add merchant suspension governance
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@Johnpii1 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! 🚀

Learn more about application limits

@Pvsaint
Pvsaint merged commit afc28f8 into MetroLogic:main Jul 28, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement stakeholder voting-to-suspend in MerchantRegistry (decentralized governance)

2 participants