Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ members = [
"protocol-units/da-sequencer/config",
"protocol-units/da-sequencer/client",
"protocol-units/da-sequencer/node"
]
, "protocol-units/da-sequencer/replica"]

[workspace.package]
version = "0.3.4"
Expand Down Expand Up @@ -85,6 +85,7 @@ movement-da-sequencer-client = { path = "protocol-units/da-sequencer/client" }
movement-da-sequencer-config = { path = "protocol-units/da-sequencer/config" }
movement-da-sequencer-node = { path = "protocol-units/da-sequencer/node" }
movement-da-sequencer-proto = { path = "protocol-units/da-sequencer/proto" }
movement-da-replica-node = { path = "protocol-units/da-sequencer/replica" }

# framework releases
maptos-framework-release-util = { path = "protocol-units/execution/maptos/framework/releases/util" }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
movement-da-replicat:
image: ghcr.io/movementlabsxyz/movement-full-node:${CONTAINER_REV}
container_name: movement-da-replicat
command: da replicat
environment:
- DOT_MOVEMENT_PATH=/.movement
- MOVEMENT_TIMING=info
- RUST_BACKTRACE=1
volumes:
- ${DOT_MOVEMENT_PATH}:/.movement
ports:
- "30730:30730"
- "30931:30931"
healthcheck:
test: [ "CMD-SHELL", "echo true" ]
retries: 10
interval: 10s
timeout: 5s
restart: on-failure:5

2 changes: 1 addition & 1 deletion docs/movement-node/run-fullnode/scripts/setup_migrate.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -e

export DOT_MOVEMENT_PATH=$HOME/.movement
export CONTAINER_REV="a349ae1"
export CONTAINER_REV="c42fbb8"
export MAYBE_RUN_LOCAL="false"

/usr/bin/docker compose --env-file movement/.env -f movement/docker/compose/movement-full-node/docker-compose.fullnode_setup.yml up --force-recreate
4 changes: 2 additions & 2 deletions networks/movement/movement-full-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ homepage = { workspace = true }
publish = { workspace = true }
rust-version = { workspace = true }

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
maptos-dof-execution = { workspace = true }
prost = { workspace = true }
Expand Down Expand Up @@ -60,6 +58,8 @@ movement-da-sequencer-client = { workspace = true }
movement-da-sequencer-node = { workspace = true }
movement-da-light-node-setup = { workspace = true }
movement-da-sequencer-config = { workspace = true }
movement-da-replica-node = { workspace = true }

ed25519-dalek = { workspace = true }
mcr-settlement-setup = { workspace = true }

Expand Down
3 changes: 3 additions & 0 deletions networks/movement/movement-full-node/src/da/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod read_block;
mod replicat;
mod run;
pub mod stream_blocks;

Expand All @@ -10,6 +11,7 @@ pub enum Da {
StreamBlocks(stream_blocks::StreamBlocks),
Run(run::DaRun),
ReadBlock(read_block::ReadBlock),
Replicat(replicat::DaReplicatRun),
}

impl Da {
Expand All @@ -18,6 +20,7 @@ impl Da {
Da::StreamBlocks(stream_blocks) => stream_blocks.execute().await,
Da::Run(da) => da.execute().await,
Da::ReadBlock(da) => da.execute().await,
Da::Replicat(replicat) => replicat.execute().await,
}
}
}
17 changes: 17 additions & 0 deletions networks/movement/movement-full-node/src/da/replicat.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use crate::common_args::MovementArgs;
use clap::Parser;

#[derive(Debug, Parser, Clone)]
#[clap(rename_all = "kebab-case", about = "Runs Da Sequencer.")]
pub struct DaReplicatRun {
#[clap(flatten)]
pub movement_args: MovementArgs,
}

impl DaReplicatRun {
pub async fn execute(&self) -> Result<(), anyhow::Error> {
// get the config file
let dot_movement = self.movement_args.dot_movement()?;
movement_da_replica_node::start(dot_movement).await
}
}
3 changes: 2 additions & 1 deletion networks/movement/movement-full-node/src/node/partial.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::node::{da_db::DaDB, tasks};
use crate::node::da_db::DaDB;
use crate::node::tasks;
use maptos_dof_execution::MakeOptFinServices;
use maptos_dof_execution::{v1::Executor, DynOptFinExecutor};
use maptos_opt_executor::executor::TxExecutionResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where
let mut da_client =
GrpcDaSequencerClient::try_connect(&da_connection_url, stream_heartbeat_interval_sec)
.await?;
// TODO manage alert_channel in the issue #1169

let (mut blocks_from_da, mut alert_channel) = da_client
.stream_read_from_height(StreamReadFromHeightRequest { height: synced_height })
.await
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub async fn exec() -> Result<(), anyhow::Error> {
}?;

//Define da-sequencer config path.
let pathbuff = movement_da_sequencer_config::get_config_path(&dot_movement);
let pathbuff = DaSequencerConfig::get_config_path(&dot_movement);
dot_movement.set_path(pathbuff);
// get a matching godfig object
let config_file = dot_movement.try_get_or_create_config_file().await?;
Expand Down
3 changes: 3 additions & 0 deletions networks/movement/movement-full-node/src/setup/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod all;
pub mod da;
pub mod full_node;
pub mod replicat;

use clap::Subcommand;

Expand All @@ -10,6 +11,7 @@ pub enum Setup {
All(all::All),
FullNode(full_node::FullNode),
Da(da::Da),
Replicat(replicat::Replicat),
}

