Skip to content

Commit

Permalink
fix build dependency isuse (#12)
Browse files Browse the repository at this point in the history
* fix build dependency isuse

* cargo fmt

* fix lint failure in CI

* update toolchain
  • Loading branch information
boqiu authored Jan 26, 2024
1 parent 7667e02 commit a4abe2b
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 33 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ jobs:
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
command: clippy
args: -- -D warnings
48 changes: 24 additions & 24 deletions common/contract-interface/build.rs
Original file line number Diff line number Diff line change
@@ -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/");
// }
}
2 changes: 1 addition & 1 deletion node/network/src/discovery/enr.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion node/router/src/libp2p_event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion node/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.73.0
1.75.0
5 changes: 5 additions & 0 deletions rustlint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# keep consistent with CI-lint in rust.yml
cargo fmt --all
cargo clippy -- -D warnings
2 changes: 1 addition & 1 deletion version-meld/discv5/src/kbucket/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

pub use super::{
bucket::{
AppliedPending, ConnectionState, InsertResult, Node, NodeStatus, MAX_NODES_PER_BUCKET,
AppliedPending, ConnectionState, InsertResult, Node, NodeStatus,
},
key::*,
ConnectionDirection,
Expand Down

0 comments on commit a4abe2b

Please sign in to comment.