apply goldilocks changes in plonky2 v1.0.2

This commit is contained in:
M Alghazwi 2025-05-27 10:26:53 +02:00
parent 7025b2efd6
commit 51e3f0ffeb

View File

@ -30,13 +30,13 @@ import (
) )
// The multiplicative group generator of the field. // The multiplicative group generator of the field.
var MULTIPLICATIVE_GROUP_GENERATOR goldilocks.Element = goldilocks.NewElement(7) var MULTIPLICATIVE_GROUP_GENERATOR goldilocks.Element = goldilocks.NewElement(14293326489335486720)
// The two adicity of the field. // The two adicity of the field.
var TWO_ADICITY uint64 = 32 var TWO_ADICITY uint64 = 32
// The power of two generator of the field. // The power of two generator of the field.
var POWER_OF_TWO_GENERATOR goldilocks.Element = goldilocks.NewElement(1753635133440165772) var POWER_OF_TWO_GENERATOR goldilocks.Element = goldilocks.NewElement(7277203076849721926)
// The modulus of the field. // The modulus of the field.
var MODULUS *big.Int = emulated.Goldilocks{}.Modulus() var MODULUS *big.Int = emulated.Goldilocks{}.Modulus()
@ -320,7 +320,7 @@ func InverseHint(_ *big.Int, inputs []*big.Int, results []*big.Int) error {
input := inputs[0] input := inputs[0]
if input.Cmp(MODULUS) == 0 || input.Cmp(MODULUS) == 1 { if input.Cmp(MODULUS) == 0 || input.Cmp(MODULUS) == 1 {
panic("Input is not in the field") panic(fmt.Sprintf("Input (%s) is not in the field", input.String()))
} }
inputGl := goldilocks.NewElement(input.Uint64()) inputGl := goldilocks.NewElement(input.Uint64())
@ -345,7 +345,7 @@ func SplitLimbsHint(_ *big.Int, inputs []*big.Int, results []*big.Int) error {
input := inputs[0] input := inputs[0]
if input.Cmp(MODULUS) == 0 || input.Cmp(MODULUS) == 1 { if input.Cmp(MODULUS) == 0 || input.Cmp(MODULUS) == 1 {
return fmt.Errorf("input is not in the field") return fmt.Errorf("input (%s) is not in the field", input.String())
} }
two_32 := big.NewInt(int64(math.Pow(2, 32))) two_32 := big.NewInt(int64(math.Pow(2, 32)))