impl Setup {
Expand All @@ -18,6 +20,7 @@ impl Setup {
Setup::All(all) => all.execute().await,
Setup::FullNode(full_node) => full_node.execute().await,
Setup::Da(da) => da.execute().await,
Setup::Replicat(replicat) => replicat.execute().await,
}
}
}
35 changes: 35 additions & 0 deletions networks/movement/movement-full-node/src/setup/replicat/exec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use crate::setup::replicat::local;
use godfig::{backend::config_file::ConfigFile, Godfig};
use movement_da_sequencer_config::DaReplicatConfig;
use tracing::info;

pub async fn exec() -> Result<(), anyhow::Error> {
info!("Starting Movement Full Node Setup");

// get the config file
let mut dot_movement = dot_movement::DotMovement::try_from_env()?;

//Define da-sequencer config path.
let pathbuff = DaReplicatConfig::get_config_path(&dot_movement);
dot_movement.set_path(pathbuff);
// get a matching godfig object
let config_file = dot_movement.try_get_or_create_config_file().await?;
let godfig: Godfig<DaReplicatConfig, ConfigFile> =
Godfig::new(ConfigFile::new(config_file), vec![]);

// run a godfig transaction to update the file
godfig
.try_transaction(|config| async move {
let mut config = config.unwrap_or(DaReplicatConfig::default());
let local = std::env::var_os("MAYBE_RUN_LOCAL").unwrap_or("false".into());
if local == "true" {
local::setup_movement_replica_node(&dot_movement, &mut config).await?;
}
tracing::info!("Da Sequencer Config after local setup: {:?}", config);

Ok(Some(config))
})
.await?;

Ok(())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use godfig::backend::config_file::ConfigFile;
use godfig::Godfig;
use movement_da_sequencer_config::DaReplicatConfig;
use movement_da_sequencer_node::whitelist::Whitelist;
use movement_signer::{cryptography::ed25519::Ed25519, Signing};
use movement_signer_loader::{Load, LoadedSigner};

pub async fn setup_movement_replica_node(
replicat_dot_movement: &dot_movement::DotMovement,
da_replicat_config: &mut DaReplicatConfig,
) -> Result<(), anyhow::Error> {
//update whitelist with node public key.
// Load Maptos config
let maptos_config = {
let dot_movement = dot_movement::DotMovement::try_from_env()?;
let config_file = dot_movement.try_get_or_create_config_file().await?;
let godfig: Godfig<maptos_execution_util::config::Config, ConfigFile> =
Godfig::new(ConfigFile::new(config_file), vec!["maptos_config".to_string()]);
godfig.try_wait_for_ready().await
}?;

let loader: LoadedSigner<Ed25519> =
maptos_config.da_sequencer.batch_signer_identifier.load().await?;

let verifying_key =
ed25519_dalek::VerifyingKey::from_bytes(&loader.public_key().await?.to_bytes())?;

let dotmovement_path = replicat_dot_movement.get_path().to_path_buf();
let whitelist_path =
dotmovement_path.join(&da_replicat_config.da_sequencer.whitelist_relative_path);
if whitelist_path.exists() {
std::fs::remove_file(&whitelist_path)?;
}
Whitelist::save(&whitelist_path, &[verifying_key])?;

// Register the full node has main node for state propagation.
let pk_str = hex::encode(verifying_key.to_bytes());

da_replicat_config.da_sequencer.main_node_verifying_key = Some(pk_str);

//set the same batch identifier as the fullnode
da_replicat_config.da_client.batch_signer_identifier =
maptos_config.da_sequencer.batch_signer_identifier;

tracing::info!("Da Sequencer local setup done.");
Ok(())
}
13 changes: 13 additions & 0 deletions networks/movement/movement-full-node/src/setup/replicat/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use clap::Parser;

mod exec;
mod local;

#[derive(Parser, Debug)]
pub struct Replicat;

impl Replicat {
pub async fn execute(&self) -> Result<(), anyhow::Error> {
exec::exec().await
}
}
53 changes: 53 additions & 0 deletions process-compose/movement-full-node/process-compose.replicat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: "3"

processes:
setup:
environment:
- "MAYBE_RUN_LOCAL=true"
- "MOVEMENT_DA_SEQUENCER_GRPC_LISTEN_ADDRESS=0.0.0.0:30830"
command: |
RUST_BACKTRACE=1 movement-full-node setup all
depends_on:
build:
condition: process_completed_successfully

da-replicat-setup:
environment:
- "MAYBE_RUN_LOCAL=true"
- "MAPTOS_DA_SEQUENCER_CONNECTION_URL=http://0.0.0.0:30830"
- "MOVEMENT_DA_HEALTHCHECK_PORT=30932"
command: |
RUST_BACKTRACE=1 movement-full-node setup replicat
depends_on:
setup:
condition: process_completed_successfully

replicat-node:
command: |
RUST_BACKTRACE=1 movement-full-node da replicat
depends_on:
da-sequencer:
condition: process_healthy
da-replicat-setup:
condition: process_completed_successfully
readiness_probe:
initial_delay_seconds: 30
exec:
command: curl http://0.0.0.0:30932/health

movement-full-node:
command: |
RUST_BACKTRACE=1 movement-full-node run
depends_on:
setup:
condition: process_completed_successfully
da-sequencer:
condition: process_healthy
replicat-node:
condition: process_healthy
readiness_probe:
initial_delay_seconds: 10
exec:
command: curl http://0.0.0.0:30731
ports:
- "9464:9464" # Expose metrics endpoint
3 changes: 3 additions & 0 deletions protocol-units/da-sequencer/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ tracing = { workspace = true }
hex = { workspace = true }
dot-movement = { workspace = true }
anyhow = { workspace = true }
url = { workspace = true , features = ["serde"] }

maptos-execution-util = { workspace = true }

[lints]
workspace = true
Loading
Loading