Skip to content

Commit

Permalink
fix: udpate websocket connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
l-monninger committed Feb 21, 2025
1 parent 427b651 commit d837e68
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ services:
CELESTIA_RPC_CONNECTION_PROTOCOL: https
CELESTIA_RPC_CONNECTION_HOSTNAME: rpc.celestia.pops.one
CELESTIA_RPC_CONNECTION_PORT: 443
# wss://celestia.cumulo.org.es:443/websocket
CELESTIA_WS_CONNECTION_PROTOCOL: wss
CELESTIA_WS_CONNECTION_HOSTNAME: celestia.cumulo.org.es
CELESTIA_WS_CONNECTION_PORT: 443
CELESTIA_WS_CONNECTION_PATH: /websocket
INDEXER_PROCESSOR_POSTGRES_CONNECTION_STRING: postgres://postgres:password@postgres:5432/postgres
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
Expand Down
14 changes: 11 additions & 3 deletions protocol-units/da/movement/protocol/util/src/config/appd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use crate::config::default::{
default_celestia_appd_replace_args, default_celestia_appd_use_replace_args,
default_celestia_chain_id, default_celestia_namespace, default_celestia_rpc_listen_hostname,
default_celestia_rpc_listen_port, default_celestia_websocket_connection_hostname,
default_celestia_websocket_connection_port, default_celestia_websocket_connection_protocol,
default_celestia_websocket_connection_path, default_celestia_websocket_connection_port,
default_celestia_websocket_connection_protocol,
};

use celestia_types::nmt::Namespace;
Expand Down Expand Up @@ -31,6 +32,10 @@ pub struct Config {
#[serde(default = "default_celestia_websocket_connection_port")]
pub celestia_websocket_connection_port: u16,

/// The path of the Celestia Node websocket
#[serde(default = "default_celestia_websocket_connection_path")]
pub celestia_websocket_connection_path: String,

/// The auth token for the Celestia node
pub celestia_auth_token: Option<String>,

Expand Down Expand Up @@ -69,6 +74,7 @@ impl Default for Config {
celestia_websocket_connection_hostname: default_celestia_websocket_connection_hostname(
),
celestia_websocket_connection_port: default_celestia_websocket_connection_port(),
celestia_websocket_connection_path: default_celestia_websocket_connection_path(),
celestia_chain_id: default_celestia_chain_id(),
celestia_auth_token: None,
celestia_namespace: default_celestia_namespace(),
Expand All @@ -84,12 +90,14 @@ impl Config {
// FIXME: use a single URL field as the source. The format was introduced by
// Sir Tim Berners-Lee in 1994 so you don't have to compose this from
// values that need to be set in three different environment variables.
// NOTE: originally, this was not done because there was a need to reuse some parts of the URL but substitute others when running in environments like Docker.
pub fn celestia_websocket_url(&self) -> String {
format!(
"{}://{}:{}",
"{}://{}:{}{}",
self.celestia_websocket_connection_protocol,
self.celestia_websocket_connection_hostname,
self.celestia_websocket_connection_port
self.celestia_websocket_connection_port,
self.celestia_websocket_connection_path
)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::config::default::{
default_celestia_rpc_connection_hostname, default_celestia_rpc_connection_port,
default_celestia_rpc_connection_protocol, default_celestia_websocket_connection_hostname,
default_celestia_websocket_connection_port, default_movement_da_light_node_connection_hostname,
default_celestia_websocket_connection_path, default_celestia_websocket_connection_port,
default_movement_da_light_node_connection_hostname,
default_movement_da_light_node_connection_port, default_movement_da_light_node_http1,
default_movement_da_light_node_listen_hostname, default_movement_da_light_node_listen_port,
};
Expand Down Expand Up @@ -130,6 +131,10 @@ pub struct Config {
#[serde(default = "default_celestia_websocket_connection_port")]
pub celestia_websocket_connection_port: u16,

/// The path of the Celestia Node websocket
#[serde(default = "default_celestia_websocket_connection_path")]
pub celestia_websocket_connection_path: String,

// FIXME: disentangle listen config for the light node service
// from the connection config to connect to the same service?
/// The hostname to listen on for the movement-celestia-da-light-node service
Expand Down Expand Up @@ -171,6 +176,7 @@ impl Default for Config {
celestia_websocket_connection_hostname: default_celestia_websocket_connection_hostname(
),
celestia_websocket_connection_port: default_celestia_websocket_connection_port(),
celestia_websocket_connection_path: default_celestia_websocket_connection_path(),
movement_da_light_node_listen_hostname: default_movement_da_light_node_listen_hostname(
),
movement_da_light_node_listen_port: default_movement_da_light_node_listen_port(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ env_default!(
26658
);

// The default Celestia Node websocket path
env_default!(
default_celestia_websocket_connection_path,
"CELESTIA_WEBSOCKET_CONNECTION_PATH",
String,
"".to_string()
);

// The default M1 DA Light Node listen hostname
env_default!(
default_movement_da_light_node_listen_hostname,
Expand Down

0 comments on commit d837e68

Please sign in to comment.