Skip to content

Commit bb9fc39

Browse files
committed
Make Trin compilable on Windows
1 parent 021e171 commit bb9fc39

File tree

9 files changed

+134
-129
lines changed

9 files changed

+134
-129
lines changed

Cargo.lock

+109-120
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ parking_lot = "0.11.2"
2424
portalnet = { path = "portalnet" }
2525
prometheus_exporter = "0.8.4"
2626
rand = "0.8.4"
27-
reth-ipc = { version = "0.1.0", git = "https://github.com/paradigmxyz/reth.git"}
2827
rlp = "0.5.0"
2928
rocksdb = "0.18.0"
3029
rpc = { path = "rpc"}
@@ -41,6 +40,9 @@ trin-utils = { path = "trin-utils" }
4140
trin-validation = { path = "trin-validation" }
4241
utp-rs = "0.1.0-alpha.4"
4342

43+
[target.'cfg(not(windows))'.dependencies]
44+
reth-ipc = { version = "0.1.0", git = "https://github.com/paradigmxyz/reth.git"}
45+
4446
[dev-dependencies]
4547
ethportal-peertest = { path = "ethportal-peertest" }
4648
ureq = { version = "2.5.0", features = ["json"] }

ethportal-peertest/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ hex = "0.4.3"
2222
hyper = { version = "0.14", features = ["full"] }
2323
jsonrpsee = {version="0.16.2", features = ["async-client", "client", "macros", "server"]}
2424
rand = "0.8.4"
25-
reth-ipc = { version = "0.1.0", git = "https://github.com/paradigmxyz/reth.git"}
25+
2626
rocksdb = "0.18.0"
2727
serde_json = "1.0.89"
2828
tempfile = "3.3.0"
@@ -36,5 +36,5 @@ trin-state = { path = "../trin-state" }
3636
trin-utils = { path = "../trin-utils" }
3737
ureq = { version = "2.5.0", features = ["json"] }
3838

39-
[target.'cfg(windows)'.dependencies]
40-
uds_windows = "1.0.1"
39+
[target.'cfg(not(windows))'.dependencies]
40+
reth-ipc = { version = "0.1.0", git = "https://github.com/paradigmxyz/reth.git"}

ethportal-peertest/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg(unix)]
12
pub mod constants;
23
pub mod scenarios;
34

newsfragments/739.fixed.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### fix windows compilation
2+
3+
add cfg and add a few panics to clearly define what is not supported by windows so it can compile

portalnet/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ validator = { version = "0.13.0", features = ["derive"] }
4949
url = "2.3.1"
5050
utp-rs = "0.1.0-alpha.4"
5151

52-
[target.'cfg(windows)'.dependencies]
53-
uds_windows = "1.0.1"
54-
5552
[dev-dependencies]
5653
env_logger = "0.9.0"
5754
quickcheck = "1.0.3"

rpc/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ ethportal-api = { path = "../ethportal-api"}
1616
portalnet = { path = "../portalnet"}
1717
trin-utils = { path = "../trin-utils"}
1818
tokio = { version = "1.14.0", features = ["full"] }
19-
reth-ipc = { version = "0.1.0", git = "https://github.com/paradigmxyz/reth.git"}
2019
url = "2.3.1"
2120
serde_json = "1.0.95"
21+
22+
[target.'cfg(not(windows))'.dependencies]
23+
reth-ipc = { version = "0.1.0", git = "https://github.com/paradigmxyz/reth.git"}

rpc/src/server_rpc.rs

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::{Discv5Api, HistoryNetworkApi, Web3Api};
33
use ethportal_api::types::jsonrpc::request::HistoryJsonRpcRequest;
44
use ethportal_api::{Discv5ApiServer, HistoryNetworkApiServer, Web3ApiServer};
55
use portalnet::discovery::Discovery;
6+
#[cfg(unix)]
67
use reth_ipc::server::Builder as IpcServerBuilder;
78
use std::net::SocketAddr;
89
use std::path::Path;
@@ -31,6 +32,7 @@ impl JsonRpcServer {
3132
Ok(handle)
3233
}
3334

35+
#[cfg(unix)]
3436
pub async fn run_ipc(
3537
ipc_path: Box<dyn AsRef<Path>>,
3638
discv5: Arc<Discovery>,
@@ -46,4 +48,13 @@ impl JsonRpcServer {
4648
let handle = server.start(api).await?;
4749
Ok(handle)
4850
}
51+
52+
#[cfg(windows)]
53+
pub async fn run_ipc(
54+
_ipc_path: Box<dyn AsRef<Path>>,
55+
_discv5: Arc<Discovery>,
56+
_history_handler: mpsc::UnboundedSender<HistoryJsonRpcRequest>,
57+
) -> anyhow::Result<ServerHandle> {
58+
panic!("Windows doesn't support Unix Domain Sockets IPC, use --web3-transport http")
59+
}
4960
}

tests/self_peertest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(test)]
1+
#[cfg(all(unix, test))]
22
mod test {
33
use std::{
44
net::{IpAddr, Ipv4Addr},

0 commit comments

Comments
 (0)