Skip to content

chore: no PK#15386

Merged
ledwards2225 merged 37 commits into
merge-train/barretenbergfrom
lde/no_pk
Jul 5, 2025
Merged

chore: no PK#15386
ledwards2225 merged 37 commits into
merge-train/barretenbergfrom
lde/no_pk

Conversation

@ledwards2225

@ledwards2225 ledwards2225 commented Jun 29, 2025

Copy link
Copy Markdown
Contributor

Removes the ProvingKey altogether from the Ultra/Mega proving systems.

TLDR: "proving key" used to mean "the precomputable data used by the prover." The Honk PK hasn't been that for a long time since it stores the ProverPolynomials which contains all polynomials used by the prover, including witnesses. This meant there was no clear logic behind what was stored in the DeciderProvingKey vs the ProvingKey. Since we don't have much use for the traditional notion of a proving key in Honk (unlike in Plonk), I've opted to remove it entirely and place its data directly in the DeciderProvingKey.

Most lines in this PR relate to one of these changes:

  • There is a single circuit-size-like parameter in the DPK, accessed via dyadic_size()
  • A honk VK is now constructed as vk(pk->get_precomputed()) (instead of vk(pk->proving_key))
  • Lines containing proving_key->proving_key.foo have been reduced to proving_key->foo
  • "metadata" (circuit size and public inputs metadata) live in a MetaData struct. (Note: I'm open to a better name..)

AztecBot and others added 22 commits June 27, 2025 02:02
…tered (#15313)

We make the folding of Apps share a transcript until a kernel is encountered.
Bigfield internal audit related cleanup/fixes.
- Simplified data structs: `non_native_multiplication_witnesses` and
`non_native_partial_multiplication_witnesses`
- Reduced code duplication with new functions like
`get_binary_basis_limb_witness_indices`
- Resolved/removed some of the TODOs

resolves #14662 #14660 
resolves AztecProtocol/barretenberg#999
resolves #14658
@ledwards2225 ledwards2225 changed the base branch from next to merge-train/barretenberg June 29, 2025 03:43
}
}

template <class Flavor>

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.

This didn't belong here - moved to the DPK

@ledwards2225 ledwards2225 marked this pull request as ready for review June 29, 2025 20:57

@fcarreiro fcarreiro Jun 30, 2025

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.

Should we consider a bigger change in the AVM to remove ProvingKey or at least rename it? (our team, I mean).

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.

My understanding is that ProverPolynomials are equivalent to ProvingKey without the shifted entities in the AVM. Therefore, I am wondering if we really need ProvingKey to be defined.
I would say a rename might not really be worth it. If we can easily remove it then let us do it (could be a task once AVM is fully constrained though.)

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.

It would likely be quite a simple change to get rid of it but the AVM usage of the PK has already diverged from the rest of the proving systems so I didn't want to mess around there

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.

Ok! created #15402

@lucasxia01 lucasxia01 self-requested a review June 30, 2025 23:49
std::shared_ptr<ClientIVC::DeciderProvingKey> proving_key = get_acir_program_decider_proving_key(program);
auto verification_key = std::make_shared<ClientIVC::MegaVerificationKey>(proving_key->proving_key);
auto verification_key =
std::make_shared<ClientIVC::MegaVerificationKey>(proving_key->polynomials, proving_key->metadata);

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.

maybe we should rename all of these to be decider_proving_key?

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.

although maybe thats a bad name too

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.

would like to rename but I'll leave that for a follow on. I think maybe instance should come back

