Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow unreplaced BSB22 commitment hint in solver #507

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion frontend/cs/r1cs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ import (
"errors"
"fmt"
"math/big"
"os"
"path/filepath"
"reflect"
"runtime"
"strings"

"github.com/consensys/gnark/constraint"
"github.com/consensys/gnark/constraint/solver"
"github.com/consensys/gnark/debug"
"github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/frontend/internal/expr"
"github.com/consensys/gnark/frontend/schema"
"github.com/consensys/gnark/logger"
"github.com/consensys/gnark/std/math/bits"
)

Expand Down Expand Up @@ -756,6 +759,17 @@ func (builder *builder) getCommittedVariables(i *constraint.Commitment) []fronte
return res
}

func bsb22CommitmentComputePlaceholder(*big.Int, []*big.Int, []*big.Int) error {
func bsb22CommitmentComputePlaceholder(_ *big.Int, _ []*big.Int, output []*big.Int) error {
if (len(os.Args) > 0 && strings.HasSuffix(os.Args[0], ".test")) || debug.Debug {
// usually we only run solver without prover during testing
log := logger.Logger()
log.Error().Msg("Augmented groth16 commitment hint not replaced. Proof will not be sound!")
output[0].SetInt64(0)
return nil
}
return fmt.Errorf("placeholder function: to be replaced by commitment computation")
}

func init() {
solver.RegisterHint(bsb22CommitmentComputePlaceholder)
}