-
Notifications
You must be signed in to change notification settings - Fork 7
feat: integrate tornado cash #2002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
451db65
feat: integrate tornado cash
pikonha c9f71b5
Merge branch 'dev' into feat/tornado-cash-integration
pikonha f542b75
chore: enalbe offchain api returning 400 for the not-supporte ones
pikonha 2a69466
fix(torn): correct quorum calc + governance-config facts (review foll…
Zeugh-eth 4e60b18
fix(torn): reconcile dashboard with quorum + re-vote changes (Codex)
Zeugh-eth d94e2a0
fix: vp based on custody transfers
pikonha cbd82c1
feat(torn): custom-governor write actions — vote + delegate
Zeugh-eth 3086165
fix(indexer): add torn treasury address
pikonha 5cc2176
fix(indexer): title and description parsing
pikonha db66cd3
fix(dashboard): overview resiliance and attack exposure individually …
pikonha d8cdb61
chore: setup memory as postinstall
pikonha 257f918
chore(dashboard): panel min height 400px
pikonha a6694d9
Merge pull request #2006 from blockful/fix/torn-review-quickfixes
pikonha 3031315
feat(tornado-governance-page): first draft
PedroBinotto f1ae0fb
Merge branch 'feat/tornado-cash-integration' into feat/tornado-govern…
PedroBinotto 00f4c26
feat(tornado-governance-page): action tab design adjustments
PedroBinotto 1c07ed3
Merge branch 'feat/tornado-governance' of github.com:blockful/anticap…
PedroBinotto 01a29aa
chore(tornado-governance-page): add tests to utils + id concatenation
PedroBinotto 4ff84b4
fix: remove id concatenation
PedroBinotto 4d96c51
fix: revert scripts alteration
PedroBinotto 2c71302
fix: revert scripts alteration
PedroBinotto c4bc69a
Merge pull request #2012 from blockful/feat/tornado-governance
pikonha 36992d7
chore: changeset
pikonha 032a710
Merge pull request #2009 from blockful/feat/torn-write-actions
pikonha 236fe26
Merge branch 'dev' into feat/tornado-cash-integration
pikonha 593fc57
fix(api): tron governor added to non-circulating
pikonha 1735924
chore: trigger deploy
pikonha 203ea72
chore: disable postinstall
pikonha cdb00d2
test(api): offchain controllers 400
pikonha 2f0aca6
fix(dashboard): delegation amount being correctly parsed
pikonha 2fc7174
fix(api): add torn voting power repository
pikonha 0d2da65
feat(indexer): compute delegation form governor
pikonha 96c0f22
chore: enable preview url on the pr
pikonha 412b9e8
fix(dashboard): allow vote change and disable abstain option
pikonha 3129964
fix(dashboard): uppercase dao id on route redirect
pikonha 6671b7c
chore: add local dev skill and --rw-api dev script flag
pikonha 27aa217
chore(dashboard): remove attack exposure from torn
pikonha 1454329
fix(indexer): handle governor vault transactions aggregation to deleg…
pikonha 1a91eb5
fix(indexer): handle torn vote mutability
pikonha 258eaef
chore(dashboard): change delegated to locked lable
pikonha d3dbc1e
chore: add contents read permission to tests gh action
pikonha 7923fb5
fix(dashboard): torn delegate button gate
pikonha e2202b4
feat(dashboard): torn vote on proposal with delegated tokens
pikonha 1877182
feat(dashboard): enable activity feed for torn
pikonha e8cd7ac
fix(dashboard): vote w/o delegator
pikonha 732e60b
fix(indexer): use locked balance for TORN delegated value when zero
pikonha 937c42f
fix(dashboard): render proposals relying on tx hash
pikonha 873bb45
fix(api): rearrange torn transfer from and to
pikonha bb0a8f0
refactor(indexer): move torn governor from non-circulating to treasury
pikonha 6c4fd5b
chore(dashboard): renamed delegated to blocked on torn tokens
pikonha 2eed136
fix(indexer): exclude torn governance locks from treasury metric
pikonha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@anticapture/dashboard": minor | ||
| --- | ||
|
|
||
| support Tornado Cash proposal creation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@anticapture/api": patch | ||
| --- | ||
|
|
||
| Return unsupported-offchain errors consistently across offchain proposal and vote routes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@anticapture/indexer": minor | ||
| --- | ||
|
|
||
| TORN: route locked voting power to the locker's delegate and move it between delegates on Delegated/Undelegated. TORN emits no DelegateVotesChanged, so per-account voting power is now fully synthesized from lock/unlock Transfers plus delegation shifts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@anticapture/api": patch | ||
| --- | ||
|
|
||
| Normalize TORN lock/unlock transfer direction in voting-power history so the locker (not the custody contract) is shown as the delegator. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@anticapture/dashboard": minor | ||
| --- | ||
|
|
||
| Render Tornado Cash proposal descriptions as Markdown (unwrapping the stringified-JSON body) and show a proposal Info card on the Actions tab for proposals without executable actions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@anticapture/indexer": patch | ||
| --- | ||
|
|
||
| Fix TORN voting power going negative from treasury transfers. TORN derives per-account voting power from lock/unlock Transfers in/out of the governor, but TORN also flows through the governor for treasury purposes (proposal executions, batch grant payouts, the governor↔vault migration). Those were misread as user unlocks and subtracted voting power from recipients that never locked (e.g. proposal #6 funding a staking pool booked a -120k unlock against a contract with zero locked balance), producing negative voting power and phantom locked balances. A custody transfer is now only counted as a lock/unlock when its counterparty is the transaction sender, which is true for genuine `lock()`/`unlock()` calls and false for treasury flows. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@anticapture/indexer": patch | ||
| --- | ||
|
|
||
| Fix TORN votes not reflecting vote changes. TORN's governor lets a voter re-cast to change their vote, but the `Voted` handler used `onConflictDoNothing` on the unique `(voter, proposal)` row and dropped every subsequent cast — so a voter who switched from For to Against still showed as For and the proposal tally kept the stale vote. The handler now overwrites the existing row and moves the voting power between the for/against buckets on a change, while still treating an exact re-processed log (backfill/reorg) as a no-op. Requires a reindex to repopulate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@anticapture/dashboard": minor | ||
| --- | ||
|
|
||
| Make TORN vote recasting reachable (show "Change your vote" on already-voted onchain proposals when the DAO allows changing votes) and hide the Abstain option for Tornado Cash, whose binary governor rejects abstain votes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@anticapture/api": patch | ||
| "@anticapture/dashboard": patch | ||
| --- | ||
|
|
||
| Fix TORN historical voting power rows being rendered as bogus zero-address delegations. TORN derives voting power directly from Transfers, so each history row shares the Transfer's log index, which the generic repository's strict `<` join never matched. Added a dedicated TORN voting-power repository that links the causing event at `logIndex <= row logIndex`. Dashboard also formats the auto-delegation fallback amount instead of dumping the raw delta. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@anticapture/indexer": minor | ||
| "@anticapture/api": minor | ||
| "@anticapture/dashboard": minor | ||
| --- | ||
|
|
||
| Integrate Tornado Cash DAO (TORN): custom stake-to-vote indexer (lock-based delegated supply, timestamp governance), timestamp-based proposal-status API client, and dashboard config/icon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| name: local-dev | ||
| description: Use when you need to hit the running local stack (API, gateful, dashboard, indexer) to test or verify a change. Covers scripts/dev.sh, hot reload, and the ports each service listens on. | ||
| --- | ||
|
|
||
| # Local Dev Stack | ||
|
|
||
| The local stack is started with `scripts/dev.sh` (usually already running — check the | ||
| ports before starting your own). **All services hot-reload on file save** — after | ||
| editing source you do NOT need to restart; just re-hit the endpoint. | ||
|
|
||
| ## Start it | ||
|
|
||
| ```bash | ||
| ./scripts/dev.sh <dao> # e.g. tornado, uniswap, gitcoin, scroll, shutter, compound | ||
| ./scripts/dev.sh <dao> --indexer # also run the indexer for that DAO | ||
| ./scripts/dev.sh <dao> --debug-api # wait for API from IDE debugger instead of spawning it | ||
| ./scripts/dev.sh # no DAO → API skipped, uses DAO_API_* from .env | ||
| ``` | ||
|
|
||
| ### Railway env (per service) | ||
|
|
||
| By **default all services run locally** (env from `.env`). Opt into `railway run -e dev` | ||
| env injection per service: | ||
|
|
||
| | Flag | API | Gateful | | ||
| | -------------- | ------- | ------- | | ||
| | _(none)_ | local | local | | ||
| | `--rw-api` | railway | local | | ||
| | `--rw-gateful` | local | railway | | ||
| | `--rw` | railway | railway | | ||
|
|
||
| `--rw-api` falls back to `.env` if the Railway service isn't found. Relayer and | ||
| Address Enrichment always use `railway run` when available. | ||
|
|
||
| On startup it **kills anything already on the ports below**, so a second run replaces | ||
| the first. | ||
|
|
||
| ## Ports | ||
|
|
||
| | Service | Port | URL | Notes | | ||
| | ------------------ | ----- | ---------------------- | ----------------------------------- | | ||
| | API | 42069 | http://localhost:42069 | only when a `<dao>` is passed | | ||
| | Indexer | 42070 | http://localhost:42070 | only with `--indexer` | | ||
| | Gateful (gateway) | 4001 | http://localhost:4001 | always | | ||
| | Dashboard | 3000 | http://localhost:3000 | always | | ||
| | Address Enrichment | 3001 | http://localhost:3001 | optional, skipped if no Railway svc | | ||
| | Relayer (ENS) | 3002 | http://localhost:3002 | ENS only | | ||
|
|
||
| Client SDK codegen runs in watch mode (no port) and regenerates on API/gateful changes. | ||
|
|
||
| ## Testing tips | ||
|
|
||
| - **Test the API directly** at `http://localhost:42069` — OpenAPI/REST. | ||
| - **Test the aggregated surface** through gateful at `http://localhost:4001`. | ||
| - The DAO is identified by short id in env: `DAO_API_<UPPER_ID>` (e.g. `DAO_API_TORN`, | ||
| `DAO_API_UNI`). dev.sh exports these automatically. | ||
| - When the API restarts, a watchdog touches `apps/gateful/src/_dev-reload.ts` so gateful | ||
| reloads and re-points at the recovered API. | ||
|
|
||
| Stop everything with Ctrl+C (dev.sh traps it and kills the whole process group). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| export const TORNGovernorAbi = [ | ||
| { | ||
| type: "function", | ||
| name: "QUORUM_VOTES", | ||
| inputs: [], | ||
| outputs: [{ type: "uint256" }], | ||
| stateMutability: "view", | ||
| }, | ||
| { | ||
| type: "function", | ||
| name: "VOTING_DELAY", | ||
| inputs: [], | ||
| outputs: [{ type: "uint256" }], | ||
| stateMutability: "view", | ||
| }, | ||
| { | ||
| type: "function", | ||
| name: "VOTING_PERIOD", | ||
| inputs: [], | ||
| outputs: [{ type: "uint256" }], | ||
| stateMutability: "view", | ||
| }, | ||
| { | ||
| type: "function", | ||
| name: "PROPOSAL_THRESHOLD", | ||
| inputs: [], | ||
| outputs: [{ type: "uint256" }], | ||
| stateMutability: "view", | ||
| }, | ||
| { | ||
| type: "function", | ||
| name: "EXECUTION_DELAY", | ||
| inputs: [], | ||
| outputs: [{ type: "uint256" }], | ||
| stateMutability: "view", | ||
| }, | ||
| { | ||
| type: "function", | ||
| name: "EXECUTION_EXPIRATION", | ||
| inputs: [], | ||
| outputs: [{ type: "uint256" }], | ||
| stateMutability: "view", | ||
| }, | ||
| ] as const; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.