@AztecBot AztecBot force-pushed the merge-train/barretenberg branch from 6e073a5 to 1829e9a Compare July 2, 2025 18:42
@AztecBot AztecBot force-pushed the merge-train/barretenberg branch 2 times, most recently from 141bfcd to 74bac59 Compare July 3, 2025 03:06
Comment thread barretenberg/cpp/src/barretenberg/flavor/flavor.hpp Outdated
@@ -169,9 +143,9 @@ template <typename FF, typename CommitmentKey_> class ProvingKey_ {
template <typename PrecomputedCommitments> class NativeVerificationKey_ : public PrecomputedCommitments {

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.

why not use Metadata in this class?

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.

I briefly went down that path but its a bit messy because of all the different pub input keys. Once those go away I'll reconsider

@lucasxia01 lucasxia01 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.

Looks good in general, just left a bunch of comments

commitment = ck.commit(polynomial);
set_metadata(metadata);

CommitmentKey commitment_key{ metadata.circuit_size };

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.

now, we always create a new commitment key, but maybe we should maintain the previous logic of only creating a new one if necessary, although that logic seems icky.

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.

we now just have a persistent srs so constructing a new one is cheap and free as long as the one in the PK is still around so this is basically the same logic that existed before

@lucasxia01 lucasxia01 Jul 7, 2025

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.

what happens if the new one requires more points? I guess it just allocates the extra points?

Comment thread barretenberg/cpp/src/barretenberg/flavor/permutation_lib.test.cpp
this->num_public_inputs = metadata.num_public_inputs;
this->pub_inputs_offset = metadata.pub_inputs_offset;
this->pairing_inputs_public_input_key = metadata.pairing_inputs_public_input_key;
this->ipa_claim_public_input_key = metadata.ipa_claim_public_input_key;

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.

why will they go away?

Comment thread barretenberg/cpp/src/barretenberg/honk/composer/permutation_lib.hpp
Comment thread barretenberg/cpp/src/barretenberg/flavor/flavor.hpp Outdated
this->num_public_inputs = metadata.num_public_inputs;
this->pub_inputs_offset = metadata.pub_inputs_offset;
this->pairing_inputs_public_input_key = metadata.pairing_inputs_public_input_key;
this->ipa_claim_public_input_key = metadata.ipa_claim_public_input_key;

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.

actually, I'm also confused why they weren't there before

Comment thread barretenberg/cpp/src/barretenberg/ultra_honk/decider_proving_key.hpp Outdated
Comment thread barretenberg/cpp/src/barretenberg/honk/composer/permutation_lib.hpp Outdated
Comment thread barretenberg/cpp/src/barretenberg/honk/composer/permutation_lib.hpp Outdated
Comment thread barretenberg/cpp/src/barretenberg/ultra_honk/decider_proving_key.hpp Outdated
@AztecBot AztecBot force-pushed the merge-train/barretenberg branch from 913ed6b to 4bc2037 Compare July 4, 2025 02:11
@ledwards2225 ledwards2225 merged commit 6bf35ca into merge-train/barretenberg Jul 5, 2025
5 checks passed
@ledwards2225 ledwards2225 deleted the lde/no_pk branch July 5, 2025 23:41
VerificationKey(const VerificationKey& vk) = default;

void set_metadata(const ProvingKey& proving_key)
void set_metadata(const MetaData& metadata)

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.

interesting that this doesn't exist for other flavors

if (incoming->get_overflow_size() > accumulator->get_overflow_size()) {
std::swap(accumulator->polynomials, incoming->polynomials); // swap the polys
std::swap(lagranges[0], lagranges[1]); // swap the lagrange coefficients so the sum is unchanged
accumulator->set_dyadic_size(incoming->dyadic_size()); // update dyadic size of accumulator

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.

there's no swapping here anymore?

github-merge-queue Bot pushed a commit that referenced this pull request Jul 9, 2025
See
[merge-train-readme.md](https://github.com/AztecProtocol/aztec-packages/blob/next/.github/workflows/merge-train-readme.md).

BEGIN_COMMIT_OVERRIDE
chore: stdlib bool internal audit  (#15070)
feat: improve Shplonk api (#15422)
fix(merge-train): don't queue merge if merge-train failed queue, pass on
rebase logic (#15508)
chore: nuke bit array (#15522)
chore: remove template parameters (#15530)
chore: no PK (#15386)
chore!: Correct public inputs propagation in the tube (#15547)
chore: use `batch_invert` in native IPA verifier (#15557)
chore: Move `stdlib::uint_plookup` to `stdlib::uint` (#15460)
chore: use const ref commitment keys (#15584)
fix: hiding circuit vk computed only once (#15589)
feat: transcript can hash objects independently (#15510)
chore: readme for benchmarking remotely (#15512)
chore: fix avm test (#15592)
chore: hash more stuff for IPA. (#15519)
chore: fix avm build in merge-train/bb (#15594)
feat!: structured public inputs via kernel io (#15383)
fix!: aggregate correct nested pairing points in the hiding circuit
(#15598)
fix: bb merge-train conflicts (#15617)
chore: Refactor shplonk verifier api (#15618)
chore!: databus consistency checks in the hiding circuit (#15599)
feat!: VK hash consistency check (#15591)
END_COMMIT_OVERRIDE

---------

Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: sergei iakovenko <105737703+iakovenkos@users.noreply.github.com>
Co-authored-by: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Co-authored-by: Suyash Bagad <suyash@aztecprotocol.com>
Co-authored-by: Jonathan Hao <jonathan@aztec-labs.com>
Co-authored-by: ledwards2225 <98505400+ledwards2225@users.noreply.github.com>
Co-authored-by: Raju Krishnamoorthy <krishnamoorthy@gmail.com>
Co-authored-by: notnotraju <raju@aztec-labs.com>
Co-authored-by: Lucas Xia <lucasxia01@gmail.com>
Co-authored-by: Khashayar Barooti <khashayar@aztecprotocol.com>
Co-authored-by: Jean M <132435771+jeanmon@users.noreply.github.com>
Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com>
Co-authored-by: Santiago Palladino <spalladino@users.noreply.github.com>
Co-authored-by: Santiago Palladino <santiago@aztec-labs.com>
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.

8 participants