Skip to content
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

fix: tally result index collision #583

Closed
wants to merge 0 commits into from
Closed

Conversation

kittybest
Copy link
Collaborator

@kittybest kittybest commented Jan 8, 2025

Description

This is to solve the tallyResult id collision on the subgraph, meanwhile make sure the interface works well after this change.

Additional Notes

I found that the interface mapping result with tally result never uses the result id, that's why we didn't find this problem before. We need to have 100% confidence that the subgraph returns tally result 1 by 1 following the index of the projects.
(So actually, maybe it's better that we use the result.id instead of the index of the loop?)

see here:

const results = tallyData.results.reduce((acc, tally, index) => {
const project = projects[index];
if (project) {
acc.set(project.id, { votes: Number(tally.result), voters: 0 });
}
return acc;
}, new Map<string, { votes: number; voters: number }>());

Related issue(s)

close #559

Confirmation

Important

We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical error feel free to message the team.

Copy link

vercel bot commented Jan 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
maci-platform ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 7:42pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

TallyResult ID Collision Across Multiple Polls
1 participant