-
Notifications
You must be signed in to change notification settings - Fork 24
add logup test &fix overflow issue #141
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
Conversation
This file contains hidden or 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
zhenfeizhang
approved these changes
Apr 19, 2025
circuit-std-rs/src/logup.rs
Outdated
@@ -486,12 +497,20 @@ pub fn query_count_by_key_hint<F: Field>(inputs: &[F], outputs: &mut [F]) -> Res | |||
pub fn rangeproof_hint<F: Field>(inputs: &[F], outputs: &mut [F]) -> Result<(), Error> { | |||
let n = inputs[0].to_u256().as_i64(); | |||
let m = inputs[1].to_u256().as_i64(); | |||
let mut a = inputs[2].to_u256().as_i64(); | |||
//let mut a = inputs[2].to_u256().as_i64(); |
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.
remove
siq1
added a commit
that referenced
this pull request
May 6, 2025
* add .cargo/config.toml (#104) * add some clippy rules (#106) * add some clippy rules * modify comma * modify * fix wildcard_imports * remove unused * remove unused_parens * add efc missing * test condition * m31_utils conditional import * fix test import * remove example for keccak serve * Fix to_binary in m31_utils and example (#97) * fix to_binary m31_utils and the inappropriate example * use random for commit (#107) Co-authored-by: siq1 <siqi@polyhedra.network> * allow 0 or >=2 arguments for ToBinary (#108) Co-authored-by: siq1 <siqi@polyhedra.network> * fix a bug in expand_msg_xmd, pass hash_to_curve test --------- Co-authored-by: hczphn <144504143+hczphn@users.noreply.github.com> Co-authored-by: hczphn <huancheng@polyhedra.network> * std circuit for bls pairing check (#95) * add curve assertoncurve in point module * wip: StdCircuit * add PairingParams&Debug * random assignment * add random point test, debug_eval pass * clean up * fix clippy * fix test clippy * remove common mod * refactor circuit_test_helper_with_hint handling hint circuit * fix mod issue * use ark-ec 0.5.0 --------- Signed-off-by: DreamWuGit <wwuwwei@126.com> * ci skip random pairing test (#112) * add new api * update expander * combine rangeproof api (#118) * bls12381: assert on curve for G2 extension field point (#113) * add assert_is_on_twist * multi mehtods for g2 * pairing with g1 * remove commented code * rename:remove g2_ prefix * Make logup hints generic type (#119) * make logup hints generic * remove unused import * fix poseidon flatten, assert copy (#121) * circuit serde (#115) * wip * wip * fix serde changes * clean up * clean up * Update Cargo.lock * cargo lock * update cargo lock * Update Cargo.lock * clean up * clean up * update cargo toml * rename fr to bn254 * update ci: test in debug mode * revert back to BN254Fr * clippy --------- Co-authored-by: siq1 <siqi@polyhedra.network> * feat: add ability to return circuit output (#123) * add new trait method for setting outputs on the builder * add set_output to builder * add new fn to build with internal outputs * add output specific equivalent functions * add run with outputs * output take a vec of usize * more updates * output supremacy achieved * extend into output rather than overriding * remove log package * support simd and remove duplication --------- Co-authored-by: siq1 <siqi@polyhedra.network> * impl goldilocks field (#126) * wip * update cargo lock * Update Cargo.lock * Update example_call_expander.rs * Update Cargo.lock * Update Cargo.lock * Update Cargo.lock * Update Cargo.lock * update cargo toml * sync up with Expander (#129) * update expander and add goldilocks test (#134) * update expander and add goldilocks test * change import path * disable pairing test by default (#136) * goldilocks lookup test (#130) * goldilocks lookup test * fix lint * correct key * Sub circuit macro (#124) * wip * mostly working now * add test * clean up * fmt * RSA circuit (#52) * wip * get the multiplication correct * addition circuit * refactoring * wip * wip * finished addition * add bit decomposition * finished a buggy addition * fix bugs in u2048 add * accumulation * mul without mod reduction * integrate mul * finished multiplication * fix bug in mul * add serdes for BigUInt <> RSAElement * almost there * now stucked * clean up * implement debug builder * fmt * now tests passes * clean up * fix clippy * clean up * replace value_of with display * fmt and readability * minor * move u120 and u2048 to std * more clean up * add sha2 placeholder * add sha2 circuit --buggy * wip * remove sha2 since we already have other impls * change directory structure to latest ECC * clippy --------- Co-authored-by: siq1 <siqi@polyhedra.network> * Zz/refactor configs (#131) * wip * wip * fix * builds * everything works except for goldilocks * goldilocks also works now * update cargo toml * parallelized partially done. * two exec files * Builtin to binary (#139) * implement builtin to binary * add constraint and test * change all exist uses of to_binary_hint to builtin * clippy * add from_binary * fix clippy * Add an intepret loader to load compiled circuits. (#103) * a preliminary m31 circuit loader * a preliminary m31 circuit loader * port sha256 to compiled * simplify * ??? * it work fine... * another 4.5% * faster? * hoist loader to the expander compiler * keep both and hoist loader infra * compiled keccak works * sha256 is 1e-4 better :-( * ? * 36510520 * manual rebase * wip... * fix the compatibility * .. * roll back test cases * format my loader * fix clippy on my loader * fix clippy on my loader * use builtin to_binary and from_binary --------- Co-authored-by: siq1 <siqi@polyhedra.network> * almost there * fix some errors * update * update (#142) * impl babybear (#138) * wip * wip * fix * builds * everything works except for goldilocks * goldilocks also works now * wip * finished * update cargo lock * update cargo lock * Update Cargo.lock * fix clippy * add logup test &fix overflow issue (#141) * test for overflow * use lower name * fix overflow bug by using u128 * fix overflow bug by using u128 * fix lint * add 49 bits test * fix 49 bits panic * remove print * remove unused comment --------- Co-authored-by: hczphn <huancheng@polyhedra.network> Co-authored-by: siq1 <siqi@polyhedra.network> * parallalized caller done * fmt * clippy auto fix * callee commit done; prove wip * use poseidon seed in expander (#145) * use poseidon seed in expander * update cargo toml lock * update sha256 (support batch sha256) * fmt, clippy * remove old to_binary * remove efc * apply changes from #146 * callee prove done * clippy fix * wip tests&ci * some debug * wip * remove tmp files * naming * root-only write in callee behavior * debug done * clippy * fix bugs of merging * clippy auto fix * fix some problems in test * fmt * allow static mut refs * more tests, expecting failure * command line * caller * fix a problem in single core, caused by incorrect fix after merge * oversubscription in mpi * fix argument * tmp fix: set enough space for commitment * tmp disable some fields * bug fix; add back tests for all fields * remove some println * timer * add the profile features to cargo toml --------- Signed-off-by: DreamWuGit <wwuwwei@126.com> Co-authored-by: siq1 <166227013+siq1@users.noreply.github.com> Co-authored-by: DreamWuGit <wwuwwei@126.com> Co-authored-by: hczphn <144504143+hczphn@users.noreply.github.com> Co-authored-by: hczphn <huancheng@polyhedra.network> Co-authored-by: siq1 <siqi@polyhedra.network> Co-authored-by: zhenfei <zhenfei.zhang@hotmail.com> Co-authored-by: Wisdom Ogwu <40731160+iammadab@users.noreply.github.com> Co-authored-by: Jian Weng <jian.weng465@gmail.com>
siq1
added a commit
that referenced
this pull request
May 19, 2025
* wip * wip * wip * Update readme.md Signed-off-by: Tiancheng Xie <tc@polyhedra.network> * make zkcuda compile option general * implement padding and add tests * fmt * wip: kernel macro definition * update * update * update expander version * update expander to current dev * add default gkr config (changes from #58) * implement simd eval * add tests * fix pack_size * use simd by default in solve_witnesses * clippy * add multithreading witness solving example * allow simd witness (wip) * allow simd witness * allow generation of simd witness * add test * layered circuit simd eval * clippy * fix macro, allow 0-dim variables * add tests * fix incorrect array access step loop * fix duplicate id() impl * temporary implementation of zkcuda simd * implement shapes * fix * implement shape conversion * macro call and copy back * add tests * clippy * add ExpanderGKR implementation (#64) * tmp * refactored, wip * expander gkr as proving system v1 * adapt ExpanderGKR to the simd implementation * raw done. Debugging * correctness done. * clean up * use new zkcuda raw api --------- Signed-off-by: Zhiyong Fang <zhiyong.fang.1997@gmail.com> Co-authored-by: siq1 <siqi@polyhedra.network> * add zkcuda keccak example * support hint * print stats * add serde * fat circuit test * add ComputationGraph, use ExpanderGKR by default * fix clippy * Incorrect witness should fail now. (#122) * add tests, but it fails now * incorrect witness should fail now * rename tests --------- Co-authored-by: siq1 <siqi@polyhedra.network> * Zkcuda interface change (#114) * add .cargo/config.toml (#104) * add some clippy rules (#106) * add some clippy rules * modify comma * modify * fix wildcard_imports * remove unused * remove unused_parens * add efc missing * test condition * m31_utils conditional import * fix test import * remove example for keccak serve * Fix to_binary in m31_utils and example (#97) * fix to_binary m31_utils and the inappropriate example * use random for commit (#107) Co-authored-by: siq1 <siqi@polyhedra.network> * allow 0 or >=2 arguments for ToBinary (#108) Co-authored-by: siq1 <siqi@polyhedra.network> * fix a bug in expand_msg_xmd, pass hash_to_curve test --------- Co-authored-by: hczphn <144504143+hczphn@users.noreply.github.com> Co-authored-by: hczphn <huancheng@polyhedra.network> * std circuit for bls pairing check (#95) * add curve assertoncurve in point module * wip: StdCircuit * add PairingParams&Debug * random assignment * add random point test, debug_eval pass * clean up * fix clippy * fix test clippy * remove common mod * refactor circuit_test_helper_with_hint handling hint circuit * fix mod issue * use ark-ec 0.5.0 --------- Signed-off-by: DreamWuGit <wwuwwei@126.com> * ci skip random pairing test (#112) * add new api * update expander * api change * combine rangeproof api (#118) * bls12381: assert on curve for G2 extension field point (#113) * add assert_is_on_twist * multi mehtods for g2 * pairing with g1 * remove commented code * rename:remove g2_ prefix * change interface * add back expander gkr, expect test fail * Make logup hints generic type (#119) * make logup hints generic * remove unused import * fix poseidon flatten, assert copy (#121) * merge prover_setup and verifier_setup * circuit serde (#115) * wip * wip * fix serde changes * clean up * clean up * Update Cargo.lock * cargo lock * update cargo lock * Update Cargo.lock * clean up * clean up * update cargo toml * rename fr to bn254 * update ci: test in debug mode * revert back to BN254Fr * clippy --------- Co-authored-by: siq1 <siqi@polyhedra.network> * feat: add ability to return circuit output (#123) * add new trait method for setting outputs on the builder * add set_output to builder * add new fn to build with internal outputs * add output specific equivalent functions * add run with outputs * output take a vec of usize * more updates * output supremacy achieved * extend into output rather than overriding * remove log package * support simd and remove duplication --------- Co-authored-by: siq1 <siqi@polyhedra.network> * adapt new Expander and fix bugs * add back expander gkr * wip * v1, still problematic * correctness done. * clean up * clean up * clean up * minor fix --------- Signed-off-by: DreamWuGit <wwuwwei@126.com> Co-authored-by: siq1 <166227013+siq1@users.noreply.github.com> Co-authored-by: DreamWuGit <wwuwwei@126.com> Co-authored-by: hczphn <144504143+hczphn@users.noreply.github.com> Co-authored-by: hczphn <huancheng@polyhedra.network> Co-authored-by: siq1 <siqi@polyhedra.network> Co-authored-by: zhenfei <zhenfei.zhang@hotmail.com> Co-authored-by: Wisdom Ogwu <40731160+iammadab@users.noreply.github.com> * Zkcuda compile time fix (#128) * fix zkcuda compile time * clippy * fix conflict maybe --------- Signed-off-by: siq1 <166227013+siq1@users.noreply.github.com> * proof serde (#135) * Further interface change (#137) * wip * wip * wip * wip * mostly working * minor change * switch back to slice in interface * fmt * remove uncessary clippy note * fix after merge * clean up * apply changes from #146 * Zkcuda Parallel Exec (#140) * add .cargo/config.toml (#104) * add some clippy rules (#106) * add some clippy rules * modify comma * modify * fix wildcard_imports * remove unused * remove unused_parens * add efc missing * test condition * m31_utils conditional import * fix test import * remove example for keccak serve * Fix to_binary in m31_utils and example (#97) * fix to_binary m31_utils and the inappropriate example * use random for commit (#107) Co-authored-by: siq1 <siqi@polyhedra.network> * allow 0 or >=2 arguments for ToBinary (#108) Co-authored-by: siq1 <siqi@polyhedra.network> * fix a bug in expand_msg_xmd, pass hash_to_curve test --------- Co-authored-by: hczphn <144504143+hczphn@users.noreply.github.com> Co-authored-by: hczphn <huancheng@polyhedra.network> * std circuit for bls pairing check (#95) * add curve assertoncurve in point module * wip: StdCircuit * add PairingParams&Debug * random assignment * add random point test, debug_eval pass * clean up * fix clippy * fix test clippy * remove common mod * refactor circuit_test_helper_with_hint handling hint circuit * fix mod issue * use ark-ec 0.5.0 --------- Signed-off-by: DreamWuGit <wwuwwei@126.com> * ci skip random pairing test (#112) * add new api * update expander * combine rangeproof api (#118) * bls12381: assert on curve for G2 extension field point (#113) * add assert_is_on_twist * multi mehtods for g2 * pairing with g1 * remove commented code * rename:remove g2_ prefix * Make logup hints generic type (#119) * make logup hints generic * remove unused import * fix poseidon flatten, assert copy (#121) * circuit serde (#115) * wip * wip * fix serde changes * clean up * clean up * Update Cargo.lock * cargo lock * update cargo lock * Update Cargo.lock * clean up * clean up * update cargo toml * rename fr to bn254 * update ci: test in debug mode * revert back to BN254Fr * clippy --------- Co-authored-by: siq1 <siqi@polyhedra.network> * feat: add ability to return circuit output (#123) * add new trait method for setting outputs on the builder * add set_output to builder * add new fn to build with internal outputs * add output specific equivalent functions * add run with outputs * output take a vec of usize * more updates * output supremacy achieved * extend into output rather than overriding * remove log package * support simd and remove duplication --------- Co-authored-by: siq1 <siqi@polyhedra.network> * impl goldilocks field (#126) * wip * update cargo lock * Update Cargo.lock * Update example_call_expander.rs * Update Cargo.lock * Update Cargo.lock * Update Cargo.lock * Update Cargo.lock * update cargo toml * sync up with Expander (#129) * update expander and add goldilocks test (#134) * update expander and add goldilocks test * change import path * disable pairing test by default (#136) * goldilocks lookup test (#130) * goldilocks lookup test * fix lint * correct key * Sub circuit macro (#124) * wip * mostly working now * add test * clean up * fmt * RSA circuit (#52) * wip * get the multiplication correct * addition circuit * refactoring * wip * wip * finished addition * add bit decomposition * finished a buggy addition * fix bugs in u2048 add * accumulation * mul without mod reduction * integrate mul * finished multiplication * fix bug in mul * add serdes for BigUInt <> RSAElement * almost there * now stucked * clean up * implement debug builder * fmt * now tests passes * clean up * fix clippy * clean up * replace value_of with display * fmt and readability * minor * move u120 and u2048 to std * more clean up * add sha2 placeholder * add sha2 circuit --buggy * wip * remove sha2 since we already have other impls * change directory structure to latest ECC * clippy --------- Co-authored-by: siq1 <siqi@polyhedra.network> * Zz/refactor configs (#131) * wip * wip * fix * builds * everything works except for goldilocks * goldilocks also works now * update cargo toml * parallelized partially done. * two exec files * Builtin to binary (#139) * implement builtin to binary * add constraint and test * change all exist uses of to_binary_hint to builtin * clippy * add from_binary * fix clippy * Add an intepret loader to load compiled circuits. (#103) * a preliminary m31 circuit loader * a preliminary m31 circuit loader * port sha256 to compiled * simplify * ??? * it work fine... * another 4.5% * faster? * hoist loader to the expander compiler * keep both and hoist loader infra * compiled keccak works * sha256 is 1e-4 better :-( * ? * 36510520 * manual rebase * wip... * fix the compatibility * .. * roll back test cases * format my loader * fix clippy on my loader * fix clippy on my loader * use builtin to_binary and from_binary --------- Co-authored-by: siq1 <siqi@polyhedra.network> * almost there * fix some errors * update * update (#142) * impl babybear (#138) * wip * wip * fix * builds * everything works except for goldilocks * goldilocks also works now * wip * finished * update cargo lock * update cargo lock * Update Cargo.lock * fix clippy * add logup test &fix overflow issue (#141) * test for overflow * use lower name * fix overflow bug by using u128 * fix overflow bug by using u128 * fix lint * add 49 bits test * fix 49 bits panic * remove print * remove unused comment --------- Co-authored-by: hczphn <huancheng@polyhedra.network> Co-authored-by: siq1 <siqi@polyhedra.network> * parallalized caller done * fmt * clippy auto fix * callee commit done; prove wip * use poseidon seed in expander (#145) * use poseidon seed in expander * update cargo toml lock * update sha256 (support batch sha256) * fmt, clippy * remove old to_binary * remove efc * apply changes from #146 * callee prove done * clippy fix * wip tests&ci * some debug * wip * remove tmp files * naming * root-only write in callee behavior * debug done * clippy * fix bugs of merging * clippy auto fix * fix some problems in test * fmt * allow static mut refs * more tests, expecting failure * command line * caller * fix a problem in single core, caused by incorrect fix after merge * oversubscription in mpi * fix argument * tmp fix: set enough space for commitment * tmp disable some fields * bug fix; add back tests for all fields * remove some println * timer * add the profile features to cargo toml --------- Signed-off-by: DreamWuGit <wwuwwei@126.com> Co-authored-by: siq1 <166227013+siq1@users.noreply.github.com> Co-authored-by: DreamWuGit <wwuwwei@126.com> Co-authored-by: hczphn <144504143+hczphn@users.noreply.github.com> Co-authored-by: hczphn <huancheng@polyhedra.network> Co-authored-by: siq1 <siqi@polyhedra.network> Co-authored-by: zhenfei <zhenfei.zhang@hotmail.com> Co-authored-by: Wisdom Ogwu <40731160+iammadab@users.noreply.github.com> Co-authored-by: Jian Weng <jian.weng465@gmail.com> * add simd auto pack * remove debug print (#154) * partially fix * add logup zkcuda test * Zf/zkcuda parallel exec (#156) * parallelized partially done. * two exec files * almost there * fix some errors * update * parallalized caller done * fmt * clippy auto fix * callee commit done; prove wip * callee prove done * clippy fix * wip tests&ci * some debug * wip * remove tmp files * naming * root-only write in callee behavior * debug done * clippy * fix bugs of merging * clippy auto fix * fix some problems in test * fmt * allow static mut refs * more tests, expecting failure * command line * caller * fix a problem in single core, caused by incorrect fix after merge * oversubscription in mpi * fix argument * tmp fix: set enough space for commitment * tmp disable some fields * bug fix; add back tests for all fields * remove some println * timer * tmp * simple bench added * logistics * refactor * clippy auto fix * some preparations in expander_prove & expander_commit * ready for test * update to latest expander & temporarily switch to an custom branch * debug done. * remove some unnecessary ptr copying * wip * read necessary input vals only * minor: ref multilinear poly * minimize IO & share circuit memory * add a timer * move temporary files to /tmp * fix a bug in mpi overscribe * change default config in bench * kzg as pcs * fix after merge --------- Co-authored-by: siq1 <siqi@polyhedra.network> * remove mpi generated files * minor ci update --------- Signed-off-by: Tiancheng Xie <tc@polyhedra.network> Signed-off-by: Zhiyong Fang <zhiyong.fang.1997@gmail.com> Signed-off-by: DreamWuGit <wwuwwei@126.com> Signed-off-by: siq1 <166227013+siq1@users.noreply.github.com> Co-authored-by: Tiancheng Xie <tc@polyhedra.network> Co-authored-by: Zhiyong Fang <zhiyong.fang.1997@gmail.com> Co-authored-by: DreamWuGit <wwuwwei@126.com> Co-authored-by: hczphn <144504143+hczphn@users.noreply.github.com> Co-authored-by: hczphn <huancheng@polyhedra.network> Co-authored-by: zhenfei <zhenfei.zhang@hotmail.com> Co-authored-by: Wisdom Ogwu <40731160+iammadab@users.noreply.github.com> Co-authored-by: Jian Weng <jian.weng465@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refer to issue #143