diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index 7465369dc..22db2e37b 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -449,9 +449,39 @@ func getScore*(a: Peer): int = ## Returns current score value for peer ``peer``. a.score -func updateScore*(peer: Peer, score: int) {.inline.} = +proc updateScore*(peer: Peer, score: int) = ## Update peer's ``peer`` score with value ``score``. peer.score = peer.score + score + if score == PeerScoreLowLimit: + info "Peer will be kicked soon" + elif score == PeerScorePoorRequest: + info "Peer is not responding on time" + elif score == PeerScoreInvalidRequest: + info "Peer is sending malformed or nonsensical data" + elif score == PeerScoreNoStatus: + info "Peer did not our answer to our `status` request" + elif score == PeerScoreStaleStatus: + info "Peer's status answer did not progress with time" + elif score == PeerScoreUseless: + info "Peer's latest head is lower than ours" + elif score == PeerScoreGoodStatus: + info "Peer's `status` answer is fine" + elif score == PeerScoreNoValues: + info "Peer did not respond to a request in time" + elif score == PeerScoreGoodBatchValue: + info "Individual response of the peer's multi step response is fine" + elif score == PeerScoreGoodValues: + info "Peer's response to our request is fine" + elif score == PeerScoreBadValues: + info "Peer's response contains incorrect data" + elif score == PeerScoreBadResponse: + info "Peer's response was not in the given range request" + elif score == PeerScoreBadColumns: + info "Peer's column responses are invalid" + elif score == PeerScoreMissingValues: + info "Peer contains too much of missing data" + elif score == PeerScoreUnviableFork: + info "Peer is in Unviable Fork" if peer.score > PeerScoreHighLimit: peer.score = PeerScoreHighLimit diff --git a/beacon_chain/networking/peer_scores.nim b/beacon_chain/networking/peer_scores.nim index 1d90a198b..388619e6b 100644 --- a/beacon_chain/networking/peer_scores.nim +++ b/beacon_chain/networking/peer_scores.nim @@ -36,10 +36,10 @@ const PeerScoreBadValues* = -1000 ## Peer's response contains incorrect data. PeerScoreBadResponse* = -1000 + ## Peer's response is not in requested range. + PeerScoreBadColumns* = -100000 ## Peer's column responses are invalid ## Specifically a peerdas devnet setting - PeerScoreBadColumns* = -100000 - ## Peer's response is not in requested range. PeerScoreMissingValues* = -25 ## Peer response contains too much missing data - this can happen either ## because a long reorg happened or the peer is falsely trying to convince