Modify the fix in an attempt to get erasure decoding manifests working

This commit is contained in:
Eric 2024-06-14 15:45:34 +10:00
parent f4ba5844d6
commit efee152e31
No known key found for this signature in database
2 changed files with 18 additions and 8 deletions

View File

@ -209,6 +209,9 @@ proc prepareDecodingData(
let
pos = indexToPos(encoded.steps, idx, step)
if encoded.ecK > pos:
continue
logScope:
cid = blk.cid
idx = idx
@ -217,7 +220,7 @@ proc prepareDecodingData(
empty = blk.isEmpty
cids[idx] = blk.cid
if idx >= encoded.rounded and pos >= encoded.ecK:
if idx >= encoded.rounded:
trace "Retrieved parity block"
shallowCopy(parityData[pos - encoded.ecK], if blk.isEmpty: emptyBlock else: blk.data)
parityPieces.inc

View File

@ -1,9 +1,16 @@
from pkg/libp2p import Cid, init
# import pkg/codex/manifest
import pkg/codex/manifest/coders
import pkg/codex/manifest/manifest
import ../examples
import ./marketplacesuite
import ./nodeconfigs
import ./hardhatconfig
export coders # make Manifest.decode symbol available to codex/manifest
marketplacesuite "EC bug":
test "should be able to create storage request and download dataset",
@ -16,15 +23,11 @@ marketplacesuite "EC bug":
CodexConfigs.init(nodes=1)
# .debug() # uncomment to enable console log output.debug()
.withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log
.withLogTopics("node", "erasure", "marketplace", )
.withLogTopics("node", "erasure", "marketplace", "storestream")
.some,
providers:
CodexConfigs.init(nodes=0)
# .debug() # uncomment to enable console log output
# .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log
# .withLogTopics("node", "marketplace", "sales", "reservations", "node", "proving", "clock")
.some,
CodexConfigs.none,
):
let reward = 400.u256
let duration = 10.periods
@ -60,6 +63,10 @@ marketplacesuite "EC bug":
let cidFromRequest = Cid.init(request.content.cid).get()
let downloaded = await clientApi.downloadBytes(cidFromRequest, local = true)
check downloaded.isOk
check downloaded.get.toHex == data
# let manifest = Manifest.new(downloaded.get)
# echo "manifest: ", manifest
echo "orig data length: ", data.len
echo "download length: ", downloaded.get.toHex.len
# check downloaded.get.toHex == data
await subscription.unsubscribe()