[avalanche] Fix proof_tests potential failure
Summary:
It appears that the evaluation order of the left and right parameters of BOOST_CHECK_EQUAL should not be relied upon, and will vary between compilers. This cause the test to fail if the proof has a dust stake because the right part state.GetResult() == ProofValidationResult::NONE is evaluated before state is assigned.
How to reproduce
Edit the proof_tests.cpp:29 line from:
const uint32_t score = InsecureRand32();
to:
const uint32_t score = MIN_VALID_PROOF_SCORE - 1000;
With clang the proof_tests pass as expected, but it fails with gcc as the state is evaluated before it is set.
Test Plan:
Edit the line as mentioned above, then with both GCC and Clang:
ninja check-avalanche-proof_tests
The test should succeed with both compilers.
Reviewers: #bitcoin_abc, sdulfari
Reviewed By: #bitcoin_abc, sdulfari
Differential Revision: https://reviews.bitcoinabc.org/D11940