Skip to content

feat: integrate tornado cash#2002

Merged
pikonha merged 51 commits into
devfrom
feat/tornado-cash-integration
Jul 1, 2026
Merged

feat: integrate tornado cash#2002
pikonha merged 51 commits into
devfrom
feat/tornado-cash-integration

Conversation

@pikonha

@pikonha pikonha commented Jun 28, 2026

Copy link
Copy Markdown
Member

No description provided.

@pikonha pikonha self-assigned this Jun 28, 2026
@vercel

vercel Bot commented Jun 28, 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 Jul 1, 2026 9:15pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
anticapture Ignored Ignored Jul 1, 2026 9:15pm

Request Review

@railway-app railway-app Bot temporarily deployed to anticapture-infra / anticapture-pr-2002 June 28, 2026 23:13 Destroyed
@railway-app

railway-app Bot commented Jun 28, 2026

Copy link
Copy Markdown

🚅 Deployed to the anticapture-pr-2002 environment in anticapture-infra

Service Status Web Updated (UTC)
otelcol ✅ Success (View Logs) Jul 1, 2026 at 9:14 pm
nouns-indexer 🕐 Queued (View Logs) Jul 1, 2026 at 9:14 pm
uniswap-indexer 🕐 Queued (View Logs) Jul 1, 2026 at 9:14 pm
mcp-server 🕐 Queued (View Logs) Jul 1, 2026 at 9:14 pm
authful 🕐 Queued (View Logs) Web Jul 1, 2026 at 9:14 pm
scroll-indexer 🕐 Queued (View Logs) Jul 1, 2026 at 9:14 pm
fluid-indexer 🕒 Building (View Logs) Jul 1, 2026 at 9:14 pm
prometheus ✅ Success (View Logs) Web Jul 1, 2026 at 9:14 pm
alertmanager 🕐 Queued (View Logs) Web Jul 1, 2026 at 9:14 pm
compound-indexer 🕐 Queued (View Logs) Jul 1, 2026 at 9:14 pm
tempo 🕐 Queued (View Logs) Jul 1, 2026 at 9:14 pm
gitcoin-indexer 🕐 Queued (View Logs) Jul 1, 2026 at 9:14 pm
loki 🕐 Queued (View Logs) Web Jul 1, 2026 at 9:14 pm
gateful 🕒 Building (View Logs) Web Jul 1, 2026 at 9:14 pm
aave-indexer 🕒 Building (View Logs) Jul 1, 2026 at 9:14 pm
lil-nouns-indexer 🕒 Building (View Logs) Jul 1, 2026 at 9:13 pm
obol-indexer 🕒 Building (View Logs) Jul 1, 2026 at 9:13 pm
ens-indexer 🕒 Building (View Logs) Jul 1, 2026 at 9:13 pm
tornado-indexer 🕒 Building (View Logs) Jul 1, 2026 at 9:13 pm
grafana 🕒 Building (View Logs) Web Jul 1, 2026 at 9:13 pm
shutter-indexer 🕒 Building (View Logs) Jul 1, 2026 at 9:13 pm
gitcoin-api ✅ Success (View Logs) Jul 1, 2026 at 8:52 pm
shutter-api ✅ Success (View Logs) Jul 1, 2026 at 8:49 pm
aave-api ✅ Success (View Logs) Jul 1, 2026 at 8:49 pm
lil-nouns-api ✅ Success (View Logs) Jul 1, 2026 at 8:49 pm
compound-api ✅ Success (View Logs) Jul 1, 2026 at 8:48 pm
uniswap-api ✅ Success (View Logs) Jul 1, 2026 at 8:48 pm
scroll-api ✅ Success (View Logs) Jul 1, 2026 at 8:47 pm
ens-api ✅ Success (View Logs) Jul 1, 2026 at 8:47 pm
nouns-api ✅ Success (View Logs) Jul 1, 2026 at 8:47 pm
fluid-api ✅ Success (View Logs) Jul 1, 2026 at 8:47 pm
obol-api ✅ Success (View Logs) Jul 1, 2026 at 8:47 pm
tornado-api ✅ Success (View Logs) Jul 1, 2026 at 8:46 pm
address-enrichment ✅ Success (View Logs) Web Jun 30, 2026 at 7:04 pm
mcp-docs ✅ Success (View Logs) Jun 29, 2026 at 1:13 pm
ens-indexer-offchain ✅ Success (View Logs) Jun 29, 2026 at 1:09 pm
mcp-proxy ✅ Success (View Logs) Web Jun 29, 2026 at 1:08 pm
compound-indexer-offchain ✅ Success (View Logs) Jun 29, 2026 at 1:08 pm
gitcoin-indexer-offchain ✅ Success (View Logs) Jun 29, 2026 at 1:05 pm
uniswap-indexer-offchain ✅ Success (View Logs) Jun 29, 2026 at 1:05 pm
nodeful 🚨 Crashed (View Logs) Jun 28, 2026 at 11:20 pm
ens-relayer ✅ Success (View Logs) Jun 28, 2026 at 11:16 pm
erpc ✅ Success (View Logs) Web Jun 28, 2026 at 11:16 pm

@Zeugh-eth Zeugh-eth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread apps/indexer/src/indexer/torn/governor.ts Outdated
Comment thread apps/api/src/clients/torn/index.ts Outdated
Comment thread apps/dashboard/shared/dao-config/torn.ts Outdated
Comment thread apps/dashboard/shared/dao-config/torn.ts Outdated
Comment thread apps/dashboard/shared/dao-config/torn.ts Outdated
@Zeugh-eth

Copy link
Copy Markdown
Member

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.
@Zeugh-eth

This comment was marked as resolved.

Zeugh-eth and others added 3 commits June 29, 2026 23:08
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).

@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: 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".

Comment thread apps/indexer/src/indexer/torn/governor.ts Outdated
Comment thread apps/indexer/src/indexer/torn/governor.ts

@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: 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".

Comment thread apps/dashboard/features/governance/utils/voteOnProposal.ts Outdated
@railway-app railway-app Bot temporarily deployed to anticapture-infra / anticapture-pr-2002 July 1, 2026 17:36 Destroyed

@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: 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".

Comment on lines +70 to +78
.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}
)`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment thread scripts/dev.sh

@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: 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".

Comment thread apps/indexer/src/indexer/torn/shared.ts
Comment thread apps/indexer/src/indexer/torn/erc20.ts Outdated

@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: 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".

Comment thread apps/indexer/src/indexer/torn/erc20.ts Outdated
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>
@railway-app railway-app Bot temporarily deployed to anticapture-infra / anticapture-pr-2002 July 1, 2026 21:13 Destroyed
@pikonha pikonha merged commit 2d2a736 into dev Jul 1, 2026
54 checks passed
@pikonha pikonha deleted the feat/tornado-cash-integration branch July 1, 2026 21:19
@github-actions github-actions Bot mentioned this pull request Jul 1, 2026

@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: 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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.

3 participants