Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
Make tests run in no-std as well (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare authored Feb 27, 2024
1 parent 5622087 commit 1994592
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ jobs:
command: test
args: --verbose --release --all

test_no_std:
name: Test on ${{ matrix.os }} (no-std)
runs-on: ${{ matrix.os }}
strategy:
matrix:
toolchain: [stable]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@main
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{matrix.toolchain}}
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all --no-default-features

build:
name: Build target ${{ matrix.target }}
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 0 additions & 2 deletions src/ciphersuite.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! The ciphersuite module to parameterize ICE-FROST sessions.

use core::fmt::Debug;
#[cfg(not(feature = "std"))]
use core::marker::{Send, Sync};

use aead::{Aead, KeyInit};
use zeroize::Zeroize;
Expand Down
3 changes: 0 additions & 3 deletions src/dkg/secret_share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ use crate::serialization::impl_serialization_traits;
use crate::utils::{Scalar, ToString, Vec};
use crate::{Error, FrostResult};

#[cfg(not(feature = "std"))]
use alloc::vec;

use crate::ciphersuite::CipherSuite;

use ark_ec::{CurveGroup, Group};
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1597,11 +1597,12 @@
#![warn(future_incompatible)]
#![allow(clippy::type_complexity)]

#[cfg(any(test, feature = "std"))]
#[cfg(feature = "std")]
#[macro_use]
extern crate std;

#[cfg(not(feature = "std"))]
#[macro_use]
extern crate alloc;

pub(crate) const HASH_SEC_PARAM: usize = 128;
Expand Down
10 changes: 2 additions & 8 deletions src/sign/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,6 @@ mod test {
let threshold_signature = signing_result.unwrap();
let verification_result = threshold_signature.verify(&group_key, &message_hash);

println!("{:?}", verification_result);

assert!(verification_result.is_ok());
}

Expand Down Expand Up @@ -1189,7 +1187,7 @@ mod test {
let threshold_signature = signing_result.unwrap();
let verification_result = threshold_signature.verify(&group_key, &message_hash);

println!("Dealer's signing session: {:?}", verification_result);
assert!(verification_result.is_ok());

let message = b"This is a test of the tsunami alert system. This is only a test.";
let (s1_public_comshares, mut s1_secret_comshares) =
Expand Down Expand Up @@ -1235,8 +1233,6 @@ mod test {
let threshold_signature = signing_result.unwrap();
let verification_result = threshold_signature.verify(&group_key, &message_hash);

println!("Signers's signing session: {:?}", verification_result);

assert!(verification_result.is_ok());
} else {
panic!("Invalid DKG")
Expand Down Expand Up @@ -1304,7 +1300,7 @@ mod test {
let threshold_signature = signing_result.unwrap();
let verification_result = threshold_signature.verify(&group_key, &message_hash);

println!("Dealer's signing session: {:?}", verification_result);
assert!(verification_result.is_ok());

let message = b"This is a test of the tsunami alert system. This is only a test.";
let (s1_public_comshares, mut s1_secret_comshares) =
Expand Down Expand Up @@ -1363,8 +1359,6 @@ mod test {
let threshold_signature = signing_result.unwrap();
let verification_result = threshold_signature.verify(&group_key, &message_hash);

println!("Signers's signing session: {:?}", verification_result);

assert!(verification_result.is_ok());
} else {
panic!("Invalid DKG")
Expand Down

0 comments on commit 1994592

Please sign in to comment.