pub async fn relay_valsets(
    // the validator set currently in the contract on Ethereum
    current_valset: Valset,
    ethereum_key: EthPrivateKey,
    web3: &Web3,
    grpc_client: &mut GravityQueryClient<Channel>,
    gravity_contract_address: EthAddress,
    gravity_id: String,
    timeout: Duration,
    config: RelayerConfig,
) {
    // we have to start with the current valset, we need to know what's currently
    // in the contract in order to determine if a new validator set is valid.
    // For example the contract has set A which contains validators x/y/z the
    // latest valset has set C which has validators z/e/f in order to have enough
    // power we actually need to submit validator set B with validators x/y/e in
    // order to know exactly which one we must iterate over the history in find_latest_valid_valset()

    let latest_cosmos_valset_nonce = match get_latest_cosmos_valset_nonce(grpc_client).await {
        Some(n) => n,
        None => return,
    };

    // the latest cosmos validator set that it is possible to submit given the constraints
    // of the validator set currently in the bridge
    let (latest_submittable_valset, confirms) = match find_latest_valid_valset(
        latest_cosmos_valset_nonce,
        &current_valset,
        grpc_client,
        &gravity_id,
    )
    .await
    {
        Ok(v) => v,
        Err(GravityError::ValsetUpToDate) => return,
        Err(e) => {
            error!(
                "We where unable to find a valid validator set update to submit! {:?}",
                e
            );
            return;
        }
    };

    relay_valid_valset(
        latest_cosmos_valset_nonce,
        latest_submittable_valset,
        current_valset,
        confirms,
        web3,
        gravity_contract_address,
        gravity_id,
        ethereum_key,
        timeout,
        config,
    )
    .await;
}
/// High level entry point for valset relaying, this function starts by finding
/// what validator set is valid, then evaluating if it should be relayed according
/// to the users preferences and finally relaying a validator set that is valid at
/// this moment in time
High level entry point for valset relaying, this function starts by finding
what validator set is valid, then evaluating if it should be relayed according
to the users preferences and finally relaying a validator set that is valid at
this moment in time
High level entry point for valset relaying this function starts by finding what validator set is valid then evaluating if it should be relayed according to the users preferences and finally relaying a validator set that is valid at this moment in time
pub async fn relay_valsets(
    // the validator set currently in the contract on Ethereum
    current_valset: Valset,
    ethereum_key: EthPrivateKey,
    web3: &Web3,
    grpc_client: &mut GravityQueryClient<Channel>,
    gravity_contract_address: EthAddress,
    gravity_id: String,
    timeout: Duration,
    config: RelayerConfig,
) {
    // we have to start with the current valset, we need to know what's currently
    // in the contract in order to determine if a new validator set is valid.
    // For example the contract has set A which contains validators x/y/z the
    // latest valset has set C which has validators z/e/f in order to have enough
    // power we actually need to submit validator set B with validators x/y/e in
    // order to know exactly which one we must iterate over the history in find_latest_valid_valset()
    let latest_cosmos_valset_nonce = match get_latest_cosmos_valset_nonce(grpc_client).await {
        Some(n) => n,
        None => return,
    };
    // the latest cosmos validator set that it is possible to submit given the constraints
    // of the validator set currently in the bridge
    let (latest_submittable_valset, confirms) = match find_latest_valid_valset(
        latest_cosmos_valset_nonce,
        &current_valset,
        grpc_client,
        &gravity_id,
    )
    .await
    {
        Ok(v) => v,
        Err(GravityError::ValsetUpToDate) => return,
        Err(e) => {
            error!(
                "We where unable to find a valid validator set update to submit! {:?}",
                e
            );
            return;
        }
    };
    relay_valid_valset(
        latest_cosmos_valset_nonce,
        latest_submittable_valset,
        current_valset,
        confirms,
        web3,
        gravity_contract_address,
        gravity_id,
        ethereum_key,
        timeout,
        config,
    )
    .await;
}
pub async fn relay_valsets ( // the validator set currently in the contract on Ethereum current_valset : Valset , ethereum_key : EthPrivateKey , web3 : & Web3 , grpc_client : & mut GravityQueryClient < Channel > , gravity_contract_address : EthAddress , gravity_id : String , timeout : Duration , config : RelayerConfig , ) { // we have to start with the current valset, we need to know what's currently // in the contract in order to determine if a new validator set is valid. // For example the contract has set A which contains validators x/y/z the // latest valset has set C which has validators z/e/f in order to have enough // power we actually need to submit validator set B with validators x/y/e in // order to know exactly which one we must iterate over the history in find_latest_valid_valset() let latest_cosmos_valset_nonce = match get_latest_cosmos_valset_nonce ( grpc_client ) . await { Some ( n ) => n , None => return , } ; // the latest cosmos validator set that it is possible to submit given the constraints // of the validator set currently in the bridge let ( latest_submittable_valset , confirms ) = match find_latest_valid_valset ( latest_cosmos_valset_nonce , & current_valset , grpc_client , & gravity_id , ) . await { Ok ( v ) => v , Err ( GravityError :: ValsetUpToDate ) => return , Err ( e ) => { error ! ( " " e ) ; return ; } } ; relay_valid_valset ( latest_cosmos_valset_nonce , latest_submittable_valset , current_valset , confirms , web3 , gravity_contract_address , gravity_id , ethereum_key , timeout , config , ) . await ; }
High level entry point for valset relaying, this function starts by finding
what validator set is valid, then evaluating if it should be relayed according
to the users preferences and finally relaying a validator set that is valid at
this moment in time
High level entry point for valset relaying this function starts by finding what validator set is valid then evaluating if it should be relayed according to the users preferences and finally relaying a validator set that is valid at this moment in time
current_valset
Valset
ethereum_key
EthPrivateKey
web3
&Web3
grpc_client
&mut GravityQueryClient<Channel>
gravity_contract_address
EthAddress
gravity_id
String
timeout
Duration
config
RelayerConfig
current_valset
Valset
ethereum_key
EthPrivateKey
web3
&Web3
grpc_client
&mut GravityQueryClient<Channel>
gravity_contract_address
EthAddress
gravity_id
String
timeout
Duration
config
RelayerConfig