Skip to content

chore: introduce alchemy endpoint webhook#479

Open
shazarre wants to merge 1 commit intomainfrom
shazarre/chore/alchemy_webhook_endpoint
Open

chore: introduce alchemy endpoint webhook#479
shazarre wants to merge 1 commit intomainfrom
shazarre/chore/alchemy_webhook_endpoint

Conversation

@shazarre
Copy link
Copy Markdown
Contributor

@shazarre shazarre commented Apr 9, 2026

TBD

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
celo-mondo Ready Ready Preview Apr 13, 2026 7:55am

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

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

Comment on lines +163 to +165
eq(eventsAlchemyTable.eventName, 'ProposalVoted'),
eq(eventsAlchemyTable.eventName, 'ProposalVotedV2'),
),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment on lines +171 to +174
for (const event of voteEvents) {
const decoded = decodeVoteEventLog(event as unknown as Event);
if (!decoded) continue;
voterToVotes[decoded.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 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant