From b3e7ef8e06f26cb30823eb782833097ee57f6ef3 Mon Sep 17 00:00:00 2001 From: Arya Tabaie <15056835+Tabaie@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:09:07 -0500 Subject: [PATCH] fix register rand hint --- constraint/solver/hint_registry.go | 3 ++- frontend/cs/r1cs/api.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/constraint/solver/hint_registry.go b/constraint/solver/hint_registry.go index 9ea3b573a4..fa5d44d357 100644 --- a/constraint/solver/hint_registry.go +++ b/constraint/solver/hint_registry.go @@ -2,6 +2,7 @@ package solver import ( "fmt" + "github.com/consensys/gnark/internal/hints" "math/big" "sync" @@ -9,7 +10,7 @@ import ( ) func init() { - RegisterHint(InvZeroHint) + RegisterHint(InvZeroHint, hints.Randomize) } var ( diff --git a/frontend/cs/r1cs/api.go b/frontend/cs/r1cs/api.go index 435b9da24a..095ee6e528 100644 --- a/frontend/cs/r1cs/api.go +++ b/frontend/cs/r1cs/api.go @@ -697,7 +697,7 @@ func (builder *builder) Commit(v ...frontend.Variable) (frontend.Variable, error return nil, err } vCp[len(v)] = mask[0] - builder.cs.AddR1C(builder.newR1C(mask, 1, mask), builder.genericGate) // the variable needs to be involved in a constraint otherwise it will not affect the commitment + builder.cs.AddR1C(builder.newR1C(mask[0], builder.eOne, mask[0]), builder.genericGate) // the variable needs to be involved in a constraint otherwise it will not affect the commitment v = vCp }