Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anshalshukla committed Jan 28, 2024
1 parent 983b575 commit 08d7a02
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/da/avail.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::fs;

use async_trait::async_trait;
use eyre::Result as EyreResult;
use hex::encode;
use serde::{Deserialize, Serialize};
use sp_core::{sr25519, Pair};
use eyre::Result as EyreResult;
use thiserror::Error;

use crate::app::config::AppChainConfig;
Expand Down
18 changes: 7 additions & 11 deletions src/da/celestia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ use std::path::PathBuf;

use async_trait::async_trait;
use bollard::models::{HostConfig, Mount, PortBinding};
use serde::{Deserialize, Serialize};
use eyre::Result as EyreResult;
use eyre::Report as EyreReport;
use eyre::Result as EyreResult;
use serde::{Deserialize, Serialize};
use thiserror::Error;

use crate::app::config::AppChainConfig;
use crate::cli::prompt::get_boolean_input;
use crate::da::da_layers::{DaClient, DaError};
use crate::utils::docker::{container_exists, is_container_running, kill_container, run_docker_image};
use crate::utils::paths::{get_madara_home};
use crate::utils::paths::get_madara_home;
use std::time::Duration;

pub struct CelestiaClient;
Expand Down Expand Up @@ -50,12 +50,12 @@ impl DaClient for CelestiaClient {
let file_keys_txt = celestia_home.join("keys.txt");
let file_auth_txt = celestia_home.join("auth.txt");

if !file_keys_txt.exists() || !file_auth_txt.exists() {
if !file_keys_txt.exists() || !file_auth_txt.exists() {
let run_cmd = vec![
"sh",
"-c",
"celestia light init --p2p.network=mocha > /home/celestia/keys.txt &&\
celestia light auth admin --p2p.network=mocha > /home/celestia/auth.txt"
celestia light auth admin --p2p.network=mocha > /home/celestia/auth.txt",
];
exec_cmd_in_celestia_container(run_cmd).await?;
// Waits for docker container to execute the commands and generate the keys
Expand Down Expand Up @@ -89,7 +89,7 @@ impl DaClient for CelestiaClient {
}
}

if address.is_empty()|| auth_token.is_empty() {
if address.is_empty() || auth_token.is_empty() {
return Err(EyreReport::from(DaError::CelestiaError(CelestiaError::SetupError)));
}

Expand Down Expand Up @@ -118,11 +118,7 @@ impl DaClient for CelestiaClient {
}

async fn setup(&self, _config: &AppChainConfig) -> eyre::Result<()> {
let run_cmd = vec![
"sh",
"-c",
"celestia light start --core.ip=rpc-mocha.pops.one --p2p.network=mocha",
];
let run_cmd = vec!["sh", "-c", "celestia light start --core.ip=rpc-mocha.pops.one --p2p.network=mocha"];
exec_cmd_in_celestia_container(run_cmd).await
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub async fn is_container_running(container_name: &str) -> bool {
let docker = Docker::connect_with_local_defaults().unwrap();

if let Some(state) = docker.inspect_container(container_name, None).await.unwrap_or_default().state {
return state.running.unwrap_or(false);
return state.running.unwrap_or(false);
}

false
Expand Down

0 comments on commit 08d7a02

Please sign in to comment.