Skip to content

chore: Fill witness vector with random values#19278

Merged
federicobarbacovi merged 4 commits intomerge-train/barretenbergfrom
fb/fill_witness_vector_with_random_values
Jan 5, 2026
Merged

chore: Fill witness vector with random values#19278
federicobarbacovi merged 4 commits intomerge-train/barretenbergfrom
fb/fill_witness_vector_with_random_values

Conversation

@federicobarbacovi
Copy link
Copy Markdown
Contributor

Noir optimises away some witnesses. When bb finds such a situation, it fills the witness vector with zeros. As a precaution, we change the behaviour to fill the witness vector with random values. This ensures that if the optimised witnesses are used somewhere (which should not be the case) the circuit will fail with high probability.

@federicobarbacovi federicobarbacovi self-assigned this Jan 2, 2026
@federicobarbacovi federicobarbacovi marked this pull request as ready for review January 2, 2026 12:34
Copy link
Copy Markdown
Contributor

@ledwards2225 ledwards2225 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just one comment that looks like it needs updating

@@ -444,7 +444,7 @@ WitnessVector witness_map_to_witness_vector(Witnesses::WitnessMap const& witness
// To ensure that witnesses sit at the correct indices in the `WitnessVector`, we fill any indices
// which do not exist within the `WitnessMap` with the dummy value of zero.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment needs to be updated right? might want to explain why were using a random value as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

@federicobarbacovi federicobarbacovi merged commit 6f854eb into merge-train/barretenberg Jan 5, 2026
8 checks passed
@federicobarbacovi federicobarbacovi deleted the fb/fill_witness_vector_with_random_values branch January 5, 2026 10:58
github-merge-queue Bot pushed a commit that referenced this pull request Jan 5, 2026
BEGIN_COMMIT_OVERRIDE
chore: (PCS audit) remove the linear combination of claims in shplonk
(#19191)
chore: Audit of the Mega circuit builder 1 (#19192)
chore: edit to the circuit builder docs (#19214)
chore: Honk recursion constraint audit (#18940)
chore: Fill witness vector with random values (#19278)
refactor(bb): remove unused MSGPACK_FIELDS from ACIR constraint types
(#19085)
chore: Add `DISABLE_ASSERTS` in some Honk recursion constraint tampering
tests (#19314)
fix: Replace missed CI_ENABLE_DISK_LOGS with CI_USE_BUILD_INSTANCE_KEY
END_COMMIT_OVERRIDE
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.

2 participants