diff --git a/.circleci/config.yml b/.circleci/config.yml index d2cd0b775..4b281728e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,6 +42,7 @@ commands: command: sudo apt install clang orbs: rust: circleci/rust@1.6.0 + win: circleci/windows@2.2.0 executors: docker-publisher: environment: @@ -159,6 +160,31 @@ jobs: name: Build Trin workspace command: cargo build --workspace - save-sccache-cache + check-windows: + description: | + Check the crate on Windows (Check will tell us if we can build on Windows without the need to codegen (which is the time consuming part)). + executor: + name: win/default + size: xlarge + environment: + RUSTFLAGS: '-D warnings' + RUST_LOG: 'debug' + steps: + - checkout + - run: + name: Install rustup and clang + # We are installing them at the same time because it is faster + # todo: Remove --ignore-checksums flag + command: choco install rustup.install llvm -y --ignore-checksums + - run: + name: Add target + command: rustup target add x86_64-pc-windows-msvc + - run: + name: Install target toolchain + command: rustup toolchain install stable-x86_64-pc-windows-msvc + - run: + name: Check Trin workspace + command: cargo check --workspace test: description: | Run tests. @@ -259,4 +285,5 @@ workflows: - lint - build - test + - check-windows - utp-test diff --git a/ethportal-peertest/src/lib.rs b/ethportal-peertest/src/lib.rs index 24b889251..053089b2f 100644 --- a/ethportal-peertest/src/lib.rs +++ b/ethportal-peertest/src/lib.rs @@ -1,3 +1,4 @@ +#![cfg(unix)] pub mod constants; pub mod scenarios; pub mod utils; diff --git a/portalnet/src/overlay_service.rs b/portalnet/src/overlay_service.rs index ad4db50d7..9aff3b99c 100644 --- a/portalnet/src/overlay_service.rs +++ b/portalnet/src/overlay_service.rs @@ -1520,7 +1520,7 @@ where Request::PopulatedOffer(offer) => Ok(response_clone .content_keys .iter() - .zip(offer.content_items.into_iter()) + .zip(offer.content_items) .filter(|(is_accepted, _item)| *is_accepted) .map(|(_is_accepted, (_key, val))| val) .collect()), diff --git a/portalnet/src/storage.rs b/portalnet/src/storage.rs index 99911c2d3..e7dd38cc5 100644 --- a/portalnet/src/storage.rs +++ b/portalnet/src/storage.rs @@ -1140,6 +1140,8 @@ pub mod test { // The restarted store should have the same radius as the original assert_eq!(radius, new_storage.radius); + drop(storage); + drop(new_storage); temp_dir.close()?; Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 50cd3cc56..7f5211127 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,8 @@ use tokio::sync::RwLock; use tracing::info; use utp_rs::socket::UtpSocket; +#[cfg(windows)] +use ethportal_api::types::cli::Web3TransportType; use ethportal_api::types::cli::{TrinConfig, BEACON_NETWORK, HISTORY_NETWORK, STATE_NETWORK}; use portalnet::{ discovery::{Discovery, Discv5UdpSocket}, @@ -25,6 +27,13 @@ use trin_validation::{accumulator::MasterAccumulator, oracle::HeaderOracle}; pub async fn run_trin( trin_config: TrinConfig, ) -> Result> { + // Panic early on a windows build that is trying to use IPC, which is unsupported for now + // Make sure not to panic on non-windows configurations. + #[cfg(windows)] + if let Web3TransportType::IPC = trin_config.web3_transport { + panic!("Tokio doesn't support Windows Unix Domain Sockets IPC, use --web3-transport http"); + } + let trin_version = get_trin_version(); info!("Launching Trin: v{trin_version}"); info!(config = %trin_config, "With:"); diff --git a/tests/rpc_server.rs b/tests/rpc_server.rs index 2fb978c4e..d79baa460 100644 --- a/tests/rpc_server.rs +++ b/tests/rpc_server.rs @@ -1,3 +1,4 @@ +#![cfg(unix)] /// Test that a 3rd-party web3 client can understand our JSON-RPC API use std::net::{IpAddr, Ipv4Addr}; diff --git a/tests/self_peertest.rs b/tests/self_peertest.rs index af642b9ef..508aa3622 100644 --- a/tests/self_peertest.rs +++ b/tests/self_peertest.rs @@ -1,3 +1,4 @@ +#![cfg(unix)] use rpc::RpcServerHandle; use std::env; use std::net::{IpAddr, Ipv4Addr};