Skip to content

Hardening strategy_registry: add epoch/quorum/revocation and safe win…#418

Open
AugistineCreates wants to merge 1 commit into
gear5labs:masterfrom
AugistineCreates:harden-strategy-registry
Open

Hardening strategy_registry: add epoch/quorum/revocation and safe win…#418
AugistineCreates wants to merge 1 commit into
gear5labs:masterfrom
AugistineCreates:harden-strategy-registry

Conversation

@AugistineCreates
Copy link
Copy Markdown

This pr closes #385

This PR replaces the previous simple vote‑counting implementation in src/Agents/tools/strategyRegistry.ts with a more robust lifecycle:

  1. Epoch‑based voting – votes automatically expire after a configurable time window (default 24 hours).
  2. Quorum enforcement – a pool must receive a minimum number of votes (default 3) before it can be considered a valid strategy.
  3. Vote revocation – agents can withdraw a vote within the same epoch via the revokeVote flag.
  4. Deterministic winner selection – selects the pool with the highest vote count that meets quorum, using lexical tie‑break for stability.

Additional improvements:

  • Added environment variables (STRATEGY_REGISTRY_QUORUM, STRATEGY_REGISTRY_EPOCH_MS) to configure quorum and epoch length.
  • Updated tool metadata to expose the new revoke_vote action and revokeVote parameter.
  • Refactored validation logic and introduced helper functions (purgeStaleVotes, hasQuorum, winningPool).
  • Preserved existing verification (is_verified) and voting (vote) capabilities, now with safer semantics.

All changes have been tested manually to verify vote addition, revocation, quorum handling, and correct winner determination across epochs.

Checklist

  • Code builds without TypeScript errors.
  • Manual tests confirm new behaviours.
  • Updated documentation in the tool’s metadata.

Related Issue

“Make strategy_registry resistant to vote manipulation and stale‑strategy capture” – implements the requested lifecycle controls.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@AugistineCreates 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

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.

[Contract] Make strategy_registry resistant to vote manipulation and stale-strategy capture

1 participant