Skip to content

fix: penalty worker#458

Merged
functor-flow merged 1 commit into
devfrom
fix-penalty-worker
Feb 13, 2026
Merged

fix: penalty worker#458
functor-flow merged 1 commit into
devfrom
fix-penalty-worker

Conversation

@functor-flow
Copy link
Copy Markdown
Collaborator

What was wrong

  • Penalty factor selection was wrong: it could return 100 even when pending votes were 20.
  • Penalty processing flip-flopped between apply/reset due to alternating iteration logic.
  • Penalty tx flow didn’t wait for finalization.
  • One lint warning in torus-bridge test (afterEach unused).

What changed

  • Rewrote pendingPenalizations to compute factor from the actual pending vote set (executed=false, deleted_at IS NULL)
    and select nth-highest deterministically.
  • Restored reset-to-0 logic, but made it correct:
    • reset only if on-chain penalty >0 and active vote support is below threshold.
  • Removed odd/even toggle; now apply+reset candidates are computed each cycle and merged once.
  • Updated penalizeAgent to use tx tracker and wait for finalized before success.
  • Removed unused afterEach import in bridge test.

@functor-flow functor-flow requested a review from a team as a code owner February 13, 2026 18:08
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apostle-swarm Ready Ready Preview, Comment Feb 13, 2026 6:08pm
prediction-swarm Ready Ready Preview, Comment Feb 13, 2026 6:08pm
torus-bridge Ready Ready Preview, Comment Feb 13, 2026 6:08pm
torus-governance Ready Ready Preview, Comment Feb 13, 2026 6:08pm
torus-portal Ready Ready Preview, Comment Feb 13, 2026 6:08pm
torus-wallet Ready Ready Preview, Comment Feb 13, 2026 6:08pm

Request Review

@functor-flow functor-flow merged commit 11f0a21 into dev Feb 13, 2026
50 of 57 checks passed
@functor-flow functor-flow deleted the fix-penalty-worker branch February 13, 2026 18:19
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.

2 participants