made logging more verbose

This commit is contained in:
Agnish Ghosh 2024-11-12 11:51:49 +07:00
parent fae0079f94
commit 73dba1057f
No known key found for this signature in database
GPG Key ID: 7BDDA05D1B25E9F8
2 changed files with 33 additions and 3 deletions

View File

@ -449,9 +449,39 @@ func getScore*(a: Peer): int =
## Returns current score value for peer ``peer``. ## Returns current score value for peer ``peer``.
a.score a.score
func updateScore*(peer: Peer, score: int) {.inline.} = proc updateScore*(peer: Peer, score: int) =
## Update peer's ``peer`` score with value ``score``. ## Update peer's ``peer`` score with value ``score``.
peer.score = peer.score + 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: if peer.score > PeerScoreHighLimit:
peer.score = PeerScoreHighLimit peer.score = PeerScoreHighLimit

View File

@ -36,10 +36,10 @@ const
PeerScoreBadValues* = -1000 PeerScoreBadValues* = -1000
## Peer's response contains incorrect data. ## Peer's response contains incorrect data.
PeerScoreBadResponse* = -1000 PeerScoreBadResponse* = -1000
## Peer's response is not in requested range.
PeerScoreBadColumns* = -100000
## Peer's column responses are invalid ## Peer's column responses are invalid
## Specifically a peerdas devnet setting ## Specifically a peerdas devnet setting
PeerScoreBadColumns* = -100000
## Peer's response is not in requested range.
PeerScoreMissingValues* = -25 PeerScoreMissingValues* = -25
## Peer response contains too much missing data - this can happen either ## Peer response contains too much missing data - this can happen either
## because a long reorg happened or the peer is falsely trying to convince ## because a long reorg happened or the peer is falsely trying to convince