rebase, update new files to asynctest 0.5.0, indicies -> indices :-)

This commit is contained in:
gmega 2024-01-19 11:35:02 -03:00
parent fd78727978
commit 22449fd0a8
No known key found for this signature in database
GPG Key ID: FFD8DAF00660270F
9 changed files with 14 additions and 14 deletions

View File

@ -528,7 +528,7 @@ proc onStore(
return success() return success()
if blksIter =? builder.slotIndiciesIter(slotIdx) and if blksIter =? builder.slotIndicesIter(slotIdx) and
err =? (await self.fetchBatched( err =? (await self.fetchBatched(
manifest.treeCid, manifest.treeCid,
blksIter, blksIter,

View File

@ -26,7 +26,7 @@ type
OnStore* = proc(request: StorageRequest, OnStore* = proc(request: StorageRequest,
slot: UInt256, slot: UInt256,
blocksCb: BlocksCb): Future[?!void] {.gcsafe, async.} blocksCb: BlocksCb): Future[?!void] {.gcsafe, async.}
OnProve* = proc(slot: Slot, challenge: ProofChallenge): Future[seq[byte]] {.gcsafe, async.} OnProve* = proc(slot: Slot, challenge: ProofChallenge): Future[?!seq[byte]] {.gcsafe, async.}
OnExpiryUpdate* = proc(rootCid: string, expiry: SecondsSince1970): Future[?!void] {.gcsafe, async.} OnExpiryUpdate* = proc(rootCid: string, expiry: SecondsSince1970): Future[?!void] {.gcsafe, async.}
OnClear* = proc(request: StorageRequest, OnClear* = proc(request: StorageRequest,
slotIndex: UInt256) {.gcsafe, raises: [].} slotIndex: UInt256) {.gcsafe, raises: [].}

View File

@ -141,20 +141,20 @@ func numSlotCells*(self: SlotsBuilder): Natural =
self.numBlockCells * self.numSlotBlocks self.numBlockCells * self.numSlotBlocks
func slotIndiciesIter*(self: SlotsBuilder, slot: Natural): ?!Iter[int] = func slotIndicesIter*(self: SlotsBuilder, slot: Natural): ?!Iter[int] =
## Returns the slot indices. ## Returns the slot indices.
## ##
self.strategy.getIndicies(slot).catch self.strategy.getIndices(slot).catch
func slotIndicies*(self: SlotsBuilder, slot: Natural): seq[int] = func slotIndices*(self: SlotsBuilder, slot: Natural): seq[int] =
## Returns the slot indices. ## Returns the slot indices.
## ##
if iter =? self.strategy.getIndicies(slot).catch: if iter =? self.strategy.getIndices(slot).catch:
toSeq(iter) toSeq(iter)
else: else:
trace "Failed to get slot indicies" trace "Failed to get slot indices"
newSeq[int]() newSeq[int]()
func manifest*(self: SlotsBuilder): Manifest = func manifest*(self: SlotsBuilder): Manifest =
@ -198,7 +198,7 @@ proc getCellHashes*(
let let
hashes: seq[Poseidon2Hash] = collect(newSeq): hashes: seq[Poseidon2Hash] = collect(newSeq):
for blkIdx in self.strategy.getIndicies(slotIndex): for blkIdx in self.strategy.getIndices(slotIndex):
trace "Getting block CID for tree at index" trace "Getting block CID for tree at index"
without (_, tree) =? (await self.buildBlockTree(blkIdx)) and without (_, tree) =? (await self.buildBlockTree(blkIdx)) and

View File

@ -136,7 +136,7 @@ proc getProofInput*(
# This converts our slotBlockIndex to a datasetBlockIndex using the # This converts our slotBlockIndex to a datasetBlockIndex using the
# indexing-strategy used by the builder. # indexing-strategy used by the builder.
# We need this to fetch the block data. We can't do it by slotTree + slotBlkIdx. # We need this to fetch the block data. We can't do it by slotTree + slotBlkIdx.
let datasetBlockIndex = self.builder.slotIndicies(self.index)[slotCellIdx] let datasetBlockIndex = self.builder.slotIndices(self.index)[slotCellIdx]
without (bytes, blkTree) =? await self.builder.buildBlockTree(datasetBlockIndex), err: without (bytes, blkTree) =? await self.builder.buildBlockTree(datasetBlockIndex), err:
error "Failed to build block tree", err = err.msg error "Failed to build block tree", err = err.msg

View File

@ -129,7 +129,7 @@ asyncchecksuite "Test Node - Host contracts":
(await onStore(request, 1.u256, onBlocks)).tryGet() (await onStore(request, 1.u256, onBlocks)).tryGet()
check fetchedBytes == 786432 check fetchedBytes == 786432
for index in !builder.slotIndices(1): for index in builder.slotIndices(1):
let let
blk = (await localStore.getBlock(verifiable.treeCid, index)).tryGet blk = (await localStore.getBlock(verifiable.treeCid, index)).tryGet
expiryKey = (createBlockExpirationMetadataKey(blk.cid)).tryGet expiryKey = (createBlockExpirationMetadataKey(blk.cid)).tryGet

View File

@ -75,7 +75,7 @@ proc createSlotTree(self: ProvingTestEnvironment, dSlotIndex: uint64): Future[Po
slotSize = (bytesPerBlock * numberOfSlotBlocks).uint64 slotSize = (bytesPerBlock * numberOfSlotBlocks).uint64
blocksInSlot = slotSize div bytesPerBlock.uint64 blocksInSlot = slotSize div bytesPerBlock.uint64
datasetBlockIndexingStrategy = SteppedIndexingStrategy.new(0, self.datasetBlocks.len - 1, totalNumberOfSlots) datasetBlockIndexingStrategy = SteppedIndexingStrategy.new(0, self.datasetBlocks.len - 1, totalNumberOfSlots)
datasetBlockIndices = toSeq(datasetBlockIndexingStrategy.getIndicies(dSlotIndex.int)) datasetBlockIndices = toSeq(datasetBlockIndexingStrategy.getIndices(dSlotIndex.int))
let let
slotBlocks = datasetBlockIndices.mapIt(self.datasetBlocks[it]) slotBlocks = datasetBlockIndices.mapIt(self.datasetBlocks[it])

View File

@ -1,5 +1,5 @@
import pkg/chronos import pkg/chronos
import pkg/asynctest import pkg/asynctest/chronos/unittest
import pkg/poseidon2 import pkg/poseidon2
import pkg/poseidon2/io import pkg/poseidon2/io
import pkg/constantine/math/io/io_fields import pkg/constantine/math/io/io_fields

View File

@ -9,8 +9,8 @@ import pkg/constantine/math/io/io_fields
import pkg/poseidon2/io import pkg/poseidon2/io
import pkg/poseidon2 import pkg/poseidon2
import pkg/chronos import pkg/chronos
import pkg/asynctest
import pkg/nimcrypto import pkg/nimcrypto
import pkg/asynctest/chronos/unittest
import pkg/codex/stores/cachestore import pkg/codex/stores/cachestore
import pkg/codex/chunker import pkg/codex/chunker
import pkg/codex/stores import pkg/codex/stores

View File

@ -9,7 +9,7 @@ import pkg/constantine/math/io/io_fields
import pkg/poseidon2/io import pkg/poseidon2/io
import pkg/poseidon2 import pkg/poseidon2
import pkg/chronos import pkg/chronos
import pkg/asynctest import pkg/asynctest/chronos/unittest
import pkg/codex/stores/cachestore import pkg/codex/stores/cachestore
import pkg/codex/chunker import pkg/codex/chunker
import pkg/codex/stores import pkg/codex/stores