lighthouse/consensus/state_processing
Michael Sproul 3412a3ec54 Remove saturating arith from state_processing (#1644)
## Issue Addressed

Resolves #1100

## Proposed Changes

* Implement the `SafeArith` trait for `Slot` and `Epoch`, so that methods like `safe_add` become available.
* Tweak the `SafeArith` trait to allow a different `Rhs` type (analagous to `std::ops::Add`, etc).
* Add a `legacy-arith` feature to `types` and `state_processing` that conditionally enables implementations of
  the `std` ops with saturating semantics.
* Check compilation of `types` and `state_processing` _without_ `legacy-arith` on CI,
  thus guaranteeing that they only use the `SafeArith` primitives 🎉

## Additional Info

The `legacy-arith` feature gets turned on by all higher-level crates that depend on `state_processing` or `types`, thus allowing the beacon chain, networking, and other components to continue to rely on the availability of ops like `+`, `-`, `*`, etc.

**This is a consensus-breaking change**, but brings us in line with the spec, and our incompatibilities shouldn't have been reachable with any valid configuration of Eth2 parameters.
2020-09-25 05:18:21 +00:00
..
benches Consensus updates for v0.12 (#1228) 2020-06-03 14:56:54 +10:00
src Remove saturating arith from state_processing (#1644) 2020-09-25 05:18:21 +00:00
tests Support multiple BLS implementations (#1335) 2020-07-25 02:03:18 +00:00
.gitignore Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00
Cargo.toml Remove saturating arith from state_processing (#1644) 2020-09-25 05:18:21 +00:00