Skip to content
This repository has been archived by the owner on Feb 24, 2025. It is now read-only.

Obasilakis/save voter active votes to db #581

Merged
merged 39 commits into from
Mar 17, 2022

Conversation

obasilakis
Copy link

@obasilakis obasilakis commented Mar 14, 2022

GitHub keywords to close any associated issues

Motivation

With this we save all active voter votes for every epoch to the db. To that end a new celo_voter_votes table, runner and fetcher were introduced. A new column has been added to the celo_pending_epoch_operations table and the relevant migration to backfill the voter votes. New epoch blocks are added to celo_pending_epoch_operations in the blocks runner.

The fetcher gets all accounts that activated votes for a group in the previous epoch or had non-zero active votes in the previous epoch for one epoch block at a time. It then gets the active votes for each of these account/group pairs and passes them to the runner which saves them to the db. The runner updates celo_pending_epoch_operations so that the processed epoch block isn't requeued.

Changelog

Checklist for your Pull Request (PR)

@obasilakis obasilakis requested a review from a team March 14, 2022 10:50
@obasilakis obasilakis requested a review from eruizgar91 as a code owner March 14, 2022 10:50
@github-actions
Copy link

github-actions bot commented Mar 14, 2022

Unit Test Results

       3 files  ±0     244 suites  +2   3m 9s ⏱️ -10s
2 128 tests +5  2 083 ✔️ +5  45 💤 ±0  0 ±0 
2 159 runs  +5  2 114 ✔️ +5  45 💤 ±0  0 ±0 

Results for commit 01a735a. ± Comparison against base commit f609297.

♻️ This comment has been updated with latest results.

The new way of getting account/group pairs doesn't require sequential processing
@obasilakis obasilakis force-pushed the obasilakis/save_voter_active_votes_to_db branch 3 times, most recently from 72adb9e to f4886eb Compare March 17, 2022 10:28
@obasilakis obasilakis force-pushed the obasilakis/save_voter_active_votes_to_db branch from 53107dc to 8c6a32f Compare March 17, 2022 12:01
)
end

def previous_epoch_non_zero_voter_votes(epoch_block_number) do

Choose a reason for hiding this comment

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

Is it still used?

@obasilakis obasilakis merged commit 3393ebf into master Mar 17, 2022
@obasilakis obasilakis deleted the obasilakis/save_voter_active_votes_to_db branch March 17, 2022 20:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants