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

Release 0.4.0 #168

Merged
merged 377 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
377 commits
Select commit Hold shift + click to select a range
be7c743
separated the ci in multiple steps to optimize timing
lander86 Sep 28, 2021
f1c79c3
fixed typo
lander86 Sep 28, 2021
8e964e8
mul_bits() native: resolved TODOs on documenting completeness.
UlrichHaboeck75 Sep 28, 2021
b0340fb
fix typos
lander86 Sep 28, 2021
1adf934
Merge branch 'hopwood_optimized_sm' of github.com:HorizenOfficial/gin…
lander86 Sep 28, 2021
1be49de
Merge pull request #126 from HorizenOfficial/hopwood_optimized_sm
DanieleDiBenedetto Sep 28, 2021
b29963e
Endo mul gadget implementation
phoinic Sep 30, 2021
b924353
Made nonnative::fields tests generic. Found bug with some instances a…
DanieleDiBenedetto Sep 30, 2021
376ebdc
Implement test functionality for ConstraintSystemImpl
lgiussan Sep 30, 2021
6dc70ea
Remove TestConstraintSystem and update tests to use ConstraintSystemI…
lgiussan Sep 30, 2021
1edac58
Add variables to named_objects during alloc
lgiussan Sep 30, 2021
0a3364b
Panic when trying to get or set variables during setup
lgiussan Sep 30, 2021
45ff1e9
Bugfix: building constraint matrices when not required
lgiussan Sep 30, 2021
7d24190
Fix Cargo.toml files
lgiussan Sep 30, 2021
aa6ce0b
Fix Cargo.toml files (hopefully)
lgiussan Oct 1, 2021
641d26a
Added is_odd test. Moved NonNativeGroupAffineGadget into proper submo…
DanieleDiBenedetto Oct 1, 2021
e8b21bd
Fix endo_rep_to_scalar algorithm
phoinic Oct 3, 2021
23739ca
fix failing proof-systems tests
lgiussan Oct 4, 2021
d1dbe18
Added checks on mul_bits inputs
DanieleDiBenedetto Oct 4, 2021
26fc09a
Added missing comments
DanieleDiBenedetto Oct 4, 2021
4b06b84
Hopwood optimized fbSM
DanieleDiBenedetto Oct 4, 2021
c115f96
Added more comments
DanieleDiBenedetto Oct 4, 2021
d8409e8
extended comment on mul_bits()
UlrichHaboeck75 Oct 5, 2021
00fbf4b
copy paste of previous commit to short_weierstrass_projective
UlrichHaboeck75 Oct 5, 2021
331b069
Changed interface of check_mul_bits_inputs
DanieleDiBenedetto Oct 5, 2021
7b5b53d
Merge branch 'sc_testnet_2' into endo_proof_size_opt
phoinic Oct 5, 2021
8030388
Updating UTs for endo gadget
phoinic Oct 5, 2021
bc56da4
Endo gadget optimization
phoinic Oct 5, 2021
468295a
Cleanup comments
phoinic Oct 5, 2021
8804cf2
Comment for endo_mul updated
phoinic Oct 5, 2021
e4c8fb5
Addressed remaining PR comments
DanieleDiBenedetto Oct 6, 2021
46bc772
Merge branch 'rc/audit_chain' into optimized_fb_sm
DanieleDiBenedetto Oct 6, 2021
384039d
added TODO for non-native alloc gadget
UlrichHaboeck75 Oct 6, 2021
3c291a2
Added checks on mul_bits_fixed_base inputs
DanieleDiBenedetto Oct 6, 2021
561ea89
added experimental status to non-native lib
UlrichHaboeck75 Oct 6, 2021
fc3a0a6
Merge branch 'development_tmp' into rc/audit_chain
DanieleDiBenedetto Oct 6, 2021
23a53ee
Merge branch 'rc/audit_chain' into optimized_fb_sm
DanieleDiBenedetto Oct 6, 2021
f776412
added docu to check_mul_bits_fixed_base_inputs.
UlrichHaboeck75 Oct 6, 2021
8589413
Merge branch 'optimized_fb_sm' of https://github.com/HorizenOfficial/…
UlrichHaboeck75 Oct 6, 2021
5819c58
corrected comment on the length of the scalar bits in `check_mul_bits…
UlrichHaboeck75 Oct 6, 2021
6c9fc53
clarification of the previous change
UlrichHaboeck75 Oct 6, 2021
0aafce4
once again, clarified the previous "clarification"
UlrichHaboeck75 Oct 6, 2021
04af3d4
Added inline docu for mul_bits_fixed_base.
UlrichHaboeck75 Oct 6, 2021
8d5f9ca
Fixed check function
DanieleDiBenedetto Oct 7, 2021
ab040bf
changed comment on bit len in mul_bits_fixed_base
UlrichHaboeck75 Oct 7, 2021
2717488
Merge pull request #129 from HorizenOfficial/optimized_fb_sm
DanieleDiBenedetto Oct 7, 2021
42aee87
endo merge and optimization
phoinic Oct 9, 2021
d65e6f6
Added the Sage scripts for checking field parameters. With respect to…
Oct 11, 2021
0bd1bc3
rename ConstraintSystemImpl and ConstraintSystem
lgiussan Oct 18, 2021
d5a8399
Add debugging functions to ConstraintSystem trait
lgiussan Oct 18, 2021
e5b32f7
added endo mul inline docu
UlrichHaboeck75 Oct 18, 2021
8881671
Merge branch 'development_tmp' into refactor_constraint_system
lgiussan Oct 18, 2021
d2dc6cc
Remove print_named_objects function
lgiussan Oct 19, 2021
d2c83e0
Remove unnecessary override
lgiussan Oct 19, 2021
e5c45a0
Delete commented out code
lgiussan Oct 19, 2021
7c7545a
Applied the changes suggested by Ulrich about endo_mul parameters.
Oct 19, 2021
5ecf4e6
Introduce Debug mode in ConstraintSystem
lgiussan Oct 21, 2021
420256d
Merge remote-tracking branch 'origin/refactor_constraint_system' into…
lgiussan Oct 21, 2021
555ec1f
Changes after code review
lgiussan Oct 25, 2021
1791773
Refactored endo mul native implementation
phoinic Oct 25, 2021
6b79526
Changes after code review
lgiussan Oct 26, 2021
30e0c89
Refactored endo implementation
phoinic Oct 27, 2021
89904fc
Endo mul for 'short_weierstrass_projective' model
phoinic Oct 27, 2021
780ae5f
Additional implementations and bits paddings
phoinic Oct 27, 2021
5007fca
nonnative endo implementation
phoinic Oct 27, 2021
f9a9e44
Modified to check_curve_parameters.sage according to Ulrich's request…
Oct 27, 2021
690abe5
Modified to check_curve_parameters.sage according to Ulrich's request…
Oct 27, 2021
8cf7170
Modified to check_curve_parameters.sage according to Ulrich's request…
Oct 27, 2021
4c9232c
Merge branch 'endo' of https://github.com/HorizenOfficial/ginger-lib …
Oct 27, 2021
24c4f32
Merge branch 'development' into rc/audit_chain
DanieleDiBenedetto Oct 27, 2021
120a3dc
Merge pull request #120 from HorizenOfficial/rc/audit_chain
DanieleDiBenedetto Oct 27, 2021
11f8dc4
Merge pull request #124 from HorizenOfficial/sage_scripts_params
DanieleDiBenedetto Oct 27, 2021
1f4f6f1
Updated dependencies
DanieleDiBenedetto Oct 27, 2021
7318706
cargo fmt
DanieleDiBenedetto Oct 27, 2021
e10cb02
clippy autofix
DanieleDiBenedetto Oct 27, 2021
7fafe74
Endo generic test
phoinic Oct 28, 2021
04926c8
cargo-fmt
lgiussan Oct 28, 2021
40cb120
Merge branch 'rc/audit_chain' into endo_merge
phoinic Oct 28, 2021
116d558
Merge branch 'development' into endo_merge
phoinic Oct 28, 2021
5687c47
Generic endo mul UT optimized
phoinic Oct 28, 2021
6787407
Branch switched to endo
phoinic Oct 28, 2021
177e813
Sync with pc/marlin endo branches
phoinic Oct 28, 2021
f15ebb4
Merge branch 'development' into refactor_constraint_system
lgiussan Oct 28, 2021
7ab5a5b
Update Cargo.toml files
lgiussan Oct 29, 2021
e25730f
Merge branch 'endo' into refactor_constraint_system
lgiussan Oct 29, 2021
bcd8fd6
additional inline doc
UlrichHaboeck75 Nov 2, 2021
3b51d3f
Resolved conflicts in check_curve_parameters.sage
Nov 3, 2021
42470dc
Parameter LAMBDA read from from the curve file, as requested by Ulrich.
Nov 3, 2021
1d9e99b
Merge pull request #128 from HorizenOfficial/endo
DanieleDiBenedetto Nov 3, 2021
260410f
Updated dependencies
DanieleDiBenedetto Nov 3, 2021
9f25369
Importing the ed25519 parameters, first push.
Nov 3, 2021
2f8ea42
Added tests for ed25519 + update dependencies
DanieleDiBenedetto Nov 3, 2021
3b6c01a
Bug fix + added nonnative tests with ed25519
DanieleDiBenedetto Nov 4, 2021
4deb1b5
check_curve_parameters.sage updated in order to check files containg…
Nov 4, 2021
8d636e8
Updated nonnative tests
DanieleDiBenedetto Nov 4, 2021
0f0a1a0
Merge branch 'development' into import_ed25519
DanieleDiBenedetto Nov 4, 2021
1e52d64
Restored group_membership_test to previous state
DanieleDiBenedetto Nov 5, 2021
51016ed
Update dependencies
DanieleDiBenedetto Nov 8, 2021
96b094a
(WIP) DensityOptimizedTweedleFrPoseidonHashGadget
DanieleDiBenedetto Nov 8, 2021
dd8ded1
Bug fixes
DanieleDiBenedetto Nov 9, 2021
78d4a50
Restored Cargo.toml
DanieleDiBenedetto Nov 9, 2021
cf191b6
Clean dirty commit
DanieleDiBenedetto Nov 9, 2021
5abd1a7
Cargo fmt
DanieleDiBenedetto Nov 9, 2021
4e9909d
Merge branch 'development' into import_ed25519
DanieleDiBenedetto Nov 9, 2021
0e28cc7
cargo fmt
DanieleDiBenedetto Nov 9, 2021
275bc06
Merge branch 'development' into poseidon_tweedle_opt
DanieleDiBenedetto Nov 9, 2021
663e381
Merge branch 'import_ed25519' into poseidon_tweedle_opt
DanieleDiBenedetto Nov 9, 2021
974dee6
Minor fix
DanieleDiBenedetto Nov 9, 2021
5c09cc3
Update short_weierstrass_jacobian.rs
DanieleDiBenedetto Nov 9, 2021
8ef30e3
Reduced num variables used
DanieleDiBenedetto Nov 9, 2021
3cba9fe
Replaced DB with HashMaps in BigLazyMerkleTree
DanieleDiBenedetto Nov 9, 2021
25c1838
(WIP) Remove all data structure except one storing all non-empty nodes
DanieleDiBenedetto Nov 10, 2021
c3dad08
Added sqrt field test for ed25519 fields
DanieleDiBenedetto Nov 11, 2021
b33a154
Optimized the check for the parameter ROOT_OF_UNITY in check_field_pa…
Nov 11, 2021
eaec897
Merge branch 'import_ed25519' of https://github.com/HorizenOfficial/g…
Nov 11, 2021
9a826e9
Corrected some bug in the Shell script all_field:checks.sh. Inserted …
Nov 11, 2021
ae53e88
Added inline comments which explain how the new constants used in Pos…
Nov 11, 2021
02f7f66
Added the Sage script which generate the new Poseidon constants. Adde…
Nov 11, 2021
837c59d
Bug fix
DanieleDiBenedetto Nov 11, 2021
479e697
Update check_field_parameters.sage
UlrichHaboeck75 Nov 11, 2021
54e11de
(WIP) More refined tests
DanieleDiBenedetto Nov 12, 2021
80fed9e
Expanded UTs. Better error handling. Some minor modifications
DanieleDiBenedetto Nov 15, 2021
dbc5ec9
Added edge cases test + handle tree with height 0
DanieleDiBenedetto Nov 15, 2021
59a03cb
Refined UTs
DanieleDiBenedetto Nov 16, 2021
d41aef6
Merge remote-tracking branch 'origin/development' into refactor_const…
lgiussan Nov 16, 2021
7b3f7d3
Optimized SMT memory usage
DanieleDiBenedetto Nov 16, 2021
49162ce
Merge branch 'development' into in_memory_lazy_smt
DanieleDiBenedetto Nov 16, 2021
3727f5f
Fixes in cargo tomls
DanieleDiBenedetto Nov 16, 2021
b1b2a40
Slightly optimized SMT memory usage + added benches
DanieleDiBenedetto Nov 16, 2021
2c37430
Small fix in benches
DanieleDiBenedetto Nov 17, 2021
12ae2fc
Minor mods
DanieleDiBenedetto Nov 17, 2021
4007361
Refined MerkleTree benches
DanieleDiBenedetto Nov 17, 2021
462a189
Slightly optimized memory usage and tests of FieldBasedOptimizedMHT
DanieleDiBenedetto Nov 17, 2021
cf23693
Added FieldBasedSparseMerkleTree trait. Implemented this and FieldBas…
DanieleDiBenedetto Nov 18, 2021
03de6cd
Minor modifications
DanieleDiBenedetto Nov 18, 2021
0bfd4c0
Added new test cases for SMT + reduced code duplication
DanieleDiBenedetto Nov 18, 2021
9383867
Fix CI
DanieleDiBenedetto Nov 18, 2021
e9cf1f8
Merge branch 'in_memory_lazy_smt' of https://github.com/HorizenOffici…
DanieleDiBenedetto Nov 18, 2021
144cc54
added another minor test case
DanieleDiBenedetto Nov 18, 2021
46cfec6
Commented one non native mul bits test otherwise CI timeouts
DanieleDiBenedetto Nov 19, 2021
64d1f26
Commented one non native mul bits test otherwise CI times out
DanieleDiBenedetto Nov 19, 2021
5831c0a
Minor modifications
DanieleDiBenedetto Nov 19, 2021
ced8195
added minor debug_assert
DanieleDiBenedetto Nov 19, 2021
2a77b27
Fix CI
DanieleDiBenedetto Nov 19, 2021
df3c939
Merge branch 'import_ed25519' into poseidon_tweedle_opt
DanieleDiBenedetto Nov 19, 2021
0c13fcf
Merge branch 'import_ed25519' into integration
DanieleDiBenedetto Nov 19, 2021
a1f19e1
Merge branch 'poseidon_tweedle_opt' into integration
DanieleDiBenedetto Nov 19, 2021
47339ff
Updated dependencies
DanieleDiBenedetto Nov 19, 2021
1fcafdc
Updated dependencies
DanieleDiBenedetto Nov 19, 2021
7f778ab
Bug fix
DanieleDiBenedetto Nov 19, 2021
ec151b4
Merge branch 'in_memory_lazy_smt' into integration
DanieleDiBenedetto Nov 19, 2021
26a00c1
Renaming and interface changes
DanieleDiBenedetto Nov 26, 2021
0b490fc
Merge branch 'in_memory_lazy_smt' into integration
DanieleDiBenedetto Nov 26, 2021
b2dcace
added inline documentation and TODOs
UlrichHaboeck75 Dec 1, 2021
14db5fc
added further inline docu and todos.
UlrichHaboeck75 Dec 3, 2021
cb144c8
corrected `ConstraintSystem` to `ConstraintSystemAbstract`
UlrichHaboeck75 Dec 3, 2021
c6126bb
added inline documentation and TODOs
UlrichHaboeck75 Dec 1, 2021
cf28a41
additional comments on group_and_check_equality()
UlrichHaboeck75 Dec 6, 2021
f295e38
Optimized group_and_check_equality(), sub_without_reduce(),
UlrichHaboeck75 Dec 8, 2021
43bcecd
Optimized compilation timings in r1cs-std
DanieleDiBenedetto Dec 9, 2021
e5c53c2
Merge branch 'nonnative_doc' of https://github.com/HorizenOfficial/gi…
DanieleDiBenedetto Dec 9, 2021
3eaa76e
further TODOs
UlrichHaboeck75 Dec 9, 2021
d43a154
(WIP) Fixed bugs and improved code on sub/add/mul reductions + fixed …
DanieleDiBenedetto Dec 9, 2021
b1a1ef2
bits-related tests now pass. density-optimized flag not needed anymor…
DanieleDiBenedetto Dec 9, 2021
79aceb9
Added detailed comment for the automatized reduction strategy.
UlrichHaboeck75 Dec 10, 2021
95335a3
Merge branch 'nonnative_doc' of https://github.com/HorizenOfficial/gi…
UlrichHaboeck75 Dec 10, 2021
ff42d4f
few additional comments
UlrichHaboeck75 Dec 13, 2021
657cf98
Address PR comments
DanieleDiBenedetto Dec 13, 2021
62fb83c
Merge pull request #139 from HorizenOfficial/import_ed25519
DanieleDiBenedetto Dec 14, 2021
01c7cda
Merge pull request #140 from HorizenOfficial/poseidon_tweedle_opt
DanieleDiBenedetto Dec 14, 2021
5efac01
Updated dependencies
DanieleDiBenedetto Dec 14, 2021
97b0a0a
corrected surfeit bound for kp_plus_r, and adapted pre-reduction cond…
UlrichHaboeck75 Dec 14, 2021
2f3f0bc
corrected square computations of u64
UlrichHaboeck75 Dec 16, 2021
b16d11c
updated find_parameters(), added function for checking num_add bound
UlrichHaboeck75 Dec 17, 2021
6be8919
corrected the `check()` of NonNativeFieldGadgets, renamed `bitlen!`
UlrichHaboeck75 Dec 17, 2021
633ef0a
added check() for NonNativeFieldMulResultGadget, corrected find_param…
UlrichHaboeck75 Dec 17, 2021
c62a55e
strengthened check() on most significant limb, corrected pad_limb in …
UlrichHaboeck75 Dec 19, 2021
a278abb
clean up of unnecessary debug asserts, added test vector get_params_t…
UlrichHaboeck75 Dec 19, 2021
b5dbeab
added TweedleFrMnt4753 nonnative tests
UlrichHaboeck75 Dec 19, 2021
499f214
separate iteration bound for stress tests, added substraction and neg…
UlrichHaboeck75 Dec 21, 2021
c5d10e2
corrected to_bytes test, use serial_test
UlrichHaboeck75 Dec 21, 2021
0a517a2
Minor fix to check() function
DanieleDiBenedetto Dec 21, 2021
97a4577
added alloc_random() for oversized nonnatives, corrected ceil_log_2 m…
UlrichHaboeck75 Dec 21, 2021
05692d7
modified elementary arithmetic tests to use alloc_random(),
UlrichHaboeck75 Dec 22, 2021
34e6062
added comment for changing add_num to BigUint
UlrichHaboeck75 Dec 22, 2021
b6e71cb
added ceil_log_2_biguint plus unit test
UlrichHaboeck75 Dec 22, 2021
fbe7a7f
Replaced ConstraintF with BigUint in nonnative
DanieleDiBenedetto Dec 23, 2021
1ac23a6
Temporarily updated dependencies
DanieleDiBenedetto Dec 23, 2021
555883f
Added consistency test for deserialization mod order used by the Fiel…
DanieleDiBenedetto Dec 23, 2021
7b29cc0
fixed mul_by_constant_without_prereduce
UlrichHaboeck75 Jan 5, 2022
a64e72c
conditional_enforce_equal(): fixed length bound for k
UlrichHaboeck75 Jan 5, 2022
76281af
introduced conditional_enforce_equal_without_prereduce() and pre_enfo…
UlrichHaboeck75 Jan 6, 2022
ed4d89c
corrected security bounds according to the upated enfore_equal bound
UlrichHaboeck75 Jan 6, 2022
eaa850a
commented out test over mnt4_735 Fr
UlrichHaboeck75 Jan 6, 2022
46f1eaa
explicit provocate edge cases in elementary tests,
UlrichHaboeck75 Jan 7, 2022
c9ca5c5
modified edge cases in elementary tests
UlrichHaboeck75 Jan 7, 2022
0184d21
Added some inline comments about the estimate of the number of constr…
Jan 7, 2022
d913ec0
reduce() of mul results: optimized the surfeit bound of the k*p+r gadget
UlrichHaboeck75 Jan 7, 2022
c30b50b
corrected get_params test vector, increased TEST_COUNT
UlrichHaboeck75 Jan 7, 2022
b69f91c
corrected security bound error messages
UlrichHaboeck75 Jan 7, 2022
b8dd43a
find_parameters(): replaced length by ceil_log_2,
UlrichHaboeck75 Jan 10, 2022
e4952f6
Fixed warning
DanieleDiBenedetto Jan 10, 2022
53a4fca
corrected elementary_test_substraction()
UlrichHaboeck75 Jan 10, 2022
d86ddaf
Merge branch 'development' into release_0_3_0_dev
DanieleDiBenedetto Jan 10, 2022
fc25053
Updated and freezed dependencies
DanieleDiBenedetto Jan 10, 2022
2bff8ef
Merge pull request #156 from HorizenOfficial/release_0_3_0_dev
lander86 Jan 10, 2022
b4a2e8c
Merge pull request #158 from HorizenOfficial/release_0_3_1_dev
lander86 Jan 10, 2022
a61fc10
Merge branch 'development' into refactor_constraint_system
DanieleDiBenedetto Jan 12, 2022
6ac16de
Fix compilation error
DanieleDiBenedetto Jan 12, 2022
5ee533c
Merge branch 'refactor_constraint_system' into in_memory_lazy_smt
DanieleDiBenedetto Jan 12, 2022
ee38568
Merge branch 'in_memory_lazy_smt' into nonnative_doc
DanieleDiBenedetto Jan 12, 2022
e78e8d4
corrected elementary_test_substraction()
UlrichHaboeck75 Jan 10, 2022
742f517
Merge branch 'nonnative_doc' into bugfix/issue#159
DanieleDiBenedetto Jan 13, 2022
c80aed2
fixed issue #159
UlrichHaboeck75 Jan 11, 2022
9a94068
Update nonnative_field_gadget.rs
DDT92 Jan 12, 2022
6026c0c
Update nonnative_field_gadget.rs
DDT92 Jan 12, 2022
d5dbb31
Merge pull request #161 from HorizenOfficial/bugfix/issue#159
DanieleDiBenedetto Jan 13, 2022
32c52f1
optimizing mul for pseudo-mersenne fields + fix find_parameters
Jan 26, 2022
d8ffb34
remove restriction that bits_per_limb*num_limbs must be equal to MODU…
Jan 27, 2022
611d88c
Undo modifications to Cargo.toml needed for local development
Jan 27, 2022
731d3cd
Undo modifications to Cargo.toml needed for local development
Jan 27, 2022
e671909
Fixed bug in debug_assert call when testing merkle paths with an empt…
DanieleDiBenedetto Jan 31, 2022
31ed7e8
addressing comments from PR review
Jan 31, 2022
f1a8ebf
Fix CI build
Feb 1, 2022
1564772
Fix CI build
Feb 1, 2022
4ef56eb
cargo fmt + removing useless tests
Feb 1, 2022
5e73fd0
Optimize mul_equals and inverse for pseudo-mersenne primes + fix comm…
Feb 1, 2022
48003ea
Restored Vec as input param of update_leaves function
DanieleDiBenedetto Feb 3, 2022
6b3acb8
Fix CI
DanieleDiBenedetto Feb 3, 2022
92f1c2b
Renaming functions for no-pseudomersenne mul
Feb 3, 2022
79ba224
update mul_equals comments
Feb 3, 2022
a12f4a5
Merge pull request #131 from HorizenOfficial/refactor_constraint_system
DanieleDiBenedetto Feb 4, 2022
81581dd
Merge pull request #142 from HorizenOfficial/in_memory_lazy_smt
DanieleDiBenedetto Feb 4, 2022
8129a70
Merge branch 'nonnative_doc' into development
DanieleDiBenedetto Feb 4, 2022
1fbba3c
Merge branch 'Optimize-non-native-field-mul-for-pseudo-mersenne-prime…
DanieleDiBenedetto Feb 4, 2022
d9f863e
Updated dependencies
DanieleDiBenedetto Feb 4, 2022
7e2c469
Cargo fmt
DanieleDiBenedetto Feb 4, 2022
3b237bd
Updated AUTHORS
DanieleDiBenedetto Feb 4, 2022
732e1e5
Updated version
DanieleDiBenedetto Feb 4, 2022
65e260d
added comments on `accumulated_extra` in `group_and_check_equality()`
UlrichHaboeck75 Feb 9, 2022
8462bca
Integrating comments on PR #153
Feb 9, 2022
5df1ac3
Merge branch 'Optimize-non-native-field-mul-for-pseudo-mersenne-prime…
Feb 9, 2022
67a2a96
Fix security check in pre_add_reduce
Feb 9, 2022
775fe6d
Merge pull request #164 from HorizenOfficial/Optimize-non-native-fiel…
DanieleDiBenedetto Feb 10, 2022
8de1ad7
Merge pull request #153 from HorizenOfficial/nonnative_doc
DanieleDiBenedetto Feb 10, 2022
a2f365a
Cargo fmt
DanieleDiBenedetto Feb 10, 2022
25a1ea8
Merge branch 'development' into release_0_4_0
DanieleDiBenedetto Feb 10, 2022
96e2065
Updated some allowed clippy lints and solved a couple of clippy errors
DanieleDiBenedetto Feb 10, 2022
acf8569
Merge branch 'development' into release_0_4_0
DanieleDiBenedetto Feb 10, 2022
c0f35a9
Updated version in all crates
DanieleDiBenedetto Feb 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Cargo.lock
*.orig
coeffs_*
msm_bases_*
*.py
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ script:

jobs:
include:
- name: bionic_rust-1.51.0_latest-STAGE1
env: IMAGE_TAG=bionic_rust-1.51.0_latest TESTS='000,001,003,005,006,008,009,011,012,013,014,015,016,018'
- name: bionic_rust-1.51.0_latest-STAGE2
env: IMAGE_TAG=bionic_rust-1.51.0_latest TESTS='017'
- name: bionic_rust-nightly-2021-04-25_latest
- name: bionic_rust-1.51.0_latest-CHECK
env: IMAGE_TAG=bionic_rust-1.51.0_latest TESTS='000,001,003,005,006,008,009,011,012,013,014,015,016,020'
- name: bionic_rust-1.51.0_latest-TEST
env: IMAGE_TAG=bionic_rust-1.51.0_latest TESTS='017,018'
- name: bionic_rust-1.51.0_latest-TEST_INTENSIVE
env: IMAGE_TAG=bionic_rust-1.51.0_latest TESTS='019'
- name: bionic_rust-nightly-2021-04-25_latest-CHECK
env: IMAGE_TAG=bionic_rust-nightly-2021-04-25_latest TESTS='002,004,007,010' CARGOARGS='+nightly-2021-04-25'
5 changes: 4 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ Pratyush Mishra
Howard Wu
Daniele Di Benedetto
Marcelo Kaihara
Ulrich Haboeck
Ulrich Haboeck
Luca Giussani
Daniele Di Tullio
Nicholas Mainardi
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ debug-assertions = true
debug = true

# Uncomment these lines for local development paths
#
#[patch.'https://github.com/HorizenOfficial/ginger-lib']
#algebra = { path = './algebra' }
#r1cs-core = { path = "./r1cs/core" }
#
#[patch.'https://github.com/HorizenLabs/marlin']
#marlin = { path = '../marlin' }
#
#[patch.'https://github.com/HorizenLabs/poly-commit']
#poly-commit = { path = '../poly-commit' }

# [patch.'https://github.com/HorizenOfficial/ginger-lib']
# algebra = { path = './algebra' }
# r1cs-core = { path = "./r1cs/core" }

# [patch.'https://github.com/HorizenLabs/marlin']
# marlin = { path = '../marlin' }

# [patch.'https://github.com/HorizenLabs/poly-commit']
# poly-commit = { path = '../poly-commit' }
20 changes: 14 additions & 6 deletions algebra/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "algebra"
version = "0.3.1"
version = "0.4.0"
authors = [
"Sean Bowe",
"Alessandro Chiesa",
Expand All @@ -13,7 +13,10 @@ authors = [
"Ulrich Haboeck <ulrich@horizenlabs.io>",
"Maksym Vereshchak <phoinic@gmail.com>",
"Luigi Varriale <luigi@horizenlabs.io>",
"cronicc <cronic@horizenlabs.io>"
"cronicc <cronic@horizenlabs.io>",
"Luca Giussani <lucagiussani@horizenlabs.io>",
"Daniele Di Tullio <danieled@horizenlabs.io>",
"Nicholas Mainardi <nicholas@horizenlabs.io>"
]
description = "A library for finite fields, elliptic curves and FFTs evaluation over prime finite fields"
include = ["Cargo.toml", "src", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
Expand All @@ -26,9 +29,10 @@ build = "build.rs"

[dependencies]
algebra-derive = { path = "algebra-derive", optional = true }
num-bigint = { version = "=0.4.3", default-features = false }

bench-utils = { path = "../bench-utils", optional = true }
byteorder = { version = "1" }
byteorder = { version = "=1.4.3" }
rand = { version = "=0.8.4" }
derivative = { version = "=2.2.0", features = ["use_core"] }

Expand All @@ -45,7 +49,9 @@ blake2 = "=0.8.1"
rand_xorshift = { version = "=0.3.0" }
paste = "=1.0.6"
criterion = "=0.3.5"
algebra = { path = "../algebra", features = ["full"] }
hex-literal = "=0.3.4"
num-traits = { version = "=0.2.14", default-features = false }
num-bigint = { version = "=0.4.3", features = ["rand"] }

[features]
parallel = [ "rayon" ]
Expand All @@ -55,7 +61,7 @@ llvm_asm = []
derive = ["algebra-derive"]

bls12_377 = []
bls12_381 = []
bls12_381 = ["jubjub"]
edwards_bls12 = ["bls12_377"]
edwards_sw6 = ["sw6"]
jubjub = []
Expand All @@ -65,8 +71,10 @@ mnt6_298 = []
mnt6_753 = ["mnt4_753"]
bn_382 = []
tweedle = []
secp256k1 = []
ed25519 = []

full = [ "bls12_377", "bls12_381", "sw6", "mnt4_753", "mnt6_298", "mnt6_753", "edwards_bls12", "edwards_sw6", "jubjub", "bn_382", "tweedle" ]
full = [ "bls12_377", "bls12_381", "sw6", "mnt4_753", "mnt6_298", "mnt6_753", "edwards_bls12", "edwards_sw6", "jubjub", "bn_382", "tweedle", "secp256k1", "ed25519" ]

[build-dependencies]
field-assembly = { path = "./field-assembly" }
Expand Down
1 change: 0 additions & 1 deletion algebra/algebra-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
clippy::assertions_on_constants
)]


use proc_macro2::TokenStream;
use syn::{parse_macro_input, Data, DeriveInput, Index, Type};

Expand Down
53 changes: 53 additions & 0 deletions algebra/src/biginteger/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ macro_rules! bigint_impl {
pub fn new(value: [u64; $num_limbs]) -> Self {
$name(value)
}

#[inline]
fn to_bytes_le(&self) -> Vec<u8> {
let array_map = self.0.iter().map(|limb| limb.to_le_bytes());
let mut res = Vec::<u8>::with_capacity($num_limbs * 8);
for limb in array_map {
res.extend_from_slice(&limb);
}
res
}
}

impl BigInteger for $name {
Expand Down Expand Up @@ -147,14 +157,18 @@ macro_rules! bigint_impl {
}
}

// Defines a BigInt from a slice of big endian booleans.
#[inline]
fn from_bits(bits: &[bool]) -> Self {
let mut res = Self::default();
let mut acc: u64 = 0;

// convert to little endian as the limbs are in
// little endian order
let mut bits = bits.to_vec();
bits.reverse();
for (i, bits64) in bits.chunks(64).enumerate() {
// each chunk is again arranged big endian
for bit in bits64.iter().rev() {
acc <<= 1;
acc += *bit as u64;
Expand All @@ -165,6 +179,7 @@ macro_rules! bigint_impl {
res
}

// Note: Does not skip leading zeroes
#[inline]
fn to_bits(&self) -> Vec<bool> {
let mut res = Vec::with_capacity(256);
Expand Down Expand Up @@ -293,5 +308,43 @@ macro_rules! bigint_impl {
repr
}
}

impl TryFrom<BigUint> for $name {
type Error = Box<dyn std::error::Error>;

#[inline]
fn try_from(val: BigUint) -> Result<$name, Self::Error> {
let bytes = val.to_bytes_le();

if bytes.len() > $num_limbs * 8 {
Err(format!(
"A BigUint of {} bytes cannot fit into a BigInt of {} bytes.",
bytes.len(),
$num_limbs * 8
))?
} else {
let mut limbs = [0u64; $num_limbs];

bytes
.chunks(8)
.into_iter()
.enumerate()
.for_each(|(i, chunk)| {
let mut chunk_padded = [0u8; 8];
chunk_padded[..chunk.len()].copy_from_slice(chunk);
limbs[i] = u64::from_le_bytes(chunk_padded)
});

Ok(Self(limbs))
}
}
}

impl From<$name> for BigUint {
#[inline]
fn from(val: $name) -> BigUint {
BigUint::from_bytes_le(&val.to_bytes_le())
}
}
};
}
6 changes: 6 additions & 0 deletions algebra/src/biginteger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ use crate::{
fields::BitIterator,
CanonicalDeserialize, CanonicalSerialize, SerializationError, UniformRand,
};
use num_bigint::BigUint;
use rand::{
distributions::{Distribution, Standard},
Rng,
};
use serde::{Deserialize, Serialize};
use std::{
convert::TryFrom,
fmt::{Debug, Display},
io::{Read, Result as IoResult, Write},
};
Expand Down Expand Up @@ -51,6 +53,8 @@ pub trait BigInteger:
+ AsMut<[u64]>
+ AsRef<[u64]>
+ From<u64>
+ TryFrom<BigUint>
+ Into<BigUint>
{
/// Add another representation to this one, returning the carry bit.
fn add_nocarry(&mut self, other: &Self) -> bool;
Expand Down Expand Up @@ -94,6 +98,8 @@ pub trait BigInteger:

/// Returns the bit representation in a big endian boolean array, without
/// leading zeros.
// TODO: the current implementation does not seem to skip leading zeroes.
// Let us check its usage and determine if a change is reasonable.
fn to_bits(&self) -> Vec<bool>;

/// Returns a vector for wnaf.
Expand Down
38 changes: 38 additions & 0 deletions algebra/src/curves/all_curve_checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
echo "################ CHECKING ALL CURVE PARAMETERS##################"
echo "################################################################"
echo #
echo "###############Checking bls12_377 curve parameters:"
sage check_curve_parameters.sage bls12_377/g1.rs ../fields/bls12_377/fq.rs ../fields/bls12_377/fr.rs #
echo #
echo "################Checking bls12_381 curve parameters:"
sage check_curve_parameters.sage bls12_381/g1.rs ../fields/bls12_381/fq.rs ../fields/jubjub/fq.rs #
echo #
echo "###############Checking bn_382 curve parameters:"
echo "########### curve g1:"
sage check_curve_parameters.sage bn_382/g1.rs ../fields/bn_382/fq.rs ../fields/bn_382/fr.rs #
echo "########### curve g:"
sage check_curve_parameters.sage bn_382/g.rs ../fields/bn_382/fr.rs ../fields/bn_382/fq.rs #
echo #
echo "################Checking ed25519 curve parameters:"
sage check_curve_parameters.sage ed25519/mod.rs ../fields/ed25519/fq.rs ../fields/ed25519/fr.rs #
echo #
echo "###############Checking mnt6 curve parameters:"
sage check_curve_parameters.sage mnt6/g1.rs ../fields/mnt6/fq.rs ../fields/mnt6/fr.rs #
echo #
echo "###############Checking mnt4753 curve parameters:"
sage check_curve_parameters.sage mnt4753/g1.rs ../fields/mnt4753/fq.rs ../fields/mnt6753/fq.rs #
echo #
echo "###############Checking mnt6753 curve parameters:"
sage check_curve_parameters.sage mnt6753/g1.rs ../fields/mnt6753/fq.rs ../fields/mnt4753/fq.rs #
echo #
echo "###############Checking secp256k1 curve parameters:"
sage check_curve_parameters.sage secp256k1/mod.rs ../fields/secp256k1/fq.rs ../fields/secp256k1/fr.rs #
echo #
echo "###############Checking sw6 curve parameters:" # Very long computation.
sage check_curve_parameters.sage sw6/g1.rs ../fields/sw6/fq.rs ../fields/bls12_377/fq.rs #
echo #
echo "###############Checking tweedle curve parameters:"
echo "############ dee:"
sage check_curve_parameters.sage tweedle/dee.rs ../fields/tweedle/fq.rs ../fields/tweedle/fr.rs #
echo "############ dum:"
sage check_curve_parameters.sage tweedle/dum.rs ../fields/tweedle/fr.rs ../fields/tweedle/fq.rs #
5 changes: 1 addition & 4 deletions algebra/src/curves/bls12_377/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use crate::field_new;
use crate::{
biginteger::{BigInteger256, BigInteger384},
curves::models::{ModelParameters, SWModelParameters},
fields::{
bls12_377::{Fq, Fr},
Field,
},
fields::{bls12_377::*, Field},
};

#[derive(Copy, Clone, Default, PartialEq, Eq)]
Expand Down
5 changes: 1 addition & 4 deletions algebra/src/curves/bls12_377/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ use crate::field_new;
use crate::{
biginteger::{BigInteger256, BigInteger384},
curves::models::{ModelParameters, SWModelParameters},
fields::{
bls12_377::{Fq, Fq2, Fr},
Field,
},
fields::{bls12_377::*, Field},
};

#[derive(Copy, Clone, Default, PartialEq, Eq)]
Expand Down
5 changes: 1 addition & 4 deletions algebra/src/curves/bls12_381/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ use crate::{
bls12_381::Bls12_381Parameters,
models::{ModelParameters, SWModelParameters},
},
fields::{
bls12_381::{Fq, Fr},
Field,
},
fields::{bls12_381::*, Field},
};

pub type G1Affine = Bls12G1Affine<Bls12_381Parameters>;
Expand Down
5 changes: 1 addition & 4 deletions algebra/src/curves/bls12_381/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ use crate::{
bls12_381::{g1::Bls12_381G1Parameters, Bls12_381Parameters},
models::{ModelParameters, SWModelParameters},
},
fields::{
bls12_381::{Fq, Fq2, Fr},
Field,
},
fields::{bls12_381::*, Field},
};

pub type G2Affine = Bls12G2Affine<Bls12_381Parameters>;
Expand Down
Loading