pub async fn start_orchestrators(
    keys: Vec<ValidatorKeys>,
    gravity_address: EthAddress,
    validator_out: bool,
    orchestrator_config: GravityBridgeToolsConfig,
) {
    // used to break out of the loop early to simulate one validator
    // not running an Orchestrator
    let num_validators = keys.len();
    let mut count = 0;

    #[allow(clippy::explicit_counter_loop)]
    for k in keys {
        let config = orchestrator_config.clone();
        info!(
            "Spawning Orchestrator with delegate keys {} {} and validator key {}",
            k.eth_key.to_address(),
            k.orch_key.to_address(ADDRESS_PREFIX.as_str()).unwrap(),
            get_operator_address(k.validator_key),
        );
        let mut grpc_client = GravityQueryClient::connect(COSMOS_NODE_GRPC.as_str())
            .await
            .unwrap();
        let params = get_gravity_params(&mut grpc_client)
            .await
            .expect("Failed to get Gravity Bridge module parameters!");

        // we have only one actual futures executor thread (see the actix runtime tag on our main function)
        // but that will execute all the orchestrators in our test in parallel
        thread::spawn(move || {
            let web30 = web30::client::Web3::new(ETH_NODE.as_str(), OPERATION_TIMEOUT);
            let contact = Contact::new(
                COSMOS_NODE_GRPC.as_str(),
                OPERATION_TIMEOUT,
                ADDRESS_PREFIX.as_str(),
            )
            .unwrap();
            let fut = orchestrator_main_loop(
                k.orch_key,
                k.eth_key,
                web30,
                contact,
                grpc_client,
                gravity_address,
                params.gravity_id,
                get_fee(),
                config,
            );
            let system = System::new();
            system.block_on(fut);
        });
        // used to break out of the loop early to simulate one validator
        // not running an orchestrator
        count += 1;
        if validator_out && count == num_validators - 1 {
            break;
        }
    }
}
/// This function pays the piper for the strange concurrency model that we use for the tests
/// we launch a thread, create an actix executor and then start the orchestrator within that scope
/// previously we could just throw around futures to spawn despite not having 'send' newer versions
/// of Actix rightly forbid this and we have to take the time to handle it here.
This function pays the piper for the strange concurrency model that we use for the tests
we launch a thread, create an actix executor and then start the orchestrator within that scope
previously we could just throw around futures to spawn despite not having 'send' newer versions
of Actix rightly forbid this and we have to take the time to handle it here.
This function pays the piper for the strange concurrency model that we use for the tests we launch a thread create an actix executor and then start the orchestrator within that scope previously we could just throw around futures to spawn despite not having ' send ' newer versions of Actix rightly forbid this and we have to take the time to handle it here .
pub async fn start_orchestrators(
    keys: Vec<ValidatorKeys>,
    gravity_address: EthAddress,
    validator_out: bool,
    orchestrator_config: GravityBridgeToolsConfig,
) {
    // used to break out of the loop early to simulate one validator
    // not running an Orchestrator
    let num_validators = keys.len();
    let mut count = 0;
    #[allow(clippy::explicit_counter_loop)]
    for k in keys {
        let config = orchestrator_config.clone();
        info!(
            "Spawning Orchestrator with delegate keys {} {} and validator key {}",
            k.eth_key.to_address(),
            k.orch_key.to_address(ADDRESS_PREFIX.as_str()).unwrap(),
            get_operator_address(k.validator_key),
        );
        let mut grpc_client = GravityQueryClient::connect(COSMOS_NODE_GRPC.as_str())
            .await
            .unwrap();
        let params = get_gravity_params(&mut grpc_client)
            .await
            .expect("Failed to get Gravity Bridge module parameters!");
        // we have only one actual futures executor thread (see the actix runtime tag on our main function)
        // but that will execute all the orchestrators in our test in parallel
        thread::spawn(move || {
            let web30 = web30::client::Web3::new(ETH_NODE.as_str(), OPERATION_TIMEOUT);
            let contact = Contact::new(
                COSMOS_NODE_GRPC.as_str(),
                OPERATION_TIMEOUT,
                ADDRESS_PREFIX.as_str(),
            )
            .unwrap();
            let fut = orchestrator_main_loop(
                k.orch_key,
                k.eth_key,
                web30,
                contact,
                grpc_client,
                gravity_address,
                params.gravity_id,
                get_fee(),
                config,
            );
            let system = System::new();
            system.block_on(fut);
        });
        // used to break out of the loop early to simulate one validator
        // not running an orchestrator
        count += 1;
        if validator_out && count == num_validators - 1 {
            break;
        }
    }
}
pub async fn start_orchestrators ( keys : Vec < ValidatorKeys > , gravity_address : EthAddress , validator_out : bool , orchestrator_config : GravityBridgeToolsConfig , ) { // used to break out of the loop early to simulate one validator // not running an Orchestrator let num_validators = keys . len ( ) ; let mut count = 0 ; # [ allow ( clippy explicit_counter_loop ) ] for k in keys { let config = orchestrator_config . clone ( ) ; info ! ( " " k eth_key to_address ( ) k orch_key to_address ( ADDRESS_PREFIX as_str ( ) ) unwrap ( ) get_operator_address ( k validator_key ) ) ; let mut grpc_client = GravityQueryClient :: connect ( COSMOS_NODE_GRPC . as_str ( ) ) . await . unwrap ( ) ; let params = get_gravity_params ( & mut grpc_client ) . await . expect ( " " ) ; // we have only one actual futures executor thread (see the actix runtime tag on our main function) // but that will execute all the orchestrators in our test in parallel thread :: spawn ( move | | { let web30 = web30 :: client :: Web3 :: new ( ETH_NODE . as_str ( ) , OPERATION_TIMEOUT ) ; let contact = Contact :: new ( COSMOS_NODE_GRPC . as_str ( ) , OPERATION_TIMEOUT , ADDRESS_PREFIX . as_str ( ) , ) . unwrap ( ) ; let fut = orchestrator_main_loop ( k . orch_key , k . eth_key , web30 , contact , grpc_client , gravity_address , params . gravity_id , get_fee ( ) , config , ) ; let system = System :: new ( ) ; system . block_on ( fut ) ; } ) ; // used to break out of the loop early to simulate one validator // not running an orchestrator count += 1 ; if validator_out && count == num_validators - 1 { break ; } } }
This function pays the piper for the strange concurrency model that we use for the tests
we launch a thread, create an actix executor and then start the orchestrator within that scope
previously we could just throw around futures to spawn despite not having 'send' newer versions
of Actix rightly forbid this and we have to take the time to handle it here.
This function pays the piper for the strange concurrency model that we use for the tests we launch a thread create an actix executor and then start the orchestrator within that scope previously we could just throw around futures to spawn despite not having ' send ' newer versions of Actix rightly forbid this and we have to take the time to handle it here .
keys
Vec<ValidatorKeys>
gravity_address
EthAddress
validator_out
bool
orchestrator_config
GravityBridgeToolsConfig
keys
Vec<ValidatorKeys>
gravity_address
EthAddress
validator_out
bool
orchestrator_config
GravityBridgeToolsConfig