rep_weights part 3 - Add mininum weight to representative cache#4485
rep_weights part 3 - Add mininum weight to representative cache#4485clemahieu merged 10 commits intonanocurrency:developfrom
Conversation
fc83736 to
cca0b43
Compare
3a6a8c3 to
d916e14
Compare
| 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.
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.
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.
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_minimumin the fileconfig-node.toml