-
Notifications
You must be signed in to change notification settings - Fork 13
feat: add vp value to leaderboard #571
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
base: master
Are you sure you want to change the base?
Conversation
feat: add index to vp_value fix: handle high precision computation perf: fix: handle error fix: increase last vote cb
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds voting power value tracking to the leaderboard system by introducing a new vp_value column that accumulates the total voting power value for each user across spaces and proposals.
- Adds
vp_valuecolumn to the leaderboard table schema with appropriate indexing - Updates vote creation logic to increment the user's voting power value in the leaderboard
- Implements voting power value decrementation when proposals are deleted
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/schema.sql | Adds vp_value DECIMAL column and index to leaderboard table |
| src/writer/vote.ts | Updates vote creation to track and increment voting power values in leaderboard |
| src/writer/delete-proposal.ts | Implements batch processing to decrement voting power values when proposals are deleted |
| src/helpers/entityValue.ts | Refactors vote value calculation using reduce for better readability |
Toward https://github.com/snapshot-labs/workflow/issues/625
Depends on #566
This PR will add a new
vp_valuecolumn to the leaderboard, tracking the user's total voting power value across spaces and proposalsValue will be updated on:
Test
Add the new column in the database
With a copy of the database with almost 10M of rows, this query is pretty fast, less than 10s
Notes