-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: need to apply FieldExtension on Fq, Fq2 for mul_013_by_013 test * Fix mul_013_by_013 * WIP: isolate issue * Fix xi * Update IntAdd * fix * Clean up * Add chip for mul_013_by_013 * Update w/ new ExprBuilderConfig paradigm * Remove extraneous items * Fix lints * Add mul_023_by_023, refactor test_utils * Add chips/chip_set items * address PR comments * Additional fixes * Rebase * Rebase * WIP: test is failing at execute * Rename tangent_line_023 * switch test back to pass * Extra clone * Update adapter to use block size * use BLOCK_SIZE const in miller tests to prevent confusion * Fix lint * Update tests to use BLOCK_SIZE const for Rv32VecHeapAdapterChip * chore: move xi to constructor * chore: clippy --------- Co-authored-by: luffykai <[email protected]> Co-authored-by: Jonathan Wang <[email protected]>
- Loading branch information
1 parent
90781a8
commit 802b204
Showing
25 changed files
with
624 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use ax_stark_sdk::utils::create_seeded_rng_with_seed; | ||
use halo2curves_axiom::{ | ||
bls12_381::{Fq, Fq12, Fq2}, | ||
ff::Field, | ||
}; | ||
use num_bigint_dig::BigUint; | ||
|
||
pub fn bls12381_fq_to_biguint(fq: Fq) -> BigUint { | ||
let bytes = fq.to_bytes(); | ||
BigUint::from_bytes_le(&bytes) | ||
} | ||
|
||
pub fn bls12381_fq2_to_biguint_vec(x: Fq2) -> Vec<BigUint> { | ||
vec![bls12381_fq_to_biguint(x.c0), bls12381_fq_to_biguint(x.c1)] | ||
} | ||
|
||
pub fn bls12381_fq12_to_biguint_vec(x: Fq12) -> Vec<BigUint> { | ||
vec![ | ||
bls12381_fq_to_biguint(x.c0.c0.c0), | ||
bls12381_fq_to_biguint(x.c0.c0.c1), | ||
bls12381_fq_to_biguint(x.c0.c1.c0), | ||
bls12381_fq_to_biguint(x.c0.c1.c1), | ||
bls12381_fq_to_biguint(x.c0.c2.c0), | ||
bls12381_fq_to_biguint(x.c0.c2.c1), | ||
bls12381_fq_to_biguint(x.c1.c0.c0), | ||
bls12381_fq_to_biguint(x.c1.c0.c1), | ||
bls12381_fq_to_biguint(x.c1.c1.c0), | ||
bls12381_fq_to_biguint(x.c1.c1.c1), | ||
bls12381_fq_to_biguint(x.c1.c2.c0), | ||
bls12381_fq_to_biguint(x.c1.c2.c1), | ||
] | ||
} | ||
|
||
pub fn bls12381_fq12_random(seed: u64) -> Vec<BigUint> { | ||
let seed = create_seeded_rng_with_seed(seed); | ||
let fq = Fq12::random(seed); | ||
bls12381_fq12_to_biguint_vec(fq) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use ax_stark_sdk::utils::create_seeded_rng_with_seed; | ||
use halo2curves_axiom::{ | ||
bn256::{Fq, Fq12, Fq2}, | ||
ff::Field, | ||
}; | ||
use num_bigint_dig::BigUint; | ||
|
||
pub fn bn254_fq_to_biguint(fq: Fq) -> BigUint { | ||
let bytes = fq.to_bytes(); | ||
BigUint::from_bytes_le(&bytes) | ||
} | ||
|
||
pub fn bn254_fq2_to_biguint_vec(x: Fq2) -> Vec<BigUint> { | ||
vec![bn254_fq_to_biguint(x.c0), bn254_fq_to_biguint(x.c1)] | ||
} | ||
|
||
pub fn bn254_fq12_to_biguint_vec(x: Fq12) -> Vec<BigUint> { | ||
vec![ | ||
bn254_fq_to_biguint(x.c0.c0.c0), | ||
bn254_fq_to_biguint(x.c0.c0.c1), | ||
bn254_fq_to_biguint(x.c0.c1.c0), | ||
bn254_fq_to_biguint(x.c0.c1.c1), | ||
bn254_fq_to_biguint(x.c0.c2.c0), | ||
bn254_fq_to_biguint(x.c0.c2.c1), | ||
bn254_fq_to_biguint(x.c1.c0.c0), | ||
bn254_fq_to_biguint(x.c1.c0.c1), | ||
bn254_fq_to_biguint(x.c1.c1.c0), | ||
bn254_fq_to_biguint(x.c1.c1.c1), | ||
bn254_fq_to_biguint(x.c1.c2.c0), | ||
bn254_fq_to_biguint(x.c1.c2.c1), | ||
] | ||
} | ||
|
||
pub fn bn254_fq2_random(seed: u64) -> Fq2 { | ||
let seed = create_seeded_rng_with_seed(seed); | ||
Fq2::random(seed) | ||
} | ||
|
||
pub fn bn254_fq12_random(seed: u64) -> Fq12 { | ||
let seed = create_seeded_rng_with_seed(seed); | ||
Fq12::random(seed) | ||
} |
Oops, something went wrong.