This repository has been archived by the owner on Feb 24, 2025. It is now read-only.
forked from blockscout/blockscout
-
Notifications
You must be signed in to change notification settings - Fork 21
Obasilakis/save voter active votes to db #581
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…er_active_votes_to_db
The block runner takes care of that
carterqw2
reviewed
Mar 15, 2022
apps/explorer/lib/explorer/chain/import/runner/celo_voter_votes.ex
Outdated
Show resolved
Hide resolved
...iv/repo/migrations/20220312195404_add_fetch_voter_votes_to_celo_pending_epoch_operations.exs
Outdated
Show resolved
Hide resolved
carterqw2
reviewed
Mar 15, 2022
The new way of getting account/group pairs doesn't require sequential processing
carterqw2
reviewed
Mar 16, 2022
apps/explorer/test/explorer/celo/events/validator_group_vote_activated_event_test.exs
Outdated
Show resolved
Hide resolved
72adb9e
to
f4886eb
Compare
53107dc
to
8c6a32f
Compare
carterqw2
reviewed
Mar 17, 2022
) | ||
end | ||
|
||
def previous_epoch_non_zero_voter_votes(epoch_block_number) do |
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.
Is it still used?
carterqw2
approved these changes
Mar 17, 2022
…er_active_votes_to_db
6 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thecelo_pending_epoch_operations
table and the relevant migration to backfill the voter votes. New epoch blocks are added tocelo_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)
CHANGELOG.md
with this PRmaster
in the Version column. Changes will be reflected in this table: https://docs.blockscout.com/for-developers/information-and-settings/env-variables.