-
Notifications
You must be signed in to change notification settings - Fork 613
feat: UltraRollupRecursiveFlavor #10088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
124b188
5ebabd7
2662eab
8a488a7
b3e5265
64a3105
bc41b7d
907cbbd
705a5b4
66421c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -331,6 +331,7 @@ class MegaZKFlavor; | |
| class TranslatorFlavor; | ||
| class AvmFlavor; | ||
| template <typename BuilderType> class UltraRecursiveFlavor_; | ||
| template <typename BuilderType> class UltraRollupRecursiveFlavor_; | ||
| template <typename BuilderType> class MegaRecursiveFlavor_; | ||
| template <typename BuilderType> class MegaZKRecursiveFlavor_; | ||
| template <typename BuilderType> class TranslatorRecursiveFlavor_; | ||
|
|
@@ -367,30 +368,31 @@ template <typename T> | |
| concept IsMegaFlavor = IsAnyOf<T, MegaFlavor, MegaZKFlavor, | ||
| MegaRecursiveFlavor_<UltraCircuitBuilder>, | ||
| MegaRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| MegaZKRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaZKRecursiveFlavor_<UltraCircuitBuilder>>; | ||
| MegaRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| MegaZKRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaZKRecursiveFlavor_<UltraCircuitBuilder>>; | ||
|
|
||
| template <typename T> | ||
| concept HasDataBus = IsMegaFlavor<T>; | ||
|
|
||
| template <typename T> | ||
| concept HasIPAAccumulatorFlavor = IsAnyOf<T, UltraRollupFlavor>; | ||
| concept HasIPAAccumulatorFlavor = IsAnyOf<T, UltraRollupFlavor, UltraRollupRecursiveFlavor_<UltraCircuitBuilder>>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: concept name is ungrammatical;
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah fair. Was following the style of some of the other flavor names which have Flavor in them, but I can remove this one |
||
|
|
||
| template <typename T> | ||
| concept IsRecursiveFlavor = IsAnyOf<T, UltraRecursiveFlavor_<UltraCircuitBuilder>, | ||
| UltraRecursiveFlavor_<MegaCircuitBuilder>, | ||
| UltraRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| UltraRollupRecursiveFlavor_<UltraCircuitBuilder>, | ||
| MegaRecursiveFlavor_<UltraCircuitBuilder>, | ||
| MegaRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| MegaZKRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaZKRecursiveFlavor_<UltraCircuitBuilder>, | ||
| TranslatorRecursiveFlavor_<UltraCircuitBuilder>, | ||
| TranslatorRecursiveFlavor_<MegaCircuitBuilder>, | ||
| TranslatorRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| ECCVMRecursiveFlavor_<UltraCircuitBuilder>, | ||
| AvmRecursiveFlavor_<UltraCircuitBuilder>>; | ||
| MegaRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| MegaZKRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaZKRecursiveFlavor_<UltraCircuitBuilder>, | ||
| TranslatorRecursiveFlavor_<UltraCircuitBuilder>, | ||
| TranslatorRecursiveFlavor_<MegaCircuitBuilder>, | ||
| TranslatorRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| ECCVMRecursiveFlavor_<UltraCircuitBuilder>, | ||
| AvmRecursiveFlavor_<UltraCircuitBuilder>>; | ||
|
|
||
| template <typename T> concept IsECCVMRecursiveFlavor = IsAnyOf<T, ECCVMRecursiveFlavor_<UltraCircuitBuilder>>; | ||
|
|
||
|
|
@@ -406,11 +408,12 @@ template <typename T> concept IsFoldingFlavor = IsAnyOf<T, UltraFlavor, | |
| UltraRecursiveFlavor_<UltraCircuitBuilder>, | ||
| UltraRecursiveFlavor_<MegaCircuitBuilder>, | ||
| UltraRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| UltraRollupRecursiveFlavor_<UltraCircuitBuilder>, | ||
| MegaRecursiveFlavor_<UltraCircuitBuilder>, | ||
| MegaRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| MegaZKRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaZKRecursiveFlavor_<UltraCircuitBuilder>>; | ||
| MegaRecursiveFlavor_<CircuitSimulatorBN254>, | ||
| MegaZKRecursiveFlavor_<MegaCircuitBuilder>, | ||
| MegaZKRecursiveFlavor_<UltraCircuitBuilder>>; | ||
| template <typename T> | ||
| concept FlavorHasZK = T::HasZK; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,8 +24,8 @@ UltraRecursiveVerifier_<Flavor>::UltraRecursiveVerifier_(Builder* builder, const | |
| * @return Output aggregation object | ||
| */ | ||
| template <typename Flavor> | ||
| UltraRecursiveVerifier_<Flavor>::AggregationObject UltraRecursiveVerifier_<Flavor>::verify_proof( | ||
| const HonkProof& proof, AggregationObject agg_obj) | ||
| UltraRecursiveVerifier_<Flavor>::Output UltraRecursiveVerifier_<Flavor>::verify_proof(const HonkProof& proof, | ||
| AggregationObject agg_obj) | ||
| { | ||
| StdlibProof<Builder> stdlib_proof = bb::convert_native_proof_to_stdlib(builder, proof); | ||
| return verify_proof(stdlib_proof, agg_obj); | ||
|
|
@@ -36,8 +36,8 @@ UltraRecursiveVerifier_<Flavor>::AggregationObject UltraRecursiveVerifier_<Flavo | |
| * @return Output aggregation object | ||
| */ | ||
| template <typename Flavor> | ||
| UltraRecursiveVerifier_<Flavor>::AggregationObject UltraRecursiveVerifier_<Flavor>::verify_proof( | ||
| const StdlibProof<Builder>& proof, AggregationObject agg_obj) | ||
| UltraRecursiveVerifier_<Flavor>::Output UltraRecursiveVerifier_<Flavor>::verify_proof(const StdlibProof<Builder>& proof, | ||
| AggregationObject agg_obj) | ||
| { | ||
| using Sumcheck = ::bb::SumcheckVerifier<Flavor>; | ||
| using PCS = typename Flavor::PCS; | ||
|
|
@@ -127,7 +127,39 @@ UltraRecursiveVerifier_<Flavor>::AggregationObject UltraRecursiveVerifier_<Flavo | |
| pairing_points[1] = pairing_points[1].normalize(); | ||
| // TODO(https://github.com/AztecProtocol/barretenberg/issues/995): generate recursion separator challenge properly. | ||
| agg_obj.aggregate(pairing_points, recursion_separator); | ||
| return agg_obj; | ||
| Output output; | ||
| output.agg_obj = std::move(agg_obj); | ||
|
|
||
| // Extract the IPA claim from the public inputs | ||
| // Parse out the nested IPA claim using key->ipa_claim_public_input_indices and runs the native IPA verifier. | ||
| if constexpr (HasIPAAccumulatorFlavor<Flavor>) { | ||
| const auto recover_fq_from_public_inputs = [](std::array<FF, 4>& limbs) { | ||
| for (size_t k = 0; k < 4; k++) { | ||
|
lucasxia01 marked this conversation as resolved.
Outdated
|
||
| limbs[k].create_range_constraint(Curve::BaseField::NUM_LIMB_BITS, "limb_" + std::to_string(k)); | ||
| } | ||
| return Curve::BaseField::unsafe_construct_from_limbs(limbs[0], limbs[1], limbs[2], limbs[3], false); | ||
| }; | ||
|
|
||
| if (verification_key->verification_key->contains_ipa_claim) { | ||
| OpeningClaim<grumpkin<Builder>> ipa_claim; | ||
| std::array<FF, 4> bigfield_limbs; | ||
| for (size_t k = 0; k < 4; k++) { | ||
| bigfield_limbs[k] = | ||
| verification_key | ||
| ->public_inputs[verification_key->verification_key->ipa_claim_public_input_indices[k]]; | ||
| } | ||
| ipa_claim.opening_pair.challenge = recover_fq_from_public_inputs(bigfield_limbs); | ||
| ipa_claim.opening_pair.evaluation = 0; | ||
| ipa_claim.commitment = { | ||
| verification_key->public_inputs[verification_key->verification_key->ipa_claim_public_input_indices[4]], | ||
| verification_key->public_inputs[verification_key->verification_key->ipa_claim_public_input_indices[5]], | ||
| false // WORKTODO: make this a witness? | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe this can stay as a constant? |
||
| }; | ||
| output.ipa_opening_claim = std::move(ipa_claim); | ||
| } | ||
| } | ||
|
|
||
| return output; | ||
| } | ||
|
|
||
| template class UltraRecursiveVerifier_<bb::UltraRecursiveFlavor_<UltraCircuitBuilder>>; | ||
|
|
@@ -138,4 +170,5 @@ template class UltraRecursiveVerifier_<bb::MegaZKRecursiveFlavor_<MegaCircuitBui | |
| template class UltraRecursiveVerifier_<bb::MegaZKRecursiveFlavor_<UltraCircuitBuilder>>; | ||
| template class UltraRecursiveVerifier_<bb::UltraRecursiveFlavor_<CircuitSimulatorBN254>>; | ||
| template class UltraRecursiveVerifier_<bb::MegaRecursiveFlavor_<CircuitSimulatorBN254>>; | ||
| template class UltraRecursiveVerifier_<bb::UltraRollupRecursiveFlavor_<UltraCircuitBuilder>>; | ||
| } // namespace bb::stdlib::recursion::honk | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,6 +189,23 @@ class CircuitSimulatorBN254 { | |
|
|
||
| [[nodiscard]] bool check_circuit() const { return !_failed; } | ||
|
|
||
| size_t create_ROM_array([[maybe_unused]] const size_t array_size) { return {}; } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. had to add these since cycle group takes in CircuitSimulator now, because its being used in the ultra RecursiveVerifier |
||
|
|
||
| void set_ROM_element_pair([[maybe_unused]] const size_t rom_id, | ||
| [[maybe_unused]] const size_t index_value, | ||
| [[maybe_unused]] const std::array<uint32_t, 2>& value_witnesses) | ||
| {} | ||
| uint32_t read_ROM_array([[maybe_unused]] const size_t rom_id, [[maybe_unused]] const uint32_t index_witness) | ||
| { | ||
| return {}; | ||
| } | ||
| std::array<uint32_t, 2> read_ROM_array_pair([[maybe_unused]] const size_t rom_id, | ||
| [[maybe_unused]] const uint32_t index_witness) | ||
| { | ||
| return {}; | ||
| } | ||
| void create_ecc_dbl_gate([[maybe_unused]] const ecc_dbl_gate_<FF>& in){}; | ||
|
|
||
| // Public input indices which contain recursive proof information | ||
| PairingPointAccumulatorPubInputIndices pairing_point_accumulator_public_input_indices; | ||
| }; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.