mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-04 06:23:06 +00:00
chore: bump Nim to 2.2.4 (#1242)
* chore: bump Nim to 2.2.4 * fix: resolve symbol ambiguity and drop auto type * fix: use reference to task instead of pointer or the compiler will deallocate `task` before the encoding/decoding is done * fix: convention that maxCollateralPerByte equals totalRemainingCollateral when freeSize is 0 to avoid DivByZeroDefect * fix: bump compiler version in CI pipeline as well
This commit is contained in:
parent
28a83db69e
commit
d59c5b023c
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -9,7 +9,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
cache_nonce: 0 # Allows for easily busting actions/cache caches
|
cache_nonce: 0 # Allows for easily busting actions/cache caches
|
||||||
nim_version: v2.0.14
|
nim_version: v2.2.4
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
||||||
|
|||||||
3
Makefile
3
Makefile
@ -15,8 +15,7 @@
|
|||||||
#
|
#
|
||||||
# If NIM_COMMIT is set to "nimbusbuild", this will use the
|
# If NIM_COMMIT is set to "nimbusbuild", this will use the
|
||||||
# version pinned by nimbus-build-system.
|
# version pinned by nimbus-build-system.
|
||||||
#PINNED_NIM_VERSION := 38640664088251bbc88917b4bacfd86ec53014b8 # 1.6.21
|
PINNED_NIM_VERSION := v2.2.4
|
||||||
PINNED_NIM_VERSION := v2.0.14
|
|
||||||
|
|
||||||
ifeq ($(NIM_COMMIT),)
|
ifeq ($(NIM_COMMIT),)
|
||||||
NIM_COMMIT := $(PINNED_NIM_VERSION)
|
NIM_COMMIT := $(PINNED_NIM_VERSION)
|
||||||
|
|||||||
@ -28,7 +28,7 @@ import pkg/stew/io2
|
|||||||
|
|
||||||
import ./node
|
import ./node
|
||||||
import ./conf
|
import ./conf
|
||||||
import ./rng
|
import ./rng as random
|
||||||
import ./rest/api
|
import ./rest/api
|
||||||
import ./stores
|
import ./stores
|
||||||
import ./slots
|
import ./slots
|
||||||
@ -199,7 +199,7 @@ proc new*(
|
|||||||
.new()
|
.new()
|
||||||
.withPrivateKey(privateKey)
|
.withPrivateKey(privateKey)
|
||||||
.withAddresses(config.listenAddrs)
|
.withAddresses(config.listenAddrs)
|
||||||
.withRng(Rng.instance())
|
.withRng(random.Rng.instance())
|
||||||
.withNoise()
|
.withNoise()
|
||||||
.withMplex(5.minutes, 5.minutes)
|
.withMplex(5.minutes, 5.minutes)
|
||||||
.withMaxConnections(config.maxPeers)
|
.withMaxConnections(config.maxPeers)
|
||||||
|
|||||||
@ -338,11 +338,9 @@ proc asyncEncode*(
|
|||||||
signal: threadPtr,
|
signal: threadPtr,
|
||||||
)
|
)
|
||||||
|
|
||||||
let t = addr task
|
|
||||||
|
|
||||||
doAssert self.taskPool.numThreads > 1,
|
doAssert self.taskPool.numThreads > 1,
|
||||||
"Must have at least one separate thread or signal will never be fired"
|
"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()
|
let threadFut = threadPtr.wait()
|
||||||
|
|
||||||
if joinErr =? catch(await threadFut.join()).errorOption:
|
if joinErr =? catch(await threadFut.join()).errorOption:
|
||||||
@ -353,7 +351,7 @@ proc asyncEncode*(
|
|||||||
else:
|
else:
|
||||||
return failure(joinErr)
|
return failure(joinErr)
|
||||||
|
|
||||||
if not t.success.load():
|
if not task.success.load():
|
||||||
return failure("Leopard encoding failed")
|
return failure("Leopard encoding failed")
|
||||||
|
|
||||||
success()
|
success()
|
||||||
@ -532,11 +530,9 @@ proc asyncDecode*(
|
|||||||
signal: threadPtr,
|
signal: threadPtr,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Hold the task pointer until the signal is received
|
|
||||||
let t = addr task
|
|
||||||
doAssert self.taskPool.numThreads > 1,
|
doAssert self.taskPool.numThreads > 1,
|
||||||
"Must have at least one separate thread or signal will never be fired"
|
"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()
|
let threadFut = threadPtr.wait()
|
||||||
|
|
||||||
if joinErr =? catch(await threadFut.join()).errorOption:
|
if joinErr =? catch(await threadFut.join()).errorOption:
|
||||||
@ -547,7 +543,7 @@ proc asyncDecode*(
|
|||||||
else:
|
else:
|
||||||
return failure(joinErr)
|
return failure(joinErr)
|
||||||
|
|
||||||
if not t.success.load():
|
if not task.success.load():
|
||||||
return failure("Leopard encoding failed")
|
return failure("Leopard encoding failed")
|
||||||
|
|
||||||
success()
|
success()
|
||||||
|
|||||||
@ -231,6 +231,11 @@ func key*(availability: Availability): ?!Key =
|
|||||||
return availability.id.key
|
return availability.id.key
|
||||||
|
|
||||||
func maxCollateralPerByte*(availability: Availability): UInt256 =
|
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)
|
return availability.totalRemainingCollateral div availability.freeSize.stuint(256)
|
||||||
|
|
||||||
func key*(reservation: Reservation): ?!Key =
|
func key*(reservation: Reservation): ?!Key =
|
||||||
|
|||||||
@ -293,8 +293,8 @@ asyncchecksuite "RepoStore":
|
|||||||
|
|
||||||
test "Should retrieve block expiration information":
|
test "Should retrieve block expiration information":
|
||||||
proc unpack(
|
proc unpack(
|
||||||
beIter: auto
|
beIter: Future[?!SafeAsyncIter[BlockExpiration]]
|
||||||
): Future[seq[BlockExpiration]] {.async: (raises: [CancelledError]).} =
|
): Future[seq[BlockExpiration]] {.async: (raises: [CatchableError]).} =
|
||||||
var expirations = newSeq[BlockExpiration](0)
|
var expirations = newSeq[BlockExpiration](0)
|
||||||
without iter =? (await beIter), err:
|
without iter =? (await beIter), err:
|
||||||
return expirations
|
return expirations
|
||||||
|
|||||||
2
vendor/nimbus-build-system
vendored
2
vendor/nimbus-build-system
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 4c6ff070c116450bb2c285691724ac9e6202cb28
|
Subproject commit 0be0663e1af76e869837226a4ef3e586fcc737d3
|
||||||
Loading…
x
Reference in New Issue
Block a user