a16z / jolt

The simplest and most extensible zkVM. Fast and fully open source from a16z crypto and friends. ⚡
https://jolt.a16zcrypto.com
MIT License
580 stars 105 forks source link

Unit test for parity between JoltIn and memory checking instances #378

Open sragss opened 1 month ago

sragss commented 1 month ago

After #368 the inputs to the Jolt R1CS instances are hardcoded into the JoltIn enum. We should be able to write a unit test that the size of this iterable enum matches the size spit out by vm/mod.rs.

sragss commented 3 weeks ago

Discussed with @moodlezoup. We don't have a great strategy here yet. Ideally we have some static information about what is output by the memory checking instances and then we can constrain those to the JoltIn enums.

The simplest strategy is that we check Inputs::clone_to_trace_len_chunks and Inputs::format_commitments output things matching JoltIn::COUNT. These would not catch ordering related bugs, but would catch sizing related bugs which are likely more common.

sragss commented 3 weeks ago

I've added this to clone_to_trace_len chunks in #368 but have not added to format_commitments as this includes auxiliary variables and we do not have access to this count statically. We could use an assert_static_aux_index as is used for next_pc_jump_branch in jolt_constraints.rs.