-
Notifications
You must be signed in to change notification settings - Fork 785
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
rep_weights part 3 - Add mininum weight to representative cache #4485
rep_weights part 3 - Add mininum weight to representative cache #4485
Conversation
fc83736
to
cca0b43
Compare
cca0b43
to
368ce6e
Compare
3a6a8c3
to
d916e14
Compare
nano::uint128_t weight (nano::account const &); | ||
std::optional<nano::block_hash> successor (store::transaction const &, nano::qualified_root const &) const noexcept; | ||
std::optional<nano::block_hash> successor (store::transaction const & transaction, nano::block_hash const & hash) const noexcept; | ||
/* Returns the exact vote weight for the given representative by doing a database lookup */ | ||
nano::uint128_t weight_exact (store::transaction const &, nano::account const &); |
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.
On the naming of "weight_exact" it seems like the other weight function isn't exact though they should always be in sync shouldn't they?
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.
Let's say a representative has a vote weight of Ӿ0.1. weight_exact
would return Ӿ0.1, but weight
would return 0, because it wasn't in the cache. I wanted to rename weight
to weight_cached
, but this would pollute this pull request with the renames. Or should I rename it now? Do you have better names in mind?
Maybe let's rename weight
=>weight_cached
and weight_exact
=> weight
?
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.
Renaming is going to impact work in progress code, the current "non-exact" weight function is what node components should use 99% of the time.
This is needed, because reps_cache will get access to the new rep_cache data store.
d916e14
to
b6ec773
Compare
This is the last part of multiple stacked and self-contained pull requests. The previous part is #4483.
Overall Goal
With the recent spam attack the number of representatives has increased significantly. All representatives and their vote weight are held in memory and this isn't a viable solution anymore. This series of pull requests moves the representatives out of memory and stores them in the database.
What this PR does
This PR introduces a minimum weight for the representatives cache (
rep_weights
). All votes from representatives below that minimum will be ignored. The minimum weight can be configured via the new optionrepresentative_vote_weight_minimum
in the fileconfig-node.toml