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

Test fails without unnecessary dummy constraint for PlonkFRI backend #679

Closed
tiagofneto opened this issue May 8, 2023 · 4 comments
Closed
Labels
bug Something isn't working P3: Low Issue priority: low

Comments

@tiagofneto
Copy link

Description

I encountered a bug where a seemingly unnecessary dummy constraint (e.g., a == a) must be added for my circuit test to pass when using the PlonkFRI backend, even though the constraint is always true and should not affect the test result. If I do not include this constraint, the test fails. However, this issue does not occur when using other backends such as PLONK and Groth16.

Code Example

Here's a code snippet that demonstrates the issue. Uncommenting the commented line is required for the test to pass:

type testCircuitBasic struct {
    A frontend.Variable
    B frontend.Variable
    Expected frontend.Variable
}

func (circuit *testCircuitBasic) Define(api frontend.API) error {
    mulRes := api.Mul(circuit.A, circuit.B)
    api.AssertIsEqual(mulRes, circuit.Expected)

    // Uncomment the following line to make the test pass
    // api.AssertIsEqual(circuit.A, circuit.A)

    return nil
}

func TestMainBasic(t *testing.T) {
    assert := test.NewAssert(t)

    var circuit testCircuitBasic

    assert.ProverSucceeded(&circuit, &testCircuitBasic{
        A: "42",
        B: "24",
        Expected: "1008",
    }, test.WithCurves(ecc.BN254))
}

Output

Running this test will result in the following error:

Error:          plonkFRI(bn254): one round of interaction failed
                                witness:{"A":42,"B":24,"Expected":1008}
Test:           TestMainBasic/bn254/plonkFRI

Uncommenting the commented line makes the test pass as expected.

@ivokub ivokub added bug Something isn't working P3: Low Issue priority: low labels May 9, 2023
@ivokub
Copy link
Collaborator

ivokub commented May 9, 2023

Just as a remark - I also encountered the same bug very recently. I checked very briefly and seems that this bug is propagated from gnark-crypto, but have to debug more closely.

Setting low priority as PLONK+FRI is very experimental right now. Are you particularly interested in PLONK+FRI?

@tiagofneto
Copy link
Author

I'm not particularly interested in PLONK+FRI, it's just that the tester by default will iterate through the various backends and will fail (because of PLONK+FRI), meaning that I have to specify some backend when testing now.

@ivokub
Copy link
Collaborator

ivokub commented May 17, 2023

I'm not particularly interested in PLONK+FRI, it's just that the tester by default will iterate through the various backends and will fail (because of PLONK+FRI), meaning that I have to specify some backend when testing now.

The option for setting backends in testing accepts multiple backends. But I agree, it is definitely nuisance. Will propose to the team omitting PLONK+FRI as one of the default backends to test against.

@ivokub
Copy link
Collaborator

ivokub commented Apr 5, 2024

We have omitted PLONK+FRI backend by default: #1075

@ivokub ivokub closed this as completed Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P3: Low Issue priority: low
Projects
None yet
Development

No branches or pull requests

2 participants