Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,61 @@ jobs:
path: target/release/mina
retention-days: 7

unit-tests:
runs-on: ubuntu-24.04
steps:
- name: Git checkout
uses: actions/checkout@v5

- name: Load versions
uses: ./.github/actions/load-versions

- name: Setup build dependencies
uses: ./.github/actions/setup-build-deps

- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: ${{ env.RUST_STABLE_VERSION }}
cache-prefix: unit-tests-${{ env.CACHE_VERSION }}

- name: Install cargo-nextest
uses: taiki-e/install-action@nextest

# TODO: add this to the makefile
- name: Run unit tests
run: |
cargo nextest run --workspace --lib \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a target in the Makefile for this instead, please? We try to have all the commands run by the CI in the Makefile.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a TODO here. I want the changes to be apparent here for this specific job. Once we remove all the exclude flags, I think we can add this to the makefile

--exclude mina-core \
--exclude mina-fuzzer \
--exclude mina-macros \
--exclude mina-p2p-messages \
--exclude poseidon \
--exclude snark \
--exclude p2p \
--exclude salsa-simple \
--exclude p2p-testing \
--exclude libp2p-rpc-behaviour \
--exclude node \
--exclude mina-node-account \
--exclude vrf \
--exclude mina-node-common \
--exclude mina-node-native \
--exclude mina-node-web \
--exclude mina-node-invariants \
--exclude mina-node-testing \
--exclude cli \
--exclude replay_dynamic_effects \
--exclude mina-transport \
--exclude mina-bootstrap-sandbox \
--exclude mina-gossipsub-sandbox \
--exclude hash-tool \
--exclude ledger-tool \
--exclude transaction_fuzzer \
--exclude mina-archive-breadcrumb-compare \
--exclude webrtc-sniffer
# --exclude mina-tree

