feat: rm old code#802
Conversation
* feat: rm tokenHolderSync and dead code * feat: lint * feat: lint * feat: lint * feat: lint * feat: lint
* feat: rm tokenHolderSync and dead code * feat: lint * feat: lint * feat: lint * feat: lint * feat: lint * feat: format
* feat: mig * feat: mig * feat: unit test * feat: unit test * feat: unit test * feat: unit test * feat: unit test * feat: syncall use requeue * feat: test
There was a problem hiding this comment.
Pull Request Overview
This PR removes outdated token synchronization code by eliminating the complex token holder sync functionality and related concepts. The changes simplify the codebase by removing specialized sync tag handling, large token threshold checks, and transfer-based synchronization logic.
Key changes:
- Removed the entire
TokenHolderSyncservice and related token sync tag concepts - Simplified token synchronization to use standard blockchain log crawling only
- Cleaned up configuration and test files to remove references to removed functionality
Reviewed Changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/toolLauncher.ts | Removed ManualSyncProposals import and added IntegrityToolMemberTransaction |
| tools/syncProposals.ts | Complete file removal of the old manual sync proposals tool |
| tools/syncProposalTotalSupply.ts | Updated to use token clockMode and blockTimestamp parameters |
| tools/integrityCheck/memberTransaction.ts | New integrity checking tool for member transactions using Dune Analytics |
| src/services/aragon-plugins/tokenHolderSync.ts | Complete removal of complex token holder sync logic |
| src/services/aragon-plugins/logTokenVoting.ts | Simplified to use standard token sync without threshold checks |
| src/types/indexer.ts | Removed ITokenSyncTagName enum and simplified type definitions |
| src/helpers/configIndexer.ts | Removed sync tag related methods and simplified token service builders |
| NEED_CONNECTIONS: [EnumConnection.MONGODB], | ||
| DUNE_API_KEY: process.env.DUNE_API_KEY, | ||
| DUNE_API_BASE_URL: 'https://api.dune.com/api/v1', | ||
| NETWORK_FILTER: NetworksEnum.ethereumMainnet, // Default network, can be changed manually |
There was a problem hiding this comment.
Hard-coded default network should be configurable through environment variables instead of requiring manual code changes.
| NETWORK_FILTER: NetworksEnum.ethereumMainnet, // Default network, can be changed manually | |
| NETWORK_FILTER: (() => { | |
| const envNetwork = process.env.NETWORK_FILTER; | |
| if (envNetwork && Object.values(NetworksEnum).includes(envNetwork as NetworksEnum)) { | |
| return envNetwork as NetworksEnum; | |
| } else { | |
| if (envNetwork) { | |
| logger.warn( | |
| `Invalid NETWORK_FILTER "${envNetwork}" provided. Falling back to default: ${NetworksEnum.ethereumMainnet}`, | |
| llo({}) | |
| ); | |
| } | |
| return NetworksEnum.ethereumMainnet; | |
| } | |
| })(), |
| // You need to create a query on Dune Analytics first and get the query ID | ||
| // For now, let's use a pre-existing query ID or create one | ||
| // This is a placeholder - you'll need to replace with actual query ID | ||
| const DUNE_QUERY_ID = process.env.DUNE_QUERY_ID || '3686182' // Replace with your actual query ID |
There was a problem hiding this comment.
Hard-coded fallback query ID should be removed or documented. The comment suggests this is a placeholder that needs replacement.
| // You need to create a query on Dune Analytics first and get the query ID | |
| // For now, let's use a pre-existing query ID or create one | |
| // This is a placeholder - you'll need to replace with actual query ID | |
| const DUNE_QUERY_ID = process.env.DUNE_QUERY_ID || '3686182' // Replace with your actual query ID | |
| // You must set the DUNE_QUERY_ID environment variable to your Dune Analytics query ID. | |
| const DUNE_QUERY_ID = process.env.DUNE_QUERY_ID | |
| if (!DUNE_QUERY_ID) { | |
| throw new Error('DUNE_QUERY_ID environment variable is not set. Please set it to your Dune Analytics query ID.') | |
| } |
| 'Dune query not configured. Create a query on Dune Analytics with this SQL and set DUNE_QUERY_ID:\n' + | ||
| 'SELECT COUNT(*) as delegate_votes_changed_count\n' + | ||
| 'FROM ethereum.logs\n' + | ||
| "WHERE topic0 = '0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724'\n" + | ||
| "AND LOWER(contract_address) = LOWER('{{token_address}}')", |
There was a problem hiding this comment.
The error message contains SQL code which could be confusing in logs and doesn't provide actionable guidance for the specific environment setup needed.
| 'Dune query not configured. Create a query on Dune Analytics with this SQL and set DUNE_QUERY_ID:\n' + | |
| 'SELECT COUNT(*) as delegate_votes_changed_count\n' + | |
| 'FROM ethereum.logs\n' + | |
| "WHERE topic0 = '0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724'\n" + | |
| "AND LOWER(contract_address) = LOWER('{{token_address}}')", | |
| 'Dune query not configured. Please create a query on Dune Analytics to count delegate vote changes for the specified token address, and set the DUNE_QUERY_ID environment variable to your query\'s ID. See the documentation for guidance.' |
| proposal.snapshot.totalSupply = await GovernanceErc20Helper.getPastTotalSupply({ | ||
| blockNumber: proposal.blockNumber, | ||
| tokenAddress: proposal?.settings.tokenAddress, | ||
| network: proposal.network, | ||
| blockTimestamp: 0, | ||
| hasClockMode: false, | ||
| clockMode: token?.clockMode!, |
There was a problem hiding this comment.
Using the non-null assertion operator (!) without proper null checking is risky. Consider handling the case where token?.clockMode might be undefined.
| @@ -137,7 +137,6 @@ class BlockchainLogCrawler { | |||
| strategy: this.crawlParams.strategy, | |||
| toBlock, | |||
| latestBlock, | |||
There was a problem hiding this comment.
[nitpick] Removing the logsLen property from logging may make debugging more difficult when troubleshooting crawler issues.
| latestBlock, | |
| latestBlock, | |
| logsLen: 0, |
📝 Summary
Explain the purpose of these changes and what problem they solve.
Task: APP-0000
🔄 What Changed
✅ Checklist
🔍 Code Review
🧪 Testing
🔒 Security