-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trace gossipsub scores #10
Conversation
Interestingly, the tests happily pass successfully when I try them out locally: (trace-gossipsub-scores)$ go test ./tele
PASS
ok github.com/probe-lab/hermes/tele 0.004s I haven't even changed the existing tests or functions tested. I'll further look into it. |
It seems that the tests are failing due to the 32-bit architecture, which is weird, I restarted the jobs, let's see if they pass. If the problem persists, we can get rid of 32-bit tests. |
@@ -15,7 +15,7 @@ import ( | |||
gcrypto "github.com/ethereum/go-ethereum/crypto" | |||
"github.com/libp2p/go-libp2p" | |||
mplex "github.com/libp2p/go-libp2p-mplex" | |||
"github.com/libp2p/go-libp2p-pubsub" | |||
pubsub "github.com/libp2p/go-libp2p-pubsub" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this alias? I guess this was added automatically. No big deal, just curious 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be an automated behaviour from VS Code, let me check if i can adjust it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, I also use vscode with the Go extension, but I don't get aliases for imports. Do you use a custom format extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be a clean install of code
on manjaro + the go
extension. I'll try it out with the one from the ms-vscode
guys
|
||
// ScoreKeeper is a thread-safe local copy of the score per peer and per copy | ||
// TODO: figure out if this is some sort of info that we want to expose through OpenTelemetry (Still good to have it) | ||
type ScoreKeeper struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This currently has no mechanism to remove peers. It would grow indefinitely over time. It would be great to have a method on ScoreKeeper
that removes peers (and also remove peers when, e.g., we disconnect?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Update()
method should directly swap the entire map
for the one given by the GossipSub Inspect call.
from the spec
Furthermore, the score is retained for some period of time when a peer disconnects, so that malicious peers cannot easily reset their score when it drops to negative and well behaving peers don't lose their status because of a disconnection.
As far as I know, these scores are eventually dropped, so we would just be tracking all the scores available at the GossipSub level. (There seems to be a RetainScore duration after the Disconnection)
…s without blindly follow requested ones
…scores and correct scores
UpdateThere have been some minor changes to the structure of the tool to make the
Previously, the tool would hide some
The tool reported some
The combination of all these three points was a bit tedious to troubleshoot, as a non-correct fork was leading to not having peers in the mesh when testing it locally with a Holesky node, keeping 0 connections open on the advertised network. The wrong decoding of the gossipsub topic was making the service to restart, thus not keeping any score, which was neither configured at the topic level. There are significant changes in the code (apologies for that, I wasn't expecting such extra changes), but this last commit already connects correctly to the local Prysm node in
Let me know if there is any change we would like to apply to the code itself, formatting or style (I haven't been able to fix the auto-fmt of vs-code), although I can manually leave those lines away :) |
d03cfd6
to
47b5de8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks good 👍🏻
We can merge even though the 32-bit tests are failing. Anyway we won't run hermes on a 32-bit arch.
Decription
The current tracing module of the Libp2p host and the GossipSub events includes most of the interactions between
Hermes
and remote peers in the Ethereum network. There is still a relevant point missing to debug, with higher resolution, how GossipSub events (mostlyPRUNES
/DISCONNECTIONS
) relate to thePeerScore
of each peer per topic.Thus, this PR aims to aggregate the periodic export of the
PeerScores
snapshots. This feature was already present in the Lotus + TraceCatcher combo but hasn't landed on Hermes yet.Tasks
PeerScores
(per peer and per topic), and flush them as tracespeerscore
traces are getting correctly flushed and tracked at the AWS kinesis instance