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

add accumulators #300

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

add accumulators #300

wants to merge 4 commits into from

Conversation

mikelodder7
Copy link
Contributor

Sorry this is massive but its all the accumulator stuff.

@mikelodder7
Copy link
Contributor Author

Hmm. It's failing due to an openssl dependency fail. Could use some help with how to fix your test environment on this.

accumulator-rsa/Cargo.toml Outdated Show resolved Hide resolved
@clehner
Copy link
Contributor

clehner commented Sep 21, 2021

After making the change in #300 (comment), build completes, but some tests fail:

4 failing tests

This is with running cargo test --workspace or cargo test -p pairings.

failures:

---- bn256::cofactor::clear_cofactor stdout ----
thread 'bn256::cofactor::clear_cofactor' panicked at 'assertion failed: `(left == right)`
  left: `G2 { x: Fq2 { c0: Fq(0x1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed), c1: Fq(0x198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c2) }, y: Fq2 { c0: Fq(0x12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa), c1: Fq(0x090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b) }, z: Fq2 { c0: Fq(0x0000000000000000000000000000000000000000000000000000000000000001), c1: Fq(0x0000000000000000000000000000000000000000000000000000000000000000) } }`,
 right: `G2 { x: Fq2 { c0: Fq(0x2d7cfbc8248749d23d9de54dab37f81e683b82e029299bff95d20fc22818edca), c1: Fq(0x2a0650569bfb5c818bb0b8fa62addfb23f12a7cbcc049233270583eb5d2decd7) }, y: Fq2 { c0: Fq(0x10068a7fae331689151177f6d95f167f6d96565daf7e1b755359150c843dc86e), c1: Fq(0x05aa432f412580f38a914b1101450184c8f24355b16925b5fe067f03a2ad9cfe) }, z: Fq2 { c0: Fq(0x2503df8ee48621d0c5481da5b6ccf5cf1e0be6dc2ad0ce044d1005f9c62c0aeb), c1: Fq(0x299d57de5cf683bb31677f00bb47159a293e230797ece4b3ed7d5156cf4e031e) } }`', pairings/src/bn256/cofactor.rs:35:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- bn256::ec::g2::g2_curve_tests stdout ----
thread 'bn256::ec::g2::g2_curve_tests' panicked at 'assertion failed: `(left == right)`
  left: `G2 { x: Fq2 { c0: Fq(0x2c421e56bb32e0c33a662a7bef858980c853cb6f23e851e17eb2502a228e0150), c1: Fq(0x28a09f3657471824057079222570f44a06975acd08cb083db78b0078a7438107) }, y: Fq2 { c0: Fq(0x18e5bec318d4c56519a22650a0900344b777abce21ec83b44885c4f244977f61), c1: Fq(0x2f52b607d2202b7e355e4d4dd91d668f0f594ab42de1abe5b06a34ab8c4c4cac) }, z: Fq2 { c0: Fq(0x08989bf5996c970025c44569972f62c427be1e06f3176830595a1bf33df8bc68), c1: Fq(0x17cbf10e24bbcced3fa73a13718ff731e8a1214aaca0e9a3120e4efb5888e13a) } }`,
 right: `G2 { x: Fq2 { c0: Fq(0x098e2b0072271f9acb772c686d3248f2fae5f6f7acc5a347f20e7f9fe09e9499), c1: Fq(0x198cb7ada594ecd49f36b7ccac246b7f6fe254e1921efc5588d1975cf39e2351) }, y: Fq2 { c0: Fq(0x02d0e00e9ece50706008de070834edf4a89bc14e9aeb1655c625e1d0187bacde), c1: Fq(0x053d4017991c41be75d0481693b428a634339faf63cacab0f96a33dbd5331176) }, z: Fq2 { c0: Fq(0x1837d19e86a139119160f8a09e3a9c65f77bcdc119a068e3ba5eebf218186e63), c1: Fq(0x268d74d1139815f3c6a917bcbbda7d3d6f3456d07bafa4a84e0970afc8387e49) } }`', pairings/src/tests/curve.rs:374:17

---- bn256::ec::g2::subgroup_check::test_g2_subgroup_check stdout ----
thread 'bn256::ec::g2::subgroup_check::test_g2_subgroup_check' panicked at 'assertion failed: `(left == right)`
  left: `false`,
 right: `true`', pairings/src/bn256/ec/g2.rs:354:13

