style: nph formatting

Signed-off-by: Chrysostomos Nanakos <chris@include.gr>
This commit is contained in:
Chrysostomos Nanakos 2026-01-07 17:33:11 +02:00 committed by E M
parent 41efa3fc68
commit 0720763165
No known key found for this signature in database
11 changed files with 18 additions and 36 deletions

View File

@ -760,13 +760,12 @@ proc wantListHandler*(
wantType = $e.wantType
if e.address notin peerCtx.wantedBlocks: # Adding new entry to peer wants
let
have =
try:
await e.address in self.localStore
except CatchableError as exc:
# TODO: should not be necessary once we have proper exception tracking on the BlockStore interface
false
let have =
try:
await e.address in self.localStore
except CatchableError as exc:
# TODO: should not be necessary once we have proper exception tracking on the BlockStore interface
false
if e.cancel:
# This is sort of expected if we sent the block to the peer, as we have removed
@ -781,17 +780,13 @@ proc wantListHandler*(
if have:
trace "We HAVE the block", address = e.address
presence.add(
BlockPresence(
address: e.address, `type`: BlockPresenceType.Have
)
BlockPresence(address: e.address, `type`: BlockPresenceType.Have)
)
else:
trace "We DON'T HAVE the block", address = e.address
if e.sendDontHave:
presence.add(
BlockPresence(
address: e.address, `type`: BlockPresenceType.DontHave
)
BlockPresence(address: e.address, `type`: BlockPresenceType.DontHave)
)
codex_block_exchange_want_have_lists_received.inc()

View File

@ -24,10 +24,8 @@ func parse(_: type UInt256, bytes: seq[byte]): ?UInt256 =
UInt256.fromBytesBE(bytes).some
func init*(_: type Presence, message: PresenceMessage): ?Presence =
some Presence(
address: message.address,
have: message.`type` == BlockPresenceType.Have,
address: message.address, have: message.`type` == BlockPresenceType.Have
)
func init*(_: type PresenceMessage, presence: Presence): PresenceMessage =

View File

@ -303,7 +303,8 @@ const
nimBanner* = getNimBanner()
codexFullVersion* =
"Storage version: " & codexVersion & "\p" & "Storage revision: " & codexRevision & "\p"
"Storage version: " & codexVersion & "\p" & "Storage revision: " & codexRevision &
"\p"
proc parseCmdArg*(
T: typedesc[MultiAddress], input: string

View File

@ -84,8 +84,7 @@ func isManifest*(mc: MultiCodec): ?!bool =
func `==`*(a, b: Manifest): bool =
(a.treeCid == b.treeCid) and (a.datasetSize == b.datasetSize) and
(a.blockSize == b.blockSize) and (a.version == b.version) and (a.hcodec == b.hcodec) and
(a.codec == b.codec) and (a.filename == b.filename) and
(a.mimetype == b.mimetype)
(a.codec == b.codec) and (a.filename == b.filename) and (a.mimetype == b.mimetype)
func `$`*(self: Manifest): string =
result =

View File

@ -489,10 +489,7 @@ proc initDebugApi(node: CodexNodeRef, conf: CodexConf, router: var RestRouter) =
"",
"announceAddresses": node.discovery.announceAddrs,
"table": table,
"storage": {
"version": $codexVersion,
"revision": $codexRevision,
},
"storage": {"version": $codexVersion, "revision": $codexRevision},
}
# return pretty json for human readability

View File

@ -10,7 +10,6 @@ import ../units
export json
type
RestContent* = object
cid* {.serialize.}: Cid
manifest* {.serialize.}: Manifest

View File

@ -253,9 +253,7 @@ asyncchecksuite "NetworkStore engine handlers":
await engine.blockPresenceHandler(
peerId,
blocks.mapIt(
PresenceMessage.init(Presence(address: it.address, have: true))
),
blocks.mapIt(PresenceMessage.init(Presence(address: it.address, have: true))),
)
for a in blocks.mapIt(it.address):

View File

@ -230,10 +230,7 @@ asyncchecksuite "Network - Test Limits":
): Future[void] {.async: (raises: []).} =
check false
let fut = network1.send(
switch2.peerInfo.peerId,
Message()
)
let fut = network1.send(switch2.peerInfo.peerId, Message())
await sleepAsync(100.millis)
check not fut.finished

View File

@ -13,9 +13,8 @@ import ./helpers
import ./examples
suite "Manifest":
let
manifest =
Manifest.new(treeCid = Cid.example, blockSize = 1.MiBs, datasetSize = 100.MiBs)
let manifest =
Manifest.new(treeCid = Cid.example, blockSize = 1.MiBs, datasetSize = 100.MiBs)
proc encodeDecode(manifest: Manifest): Manifest =
let e = manifest.encode().tryGet()

View File

@ -20,7 +20,7 @@ multinodesuite "Rest API validation":
test "should return 204 when attempting delete of non-existing dataset", config:
let data = await RandomChunker.example(blocks = 2)
let cid = (await client.upload(data)).get
let responseBefore = await client.deleteRaw($Cid.example)
check responseBefore.status == 204
check (await responseBefore.body) == "" # No content

View File

@ -20,7 +20,6 @@ template twonodessuite*(name: string, body: untyped) =
var client2 {.inject, used.}: CodexClient
setup:
node1 = clients()[0]
node2 = clients()[1]