Skip to content

Commit

Permalink
Merge separate out crypto tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed Nov 30, 2023
1 parent b6f1b08 commit 49ffd9c
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 11 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/test_crypto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Crypto tests

on:
push:
branches:
- 'develop'
- 'main'
pull_request:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
strategy:
matrix:
just_variants:
- async_std
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout Repository

- run: rustup toolchain install stable --profile minimal

- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching
with:
shared-key: ""
prefix-key: ${{ matrix.just_variants }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- name: Unit and integration tests for all crates in workspace
run: |
just ${{ matrix.just_variants }} test_crypto
timeout-minutes: 60
env:
RUST_BACKTRACE: full
2 changes: 1 addition & 1 deletion crates/hotshot-qc/src/bit_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ mod tests {
};
}
#[test]
fn test_quorum_certificate() {
fn crypto_test_quorum_certificate() {
test_quorum_certificate!(BLSOverBN254CurveSignatureScheme);
}
}
2 changes: 1 addition & 1 deletion crates/hotshot-qc/src/bit_vector_old.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ mod tests {
};
}
#[test]
fn test_quorum_certificate() {
fn crypto_test_quorum_certificate() {
test_quorum_certificate!(BLSOverBN254CurveSignatureScheme);
}
}
4 changes: 2 additions & 2 deletions crates/hotshot-qc/src/snarked/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ mod tests {
};

#[test]
fn test_vk_aggregate_sw_circuit() -> Result<(), CircuitError> {
fn crypto_test_vk_aggregate_sw_circuit() -> Result<(), CircuitError> {
let a_ecc = Fq377::zero();
test_vk_aggregate_sw_circuit_helper::<Fq377, Fr254, Param377>(a_ecc)?;
let a_ecc = Fq254::zero();
Expand Down Expand Up @@ -440,7 +440,7 @@ mod tests {
}

#[test]
fn test_vk_aggregate_te_circuit() -> Result<(), CircuitError> {
fn crypto_test_vk_aggregate_te_circuit() -> Result<(), CircuitError> {
let d_ecc : Fq377 = MontFp!("122268283598675559488486339158635529096981886914877139579534153582033676785385790730042363341236035746924960903179");
test_vk_aggregate_te_circuit_helper::<Fq377, Fr254, Param377>(d_ecc)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hotshot-stake-table/src/mt_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ mod tests {
type Key = ark_bn254::Fq;

#[test]
fn test_stake_table() -> Result<(), StakeTableError> {
fn crypto_test_stake_table() -> Result<(), StakeTableError> {
let mut st = StakeTable::<Key>::new(3);
let keys = (0..10).map(Key::from).collect::<Vec<_>>();
assert_eq!(st.total_stake(SnapshotVersion::Head)?, U256::from(0));
Expand Down
4 changes: 2 additions & 2 deletions crates/hotshot-stake-table/src/mt_based/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ mod tests {
type Key = ark_bn254::Fq;

#[test]
fn test_persistent_merkle_tree() {
fn crypto_test_persistent_merkle_tree() {
let height = 3;
let mut roots = vec![Arc::new(PersistentMerkleNode::<Key>::Empty)];
let path = (0..10)
Expand Down Expand Up @@ -712,7 +712,7 @@ mod tests {
}

#[test]
fn test_mt_iter() {
fn crypto_test_mt_iter() {
let height = 3;
let capacity = config::TREE_BRANCH.pow(height);
let mut rng = test_rng();
Expand Down
2 changes: 1 addition & 1 deletion crates/hotshot-stake-table/src/vec_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ mod tests {
use jf_primitives::signatures::{SchnorrSignatureScheme, SignatureScheme};

#[test]
fn test_stake_table() -> Result<(), StakeTableError> {
fn crypto_test_stake_table() -> Result<(), StakeTableError> {
let mut st = StakeTable::<BLSVerKey, SchnorrVerKey, F>::new();
let mut prng = jf_utils::test_rng();
let keys = (0..10)
Expand Down
2 changes: 1 addition & 1 deletion crates/hotshot-state-prover/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ mod tests {
type F = ark_ed_on_bn254::Fq;

#[test]
fn test_circuit_building() {
fn crypto_test_circuit_building() {
let num_validators = 10;
let mut prng = test_rng();

Expand Down
2 changes: 1 addition & 1 deletion crates/hotshot-state-prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ mod tests {
}

#[test]
fn test_proof_generation() {
fn crypto_test_proof_generation() {
let num_validators = 10;
let mut prng = test_rng();

Expand Down
1 change: 1 addition & 0 deletions crates/testing/tests/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ async fn test_timeout_web() {
tokio::test(flavor = "multi_thread", worker_threads = 2)
)]
#[cfg_attr(async_executor_impl = "async-std", async_std::test)]
#[ignore]
async fn test_timeout_libp2p() {
use std::time::Duration;

Expand Down
5 changes: 4 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ example *ARGS:

test:
echo Testing
cargo test --verbose --lib --bins --tests --benches --workspace --no-fail-fast -- --test-threads=1 --nocapture
cargo test --verbose --lib --bins --tests --benches --workspace --no-fail-fast -- --test-threads=1 --nocapture --skip crypto_test

test_basic: test_success test_with_failures test_network_task test_consensus_task test_da_task test_vid_task test_view_sync_task

test_catchup:
echo Testing with async std executor
ASYNC_STD_THREAD_COUNT=1 cargo test --lib --bins --tests --benches --workspace --no-fail-fast test_catchup -- --test-threads=1 --nocapture

test_crypto:
ASYNC_STD_THREAD_COUNT=1 cargo test --lib --bins --tests --benches --workspace --no-fail-fast crypto_test -- --test-threads=1 --nocapture

test_success:
echo Testing success test
ASYNC_STD_THREAD_COUNT=1 cargo test --lib --bins --tests --benches --workspace --no-fail-fast test_success -- --test-threads=1 --nocapture
Expand Down

0 comments on commit 49ffd9c

Please sign in to comment.