Skip to content
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

feat: feature gate tokio::net lookup #9289

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/net/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ reth-storage-api.workspace = true
reth-provider = { workspace = true, optional = true }
reth-tokio-util.workspace = true
reth-consensus.workspace = true
reth-network-peers.workspace = true
reth-network-peers = { workspace = true, features = ["net"] }
reth-network-types.workspace = true

# ethereum
Expand Down
4 changes: 3 additions & 1 deletion crates/net/peers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ secp256k1 = { workspace = true, optional = true }
serde_with.workspace = true
thiserror.workspace = true
url.workspace = true
tokio = { workspace = true, features = ["full"] }
tokio = { workspace = true, optional = true }

[dev-dependencies]
alloy-primitives = { workspace = true, features = ["rand"] }
rand.workspace = true
secp256k1 = { workspace = true, features = ["rand"] }
serde_json.workspace = true
tokio = { workspace = true, features = ["net", "macros", "rt"] }

[features]
secp256k1 = ["dep:secp256k1", "enr/secp256k1"]
net = ["dep:tokio", "tokio?/net"]
emhane marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions crates/net/peers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
//! - [`TrustedPeer`]: A [`NodeRecord`] with an optional domain name, which can be resolved to a
//! [`NodeRecord`]. Useful for adding trusted peers at startup, whose IP address may not be
//! static.
//!
//!
//! ## Feature Flags
//!
//! - `net`: Support for address lookups.

#![doc(
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
Expand Down
1 change: 1 addition & 0 deletions crates/net/peers/src/trusted_peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl TrustedPeer {
}

/// Resolves the host in a [`TrustedPeer`] to an IP address, returning a [`NodeRecord`].
#[cfg(any(test, feature = "net"))]
pub async fn resolve(&self) -> Result<NodeRecord, Error> {
let domain = match self.try_node_record() {
Ok(record) => return Ok(record),
Expand Down
Loading