Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes governance-related issues including ENS address resolution, voter count caching, and proposal voting functionality. The changes introduce a new abstraction layer (VoteProposalData) to decouple voting UI components from data source implementations (graph vs cache), resolve block hash to block number to fix RPC provider errors, and add ENS name resolution for cached proposal voters.
Changes:
- Converts block hashes to block numbers in service calls to resolve "number too large" errors with RPC providers
- Introduces
VoteProposalDatatype to abstract voting data from different sources (graph/cache) - Adds ENS name resolution for cached governance voters and creates
getUserVoteFromCachefunction
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/services/WalletBalanceService.ts | Converts block hash to block number for governance token balance queries |
| src/services/GovernanceService.ts | Converts block hash to block number for token power queries |
| src/services/GovernanceCacheService.ts | Adds votingMachineAddress field and getUserVoteFromCache function |
| src/modules/governance/types.ts | Defines new VoteProposalData type and adds ensName to VoteDisplay |
| src/modules/governance/adapters.ts | Implements adapter functions to build VoteProposalData from different sources |
| src/modules/governance/proposal/VoteInfo.tsx | Refactors to use VoteProposalData instead of full Proposal object |
| src/modules/governance/proposal/ProposalOverview.tsx | Comments out proposal author display |
| src/hooks/useModal.tsx | Updates modal types to use VoteProposalData |
| src/hooks/governance/useProposalVotes.ts | Extracts ENS_REVERSE_REGISTRAR constant |
| src/hooks/governance/useGovernanceProposals.ts | Adds ENS resolution for cache voters and fetches user vote for cache detail |
| src/components/transactions/GovVote/GovVoteModalContent.tsx | Updates to use VoteProposalData type |
| src/components/transactions/GovVote/GovVoteActions.tsx | Updates to use VoteProposalData and adds query invalidation |
| pages/governance/v3/proposal/index.governance.tsx | Simplifies votingChainId extraction using new abstraction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.log('[GovVote] proposal data:', { | ||
| proposalId, | ||
| blockHash, | ||
| votingChainId, | ||
| votingMachineAddress, | ||
| support, | ||
| user, | ||
| assets, | ||
| tokenPowers, | ||
| }); |
There was a problem hiding this comment.
Debug console.log statement should be removed before merging to production. This logging statement appears to have been added for debugging purposes but should not be included in production code.
| console.log('[GovVote] proposal data:', { | |
| proposalId, | |
| blockHash, | |
| votingChainId, | |
| votingMachineAddress, | |
| support, | |
| user, | |
| assets, | |
| tokenPowers, | |
| }); |
| const match = raw.match(/FixedBytes\((0x[a-fA-F0-9]+)/); | ||
| return match ? match[1] : raw; |
There was a problem hiding this comment.
The regex pattern for parseFixedBytes only captures hex strings but doesn't validate the full format strictly. If the input is a plain hex string (not in FixedBytes format), it will be returned as-is, which is the intended fallback behavior. However, consider adding validation to ensure the hex string format is valid (starts with 0x and contains only valid hex characters) to catch malformed inputs early.
| const match = raw.match(/FixedBytes\((0x[a-fA-F0-9]+)/); | |
| return match ? match[1] : raw; | |
| const trimmed = raw.trim(); | |
| // Strictly match the full FixedBytes(...) format and extract the hex value | |
| const fixedBytesMatch = trimmed.match(/^FixedBytes\(\s*(0x[0-9a-fA-F]+)\s*,\s*\d+\s*\)$/); | |
| if (fixedBytesMatch) { | |
| return fixedBytesMatch[1]; | |
| } | |
| // Fallback: accept only well-formed plain hex strings (e.g. "0xabc123") | |
| const plainHexPattern = /^0x[0-9a-fA-F]*$/; | |
| if (plainHexPattern.test(trimmed)) { | |
| return trimmed; | |
| } | |
| // Malformed input: not FixedBytes format and not a valid hex string | |
| return null; |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8cf9c83e6
ℹ️ 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".
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
General Changes
Developer Notes
Add any notes here that may be helpful for reviewers.
Reviewer Checklist
Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate any downstream issues that may occur.
.env.examplefile as well as the pertinant.github/actions/*files