Skip to content

fix(torn): correct quorum calc + governance-config facts (review follow-up)#2006

Merged
pikonha merged 2 commits into
feat/tornado-cash-integrationfrom
fix/torn-review-quickfixes
Jun 30, 2026
Merged

fix(torn): correct quorum calc + governance-config facts (review follow-up)#2006
pikonha merged 2 commits into
feat/tornado-cash-integrationfrom
fix/torn-review-quickfixes

Conversation

@Zeugh-eth

Copy link
Copy Markdown
Member

What

Small, factually-verifiable corrections to the TORN integration, split out from my review on #2002 so they're easy to review/merge. Targets feat/tornado-cash-integration to fold into #2002.

Included (low-risk, verified against the on-chain contract)

  • apps/api/src/clients/torn/index.tscalculateQuorum: count forVotes + againstVotes. Governance.state() reaches quorum on forVotes + againstVotes >= QUORUM_VOTES (both sides count), so returning forVotes alone could mislabel NO_QUORUM. Status docstring updated to match.
  • apps/dashboard/shared/dao-config/torn.ts:
    • Proposal threshold copy: 1,000 TORN (was 25,000 — that's the old quorum figure; current PROPOSAL_THRESHOLD = 1e21).
    • Voting delay copy: 75 seconds (was "~1 block (~12 seconds)"; on-chain VOTING_DELAY = 75). Risk rating left HIGH — 75s is still very short.
    • rules.changeVote: true — re-voting is allowed on-chain (_castVote overwrites the prior receipt while a proposal is Active).

Deliberately NOT included (need your call / testing)

  • Re-vote tally handling in apps/indexer/src/indexer/torn/governor.ts: the onConflictDoNothing on (voter, proposalId) drops genuine re-votes (not just backfill replays), so tallies can drift from chain. A correct fix must stay idempotent on replay (e.g. compare stored txHash/logIndex) — left to you since it needs an indexer run to verify.
  • VOTE_MUTABILITY risk field still reads "does not allow changing votes"; with changeVote now true, that field's copy/rating likely wants updating too — left as a product/risk-scoring call.
  • rules.logic: "For" is now inconsistent with the quorum fix; "All Votes Cast" (for+against, abstain always 0) would match — didn't change it to avoid touching the enum without your confirmation.

No behavioral logic changed in the indexer; CI will typecheck. Happy to fold in the indexer re-vote fix if you want it here.

…ow-up)

- TORNClient.calculateQuorum: count forVotes + againstVotes (matches the
  on-chain Governance.state() quorum rule); update status docstring.
- dao-config: proposal threshold 1,000 TORN (was 25,000); voting delay 75s
  (was ~1 block/12s); changeVote=true (re-voting overwrites the prior
  receipt on-chain).

Refs review on #2002.
@railway-app

railway-app Bot commented Jun 29, 2026

Copy link
Copy Markdown

This PR was not deployed automatically as @Zeugh-eth does not have access to the Railway project.

In order to get automatic PR deploys, please add @Zeugh-eth to your workspace on Railway.

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
anticapture-storybook Ready Ready Preview, Comment Jun 29, 2026 10:31pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
anticapture Ignored Ignored Jun 29, 2026 10:31pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a69466b3d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/api/src/clients/torn/index.ts
Comment thread apps/dashboard/shared/dao-config/torn.ts
- rules.logic: "All Votes Cast" (was "For") to match calculateQuorum now
  counting forVotes + againstVotes — dashboard no longer explains the
  opposite quorum rule.
- VOTE_MUTABILITY: LOW + copy reflecting that TORN allows changing votes
  (consistent with rules.changeVote=true); drop stale requirements.
- attackExposure GOV_FRONTEND_RESILIENCE: remove the 'immutable votes'
  claim (votes are mutable) — keeps the unhardened-interface point.
@Zeugh-eth

Copy link
Copy Markdown
Member Author

Both addressed in 4e60b18e (thanks @codex):

  • quorum labelrules.logic"All Votes Cast" so the dashboard (MetricsCard / governance-settings) matches calculateQuorum now counting for+against.
  • vote mutabilityVOTE_MUTABILITY now LOW with copy reflecting that TORN allows changing votes (consistent with changeVote: true); also fixed the attackExposure line that claimed 'immutable votes'.

This makes the quickfix PR internally consistent. The deeper items (indexer re-vote tally, Vault custody, per-account voting power, target-verification detector) are tracked for the full implementation.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@Zeugh-eth

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 4e60b18e94

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@pikonha pikonha merged commit a6694d9 into feat/tornado-cash-integration Jun 30, 2026
9 of 11 checks passed
@pikonha pikonha deleted the fix/torn-review-quickfixes branch June 30, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants