Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c46e91df39
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| eq(eventsAlchemyTable.eventName, 'ProposalVoted'), | ||
| eq(eventsAlchemyTable.eventName, 'ProposalVotedV2'), | ||
| ), |
There was a problem hiding this comment.
Include revoked vote events in tally recomputation
The webhook marks ProposalVoteRevoked/ProposalVoteRevokedV2 as vote events, but upsertAlchemyVotes only reloads ProposalVoted and ProposalVotedV2. In the common case where a voter revokes without recasting, this keeps their previous cast vote in votes_alchemy, so totals stay inflated after a revoke webhook is processed. The recomputation query needs to account for revoke events (and clear that voter’s vote state) to keep on-chain and stored totals aligned.
Useful? React with 👍 / 👎.
| for (const event of voteEvents) { | ||
| const decoded = decodeVoteEventLog(event as unknown as Event); | ||
| if (!decoded) continue; | ||
| voterToVotes[decoded.account] = { |
There was a problem hiding this comment.
Order vote events before last-write-wins reduction
This reducer overwrites each voter’s entry with whichever event is seen last, but the preceding SELECT has no ORDER BY, so PostgreSQL can return rows in arbitrary order. If a voter has multiple vote events for one proposal, totals can drift because an older event may be applied after a newer one. Ensure vote events are processed in deterministic chronological order before applying overwrite semantics.
Useful? React with 👍 / 👎.
TBD