diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 288ceea..d771f6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - nim: [1.6.14] + nim: [stable, 1.6.20] steps: - uses: actions/checkout@v2 - - uses: iffy/install-nim@v3 + - uses: iffy/install-nim@v5 with: version: ${{ matrix.nim }} - name: Build diff --git a/poseidon2.nim b/poseidon2.nim index 694f12b..6fd7229 100644 --- a/poseidon2.nim +++ b/poseidon2.nim @@ -15,6 +15,6 @@ export toF export elements export types -# workaround for "undeclared identifier: 'getCurveOrder'" -import constantine/math/config/curves -export curves +# workaround for "undeclared identifier: 'getModulus'" +import constantine/named/algebras +export algebras diff --git a/poseidon2.nimble b/poseidon2.nimble index 131eac7..4e3f4b8 100644 --- a/poseidon2.nimble +++ b/poseidon2.nimble @@ -3,4 +3,4 @@ author = "nim-poseidon2 authors" description = "Poseidon2 hash function" license = "MIT" -requires "https://github.com/mratsim/constantine#ab6fa6ae1bbbd1b10071a92ec209b381b5d82511" +requires "https://github.com/mratsim/constantine == 0.1.0" diff --git a/poseidon2/io.nim b/poseidon2/io.nim index 68d7157..4ca3f30 100644 --- a/poseidon2/io.nim +++ b/poseidon2/io.nim @@ -2,10 +2,10 @@ import std/options import constantine/math/arithmetic import constantine/math/io/io_bigints import constantine/math/io/io_fields -import constantine/math/config/curves +import constantine/named/algebras import ./types -export curves +export algebras func fromOpenArray(_: type F, bytes: openArray[byte]): F = F.fromBig(B.unmarshal(bytes, littleEndian)) @@ -19,7 +19,7 @@ func fromBytes*(_: type F, bytes: array[32, byte]): Option[F] = ## Converts bytes into a field element. The byte array is interpreted as a ## canonical little-endian big integer. let big = B.unmarshal(bytes, littleEndian) - if bool(big < F.fieldMod()): + if bool(big < F.getModulus()): return some(F.fromBig(big)) func toBytes*(element: F): array[32, byte] = diff --git a/poseidon2/roundfun.nim b/poseidon2/roundfun.nim index 7e9d5a0..dc087aa 100644 --- a/poseidon2/roundfun.nim +++ b/poseidon2/roundfun.nim @@ -1,6 +1,6 @@ import constantine/math/arithmetic, - constantine/math/config/curves + constantine/named/algebras import ./types import ./roundconst diff --git a/poseidon2/types.nim b/poseidon2/types.nim index 2c9fa52..4920ec9 100644 --- a/poseidon2/types.nim +++ b/poseidon2/types.nim @@ -3,7 +3,7 @@ import constantine/math/arithmetic, constantine/math/io/io_fields, constantine/math/io/io_bigints, - constantine/math/config/curves + constantine/named/algebras #------------------------------------------------------------------------------- diff --git a/tests/poseidon2/testSponge.nim b/tests/poseidon2/testSponge.nim index edd931a..44f0558 100644 --- a/tests/poseidon2/testSponge.nim +++ b/tests/poseidon2/testSponge.nim @@ -2,7 +2,6 @@ import std/unittest import std/sequtils import constantine/math/io/io_fields -import constantine/math/arithmetic import poseidon2/types import poseidon2/io