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

Some field gadget tests do not verify lookups #19

Open
huitseeker opened this issue Jun 5, 2024 · 0 comments
Open

Some field gadget tests do not verify lookups #19

huitseeker opened this issue Jun 5, 2024 · 0 comments

Comments

@huitseeker
Copy link
Contributor

Tests that only verify a single chip's trace and proof, understandably but surprisingly, do not check for the correctness of lookups, since they are only checking an individual chip's trace for correctness.

This is particularly relevant for non-native field operation tests after the addition of range checking to the non-native field gadgets. That is, all of these tests: 1, 2, 3, 4, 5), are not actually checking that the range checks are correct and that the lookup arguments and send/receives are also correct. This is a minor issue, but can cover up existing issues if any of those gadgets are not used and tested by other existing precompiles. Right now, after merging #160, I believe only the QuadField Sqrt gadget falls under this under-tested criteria.

Any test that makes use of those operations in an actual RISC-V precompile (i.e. any of the tests under the tests/ directory) do not have this issue, since they emulate the entire machine and check the cumulative sum of the lookup arguments. However, some of the tests in the tests/ directory use only hard-coded test values, while the field gadget tests fill the trace with random values as well as hardcoded values, so the test coverage is not perfect.

I'm not sure of the best way to approach this: modifying those tests to make a "full" proof seems difficult since the test chips are not in the MachineAir enum. Adding a test-only method for checking the generated byte lookup events for correctness might be a good compromise, to ensure that at least none of the gadgets are emitting invalid byte lookups. Alternatively, proper documentation to highlight that this is the case might be enough, since the full end-to-end tests with RISC-V programs exist for all precompiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant