Skip to content

Conversation

@4l0n50
Copy link
Contributor

@4l0n50 4l0n50 commented Sep 19, 2025

Closes #73.

@4l0n50 4l0n50 force-pushed the alonso/merkle_gate_signed branch from 91be193 to 39905dc Compare September 22, 2025 09:17
@4l0n50 4l0n50 marked this pull request as ready for review September 22, 2025 09:18
@Nashtare Nashtare added this to the Verifier primitives milestone Sep 22, 2025
@sai-deng
Copy link
Contributor

sai-deng commented Oct 6, 2025

MerkleVerify be part of the default policy

I think we should keep default policy to disable ALL non-primitive operations.

@4l0n50
Copy link
Contributor Author

4l0n50 commented Oct 6, 2025

As discussed with @hratoanina and @LindaGuiga — we’re not supporting packing yet. So I added a, for now disabled, packing option to Merkle gates.

@sai-deng
Copy link
Contributor

sai-deng commented Oct 6, 2025

As discussed with @hratoanina and @LindaGuiga — we’re not supporting packing yet. So I added a, for now disabled, packing option to Merkle gates.

Could you please explain why packing is disabled for now?

@LindaGuiga
Copy link
Contributor

As discussed with @hratoanina and @LindaGuiga — we’re not supporting packing yet. So I added a, for now disabled, packing option to Merkle gates.

Could you please explain why packing is disabled for now?

The problem with fully packing everything (so for example, when creating a proof structure), is that the challenger sometimes needs to observe both base field and extension field elements, without adding any padding in between. So for example, if you have to observe degree_bits (one base field element, and we do it at the start of the verifier) then elements that are packed, you might overflow the sponge rate (since, because of that first base field element, we would have something that is no longer a multiple of the rate). The correct behaviour then would be to fill the rate with base field elements (therefore breaking up packed elements), apply the permutation, and then add the rest of the base field elements. But for now, given the current Witness table, we don't have a way to select one base field element among the D in a packed extension field element. We can change the Witness table to support the selection of individual elements, though.

@sai-deng
Copy link
Contributor

sai-deng commented Oct 7, 2025

As discussed with @hratoanina and @LindaGuiga — we’re not supporting packing yet. So I added a, for now disabled, packing option to Merkle gates.

Could you please explain why packing is disabled for now?

The problem with fully packing everything (so for example, when creating a proof structure), is that the challenger sometimes needs to observe both base field and extension field elements, without adding any padding in between. So for example, if you have to observe degree_bits (one base field element, and we do it at the start of the verifier) then elements that are packed, you might overflow the sponge rate (since, because of that first base field element, we would have something that is no longer a multiple of the rate). The correct behaviour then would be to fill the rate with base field elements (therefore breaking up packed elements), apply the permutation, and then add the rest of the base field elements. But for now, given the current Witness table, we don't have a way to select one base field element among the D in a packed extension field element. We can change the Witness table to support the selection of individual elements, though.

I think the correct and most efficient way to solve it is to change Plonky3 prover to only observe extension field elements. We can add a TODO for now.

Copy link
Contributor

@sai-deng sai-deng left a comment

Choose a reason for hiding this comment

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

@4l0n50 I pushed a rename commit and another commit with several fixes. Please review and merge the PR as soon as possible to unblock others.

My fixes include:
Adding root indices to the AIR tables.
Fixing missing or incorrect constraints in AIR tables.
Correcting the logic for hashing extra siblings.

@github-project-automation github-project-automation bot moved this from Ready for review to Ready to be merged in Plonky3 Recursion Oct 8, 2025
Copy link
Contributor Author

@4l0n50 4l0n50 left a comment

Choose a reason for hiding this comment

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

I'm ok with your changes. Thanks for you help!

@4l0n50 4l0n50 merged commit 011d3fc into main Oct 8, 2025
8 checks passed
@4l0n50 4l0n50 deleted the alonso/merkle_gate_signed branch October 8, 2025 08:59
@github-project-automation github-project-automation bot moved this from Ready to be merged to Done in Plonky3 Recursion Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add a MerkleVerify gate

5 participants