Skip to content

Commit

Permalink
fix review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
gshep committed Aug 5, 2024
1 parent da7e2fa commit f741abb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions relayer/src/ethereum_checkpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub async fn relay(args: RelayCheckpointsArgs) {
beacon_endpoint,
vara_domain,
vara_port,
suri,
vara_suri,
prometheus_args: PrometheusArgs {
endpoint: endpoint_prometheus,
},
Expand All @@ -63,7 +63,7 @@ pub async fn relay(args: RelayCheckpointsArgs) {

sync_update::spawn_receiver(client_http.clone(), beacon_endpoint.clone(), sender);

let client = GearApi::init_with(WSAddress::new(vara_domain, vara_port), suri)
let client = GearApi::init_with(WSAddress::new(vara_domain, vara_port), vara_suri)
.await
.expect("GearApi client should be created");

Expand Down
9 changes: 3 additions & 6 deletions relayer/src/ethereum_checkpoints/sync_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@ pub fn spawn_receiver(
tokio::spawn(async move {
log::info!("Update receiver spawned");

let duration = Duration::from_secs(DELAY_SECS_UPDATE_REQUEST);
let mut failures = 0;
loop {
match receive(&client_http, &beacon_endpoint, &sender).await {
Ok(Break(_)) => break,
Ok(Continue(_)) => time::sleep(duration).await,
Ok(Continue(_)) => (),
Err(e) => {
log::error!("{e:?}");

failures += 1;
if failures >= COUNT_FAILURE {
break;
}

time::sleep(duration).await;
}
}

time::sleep(Duration::from_secs(DELAY_SECS_UPDATE_REQUEST)).await;
}
});
}
Expand Down Expand Up @@ -71,8 +70,6 @@ async fn receive(
return Ok(Break(()));
}

time::sleep(Duration::from_secs(DELAY_SECS_UPDATE_REQUEST)).await;

Ok(Continue(()))
}

Expand Down
2 changes: 1 addition & 1 deletion relayer/src/ethereum_checkpoints/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use tokio::time::{self, Duration};
const RPC_URL: &str = "http://127.0.0.1:5052";
const NETWORK_MAINNET: &str = "Mainnet";
const NETWORK_HOLESKY: &str = "Holesky";
const NETWORK_SEPOLIA: &str = "";
const NETWORK_SEPOLIA: &str = "Sepolia";

const FINALITY_UPDATE_5_254_112: &[u8; 4_940] =
include_bytes!("./sepolia-finality-update-5_254_112.json");
Expand Down
6 changes: 3 additions & 3 deletions relayer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct ProofStorageArgs {
#[derive(Args)]
struct RelayCheckpointsArgs {
/// Specify ProgramId of the Checkpoint-light-client program
#[arg(long, env = "PROGRAM_ID")]
#[arg(long, env = "CHECKPOINT_LIGHT_CLIENT_ADDRESS")]
program_id: String,

/// Specify an endpoint providing Beacon API
Expand All @@ -150,8 +150,8 @@ struct RelayCheckpointsArgs {
/// provides default users from the keyring (e.g., "//Alice", "//Bob",
/// etc.). The password for URI should be specified in the same `suri`,
/// separated by the ':' char
#[arg(long, default_value = "//Alice", env = "SURI")]
suri: String,
#[arg(long, default_value = "//Alice", env = "VARA_SURI")]
vara_suri: String,

#[clap(flatten)]
prometheus_args: PrometheusArgs,
Expand Down

0 comments on commit f741abb

Please sign in to comment.