Skip to content

vote_deactivate: drop collateral gate, trust validator quorum#62

Merged
LandynDev merged 1 commit into
testfrom
feat/vote-deactivate-trust-only
Apr 17, 2026
Merged

vote_deactivate: drop collateral gate, trust validator quorum#62
LandynDev merged 1 commit into
testfrom
feat/vote-deactivate-trust-only

Conversation

@LandynDev
Copy link
Copy Markdown
Collaborator

Summary

Remove the collateral >= min_collateral precondition from vote_deactivate so validator consensus alone is authoritative. The contract trusts the quorum — the threshold itself is the abuse protection, same envelope as vote_activate / vote_reserve.

Why

The original gate was designed to prevent validator collusion against compliant miners, but it narrows vote_deactivate to exactly one remediation case (min-raise cleanup). Removing it gives the validator layer freedom to invoke deactivation for any reason the quorum deems valid — min-raise, protocol abuse, operational emergencies — without needing a new on-chain gate per case.

Miner protection against malicious quorum unchanged in practice: the validator set is already trusted for reserve / initiate / confirm / slash paths. If the quorum is compromised, there are bigger problems than one extra deactivate vector.

Changes

  • smart-contracts/ink/lib.rs — drop the if miner_collateral >= self.min_collateral { Err(SufficientCollateral) } check from vote_deactivate; keep the !miner_active → InvalidStatus guard.
  • smart-contracts/ink/errors.rs — remove the now-unused SufficientCollateral variant.
  • allways/contract_client.py — drop the variant from CONTRACT_ERROR_VARIANTS (renumbers HasActiveSwap from 29 → 28, CurrentlyReserved from 30 → 29). Update vote_deactivate client docstring.
  • plans/scoring-simplification-and-contract-hardening.md — reflect the simplified semantics (local-only file, not in repo).

Follow-ups

  • entrius/alw-utils PR for suite 21 already pushed: drops the above-floor rejection assertion.

Test plan

  • cargo check — contract compiles
  • pytest -q — 279 tests pass
  • ruff check — clean
  • Rebuild contract in dev env; E2E suite 21 passes (contract redeploy required because the error enum changed)

Remove the `collateral >= min_collateral` check from vote_deactivate so validator consensus alone is authoritative. Same trust envelope as vote_activate / vote_reserve — abuse protection comes from the quorum threshold, not a contract-level precondition. Frees the validator layer to use deactivation for any remediation case (min-raise, protocol abuse, operational emergencies) without needing a new on-chain gate per case. Drops the now-unused Error::SufficientCollateral variant and renumbers the Python error-variant map accordingly.
@LandynDev LandynDev merged commit 85f0f91 into test Apr 17, 2026
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.

1 participant