Skip to content

Commit

Permalink
Move reputation module to reth-network-p2p
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane committed Aug 1, 2024
1 parent 321032f commit 34e2ef8
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/net/network-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ workspace = true
# reth
reth-network-peers.workspace = true
reth-net-banlist.workspace = true
reth-network-p2p.workspace = true

# io
serde = { workspace = true, optional = true }
Expand All @@ -25,5 +26,5 @@ serde_json = { workspace = true }
tracing.workspace = true

[features]
serde = ["dep:serde", "dep:humantime-serde"]
serde = ["dep:serde", "dep:humantime-serde", "reth-network-p2p/serde"]
test-utils = []
7 changes: 3 additions & 4 deletions crates/net/network-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@

/// Types related to peering.
pub mod peers;
pub use peers::{
reputation::{Reputation, ReputationChangeKind, ReputationChangeWeights},
ConnectionsConfig, PeersConfig,
};
pub use peers::{ConnectionsConfig, PeersConfig};

pub mod session;
pub use session::{SessionLimits, SessionsConfig};

/// [`BackoffKind`] definition.
mod backoff;
pub use backoff::BackoffKind;

pub use reth_network_p2p::reputation::{Reputation, ReputationChangeKind, ReputationChangeWeights};
6 changes: 3 additions & 3 deletions crates/net/network-types/src/peers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod reputation;
pub use reputation::ReputationChangeWeights;

pub mod config;

pub use reth_network_p2p::reputation;

pub use config::{ConnectionsConfig, PeersConfig};
5 changes: 4 additions & 1 deletion crates/net/p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ reth-eth-wire-types.workspace = true
reth-consensus.workspace = true
reth-network-peers.workspace = true
reth-storage-errors.workspace = true
reth-network-types.workspace = true

# io
serde = { workspace = true, optional = true }

# async
futures.workspace = true
Expand All @@ -38,3 +40,4 @@ tokio = { workspace = true, features = ["full"] }

[features]
test-utils = ["reth-consensus/test-utils", "parking_lot"]
serde = ["dep:serde"]
8 changes: 5 additions & 3 deletions crates/net/p2p/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
use super::headers::client::HeadersRequest;
use std::ops::RangeInclusive;

use reth_consensus::ConsensusError;
use reth_network_peers::WithPeerId;
use reth_network_types::ReputationChangeKind;
use reth_primitives::{
BlockHashOrNumber, BlockNumber, GotExpected, GotExpectedBoxed, Header, B256,
};
use reth_storage_errors::{db::DatabaseError, provider::ProviderError};
use std::ops::RangeInclusive;
use thiserror::Error;
use tokio::sync::{mpsc, oneshot};

use super::headers::client::HeadersRequest;
use crate::ReputationChangeKind;

/// Result alias for result of a request.
pub type RequestResult<T> = Result<T, RequestError>;

Expand Down
4 changes: 4 additions & 0 deletions crates/net/p2p/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ pub mod sync;
/// Common test helpers for mocking out Consensus, Downloaders and Header Clients.
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;

pub mod reputation;

pub use reputation::{Reputation, ReputationChange, ReputationChangeKind, ReputationChangeWeights};
File renamed without changes.

0 comments on commit 34e2ef8

Please sign in to comment.