Commit Graph

21 Commits

Author SHA1 Message Date
Mamy Ratsimbazafy 3e27f1e831
Rust bindings (#287)
* first jab at Rust bindings

* stash C library and header generation

* Create a single big library with multiple headers

* remove ctt_pure, people will not call crypto proc twice with unchanged parameter and extra noise when reading header

* fix MacOS and Windows builds

* fix cross-lang ThinLTO, require LLD

* Remove NimMain need, cleanup CPU features and detect them on library load
2023-10-24 10:56:28 +02:00
Mamy Ratsimbazafy c3b76cd420
32-bit fixes (#288)
* fix the new div2n1n_vartime on 32-bit - regression from #286

* remove unnecessary defensive programming

* reactivate 32-bit CI to check on #244

* 32-bit: centralize OS, ISA and env variable config

* enable assemble on x86 32-bit
2023-10-22 03:54:09 +02:00
Mamy Ratsimbazafy 153b37b77f
Ethereum KZG / EIP-4844 / Proto-danksharding followup (#270)
* Pass all verify_kzg_proof test cases

* pass blob_to_commitment tests

* move tests

* KZG: WIP on compute_proof

* eip4844: Pass all compute_kzg_proof tests

* pass compute_blob_kzg_proof tests

* pass all verify_blob_kzg_proof tests

* CI needs yaml

* fix memory leaks and add effect tags

* CI: lock yaml version too pre Nim 2.0
2023-09-15 08:21:04 +02:00
Mamy Ratsimbazafy 0eba593951
Pasta / Halo2 MSM bench (#243)
* Pasta bench

* cleanup env variables

* [MSM]: generate benchmark coef-points pairs in parallel

* try to fix windows Ci

* add diagnostic info

* fix old test for new codecs/io primitives

* Ensure the projective point at infinity is not all zeros, but (0, 1, 0)
2023-06-04 17:41:54 +02:00
Mamy Ratsimbazafy 1325d249ce
deactivate 32-bit CI, package management woes, see #244 2023-06-02 09:01:00 +02:00
Mamy Ratsimbazafy d996ccd5d8
Path reorgs (#240)
* move tests

* move threadpool to root path

* fix hints and warnings, print nim versions for tests for debugging the new strange issue in CI

* print nim version

* mixup on branches

* mixup on branches reloaded
2023-05-29 20:14:30 +02:00
Mamy Ratsimbazafy c6d9a213f2
Rework assembly to be compatible with LTO (#231)
* rework assembler register/mem and constraint declarations

* Introduce constraint UnmutatedPointerToWriteMem

* Create invidual memory cell operands

* [Assembly] fully support indirect memory addressing

* fix calling convention for exported procs

* Prepare for switch to intel syntax to avoid clang constant propagation asm symbol name interfering OR pointer+offset addressing

* use modifiers to prevent bad string mixin fo assembler to linker of propagated consts

* Assembly: switch to intel syntax

* with working memory operand - now works with LTO on both GCC and clang and constant folding

* use memory operand in more places

* remove some inline now that we have lto

* cleanup compiler config and benches

* tracer shouldn't force dependencies when unused

* fix cc on linux

* nimble fixes

* update README [skip CI]

* update MacOS CI with Homebrew Clang

* oops nimble bindings disappeared

* more nimble fixes

* fix sha256 exported symbol

* improve constraints on modular addition

* Add extra constraint to force reloading of pointer in reg inputs

* Fix LLVM gold linker running out of registers

* workaround MinGW64 GCC 12.2 bad codegen in t_pairing_cyclotomic_subgroup with LTO
2023-04-26 06:58:31 +02:00
Mamy Ratsimbazafy 4be89d309f
chore: remove stew/byteutils dependencies and unneeded imports 2023-01-12 20:25:57 +01:00
Mamy Ratsimbazafy b901dd5878
CI: pure C can link to GMP, but Nim cannot LoadLib GMP, not found 2022-09-19 02:02:04 +02:00
Mamy Ratsimbazafy df048112c3
Example+Test C API vs GMP (#203)
* Example+Test C API vs GMP

* Create build directory for bindings test

* --nimMainPrefix is 1.6 only

* Add libdl for  dynamic loading

* absolute paths

* add static link test

* Fix man main, rename Nimmain to init_NimMain

* Deal with MacOS annoying linker w.r.t. static libraries

* use .exe extension to satisfy windows (?)

* annoying GCC which doesn't create paths

* Try skipping DLL test on windows

* windows extensions ...

* no lib prefix on windows
2022-09-15 17:11:57 +02:00
Mamy Ratsimbazafy 962e7ccf49
CI: enable GMP tests on Windows and Linux 32-bit and fix caching (#204)
* Try to compile with GMP on windows and 32-bit linux

* remove leftover msys shell

* Don't use GMP Mersenne Twister, bad randomness and untested Nim wrapper

* properly cache nim

* fix path after cache

* run pacman in msys2 env

* rework msys2 ... again

* shell compat for file clearing

* shell compat try-again for file clearing

* force bash for clearing parallel builds on windows

* Use nimscript directly (why didn't it work last time?)

* Avoid IO redirection to support any shell

* Avoid IO redirection v2 to support any shell

* add debug data

* add debug again

* Introduce pararun, a parallel test runner to remove need of GNU parallel

* pararun: style
2022-09-15 09:33:34 +02:00
Mamy Ratsimbazafy 81acfb1626
Nim 1.6 in CI (#170)
* try 1.6 CI

* Try CI with 1.6 and windows.

* Bend the knee

* have fun debugging CI

* have fun debugging CI

* more CI spam

* branch -> nim_version

* fight or flight

* properly detect windows

* Fix galore

* 🐍 🐍 snake:

* meh give up on parallelizing windows and dealing with windows PATH issues

* ¯\_ (ツ)_/¯
2022-02-20 23:44:00 +01:00
Mamy André-Ratsimbazafy 5404437d18
CI: don't cancel master 2021-07-25 13:21:38 +02:00
Mamy Ratsimbazafy 6a2b172bbc
CI revamp (#157)
* Azure try to fix certificates on windows

* Split ASM / no asm

* switch to stable in travis

* Split ASM tests in all CI

* workflow name

* typo

* PPC fails at download or when compiling Nim for unknown reason

* try to fix curl
2021-02-10 22:21:02 +01:00
Mamy Ratsimbazafy 491b4d4d21
Drop nim-json-serialization for testing (#156) 2021-02-09 22:10:16 +01:00
Mamy Ratsimbazafy ac6300555a
Fix test suite (#116)
* Pin nim-serialization. Workaround #113 and https://github.com/status-im/nim-serialization/issues/33

* Need to workaround nimble installing dependency multiple times

* non-interactive

* UB sanitizer missing on mingw

* Fix OpenSSL benchmark on non-Linux platforms

* Accelerate CI:
- Skip 32-bit on 64-bit tests
- Only test leaf functionality.

* Don't define -fstack-protector-all with MinGW

* skip line functions and cyclotomic tests (already tested in pairing) + only compile the benches don't run them.
2021-01-21 21:25:42 +01:00
Mamy André-Ratsimbazafy f0b18ecfe0
Github Actions add-path is gone https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ 2020-12-13 15:28:51 +01:00
Mamy Ratsimbazafy a2f46f77b7
Sage constants & tests codegen (#101)
* Implement a Sage codegenerator for frobenius constants

* Sage codegen for pairings

* Autogen of endomorphism acceleration constants

* The autogen fixed a copy-paste bug in lattice decomposition. We can use conditional negation now and save an add+dbl in scalar mul

* small fixes

* sage code for square root bls12-377 is not old

* readme updates

* Provide test suggestions for derive_frobenius

* indentation + add equation form to sage

* Sage test vector generator

* Use the json vectors
- includes type system workaround: generic sandwich https://github.com/nim-lang/Nim/issues/11225
- converting NimNode to typedesc: https://github.com/nim-lang/Nim/issues/6785

* Delete old sage code

* Install nim-serialization and nim-json-serialization in CI

* CI nimble install force yes
2020-10-10 16:19:23 +02:00
Mamy Ratsimbazafy d84edcd217
Naive pairings + Naive cofactor clearing (#82)
* Pairing - initial commit
- line functions
- sparse Fp12 functions

* Small fixes:
- Line parametrized by twist for generic algorithm
- Add a conjugate operator for quadratic extensions
- Have frobenius use it
- Create an Affine coordinate type for elliptic curve

* Implement (failing) pairing test

* Stash pairing debug session, temp switch Fp12 over Fp4

* Proper naive pairing on BLS12-381

* Frobenius map

* Implement naive pairing for BN curves

* Add pairing tests to CI + reduce time spent on lower-level tests

* Test without assembler in Github Actions + less base layers test iterations
2020-09-21 23:24:00 +02:00
Mamy Ratsimbazafy 0400187f05
Use GMP and GNU parallel in GIthub Actions (#63)
* Use GMP and GNU parallel in GIthub Actions

* try gmp:i386

* Don't do GMP tests on i386
2020-06-20 19:46:30 +02:00
Mamy Ratsimbazafy a2a2495351
Github Action CI (without GMP) (#29)
* Github Action CI (without GMP)

* Deactivate MacOS, spurious failures: https://github.com/actions/virtual-environments/issues/841

* force install with nimble

* Add badge

* Don"t include Nim 1.2.x https://github.com/mratsim/constantine/pull/20#issuecomment-646327952

* Action branch mistake

* Add back OSX? https://github.com/actions/virtual-environments/issues/841, https://github.com/actions/virtual-environments/issues/969

* fix MacOS target

* comment out RDTSC on i386

* Add initialization canaries

* Add more verbose output to debug windows failures

* spurious windows i386 test

* For now only activate Linux and mac

* missed include
2020-06-19 22:08:15 +02:00