From a9948b0b05334cbd9ee6376ff72112e0099797d2 Mon Sep 17 00:00:00 2001 From: Giovanni Petrantoni <7008900+sinkingsugar@users.noreply.github.com> Date: Thu, 12 Nov 2020 01:42:12 +0900 Subject: [PATCH] clarify validation messages (#431) * clarify validation messages * add codecov threshold --- codecov.yml | 8 ++++++++ libp2p/protocols/pubsub/floodsub.nim | 7 +++++-- libp2p/protocols/pubsub/gossipsub.nim | 4 ++-- libp2p/protocols/pubsub/gossipsub10.nim | 7 +++++-- 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..8adfd3c0b --- /dev/null +++ b/codecov.yml @@ -0,0 +1,8 @@ +coverage: + status: + project: + default: # This can be anything, but it needs to exist as the name + # basic settings + target: auto + threshold: 5% + base: auto \ No newline at end of file diff --git a/libp2p/protocols/pubsub/floodsub.nim b/libp2p/protocols/pubsub/floodsub.nim index 137c7920f..295997e93 100644 --- a/libp2p/protocols/pubsub/floodsub.nim +++ b/libp2p/protocols/pubsub/floodsub.nim @@ -87,8 +87,11 @@ method rpcHandler*(f: FloodSub, let validation = await f.validate(msg) case validation - of ValidationResult.Reject, ValidationResult.Ignore: - debug "Dropping message due to ignored validation", msgId, peer + of ValidationResult.Reject: + debug "Dropping message after validation, reason: reject", msgId, peer + continue + of ValidationResult.Ignore: + debug "Dropping message after validation, reason: ignore", msgId, peer continue of ValidationResult.Accept: discard diff --git a/libp2p/protocols/pubsub/gossipsub.nim b/libp2p/protocols/pubsub/gossipsub.nim index dd761cf51..4bbd65dca 100644 --- a/libp2p/protocols/pubsub/gossipsub.nim +++ b/libp2p/protocols/pubsub/gossipsub.nim @@ -1109,11 +1109,11 @@ method rpcHandler*(g: GossipSub, let validation = await g.validate(msg) case validation of ValidationResult.Reject: - debug "Dropping message due to failed validation", msgId, peer + debug "Dropping message after validation, reason: reject", msgId, peer g.punishPeer(peer, msg.topicIDs) continue of ValidationResult.Ignore: - debug "Dropping message due to ignored validation", msgId, peer + debug "Dropping message after validation, reason: ignore", msgId, peer continue of ValidationResult.Accept: discard diff --git a/libp2p/protocols/pubsub/gossipsub10.nim b/libp2p/protocols/pubsub/gossipsub10.nim index 47c542ff4..9d828f974 100644 --- a/libp2p/protocols/pubsub/gossipsub10.nim +++ b/libp2p/protocols/pubsub/gossipsub10.nim @@ -466,8 +466,11 @@ method rpcHandler*(g: GossipSub, let validation = await g.validate(msg) case validation - of ValidationResult.Reject, ValidationResult.Ignore: - debug "Dropping message due to ignored validation", msgId, peer + of ValidationResult.Reject: + debug "Dropping message after validation, reason: reject", msgId, peer + continue + of ValidationResult.Ignore: + debug "Dropping message after validation, reason: ignore", msgId, peer continue of ValidationResult.Accept: discard