From 374e6b645be863562cad91ac11c61d69991c0681 Mon Sep 17 00:00:00 2001 From: markspanbroek Date: Mon, 20 Nov 2023 09:51:36 +0100 Subject: [PATCH] Add poseidon2 dependency (#625) * [build] add nim-poseidon2 * [build] Workaround incompatibility constantine and secp256k1 Constantine sets compiler flag that is incompatible with the assembly code in secp256k1: https://github.com/mratsim/constantine/blob/5f7ba18f2ed351260015397c9eae079a6decaee1/constantine/platforms/isa/macro_assembler_x86.nim#L19 --------- Co-authored-by: Dmitriy Ryajov --- .gitmodules | 6 ++++++ codex.nimble | 1 + config.nims | 3 +++ vendor/constantine | 1 + vendor/nim-poseidon2 | 1 + 5 files changed, 12 insertions(+) create mode 160000 vendor/constantine create mode 160000 vendor/nim-poseidon2 diff --git a/.gitmodules b/.gitmodules index 8cc85d0e..c155a04c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -193,3 +193,9 @@ [submodule "vendor/npeg"] path = vendor/npeg url = https://github.com/zevv/npeg +[submodule "vendor/nim-poseidon2"] + path = vendor/nim-poseidon2 + url = https://github.com/codex-storage/nim-poseidon2.git +[submodule "vendor/constantine"] + path = vendor/constantine + url = https://github.com/mratsim/constantine.git diff --git a/codex.nimble b/codex.nimble index e1200d71..df89e043 100644 --- a/codex.nimble +++ b/codex.nimble @@ -30,5 +30,6 @@ requires "leopard >= 0.1.0 & < 0.2.0" requires "blscurve" requires "libp2pdht" requires "eth" +requires "https://github.com/codex-storage/nim-poseidon2.git >= 0.1.0 & < 0.2.0" include "build.nims" diff --git a/config.nims b/config.nims index 3c02c598..031cdaa7 100644 --- a/config.nims +++ b/config.nims @@ -113,6 +113,9 @@ switch("define", "libp2p_pki_schemes=secp256k1") # we can't use it. And codex.cfg doesn't work switch("define", "chronicles_sinks=textlines[dynamic],json[dynamic],textlines[dynamic]") +# Workaround for assembler incompatibility between constantine and secp256k1 +switch("define", "use_asm_syntax_intel=false") + # begin Nimble config (version 1) when system.fileExists("nimble.paths"): include "nimble.paths" diff --git a/vendor/constantine b/vendor/constantine new file mode 160000 index 00000000..5f7ba18f --- /dev/null +++ b/vendor/constantine @@ -0,0 +1 @@ +Subproject commit 5f7ba18f2ed351260015397c9eae079a6decaee1 diff --git a/vendor/nim-poseidon2 b/vendor/nim-poseidon2 new file mode 160000 index 00000000..af673749 --- /dev/null +++ b/vendor/nim-poseidon2 @@ -0,0 +1 @@ +Subproject commit af6737492971dd05b2a6b03404e490f865266f15