diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index 7215344be..d1168a067 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -63,7 +63,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: make - args: fmt-check-selected-packages + args: fmt - name: Run clippy uses: actions-rs/cargo@v1 @@ -71,5 +71,5 @@ jobs: TARGET: ${{ matrix.target }} with: command: make - args: clippy-check-selected-packages + args: clippy diff --git a/Makefile.toml b/Makefile.toml index 60864bade..405844b1c 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -2,27 +2,50 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true CORE = { script = ["grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}'"] } RAYON_NUM_THREADS = "${CORE}" +CUR_TARGET = { script = [ + ''' + if [ -z "${TARGET}" ]; then + TARGET=$(rustc -vV | grep "host" | awk '{print $2}') + echo "${TARGET}" + else + echo "${TARGET}" + fi + ''' +]} +TASK_RUN = { script = [ + ''' + #!/bin/bash + exclude_projects=" singer-pro ceno_rt " # NOTE:keep leading and end with one space + + if echo "$exclude_projects" | grep -q -E "( )${CARGO_MAKE_CRATE_NAME}( )"; then + echo "false" + else + echo "true" + fi + ''' +]} [tasks.tests] +condition = { env_true = ["TASK_RUN"] } command = "cargo" -args = ["test", "--lib", "--release", "--target", "${TARGET}", "--workspace", "--exclude", "singer-pro", "--exclude", "ceno_rt"] +args = ["test", "--lib", "--release", "--target", "${CUR_TARGET}", "-p", "${CARGO_MAKE_CRATE_NAME}"] -[tasks.fmt-check] +[tasks.fmt-all-check] command = "cargo" args = ["fmt", "--all", "--", "--check"] -[tasks.fmt] +[tasks.fmt-all] command = "cargo" args = ["fmt", "--all"] -[tasks.clippy] +[tasks.clippy-all] command = "cargo" args = ["clippy", "--all-features", "--all-targets", "--", "-D", "warnings"] -[tasks.fmt-check-selected-packages] +[tasks.fmt] command = "cargo" args = ["fmt", "-p", "ceno_zkvm", "--", "--check"] -[tasks.clippy-check-selected-packages] +[tasks.clippy] command = "cargo" -args = ["clippy", "-p", "ceno_zkvm", "--target", "${TARGET}", "--", "-D", "warnings"] +args = ["clippy", "-p", "ceno_zkvm", "-p", "mpcs", "-p", "ceno_emul", "-p", "ceno_rt", "--target", "${CUR_TARGET}", "--", "-D", "warnings"] diff --git a/ceno_emul/src/rv32im.rs b/ceno_emul/src/rv32im.rs index 86c7c71cb..42a97a27d 100644 --- a/ceno_emul/src/rv32im.rs +++ b/ceno_emul/src/rv32im.rs @@ -377,6 +377,7 @@ impl DecodedInstruction { #[cfg(test)] #[test] +#[allow(clippy::identity_op)] fn test_decode_imm() { for (i, expected) in [ // Example of I-type: ADDI. diff --git a/ceno_emul/tests/test_vm_trace.rs b/ceno_emul/tests/test_vm_trace.rs index 86cb7420b..06fb4203a 100644 --- a/ceno_emul/tests/test_vm_trace.rs +++ b/ceno_emul/tests/test_vm_trace.rs @@ -1,3 +1,4 @@ +#![allow(clippy::unusual_byte_groupings)] use anyhow::Result; use std::collections::HashMap; diff --git a/ceno_rt/src/io.rs b/ceno_rt/src/io.rs index 61636e233..3b0e0205b 100644 --- a/ceno_rt/src/io.rs +++ b/ceno_rt/src/io.rs @@ -23,6 +23,9 @@ impl IOWriter { } } + // TODO docs on why design mut_from_ref + // or justify this convention by citing from other place + #[allow(clippy::mut_from_ref)] pub fn alloc(&self, count: usize) -> &mut [T] { let byte_len = count * size_of::(); let word_len = byte_len.div_ceil(WORD_SIZE); diff --git a/ceno_rt/src/lib.rs b/ceno_rt/src/lib.rs index a79ebefb8..03bb27a91 100644 --- a/ceno_rt/src/lib.rs +++ b/ceno_rt/src/lib.rs @@ -21,6 +21,7 @@ mod panic_handler { } } +#[allow(asm_sub_register)] pub fn halt(exit_code: u32) -> ! { unsafe { asm!( diff --git a/mpcs/src/sum_check.rs b/mpcs/src/sum_check.rs index 60cca3b23..4cd20cccd 100644 --- a/mpcs/src/sum_check.rs +++ b/mpcs/src/sum_check.rs @@ -42,6 +42,12 @@ impl<'a, E: ExtensionField> VirtualPolynomial<'a, E> { } } +pub type SumCheckProverOutput = ( + Vec, + Vec, + SumcheckProof>::RoundMessage>, +); + pub trait SumCheck: Clone + Debug where E::BaseField: Serialize + DeserializeOwned, @@ -57,7 +63,7 @@ where virtual_poly: VirtualPolynomial, sum: E, transcript: &mut Transcript, - ) -> Result<(Vec, Vec, SumcheckProof), Error>; + ) -> Result, Error>; fn verify( vp: &Self::VerifierParam,