Skip to content

fix: use permutation constraints for quotient degree calculation #11

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

Merged
merged 4 commits into from
May 10, 2024

Conversation

shuklaayush
Copy link
Contributor

Replaced air.eval with rap.eval for calculating quotient polynomial degree. This should remove the need for dummy constraints in chips

Comment on lines +204 to +206
type EF = F;
type ExprEF = SymbolicExpression<F>;
type VarEF = SymbolicVariable<F>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally, these should be symbolic in the extension field but it shouldn't matter just for degree calculation

Comment on lines +21 to +22
x: Arc<Self>,
y: Arc<Self>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was getting errors with Rc usage here so I copied the file and changed it to Arc. We could reuse the uni-stark version if we get rid of the errors

@shuklaayush shuklaayush requested a review from jonathanpwang May 10, 2024 07:17
@@ -268,12 +268,14 @@ impl<SC: StarkGenericConfig> PartitionProver<SC> {
let quotient_degrees = raps
.iter()
.zip(std::iter::repeat(preprocessed_traces_with_domains.iter()).flatten())
Copy link
Contributor

Choose a reason for hiding this comment

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

does the repeat need to be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, probably can be removed. I can create a PR. The reason I added the repeat was because I thought we were proving multiple vertically-stacked partitions here (like shards) and each partition itself was multiple AIRs. My understanding now is that these are horizontally-stacked partitions where each partition is still multiple AIRs.

The only issue I see is that you have to match each AIR of a partition with the corresponding preprocessed AIR. If the partitions are ordered and don't skip any AIR, then just removing the repeat is fine. Otherwise, we need to either pass in a different pk for each call or have a pointer with each AIR that helps in selecting the corresponding preprocessed trace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it in #13

Copy link
Contributor

@jonathanpwang jonathanpwang left a comment

Choose a reason for hiding this comment

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

One comment.
There is still issue about multiple chips where only some have preprocessed, but out of scope for this PR

@jonathanpwang
Copy link
Contributor

@shuklaayush needs a rebase fix

@shuklaayush shuklaayush force-pushed the fix/quotient-degree-perm branch from bf85996 to 5334bc0 Compare May 10, 2024 17:29
@jonathanpwang jonathanpwang merged commit 1e6737b into main May 10, 2024
@jonathanpwang jonathanpwang deleted the fix/quotient-degree-perm branch May 10, 2024 17:32
luffykai pushed a commit that referenced this pull request Dec 13, 2024
* fix: use perm trace for quotient degree calc

* fix: remove dummy constraints

* fix: remove comment

* fix: remove extra file
Avaneesh-axiom pushed a commit that referenced this pull request Jan 10, 2025
* Add cache for SymbolicEvaluator

* Replace HashMap with FxHashMap
jonathanpwang pushed a commit that referenced this pull request Mar 9, 2025
jonathanpwang added a commit that referenced this pull request Mar 9, 2025
…ications (#29)

* [fix] Fix P256 `GENERATOR` and `double_impl` (#2)

* fix p256-generator

* add host tests for ecc

* Use private repo for stark-backend (#11)

* temp(ci): switch riscv AMI for runner (#14)

* [chore] Update DSL verify to match plonky3 (#5)

* Update DSL verify to match plonky3

* fix: transpose state for p3-keccak tracegen

* chore: add comment linking plonky3 issue

* Update stark-backend commit

---------

Co-authored-by: Jonathan Wang <[email protected]>

* Use full commit in openvm-stark-backend revision (#18)

* chore: update `stark-backend` commit (#19)

* [fix] `Rv32BaseAluAdapterAir` unconstrained register reads (#25)

* Create pull_request_template.md (#26)

* [fix] Poseidon2 verify_batch opcode can send to execution bus for invalid rows (#17)

* [fix] Rust memory allocation overflow (#13)

* Fix and add test

* Fix lint error

* Update crates/toolchain/platform/src/memory.rs

---------

Co-authored-by: Jonathan Wang <[email protected]>

* [fix] Constrain `final_hash` in sha256 air to address audit finding (#12)

* [fix] properly constrain final_hash in sha256 air

* Add negative test for underconstrained final_hash. It was manually checked that this new test would have passed before the change.

* [fix] IsLtArraySubAir (#9)

* add fix

* add tests

* remove diff_val

* chore: update comment

* chore: no try_inverse

---------

Co-authored-by: Jonathan Wang <[email protected]>

* [fix] `Rv32BaseAluAdapterAir` immediate limbs not range-checked (#8)

* fix local_as2

* range check imm limbs

* add count for range check

* add test for unconstrained imm limb

* fix MemoryTester chip trace height

* add test for unconstrained rs2 read

* Revert "fix local_as2"

This reverts commit ef83121bf1796874affaca4682dbb4f9f051b079.

* Revert "add count for range check"

This reverts commit 5252444dfeaf41e7c336648ad92c4736f48ead9d.

* Revert "range check imm limbs"

This reverts commit 2e2937536069ae66849fdf7bba9ea509065d17fe.

* fix unconstrained imm limbs

* fix local_rs2_as test

* fix lint

* Update extensions/rv32im/circuit/src/base_alu/tests.rs

---------

Co-authored-by: Jonathan Wang <[email protected]>

* fix: fixed SHA2 subair trace generation and the testing (#28)

* fix: loadstore sign of immediate (#4)

* [fix] Fix P256 `GENERATOR` and `double_impl` (#2)

* fix p256-generator

* add host tests for ecc

* fix: loadstore sign of immediate

* fix: prints and test

* fix: load_sign_extend tests

* Update docs/specs/ISA.md

* clarify notation and sign extension in ISA spec

* fix reveal transpiler spec

---------

Co-authored-by: Manh Dinh <[email protected]>
Co-authored-by: Jonathan Wang <[email protected]>

* fix transpiler

* fix loadstore adapter

* fix store transpiler

* fix tests

* add e2e test

* fix docs

* fix: jalr imm_sign (#30)

* optimize record struct packing

* chore: use from_bool

* chore: derive_more feature in bench

* fix bench

* fix

---------

Co-authored-by: Xinding Wei <[email protected]>
Co-authored-by: Jonathan Wang <[email protected]>
Co-authored-by: Golovanov399 <[email protected]>
Co-authored-by: Avaneesh-axiom <[email protected]>
Co-authored-by: Arayi Khalatyan <[email protected]>
jonathanpwang added a commit that referenced this pull request Mar 9, 2025
* [fix] Fix P256 `GENERATOR` and `double_impl` (#2)

* fix p256-generator

* add host tests for ecc

* fix: hintstore mem_ptr and rem_words overflow

* fix: is_buffer_start constrain

* Use private repo for stark-backend (#11)

* temp(ci): switch riscv AMI for runner (#14)

* [chore] Update DSL verify to match plonky3 (#5)

* Update DSL verify to match plonky3

* fix: transpose state for p3-keccak tracegen

* chore: add comment linking plonky3 issue

* Update stark-backend commit

---------

Co-authored-by: Jonathan Wang <[email protected]>

* Use full commit in openvm-stark-backend revision (#18)

* chore: update `stark-backend` commit (#19)

* [fix] `Rv32BaseAluAdapterAir` unconstrained register reads (#25)

* Create pull_request_template.md (#26)

* [fix] Poseidon2 verify_batch opcode can send to execution bus for invalid rows (#17)

* [fix] Rust memory allocation overflow (#13)

* Fix and add test

* Fix lint error

* Update crates/toolchain/platform/src/memory.rs

---------

Co-authored-by: Jonathan Wang <[email protected]>

* [fix] Constrain `final_hash` in sha256 air to address audit finding (#12)

* [fix] properly constrain final_hash in sha256 air

* Add negative test for underconstrained final_hash. It was manually checked that this new test would have passed before the change.

* [fix] IsLtArraySubAir (#9)

* add fix

* add tests

* remove diff_val

* chore: update comment

* chore: no try_inverse

---------

Co-authored-by: Jonathan Wang <[email protected]>

* [fix] `Rv32BaseAluAdapterAir` immediate limbs not range-checked (#8)

* fix local_as2

* range check imm limbs

* add count for range check

* add test for unconstrained imm limb

* fix MemoryTester chip trace height

* add test for unconstrained rs2 read

* Revert "fix local_as2"

This reverts commit ef83121bf1796874affaca4682dbb4f9f051b079.

* Revert "add count for range check"

This reverts commit 5252444dfeaf41e7c336648ad92c4736f48ead9d.

* Revert "range check imm limbs"

This reverts commit 2e2937536069ae66849fdf7bba9ea509065d17fe.

* fix unconstrained imm limbs

* fix local_rs2_as test

* fix lint

* Update extensions/rv32im/circuit/src/base_alu/tests.rs

---------

Co-authored-by: Jonathan Wang <[email protected]>

* fix: fixed SHA2 subair trace generation and the testing (#28)

* fix: loadstore sign of immediate (#4)

* [fix] Fix P256 `GENERATOR` and `double_impl` (#2)

* fix p256-generator

* add host tests for ecc

* fix: loadstore sign of immediate

* fix: prints and test

* fix: load_sign_extend tests

* Update docs/specs/ISA.md

* clarify notation and sign extension in ISA spec

* fix reveal transpiler spec

---------

Co-authored-by: Manh Dinh <[email protected]>
Co-authored-by: Jonathan Wang <[email protected]>

* seperate the fixes

* fix naming

* fix: lints

---------

Co-authored-by: Manh Dinh <[email protected]>
Co-authored-by: Xinding Wei <[email protected]>
Co-authored-by: Jonathan Wang <[email protected]>
Co-authored-by: Golovanov399 <[email protected]>
Co-authored-by: Avaneesh-axiom <[email protected]>
jonathanpwang added a commit that referenced this pull request Mar 9, 2025
jonathanpwang pushed a commit that referenced this pull request Mar 9, 2025
jonathanpwang added a commit that referenced this pull request Mar 9, 2025
…ications (#29)

* [fix] Fix P256 `GENERATOR` and `double_impl` (#2)

* fix p256-generator

* add host tests for ecc

* Use private repo for stark-backend (#11)

* temp(ci): switch riscv AMI for runner (#14)

* [chore] Update DSL verify to match plonky3 (#5)

* Update DSL verify to match plonky3

* fix: transpose state for p3-keccak tracegen

* chore: add comment linking plonky3 issue

* Update stark-backend commit

---------

Co-authored-by: Jonathan Wang <[email protected]>

* Use full commit in openvm-stark-backend revision (#18)

* chore: update `stark-backend` commit (#19)

* [fix] `Rv32BaseAluAdapterAir` unconstrained register reads (#25)

* Create pull_request_template.md (#26)

* [fix] Poseidon2 verify_batch opcode can send to execution bus for invalid rows (#17)

* [fix] Rust memory allocation overflow (#13)

* Fix and add test

* Fix lint error

* Update crates/toolchain/platform/src/memory.rs

---------

Co-authored-by: Jonathan Wang <[email protected]>

* [fix] Constrain `final_hash` in sha256 air to address audit finding (#12)

* [fix] properly constrain final_hash in sha256 air

* Add negative test for underconstrained final_hash. It was manually checked that this new test would have passed before the change.

* [fix] IsLtArraySubAir (#9)

* add fix

* add tests

* remove diff_val

* chore: update comment

* chore: no try_inverse

---------

Co-authored-by: Jonathan Wang <[email protected]>

* [fix] `Rv32BaseAluAdapterAir` immediate limbs not range-checked (#8)

* fix local_as2

* range check imm limbs

* add count for range check

* add test for unconstrained imm limb

* fix MemoryTester chip trace height

* add test for unconstrained rs2 read

* Revert "fix local_as2"

This reverts commit ef83121bf1796874affaca4682dbb4f9f051b079.

* Revert "add count for range check"

This reverts commit 5252444dfeaf41e7c336648ad92c4736f48ead9d.

* Revert "range check imm limbs"

This reverts commit 2e2937536069ae66849fdf7bba9ea509065d17fe.

* fix unconstrained imm limbs

* fix local_rs2_as test

* fix lint

* Update extensions/rv32im/circuit/src/base_alu/tests.rs

---------

Co-authored-by: Jonathan Wang <[email protected]>

* fix: fixed SHA2 subair trace generation and the testing (#28)

* fix: loadstore sign of immediate (#4)

* [fix] Fix P256 `GENERATOR` and `double_impl` (#2)

* fix p256-generator

* add host tests for ecc

* fix: loadstore sign of immediate

* fix: prints and test

* fix: load_sign_extend tests

* Update docs/specs/ISA.md

* clarify notation and sign extension in ISA spec

* fix reveal transpiler spec

---------

Co-authored-by: Manh Dinh <[email protected]>
Co-authored-by: Jonathan Wang <[email protected]>

* fix transpiler

* fix loadstore adapter

* fix store transpiler

* fix tests

* add e2e test

* fix docs

* fix: jalr imm_sign (#30)

* optimize record struct packing

* chore: use from_bool

* chore: derive_more feature in bench

* fix bench

* fix

---------

Co-authored-by: Xinding Wei <[email protected]>
Co-authored-by: Jonathan Wang <[email protected]>
Co-authored-by: Golovanov399 <[email protected]>
Co-authored-by: Avaneesh-axiom <[email protected]>
Co-authored-by: Arayi Khalatyan <[email protected]>
jonathanpwang added a commit that referenced this pull request Mar 9, 2025
* [fix] Fix P256 `GENERATOR` and `double_impl` (#2)

* fix p256-generator

* add host tests for ecc

* fix: hintstore mem_ptr and rem_words overflow

* fix: is_buffer_start constrain

* Use private repo for stark-backend (#11)

* temp(ci): switch riscv AMI for runner (#14)

* [chore] Update DSL verify to match plonky3 (#5)

* Update DSL verify to match plonky3

* fix: transpose state for p3-keccak tracegen

* chore: add comment linking plonky3 issue

* Update stark-backend commit

---------

Co-authored-by: Jonathan Wang <[email protected]>

* Use full commit in openvm-stark-backend revision (#18)

* chore: update `stark-backend` commit (#19)

* [fix] `Rv32BaseAluAdapterAir` unconstrained register reads (#25)

* Create pull_request_template.md (#26)

* [fix] Poseidon2 verify_batch opcode can send to execution bus for invalid rows (#17)

* [fix] Rust memory allocation overflow (#13)

* Fix and add test

* Fix lint error

* Update crates/toolchain/platform/src/memory.rs

---------

Co-authored-by: Jonathan Wang <[email protected]>

* [fix] Constrain `final_hash` in sha256 air to address audit finding (#12)

* [fix] properly constrain final_hash in sha256 air

* Add negative test for underconstrained final_hash. It was manually checked that this new test would have passed before the change.

* [fix] IsLtArraySubAir (#9)

* add fix

* add tests

* remove diff_val

* chore: update comment

* chore: no try_inverse

---------

Co-authored-by: Jonathan Wang <[email protected]>

* [fix] `Rv32BaseAluAdapterAir` immediate limbs not range-checked (#8)

* fix local_as2

* range check imm limbs

* add count for range check

* add test for unconstrained imm limb

* fix MemoryTester chip trace height

* add test for unconstrained rs2 read

* Revert "fix local_as2"

This reverts commit ef83121bf1796874affaca4682dbb4f9f051b079.

* Revert "add count for range check"

This reverts commit 5252444dfeaf41e7c336648ad92c4736f48ead9d.

* Revert "range check imm limbs"

This reverts commit 2e2937536069ae66849fdf7bba9ea509065d17fe.

* fix unconstrained imm limbs

* fix local_rs2_as test

* fix lint

* Update extensions/rv32im/circuit/src/base_alu/tests.rs

---------

Co-authored-by: Jonathan Wang <[email protected]>

* fix: fixed SHA2 subair trace generation and the testing (#28)

* fix: loadstore sign of immediate (#4)

* [fix] Fix P256 `GENERATOR` and `double_impl` (#2)

* fix p256-generator

* add host tests for ecc

* fix: loadstore sign of immediate

* fix: prints and test

* fix: load_sign_extend tests

* Update docs/specs/ISA.md

* clarify notation and sign extension in ISA spec

* fix reveal transpiler spec

---------

Co-authored-by: Manh Dinh <[email protected]>
Co-authored-by: Jonathan Wang <[email protected]>

* seperate the fixes

* fix naming

* fix: lints

---------

Co-authored-by: Manh Dinh <[email protected]>
Co-authored-by: Xinding Wei <[email protected]>
Co-authored-by: Jonathan Wang <[email protected]>
Co-authored-by: Golovanov399 <[email protected]>
Co-authored-by: Avaneesh-axiom <[email protected]>
jonathanpwang added a commit that referenced this pull request Mar 9, 2025
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.

2 participants