Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use TreeMap to prevent potential nondeterminism in BM share summation
Replace HashMap in 'BurningManService.getBurningManCandidatesByName' result construction with a TreeMap, to ensure that the map values are ordered deterministically (alphabetically by candidate name) when computing floating point sums. The map values are streamed over in a few places in this method and elsewhere in 'DelayedPayoutTxReceiverService', when performing double precision summation to compute the DPT. This introduces potential nondeterminism due to the nonassociativity of FP addition, making sums dependent on the term order. (Note that 'DoubleStream::sum' uses compensated (Kahan) summation, which makes it effectively quad precision internally, so the chance of term reordering causing the result to differ by even a single ULP is probably quite low here. So there might not be much problem in practice.)
- Loading branch information