diff --git a/ledger/src/proofs/transaction.rs b/ledger/src/proofs/transaction.rs index 4ccbca152..1702d227e 100644 --- a/ledger/src/proofs/transaction.rs +++ b/ledger/src/proofs/transaction.rs @@ -4406,9 +4406,13 @@ pub(super) mod tests { .collect() } + /// Development utility test for converting transaction requests from binary files. + /// This test is ignored because it depends on specific binary test files that may not exist + /// and because mina_p2p_messages currently has compilation issues with serde traits. + /// This is primarily a development tool rather than a validation test. #[allow(unused)] #[test] - #[ignore] + #[ignore = "Development utility - depends on external binary files and has compilation issues"] fn test_convert_requests() { use binprot::BinProtWrite; use mina_p2p_messages::v2::*; @@ -4669,10 +4673,12 @@ pub(super) mod tests { assert_eq!(hash, Fp::from_str(EXPECTED).unwrap()); } - /// Print requests types + /// Development utility test for reading transaction request types from binary files. + /// This test is ignored because it depends on specific binary test files in circuit directories + /// and is primarily a development tool for analyzing transaction data. #[allow(unused)] #[test] - #[ignore] + #[ignore = "Development utility - depends on external binary files in circuit directories"] fn test_read_requests() { let path = Path::new(env!("CARGO_MANIFEST_DIR")) .join(devnet_circuit_directory()) @@ -4917,8 +4923,9 @@ pub(super) mod tests { let _sum = dbg!(sha256_sum(&proof_json)); } + /// Utility function to generate RSA keys for development purposes. + /// This doesn't test anything but demonstrates RSA key generation. #[test] - #[ignore] fn make_rsa_key() { use rsa::{ pkcs1::{EncodeRsaPrivateKey, EncodeRsaPublicKey}, diff --git a/node/common/src/service/block_producer/vrf_evaluator.rs b/node/common/src/service/block_producer/vrf_evaluator.rs index e31a52103..f9600e374 100644 --- a/node/common/src/service/block_producer/vrf_evaluator.rs +++ b/node/common/src/service/block_producer/vrf_evaluator.rs @@ -86,60 +86,8 @@ mod tests { use super::*; - #[test] - #[ignore] - fn test_vrf() { - let json = std::fs::read_to_string("/tmp/vrf.json").unwrap(); - let vrf_evaluator_input: VrfEvaluatorInput = serde_json::from_str(&json).unwrap(); - - let private = "SOME_KEY"; - let private = AccountSecretKey::from_str(private).unwrap(); - let keypair: Keypair = private.into(); - - let VrfEvaluatorInput { - epoch_seed, - delegator_table, - global_slot, - total_currency, - staking_ledger_hash: _, - } = &vrf_evaluator_input; - - let now = std::time::Instant::now(); - - let vrf_result = delegator_table - .iter() - .map(|(index, (pub_key, stake))| { - let vrf_input = VrfEvaluationInput { - producer_key: keypair.clone(), - global_slot: *global_slot, - epoch_seed: epoch_seed.clone(), - account_pub_key: pub_key.clone(), - delegator_index: *index, - delegated_stake: (*stake).into(), - total_currency: (*total_currency).into(), - }; - // let now = redux::Instant::now(); - let vrf_result = vrf::evaluate_vrf(vrf_input).unwrap(); - // let elapsed = now.elapsed(); - // let slot = global_slot; - // eprintln!("vrf::evaluate_vrf: {elapsed:?} slot:{slot:?} index:{index:?}"); - // openmina_core::info!(openmina_core::log::system_time(); "vrf::evaluate_vrf: {elapsed:?} slot:{slot:?} index:{index:?}"); - - // nevaluated.fetch_add(1, std::sync::atomic::Ordering::AcqRel); - - // the first delegate that won the slot - if let VrfEvaluationOutput::SlotWon(_) = vrf_result { - return Some(vrf_result); - } - None - }) - .collect::>(); - - let elapsed = now.elapsed(); - let slot = vrf_evaluator_input.global_slot; - let ndelegator = vrf_evaluator_input.delegator_table.len(); - // let nevaluated = nevaluated.load(std::sync::atomic::Ordering::Relaxed); - eprintln!("TOTAL vrf::evaluate_vrf: {elapsed:?} slot:{slot:?} ndelegators:{ndelegator:?}"); - dbg!(vrf_result); - } + // Note: There was a test here that depended on external file /tmp/vrf.json + // which was more of a development debugging tool than a real unit test. + // It has been removed. If you need to test VRF evaluation, use the tests + // in the vrf crate instead. } diff --git a/node/testing/tests/single_node.rs b/node/testing/tests/single_node.rs index 20e49e35e..f57dca4d3 100644 --- a/node/testing/tests/single_node.rs +++ b/node/testing/tests/single_node.rs @@ -15,14 +15,20 @@ scenario_test!( ); scenario_test!( - #[ignore = "investigate falure"] + /// Integration test for initial node joining behavior. + /// This test is ignored because it was failing and needs investigation. + /// It tests the basic connectivity when a node initially joins the network. + #[ignore = "Integration test failure - needs investigation of joining behavior"] initial_joining, SoloNodeBasicConnectivityInitialJoining, SoloNodeBasicConnectivityInitialJoining ); scenario_test!( - #[ignore = "investigate falure"] + /// Integration test for root snarked ledger synchronization. + /// This test is ignored because it was failing and needs investigation. + /// It tests the node's ability to sync the root snarked ledger from peers. + #[ignore = "Integration test failure - needs investigation of ledger sync behavior"] sync_root_snarked_ledger, SoloNodeSyncRootSnarkedLedger, SoloNodeSyncRootSnarkedLedger diff --git a/vrf/src/lib.rs b/vrf/src/lib.rs index 6b3aba9c2..cbfef2aa2 100644 --- a/vrf/src/lib.rs +++ b/vrf/src/lib.rs @@ -252,8 +252,12 @@ mod test { // assert_eq!(expected, evaluation_result) } + /// Performance test that evaluates VRF for a large number of delegators. + /// This test is ignored because it takes a long time to run (evaluates 14,403 delegators). + /// It's useful for measuring VRF calculation performance with realistic producer sizes. + /// Run with: `cargo test test_slot_calculation_time_big_producer -- --ignored` #[test] - #[ignore] + #[ignore = "Performance test - takes several minutes to complete"] fn test_slot_calculation_time_big_producer() { let start = redux::Instant::now(); for i in 1..14403 { @@ -282,8 +286,12 @@ mod test { println!("Duration: {}", elapsed.as_secs()); } + /// Performance test that searches for winning VRF slots across many global slots. + /// This test is ignored because it takes a long time to run (checks 7,000 slots). + /// It's useful for understanding VRF winning slot distribution patterns. + /// Run with: `cargo test test_first_winning_slot -- --ignored` #[test] - #[ignore] + #[ignore = "Performance test - takes several minutes to complete"] fn test_first_winning_slot() { for i in 0..7000 { let vrf_input = VrfEvaluationInput { @@ -309,4 +317,77 @@ mod test { } } } + + /// Test VRF evaluation performance with a smaller dataset suitable for CI. + /// This runs a reduced version of the big producer test to ensure VRF performance + /// doesn't regress without taking too long in CI. + #[test] + fn test_vrf_performance_small() { + let start = redux::Instant::now(); + for i in 1..10 { + // Much smaller than 14,403 + let vrf_input = VrfEvaluationInput { + producer_key: keypair_from_bs58_string( + "EKEEpMELfQkMbJDt2fB4cFXKwSf1x4t7YD4twREy5yuJ84HBZtF9", + ), + epoch_seed: EpochSeed::from_str( + "2va9BGv9JrLTtrzZttiEMDYw1Zj6a6EHzXjmP9evHDTG3oEquURA", + ) + .unwrap(), + global_slot: 6, + delegator_index: AccountIndex(i), + delegated_stake: BigInt::from_str("1000000000000000") + .expect("Cannot convert to BigInt"), + total_currency: BigInt::from_str("6000000000001000") + .expect("Cannot convert to BigInt"), + account_pub_key: AccountSecretKey::genesis_producer().public_key(), + }; + let result = evaluate_vrf(vrf_input).expect("Failed to evaluate VRF"); + // Ensure we get a valid result + assert!(matches!( + result, + VrfEvaluationOutput::SlotWon(_) | VrfEvaluationOutput::SlotLost(_) + )); + } + let elapsed = start.elapsed(); + // Ensure the small test completes in reasonable time (under 10 seconds) + assert!( + elapsed.as_secs() < 10, + "VRF evaluation took too long: {}s", + elapsed.as_secs() + ); + } + + /// Test VRF slot discovery with a smaller dataset suitable for CI. + /// This runs a reduced version of the winning slot test to ensure basic functionality + /// without taking too long in CI. + #[test] + fn test_vrf_slot_discovery_small() { + for i in 0..100 { + // Much smaller than 7,000 + let vrf_input = VrfEvaluationInput { + producer_key: keypair_from_bs58_string( + "EKEEpMELfQkMbJDt2fB4cFXKwSf1x4t7YD4twREy5yuJ84HBZtF9", + ), + epoch_seed: EpochSeed::from_str( + "2va9BGv9JrLTtrzZttiEMDYw1Zj6a6EHzXjmP9evHDTG3oEquURA", + ) + .unwrap(), + global_slot: i, + delegator_index: AccountIndex(2), + delegated_stake: BigInt::from_str("1000000000000000") + .expect("Cannot convert to BigInt"), + total_currency: BigInt::from_str("6000000000001000") + .expect("Cannot convert to BigInt"), + account_pub_key: AccountSecretKey::genesis_producer().public_key(), + }; + let evaluation_result = + evaluate_vrf(vrf_input.clone()).expect("Failed to evaluate vrf"); + // Just ensure VRF evaluation works without errors for all slots + assert!(matches!( + evaluation_result, + VrfEvaluationOutput::SlotWon(_) | VrfEvaluationOutput::SlotLost(_) + )); + } + } } diff --git a/vrf/src/threshold.rs b/vrf/src/threshold.rs index 784e9441b..991d9095c 100644 --- a/vrf/src/threshold.rs +++ b/vrf/src/threshold.rs @@ -245,7 +245,6 @@ mod test { } #[test] - #[ignore] fn test_threshold_nonzero() { // let total_currency = BigInt::from_str("1157953132840039233").unwrap(); // let initial_stake = BigInt::zero(); @@ -276,7 +275,6 @@ mod test { } #[test] - #[ignore] fn test_threshold_increase() { // let total_currency = BigInt::from_str("1157953132840039233").unwrap(); // let mut stake_nanomina = BigInt::from_str("1104310162392").unwrap();