Skip to content

Commit

Permalink
chore!: Rename other m1_da occurrences
Browse files Browse the repository at this point in the history
  • Loading branch information
mzabaluev committed Nov 20, 2024
1 parent 80f76f5 commit 320d74b
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 72 deletions.
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# maptos-executor
protocol-units/execution/* @l-monninger @0xmovses @musitdev @mzabaluev

# m1-da
protocol-units/da/celestia/* @l-monninger @mzabaluev
# da
protocol-units/da/* @l-monninger @mzabaluev

# mempool
protocol-units/mempool/* @l-monninger @mzabaluev
Expand Down
2 changes: 1 addition & 1 deletion protocol-units/da/celestia/light-node/src/v1/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
let godfig = Godfig::new(
ConfigFile::new(file),
vec![
"m1_da_light_node_config".to_string(), // in this example this comes from the structuring of the config file
"celestia_da_light_node_config".to_string(), // in this example this comes from the structuring of the config file
],
);
Ok(Self { godfig, _marker: std::marker::PhantomData })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ where
}

fn try_service_address(&self) -> Result<String, anyhow::Error> {
Ok(self.config.m1_da_light_node_service())
Ok(self.config.movement_da_light_node_service())
}

/// Runs background tasks for the LightNodeV1 instance.
Expand Down
15 changes: 7 additions & 8 deletions protocol-units/da/celestia/setup/src/arabica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ impl Arabica {
pub async fn setup_celestia(
&self,
dot_movement: DotMovement,
mut config: Config,
config: Config,
) -> Result<Config, anyhow::Error> {
let mut config =
common::celestia::initialize_celestia_config(dot_movement.clone(), config)?;
let mut config = common::memseq::initialize_memseq_config(dot_movement.clone(), config)?;
let config = common::celestia::initialize_celestia_config(dot_movement.clone(), config)?;
let config = common::memseq::initialize_memseq_config(dot_movement.clone(), config)?;
let mut config = common::celestia::make_dirs(dot_movement.clone(), config).await?;

// celestia light init --p2p.network arabica
Expand All @@ -109,10 +108,10 @@ impl Arabica {

pub async fn create_and_fund_account(
&self,
dot_movement: DotMovement,
_dot_movement: DotMovement,
config: Config,
) -> Result<(), anyhow::Error> {
/**
/*
* #!/bin/bash
# Maximum number of retries
max_retries=10
Expand Down Expand Up @@ -204,7 +203,7 @@ impl Arabica {
config: Config,
) -> Result<Config, anyhow::Error> {
// By default the M1 DA Light Node is not initialized.
if !config.m1_da_light_node_is_initial {
if !config.da_light_node_is_initial {
info!("M1 DA Light Node is already initialized.");
return Ok(config);
}
Expand All @@ -215,7 +214,7 @@ impl Arabica {
info!("M1 DA Light Node setup complete.");

// Now we set the config to initialized.
config.m1_da_light_node_is_initial = false;
config.da_light_node_is_initial = false;

// Placeholder for returning the actual configuration.
Ok(config)
Expand Down
9 changes: 4 additions & 5 deletions protocol-units/da/celestia/setup/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ impl Local {
config: Config,
) -> Result<Config, anyhow::Error> {
info!("Setting up Celestia.");
let mut config =
common::celestia::initialize_celestia_config(dot_movement.clone(), config)?;
let mut config = common::memseq::initialize_memseq_config(dot_movement.clone(), config)?;
let config = common::celestia::initialize_celestia_config(dot_movement.clone(), config)?;
let config = common::memseq::initialize_memseq_config(dot_movement.clone(), config)?;
let mut config = common::celestia::make_dirs(dot_movement.clone(), config).await?;
info!("Setup config for Memseq and Celestia: {:?}", config);

Expand Down Expand Up @@ -195,7 +194,7 @@ impl Local {
config: Config,
) -> Result<Config, anyhow::Error> {
// By default the M1 DA Light Node is not initialized.
if !config.m1_da_light_node_is_initial {
if !config.da_light_node_is_initial {
info!("M1 DA Light Node is already initialized.");
return Ok(config);
}
Expand All @@ -206,7 +205,7 @@ impl Local {
info!("M1 DA Light Node setup complete.");

// Now we set the config to initialized.
config.m1_da_light_node_is_initial = false;
config.da_light_node_is_initial = false;

// Placeholder for returning the actual configuration.
Ok(config)
Expand Down
11 changes: 5 additions & 6 deletions protocol-units/da/celestia/setup/src/mocha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ impl Mocha {
pub async fn setup_celestia(
&self,
dot_movement: DotMovement,
mut config: Config,
config: Config,
) -> Result<Config, anyhow::Error> {
let mut config =
common::celestia::initialize_celestia_config(dot_movement.clone(), config)?;
let mut config = common::memseq::initialize_memseq_config(dot_movement.clone(), config)?;
let config = common::celestia::initialize_celestia_config(dot_movement.clone(), config)?;
let config = common::memseq::initialize_memseq_config(dot_movement.clone(), config)?;
let mut config = common::celestia::make_dirs(dot_movement.clone(), config).await?;

// celestia light init --p2p.network mocha
Expand All @@ -109,7 +108,7 @@ impl Mocha {
config: Config,
) -> Result<Config, anyhow::Error> {
// By default the M1 DA Light Node is not initialized.
if !config.m1_da_light_node_is_initial {
if !config.da_light_node_is_initial {
info!("M1 DA Light Node is already initialized.");
return Ok(config);
}
Expand All @@ -120,7 +119,7 @@ impl Mocha {
info!("M1 DA Light Node setup complete.");

// Now we set the config to initialized.
config.m1_da_light_node_is_initial = false;
config.da_light_node_is_initial = false;

// Placeholder for returning the actual configuration.
Ok(config)
Expand Down
6 changes: 3 additions & 3 deletions protocol-units/da/celestia/util/src/config/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ env_default!(

// The default M1 DA Light Node listen hostname
env_default!(
default_m1_da_light_node_listen_hostname,
default_movement_da_light_node_listen_hostname,
"MOVEMENT_DA_LIGHT_NODE_LISTEN_HOSTNAME",
String,
"0.0.0.0".to_string()
);

// The default M1 DA Light Node listen port
env_default!(
default_m1_da_light_node_listen_port,
default_movement_da_light_node_listen_port,
"MOVEMENT_DA_LIGHT_NODE_LISTEN_PORT",
u16,
30730
Expand Down Expand Up @@ -153,4 +153,4 @@ pub fn default_celestia_bridge_replace_args() -> Vec<String> {
}

// Whether to use replace args for Celestia bridge
env_default!(default_m1_da_light_node_is_initial, "MOVEMENT_DA_LIGHT_NODE_IS_INITIAL", bool, true);
env_default!(default_da_light_node_is_initial, "MOVEMENT_DA_LIGHT_NODE_IS_INITIAL", bool, true);
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::config::common::{
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_m1_da_light_node_listen_hostname,
default_m1_da_light_node_listen_port, default_movement_da_light_node_connection_hostname,
default_movement_da_light_node_connection_port,
default_celestia_websocket_connection_port, default_movement_da_light_node_connection_hostname,
default_movement_da_light_node_connection_port, default_movement_da_light_node_listen_hostname,
default_movement_da_light_node_listen_port,
};
use ecdsa::SigningKey;
use k256::Secp256k1;
Expand Down Expand Up @@ -111,13 +111,15 @@ pub struct Config {
#[serde(default = "default_celestia_websocket_connection_port")]
pub celestia_websocket_connection_port: u16,

// 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
#[serde(default = "default_m1_da_light_node_listen_hostname")]
pub m1_da_light_node_listen_hostname: String,
#[serde(default = "default_movement_da_light_node_listen_hostname")]
pub movement_da_light_node_listen_hostname: String,

/// The port to listen on for the movement-celestia-da-light-node service
#[serde(default = "default_m1_da_light_node_listen_port")]
pub m1_da_light_node_listen_port: u16,
#[serde(default = "default_movement_da_light_node_listen_port")]
pub movement_da_light_node_listen_port: u16,

/// The protocol for movement-celestia-da-light-node connection
#[serde(default = "default_celestia_rpc_connection_protocol")]
Expand Down Expand Up @@ -146,8 +148,9 @@ impl Default for Config {
celestia_websocket_connection_hostname: default_celestia_websocket_connection_hostname(
),
celestia_websocket_connection_port: default_celestia_websocket_connection_port(),
m1_da_light_node_listen_hostname: default_m1_da_light_node_listen_hostname(),
m1_da_light_node_listen_port: default_m1_da_light_node_listen_port(),
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(),
movement_da_light_node_connection_hostname:
default_movement_da_light_node_connection_hostname(),
movement_da_light_node_connection_port: default_movement_da_light_node_connection_port(
Expand Down
16 changes: 7 additions & 9 deletions protocol-units/da/celestia/util/src/config/local/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
pub mod appd;
pub mod bridge;
pub mod m1_da_light_node;
use crate::config::common::{
default_celestia_force_new_chain, default_m1_da_light_node_is_initial,
};
pub mod da_light_node;
use crate::config::common::{default_celestia_force_new_chain, default_da_light_node_is_initial};
use memseq_util::Config as MemseqConfig;
use serde::{Deserialize, Serialize};

Expand All @@ -19,7 +17,7 @@ pub struct Config {

/// The movement-celestia-da-light-node configuration
#[serde(default)]
pub m1_da_light_node: m1_da_light_node::Config,
pub da_light_node: da_light_node::Config,

/// Whether to force a new chain
#[serde(default = "default_celestia_force_new_chain")]
Expand All @@ -29,19 +27,19 @@ pub struct Config {
#[serde(default)]
pub memseq: MemseqConfig,

#[serde(default = "default_m1_da_light_node_is_initial")]
pub m1_da_light_node_is_initial: bool,
#[serde(default = "default_da_light_node_is_initial")]
pub da_light_node_is_initial: bool,
}

impl Default for Config {
fn default() -> Self {
Self {
appd: appd::Config::default(),
bridge: bridge::Config::default(),
m1_da_light_node: m1_da_light_node::Config::default(),
da_light_node: da_light_node::Config::default(),
celestia_force_new_chain: default_celestia_force_new_chain(),
memseq: MemseqConfig::default(),
m1_da_light_node_is_initial: default_m1_da_light_node_is_initial(),
da_light_node_is_initial: default_da_light_node_is_initial(),
}
}
}
56 changes: 30 additions & 26 deletions protocol-units/da/celestia/util/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,65 +118,69 @@ impl Config {
pub fn movement_da_light_node_connection_protocol(&self) -> String {
match self {
Config::Local(local) => {
local.m1_da_light_node.movement_da_light_node_connection_protocol.clone()
local.da_light_node.movement_da_light_node_connection_protocol.clone()
}
Config::Arabica(local) => {
local.m1_da_light_node.movement_da_light_node_connection_protocol.clone()
local.da_light_node.movement_da_light_node_connection_protocol.clone()
}
Config::Mocha(local) => {
local.m1_da_light_node.movement_da_light_node_connection_protocol.clone()
local.da_light_node.movement_da_light_node_connection_protocol.clone()
}
}
}

/// Gets M1 DA Light Node listen hostname
pub fn m1_da_light_node_listen_hostname(&self) -> String {
pub fn movement_da_light_node_listen_hostname(&self) -> String {
match self {
Config::Local(local) => local.m1_da_light_node.m1_da_light_node_listen_hostname.clone(),
Config::Local(local) => {
local.da_light_node.movement_da_light_node_listen_hostname.clone()
}
Config::Arabica(local) => {
local.m1_da_light_node.m1_da_light_node_listen_hostname.clone()
local.da_light_node.movement_da_light_node_listen_hostname.clone()
}
Config::Mocha(local) => {
local.da_light_node.movement_da_light_node_listen_hostname.clone()
}
Config::Mocha(local) => local.m1_da_light_node.m1_da_light_node_listen_hostname.clone(),
}
}

/// Gets M1 DA Light Node listen port
pub fn m1_da_light_node_listen_port(&self) -> u16 {
pub fn movement_da_light_node_listen_port(&self) -> u16 {
match self {
Config::Local(local) => local.m1_da_light_node.m1_da_light_node_listen_port,
Config::Arabica(local) => local.m1_da_light_node.m1_da_light_node_listen_port,
Config::Mocha(local) => local.m1_da_light_node.m1_da_light_node_listen_port,
Config::Local(local) => local.da_light_node.movement_da_light_node_listen_port,
Config::Arabica(local) => local.da_light_node.movement_da_light_node_listen_port,
Config::Mocha(local) => local.da_light_node.movement_da_light_node_listen_port,
}
}

/// Gets M1 DA Light Node service
pub fn m1_da_light_node_service(&self) -> String {
let hostname = self.m1_da_light_node_listen_hostname();
let port = self.m1_da_light_node_listen_port();
pub fn movement_da_light_node_service(&self) -> String {
let hostname = self.movement_da_light_node_listen_hostname();
let port = self.movement_da_light_node_listen_port();
format!("{}:{}", hostname, port)
}

/// Gets M1 DA Light Node connection hostname
pub fn movement_da_light_node_connection_hostname(&self) -> String {
match self {
Config::Local(local) => {
local.m1_da_light_node.movement_da_light_node_connection_hostname.clone()
local.da_light_node.movement_da_light_node_connection_hostname.clone()
}
Config::Arabica(local) => {
local.m1_da_light_node.movement_da_light_node_connection_hostname.clone()
local.da_light_node.movement_da_light_node_connection_hostname.clone()
}
Config::Mocha(local) => {
local.m1_da_light_node.movement_da_light_node_connection_hostname.clone()
local.da_light_node.movement_da_light_node_connection_hostname.clone()
}
}
}

/// Gets M1 DA Light Node connection port
pub fn movement_da_light_node_connection_port(&self) -> u16 {
match self {
Config::Local(local) => local.m1_da_light_node.movement_da_light_node_connection_port,
Config::Arabica(local) => local.m1_da_light_node.movement_da_light_node_connection_port,
Config::Mocha(local) => local.m1_da_light_node.movement_da_light_node_connection_port,
Config::Local(local) => local.da_light_node.movement_da_light_node_connection_port,
Config::Arabica(local) => local.da_light_node.movement_da_light_node_connection_port,
Config::Mocha(local) => local.da_light_node.movement_da_light_node_connection_port,
}
}

Expand All @@ -198,18 +202,18 @@ impl Config {
/// Gets the da signing key as a string
pub fn da_signing_key(&self) -> String {
match self {
Config::Local(local) => local.m1_da_light_node.da_signers.private_key_hex.clone(),
Config::Arabica(local) => local.m1_da_light_node.da_signers.private_key_hex.clone(),
Config::Mocha(local) => local.m1_da_light_node.da_signers.private_key_hex.clone(),
Config::Local(local) => local.da_light_node.da_signers.private_key_hex.clone(),
Config::Arabica(local) => local.da_light_node.da_signers.private_key_hex.clone(),
Config::Mocha(local) => local.da_light_node.da_signers.private_key_hex.clone(),
}
}

/// Gets the da signers sec1 keys
pub fn da_signers_sec1_keys(&self) -> HashSet<String> {
match self {
Config::Local(local) => local.m1_da_light_node.da_signers.public_keys_hex.clone(),
Config::Arabica(local) => local.m1_da_light_node.da_signers.public_keys_hex.clone(),
Config::Mocha(local) => local.m1_da_light_node.da_signers.public_keys_hex.clone(),
Config::Local(local) => local.da_light_node.da_signers.public_keys_hex.clone(),
Config::Arabica(local) => local.da_light_node.da_signers.public_keys_hex.clone(),
Config::Mocha(local) => local.da_light_node.da_signers.public_keys_hex.clone(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion protocol-units/da/grpc/light-node/build.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
buildtime::proto_build_main!("movementlabs/protocol_units/da/m1/light_node/v1beta1.proto");
buildtime::proto_build_main!("movementlabs/protocol_units/da/light_node/v1beta1.proto");
2 changes: 1 addition & 1 deletion util/buildtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn test_cargo_workspace() -> Result<(), anyhow::Error> {
Standardizes tonic builds, so that you can simply put:

```rust
buildtime::proto_build_main!("protocol-units/data-availability/m1/m1_da_light_node.proto");
buildtime::proto_build_main!("movementlabs/protocol-units/da/light_node/v1beta1.proto");
```

in your `build.rs` file and it will generate the necessary tonic code.
Expand Down

0 comments on commit 320d74b

Please sign in to comment.