From 7602adc0dfb947970d4fc1e98f983c3b3dc82227 Mon Sep 17 00:00:00 2001 From: Slava <20563034+veaceslavdoina@users.noreply.github.com> Date: Thu, 27 Jun 2024 08:51:50 +0300 Subject: [PATCH] Release v0.1.2 (#847) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: createReservation lock (#825) * fix: createReservation lock * fix: additional locking places * fix: acquire lock * chore: feedback Co-authored-by: markspanbroek Signed-off-by: Adam Uhlíř * feat: withLock template and fixed tests * fix: use proc for MockReservations constructor * chore: feedback Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com> Signed-off-by: Adam Uhlíř * chore: feedback implementation --------- Signed-off-by: Adam Uhlíř Co-authored-by: markspanbroek Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com> * Block deletion with ref count & repostore refactor (#631) * Fix StoreStream so it doesn't return parity bytes (#838) * fix storestream so it doesn\'t return parity bits for protected/verifiable manifests * use Cid.example instead of creating a mock manually * Fix verifiable manifest initialization (#839) * fix verifiable manifest initialization * fix linearstrategy, use verifiableStrategy to select blocks for slots * check for both strategies in attribute inheritance test * ci: add verify_circuit=true to the releases (#840) * provisional fix so EC errors do not crash the node on download (#841) * prevent node crashing with `not val.isNil` (#843) * bump nim-leopard to handle no parity data (#845) * Fix verifiable manifest constructor (#844) * Fix verifiable manifest constructor * Add integration test for verifiable manifest download Add integration test for testing download of verifiable dataset after creating request for storage * add missing import * add testecbug to integration suite * Remove hardhat instance from integration test * change description, drop echo --------- Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com> Co-authored-by: gmega --------- Signed-off-by: Adam Uhlíř Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com> Co-authored-by: Adam Uhlíř Co-authored-by: markspanbroek Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com> Co-authored-by: Tomasz Bekas Co-authored-by: Giuliano Mega --- codex/manifest/manifest.nim | 2 +- codex/node.nim | 5 ++- tests/codex/testerasure.nim | 20 +++++++++++ tests/integration/codexclient.nim | 27 +++++++++++++- tests/integration/testecbug.nim | 60 +++++++++++++++++++++++++++++++ tests/testIntegration.nim | 1 + vendor/nim-leopard | 2 +- 7 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 tests/integration/testecbug.nim diff --git a/codex/manifest/manifest.nim b/codex/manifest/manifest.nim index abfd5b4c..5966feb3 100644 --- a/codex/manifest/manifest.nim +++ b/codex/manifest/manifest.nim @@ -322,7 +322,7 @@ func new*( protected: true, ecK: manifest.ecK, ecM: manifest.ecM, - originalTreeCid: manifest.treeCid, + originalTreeCid: manifest.originalTreeCid, originalDatasetSize: manifest.originalDatasetSize, protectedStrategy: manifest.protectedStrategy, verifiable: true, diff --git a/codex/node.nim b/codex/node.nim index 15ca1466..f2bcb289 100644 --- a/codex/node.nim +++ b/codex/node.nim @@ -257,7 +257,10 @@ proc streamEntireDataset( leoDecoderProvider, self.taskpool) without _ =? (await erasure.decode(manifest)), error: - trace "Unable to erasure decode manifest", manifestCid, exc = error.msg + error "Unable to erasure decode manifest", manifestCid, exc = error.msg + return failure(error) + + return success() # -------------------------------------------------------------------------- # FIXME this is a HACK so that the node does not crash during the workshop. # We should NOT catch Defect. diff --git a/tests/codex/testerasure.nim b/tests/codex/testerasure.nim index b92f4ae3..84f4b1c3 100644 --- a/tests/codex/testerasure.nim +++ b/tests/codex/testerasure.nim @@ -17,6 +17,7 @@ import pkg/taskpools import ../asynctest import ./helpers +import ./examples suite "Erasure encode/decode": const BlockSize = 1024'nb @@ -232,3 +233,22 @@ suite "Erasure encode/decode": let encoded = await encode(buffers, parity) discard (await erasure.decode(encoded)).tryGet() + + test "Should handle verifiable manifests": + const + buffers = 20 + parity = 10 + + let + encoded = await encode(buffers, parity) + slotCids = collect(newSeq): + for i in 0.. //_.log + .withLogTopics("node", "erasure", "marketplace", ) + .some, + + providers: + CodexConfigs.init(nodes=0) + # .debug() # uncomment to enable console log output + # .withLogFile() # uncomment to output log file to tests/integration/logs/ //_.log + # .withLogTopics("node", "marketplace", "sales", "reservations", "node", "proving", "clock") + .some, + ): + let reward = 400.u256 + let duration = 10.periods + let collateral = 200.u256 + let expiry = 5.periods + let data = await RandomChunker.example(blocks=8) + let client = clients()[0] + let clientApi = client.client + + let cid = clientApi.upload(data).get + + var requestId = none RequestId + proc onStorageRequested(event: StorageRequested) {.raises:[].} = + requestId = event.requestId.some + + let subscription = await marketplace.subscribe(StorageRequested, onStorageRequested) + + # client requests storage but requires multiple slots to host the content + let id = await clientApi.requestStorage( + cid, + duration=duration, + reward=reward, + expiry=expiry, + collateral=collateral, + nodes=3, + tolerance=1 + ) + + check eventually(requestId.isSome, timeout=expiry.int * 1000) + + let request = await marketplace.getRequest(requestId.get) + let cidFromRequest = Cid.init(request.content.cid).get() + let downloaded = await clientApi.downloadBytes(cidFromRequest, local = true) + check downloaded.isOk + check downloaded.get.toHex == data.toHex + + await subscription.unsubscribe() diff --git a/tests/testIntegration.nim b/tests/testIntegration.nim index de854ecb..b1f81ef4 100644 --- a/tests/testIntegration.nim +++ b/tests/testIntegration.nim @@ -6,5 +6,6 @@ import ./integration/testpurchasing import ./integration/testblockexpiration import ./integration/testmarketplace import ./integration/testproofs +import ./integration/testecbug {.warning[UnusedImport]:off.} diff --git a/vendor/nim-leopard b/vendor/nim-leopard index 1a6f2ab7..895ff24c 160000 --- a/vendor/nim-leopard +++ b/vendor/nim-leopard @@ -1 +1 @@ -Subproject commit 1a6f2ab7252426a6ac01482a68b75d0c3b134cf0 +Subproject commit 895ff24ca6615d577acfb11811cdd5465f596c97