Skip to content

Conversation

@sashass1315
Copy link

Problem: The docs for r1cs_to_sr1cs state it panics if R1CS is missing or if there is more than one predicate. The code only asserted num_predicates == 1 and then indexed to_matrices()["R1CS"] without checking presence, causing a panic due to a missing key rather than the documented precondition. r1cs_to_sr1cs_with_assignment had the same implicit panic path

Why it’s a problem: This creates a documentation/behavior mismatch and leads to non-diagnostic panics from map indexing, making failures harder to understand and violating the documented contract.

Fix: Added assert!(has_predicate(R1CS_PREDICATE_LABEL)) before matrix access in both r1cs_to_sr1cs and r1cs_to_sr1cs_with_assignment, preserving the existing num_predicates == 1 check in the former.

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

Successfully merging this pull request may close these issues.

1 participant