Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add trusted setup constant #36

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kzg4844/kzg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import
./kzg_abi # compile sha256.c

export
kzg
kzg, kzg_abi.trustedSetup
20 changes: 10 additions & 10 deletions kzg4844/kzg_abi.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

# Ensure "c_kzg_4844.h" in this directory takes precedence
import std/[os, strutils]
{.passc: "-I" & quoteShell(currentSourcePath.rsplit({DirSep, AltSep}, 1)[0]).}

import
./csources/bindings/nim/kzg_abi
const
currentDir = currentSourcePath.rsplit({DirSep, AltSep}, 1)[0]
trustedSetup* =
staticRead(currentDir & "/csources/src/trusted_setup.txt")

export
kzg_abi
{.passc: "-I" & quoteShell(currentDir).}

import ./csources/bindings/nim/kzg_abi

export kzg_abi

when defined(kzgExternalBlstNoSha256):
import std/strutils
from os import DirSep
const
kzgPath = currentSourcePath.rsplit(DirSep, 1)[0] & "/"
{.compile: kzgPath & "sha256.c"}
{.compile: currentDir & "/sha256.c".}
5 changes: 5 additions & 0 deletions tests/test_all.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
{.warning[UnusedImport]:off.}

import
unittest2,
../kzg4844/kzg,
../kzg4844/kzg_abi

# do nothing else, all tests are done in c-kzg-4844.
# we only need to make sure our imports are compileable

test "Check that trusted setup can be loaded":
check:
loadTrustedSetupFromString(trustedSetup, 0) == Result[void, string].ok()
Loading