Skip to content

feat: ZK CIVC #16687

Merged
maramihali merged 48 commits intomerge-train/barretenbergfrom
mm/zk-civc
Sep 9, 2025
Merged

feat: ZK CIVC #16687
maramihali merged 48 commits intomerge-train/barretenbergfrom
mm/zk-civc

Conversation

@maramihali
Copy link

@maramihali maramihali commented Sep 1, 2025

At last! Add randomness to the UltraOp version of the op queue and ensure proper handling in Translator. This makes the Translator and Merge proof actually zero knowledge.

The caveat is, because Translator is zero-knowledge by default, we have to ensure these changes don't affect the AVM recursive verifier. There, we only ever accumulate one circuit so we don't want to do an artificial append merge with offset. As such, I opted for translator not expecting to process random ops at the end of the op queue when the op queue is derived from the goblin recursive verifier circuit. We however add the three random ops at the beginning of the op queue by default as otherwise we'd have to alter Translator relations based on whether Goblin is used in AVM or CIVC.

Closes AztecProtocol/barretenberg#1360

@maramihali maramihali changed the base branch from next to mm/translator-detects-no-op September 1, 2025 11:02
@maramihali maramihali changed the base branch from mm/translator-detects-no-op to mm/opcode-in-both-rows September 1, 2025 11:03
@maramihali maramihali marked this pull request as ready for review September 8, 2025 10:47
@maramihali maramihali self-assigned this Sep 8, 2025
@maramihali maramihali added the ci-full Run all master checks. label Sep 8, 2025
Comment on lines +193 to +196
mega_builder.queue_ecc_no_op();

mega_builder.queue_ecc_random_op();
mega_builder.queue_ecc_random_op();
mega_builder.queue_ecc_random_op();
Copy link
Author

Choose a reason for hiding this comment

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

could move this into a function in goblin for the avm_mode

Copy link
Contributor

Choose a reason for hiding this comment

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

Do these need to be "random" instead of no-ops? If that's the case then does feel like a design flaw somewhere but maybe not critical. Does seem like it might be better off as a method in goblin with an explanation

Copy link
Author

@maramihali maramihali Sep 9, 2025

Choose a reason for hiding this comment

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

random ops are handled differently than no-ops in Translator, particularly because the op wire will not be populated with the opcode at even indices and 0 at odd indices but rather with two random values and translator expects, we can make it so we don't handle random ops at the beginning of the trace in avm_mode but seemed an unnecesary complication. Isolated to a function in goblin

Copy link
Contributor

If you want to check if this affects the AVM you can run the GoblinRecursion rest in vm2/constraining/recursion/recursive_verifier.test.cpp. We don't have a live benchmark on that so it would be good to check the before and after times. They will be printed by the test.

@maramihali
Copy link
Author

maramihali commented Sep 8, 2025

@fcarreiro what I mentioned above is an insignificant amount of work (6 extra ultra ops on top of the 7000 from the AVM recursive verifier), double checked by running the tests I dont see a change in times
:)

@fcarreiro
Copy link
Contributor

@fcarreiro what I mentioned above is an insignificant amount of work (6 extra ultra ops on top of the 7000 from the AVM recursive verifier), double checked by running the tests I dont see a change in times :)

Oh I think then I misunderstood. I see a special avm_mode :) thanks for double checking!

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.

Woo! The end of an era. Nice work. Left some comments about things I think could be clarified

// information about the op queue content linked to the circuits being proven
static constexpr size_t RESULT_ROW = 8;
static constexpr size_t NUM_NO_OPS_START = 1;
static_assert(NUM_NO_OPS_START == 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the intent of these static asserts just to signal that these are not parameters that can be tweaked?

Copy link
Author

Choose a reason for hiding this comment

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

yes, or that a change to these parameter might require further changes, similar to how we have static_asserts for relation degrees in flavors, but maybe they are a bit overkill (especially the no-op one I think can be removed), I tried my best to not hardcode constants in the code though

Comment on lines +193 to +196
mega_builder.queue_ecc_no_op();

mega_builder.queue_ecc_random_op();
mega_builder.queue_ecc_random_op();
mega_builder.queue_ecc_random_op();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these need to be "random" instead of no-ops? If that's the case then does feel like a design flaw somewhere but maybe not critical. Does seem like it might be better off as a method in goblin with an explanation

@maramihali maramihali merged commit 05a95db into merge-train/barretenberg Sep 9, 2025
6 checks passed
@maramihali maramihali deleted the mm/zk-civc branch September 9, 2025 11:09
github-merge-queue bot pushed a commit that referenced this pull request Sep 9, 2025
BEGIN_COMMIT_OVERRIDE
feat: ZK CIVC  (#16687)
feat!: verifying civc in tx base (#16713)
END_COMMIT_OVERRIDE
mralj pushed a commit that referenced this pull request Oct 13, 2025
At last! Add randomness to the UltraOp version of the op queue and
ensure proper handling in Translator. This makes the Translator and
Merge proof actually zero knowledge.

The caveat is, because Translator is zero-knowledge by default, we have
to ensure these changes don't affect the AVM recursive verifier. There,
we only ever accumulate one circuit so we don't want to do an artificial
append merge with offset. As such, I opted for translator not expecting
to process random ops at the end of the op queue when the op queue is
derived from the goblin recursive verifier circuit. We however add the
three random ops at the beginning of the op queue by default as
otherwise we'd have to alter Translator relations based on whether
Goblin is used in AVM or CIVC.

Closes AztecProtocol/barretenberg#1360
ludamad pushed a commit that referenced this pull request Dec 16, 2025
At last! Add randomness to the UltraOp version of the op queue and
ensure proper handling in Translator. This makes the Translator and
Merge proof actually zero knowledge.

The caveat is, because Translator is zero-knowledge by default, we have
to ensure these changes don't affect the AVM recursive verifier. There,
we only ever accumulate one circuit so we don't want to do an artificial
append merge with offset. As such, I opted for translator not expecting
to process random ops at the end of the op queue when the op queue is
derived from the goblin recursive verifier circuit. We however add the
three random ops at the beginning of the op queue by default as
otherwise we'd have to alter Translator relations based on whether
Goblin is used in AVM or CIVC.

Closes AztecProtocol/barretenberg#1360
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.

3 participants