Skip to content

Commit 2308fe4

Browse files
committed
extracts toF out of users of manifest code
1 parent cb6bb59 commit 2308fe4

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

codex/manifest/types.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import pkg/poseidon2
1616

1717
import ../units
1818
export units
19+
export curves # workaround for "undeclared identifier: 'getCurveOrder'" from constantine
1920

2021
const
2122
BlockCodec* = multiCodec("raw")
@@ -34,9 +35,8 @@ const
3435
proc `==`*(a, b: VerificationHash): bool =
3536
a.toHex() == b.toHex()
3637

37-
# not working, undeclared identifier 'getCurveOrder'
38-
# proc fromInt*(T: type VerificationHash, value: SomeInteger | SomeUnsignedInt): VerificationHash =
39-
# toF(value)
38+
proc fromInt*(T: type VerificationHash, value: SomeInteger | SomeUnsignedInt): VerificationHash =
39+
toF(value)
4040

4141
proc encode*(a: VerificationHash): string =
4242
a.toHex()

tests/codex/testmanifest.nim

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import std/sequtils
33
import pkg/chronos
44
import pkg/questionable/results
55
import pkg/asynctest
6-
import pkg/stew/byteutils
7-
import pkg/poseidon2
86
import pkg/codex/chunker
97
import pkg/codex/blocktype as bt
108
import pkg/codex/manifest
@@ -61,10 +59,8 @@ checksuite "Manifest":
6159

6260
var manifest = Manifest.new(
6361
manifest = protectedManifest,
64-
# datasetRoot = VerificationHash.fromInt(12),
65-
# slotRoots = @[VerificationHash.fromInt(23), VerificationHash.fromInt(34)]
66-
datasetRoot = toF(12),
67-
slotRoots = @[toF(23), toF(34)]
62+
datasetRoot = VerificationHash.fromInt(12),
63+
slotRoots = @[VerificationHash.fromInt(23), VerificationHash.fromInt(34)]
6864
).tryGet()
6965

7066
let

0 commit comments

Comments
 (0)