Skip to content

chore: civc tests refactor#16086

Merged
maramihali merged 19 commits into
merge-train/barretenbergfrom
mm/civc-mock-tests-refactor
Jul 31, 2025
Merged

chore: civc tests refactor#16086
maramihali merged 19 commits into
merge-train/barretenbergfrom
mm/civc-mock-tests-refactor

Conversation

@maramihali

@maramihali maramihali commented Jul 29, 2025

Copy link
Copy Markdown

In this PR:

  • unify the logic of the two mock circuit producers for CIVC tests
  • remove logic in CIVC to handle whether we are or are not receiving precomputed vks and mocked vks, accumulate now expects a precomputed verification key
  • remove redundant tests

AztecBot and others added 11 commits July 25, 2025 03:27
In `stdlib_uint` we no longer need logical operations because the only
places they were used in, i.e., std/turbo version of sha256, blake2s,
blake3s, have been removed. So its best to reduce complexity of the
`uint` class and keep it minimal.

Removed the following functions from the `uint` class:
```cpp
operator^
operator&
operator|
operator~
operator>>
operator<<
ror
rol
logic_operator
```
…ments as input and returns the commitment to the merged table (#15949)

We modify the `MergeVerifier` so that it gets the subtable commitments as input and returns the commitment to the merged table. The reason for this change is that given the new structure of `ClientIVC` following [#15704](#15704), we can't access the merged table commitments from inside `complete_hiding_circuit_logic`.

This PR is in preparation for [#15829](#15829)

---------

Co-authored-by: AztecBot <tech@aztecprotocol.com>
@maramihali maramihali force-pushed the mm/civc-mock-tests-refactor branch from bec97b3 to 812decc Compare July 29, 2025 19:35
@@ -207,27 +208,6 @@ TEST_F(ClientIVCTests, BadProofFailure)
EXPECT_TRUE(true);
};

@maramihali maramihali Jul 30, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

test above exists in the integration tests

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.

the test seems most suited for this module I feel though.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah that’s true - I think the two test files should just be merged into a single one. Could do it in this PR tbf

@maramihali maramihali changed the title chore: civc test refactor, unify mock circuits producer chore: civc tests refactor Jul 30, 2025
@maramihali maramihali marked this pull request as ready for review July 30, 2025 12:22
@maramihali maramihali requested a review from kashbrti July 30, 2025 12:23
@maramihali maramihali self-assigned this Jul 30, 2025
Base automatically changed from merge-train/barretenberg to next July 30, 2025 17:45

@kashbrti kashbrti left a comment

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.

will check the rest later. but so far other than a couple clarifications it looks good.

honk_vk->set_metadata(proving_key->get_metadata());
vinfo("set honk vk metadata");
}
honk_vk = precomputed_vk;

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.

hmm, so we don't have any cases where the vk is not provided? was this exclusive to our mock vks?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Well the cases where we were computing the vk on the fly or adding metadata to the the vk was purely for testing and benching purposes. We still mock vks for benchmarks but we do so completely in the test utilities.the accumulate function is meant to be used only with precomputed vks in productions and so I just made tests amenable to production behaviour

@@ -207,27 +208,6 @@ TEST_F(ClientIVCTests, BadProofFailure)
EXPECT_TRUE(true);
};

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.

the test seems most suited for this module I feel though.

for (size_t idx = 0; idx < NUM_CIRCUITS; ++idx) {
auto circuit = circuit_producer.create_next_circuit(ivc);
ivc.accumulate(circuit, precomputed_vks[idx]);
auto [circuit, vk] = circuit_producer.create_next_circuit_and_vk(ivc, { .log2_num_gates = 5 + idx });

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.

seems like we were adding 2 to log2_num_gates per index but now we're adding one. Am I missing something here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It doesn’t matter, the point of the test was to keep increasing the number of gates in the circuit, and that way it could be made cleaner

for (size_t j = 0; j < num_circuits; ++j) {
auto circuit = circuit_producer.create_next_circuit(ivc, log2_num_gates);
ivc.accumulate(circuit);
auto [circuit, vk] = circuit_producer.create_next_circuit_and_vk(ivc, { .log2_num_gates = 5 });

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.

feel like this value 5 is being used for a lot of tests, should we make it a global?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hm, it’s just an arbitrary value, would not want the civc tests to wrongly convey that some circuits should be set to log size 5

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.

We can still have a global called EXAMPLE_LOG_NUM_GATES still I guess.

for (auto& commitment : key->get_all()) {
commitment = MegaFlavor::Commitment::random_element();
}
auto key = idx % 2 == 0 ? app_vk : kernel_vk; // alternate between app and kernel vks

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.

hmm, not sure I saw where we are populating the commitments in the refactored code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

so i'm creating one app vk and one kernel vk above and just using those - the point of these mock vks is to speeed up benchmarks (in the sense that these vks will obviously be wrong but instead of spending time precomputing the vks of many circuits we just do two using our mock circuits so civc will not crash running with them)

@maramihali maramihali changed the base branch from next to merge-train/barretenberg July 31, 2025 09:50
@maramihali maramihali removed the request for review from jeanmon July 31, 2025 09:50

@kashbrti kashbrti left a comment

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.

other than some comments lgtm.

@maramihali maramihali merged commit 59bc177 into merge-train/barretenberg Jul 31, 2025
4 checks passed
@maramihali maramihali deleted the mm/civc-mock-tests-refactor branch July 31, 2025 11:33
maramihali pushed a commit that referenced this pull request Jul 31, 2025
ludamad pushed a commit that referenced this pull request Jul 31, 2025
@maramihali maramihali restored the mm/civc-mock-tests-refactor branch July 31, 2025 14:46
github-merge-queue Bot pushed a commit that referenced this pull request Aug 1, 2025
See
[merge-train-readme.md](https://github.com/AztecProtocol/aztec-packages/blob/next/.github/workflows/merge-train-readme.md).

BEGIN_COMMIT_OVERRIDE
chore: civc tests refactor (#16086)
chore: save memory in trace blocks when gate selectors are known to be
all zero (#16044)
chore: Revert "chore: civc tests refactor" (#16133)
fix: revert "chore: save memory in trace blocks when gate selectors are
kn… (#16139)
feat: specialised ZeroSelector to save memory on selectors known to be
zero (#16141)
chore: add a `PG_TAIL` proof and queue type (#15986)
Revert "chore: add a `PG_TAIL` proof and queue type" (#16152)
END_COMMIT_OVERRIDE

---------

Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: maramihali <mara@aztecprotocol.com>
Co-authored-by: Jonathan Hao <jonathan@aztec-labs.com>
Co-authored-by: Suyash Bagad <suyash@aztecprotocol.com>
Co-authored-by: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Co-authored-by: Khashayar Barooti <khashayar@aztecprotocol.com>
Co-authored-by: Lucas Xia <lucasxia01@gmail.com>
maramihali pushed a commit that referenced this pull request Aug 1, 2025
In this PR (redo of #16086):

* unify the logic of the two mock circuit producers for CIVC tests
* remove logic in CIVC to handle whether we are or are not receiving
precomputed vks and mocked vks, accumulate now
* expects a precomputed verification key
* remove redundant tests
* make our Typescript integration tests also provide precomputed vks for
both the native and wasm version of CIVC
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.

5 participants