pub fn replica_run_till_height(p2p_test_context: &P2PTestContext, till_height: u64) {
    std::println!("Instance id: {}", p2p_test_context.node_id);
    let mut last_finalized_height = 0;
    let mut last_notarized_height = 0;
    let mut last_certified_height = 0;
    std::thread::sleep(Duration::from_millis(800));
    loop {
        let finalized_height = fetch_int_gauge(
            &p2p_test_context.metrics_registry,
            "consensus_pool_validated_finalization_max_height",
        )
        .unwrap_or(last_finalized_height);
        let notarized_height = fetch_int_gauge(
            &p2p_test_context.metrics_registry,
            "consensus_pool_validated_notarization_max_height",
        )
        .unwrap_or(last_notarized_height);
        let certified_height = fetch_int_gauge(
            &p2p_test_context.metrics_registry,
            "certification_last_certified_height",
        )
        .unwrap_or(last_certified_height);
        std::thread::sleep(Duration::from_millis(10));

        if finalized_height > last_finalized_height
            || notarized_height > last_notarized_height
            || certified_height > last_certified_height
        {
            last_finalized_height = finalized_height.max(last_finalized_height);
            last_notarized_height = notarized_height.max(last_notarized_height);
            last_certified_height = certified_height.max(last_certified_height);
            println!(
                " Node {} at notarized height {:?} finalized height {:?} certified height {:?}",
                p2p_test_context.node_id,
                last_notarized_height,
                last_finalized_height,
                last_certified_height
            );
        }
        if last_certified_height >= till_height {
            p2p_test_context.test_synchronizer.set_group_stop();
            break;
        }

        if p2p_test_context.test_synchronizer.is_group_stopped() {
            break;
        }
    }
    p2p_test_context
        .test_synchronizer
        .wait_on_barrier(P2P_TEST_END_BARRIER.to_string());
}
/// Helper function for P2P test, runs a replica until consensus certifies a
/// given height
///
/// # Parameters
/// - p2p_test_context        Test context for the replica
/// - till_height             height to reach
Helper function for P2P test, runs a replica until consensus certifies a
given height

Parameters
p2p_test_context        Test context for the replica
till_height             height to reach
Helper function for P2P test runs a replica until consensus certifies a given height Parameters p2p_test_context Test context for the replica till_height height to reach
pub fn replica_run_till_height(p2p_test_context: &P2PTestContext, till_height: u64) {
    std::println!("Instance id: {}", p2p_test_context.node_id);
    let mut last_finalized_height = 0;
    let mut last_notarized_height = 0;
    let mut last_certified_height = 0;
    std::thread::sleep(Duration::from_millis(800));
    loop {
        let finalized_height = fetch_int_gauge(
            &p2p_test_context.metrics_registry,
            "consensus_pool_validated_finalization_max_height",
        )
        .unwrap_or(last_finalized_height);
        let notarized_height = fetch_int_gauge(
            &p2p_test_context.metrics_registry,
            "consensus_pool_validated_notarization_max_height",
        )
        .unwrap_or(last_notarized_height);
        let certified_height = fetch_int_gauge(
            &p2p_test_context.metrics_registry,
            "certification_last_certified_height",
        )
        .unwrap_or(last_certified_height);
        std::thread::sleep(Duration::from_millis(10));
        if finalized_height > last_finalized_height
            || notarized_height > last_notarized_height
            || certified_height > last_certified_height
        {
            last_finalized_height = finalized_height.max(last_finalized_height);
            last_notarized_height = notarized_height.max(last_notarized_height);
            last_certified_height = certified_height.max(last_certified_height);
            println!(
                " Node {} at notarized height {:?} finalized height {:?} certified height {:?}",
                p2p_test_context.node_id,
                last_notarized_height,
                last_finalized_height,
                last_certified_height
            );
        }
        if last_certified_height >= till_height {
            p2p_test_context.test_synchronizer.set_group_stop();
            break;
        }
        if p2p_test_context.test_synchronizer.is_group_stopped() {
            break;
        }
    }
    p2p_test_context
        .test_synchronizer
        .wait_on_barrier(P2P_TEST_END_BARRIER.to_string());
}
pub fn replica_run_till_height ( p2p_test_context : & P2PTestContext , till_height : u64 ) { std :: println ! ( " " p2p_test_context node_id ) ; let mut last_finalized_height = 0 ; let mut last_notarized_height = 0 ; let mut last_certified_height = 0 ; std :: thread :: sleep ( Duration :: from_millis ( 800 ) ) ; loop { let finalized_height = fetch_int_gauge ( & p2p_test_context . metrics_registry , " " , ) . unwrap_or ( last_finalized_height ) ; let notarized_height = fetch_int_gauge ( & p2p_test_context . metrics_registry , " " , ) . unwrap_or ( last_notarized_height ) ; let certified_height = fetch_int_gauge ( & p2p_test_context . metrics_registry , " " , ) . unwrap_or ( last_certified_height ) ; std :: thread :: sleep ( Duration :: from_millis ( 10 ) ) ; if finalized_height > last_finalized_height || notarized_height > last_notarized_height || certified_height > last_certified_height { last_finalized_height = finalized_height . max ( last_finalized_height ) ; last_notarized_height = notarized_height . max ( last_notarized_height ) ; last_certified_height = certified_height . max ( last_certified_height ) ; println ! ( " " p2p_test_context node_id last_notarized_height last_finalized_height last_certified_height ) ; } if last_certified_height >= till_height { p2p_test_context . test_synchronizer . set_group_stop ( ) ; break ; } if p2p_test_context . test_synchronizer . is_group_stopped ( ) { break ; } } p2p_test_context . test_synchronizer . wait_on_barrier ( P2P_TEST_END_BARRIER . to_string ( ) ) ; }
Helper function for P2P test, runs a replica until consensus certifies a
given height
Helper function for P2P test runs a replica until consensus certifies a given height
p2p_test_context
&P2PTestContext
till_height
u64
p2p_test_context
&P2PTestContext
till_height
u64