-
Notifications
You must be signed in to change notification settings - Fork 871
Store peer penality records in the PeerDB in PeerInfo #7320
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
base: unstable
Are you sure you want to change the base?
Conversation
I'm planning on writing the tests soon, but I was wondering if there's anything else you all believe I should add? Perhaps some other info that might be useful to store? |
replied on Discord, thanks! |
Apparently I just found out that it should have been into unstable instead of stable, fixed that. |
beacon_node/lighthouse_network/src/peer_manager/peerdb/score.rs
Outdated
Show resolved
Hide resolved
beacon_node/lighthouse_network/src/peer_manager/peerdb/score.rs
Outdated
Show resolved
Hide resolved
beacon_node/lighthouse_network/src/peer_manager/peerdb/score.rs
Outdated
Show resolved
Hide resolved
beacon_node/lighthouse_network/src/peer_manager/peerdb/score.rs
Outdated
Show resolved
Hide resolved
@@ -752,6 +762,32 @@ impl<E: EthSpec> PeerDB<E> { | |||
peer_id | |||
} | |||
|
|||
fn add_penalty_record(&mut self, peer_id: &PeerId, penalty_record: PenaltyRecord) { | |||
let info = self.peers.entry(*peer_id).or_insert_with(|| { | |||
error!(%peer_id, "Adding a penalty record to a non-existant peer"); |
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 can happen in a race condition, not sure if it should be an error log
/// The result of the penalty | ||
pub result: ScoreTransitionResult, | ||
/// The time when the penalty occured in unix millis | ||
pub time_stamp: u128, |
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.
pub time_stamp: u128, | |
pub timestamp_ms: u128, |
All required checks have passed and there are no merge conflicts. This pull request may now be ready for another review. |
Not really, we are waiting for author input |
@dapplion lol yep, mergify automation rules have been updated now, thanks |
Issue Addressed
#7245
Proposed Changes
Added records regarding penalty actions to the peer info. The chosen details saved to the record seem to be the most
relevant ones from my knowledge, however I'm open to changes.
Additional Info
This is still a WIP. I'll try to test and fully validate that the changes work as expected sometime tomorrow. I'll also see if I can add some test cases as well.