Enable tests with also json sink and fix failures (#624)

And a few minor cleanups
This commit is contained in:
Kim De Mey 2023-06-22 18:13:16 +02:00 committed by GitHub
parent d74dc40bee
commit c5dd5e4115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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).

View File

@ -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

View File

@ -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,
@ -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)
@ -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)