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) success Sponge.digest(bytes, rate)
# TODO: replace with poseidon2 library call plz
proc digestTree*( proc digestTree*(
_: type Poseidon2Tree, _: type Poseidon2Tree,
bytes: seq[byte], bytes: seq[byte],

View File

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

View File

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

View File

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