---- bn256::ec::g2::test_addition_and_doubling stdout ----
thread 'bn256::ec::g2::test_addition_and_doubling' panicked at 'assertion failed: `(left == right)`
  left: `G2 { x: Fq2 { c0: Fq(0x19e564c3865619a82e57d6247d7136a2ed657904e08ade690b781cb8fb4ed455), c1: Fq(0x15bfe26eabcb3f656bd0ce381f29d22a7e62af264d9e290d8aa10326427af146) }, y: Fq2 { c0: Fq(0x2f20acb1a3c6d87dd88f7e8fef38f207a93af940cee8fe77696cb255dadaaabe), c1: Fq(0x2b966eeaf70673a4e64eda5feba42258d94e11f53f2acc337702b1655c8bf474) }, z: Fq2 { c0: Fq(0x1c2fa13bab694003280c8c19765b3d6463896e6de3ee2521145c23cb701c4862), c1: Fq(0x19c501daa4709bbed88af69b154f3b2babd420eb4b055e3cdcfa2b8af2dd2f13) } }`,
 right: `G2 { x: Fq2 { c0: Fq(0x113ceaec9b8cf1de8f37a9565e53a75983f4333887de0613b31cc3e71159973c), c1: Fq(0x1387c7b0fd21326a841d6456650b173e28c47f5458b822a13c6f69a850d867f2) }, y: Fq2 { c0: Fq(0x1b4fe84946a6ff937c75a22ad31dca263f90ff0029d103c23943ffa06461da5a), c1: Fq(0x279bb0fb9d267976d0ab21c67810bfb6c7753e69a4acdf76f9501ad7115b71b4) }, z: Fq2 { c0: Fq(0x08a04fcc4f07afe32551713b2913958b4fca168514c04d0e8789e215f0946965), c1: Fq(0x0456a0bfca642e7263581a466cde65719748f7ce99727983521e93e7f64a0015) } }`', pairings/src/bn256/ec/g2.rs:584:17


failures:
    bn256::cofactor::clear_cofactor
    bn256::ec::g2::g2_curve_tests
    bn256::ec::g2::subgroup_check::test_g2_subgroup_check
    bn256::ec::g2::test_addition_and_doubling

test result: FAILED. 172 passed; 4 failed; 16 ignored; 0 measured; 0 filtered out; finished in 70.89s

I skipped tests that were taking > 60 seconds, for practical reasons:

patch to ignore slow tests
diff --git a/accumulator-ecc/src/accumulator.rs b/accumulator-ecc/src/accumulator.rs
index cf2c7c7..09d04f1 100644
--- a/accumulator-ecc/src/accumulator.rs
+++ b/accumulator-ecc/src/accumulator.rs
@@ -237,2 +237,3 @@ mod tests {
     #[test]
+    #[ignore]
     fn one_year_updates() {
diff --git a/pairings/src/bls12_381/ec/g1.rs b/pairings/src/bls12_381/ec/g1.rs
index f0ccece..9c7d161 100644
--- a/pairings/src/bls12_381/ec/g1.rs
+++ b/pairings/src/bls12_381/ec/g1.rs
@@ -698,2 +698,3 @@ fn test_g1_same_y() {
 #[test]
+#[ignore]
 fn g1_curve_tests() {
diff --git a/pairings/src/bls12_381/ec/g2.rs b/pairings/src/bls12_381/ec/g2.rs
index f6719f2..d2e04b7 100644
--- a/pairings/src/bls12_381/ec/g2.rs
+++ b/pairings/src/bls12_381/ec/g2.rs
@@ -828,2 +828,3 @@ use rand_core::SeedableRng;
 #[test]
+#[ignore]
 fn g2_add_test() {
diff --git a/pairings/src/bls12_381/fq12.rs b/pairings/src/bls12_381/fq12.rs
index 2534d20..6ebb900 100644
--- a/pairings/src/bls12_381/fq12.rs
+++ b/pairings/src/bls12_381/fq12.rs
@@ -183,2 +183,3 @@ fn test_fq12_mul_by_014() {
 #[test]
+#[ignore]
 fn fq12_field_tests() {
diff --git a/pairings/src/bls12_381/fq2.rs b/pairings/src/bls12_381/fq2.rs
index b0774aa..b56a511 100644
--- a/pairings/src/bls12_381/fq2.rs
+++ b/pairings/src/bls12_381/fq2.rs
@@ -982,2 +982,3 @@ fn test_fq2_mul_nonresidue() {
 #[test]
+#[ignore]
 fn fq2_field_tests() {
diff --git a/pairings/src/bls12_381/fq6.rs b/pairings/src/bls12_381/fq6.rs
index c21b9f9..5c3cde9 100644
--- a/pairings/src/bls12_381/fq6.rs
+++ b/pairings/src/bls12_381/fq6.rs
@@ -372,2 +372,3 @@ fn test_fq6_mul_by_01() {
 #[test]
+#[ignore]
 fn fq6_field_tests() {
diff --git a/pairings/src/bls12_381/mod.rs b/pairings/src/bls12_381/mod.rs
index da008cd..1da309c 100644
--- a/pairings/src/bls12_381/mod.rs
+++ b/pairings/src/bls12_381/mod.rs
@@ -379,2 +379,3 @@ impl G2Prepared {
 #[test]
+#[ignore]
 fn bls12_engine_tests() {
diff --git a/pairings/src/bn256/ec/g1.rs b/pairings/src/bn256/ec/g1.rs
index a3e8f57..21a150f 100644
--- a/pairings/src/bn256/ec/g1.rs
+++ b/pairings/src/bn256/ec/g1.rs
@@ -386,2 +386,3 @@ fn test_base_point_addition_and_doubling() {
 #[test]
+#[ignore]
 fn g1_curve_tests() {
diff --git a/pairings/src/bn256/ec/g2.rs b/pairings/src/bn256/ec/g2.rs
index ba05bb2..d03ce57 100644
--- a/pairings/src/bn256/ec/g2.rs
+++ b/pairings/src/bn256/ec/g2.rs
@@ -599,2 +599,3 @@ fn test_addition_and_doubling() {
 #[test]
+#[ignore]
 fn random_negation_tests() {
@@ -634,2 +635,3 @@ fn random_negation_tests() {
 #[test]
+#[ignore]
 fn mul_by_order_tests() {
diff --git a/pairings/src/bn256/fq12.rs b/pairings/src/bn256/fq12.rs
index a7eeed1..4cd3b39 100644
--- a/pairings/src/bn256/fq12.rs
+++ b/pairings/src/bn256/fq12.rs
@@ -214,2 +214,3 @@ fn test_squaring() {
 #[test]
+#[ignore]
 fn fq12_field_tests() {
diff --git a/pairings/src/bn256/fq2.rs b/pairings/src/bn256/fq2.rs
index 95350d0..90f2acd 100644
--- a/pairings/src/bn256/fq2.rs
+++ b/pairings/src/bn256/fq2.rs
@@ -991,2 +991,3 @@ fn test_fq2_mul_nonresidue() {
 #[test]
+#[ignore]
 fn fq2_field_tests() {
diff --git a/pairings/src/bn256/fq6.rs b/pairings/src/bn256/fq6.rs
index aedc354..57d761c 100644
--- a/pairings/src/bn256/fq6.rs
+++ b/pairings/src/bn256/fq6.rs
@@ -393,2 +393,3 @@ fn test_fq6_mul_by_01() {
 #[test]
+#[ignore]
 fn fq6_field_tests() {
diff --git a/pairings/src/bn256/mod.rs b/pairings/src/bn256/mod.rs
index 0c41fd5..151b36b 100644
--- a/pairings/src/bn256/mod.rs
+++ b/pairings/src/bn256/mod.rs
@@ -472,2 +472,3 @@ use rand_xorshift::XorShiftRng;
 #[test]
+#[ignore]
 fn test_pairing() {
@@ -554,2 +555,3 @@ fn test_pairing() {
 #[test]
+#[ignore]
 fn random_bilinearity_tests() {
@@ -597,2 +599,3 @@ fn random_bilinearity_tests() {
 #[test]
+#[ignore]
 fn bn256_engine_tests() {

Signed-off-by: Michael Lodder <redmike7@gmail.com>
Signed-off-by: Michael Lodder <redmike7@gmail.com>
Signed-off-by: Michael Lodder <redmike7@gmail.com>
@clehner
Copy link
Contributor

clehner commented Oct 19, 2021

Tests passed on my machine (after about 20 minutes)

@mikelodder7
Copy link
Contributor Author

Tests passed on my machine (after about 20 minutes)

Yes there is a long running test. Should we set it to ignore?

@clehner
Copy link
Contributor

clehner commented Oct 19, 2021

Should we set it to ignore?

I think so

Signed-off-by: Michael Lodder <redmike7@gmail.com>
@clehner
Copy link
Contributor

clehner commented Oct 26, 2021

@mikelodder7 Thanks for adding that ignore.

Unfortunately, there is a CI/test failure in https://github.com/spruceid/ssi/runs/3952962118?check_suite_focus=true#step:5:619 which I reproduce now:

---- witnessnon::tests::big_updates stdout ----
thread 'witnessnon::tests::big_updates' panicked at 'assertion failed: `(left == right)`
  left: `RustBigInt { value: 32491858468683582588879091275371469417598983656934653402224842218834223921424 }`,
 right: `RustBigInt { value: -78535984312064952543786128050760493949773997771750782388247151021506874890467 }`', accumulator-rsa/src/witnessnon.rs:92:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Changing from the bi-rust feature to bi-ossl did not help:

---- witnessnon::tests::big_updates stdout ----
thread 'witnessnon::tests::big_updates' panicked at 'assertion failed: `(left == right)`
  left: `OsslBigInt { value: -45867278714733619537242147304622359398474573969922088330638796276810677237142 }`,
 right: `OsslBigInt { value: 52241412249517719820353771406309237997644926343828395035723674440609766849227 }`', accumulator-rsa/src/witnessnon.rs:225:9

Using bi-gmp did not work either:

test witnessnon::tests::big_updates ... FAILED
error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: `/home/cel/src/ssi/target/debug/deps/rsa-ed989139d94aa775` (signal: 8, SIGFPE: erroneous arithmetic operation)

@mikelodder7
Copy link
Contributor Author

That's odd because it has nothing to do with what I changed.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

None yet

3 participants