Skip to content

Conversation

@iakovenkos
Copy link
Contributor

@iakovenkos iakovenkos commented Jan 26, 2026

  • Don't use get_value() on vk member, derive from proof size, make sure it matches the value from the vk

  • Added new bb::ProofLength gadget responsible for all Chonk and Honk proof/public inputs lengths computations

@iakovenkos iakovenkos marked this pull request as ready for review January 27, 2026 09:48
// ECCVM proof
start_idx = end_idx;
end_idx += static_cast<std::ptrdiff_t>(ECCVMFlavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS);
end_idx += static_cast<std::ptrdiff_t>(ECCVMFlavor::PROOF_LENGTH);
Copy link
Contributor Author

@iakovenkos iakovenkos Jan 27, 2026

Choose a reason for hiding this comment

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

It was somewhat misleading to call those w/o pub inputs in VMs

// Populate mock witness accumulator commitments
populate_field_elements_for_mock_commitments(proof, Flavor::NUM_WITNESS_ENTITIES / 2);
// Populate mock accumulator commitments (non_shifted + shifted)
populate_field_elements_for_mock_commitments(proof, Flavor::NUM_ACCUMULATOR_COMMITMENTS);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Realized that MLB Flavor is quite confusing due to copy-pasted structures. Simplified those as a byproducr


TYPED_TEST_SUITE(MockVerifierInputsTest, FlavorTypes);
// Static assertions for proof length constants
static_assert(MERGE_PROOF_SIZE == 42, "Merge proof size changed");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be faster to modify now

DEFINE_FLAVOR_MEMBERS(DataType,
batched_unshifted_accumulator, // column 0: batched unshifted poly for accumulator
batched_unshifted_instance, // column 1: batched unshifted poly for instance
eq_accumulator, // column 2: eq(u, r_acc) - selects accumulator eval point
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This class was essentially unused, + eq's are not witnesses.

@@ -0,0 +1,181 @@
// === AUDIT STATUS ===
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, my goal was to always derive num_public_inputs from the proof size. But the methods used to compute the "fixed" sizes were flavor-linked. Instead I wanted to have something context-dependent like HypernovaInstanceToAccum length that still re-uses lots from Honk proof building blocks. As a result, we have all honk/chonk proof length computations in one place + it's easy to deduce num_public inputs

verifier_instance->vk_and_hash->hash.assert_equal(vk_hash);

// Assert that the provided num_public_inputs matches VK's value (in-circuit constraint)
vk->num_public_inputs.assert_equal(FF(num_public_inputs), "OinkVerifier: num_public_inputs mismatch with VK");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that previously we would use .get_value(). though substituting the real witness value with something else would have created a different circuit, feels more robust when such discrepancy immediately leads to a failed constraint

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, so the idea is that leads to a better error in the circuit failure case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was concerned about vk->num_public_inputs.get_value() in general, as then we would need to analyze whether a malicious actor can ignore this value + the binding of the vk field with the proof was very implicit, namely through the loop for receiving the public inputs that uses the underlying native value, changing which would be enough to change this circuit's VK and cause a verification failure against a correctly computed VK, but now it's obvious that this loop uses the same value that's in the vk

*/
template <typename Flavor, class IO>
typename UltraVerifier_<Flavor, IO>::PaddingData UltraVerifier_<Flavor, IO>::process_padding() const
template <typename Flavor, class IO> size_t UltraVerifier_<Flavor, IO>::compute_log_n() const
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to split process_padding method, cause integer log_n is needed before oink, and padding indicator array can only be computed after oink -- vk member log_circuit_size gets hashed and untagged as a free witness

@iakovenkos iakovenkos self-assigned this Jan 27, 2026
Copy link
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 - thanks for the improvements

@iakovenkos iakovenkos added the ci-full Run all master checks. label Jan 27, 2026
@AztecBot
Copy link
Collaborator

Flakey Tests

🤖 says: This CI run detected 4 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/47bbe7f15962c754�47bbe7f15962c7548;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_first_slot.test.ts (230s) (code: 1) group:e2e-p2p-epoch-flakes (\033iakovenkos\033: upd vks hash)
\033FLAKED\033 (8;;http://ci.aztec-labs.com/48187d2442d1e742�48187d2442d1e7428;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_high_tps_block_building.test.ts (279s) (code: 1) group:e2e-p2p-epoch-flakes (\033iakovenkos\033: upd vks hash)
\033FLAKED\033 (8;;http://ci.aztec-labs.com/d224bff8670c857e�d224bff8670c857e8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_p2p/reqresp.test.ts (368s) (code: 1) group:e2e-p2p-epoch-flakes (\033iakovenkos\033: upd vks hash)
\033FLAKED\033 (8;;http://ci.aztec-labs.com/dc8d8eac9e38bcf9�dc8d8eac9e38bcf98;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_p2p/valid_epoch_pruned_slash.test.ts (404s) (code: 1) group:e2e-p2p-epoch-flakes (\033iakovenkos\033: upd vks hash)

@iakovenkos iakovenkos merged commit 198c4de into merge-train/barretenberg Jan 27, 2026
8 checks passed
@iakovenkos iakovenkos deleted the si/pub-inputs-clean-up branch January 27, 2026 20:14
github-merge-queue bot pushed a commit that referenced this pull request Jan 28, 2026
BEGIN_COMMIT_OVERRIDE
chore: use powers of gamma in logup  (#19881)
fix: ultra num public inputs derivation (#19950)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants