Skip to content

Commit

Permalink
Enable tests with also json sink and fix failures (#624)
Browse files Browse the repository at this point in the history
And a few minor cleanups
  • Loading branch information
kdeme authored Jun 22, 2023
1 parent d74dc40 commit c5dd5e4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eth/p2p/discoveryv5/routing_table.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import
std/[algorithm, times, sequtils, bitops, sets, options],
bearssl/rand,
stint, chronicles, metrics, chronos, stew/shims/net as stewNet,
../../net/utils, stew/endians2,
../../net/utils,
"."/[node, random2, enr]

export options
Expand Down
2 changes: 2 additions & 0 deletions eth/utp/utp_protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type
proc (d: DatagramTransport):
SendCallback[TransportAddress] {.gcsafe, raises: [].}

chronicles.formatIt(TransportAddress): $it

# This should probably be defined in TransportAddress module, as hash function should
# be consistent with equality function
# in nim zero arrays always have hash equal to 0, irrespectively of array size, to
Expand Down
2 changes: 2 additions & 0 deletions eth/utp/utp_socket.nim
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ type

ConnectionResult*[A] = Result[UtpSocket[A], OutgoingConnectionError]

chronicles.formatIt(UtpSocketKey): $it

const
# Default maximum size of the data packet payload. With this configuration
# data packets will have 508 bytes (488 + 20 header).
Expand Down
2 changes: 2 additions & 0 deletions tests/nim.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# rocksdb init does this type of assignment
--define:nimOldCaseObjects

-d:"chronicles_sinks=textlines[stdout],json[dynamic]"
-d:"chronicles_log_level=TRACE"
-d:"chronicles_runtime_filtering=on"

# Avoid some rare stack corruption while using exceptions with a SEH-enabled
Expand Down
6 changes: 5 additions & 1 deletion tools/dcli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# This file may not be copied, modified, or distributed except according to
# those terms.

{.push raises: [].}

import
std/[options, strutils, tables, sets],
confutils, confutils/std/net, chronicles, chronicles/topics_registry,
Expand Down Expand Up @@ -182,7 +184,7 @@ proc discover(d: discv5_protocol.Protocol, psFile: string) {.async.} =
await sleepAsync(1000) # 1 sec of delay


proc run(config: DiscoveryConf) =
proc run(config: DiscoveryConf) {.raises: [CatchableError].} =
let
bindIp = config.listenAddress
udpPort = Port(config.udpPort)
Expand Down Expand Up @@ -235,7 +237,9 @@ proc run(config: DiscoveryConf) =
waitFor(discover(d, config.persistingFile))

when isMainModule:
{.pop.}
let config = DiscoveryConf.load()
{.push raises: [].}

setLogLevel(config.logLevel)

Expand Down

0 comments on commit c5dd5e4

Please sign in to comment.