feat: integrate tornado cash#2002
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
🚅 Deployed to the anticapture-pr-2002 environment in anticapture-infra
|
Zeugh-eth
left a comment
There was a problem hiding this comment.
Independent review from external research on the TORN governance model — verified against tornadocash/tornado-governance (impl GovernanceProposalStateUpgrade, on-chain version 5.proposal-state-patch).
Great work overall — the custom stake-to-vote handling is clean and the backfill matches chain. A few correctness items below where the indexed/derived behaviour diverges from the contract, with click-to-apply suggestions for the one-liners. A companion doc covering the full DAO anatomy, tech funnel and remaining-gap roadmap is coming as a separate PR into this branch (apps/indexer/src/indexer/torn/RESEARCH.md, alongside your INTEGRATION.md).
Context: these surfaced while mapping what's needed to flag the 2026-06-25 Proposal 67 look-alike-address attack.
Just want be clear this is a PR from aa local opus agent during a research step, to contribute to the repo, but while on another stream of work. This is not all reviewed/verified, and might just be wrong, happy to help verify after the game lol |
…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.
- 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.
685561b to
d94e2a0
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Mirrors the SHU custom-governor pattern so Tornado's write flows work: - voteOnProposal: add tornVoteHandler -> castVote(uint256, bool) on the governor (for=true/against=false, no abstain); route via getVoteHandler. - delegateTo: route TORN delegation to the governor's delegate(address) (delegatedTo mapping), not the ERC20Votes token. Verified on a mainnet fork (forge): castVote(bool) + governor.delegate succeed; the old OZ uint8/token-delegate paths revert. Proposal creation left ENS-gated (TORN's contract-as-proposal model needs its own form).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a91eb56fc
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2202b4338
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1877182d30
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .leftJoin( | ||
| transfer, | ||
| sql`${votingPowerHistory.transactionHash} = ${transfer.transactionHash} | ||
| AND ${transfer.logIndex} = ( | ||
| SELECT MAX(${transfer.logIndex}) | ||
| FROM ${transfer} | ||
| WHERE ${transfer.transactionHash} = ${votingPowerHistory.transactionHash} | ||
| AND ${transfer.logIndex} <= ${votingPowerHistory.logIndex} | ||
| )`, |
There was a problem hiding this comment.
Normalize TORN lock transfer direction
When this TORN-only repository starts returning the underlying lock/unlock Transfer, the dashboard's existing VotingPowerHistoryTable treats transfer gains as coming from transfer.to and losses as coming from transfer.from. For TORN locks the transfer is wallet → governor/vault, and for unlocks it is governor/vault → wallet, so every lock/unlock history row will display the custody contract as the delegator instead of the locker who caused the voting-power change. Normalize the transfer relation for TORN custody transfers or add TORN-specific direction handling before exposing these rows.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 937c42f32f
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c4fd5b451
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Genuine lock/unlock transfers and governor<->vault internal moves no longer count as treasury flows; governor restored as lock custody so pre-vault locks are tracked, attributed to non-circulating supply. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2eed136e8e
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Undelegation: delegate reverts to self, previous delegate was `from` | ||
| await delegateChanged(context, daoId, { | ||
| delegator: account, | ||
| delegate: account, |
There was a problem hiding this comment.
Clear TORN delegation instead of writing self-delegation
When a TORN Undelegated event is processed, passing delegate: account into the generic delegateChanged path writes account_balance.delegate = account and inserts a self-delegation. The governor clears delegatedTo[account] on undelegation, so after this scenario the API delegators query can report the voter as their own delegator; even if the modal's no-delegator fallback is fixed, the TORN voting flow can then pass that self address in castDelegatedVote's from list, which reverts because self-delegation is forbidden. Store the cleared/zero delegate for the delegation row while still moving voting power back to the account.
Useful? React with 👍 / 👎.
No description provided.