nim-codex/tests/codex/slots/testconverters.nim
Adam Uhlíř e5df8c50d3
style: nph formatting (#1067)
* style: nph setup

* chore: formates codex/ and tests/ folder with nph 0.6.1
2025-01-21 20:54:46 +00:00

47 lines
1.0 KiB
Nim

import pkg/chronos
import pkg/poseidon2
import pkg/poseidon2/io
import pkg/constantine/math/io/io_fields
import pkg/questionable/results
import pkg/codex/merkletree
import pkg/codex/slots/converters
import ../../asynctest
import ../examples
import ../merkletree/helpers
let hash: Poseidon2Hash = toF(12345)
suite "Converters":
test "CellBlock cid":
let
cid = toCellCid(hash).tryGet()
value = fromCellCid(cid).tryGet()
check:
hash.toDecimal() == value.toDecimal()
test "Slot cid":
let
cid = toSlotCid(hash).tryGet()
value = fromSlotCid(cid).tryGet()
check:
hash.toDecimal() == value.toDecimal()
test "Verify cid":
let
cid = toVerifyCid(hash).tryGet()
value = fromVerifyCid(cid).tryGet()
check:
hash.toDecimal() == value.toDecimal()
test "Proof":
let
codexProof = toEncodableProof(Poseidon2Proof.example).tryGet()
poseidonProof = toVerifiableProof(codexProof).tryGet()
check:
Poseidon2Proof.example == poseidonProof