[Merged by Bors] - Remove saturating arith from state_processing #1644
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Addressed
Resolves #1100
Proposed Changes
SafeArith
trait forSlot
andEpoch
, so that methods likesafe_add
become available.SafeArith
trait to allow a differentRhs
type (analagous tostd::ops::Add
, etc).legacy-arith
feature totypes
andstate_processing
that conditionally enables implementations ofthe
std
ops with saturating semantics.types
andstate_processing
withoutlegacy-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 onstate_processing
ortypes
, 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.