mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 00:51:33 +01:00
feat: Plonk optimizations (#39)
* Fixed poseidion hash TOOD in fri/fri.go * optimized goldilocks * Another optimization * Down to 16 million * Finished TODOs
This commit is contained in:
@@ -131,9 +131,8 @@ func (p *Chip) MulAdd(a Variable, b Variable, c Variable) Variable {
|
||||
quotient := NewVariable(result[0])
|
||||
remainder := NewVariable(result[1])
|
||||
|
||||
lhs := p.api.Mul(a.Limb, b.Limb)
|
||||
lhs = p.api.Add(lhs, c.Limb)
|
||||
rhs := p.api.Add(p.api.Mul(quotient.Limb, MODULUS), remainder.Limb)
|
||||
lhs := p.api.MulAcc(c.Limb, a.Limb, b.Limb)
|
||||
rhs := p.api.MulAcc(remainder.Limb, MODULUS, quotient.Limb)
|
||||
p.api.AssertIsEqual(lhs, rhs)
|
||||
|
||||
p.RangeCheck(quotient)
|
||||
@@ -144,7 +143,7 @@ func (p *Chip) MulAdd(a Variable, b Variable, c Variable) Variable {
|
||||
// Multiplies two field elements and adds a field element such that x * y + z = c within the
|
||||
// Golidlocks field without reducing.
|
||||
func (p *Chip) MulAddNoReduce(a Variable, b Variable, c Variable) Variable {
|
||||
return p.AddNoReduce(p.MulNoReduce(a, b), c)
|
||||
return NewVariable(p.api.MulAcc(c.Limb, a.Limb, b.Limb))
|
||||
}
|
||||
|
||||
// The hint used to compute MulAdd.
|
||||
|
||||
Reference in New Issue
Block a user