diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a6d7b66..c045031c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: env: cache_nonce: 0 # Allows for easily busting actions/cache caches - nim_version: v2.0.14 + nim_version: v2.2.4 concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} diff --git a/Makefile b/Makefile index 6915a119..f39a3394 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,7 @@ # # If NIM_COMMIT is set to "nimbusbuild", this will use the # version pinned by nimbus-build-system. -#PINNED_NIM_VERSION := 38640664088251bbc88917b4bacfd86ec53014b8 # 1.6.21 -PINNED_NIM_VERSION := v2.0.14 +PINNED_NIM_VERSION := v2.2.4 ifeq ($(NIM_COMMIT),) NIM_COMMIT := $(PINNED_NIM_VERSION) diff --git a/codex/codex.nim b/codex/codex.nim index 04050f04..3ee48d68 100644 --- a/codex/codex.nim +++ b/codex/codex.nim @@ -28,7 +28,7 @@ import pkg/stew/io2 import ./node import ./conf -import ./rng +import ./rng as random import ./rest/api import ./stores import ./slots @@ -199,7 +199,7 @@ proc new*( .new() .withPrivateKey(privateKey) .withAddresses(config.listenAddrs) - .withRng(Rng.instance()) + .withRng(random.Rng.instance()) .withNoise() .withMplex(5.minutes, 5.minutes) .withMaxConnections(config.maxPeers) diff --git a/codex/erasure/erasure.nim b/codex/erasure/erasure.nim index 884969d0..e3d618ea 100644 --- a/codex/erasure/erasure.nim +++ b/codex/erasure/erasure.nim @@ -338,11 +338,9 @@ proc asyncEncode*( signal: threadPtr, ) - let t = addr task - doAssert self.taskPool.numThreads > 1, "Must have at least one separate thread or signal will never be fired" - self.taskPool.spawn leopardEncodeTask(self.taskPool, t) + self.taskPool.spawn leopardEncodeTask(self.taskPool, addr task) let threadFut = threadPtr.wait() if joinErr =? catch(await threadFut.join()).errorOption: @@ -353,7 +351,7 @@ proc asyncEncode*( else: return failure(joinErr) - if not t.success.load(): + if not task.success.load(): return failure("Leopard encoding failed") success() @@ -532,11 +530,9 @@ proc asyncDecode*( signal: threadPtr, ) - # Hold the task pointer until the signal is received - let t = addr task doAssert self.taskPool.numThreads > 1, "Must have at least one separate thread or signal will never be fired" - self.taskPool.spawn leopardDecodeTask(self.taskPool, t) + self.taskPool.spawn leopardDecodeTask(self.taskPool, addr task) let threadFut = threadPtr.wait() if joinErr =? catch(await threadFut.join()).errorOption: @@ -547,7 +543,7 @@ proc asyncDecode*( else: return failure(joinErr) - if not t.success.load(): + if not task.success.load(): return failure("Leopard encoding failed") success() diff --git a/codex/sales/reservations.nim b/codex/sales/reservations.nim index d8ef2ae5..b9facd2e 100644 --- a/codex/sales/reservations.nim +++ b/codex/sales/reservations.nim @@ -231,6 +231,11 @@ func key*(availability: Availability): ?!Key = return availability.id.key func maxCollateralPerByte*(availability: Availability): UInt256 = + # If freeSize happens to be zero, we convention that the maxCollateralPerByte + # should be equal to totalRemainingCollateral. + if availability.freeSize == 0.uint64: + return availability.totalRemainingCollateral + return availability.totalRemainingCollateral div availability.freeSize.stuint(256) func key*(reservation: Reservation): ?!Key = diff --git a/tests/codex/stores/testrepostore.nim b/tests/codex/stores/testrepostore.nim index 1666e44a..69f38711 100644 --- a/tests/codex/stores/testrepostore.nim +++ b/tests/codex/stores/testrepostore.nim @@ -293,8 +293,8 @@ asyncchecksuite "RepoStore": test "Should retrieve block expiration information": proc unpack( - beIter: auto - ): Future[seq[BlockExpiration]] {.async: (raises: [CancelledError]).} = + beIter: Future[?!SafeAsyncIter[BlockExpiration]] + ): Future[seq[BlockExpiration]] {.async: (raises: [CatchableError]).} = var expirations = newSeq[BlockExpiration](0) without iter =? (await beIter), err: return expirations diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system index 4c6ff070..0be0663e 160000 --- a/vendor/nimbus-build-system +++ b/vendor/nimbus-build-system @@ -1 +1 @@ -Subproject commit 4c6ff070c116450bb2c285691724ac9e6202cb28 +Subproject commit 0be0663e1af76e869837226a4ef3e586fcc737d3