From 7c5421ffdc0c64e4c60cdd497383014bd4d0de50 Mon Sep 17 00:00:00 2001 From: Mamy Ratsimbazafy Date: Tue, 7 Feb 2023 13:11:44 +0100 Subject: [PATCH] move staticFor to the inner repo, not helpers/ for unblocking nimble install (#216) --- benchmarks/bench_ec_g1.nim | 1 - benchmarks/bench_ec_g1_batch.nim | 2 +- benchmarks/bench_ec_g2.nim | 1 - benchmarks/bench_fields_template.nim | 2 +- benchmarks/bench_fp.nim | 1 - benchmarks/bench_fp12.nim | 1 - benchmarks/bench_fp2.nim | 1 - benchmarks/bench_fp4.nim | 1 - benchmarks/bench_fp6.nim | 1 - benchmarks/bench_fp_double_precision.nim | 4 ++-- benchmarks/bench_pairing_bls12_377.nim | 1 - benchmarks/bench_pairing_bls12_381.nim | 1 - benchmarks/bench_pairing_bn254_nogami.nim | 1 - benchmarks/bench_pairing_bn254_snarks.nim | 1 - benchmarks/bench_pairing_template.nim | 1 + benchmarks/bench_summary_bls12_377.nim | 1 - benchmarks/bench_summary_bls12_381.nim | 1 - benchmarks/bench_summary_bn254_nogami.nim | 1 - benchmarks/bench_summary_bn254_snarks.nim | 1 - benchmarks/bench_summary_pasta.nim | 1 - benchmarks/bench_summary_template.nim | 2 +- constantine/platforms/primitives.nim | 2 +- {helpers => constantine/platforms}/static_for.nim | 0 tests/gpu/t_nvidia_fp.nim | 8 ++++---- tests/math/t_fp12_exponentiation.nim | 2 +- tests/math/t_fp2_sqrt.nim | 2 +- tests/math/t_fp_tower_frobenius_template.nim | 2 +- tests/math/t_fp_tower_template.nim | 2 +- tests/math/t_pairing_bls12_377_line_functions.nim | 2 +- tests/math/t_pairing_bls12_381_line_functions.nim | 2 +- tests/math/t_pairing_cyclotomic_subgroup.nim | 2 +- tests/math/t_pairing_mul_fp12_by_lines.nim | 2 +- 32 files changed, 19 insertions(+), 34 deletions(-) rename {helpers => constantine/platforms}/static_for.nim (100%) diff --git a/benchmarks/bench_ec_g1.nim b/benchmarks/bench_ec_g1.nim index 1419b49..aad7948 100644 --- a/benchmarks/bench_ec_g1.nim +++ b/benchmarks/bench_ec_g1.nim @@ -14,7 +14,6 @@ import ec_shortweierstrass_projective, ec_shortweierstrass_jacobian], # Helpers - ../helpers/static_for, ./bench_elliptic_template # ############################################################ diff --git a/benchmarks/bench_ec_g1_batch.nim b/benchmarks/bench_ec_g1_batch.nim index f83524d..4995c9f 100644 --- a/benchmarks/bench_ec_g1_batch.nim +++ b/benchmarks/bench_ec_g1_batch.nim @@ -17,7 +17,7 @@ import ec_shortweierstrass_batch_ops_parallel], ../constantine/platforms/threadpool/threadpool, # Helpers - ../helpers/[static_for, prng_unsafe], + ../helpers/prng_unsafe, ./bench_elliptic_template, ./bench_blueprint diff --git a/benchmarks/bench_ec_g2.nim b/benchmarks/bench_ec_g2.nim index 00cd37f..e43099a 100644 --- a/benchmarks/bench_ec_g2.nim +++ b/benchmarks/bench_ec_g2.nim @@ -15,7 +15,6 @@ import ec_shortweierstrass_projective, ec_shortweierstrass_jacobian], # Helpers - ../helpers/static_for, ./bench_elliptic_template, # Standard library std/strutils diff --git a/benchmarks/bench_fields_template.nim b/benchmarks/bench_fields_template.nim index e65c773..0d99dc5 100644 --- a/benchmarks/bench_fields_template.nim +++ b/benchmarks/bench_fields_template.nim @@ -23,7 +23,7 @@ import ../helpers/prng_unsafe, ./bench_blueprint -export notes +export notes, abstractions proc separator*() = separator(165) proc smallSeparator*() = separator(8) diff --git a/benchmarks/bench_fp.nim b/benchmarks/bench_fp.nim index 8ef45d1..5e668b0 100644 --- a/benchmarks/bench_fp.nim +++ b/benchmarks/bench_fp.nim @@ -13,7 +13,6 @@ import ../constantine/math/io/io_bigints, ../constantine/math/constants/zoo_square_roots, # Helpers - ../helpers/static_for, ./bench_fields_template # ############################################################ diff --git a/benchmarks/bench_fp12.nim b/benchmarks/bench_fp12.nim index 9c636db..991d83b 100644 --- a/benchmarks/bench_fp12.nim +++ b/benchmarks/bench_fp12.nim @@ -11,7 +11,6 @@ import ../constantine/math/config/curves, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_fields_template # ############################################################ diff --git a/benchmarks/bench_fp2.nim b/benchmarks/bench_fp2.nim index c75a0f2..3eae545 100644 --- a/benchmarks/bench_fp2.nim +++ b/benchmarks/bench_fp2.nim @@ -11,7 +11,6 @@ import ../constantine/math/config/curves, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_fields_template # ############################################################ diff --git a/benchmarks/bench_fp4.nim b/benchmarks/bench_fp4.nim index 99eec03..6eba487 100644 --- a/benchmarks/bench_fp4.nim +++ b/benchmarks/bench_fp4.nim @@ -11,7 +11,6 @@ import ../constantine/math/config/curves, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_fields_template # ############################################################ diff --git a/benchmarks/bench_fp6.nim b/benchmarks/bench_fp6.nim index 1fb440b..ab80391 100644 --- a/benchmarks/bench_fp6.nim +++ b/benchmarks/bench_fp6.nim @@ -11,7 +11,6 @@ import ../constantine/math/config/curves, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_fields_template # ############################################################ diff --git a/benchmarks/bench_fp_double_precision.nim b/benchmarks/bench_fp_double_precision.nim index cb5dd91..a57655a 100644 --- a/benchmarks/bench_fp_double_precision.nim +++ b/benchmarks/bench_fp_double_precision.nim @@ -19,7 +19,7 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/[prng_unsafe, static_for], + ../helpers/prng_unsafe, ./platforms, # Standard library std/[monotimes, times, strformat, strutils] @@ -218,7 +218,7 @@ proc reduce2x*(T: typedesc, iters: int) = r.redc2x(t) proc reduce2xViaDivision*(T: typedesc, iters: int) = - + const bits2x = 2 * T.C.getCurveBitWidth() var r: matchingBigInt(T.C) let t = rng.random_unsafe(BigInt[bits2x]) diff --git a/benchmarks/bench_pairing_bls12_377.nim b/benchmarks/bench_pairing_bls12_377.nim index 7ce8844..7bc205a 100644 --- a/benchmarks/bench_pairing_bls12_377.nim +++ b/benchmarks/bench_pairing_bls12_377.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_pairing_template # ############################################################ diff --git a/benchmarks/bench_pairing_bls12_381.nim b/benchmarks/bench_pairing_bls12_381.nim index 4e868c5..bf9270a 100644 --- a/benchmarks/bench_pairing_bls12_381.nim +++ b/benchmarks/bench_pairing_bls12_381.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_pairing_template # ############################################################ diff --git a/benchmarks/bench_pairing_bn254_nogami.nim b/benchmarks/bench_pairing_bn254_nogami.nim index 7ec159b..899f9fa 100644 --- a/benchmarks/bench_pairing_bn254_nogami.nim +++ b/benchmarks/bench_pairing_bn254_nogami.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_pairing_template # ############################################################ diff --git a/benchmarks/bench_pairing_bn254_snarks.nim b/benchmarks/bench_pairing_bn254_snarks.nim index f6e0461..ebd71af 100644 --- a/benchmarks/bench_pairing_bn254_snarks.nim +++ b/benchmarks/bench_pairing_bn254_snarks.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_pairing_template # ############################################################ diff --git a/benchmarks/bench_pairing_template.nim b/benchmarks/bench_pairing_template.nim index 4147c5f..9519790 100644 --- a/benchmarks/bench_pairing_template.nim +++ b/benchmarks/bench_pairing_template.nim @@ -31,6 +31,7 @@ import ../helpers/prng_unsafe, ./bench_blueprint +export abstractions export zoo_pairings # generic sandwich https://github.com/nim-lang/Nim/issues/11225 export notes proc separator*() = separator(132) diff --git a/benchmarks/bench_summary_bls12_377.nim b/benchmarks/bench_summary_bls12_377.nim index 9783d5c..d4c11ff 100644 --- a/benchmarks/bench_summary_bls12_377.nim +++ b/benchmarks/bench_summary_bls12_377.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_summary_template # ############################################################ diff --git a/benchmarks/bench_summary_bls12_381.nim b/benchmarks/bench_summary_bls12_381.nim index f7ebe11..347a778 100644 --- a/benchmarks/bench_summary_bls12_381.nim +++ b/benchmarks/bench_summary_bls12_381.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_summary_template # ############################################################ diff --git a/benchmarks/bench_summary_bn254_nogami.nim b/benchmarks/bench_summary_bn254_nogami.nim index 4e23c79..fbcbc84 100644 --- a/benchmarks/bench_summary_bn254_nogami.nim +++ b/benchmarks/bench_summary_bn254_nogami.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_summary_template # ############################################################ diff --git a/benchmarks/bench_summary_bn254_snarks.nim b/benchmarks/bench_summary_bn254_snarks.nim index fdb182d..2e29d33 100644 --- a/benchmarks/bench_summary_bn254_snarks.nim +++ b/benchmarks/bench_summary_bn254_snarks.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_summary_template # ############################################################ diff --git a/benchmarks/bench_summary_pasta.nim b/benchmarks/bench_summary_pasta.nim index 56d4256..2b1de57 100644 --- a/benchmarks/bench_summary_pasta.nim +++ b/benchmarks/bench_summary_pasta.nim @@ -12,7 +12,6 @@ import ../constantine/math/arithmetic, ../constantine/math/extension_fields, # Helpers - ../helpers/static_for, ./bench_summary_template # ############################################################ diff --git a/benchmarks/bench_summary_template.nim b/benchmarks/bench_summary_template.nim index 37b4f5f..b9c81ff 100644 --- a/benchmarks/bench_summary_template.nim +++ b/benchmarks/bench_summary_template.nim @@ -32,7 +32,7 @@ import ../constantine/hashes, ../constantine/hash_to_curve/hash_to_curve, # Helpers - ../helpers/[prng_unsafe, static_for], + ../helpers/prng_unsafe, ./bench_blueprint export diff --git a/constantine/platforms/primitives.nim b/constantine/platforms/primitives.nim index b3460e5..be8a25d 100644 --- a/constantine/platforms/primitives.nim +++ b/constantine/platforms/primitives.nim @@ -18,7 +18,7 @@ import extended_precision ], ./bithacks, - ../../helpers/static_for + ./static_for export ct_types, diff --git a/helpers/static_for.nim b/constantine/platforms/static_for.nim similarity index 100% rename from helpers/static_for.nim rename to constantine/platforms/static_for.nim diff --git a/tests/gpu/t_nvidia_fp.nim b/tests/gpu/t_nvidia_fp.nim index 7b42728..c09e707 100644 --- a/tests/gpu/t_nvidia_fp.nim +++ b/tests/gpu/t_nvidia_fp.nim @@ -7,7 +7,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. -import +import # Standard library std/[unittest, times], # Internal @@ -17,7 +17,7 @@ import ../../constantine/math/arithmetic, ../../constantine/math_gpu/fields_nvidia, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe var rng: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 @@ -87,7 +87,7 @@ proc t_field_add(curve: static Curve) = let b = rng.random_long01Seq(Fp[curve]) var rCPU, rGPU_32, rGPU_64: Fp[curve] - + rCPU.sum(a, b) fpAdd32.exec(rGPU_32, a, b) fpAdd64.exec(rGPU_64, a, b) @@ -101,7 +101,7 @@ proc t_field_add(curve: static Curve) = let b = rng.random_long01Seq(Fr[curve]) var rCPU, rGPU_32, rGPU_64: Fr[curve] - + rCPU.sum(a, b) frAdd32.exec(rGPU_32, a, b) frAdd64.exec(rGPU_64, a, b) diff --git a/tests/math/t_fp12_exponentiation.nim b/tests/math/t_fp12_exponentiation.nim index 9a25195..0d3b643 100644 --- a/tests/math/t_fp12_exponentiation.nim +++ b/tests/math/t_fp12_exponentiation.nim @@ -16,7 +16,7 @@ import ../../constantine/math/config/curves, ../../constantine/math/io/io_extfields, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe const Iters = 2 diff --git a/tests/math/t_fp2_sqrt.nim b/tests/math/t_fp2_sqrt.nim index 5ac5533..8f372b7 100644 --- a/tests/math/t_fp2_sqrt.nim +++ b/tests/math/t_fp2_sqrt.nim @@ -16,7 +16,7 @@ import ../../constantine/math/config/curves, ../../constantine/math/io/io_extfields, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe const Iters = 8 diff --git a/tests/math/t_fp_tower_frobenius_template.nim b/tests/math/t_fp_tower_frobenius_template.nim index ac89e59..8699fe0 100644 --- a/tests/math/t_fp_tower_frobenius_template.nim +++ b/tests/math/t_fp_tower_frobenius_template.nim @@ -23,7 +23,7 @@ import ../../constantine/math/arithmetic, ../../constantine/math/isogenies/frobenius, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe export unittest # Generic sandwich diff --git a/tests/math/t_fp_tower_template.nim b/tests/math/t_fp_tower_template.nim index a194250..0be6502 100644 --- a/tests/math/t_fp_tower_template.nim +++ b/tests/math/t_fp_tower_template.nim @@ -23,7 +23,7 @@ import ../../constantine/math/arithmetic, ../../constantine/math/io/io_extfields, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe export unittest # Generic sandwich diff --git a/tests/math/t_pairing_bls12_377_line_functions.nim b/tests/math/t_pairing_bls12_377_line_functions.nim index 5301183..bc8fb92 100644 --- a/tests/math/t_pairing_bls12_377_line_functions.nim +++ b/tests/math/t_pairing_bls12_377_line_functions.nim @@ -21,7 +21,7 @@ import ec_scalar_mul], ../../constantine/math/pairings/lines_eval, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe const Iters = 4 diff --git a/tests/math/t_pairing_bls12_381_line_functions.nim b/tests/math/t_pairing_bls12_381_line_functions.nim index cc0fe98..bfaa92a 100644 --- a/tests/math/t_pairing_bls12_381_line_functions.nim +++ b/tests/math/t_pairing_bls12_381_line_functions.nim @@ -20,7 +20,7 @@ import ec_shortweierstrass_projective], ../../constantine/math/pairings/lines_eval, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe const Iters = 4 diff --git a/tests/math/t_pairing_cyclotomic_subgroup.nim b/tests/math/t_pairing_cyclotomic_subgroup.nim index 36184e5..2605660 100644 --- a/tests/math/t_pairing_cyclotomic_subgroup.nim +++ b/tests/math/t_pairing_cyclotomic_subgroup.nim @@ -18,7 +18,7 @@ import ../../constantine/math/pairings/cyclotomic_subgroups, ../../constantine/math/isogenies/frobenius, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe const Iters = 4 diff --git a/tests/math/t_pairing_mul_fp12_by_lines.nim b/tests/math/t_pairing_mul_fp12_by_lines.nim index 2174681..3258359 100644 --- a/tests/math/t_pairing_mul_fp12_by_lines.nim +++ b/tests/math/t_pairing_mul_fp12_by_lines.nim @@ -17,7 +17,7 @@ import ../../constantine/math/io/io_extfields, ../../constantine/math/pairings/lines_eval, # Test utilities - ../../helpers/[prng_unsafe, static_for] + ../../helpers/prng_unsafe const Iters = 8