diff --git a/.github/workflows/cc.yml b/.github/workflows/cc.yml index e3edb80..56b0915 100644 --- a/.github/workflows/cc.yml +++ b/.github/workflows/cc.yml @@ -36,9 +36,7 @@ jobs: override: true - name: Run unittest - # Disable --all-features to avoid CI failure when download dependent lib (via yarn) for contract compilation. - # run: cargo test --all-features --no-fail-fast - run: cargo test --no-fail-fast + run: cargo test --all-features --no-fail-fast env: CARGO_INCREMENTAL: '0' RUSTC_BOOTSTRAP: '1' diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0de5ec5..792c2c1 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -96,4 +96,5 @@ jobs: - name: Run cargo clippy uses: actions-rs/cargo@v1 with: - command: clippy \ No newline at end of file + command: clippy + args: -- -D warnings \ No newline at end of file diff --git a/common/contract-interface/build.rs b/common/contract-interface/build.rs index 0d405ff..93043a6 100644 --- a/common/contract-interface/build.rs +++ b/common/contract-interface/build.rs @@ -1,30 +1,30 @@ -use std::process::Command; +// use std::process::Command; -const INSTALL_ERROR_MESSAGE: &str = - "Install dependencies for contract fail, try to run `yarn` in folder 'zerog-storage-contracts'"; -const COMPILE_ERROR_MESSAGE: &str = - "Compile solidity contracts fail, try to run `yarn compile` in folder 'zerog-storage-contracts'"; +// const INSTALL_ERROR_MESSAGE: &str = +// "Install dependencies for contract fail, try to run `yarn` in folder 'zerog-storage-contracts'"; +// const COMPILE_ERROR_MESSAGE: &str = +// "Compile solidity contracts fail, try to run `yarn compile` in folder 'zerog-storage-contracts'"; fn main() { - if cfg!(feature = "compile-contracts") { - println!("cargo:rerun-if-changed=../../zerog-storage-contracts/contracts/"); - println!("cargo:rerun-if-changed=../../zerog-storage-contracts/hardhat.config.ts"); + // if cfg!(feature = "compile-contracts") { + // println!("cargo:rerun-if-changed=../../zerog-storage-contracts/contracts/"); + // println!("cargo:rerun-if-changed=../../zerog-storage-contracts/hardhat.config.ts"); - let output = Command::new("yarn") - .arg("--cwd") - .arg("../../zerog-storage-contracts") - .status() - .expect(INSTALL_ERROR_MESSAGE); - assert!(output.success(), "{}", INSTALL_ERROR_MESSAGE); + // let output = Command::new("yarn") + // .arg("--cwd") + // .arg("../../zerog-storage-contracts") + // .status() + // .expect(INSTALL_ERROR_MESSAGE); + // assert!(output.success(), "{}", INSTALL_ERROR_MESSAGE); - let output = Command::new("yarn") - .arg("--cwd") - .arg("../../zerog-storage-contracts") - .arg("compile") - .status() - .expect(COMPILE_ERROR_MESSAGE); - assert!(output.success(), "{}", COMPILE_ERROR_MESSAGE); - } else { - println!("cargo:rerun-if-changed=../../zerog-storage-contracts/artifacts/"); - } + // let output = Command::new("yarn") + // .arg("--cwd") + // .arg("../../zerog-storage-contracts") + // .arg("compile") + // .status() + // .expect(COMPILE_ERROR_MESSAGE); + // assert!(output.success(), "{}", COMPILE_ERROR_MESSAGE); + // } else { + // println!("cargo:rerun-if-changed=../../zerog-storage-contracts/artifacts/"); + // } } diff --git a/node/network/src/discovery/enr.rs b/node/network/src/discovery/enr.rs index 1e661c3..a9dfde7 100644 --- a/node/network/src/discovery/enr.rs +++ b/node/network/src/discovery/enr.rs @@ -1,6 +1,6 @@ //! Helper functions and an extension trait for Ethereum 2 ENRs. -pub use discv5::enr::{self, CombinedKey, EnrBuilder}; +pub use discv5::enr::{CombinedKey, EnrBuilder}; use super::enr_ext::CombinedKeyExt; use super::ENR_FILENAME; diff --git a/node/router/src/libp2p_event_handler.rs b/node/router/src/libp2p_event_handler.rs index 3f71ba3..bbd5347 100644 --- a/node/router/src/libp2p_event_handler.rs +++ b/node/router/src/libp2p_event_handler.rs @@ -24,7 +24,7 @@ lazy_static::lazy_static! { } fn duration_since(timestamp: u32) -> chrono::Duration { - let timestamp = i64::try_from(timestamp).expect("Should fit"); + let timestamp = i64::from(timestamp); let timestamp = chrono::NaiveDateTime::from_timestamp_opt(timestamp, 0).expect("should fit"); let now = chrono::Utc::now().naive_utc(); now.signed_duration_since(timestamp) diff --git a/node/src/client/mod.rs b/node/src/client/mod.rs index 4074b04..3f9892a 100644 --- a/node/src/client/mod.rs +++ b/node/src/client/mod.rs @@ -7,7 +7,7 @@ use network::{Enr, Multiaddr, NetworkGlobals}; use std::sync::Arc; pub use builder::ClientBuilder; -pub use environment::{Environment, EnvironmentBuilder, RuntimeContext}; +pub use environment::{EnvironmentBuilder, RuntimeContext}; /// The core Zgs client. /// diff --git a/rust-toolchain b/rust-toolchain index 5e3a425..7c7053a 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.73.0 +1.75.0 diff --git a/rustlint.sh b/rustlint.sh new file mode 100644 index 0000000..e380d29 --- /dev/null +++ b/rustlint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# keep consistent with CI-lint in rust.yml +cargo fmt --all +cargo clippy -- -D warnings diff --git a/version-meld/discv5/src/kbucket/entry.rs b/version-meld/discv5/src/kbucket/entry.rs index e978613..0dfc739 100644 --- a/version-meld/discv5/src/kbucket/entry.rs +++ b/version-meld/discv5/src/kbucket/entry.rs @@ -26,7 +26,7 @@ pub use super::{ bucket::{ - AppliedPending, ConnectionState, InsertResult, Node, NodeStatus, MAX_NODES_PER_BUCKET, + AppliedPending, ConnectionState, InsertResult, Node, NodeStatus, }, key::*, ConnectionDirection,