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 #584

Closed
wants to merge 0 commits into from
Closed

Conversation

kittybest
Copy link
Contributor

@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 }>());

Meanwhile, the rebase main is not working maybe because the template is already been used in this PR? (not sure)
So using merge main here. Tell me if we need to squash commits. (using rebase would close this PR)

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 8:09pm

@kittybest kittybest self-assigned this Jan 8, 2025
@kittybest kittybest added the bug Something isn't working label Jan 8, 2025
@kittybest kittybest force-pushed the fix/tally-id-collision branch from dbfa74a to bda7a53 Compare January 8, 2025 20:03
@kittybest kittybest closed this Jan 10, 2025
@kittybest kittybest force-pushed the fix/tally-id-collision branch from bda7a53 to f0ad8f3 Compare January 10, 2025 12:31
@kittybest kittybest deleted the fix/tally-id-collision branch January 10, 2025 12:42
@kittybest kittybest mentioned this pull request Jan 10, 2025
2 tasks
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