Skip to content

Commit

Permalink
fix: more descriptive error message (Consensys#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub authored May 14, 2024
1 parent e822c15 commit 5c74bd7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion std/math/emulated/composition.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ func decompose(input *big.Int, nbBits uint, res []*big.Int) error {
// then no such underflow happens and s = a-b (mod p) as the padding is multiple
// of p.
func subPadding(modulus *big.Int, bitsPerLimbs uint, overflow uint, nbLimbs uint) []*big.Int {

if modulus.Cmp(big.NewInt(0)) == 0 {
panic("modulus is zero")
}
// first, we build a number nLimbs, such that nLimbs > b;
// here b is defined by its bounds, that is b is an element with nbLimbs of (bitsPerLimbs+overflow)
// so a number nLimbs > b, is simply taking the next power of 2 over this bound .
Expand Down

0 comments on commit 5c74bd7

Please sign in to comment.