more testing logs

This commit is contained in:
Ben 2025-01-07 15:16:08 +01:00
parent 4048daa64b
commit 6e2d601ecd
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
4 changed files with 13 additions and 6 deletions

View File

@ -131,6 +131,7 @@ proc queueFindBlocksReq*(b: DiscoveryEngine, cids: seq[Cid]) {.inline.} =
for cid in cids:
if cid notin b.discoveryQueue:
try:
trace "Discovery Started", cid
b.discoveryQueue.putNoWait(cid)
except CatchableError as exc:
warn "Exception queueing discovery request", exc = exc.msg

View File

@ -223,7 +223,7 @@ proc blockPresenceHandler*(
if peerCtx.isNil:
return
trace "Handling blockPresences", addrs = blocks.mapIt(it.address)
trace "Handling blockPresences", addrs = blocks.mapIt(it.address), anyCancel = blocks.anyIt(it.isCancel)
for blk in blocks:
if presence =? Presence.init(blk):
peerCtx.setPresence(presence)
@ -432,7 +432,8 @@ proc wantListHandler*(
BlockPresence(
address: e.address,
`type`: BlockPresenceType.DontHave,
price: price))
price: price,
isCancel: e.cancel))
elif have: # and not e.cancel: # Uncomment this for slow mode.
# Important todo: This presence can be added in response to a cancel message.
# This is ignored by the receiving peer. But not doing so degrades performance.
@ -442,7 +443,8 @@ proc wantListHandler*(
BlockPresence(
address: e.address,
`type`: BlockPresenceType.Have,
price: price))
price: price,
isCancel: e.cancel))
elif e.wantType == WantType.WantBlock and not e.cancel:
# cancels are always of type wantHave, but just in case
@ -458,7 +460,7 @@ proc wantListHandler*(
peerCtx.peerWants[idx] = e # update entry
if presence.len > 0:
trace "Sending presence", addrs = presence.mapIt(it.address)
trace "Sending presence", addrs = presence.mapIt(it.address), anyCancel = presence.anyIt(it.isCancel)
await b.network.request.sendPresence(peer, presence)
if schedulePeer:

View File

@ -48,6 +48,7 @@ type
address*: BlockAddress
`type`*: BlockPresenceType
price*: seq[byte] # Amount of assets to pay for the block (UInt256)
isCancel*: bool
AccountMessage* = object
address*: seq[byte] # Ethereum address to which payments should be made
@ -112,6 +113,7 @@ proc write*(pb: var ProtoBuffer, field: int, value: BlockPresence) =
ipb.write(1, value.address)
ipb.write(2, value.`type`.uint)
ipb.write(3, value.price)
ipb.write(4, value.isCancel.uint)
ipb.finish()
pb.write(field, ipb)
@ -237,6 +239,8 @@ proc decode*(_: type BlockPresence, pb: ProtoBuffer): ProtoResult[BlockPresence]
if ? pb.getField(2, field):
value.`type` = BlockPresenceType(field)
discard ? pb.getField(3, value.price)
if ? pb.getField(4, field):
value.isCancel = bool(field)
ok(value)
proc decode*(_: type AccountMessage, pb: ProtoBuffer): ProtoResult[AccountMessage] =

View File

@ -1,2 +1,2 @@
docker build --build-arg MAKE_PARALLEL=4 --build-arg NIMFLAGS="-d:disableMarchNative -d:codex_enable_api_debug_peers=true -d:codex_enable_proof_failures=true -d:codex_use_hardhat=false -d:codex_enable_log_counter=true -d:verify_circuit=true" --build-arg NAT_IP_AUTO=true -t thatbenbierens/nim-codex:blkex-cancelpresence-15 -f codex.Dockerfile ..
docker push thatbenbierens/nim-codex:blkex-cancelpresence-15
docker build --build-arg MAKE_PARALLEL=4 --build-arg NIMFLAGS="-d:disableMarchNative -d:codex_enable_api_debug_peers=true -d:codex_enable_proof_failures=true -d:codex_use_hardhat=false -d:codex_enable_log_counter=true -d:verify_circuit=true" --build-arg NAT_IP_AUTO=true -t thatbenbierens/nim-codex:blkex-cancelpresence-18-s -f codex.Dockerfile ..
docker push thatbenbierens/nim-codex:blkex-cancelpresence-18-s