Skip to content

Commit

Permalink
Add miri to github ci (#72)
Browse files Browse the repository at this point in the history
* Add miri to github ci

* Fix test errors

* Decrease test matrix size for miri

* Use random for testing `nbyte_add_mod`

* Revert "Use random for testing `nbyte_add_mod`"

This reverts commit 51a9ef3.

* Assign target packages for miri test

* Reduce test sizes for miri

* Test miri for both x86_64 and aarch64
  • Loading branch information
000wan authored Oct 2, 2023
1 parent 1f2c922 commit 5f07a24
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ jobs:
# RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --workspace --lib --document-private-items --examples

miri:
if: ( ! github.event.pull_request.draft )
name: "Miri"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Miri
run: |
rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup
- name: Test with Miri on x86_64
run: cargo miri test -p clmul -p matrix-transpose --target x86_64-unknown-linux-gnu

- name: Test with Miri on aarch64
run: cargo miri test -p clmul -p matrix-transpose --target aarch64-unknown-linux-gnu

rustfmt_and_clippy:
name: Rustfmt and Clippy
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions clmul/src/backend/clmul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ mod tests {

#[test]
fn test_against_emptool_impl() {
if !is_x86_feature_detected!("pclmulqdq") {
return;
}

let mut rng = ChaCha12Rng::from_seed([0; 32]);
let a: [u8; 16] = rng.gen();
let b: [u8; 16] = rng.gen();
Expand Down
12 changes: 6 additions & 6 deletions matrix-transpose/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ mod tests {

#[test]
fn test_transpose_bits() {
let rows = 512;
let columns = 256;
let rows = 64;
let columns = 32;

let mut matrix: Vec<u8> = random_vec::<u8>(columns * rows);
let naive = transpose_naive(&matrix, columns);
Expand Down Expand Up @@ -154,9 +154,9 @@ mod tests {

#[test]
fn test_transpose() {
let rounds = 7_u32;
let rounds = 6_u32;
let mut rows = 2_usize.pow(rounds);
let mut columns = 64;
let mut columns = 32;

let mut matrix: Vec<u8> = random_vec::<u8>(columns * rows);
let original = matrix.clone();
Expand All @@ -177,8 +177,8 @@ mod tests {

#[test]
fn test_bitmask_shift() {
let columns = 64;
let rows = 128;
let columns = 32;
let rows = 64;

let mut matrix: Vec<u8> = random_vec::<u8>(columns * rows);
let mut original = matrix.clone();
Expand Down
2 changes: 1 addition & 1 deletion ot/mpz-ot/src/kos/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ where
let actual_delta = <[u8; 16]>::from_lsb0_iter(choices).into();

if expected_delta != actual_delta {
return Err(ReceiverVerifyError::InconsistentDelta).map_err(ReceiverError::from)?;
return Err(ReceiverError::from(ReceiverVerifyError::InconsistentDelta));
}

self.state = State::Verify(receiver.start_verification(actual_delta)?);
Expand Down

0 comments on commit 5f07a24

Please sign in to comment.