2018-12-01 19:12:05 +00:00
|
|
|
|
packageName = "constantine"
|
2018-07-24 14:52:18 +00:00
|
|
|
|
version = "0.0.1"
|
|
|
|
|
author = "Status Research & Development GmbH"
|
2018-09-05 04:38:34 +00:00
|
|
|
|
description = "This library provides constant time big int primitives."
|
2018-07-24 14:52:18 +00:00
|
|
|
|
license = "MIT or Apache License 2.0"
|
|
|
|
|
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Dependencies
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2020-02-22 15:37:31 +00:00
|
|
|
|
requires "nim >= 1.1.0"
|
2018-07-24 14:52:18 +00:00
|
|
|
|
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Test config
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2020-06-07 17:39:34 +00:00
|
|
|
|
const buildParallel = "test_parallel.txt"
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# Testing strategy: to reduce CI time we test leaf functionality
|
|
|
|
|
# and skip testing codepath that would be exercised by leaves.
|
|
|
|
|
# While debugging, relevant unit-test can be reactivated.
|
|
|
|
|
# New features should stay on.
|
|
|
|
|
# Code refactoring requires re-enabling the full suite.
|
|
|
|
|
# Basic primitives should stay on to catch compiler regressions.
|
2020-06-15 20:58:56 +00:00
|
|
|
|
const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
|
|
|
|
|
# Primitives
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
2020-06-15 21:15:01 +00:00
|
|
|
|
("tests/t_primitives.nim", false),
|
2020-06-22 23:27:40 +00:00
|
|
|
|
("tests/t_primitives_extended_precision.nim", false),
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Big ints
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
2020-06-15 21:15:01 +00:00
|
|
|
|
("tests/t_io_bigints.nim", false),
|
|
|
|
|
("tests/t_bigints.nim", false),
|
|
|
|
|
("tests/t_bigints_multimod.nim", false),
|
|
|
|
|
("tests/t_bigints_mod_vs_gmp.nim", true),
|
|
|
|
|
("tests/t_bigints_mul_vs_gmp.nim", true),
|
|
|
|
|
("tests/t_bigints_mul_high_words_vs_gmp.nim", true),
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Field
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
2020-06-15 21:15:01 +00:00
|
|
|
|
("tests/t_io_fields", false),
|
|
|
|
|
("tests/t_finite_fields.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_finite_fields_conditional_arithmetic.nim", false),
|
2020-06-15 21:15:01 +00:00
|
|
|
|
("tests/t_finite_fields_mulsquare.nim", false),
|
|
|
|
|
("tests/t_finite_fields_sqrt.nim", false),
|
|
|
|
|
("tests/t_finite_fields_powinv.nim", false),
|
|
|
|
|
("tests/t_finite_fields_vs_gmp.nim", true),
|
2020-09-27 14:01:31 +00:00
|
|
|
|
("tests/t_fp_cubic_root.nim", false),
|
2020-08-20 08:21:39 +00:00
|
|
|
|
# Double-width finite fields
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
2020-08-20 08:21:39 +00:00
|
|
|
|
("tests/t_finite_fields_double_width.nim", false),
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Towers of extension fields
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
# ("tests/t_fp2.nim", false),
|
2020-06-15 21:15:01 +00:00
|
|
|
|
("tests/t_fp2_sqrt.nim", false),
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_fp6_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/t_fp6_bls12_377.nim", false),
|
|
|
|
|
# ("tests/t_fp6_bls12_381.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
("tests/t_fp6_bw6_761.nim", false),
|
2020-06-15 21:15:01 +00:00
|
|
|
|
("tests/t_fp12_bn254_snarks.nim", false),
|
|
|
|
|
("tests/t_fp12_bls12_377.nim", false),
|
|
|
|
|
("tests/t_fp12_bls12_381.nim", false),
|
2020-09-21 21:24:00 +00:00
|
|
|
|
("tests/t_fp12_exponentiation.nim", false),
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_fp4_frobenius.nim", false),
|
|
|
|
|
# ("tests/t_fp6_frobenius.nim", false),
|
|
|
|
|
("tests/t_fp12_frobenius.nim", false),
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Elliptic curve arithmetic G1
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g1_add_double.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g1_mul_sanity.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g1_mul_distri.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_g1_mul_vs_ref.nim", false),
|
|
|
|
|
("tests/t_ec_shortw_prj_g1_mixed_add.nim", false),
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_ec_shortw_jac_g1_add_double.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g1_mul_sanity.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g1_mul_distri.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_jac_g1_mul_vs_ref.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
# mixed_add
|
|
|
|
|
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Elliptic curve arithmetic G2
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_add_double_bls12_381.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_add_double_bls12_377.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim", false),
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_add_double_bw6_761.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim", false),
|
|
|
|
|
("tests/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
# mixed_add
|
2020-10-01 22:01:09 +00:00
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_add_double_bls12_381.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
# mixed_add
|
2020-10-01 22:01:09 +00:00
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_add_double_bls12_377.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim", false),
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
# mixed_add
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_add_double_bw6_761.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim", false),
|
|
|
|
|
# ("tests/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim", false),
|
2020-10-09 05:51:47 +00:00
|
|
|
|
("tests/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim", false),
|
|
|
|
|
# mixed_add
|
|
|
|
|
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Elliptic curve arithmetic vs Sagemath
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
2020-08-31 21:18:48 +00:00
|
|
|
|
("tests/t_ec_frobenius.nim", false),
|
2020-10-10 16:53:48 +00:00
|
|
|
|
("tests/t_ec_sage_bn254_nogami.nim", false),
|
2020-10-10 14:19:23 +00:00
|
|
|
|
("tests/t_ec_sage_bn254_snarks.nim", false),
|
2020-09-27 07:15:14 +00:00
|
|
|
|
("tests/t_ec_sage_bls12_377.nim", false),
|
2020-06-22 23:27:40 +00:00
|
|
|
|
("tests/t_ec_sage_bls12_381.nim", false),
|
|
|
|
|
# Edge cases highlighted by past bugs
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
2020-10-01 22:01:09 +00:00
|
|
|
|
("tests/t_ec_shortw_prj_edge_cases.nim", false),
|
2020-09-21 21:24:00 +00:00
|
|
|
|
# Pairing
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
# ("tests/t_pairing_bls12_377_line_functions.nim", false),
|
|
|
|
|
# ("tests/t_pairing_bls12_381_line_functions.nim", false),
|
|
|
|
|
# ("tests/t_pairing_mul_fp12_by_lines.nim", false),
|
|
|
|
|
# ("tests/t_pairing_cyclotomic_fp12.nim", false),
|
2020-09-21 21:24:00 +00:00
|
|
|
|
("tests/t_pairing_bn254_nogami_optate.nim", false),
|
|
|
|
|
("tests/t_pairing_bn254_snarks_optate.nim", false),
|
2020-09-27 07:15:14 +00:00
|
|
|
|
("tests/t_pairing_bls12_377_optate.nim", false),
|
|
|
|
|
("tests/t_pairing_bls12_381_optate.nim", false),
|
2020-12-15 18:18:36 +00:00
|
|
|
|
|
|
|
|
|
# Hashing vs OpenSSL
|
2021-01-21 23:09:52 +00:00
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
("tests/t_hash_sha256_vs_openssl.nim", true), # skip OpenSSL tests on Windows
|
|
|
|
|
|
|
|
|
|
# Prime order fields
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
("tests/t_fr.nim", false),
|
2020-06-15 20:58:56 +00:00
|
|
|
|
]
|
|
|
|
|
|
2020-06-19 20:08:15 +00:00
|
|
|
|
# For temporary (hopefully) investigation that can only be reproduced in CI
|
|
|
|
|
const useDebug = [
|
2020-12-15 18:18:36 +00:00
|
|
|
|
"tests/t_bigints.nim",
|
|
|
|
|
"tests/t_hash_sha256_vs_openssl.nim",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# Tests that uses sequences require Nim GC, stack scanning and nil pointer passed to openarray
|
|
|
|
|
# In particular the tests that uses the json test vectors, don't sanitize them.
|
|
|
|
|
# we do use gc:none to help
|
|
|
|
|
const skipSanitizers = [
|
|
|
|
|
"tests/t_ec_sage_bn254_nogami.nim",
|
|
|
|
|
"tests/t_ec_sage_bn254_snarks.nim",
|
|
|
|
|
"tests/t_ec_sage_bls12_377.nim",
|
|
|
|
|
"tests/t_ec_sage_bls12_381.nim",
|
2020-06-19 20:08:15 +00:00
|
|
|
|
]
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
when defined(windows):
|
|
|
|
|
# UBSAN is not available on mingw
|
|
|
|
|
const sanitizers = ""
|
|
|
|
|
else:
|
|
|
|
|
const sanitizers =
|
|
|
|
|
" --passC:-fsanitize=undefined --passL:-fsanitize=undefined" &
|
|
|
|
|
" --passC:-fno-sanitize-recover" & # Enforce crash on undefined behaviour
|
|
|
|
|
" --gc:none" # The conservative stack scanning of Nim default GC triggers, alignment UB and stack-buffer-overflow check.
|
|
|
|
|
# " --passC:-fsanitize=address --passL:-fsanitize=address" & # Requires too much stack for the inline assembly
|
2020-12-15 18:18:36 +00:00
|
|
|
|
|
2020-06-19 20:08:15 +00:00
|
|
|
|
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Helper functions
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2020-12-15 18:18:36 +00:00
|
|
|
|
proc clearParallelBuild() =
|
|
|
|
|
exec "> " & buildParallel
|
|
|
|
|
|
2020-06-07 17:39:34 +00:00
|
|
|
|
proc test(flags, path: string, commandFile = false) =
|
|
|
|
|
# commandFile should be a "file" but Nimscript doesn't support IO
|
2018-07-24 14:52:18 +00:00
|
|
|
|
if not dirExists "build":
|
|
|
|
|
mkDir "build"
|
2020-02-23 17:27:26 +00:00
|
|
|
|
# Compilation language is controlled by WEAVE_TEST_LANG
|
|
|
|
|
var lang = "c"
|
|
|
|
|
if existsEnv"TEST_LANG":
|
|
|
|
|
lang = getEnv"TEST_LANG"
|
|
|
|
|
|
2020-03-16 15:33:51 +00:00
|
|
|
|
var cc = ""
|
|
|
|
|
if existsEnv"CC":
|
|
|
|
|
cc = " --cc:" & getEnv"CC"
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
var flags = flags
|
|
|
|
|
when not defined(windows):
|
|
|
|
|
# Not available in MinGW https://github.com/libressl-portable/portable/issues/54
|
|
|
|
|
flags &= " --passC:-fstack-protector-all"
|
2020-08-22 21:00:05 +00:00
|
|
|
|
let command = "nim " & lang & cc & " " & flags &
|
|
|
|
|
" --verbosity:0 --outdir:build/testsuite -r --hints:off --warnings:off " &
|
|
|
|
|
" --nimcache:nimcache/" & path & " " &
|
|
|
|
|
path
|
2020-06-07 17:39:34 +00:00
|
|
|
|
|
|
|
|
|
if not commandFile:
|
2020-06-15 20:58:56 +00:00
|
|
|
|
echo "\n=============================================================================================="
|
2020-12-15 18:18:36 +00:00
|
|
|
|
echo "Running [flags:", flags, "] ", path
|
2020-06-15 20:58:56 +00:00
|
|
|
|
echo "=============================================================================================="
|
2020-06-07 17:39:34 +00:00
|
|
|
|
exec command
|
|
|
|
|
else:
|
|
|
|
|
exec "echo \'" & command & "\' >> " & buildParallel
|
2021-01-23 19:55:40 +00:00
|
|
|
|
exec "echo \"------------------------------------------------------\""
|
2018-07-24 14:52:18 +00:00
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
proc buildBench(benchName: string, compiler = "", useAsm = true, run = false) =
|
2020-04-15 17:46:25 +00:00
|
|
|
|
if not dirExists "build":
|
|
|
|
|
mkDir "build"
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
let runFlag = if run: " -r "
|
|
|
|
|
else: " "
|
|
|
|
|
|
2020-04-15 17:46:25 +00:00
|
|
|
|
var cc = ""
|
|
|
|
|
if compiler != "":
|
2020-08-20 08:21:39 +00:00
|
|
|
|
cc = "--cc:" & compiler
|
|
|
|
|
if not useAsm:
|
|
|
|
|
cc &= " -d:ConstantineASM=false"
|
2020-04-15 17:46:25 +00:00
|
|
|
|
exec "nim c " & cc &
|
2020-08-22 21:00:05 +00:00
|
|
|
|
" -d:danger --verbosity:0 -o:build/bench/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") &
|
|
|
|
|
" --nimcache:nimcache/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") &
|
2021-01-21 20:25:42 +00:00
|
|
|
|
runFlag & "--hints:off --warnings:off benchmarks/" & benchName & ".nim"
|
|
|
|
|
|
|
|
|
|
proc runBench(benchName: string, compiler = "", useAsm = true) =
|
|
|
|
|
buildBench(benchName, compiler, useAsm, run = true)
|
2020-04-15 17:46:25 +00:00
|
|
|
|
|
2020-12-15 18:18:36 +00:00
|
|
|
|
proc runTests(requireGMP: bool, dumpCmdFile = false, test32bit = false, testASM = true) =
|
|
|
|
|
for td in testDesc:
|
|
|
|
|
if not(td.useGMP and not requireGMP):
|
|
|
|
|
var flags = ""
|
|
|
|
|
if not testASM:
|
|
|
|
|
flags &= " -d:ConstantineASM=false"
|
|
|
|
|
if test32bit:
|
|
|
|
|
flags &= " -d:Constantine32"
|
|
|
|
|
if td.path in useDebug:
|
|
|
|
|
flags &= " -d:debugConstantine"
|
|
|
|
|
if td.path notin skipSanitizers:
|
|
|
|
|
flags &= sanitizers
|
|
|
|
|
test flags, td.path, dumpCmdFile
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
proc buildAllBenches() =
|
|
|
|
|
echo "\n\n------------------------------------------------------\n"
|
|
|
|
|
echo "Building benchmarks to ensure they stay relevant ..."
|
|
|
|
|
buildBench("bench_fp")
|
|
|
|
|
buildBench("bench_fp_double_width")
|
|
|
|
|
buildBench("bench_fp2")
|
|
|
|
|
buildBench("bench_fp6")
|
|
|
|
|
buildBench("bench_fp12")
|
|
|
|
|
buildBench("bench_ec_g1")
|
|
|
|
|
buildBench("bench_ec_g2")
|
|
|
|
|
buildBench("bench_pairing_bls12_377")
|
|
|
|
|
buildBench("bench_pairing_bls12_381")
|
|
|
|
|
buildBench("bench_pairing_bn254_nogami")
|
|
|
|
|
buildBench("bench_pairing_bn254_snarks")
|
|
|
|
|
buildBench("bench_sha256")
|
|
|
|
|
echo "All benchmarks compile successfully."
|
2021-01-21 23:09:52 +00:00
|
|
|
|
|
2020-06-15 20:58:56 +00:00
|
|
|
|
# Tasks
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2018-07-24 14:52:18 +00:00
|
|
|
|
task test, "Run all tests":
|
2020-02-23 17:27:26 +00:00
|
|
|
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
2020-12-15 18:18:36 +00:00
|
|
|
|
runTests(requireGMP = true)
|
2020-04-13 17:25:59 +00:00
|
|
|
|
|
2020-10-31 13:51:17 +00:00
|
|
|
|
# if sizeof(int) == 8: # 32-bit tests on 64-bit arch
|
2020-12-15 18:18:36 +00:00
|
|
|
|
# runTests(requireGMP = true, test32bit = true)
|
2020-04-13 17:25:59 +00:00
|
|
|
|
|
2020-04-15 19:28:37 +00:00
|
|
|
|
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
|
|
|
|
|
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
|
2021-01-21 20:25:42 +00:00
|
|
|
|
buildAllBenches()
|
2020-04-15 17:46:25 +00:00
|
|
|
|
|
2020-02-23 17:27:26 +00:00
|
|
|
|
task test_no_gmp, "Run tests that don't require GMP":
|
|
|
|
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
2020-12-15 18:18:36 +00:00
|
|
|
|
runTests(requireGMP = false)
|
2020-03-17 21:04:37 +00:00
|
|
|
|
|
2020-12-15 18:18:36 +00:00
|
|
|
|
# if sizeof(int) == 8: # 32-bit tests on 64-bit arch
|
|
|
|
|
# runTests(requireGMP = true, test32bit = true)
|
2020-06-19 20:08:15 +00:00
|
|
|
|
|
2020-04-15 19:28:37 +00:00
|
|
|
|
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
|
|
|
|
|
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
|
2021-01-21 20:25:42 +00:00
|
|
|
|
buildAllBenches()
|
2020-03-20 22:03:52 +00:00
|
|
|
|
|
2020-06-07 17:39:34 +00:00
|
|
|
|
task test_parallel, "Run all tests in parallel (via GNU parallel)":
|
|
|
|
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
2020-12-15 18:18:36 +00:00
|
|
|
|
clearParallelBuild()
|
|
|
|
|
runTests(requireGMP = true, dumpCmdFile = true)
|
2020-06-07 17:39:34 +00:00
|
|
|
|
exec "parallel --keep-order --group < " & buildParallel
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# if sizeof(int) == 8: # 32-bit tests on 64-bit arch
|
|
|
|
|
# clearParallelBuild()
|
|
|
|
|
# runTests(requireGMP = true, dumpCmdFile = true, test32bit = true)
|
|
|
|
|
# exec "parallel --keep-order --group < " & buildParallel
|
2020-06-07 17:39:34 +00:00
|
|
|
|
|
|
|
|
|
# Now run the benchmarks
|
|
|
|
|
#
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# Benchmarks compile
|
2020-06-07 17:39:34 +00:00
|
|
|
|
# ignore Windows 32-bit for the moment
|
|
|
|
|
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
|
|
|
|
|
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
|
2021-01-21 20:25:42 +00:00
|
|
|
|
buildAllBenches()
|
2020-06-20 17:46:30 +00:00
|
|
|
|
|
2020-07-24 20:02:30 +00:00
|
|
|
|
task test_parallel_no_assembler, "Run all tests (without macro assembler) in parallel (via GNU parallel)":
|
|
|
|
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
2020-12-15 18:18:36 +00:00
|
|
|
|
clearParallelBuild()
|
|
|
|
|
runTests(requireGMP = true, dumpCmdFile = true, testASM = false)
|
2020-07-24 20:02:30 +00:00
|
|
|
|
exec "parallel --keep-order --group < " & buildParallel
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# if sizeof(int) == 8: # 32-bit tests on 64-bit arch
|
|
|
|
|
# clearParallelBuild()
|
|
|
|
|
# runTests(requireGMP = true, dumpCmdFile = true, test32bit = true, testASM = false)
|
|
|
|
|
# exec "parallel --keep-order --group < " & buildParallel
|
2020-07-24 20:02:30 +00:00
|
|
|
|
|
|
|
|
|
# Now run the benchmarks
|
|
|
|
|
#
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# Benchmarks compile
|
2020-07-24 20:02:30 +00:00
|
|
|
|
# ignore Windows 32-bit for the moment
|
|
|
|
|
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
|
|
|
|
|
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
|
2021-01-21 20:25:42 +00:00
|
|
|
|
buildAllBenches()
|
2020-07-24 20:02:30 +00:00
|
|
|
|
|
2020-06-20 17:46:30 +00:00
|
|
|
|
task test_parallel_no_gmp, "Run all tests in parallel (via GNU parallel)":
|
|
|
|
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
2020-12-15 18:18:36 +00:00
|
|
|
|
clearParallelBuild()
|
|
|
|
|
runTests(requireGMP = false, dumpCmdFile = true)
|
2020-06-20 17:46:30 +00:00
|
|
|
|
exec "parallel --keep-order --group < " & buildParallel
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# if sizeof(int) == 8: # 32-bit tests on 64-bit arch
|
|
|
|
|
# clearParallelBuild()
|
|
|
|
|
# runTests(requireGMP = false, dumpCmdFile = true, test32bit = true)
|
|
|
|
|
# exec "parallel --keep-order --group < " & buildParallel
|
2020-09-21 21:24:00 +00:00
|
|
|
|
|
|
|
|
|
# Now run the benchmarks
|
|
|
|
|
#
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# Benchmarks compile
|
2020-09-21 21:24:00 +00:00
|
|
|
|
# ignore Windows 32-bit for the moment
|
|
|
|
|
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
|
|
|
|
|
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
|
2021-01-21 20:25:42 +00:00
|
|
|
|
buildAllBenches()
|
2020-09-21 21:24:00 +00:00
|
|
|
|
|
|
|
|
|
task test_parallel_no_gmp_no_assembler, "Run all tests in parallel (via GNU parallel)":
|
|
|
|
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
2020-12-15 18:18:36 +00:00
|
|
|
|
clearParallelBuild()
|
|
|
|
|
runTests(requireGMP = false, dumpCmdFile = true, testASM = false)
|
2020-09-21 21:24:00 +00:00
|
|
|
|
exec "parallel --keep-order --group < " & buildParallel
|
|
|
|
|
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# if sizeof(int) == 8: # 32-bit tests on 64-bit arch
|
|
|
|
|
# clearParallelBuild()
|
|
|
|
|
# runTests(requireGMP = false, dumpCmdFile = true, test32bit = true, testASM = false)
|
|
|
|
|
# exec "parallel --keep-order --group < " & buildParallel
|
2020-06-20 17:46:30 +00:00
|
|
|
|
|
|
|
|
|
# Now run the benchmarks
|
|
|
|
|
#
|
2021-01-21 20:25:42 +00:00
|
|
|
|
# Benchmarks compile
|
2020-06-20 17:46:30 +00:00
|
|
|
|
# ignore Windows 32-bit for the moment
|
|
|
|
|
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
|
|
|
|
|
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
|
2021-01-21 20:25:42 +00:00
|
|
|
|
buildAllBenches()
|
2020-06-07 17:39:34 +00:00
|
|
|
|
|
2020-03-21 01:31:31 +00:00
|
|
|
|
task bench_fp, "Run benchmark 𝔽p with your default compiler":
|
|
|
|
|
runBench("bench_fp")
|
|
|
|
|
|
|
|
|
|
task bench_fp_gcc, "Run benchmark 𝔽p with gcc":
|
|
|
|
|
runBench("bench_fp", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_fp_clang, "Run benchmark 𝔽p with clang":
|
|
|
|
|
runBench("bench_fp", "clang")
|
|
|
|
|
|
2020-08-20 08:21:39 +00:00
|
|
|
|
task bench_fp_gcc_noasm, "Run benchmark 𝔽p with gcc - no Assembly":
|
|
|
|
|
runBench("bench_fp", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_fp_clang_noasm, "Run benchmark 𝔽p with clang - no Assembly":
|
|
|
|
|
runBench("bench_fp", "clang", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_fpdbl, "Run benchmark 𝔽pDbl with your default compiler":
|
|
|
|
|
runBench("bench_fp_double_width")
|
|
|
|
|
|
|
|
|
|
task bench_fpdbl_gcc, "Run benchmark 𝔽p with gcc":
|
|
|
|
|
runBench("bench_fp_double_width", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_fpdbl_clang, "Run benchmark 𝔽p with clang":
|
|
|
|
|
runBench("bench_fp_double_width", "clang")
|
|
|
|
|
|
|
|
|
|
task bench_fpdbl_gcc_noasm, "Run benchmark 𝔽p with gcc - no Assembly":
|
|
|
|
|
runBench("bench_fp_double_width", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_fpdbl_clang_noasm, "Run benchmark 𝔽p with clang - no Assembly":
|
|
|
|
|
runBench("bench_fp_double_width", "clang", useAsm = false)
|
|
|
|
|
|
2020-03-21 01:31:31 +00:00
|
|
|
|
task bench_fp2, "Run benchmark with 𝔽p2 your default compiler":
|
|
|
|
|
runBench("bench_fp2")
|
|
|
|
|
|
|
|
|
|
task bench_fp2_gcc, "Run benchmark 𝔽p2 with gcc":
|
|
|
|
|
runBench("bench_fp2", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_fp2_clang, "Run benchmark 𝔽p2 with clang":
|
|
|
|
|
runBench("bench_fp2", "clang")
|
|
|
|
|
|
2020-08-20 08:21:39 +00:00
|
|
|
|
task bench_fp2_gcc_noasm, "Run benchmark 𝔽p2 with gcc - no Assembly":
|
|
|
|
|
runBench("bench_fp2", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_fp2_clang_noasm, "Run benchmark 𝔽p2 with clang - no Assembly":
|
|
|
|
|
runBench("bench_fp2", "clang", useAsm = false)
|
|
|
|
|
|
2020-10-01 22:01:09 +00:00
|
|
|
|
task bench_fp4, "Run benchmark with 𝔽p4 your default compiler":
|
|
|
|
|
runBench("bench_fp4")
|
|
|
|
|
|
|
|
|
|
task bench_fp4_gcc, "Run benchmark 𝔽p4 with gcc":
|
|
|
|
|
runBench("bench_fp4", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_fp4_clang, "Run benchmark 𝔽p4 with clang":
|
|
|
|
|
runBench("bench_fp4", "clang")
|
|
|
|
|
|
|
|
|
|
task bench_fp4_gcc_noasm, "Run benchmark 𝔽p4 with gcc - no Assembly":
|
|
|
|
|
runBench("bench_fp4", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_fp4_clang_noasm, "Run benchmark 𝔽p4 with clang - no Assembly":
|
|
|
|
|
runBench("bench_fp4", "clang", useAsm = false)
|
|
|
|
|
|
2020-03-21 01:31:31 +00:00
|
|
|
|
task bench_fp6, "Run benchmark with 𝔽p6 your default compiler":
|
|
|
|
|
runBench("bench_fp6")
|
|
|
|
|
|
|
|
|
|
task bench_fp6_gcc, "Run benchmark 𝔽p6 with gcc":
|
|
|
|
|
runBench("bench_fp6", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_fp6_clang, "Run benchmark 𝔽p6 with clang":
|
|
|
|
|
runBench("bench_fp6", "clang")
|
2020-04-09 12:28:01 +00:00
|
|
|
|
|
2020-08-20 08:21:39 +00:00
|
|
|
|
task bench_fp6_gcc_noasm, "Run benchmark 𝔽p6 with gcc - no Assembly":
|
|
|
|
|
runBench("bench_fp6", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_fp6_clang_noasm, "Run benchmark 𝔽p6 with clang - no Assembly":
|
|
|
|
|
runBench("bench_fp6", "clang", useAsm = false)
|
|
|
|
|
|
2020-04-09 12:28:01 +00:00
|
|
|
|
task bench_fp12, "Run benchmark with 𝔽p12 your default compiler":
|
|
|
|
|
runBench("bench_fp12")
|
|
|
|
|
|
|
|
|
|
task bench_fp12_gcc, "Run benchmark 𝔽p12 with gcc":
|
|
|
|
|
runBench("bench_fp12", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_fp12_clang, "Run benchmark 𝔽p12 with clang":
|
|
|
|
|
runBench("bench_fp12", "clang")
|
2020-04-15 17:43:31 +00:00
|
|
|
|
|
2020-08-20 08:21:39 +00:00
|
|
|
|
task bench_fp12_gcc_noasm, "Run benchmark 𝔽p12 with gcc - no Assembly":
|
|
|
|
|
runBench("bench_fp12", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_fp12_clang_noasm, "Run benchmark 𝔽p12 with clang - no Assembly":
|
|
|
|
|
runBench("bench_fp12", "clang", useAsm = false)
|
|
|
|
|
|
2020-09-24 15:18:23 +00:00
|
|
|
|
task bench_ec_g1, "Run benchmark on Elliptic Curve group 𝔾1 - Short Weierstrass with Projective Coordinates - Default compiler":
|
2020-06-14 13:39:06 +00:00
|
|
|
|
runBench("bench_ec_g1")
|
2020-04-15 17:43:31 +00:00
|
|
|
|
|
2020-06-15 20:58:56 +00:00
|
|
|
|
task bench_ec_g1_gcc, "Run benchmark on Elliptic Curve group 𝔾1 - Short Weierstrass with Projective Coordinates - GCC":
|
2020-06-14 13:39:06 +00:00
|
|
|
|
runBench("bench_ec_g1", "gcc")
|
2020-04-15 17:43:31 +00:00
|
|
|
|
|
2020-06-14 13:39:06 +00:00
|
|
|
|
task bench_ec_g1_clang, "Run benchmark on Elliptic Curve group 𝔾1 - Short Weierstrass with Projective Coordinates - Clang":
|
|
|
|
|
runBench("bench_ec_g1", "clang")
|
2020-06-15 20:58:56 +00:00
|
|
|
|
|
2020-08-20 08:21:39 +00:00
|
|
|
|
task bench_ec_g1_gcc_noasm, "Run benchmark on Elliptic Curve group 𝔾1 - Short Weierstrass with Projective Coordinates - GCC no Assembly":
|
|
|
|
|
runBench("bench_ec_g1", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_ec_g1_clang_noasm, "Run benchmark on Elliptic Curve group 𝔾1 - Short Weierstrass with Projective Coordinates - Clang no Assembly":
|
|
|
|
|
runBench("bench_ec_g1", "clang", useAsm = false)
|
|
|
|
|
|
2020-09-24 15:18:23 +00:00
|
|
|
|
task bench_ec_g2, "Run benchmark on Elliptic Curve group 𝔾2 - Short Weierstrass with Projective Coordinates - Default compiler":
|
2020-06-15 20:58:56 +00:00
|
|
|
|
runBench("bench_ec_g2")
|
|
|
|
|
|
|
|
|
|
task bench_ec_g2_gcc, "Run benchmark on Elliptic Curve group 𝔾2 - Short Weierstrass with Projective Coordinates - GCC":
|
|
|
|
|
runBench("bench_ec_g2", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_ec_g2_clang, "Run benchmark on Elliptic Curve group 𝔾2 - Short Weierstrass with Projective Coordinates - Clang":
|
|
|
|
|
runBench("bench_ec_g2", "clang")
|
2020-08-20 08:21:39 +00:00
|
|
|
|
|
|
|
|
|
task bench_ec_g2_gcc_noasm, "Run benchmark on Elliptic Curve group 𝔾2 - Short Weierstrass with Projective Coordinates - GCC no Assembly":
|
|
|
|
|
runBench("bench_ec_g2", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_ec_g2_clang_noasm, "Run benchmark on Elliptic Curve group 𝔾2 - Short Weierstrass with Projective Coordinates - Clang no Assembly":
|
|
|
|
|
runBench("bench_ec_g2", "clang", useAsm = false)
|
2020-09-24 15:18:23 +00:00
|
|
|
|
|
2020-09-27 07:15:14 +00:00
|
|
|
|
task bench_pairing_bls12_377, "Run pairings benchmarks for BLS12-377 - Default compiler":
|
|
|
|
|
runBench("bench_pairing_bls12_377")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bls12_377_gcc, "Run pairings benchmarks for BLS12-377 - GCC":
|
|
|
|
|
runBench("bench_pairing_bls12_377", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bls12_377_clang, "Run pairings benchmarks for BLS12-377 - Clang":
|
|
|
|
|
runBench("bench_pairing_bls12_377", "clang")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bls12_377_gcc_noasm, "Run pairings benchmarks for BLS12-377 - GCC no Assembly":
|
|
|
|
|
runBench("bench_pairing_bls12_377", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bls12_377_clang_noasm, "Run pairings benchmarks for BLS12-377 - Clang no Assembly":
|
|
|
|
|
runBench("bench_pairing_bls12_377", "clang", useAsm = false)
|
|
|
|
|
|
2020-09-24 15:18:23 +00:00
|
|
|
|
task bench_pairing_bls12_381, "Run pairings benchmarks for BLS12-381 - Default compiler":
|
|
|
|
|
runBench("bench_pairing_bls12_381")
|
|
|
|
|
|
2020-09-25 19:58:20 +00:00
|
|
|
|
task bench_pairing_bls12_381_gcc, "Run pairings benchmarks for BLS12-381 - GCC":
|
2020-09-24 15:18:23 +00:00
|
|
|
|
runBench("bench_pairing_bls12_381", "gcc")
|
|
|
|
|
|
2020-09-25 19:58:20 +00:00
|
|
|
|
task bench_pairing_bls12_381_clang, "Run pairings benchmarks for BLS12-381 - Clang":
|
2020-09-24 15:18:23 +00:00
|
|
|
|
runBench("bench_pairing_bls12_381", "clang")
|
|
|
|
|
|
2020-09-25 19:58:20 +00:00
|
|
|
|
task bench_pairing_bls12_381_gcc_noasm, "Run pairings benchmarks for BLS12-381 - GCC no Assembly":
|
2020-09-24 15:18:23 +00:00
|
|
|
|
runBench("bench_pairing_bls12_381", "gcc", useAsm = false)
|
|
|
|
|
|
2020-09-25 19:58:20 +00:00
|
|
|
|
task bench_pairing_bls12_381_clang_noasm, "Run pairings benchmarks for BLS12-381 - Clang no Assembly":
|
2020-09-24 15:18:23 +00:00
|
|
|
|
runBench("bench_pairing_bls12_381", "clang", useAsm = false)
|
2020-09-25 19:58:20 +00:00
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_nogami, "Run pairings benchmarks for BN254-Nogami - Default compiler":
|
|
|
|
|
runBench("bench_pairing_bn254_nogami")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_nogami_gcc, "Run pairings benchmarks for BN254-Nogami - GCC":
|
|
|
|
|
runBench("bench_pairing_bn254_nogami", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_nogami_clang, "Run pairings benchmarks for BN254-Nogami - Clang":
|
|
|
|
|
runBench("bench_pairing_bn254_nogami", "clang")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_nogami_gcc_noasm, "Run pairings benchmarks for BN254-Nogami - GCC no Assembly":
|
|
|
|
|
runBench("bench_pairing_bn254_nogami", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_nogami_clang_noasm, "Run pairings benchmarks for BN254-Nogami - Clang no Assembly":
|
|
|
|
|
runBench("bench_pairing_bn254_nogami", "clang", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_snarks, "Run pairings benchmarks for BN254-Snarks - Default compiler":
|
|
|
|
|
runBench("bench_pairing_bn254_snarks")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_snarks_gcc, "Run pairings benchmarks for BN254-Snarks - GCC":
|
|
|
|
|
runBench("bench_pairing_bn254_snarks", "gcc")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_snarks_clang, "Run pairings benchmarks for BN254-Snarks - Clang":
|
|
|
|
|
runBench("bench_pairing_bn254_snarks", "clang")
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_snarks_gcc_noasm, "Run pairings benchmarks for BN254-Snarks - GCC no Assembly":
|
|
|
|
|
runBench("bench_pairing_bn254_snarks", "gcc", useAsm = false)
|
|
|
|
|
|
|
|
|
|
task bench_pairing_bn254_snarks_clang_noasm, "Run pairings benchmarks for BN254-Snarks - Clang no Assembly":
|
|
|
|
|
runBench("bench_pairing_bn254_snarks", "clang", useAsm = false)
|
2020-12-15 18:18:36 +00:00
|
|
|
|
|
|
|
|
|
task bench_sha256, "Run SHA256 benchmarks":
|
|
|
|
|
runBench("bench_sha256")
|