Page MenuHomePhabricator

Fix an unsigned issue in the availability score calculation
ClosedPublic

Authored by Fabien on Jan 13 2022, 20:14.

Details

Summary

The number of votes and polls are stored as unsigned ints for the computation, causing an overflow when 2 * votes - polls is negative. This can happen if a node never responded any poll, and cause the score to turn high instead of going negative. The test case was checking the score response against a rise then fall, so it didn't check for negative values and missed the edge case.

Test Plan
ninja all check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
avalanche_availability_score_negative
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17905
Build 35633: Build Diffbuild-without-wallet · build-diff · lint-circular-dependencies · build-debug · build-clang-tidy · build-clang
Build 35632: arc lint + arc unit