chore: remove warnings (#3106)

- Removes deprecation and unused import warnings for libwaku
- Removes unused imports
- Adds .base. pragma to `SubscriptionObserver.onSubscribe`
- Uses casting for uint to enums conversions
- Bumps nim-chronicles
This commit is contained in:
richΛrd 2024-10-10 08:40:09 -04:00 committed by GitHub
parent 21b0355137
commit c861fa9f75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 32 additions and 38 deletions

View File

@ -1,5 +1,5 @@
import system, std/[json, sequtils]
import stew/[byteutils, results]
import system, results, std/json
import stew/byteutils
import
../../waku/common/base64,
../../waku/waku_core/message,

View File

@ -5,7 +5,7 @@
when defined(linux):
{.passl: "-Wl,-soname,libwaku.so".}
import std/[json, sequtils, atomics, strformat, options, atomics]
import std/[json, atomics, strformat, options, atomics]
import chronicles, chronos
import
waku/common/base64,

View File

@ -1,10 +1,9 @@
import std/[json, sequtils]
import std/json
import chronos, chronicles, results, libp2p/multiaddress
import
../../../../waku/factory/waku,
../../../../waku/discovery/waku_dnsdisc,
../../../../waku/discovery/waku_discv5,
../../../../waku/waku_peer_exchange,
../../../../waku/waku_core/peers,
../../../../waku/node/waku_node,
../../../alloc

View File

@ -1,4 +1,4 @@
import std/[options, sequtils, json, strutils, net]
import std/[options, json, strutils, net]
import chronos, chronicles, results, confutils, confutils/std/net
import

View File

@ -1,5 +1,5 @@
import std/net, options
import chronicles, chronos, stew/byteutils, results
import options
import chronicles, chronos, results
import
../../../../../waku/waku_core/message/message,
../../../../../waku/factory/waku,

@ -1 +1 @@
Subproject commit a28bb9781ce74e725796c307ad05083e646872be
Subproject commit 4524912fcacfd3965e32a9fe23c9bb12d48177ff

View File

@ -161,14 +161,14 @@ task libwakuStatic, "Build the cbindings waku node library":
let name = "libwaku"
buildLibrary name,
"library/",
"""-d:chronicles_line_numbers -d:chronicles_runtime_filtering=on -d:chronicles_sinks="textlines,json" -d:chronicles_default_output_device=Dynamic -d:chronicles_disabled_topics="eth,dnsdisc.client" """,
"""-d:chronicles_line_numbers -d:chronicles_runtime_filtering=on -d:chronicles_sinks="textlines,json" -d:chronicles_default_output_device=Dynamic -d:chronicles_disabled_topics="eth,dnsdisc.client" --warning:Deprecated:off --warning:UnusedImport:on """,
"static"
task libwakuDynamic, "Build the cbindings waku node library":
let name = "libwaku"
buildLibrary name,
"library/",
"""-d:chronicles_line_numbers -d:chronicles_runtime_filtering=on -d:chronicles_sinks="textlines,json" -d:chronicles_default_output_device=Dynamic -d:chronicles_disabled_topics="eth,dnsdisc.client" """,
"""-d:chronicles_line_numbers -d:chronicles_runtime_filtering=on -d:chronicles_sinks="textlines,json" -d:chronicles_default_output_device=Dynamic -d:chronicles_disabled_topics="eth,dnsdisc.client" --warning:Deprecated:off --warning:UnusedImport:on """,
"dynamic"
### Mobile Android

View File

@ -6,7 +6,7 @@
{.push raises: [].}
import std/[options, tables], chronos/timer, libp2p/stream/connection, libp2p/utility
import std/[options, tables], libp2p/stream/connection
import ./[single_token_limiter, service_metrics], ../../utils/tableutils

View File

@ -1,7 +1,7 @@
{.push raises: [].}
import
std/[options, sequtils],
std/options,
results,
chronicles,
chronos,

View File

@ -2,7 +2,7 @@
## receive and is backed by store-v3 requests to get an additional degree of certainty
##
import std/[tables, sequtils, sets, options]
import std/[tables, sequtils, options]
import chronos, chronicles, libp2p/utility
import
../../waku_core,

View File

@ -1,7 +1,7 @@
## This module reinforces the publish operation with regular store-v3 requests.
##
import std/[sets, sequtils]
import std/sequtils
import chronos, chronicles, libp2p/utility
import
./delivery_callback,
@ -206,7 +206,7 @@ proc startSendMonitor*(self: SendMonitor) =
self.msgStoredCheckerHandle = self.checkIfMessagesStored()
proc stopSendMonitor*(self: SendMonitor) =
self.msgStoredCheckerHandle.cancel()
discard self.msgStoredCheckerHandle.cancelAndWait()
proc setDeliveryCallback*(self: SendMonitor, deliveryCb: DeliveryFeedbackCallback) =
self.deliveryCb = deliveryCb

View File

@ -9,5 +9,5 @@ method onSubscribe*(
method onUnsubscribe*(
self: SubscriptionObserver, pubsubTopic: string, contentTopics: seq[string]
) {.gcsafe, raises: [].} =
) {.base, gcsafe, raises: [].} =
error "onUnsubscribe not implemented"

View File

@ -2,9 +2,10 @@
import
std/[times, options, sequtils, algorithm],
stew/[results, byteutils],
stew/[byteutils],
chronicles,
chronos,
results,
metrics
import
../common/paging,

View File

@ -1,6 +1,6 @@
{.push raises: [].}
import std/options, results, stew/byteutils, stew/arrayops, nimcrypto/sha2
import std/options, results
import ../waku_core, ../common/paging
## Public API types

View File

@ -4,11 +4,12 @@ else:
{.push raises: [].}
import
std/[times, options, sequtils, strutils, algorithm],
stew/[results, byteutils],
std/[times, options, sequtils, algorithm],
stew/byteutils,
chronicles,
chronos,
metrics
metrics,
results
import
../common/paging,
./driver,

View File

@ -3,7 +3,7 @@ when (NimMajor, NimMinor) < (1, 4):
else:
{.push raises: [].}
import stew/byteutils, nimcrypto/sha2
import nimcrypto/sha2
import ../../../waku_core, ../../common
type Index* = object

View File

@ -63,7 +63,7 @@ proc serviceUnavailable*(
proc parse*(T: type FilterSubscribeErrorKind, kind: uint32): T =
case kind
of 000, 200, 300, 400, 404, 429, 503:
FilterSubscribeErrorKind(kind)
cast[FilterSubscribeErrorKind](kind)
else:
FilterSubscribeErrorKind.UNKNOWN

View File

@ -1,7 +1,7 @@
{.push raises: [].}
import std/[sets, tables], chronicles, chronos, libp2p/peerid, stew/shims/sets
import ../waku_core, ../utils/tableutils, ../common/rate_limit/setting
import ../waku_core, ../utils/tableutils
logScope:
topics = "waku filter subscriptions"

View File

@ -4,7 +4,6 @@ import
../waku_core,
../waku_relay,
./common,
./protocol,
./protocol_metrics,
../waku_rln_relay,
../waku_rln_relay/protocol_types

View File

@ -1,5 +1,5 @@
import
std/[options, sequtils, random, sugar],
std/[options, sequtils, random],
results,
chronicles,
chronos,

View File

@ -42,7 +42,7 @@ proc decode*(T: type PeerExchangePeerInfo, buffer: seq[byte]): ProtoResult[T] =
proc parse*(T: type PeerExchangeResponseStatusCode, status: uint32): T =
case status
of 200, 400, 429, 503:
PeerExchangeResponseStatusCode(status)
cast[PeerExchangeResponseStatusCode](status)
else:
PeerExchangeResponseStatusCode.UNKNOWN

View File

@ -1,12 +1,6 @@
{.push raises: [].}
import
chronicles,
chronos,
metrics,
metrics/chronos_httpserver,
./constants,
../utils/collector
import chronicles, metrics, metrics/chronos_httpserver, ./constants, ../utils/collector
export metrics

View File

@ -76,7 +76,7 @@ type
StoreQueryResult* = Result[StoreQueryResponse, StoreError]
proc into*(errCode: ErrorCode): StatusCode =
StatusCode(uint32(errCode))
cast[StatusCode](uint32(errCode))
proc new*(T: type StoreError, code: uint32, desc: string): T =
let kind = ErrorCode.parse(code)
@ -98,7 +98,7 @@ proc new*(T: type StoreError, code: uint32, desc: string): T =
proc parse*(T: type ErrorCode, kind: uint32): T =
case kind
of 000, 300, 400, 429, 503, 504:
ErrorCode(kind)
cast[ErrorCode](kind)
else:
ErrorCode.UNKNOWN

View File

@ -75,7 +75,7 @@ type
proc parse*(T: type HistoryResponseErrorRPC, kind: uint32): T =
case kind
of 0, 1, 429, 503:
HistoryResponseErrorRPC(kind)
cast[HistoryResponseErrorRPC](kind)
else:
# TODO: Improve error variants/move to satus codes
HistoryResponseErrorRPC.INVALID_CURSOR