Skip to content

Commit

Permalink
Decrease peer reputation on request timeouts and decode errors (#1574)
Browse files Browse the repository at this point in the history
Closes #1345. Closes #1346 Closes #1350.

This PR stops discarding request errors from libp2p, and instead returns
them to the sender of the request. Also penalizes peers for sending
invalid responses or for not replying at all.

Making penalty configurable should be a follow-up PR, as there are other
penalties that should be configurable as well

TODO:
- [x] Make timeout configutable: Already seems to be case on master
branch
- [x] Add tests
- [x] Fix current tests that for some reason don't terminate

---------

Co-authored-by: xgreenx <xgreenx9999@gmail.com>
  • Loading branch information
Dentosal and xgreenx authored Feb 5, 2024
1 parent bf14cc9 commit a33a100
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 81 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Description of the upcoming release here.
- [#1585](https://github.com/FuelLabs/fuel-core/pull/1585): Let `NetworkBehaviour` macro generate `FuelBehaviorEvent` in p2p
- [#1579](https://github.com/FuelLabs/fuel-core/pull/1579): The change extracts the off-chain-related logic from the executor and moves it to the GraphQL off-chain worker. It creates two new concepts - Off-chain and On-chain databases where the GraphQL worker has exclusive ownership of the database and may modify it without intersecting with the On-chain database.
- [#1577](https://github.com/FuelLabs/fuel-core/pull/1577): Moved insertion of sealed blocks into the `BlockImporter` instead of the executor.
- [#1574](https://github.com/FuelLabs/fuel-core/pull/1574): Penalizes peers for sending invalid responses or for not replying at all.
- [#1601](https://github.com/FuelLabs/fuel-core/pull/1601): Fix formatting in docs and check that `cargo doc` passes in the CI.
- [#1636](https://github.com/FuelLabs/fuel-core/pull/1636): Add more docs to GraphQL DAP API.

Expand Down
2 changes: 1 addition & 1 deletion crates/services/p2p/src/behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl FuelBehaviour {
Ok(true) => {
tracing::debug!(target: "fuel-p2p", "Sent a report for MessageId: {} from PeerId: {}", msg_id, propagation_source);
if should_check_score {
return self.gossipsub.peer_score(propagation_source)
return self.gossipsub.peer_score(propagation_source);
}
}
Ok(false) => {
Expand Down
Loading

0 comments on commit a33a100

Please sign in to comment.