Enable overflow-checks and fix a bug that slipped through during their absence. (#231)

* Fixed bug in `average_higher`, due to wrong assumptions about operator precendence.

* Enable overflow checks in `--release` tests.

This will hardly impact test performance, as the heavy lifting is done in the threshold crypto crate. Rough benchmarks showed significant differences only when `overflow-checks` was enable for `[profile.release]` (instead of `[profile.bench]`), causing it to be applied to `threshold_crypto` as well.
This commit is contained in:
Marc Brinkmann 2018-09-13 13:03:12 +02:00 committed by Vladimir Komendantskiy
parent 0266a4107c
commit 23bc38bbeb
2 changed files with 7 additions and 1 deletions

View File

@ -47,3 +47,9 @@ name = "consensus-node"
[[example]]
name = "simulation"
# This will turn on overflow checks in `cargo test --release` and
# `cargo bench`. Dependencies will not be affected, as they use the
# `[profile.release]` block in both cases.
[profile.bench]
overflow-checks = true

View File

@ -54,7 +54,7 @@ impl NetworkDimension {
};
// Reduce the number of faulty nodes, if we are outside our limits.
if !half.faulty * 3 <= half.size {
if !(half.faulty * 3 <= half.size) {
half.faulty -= 1;
}