Skip to content

Commit

Permalink
gcsafe adaptations becasue Nim 2.0 is more strict
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status committed Jul 6, 2024
1 parent e175131 commit 1dd94d1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/waku_core/test_namespaced_topics.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{.used.}

import std/options, stew/results, testutils/unittests
import std/options, results, testutils/unittests
import waku/waku_core/topics

suite "Waku Message - Content topics namespacing":
Expand Down
2 changes: 1 addition & 1 deletion tests/waku_store/store_utils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ proc newTestWakuStore*(

return proto

proc newTestWakuStoreClient*(switch: Switch): WakuStoreClient =
proc newTestWakuStoreClient*(switch: Switch): WakuStoreClient {.gcsafe.} =
let peerManager = PeerManager.new(switch)
WakuStoreClient.new(peerManager, rng)
4 changes: 2 additions & 2 deletions waku/node/peer_manager/peer_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ proc dialPeer(

return none(Connection)

proc loadFromStorage(pm: PeerManager) =
proc loadFromStorage(pm: PeerManager) {.gcsafe.} =
## Load peers from storage, if available

trace "loading peers from storage"
Expand Down Expand Up @@ -462,7 +462,7 @@ proc new*(
maxFailedAttempts = MaxFailedAttempts,
colocationLimit = DefaultColocationLimit,
shardedPeerManagement = false,
): PeerManager =
): PeerManager {.gcsafe.} =
let capacity = switch.peerStore.capacity
let maxConnections = switch.connManager.inSema.size
if maxConnections > capacity:
Expand Down
4 changes: 3 additions & 1 deletion waku/node/peer_manager/peer_store/peer_storage.nim
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ method put*(
): PeerStorageResult[void] {.base, gcsafe.} =
return err("Unimplemented")

method getAll*(db: PeerStorage, onData: DataProc): PeerStorageResult[void] {.base.} =
method getAll*(
db: PeerStorage, onData: DataProc
): PeerStorageResult[void] {.base, gcsafe.} =
return err("Unimplemented")
2 changes: 1 addition & 1 deletion waku/waku_api/rest/health/client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import
chronicles, json_serialization, json_serialization/std/options, presto/[route, client]
import ./types, ../serdes, ../responses, ../rest_serdes, ../../waku/node/health_monitor
import ./types, ../serdes, ../responses, ../rest_serdes, waku/node/health_monitor

logScope:
topics = "waku node rest health_api"
Expand Down
2 changes: 1 addition & 1 deletion waku/waku_store/client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type WakuStoreClient* = ref object

proc new*(
T: type WakuStoreClient, peerManager: PeerManager, rng: ref rand.HmacDrbgContext
): T =
): T {.gcsafe.} =
WakuStoreClient(peerManager: peerManager, rng: rng)

proc sendStoreRequest(
Expand Down

0 comments on commit 1dd94d1

Please sign in to comment.