lighthouse/consensus
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
..
cached_tree_hash Update smallvec (#1339) 2020-07-07 16:57:27 +10:00
fork_choice Apply hotfix for inconsistent head (#1639) 2020-09-22 02:06:10 +00:00
int_to_bytes Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00
merkle_proof Deny warnings on CI (#1372) 2020-07-21 05:51:33 +00:00
proto_array Shift HTTP server heavy-lifting to blocking executor (#1518) 2020-08-24 03:06:10 +00:00
safe_arith Remove saturating arith from state_processing (#1644) 2020-09-25 05:18:21 +00:00
serde_hex Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00
serde_utils Add serde_utils module with quoted u64 support (#1588) 2020-09-07 01:03:53 +00:00
ssz Fix clippy warnings (#1385) 2020-07-23 14:18:00 +00:00
ssz_derive Fix eval order lint in ssz_derive (#1210) 2020-05-28 11:37:40 +10:00
ssz_types Fix clippy warnings (#1385) 2020-07-23 14:18:00 +00:00
state_processing Remove saturating arith from state_processing (#1644) 2020-09-25 05:18:21 +00:00
swap_or_not_shuffle Bump all spec tags to v0.12.1 (#1275) 2020-06-19 11:18:27 +10:00
tree_hash Add caching for state.eth1_data_votes (#919) 2020-07-24 02:19:47 +00:00
tree_hash_derive Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00
types Remove saturating arith from state_processing (#1644) 2020-09-25 05:18:21 +00:00