Skip to content
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

Stark: Stone prover compatibility end to end for Fibonacci AIR #596

Merged
merged 79 commits into from
Oct 17, 2023

Conversation

schouhy
Copy link
Contributor

@schouhy schouhy commented Oct 6, 2023

Stark: Stone prover compatibility end to end for Fibonacci AIR

Description

This PR implements the same Merkle tree and FRI logic to obtain the same exact results as the Stone prover for the Fibonacci AIR for a single FRI query and no grinding factor. The source of the test cases can be found here.

Support for multiple queries, grinding factor and docs will be added in subsequent PRs.

@schouhy schouhy changed the title POC: Stone compatibility end to end for Fibonacci AIR Stark: Stone prover compatibility end to end for Fibonacci AIR Oct 17, 2023
@schouhy schouhy marked this pull request as ready for review October 17, 2023 14:50
@schouhy schouhy requested review from ajgara and a team as code owners October 17, 2023 14:50
Comment on lines 931 to 934
pub struct Prover;

impl IsStarkProver for Prover {
type Field = Stark252PrimeField;
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be better for this type definition to be on top of the file, before the function, so it doesn't get lost

@entropidelic entropidelic mentioned this pull request Oct 17, 2023
3 tasks
Comment on lines +111 to +112
let commitment = tree.root;
(tree, commitment)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe I'm missing some detail, but couldn't we just return the tree directly and use tree.root outside the function when needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, we can do that. But we lose the semantics of that function, because we wouldn't be commiting anymore, just building a merkle tree. We would have to rename it.

Copy link
Contributor

@entropidelic entropidelic Oct 17, 2023

Choose a reason for hiding this comment

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

ok maybe not too important for now, lets leave it like this

Copy link
Collaborator

Choose a reason for hiding this comment

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

Name is tricky, it's doing a commitment and returning the tree for further use

@schouhy schouhy mentioned this pull request Oct 17, 2023
9 tasks
.zip(evaluation_point_inverse)
.enumerate()
.fold(true, |mut result, (i, ((proof_s, iota_s), eval))| {
// this is done in constant time
Copy link
Collaborator

Choose a reason for hiding this comment

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

This constant time comment, I'm not sure if it's useful

@MauroToscano MauroToscano added this pull request to the merge queue Oct 17, 2023
Merged via the queue into main with commit a1f2fa7 Oct 17, 2023
6 checks passed
@MauroToscano MauroToscano deleted the composition-poly-compatibility-poc branch October 17, 2023 18:52
PatStiles pushed a commit to PatStiles/lambdaworks that referenced this pull request Oct 18, 2023
…aclass#596)

* add test

* make trace commitment SHARP compatible

* wip

* use powers of a single challenge for the boundary and transition coefficients

* add permutation to match sharp compatible commitments on the trace

* change trait bound from ByteConversion to Serializable

* minor refactor

* fmt, clippy

* move std feature to inner trait function in Serializable

* add IsStarkProver and IsStarkVerifier traits

* proof of concept

* composition poly breaker

* WIP: commitment composition poly works. Opens are broken.

* WIP Refactor open_trace_polys and open_composition_poly

* Refactor sample iotas

* Refactor sample iotas

* make fri a trait

* change trace ood evaluations in transcript

* wip

* sample gammas as power of a single challenge

* fix z fri sampling

* wip

* wip

* wip, broken

* Compiles but fibonacci_5 does not work

* Opens of query phase and OOD broken. Commit phase of FRI works.

* Dont append to the transcript when grinding factor is zero

* skip grinding factor when security bits is zero

* remove permutation function

* fmt

* fix standard verifier

* removes deep consistency check and openings of the first layer of fri for each query

* SHARP computes the trace and composition polynomial openings and their symmetric elements consistently

* Test symmetric elements in trace openings to compute deep composition polynomial

* Composition polynomial opening evaluations are splitted between symmetric and not. The authentication paths remain equal

* check openings in symmetric elements

* make verifier sharp compatible

* compute number of parts

* fix verify fri for original prover

* fix verify sym in stone prover

* rename

* rename file

* wip

* remove unnecessary variable

* wip

* move verifier

* move fri

* fix open

* move stone to prover

* remove file

* fmt

* clippy

* clippy

* remove redundant trait bounds

* remove custom serialization/deserialization and replace it with serde_cbor

* fmt

* clippy

* remove old files after merge from main

* fmt

* make field a type of IsStarkVerifier

* remove frame serialization

* separate compatibility test into individual tests

* remove redundant test

* add test case 2

* minor refactor. add docs

* minor refactor

* remove unnecessary method

* revert unintended changes to exercises

* clippy

* remove isFri trait

* move Prover definition to the top of the file

* update  docs and add unit test

* minor refactors. clippy

* remove unused trait method

* Move function only used for tests, to tests

---------

Co-authored-by: Agustin <[email protected]>
Co-authored-by: MauroFab <[email protected]>
PatStiles pushed a commit to PatStiles/lambdaworks that referenced this pull request Oct 20, 2023
…aclass#596)

* add test

* make trace commitment SHARP compatible

* wip

* use powers of a single challenge for the boundary and transition coefficients

* add permutation to match sharp compatible commitments on the trace

* change trait bound from ByteConversion to Serializable

* minor refactor

* fmt, clippy

* move std feature to inner trait function in Serializable

* add IsStarkProver and IsStarkVerifier traits

* proof of concept

* composition poly breaker

* WIP: commitment composition poly works. Opens are broken.

* WIP Refactor open_trace_polys and open_composition_poly

* Refactor sample iotas

* Refactor sample iotas

* make fri a trait

* change trace ood evaluations in transcript

* wip

* sample gammas as power of a single challenge

* fix z fri sampling

* wip

* wip

* wip, broken

* Compiles but fibonacci_5 does not work

* Opens of query phase and OOD broken. Commit phase of FRI works.

* Dont append to the transcript when grinding factor is zero

* skip grinding factor when security bits is zero

* remove permutation function

* fmt

* fix standard verifier

* removes deep consistency check and openings of the first layer of fri for each query

* SHARP computes the trace and composition polynomial openings and their symmetric elements consistently

* Test symmetric elements in trace openings to compute deep composition polynomial

* Composition polynomial opening evaluations are splitted between symmetric and not. The authentication paths remain equal

* check openings in symmetric elements

* make verifier sharp compatible

* compute number of parts

* fix verify fri for original prover

* fix verify sym in stone prover

* rename

* rename file

* wip

* remove unnecessary variable

* wip

* move verifier

* move fri

* fix open

* move stone to prover

* remove file

* fmt

* clippy

* clippy

* remove redundant trait bounds

* remove custom serialization/deserialization and replace it with serde_cbor

* fmt

* clippy

* remove old files after merge from main

* fmt

* make field a type of IsStarkVerifier

* remove frame serialization

* separate compatibility test into individual tests

* remove redundant test

* add test case 2

* minor refactor. add docs

* minor refactor

* remove unnecessary method

* revert unintended changes to exercises

* clippy

* remove isFri trait

* move Prover definition to the top of the file

* update  docs and add unit test

* minor refactors. clippy

* remove unused trait method

* Move function only used for tests, to tests

---------

Co-authored-by: Agustin <[email protected]>
Co-authored-by: MauroFab <[email protected]>
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.

5 participants