Skip to content

Conversation

@MozirDmitriy
Copy link

Motivation

The is_sub_builder flag was never being set to true when creating sub-builders via new_sub_builder(). This meant all the assert guards in witness_var(), witness_felt(), witness_ext(), and commit_public_value() were effectively dead code - they could never trigger.

This is problematic because witness_* functions use local counters (witness_var_count, etc.) that start at 0 in each sub-builder,
creating index conflicts if called from within loops or conditionals.

Solution

  • Set is_sub_builder = true in new_sub_builder() so the protection actually works
  • Remove the assert from commit_public_value() since it's safely called from sub-builders inside commit_public_values() (the nb_public_values variable is properly shared between builders)

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

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