Page MenuHomePhabricator

[avalanche] Refactor reward ranking logic into its own comparator
ClosedPublic

Authored by roqqit on Wed, Jan 8, 17:44.

Details

Summary

Sharing the reward ranking logic between the contender cache and peer manager makes it easier to reason about. This also cleans up the if statement in selectStakingRewardWinner that is difficult to read at a glance.

There is no change in behavior.

Test Plan
ninja check check-functional

Diff Detail

Event Timeline

roqqit requested review of this revision.Wed, Jan 8, 17:44
This comment was removed by Fabien.

Tail of the build log:

/work /work/abc-ci-builds/lint-circular-dependencies
A new circular dependency in the form of "avalanche/rewardrankcomparator -> avalanche/stakecontendercache -> avalanche/rewardrankcomparator" appears to have been introduced.

A new circular dependency in the form of "avalanche/peermanager -> avalanche/rewardrankcomparator -> avalanche/stakecontendercache -> avalanche/peermanager" appears to have been introduced.

/work/abc-ci-builds/lint-circular-dependencies
Build lint-circular-dependencies failed with exit code 1

Fix circular dependency

This revision is now accepted and ready to land.Wed, Jan 8, 19:54