-
Notifications
You must be signed in to change notification settings - Fork 235
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
feat: IPA Accumulator in Builder #9846
base: master
Are you sure you want to change the base?
Conversation
opening_pair.challenge.binary_basis_limbs[1].element.normalize().witness_index, | ||
opening_pair.challenge.binary_basis_limbs[2].element.normalize().witness_index, | ||
opening_pair.challenge.binary_basis_limbs[3].element.normalize().witness_index, | ||
// opening_pair.evaluation.binary_basis_limbs[0].element.normalize().witness_index, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the evaluation is always 0 for our case I believe, so it doesn't have any witness indices
@@ -749,20 +749,21 @@ template <typename Curve_> class IPA { | |||
} | |||
|
|||
/** | |||
* @brief Takes two IPA claims and accumulates them into 1 IPA claim. | |||
* @details We create an IPA accumulator by running the IPA recursive verifier on each claim. Then, we generate challenges, and use these challenges to compute the new accumulator. We also create the accumulated polynomial. | |||
* @brief Takes two IPA claims and accumulates them into 1 IPA claim. Also computes IPA proof for the claim. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified so that accumulate just returns the IPA proof directly
@@ -33,8 +33,8 @@ using namespace bb::join_split_example::proofs::notes::native; | |||
using key_pair = join_split_example::fixtures::grumpkin_key_pair; | |||
|
|||
auto create_account_leaf_data(fr const& account_alias_hash, | |||
grumpkin::g1::affine_element const& owner_key, | |||
grumpkin::g1::affine_element const& signing_key) | |||
bb::grumpkin::g1::affine_element const& owner_key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to add namespace stuff to avoid ambiguous errors...
@@ -379,6 +379,9 @@ MegaZKRecursiveFlavor_<UltraCircuitBuilder>>; | |||
template <typename T> | |||
concept HasDataBus = IsMegaFlavor<T>; | |||
|
|||
template <typename T> | |||
concept DoesRecursiveIPA = IsAnyOf<T, UltraFlavor, UltraFlavorWithZK>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not ultra keccak because that will only be called on the root rollup circuit which will just verify the IPA claim.
tube_builder->add_pairing_point_accumulator( | ||
stdlib::recursion::init_default_agg_obj_indices<Builder>(*tube_builder)); | ||
// The tube only calls an IPA recursive verifier once, so we can just add this IPA claim and proof |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the tube circuit, add the IPA claim
using byte_array_ct = byte_array<Builder>; | ||
using field_ct = field_t<Builder>; | ||
using witness_ct = witness_t<Builder>; | ||
using bool_ct = stdlib::bool_t<Builder>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespace changes for some reason.. maybe because of extra includes
|
||
EXPECT_DEBUG_DEATH(verifier.verify(proof), "(ipa_relation.get_value.* == -opening_claim.commitment.get_value.*)"); | ||
static_cast<void>(goblin_rec_verifier_output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the proper fix here is to run a IPA verifier on the claim to check it, which should fail.
bool contains_pairing_point_accumulator = false; | ||
|
||
// Public input indices which contain the output IPA opening claim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the IPA claim public inputs to the builder
IPAClaimPubInputIndices ipa_claim_public_input_indices; | ||
bool contains_ipa_claim = false; | ||
|
||
uint32_t ipa_verifier_count = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will delete this since the builder will not keep track of this
@@ -47,6 +47,11 @@ TYPED_TEST(FlavorSerializationTests, VerificationKeySerialization) | |||
// Set the pcs ptr to null since this will not be reconstructed correctly from buffer | |||
original_vkey.pcs_verification_key = nullptr; | |||
|
|||
// probably not needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could probably delete this
@@ -307,12 +307,17 @@ template <IsHonkFlavor Flavor> class DeciderProvingKey_ { | |||
proving_key.public_inputs.emplace_back(proving_key.polynomials.w_r[idx]); | |||
} | |||
|
|||
// Set the recursive proof indices | |||
if constexpr (DoesRecursiveIPA<Flavor>) { // Set the IPA claim indices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copies the ipa stuff over to the proving key from the builder
bool operator==(const VerificationKey&) const = default; | ||
VerificationKey() = default; | ||
VerificationKey(const size_t circuit_size, const size_t num_public_inputs) | ||
: VerificationKey_(circuit_size, num_public_inputs) | ||
{} | ||
VerificationKey(ProvingKey& proving_key) | ||
: contains_ipa_claim(proving_key.contains_ipa_claim) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copies the proving key ipa stuff to the vk
Adds IPA claim to builder, pk, vk, so that the verifier knows where to look to extract the IPA claim from. Modifies the UltraRecursiveVerifier to extract out the IPA claim from the public inputs and returns it