account-tests:
timeout-minutes: 20
runs-on: ubuntu-24.04
Expand Down
78 changes: 25 additions & 53 deletions ledger/src/proofs/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4364,6 +4364,7 @@ mod tests_with_wasm {

#[cfg(test)]
pub(super) mod tests {
use core::panic;
use std::path::Path;

use ::poseidon::hash::params::MINA_ZKAPP_EVENT;
Expand Down Expand Up @@ -4399,13 +4400,6 @@ pub(super) mod tests {
PerformJob(mina_p2p_messages::v2::SnarkWorkerWorkerRpcsVersionedGetWorkV2TResponse),
}

pub fn panic_in_ci() {
fn is_ci() -> bool {
std::env::var("CI").is_ok()
}
assert!(!is_ci(), "missing circuit files !");
}

fn read_binprot<T, R>(mut r: R) -> T
where
T: binprot::BinProtRead,
Expand Down Expand Up @@ -4644,19 +4638,13 @@ pub(super) mod tests {
#[test]
#[ignore = "Failing due to circuits"]
fn test_regular_tx() {
let Ok(data) =
// std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join("request_signed.bin"))
// std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join("rampup4").join("request_payment_0_rampup4.bin"))
std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join(devnet_circuit_directory()).join("tests").join("command-0-1.bin"))
// std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join("rampup4").join("request_payment_1_rampup4.bin"))
// std::fs::read("/tmp/fee_transfer_1_rampup4.bin")
// std::fs::read("/tmp/coinbase_1_rampup4.bin")
// std::fs::read("/tmp/stake_0_rampup4.bin")
else {
eprintln!("request not found");
panic_in_ci();
return;
};
let data = std::fs::read(
Path::new(env!("CARGO_MANIFEST_DIR"))
.join(devnet_circuit_directory())
.join("tests")
.join("command-0-1.bin"),
)
.unwrap();

let (statement, tx_witness, message) = extract_request(&data);
let TransactionProver {
Expand Down Expand Up @@ -4771,19 +4759,13 @@ pub(super) mod tests {
#[test]
#[ignore = "Failing due to circuits"]
fn test_merge_proof() {
let Ok(data) =
// std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join("request_signed.bin"))
// std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join("rampup4").join("merge_0_rampup4.bin"))
std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join(devnet_circuit_directory()).join("tests").join("merge-100-0.bin"))
// std::fs::read("/tmp/minaa/mina-works-dump/merge-100-0.bin")
// std::fs::read("/tmp/fee_transfer_1_rampup4.bin")
// std::fs::read("/tmp/coinbase_1_rampup4.bin")
// std::fs::read("/tmp/stake_0_rampup4.bin")
else {
eprintln!("request not found");
panic_in_ci();
return;
};
let data = std::fs::read(
Path::new(env!("CARGO_MANIFEST_DIR"))
.join(devnet_circuit_directory())
.join("tests")
.join("merge-100-0.bin"),
)
.unwrap();

let (statement, proofs, message) = extract_merge(&data);
let TransactionProver {
Expand Down Expand Up @@ -4821,16 +4803,13 @@ pub(super) mod tests {
#[test]
#[ignore = "Failing due to circuits"]
fn test_proof_zkapp_sig() {
let Ok(data) = std::fs::read(
let data = std::fs::read(
Path::new(env!("CARGO_MANIFEST_DIR"))
.join(devnet_circuit_directory())
.join("tests")
.join("command-1-0.bin"),
) else {
eprintln!("request not found");
panic_in_ci();
return;
};
)
.unwrap();

let (statement, tx_witness, message) = extract_request(&data);

Expand Down Expand Up @@ -4867,16 +4846,13 @@ pub(super) mod tests {
#[test]
#[ignore = "Failing due to circuits"]
fn test_proof_zkapp_proof() {
let Ok(data) = std::fs::read(
let data = std::fs::read(
Path::new(env!("CARGO_MANIFEST_DIR"))
.join(devnet_circuit_directory())
.join("tests")
.join("zkapp-command-with-proof-128-1.bin"),
) else {
eprintln!("request not found");
panic_in_ci();
return;
};
)
.unwrap();

let (statement, tx_witness, message) = extract_request(&data);

Expand Down Expand Up @@ -4911,16 +4887,13 @@ pub(super) mod tests {
#[test]
#[ignore = "Failing due to circuits"]
fn test_block_proof() {
let Ok(data) = std::fs::read(
let data = std::fs::read(
Path::new(env!("CARGO_MANIFEST_DIR"))
.join(devnet_circuit_directory())
.join("tests")
.join("block_input-2483246-0.bin"),
) else {
eprintln!("request not found");
panic_in_ci();
return;
};
)
.unwrap();

let blockchain_input: v2::ProverExtendBlockchainInputStableV2 =
read_binprot(&mut data.as_slice());
Expand Down Expand Up @@ -5038,8 +5011,7 @@ pub(super) mod tests {

if !base_dir.exists() {
eprintln!("{:?} not found", base_dir);
panic_in_ci();
return;
panic!();
}

let BlockProver {
Expand Down
8 changes: 3 additions & 5 deletions ledger/src/proofs/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,14 +1033,15 @@ mod tests {
use mina_curves::pasta::Fp;
use mina_p2p_messages::{binprot::BinProtRead, v2};

use crate::proofs::{provers::devnet_circuit_directory, transaction::tests::panic_in_ci};
use crate::proofs::provers::devnet_circuit_directory;

use super::*;

#[cfg(target_family = "wasm")]
use wasm_bindgen_test::wasm_bindgen_test as test;

#[test]
#[ignore = "the file are missing"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created the issue #1614 and added it to #524.

fn test_verify_zkapp() {
use mina_p2p_messages::{
binprot,
Expand All @@ -1066,10 +1067,7 @@ mod tests {
];

for filename in cases {
let Ok(file) = std::fs::read(base_dir.join(filename)) else {
panic_in_ci();
return;
};
let file = std::fs::read(base_dir.join(filename)).expect("file not found");

let VerifyZkapp {
vk,
Expand Down
Loading