-
Notifications
You must be signed in to change notification settings - Fork 0
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
Failing tests with NoirHelper #1
Comments
hi hi @critesjosh i think the inputs you are passing into the circuit |
the reason for this is also related to the above, because the public input array returned is empty trying to access an index fails |
lol derp 🤦♂️ |
I am still seeing some weird behavior. When I run the tests repeatedly, sometimes they fail, and sometimes they pass. I updated my branch. I also added Sometimes I the Other times But they never both pass. Sometimes this: It's different every time Perhaps noirHelper.clean should also delete the Prover.toml file? |
hmm, strange. let me look at it. also noticed that some data is cached between test runs so we might have to cleanup Prover.toml each time. |
I think foundry tests also run in parallel, which likely contributes to the problem. I'll try running in sequence and see if this changes things |
Ok I am pretty sure this is the issue. Running one test at a time causes them to always succeed. I am not sure how to force This seems to work, wdyt? function verifyProof() public {
noirHelper.withInput("x", 1).withInput("y", 1).withInput("return", 1);
(bytes32[] memory publicInputs, bytes memory proof) = noirHelper.generateProofAndClean(2);
starter.verifyEqual(proof, publicInputs);
}
function wrongProof() public {
noirHelper.clean();
noirHelper.withInput("x", 1).withInput("y", 5).withInput("return", 5);
(bytes32[] memory publicInputs, bytes memory proof) = noirHelper.generateProofAndClean(2);
vm.expectRevert();
starter.verifyEqual(proof, publicInputs);
}
function test_all() public {
// Run tests in wrapper to make them run sequentially
verifyProof();
wrongProof();
} |
yes yes this seems to be the bulk of the issue. |
you are right, i created a pr #3 to try and address the issue. if it works completely then we might not need to run the tests sequentially. |
This seems to work most of the time. function test_verifyProof() public {
noirHelper.withInput("x", 1).withInput("y", 1).withInput("return", 1);
(bytes32[] memory publicInputs, bytes memory proof) = noirHelper.generateProof("test_verifyProof", 2);
starter.verifyEqual(proof, publicInputs);
}
function test_wrongProof() public {
noirHelper.clean();
noirHelper.withInput("x", 1).withInput("y", 5).withInput("return", 5);
(bytes32[] memory publicInputs, bytes memory proof) = noirHelper.generateProof("test_wrongProof", 2);
vm.expectRevert();
starter.verifyEqual(proof, publicInputs);
} I occasionally see this though |
i get the same error sometimes too, might be foundry related - foundry-rs/book#949 |
looks like it is actually related to noir - noir-lang/noir#6445 |
do you know if there is any way we can specify the output of the compiled artefact JSON file like we do for the prover file? |
I am trying to integrate this tool with the
with-foundry
template in the noir-starter here: https://github.com/AztecProtocol/noir-starter/tree/main/with-foundryThis may be user error, but would love some help 😅 You can see my update on this branch
I've been running tests with
forge test --optimize --optimizer-runs 5000 --evm-version cancun
since the compiler doesn't like when I uselondon
If I try to log some of the returned
publicInputs
I see[FAIL: panic: array out-of-bounds access (0x32)] test_dynamicProof() (gas: 116848)
Without logging, I see
[FAIL: PUBLIC_INPUT_COUNT_INVALID(2, 0)] test_dynamicProof() (gas: 127192)
as part of this testDo I need to pass the circuit
return
value toNoirHelper
viawithInput
?The text was updated successfully, but these errors were encountered: