mratsim / constantine

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.
Other
413 stars 44 forks source link

Fuzzing failure: Random Inversion testing #131

Closed mratsim closed 3 years ago

mratsim commented 3 years ago

https://github.com/mratsim/constantine/runs/1745421711

test_finite_fields_powinv xoshiro512** seed: 1611271126

[Suite] Modular exponentiation over finite fields [64-bit mode]
  [OK] n² mod 101
  [OK] x^(p-2) mod p (modular inversion if p prime)

[Suite] Modular division by 2
  [OK] Random modular div2 testing on P224
  [OK] Random modular div2 testing on BN254_Nogami
  [OK] Random modular div2 testing on BN254_Snarks
  [OK] Random modular div2 testing on Curve25519
  [OK] Random modular div2 testing on P256
  [OK] Random modular div2 testing on Secp256k1
  [OK] Random modular div2 testing on BLS12_377
  [OK] Random modular div2 testing on BLS12_381

[Suite] Modular inversion over prime fields [64-bit mode]
  [OK] Specific tests on Fp[BLS12_381]
  [OK] Specific tests on Fp[BN254_Snarks]
    /Users/runner/work/constantine/constantine/constantine/tests/t_finite_fields_powinv.nim(276, 22): Check failed: bool r.isOne()
    /Users/runner/work/constantine/constantine/constantine/tests/t_finite_fields_powinv.nim(278, 22): Check failed: bool r.isOne()
  [FAILED] Random inversion testing on P224
  [OK] Random inversion testing on BN254_Nogami
  [OK] Random inversion testing on BN254_Snarks
  [OK] Random inversion testing on Curve25519
  [OK] Random inversion testing on P256
  [OK] Random inversion testing on Secp256k1
  [OK] Random inversion testing on BLS12_377
  [OK] Random inversion testing on BLS12_381

[Suite] Bug highlighted by property-based testing [64-bit mode]
  [OK] #42 - a^(p-3)/4 (inverse square root)
  [OK] #43 - a^(p-3)/4 (inverse square root)
mratsim commented 3 years ago

32-bit https://github.com/mratsim/constantine/pull/135/checks?check_run_id=1754998850#step:19:217

 test_finite_fields_powinv xoshiro512** seed: 1611433271

[Suite] Modular exponentiation over finite fields [32-bit mode]
  [OK] n² mod 101
  [OK] x^(p-2) mod p (modular inversion if p prime)

[Suite] Modular division by 2
  [OK] Random modular div2 testing on P224
  [OK] Random modular div2 testing on BN254_Nogami
  [OK] Random modular div2 testing on BN254_Snarks
  [OK] Random modular div2 testing on Curve25519
  [OK] Random modular div2 testing on P256
  [OK] Random modular div2 testing on Secp256k1
  [OK] Random modular div2 testing on BLS12_377
  [OK] Random modular div2 testing on BLS12_381

[Suite] Modular inversion over prime fields [32-bit mode]
  [OK] Specific tests on Fp[BLS12_381]
  [OK] Specific tests on Fp[BN254_Snarks]
  [OK] Random inversion testing on P224
  [OK] Random inversion testing on BN254_Nogami
  [OK] Random inversion testing on BN254_Snarks
    /home/runner/work/constantine/constantine/constantine/tests/t_finite_fields_powinv.nim(276, 22): Check failed: bool r.isOne()
    /home/runner/work/constantine/constantine/constantine/tests/t_finite_fields_powinv.nim(278, 22): Check failed: bool r.isOne()
  [FAILED] Random inversion testing on Curve25519
  [OK] Random inversion testing on P256
  [OK] Random inversion testing on Secp256k1
  [OK] Random inversion testing on BLS12_377
  [OK] Random inversion testing on BLS12_381

[Suite] Bug highlighted by property-based testing [32-bit mode]
  [OK] #42 - a^(p-3)/4 (inverse square root)
  [OK] #43 - a^(p-3)/4 (inverse square root)

64-bit https://github.com/mratsim/constantine/pull/135/checks?check_run_id=1754998858#step:17:275

test_finite_fields_powinv xoshiro512** seed: 1611433250

[Suite] Modular exponentiation over finite fields [64-bit mode]
  [OK] n² mod 101
  [OK] x^(p-2) mod p (modular inversion if p prime)

[Suite] Modular division by 2
  [OK] Random modular div2 testing on P224
  [OK] Random modular div2 testing on BN254_Nogami
  [OK] Random modular div2 testing on BN254_Snarks
  [OK] Random modular div2 testing on Curve25519
  [OK] Random modular div2 testing on P256
  [OK] Random modular div2 testing on Secp256k1
  [OK] Random modular div2 testing on BLS12_377
  [OK] Random modular div2 testing on BLS12_381

[Suite] Modular inversion over prime fields [64-bit mode]
  [OK] Specific tests on Fp[BLS12_381]
  [OK] Specific tests on Fp[BN254_Snarks]
    /Users/runner/work/constantine/constantine/constantine/tests/t_finite_fields_powinv.nim(276, 22): Check failed: bool r.isOne()
    /Users/runner/work/constantine/constantine/constantine/tests/t_finite_fields_powinv.nim(278, 22): Check failed: bool r.isOne()
  [FAILED] Random inversion testing on P224
  [OK] Random inversion testing on BN254_Nogami
  [OK] Random inversion testing on BN254_Snarks
  [OK] Random inversion testing on Curve25519
  [OK] Random inversion testing on P256
  [OK] Random inversion testing on Secp256k1
  [OK] Random inversion testing on BLS12_377
  [OK] Random inversion testing on BLS12_381

[Suite] Bug highlighted by property-based testing [64-bit mode]
  [OK] #42 - a^(p-3)/4 (inverse square root)
  [OK] #43 - a^(p-3)/4 (inverse square root)