mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
luxfi/math v1.5.1 marks Add64 deprecated in favour of Add[uint64]. The two are the same function by construction — safe.go declares the deprecated name as `Add64 = Add[uint64]`, a var holding that exact instantiation — so this moves no arithmetic: same overflow predicate, same (sum, error), same refusal at the same boundary. It also drops a call through a package-level func value, which nothing should be able to reassign. Instantiated explicitly rather than left to inference. These three are the overflow-refusal sites for stake: the two weight tallies Register and FlattenValidatorSet run, and the cert tally votedStake runs. If a weight field ever narrowed, `Add` would infer the narrower T and quietly start refusing at a lower ceiling while the caller still believed it was guarding a uint64; `Add[uint64]` fails at compile time instead. A tally that refuses at the wrong ceiling is the fault these calls exist to catch. Co-authored-by: Hanzo Dev <[email protected]>