diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbd4438e..554b2c10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,9 +60,14 @@ jobs: - nightly-2025-12-11 steps: - uses: actions/checkout@v5 + - name: Install Ziren toolchain + run: curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/ProjectZKM/toolchain/refs/heads/main/setup.sh | sh - name: Install Dependencies run: sudo apt update && sudo apt install protobuf-compiler - name: Launch the Regtest run: cd scripts && docker compose up -d - name: Run all unit tests - run: cargo test -r --features tests --all-targets + run: | + set -e + source ~/.zkm-toolchain/env + cargo test -r --all --all-targets diff --git a/.github/workflows/ci_time_consuming.yml b/.github/workflows/ci_time_consuming.yml index c4b96c6d..6be4670d 100644 --- a/.github/workflows/ci_time_consuming.yml +++ b/.github/workflows/ci_time_consuming.yml @@ -2,7 +2,7 @@ name: Time-consuming test on: push: - branches: ["main"] + branches: ["main", "dev"] workflow_dispatch: env: @@ -18,6 +18,4 @@ jobs: - run: | set -e export PATH=$HOME/.cargo/bin:$PATH - cargo test -r e2e_take_1 --features tests --features e2e-tests - cargo test -r e2e_take_2 --features tests --features e2e-tests - cargo test -r e2e_disprove --features tests --features e2e-tests + cargo test -r --all --features ci-tests -- --nocapture diff --git a/crates/bitvm2-ga/Cargo.toml b/crates/bitvm2-ga/Cargo.toml index 6eadf9fa..cfbbd21f 100644 --- a/crates/bitvm2-ga/Cargo.toml +++ b/crates/bitvm2-ga/Cargo.toml @@ -33,3 +33,7 @@ esplora-client = { workspace = true } tokio = { workspace = true, features = ["full"] } bitcoincore-rpc = "0.19" bitcoin-old = { version = "0.31.2", package = "bitcoin" } + +[features] +default = [] +ci-tests = [] \ No newline at end of file diff --git a/crates/bitvm2-ga/src/tests.rs b/crates/bitvm2-ga/src/tests.rs index ee059478..bdbea212 100644 --- a/crates/bitvm2-ga/src/tests.rs +++ b/crates/bitvm2-ga/src/tests.rs @@ -1,6 +1,7 @@ #![allow(dead_code)] #[cfg(test)] +#[cfg(feature = "ci-tests")] mod tests { use crate::{challenger::*, committee::*, keys::*, operator::*, types::*, watchtower::*}; use bitcoin::{ @@ -746,8 +747,9 @@ mod tests { async fn merge_bank_utxo(esplora: &EsploraClient) { // get_address_utxo may fail if there are too many UTXOs (e.g. 500), so we merge them before its too late - println!("merging bank UTXOs"); + println!("merging bank UTXOs, network: {}", network()); let bank_address = node_p2wsh_address(network(), &bank_keypair().public_key().into()); + println!("bank_address: {bank_address}"); let utxos = esplora.get_address_utxo(bank_address.clone()).await.unwrap(); if utxos.len() < 300 { println!("bank UTXOs are not too many {}, no need to merge", utxos.len()); diff --git a/crates/header-chain/src/mmr.rs b/crates/header-chain/src/mmr.rs index 747b7978..0e8a9da2 100644 --- a/crates/header-chain/src/mmr.rs +++ b/crates/header-chain/src/mmr.rs @@ -68,7 +68,7 @@ impl MMRHost { panic!("MMR is empty"); } if self.nodes[0].len() <= index as usize { - panic!("Index {index} out of bounds {}", self.nodes[0].len()); + panic!("Index out of bounds {}, index: {index}", self.nodes[0].len()); } let mut proof: Vec<[u8; 32]> = vec![]; let mut current_index = index; diff --git a/crates/store/src/ipfs.rs b/crates/store/src/ipfs.rs index 81394122..fd3ed74e 100644 --- a/crates/store/src/ipfs.rs +++ b/crates/store/src/ipfs.rs @@ -127,6 +127,7 @@ pub mod tests { use super::*; #[tokio::test] + #[ignore = "IPFS deprecated"] async fn test_ipfs_add_and_get() { println!("connecting to localhost:5001..."); let client = IPFS::new("http://44.229.236.82:5001"); diff --git a/node/Cargo.toml b/node/Cargo.toml index e7fdbc85..46eb55d0 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -110,8 +110,4 @@ store = { workspace = true } client = { workspace = true } bitcoin-light-client-circuit = { workspace = true } commit-chain = { workspace = true } -cbft-rpc = { workspace = true } -[features] -default = [] -tests = [] -e2e-tests = [] +cbft-rpc = { workspace = true } \ No newline at end of file diff --git a/scripts/bitcoin-init.sh b/scripts/bitcoin-init.sh index 632fd2dc..6884b91e 100755 --- a/scripts/bitcoin-init.sh +++ b/scripts/bitcoin-init.sh @@ -38,10 +38,13 @@ $BTC loadwallet $WALLET_NAME $BTC --rpcwallet=$WALLET_NAME walletpassphrase $WALLET_PASSPHRASE 600 -address="bcrt1q7tr8sl50zanztcrps35hakqpe7gmfzedhhnxcspj7n0ks5lyrnhs6m8ewg" +#address="bcrt1q7tr8sl50zanztcrps35hakqpe7gmfzedhhnxcspj7n0ks5lyrnhs6m8ewg" +## For bitvm2-ga tests +address_bitvm2="bcrt1qhnmlpxyxdntekge4u24m4a7yk6elc3zs4v89e7fqja8vagfnrs8sq28cwd" ## fund the address #$BTC --rpcwallet=$WALLET_NAME -generate 101 -$BTC --rpcwallet=$WALLET_NAME sendtoaddress $address 20 +#$BTC --rpcwallet=$WALLET_NAME sendtoaddress $address 20 +$BTC --rpcwallet=$WALLET_NAME -regtest sendtoaddress $address_bitvm2 20 # Install watch apt-get update