fixes compilation

This commit is contained in:
Ben 2024-10-29 09:05:24 +01:00
parent 599a5220b3
commit c5607206de
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
4 changed files with 9 additions and 9 deletions

View File

@ -33,7 +33,6 @@ func spongeDigest*(
success Sponge.digest(bytes, rate)
# TODO: replace with poseidon2 library call plz
proc digestTree*(
_: type Poseidon2Tree,
bytes: seq[byte],

View File

@ -4,6 +4,7 @@ import std/random
import pkg/constantine/math/arithmetic
import pkg/chronos
import pkg/poseidon2
import pkg/poseidon2/io
import pkg/poseidon2/sponge
@ -30,9 +31,9 @@ suite "Digest - MerkleTree":
leaves.add(digest)
let
digest = Poseidon2Tree.digest(bytes, chunkSize = 2*KB).tryGet
digest = (waitFor Poseidon2Tree.digest(bytes, chunkSize = 2*KB)).tryGet
spongeDigest = SpongeMerkle.digest(bytes, chunkSize = 2*KB)
codexPosTree = Poseidon2Tree.init(leaves).tryGet
codexPosTree = (waitFor Poseidon2Tree.init(leaves)).tryGet
rootDigest = codexPosTree.root.tryGet
check:
@ -53,9 +54,9 @@ suite "Digest - MerkleTree":
leaves.add(Sponge.digest(partialChunk, rate = 2))
let
digest = Poseidon2Tree.digest(bytes, chunkSize = 2*KB).tryGet
digest = (waitFor Poseidon2Tree.digest(bytes, chunkSize = 2*KB)).tryGet
spongeDigest = SpongeMerkle.digest(bytes, chunkSize = 2*KB)
codexPosTree = Poseidon2Tree.init(leaves).tryGet
codexPosTree = (waitFor Poseidon2Tree.init(leaves)).tryGet
rootDigest = codexPosTree.root.tryGet
check:

View File

@ -39,7 +39,7 @@ proc makeManifest*(
store: BlockStore,
hcodec = Sha256HashCodec,
dataCodec = BlockCodec): Future[?!Manifest] {.async.} =
without tree =? CodexTree.init(cids), err:
without tree =? (await CodexTree.init(cids)), err:
return failure(err)
without treeCid =? tree.rootCid(CIDv1, dataCodec), err:
@ -90,10 +90,10 @@ proc createProtectedManifest*(
let
cids = datasetBlocks.mapIt(it.cid)
datasetTree = CodexTree.init(cids[0..<numDatasetBlocks]).tryGet()
datasetTree = (await CodexTree.init(cids[0..<numDatasetBlocks])).tryGet()
datasetTreeCid = datasetTree.rootCid().tryGet()
protectedTree = CodexTree.init(cids).tryGet()
protectedTree = (await CodexTree.init(cids)).tryGet()
protectedTreeCid = protectedTree.rootCid().tryGet()
for index, cid in cids[0..<numDatasetBlocks]:

View File

@ -269,7 +269,7 @@ suite "Slot builder":
Merkle.digest(slotHashes)
expectedRoot = Merkle.digest(slotsHashes)
rootHash = builder.buildVerifyTree(builder.slotRoots).tryGet().root.tryGet()
rootHash = (await builder.buildVerifyTree(builder.slotRoots)).tryGet().root.tryGet()
check:
expectedRoot == rootHash