diff --git a/compose.static.yml b/compose.static.yml index 9cfc4ff8..280b72b8 100644 --- a/compose.static.yml +++ b/compose.static.yml @@ -3,7 +3,9 @@ services: bootstrap: container_name: bootstrap - build: "testnet" + build: + context: . + dockerfile: testnet/Dockerfile ports: - "3000:3000/tcp" - "18080:8080/tcp" @@ -22,7 +24,9 @@ services: libp2p-node-1: container_name: libp2p_node_1 - build: "testnet" + build: + context: . + dockerfile: testnet/Dockerfile volumes: - ./testnet:/etc/nomos depends_on: @@ -46,7 +50,9 @@ services: libp2p-node-2: container_name: libp2p_node_2 - build: "testnet" + build: + context: . + dockerfile: testnet/Dockerfile volumes: - ./testnet:/etc/nomos depends_on: @@ -70,7 +76,9 @@ services: libp2p-node-3: container_name: libp2p_node_3 - build: "testnet" + build: + context: . + dockerfile: testnet/Dockerfile volumes: - ./testnet:/etc/nomos depends_on: @@ -94,7 +102,9 @@ services: mix-node-0: container_name: mix_node_0 - build: "testnet" + build: + context: . + dockerfile: testnet/Dockerfile volumes: - ./testnet:/etc/nomos ports: @@ -105,7 +115,9 @@ services: mix-node-1: container_name: mix_node_1 - build: "testnet" + build: + context: . + dockerfile: testnet/Dockerfile volumes: - ./testnet:/etc/nomos ports: @@ -116,7 +128,9 @@ services: mix-node-2: container_name: mix_node_2 - build: "testnet" + build: + context: . + dockerfile: testnet/Dockerfile volumes: - ./testnet:/etc/nomos ports: diff --git a/nodes/nomos-node/src/config.rs b/nodes/nomos-node/src/config.rs index acd622e6..f3f464d9 100644 --- a/nodes/nomos-node/src/config.rs +++ b/nodes/nomos-node/src/config.rs @@ -108,6 +108,12 @@ pub struct OverlayArgs { pub overlay_super_majority_threshold: Option, } +#[derive(Parser, Debug, Clone)] +pub struct DaArgs { + #[clap(long = "da-voter", env = "DA_VOTER")] + da_voter: Option, +} + #[derive(Deserialize, Debug, Clone, Serialize)] pub struct Config { pub log: ::Settings, @@ -264,4 +270,15 @@ impl Config { Ok(self) } + + pub fn update_da(mut self, da_args: DaArgs) -> Result { + let DaArgs { da_voter } = da_args; + + if let Some(voter) = da_voter { + let bytes = <[u8; 32]>::from_hex(voter)?; + self.da.da_protocol.voter = bytes; + } + + Ok(self) + } } diff --git a/nodes/nomos-node/src/lib.rs b/nodes/nomos-node/src/lib.rs index bc29d230..9e3c7b87 100644 --- a/nodes/nomos-node/src/lib.rs +++ b/nodes/nomos-node/src/lib.rs @@ -35,7 +35,7 @@ use nomos_storage::{ StorageService, }; -pub use config::{Config, ConsensusArgs, HttpArgs, LogArgs, NetworkArgs, OverlayArgs}; +pub use config::{Config, ConsensusArgs, DaArgs, HttpArgs, LogArgs, NetworkArgs, OverlayArgs}; use nomos_core::{ da::certificate::select::FillSize as FillSizeWithBlobsCertificate, tx::select::FillSize as FillSizeWithTx, diff --git a/nodes/nomos-node/src/main.rs b/nodes/nomos-node/src/main.rs index 974f2d57..f956b2b0 100644 --- a/nodes/nomos-node/src/main.rs +++ b/nodes/nomos-node/src/main.rs @@ -1,6 +1,6 @@ use full_replication::{Blob, Certificate}; use nomos_node::{ - Config, ConsensusArgs, HttpArgs, LogArgs, NetworkArgs, Nomos, NomosServiceSettings, + Config, ConsensusArgs, DaArgs, HttpArgs, LogArgs, NetworkArgs, Nomos, NomosServiceSettings, OverlayArgs, Tx, }; @@ -40,11 +40,15 @@ struct Args { /// Overrides overlay config. #[clap(flatten)] overlay_args: OverlayArgs, + /// Overrides da config. + #[clap(flatten)] + da_args: DaArgs, } fn main() -> Result<()> { let Args { config, + da_args, log_args, http_args, network_args, @@ -52,6 +56,7 @@ fn main() -> Result<()> { overlay_args, } = Args::parse(); let config = serde_yaml::from_reader::<_, Config>(std::fs::File::open(config)?)? + .update_da(da_args)? .update_log(log_args)? .update_http(http_args)? .update_consensus(consensus_args)? diff --git a/testnet/bootstrap_config.yaml b/testnet/bootstrap_config.yaml index 4c1f8243..d7236035 100644 --- a/testnet/bootstrap_config.yaml +++ b/testnet/bootstrap_config.yaml @@ -70,6 +70,7 @@ http: da: da_protocol: + voter: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] num_attestations: 1 backend: max_capacity: 10 diff --git a/testnet/libp2p_config.yaml b/testnet/libp2p_config.yaml index e2cc84d6..ca3f9ae2 100644 --- a/testnet/libp2p_config.yaml +++ b/testnet/libp2p_config.yaml @@ -70,6 +70,7 @@ http: da: da_protocol: + voter: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] num_attestations: 1 backend: max_capacity: 10 diff --git a/testnet/scripts/run_bootstrap_node.sh b/testnet/scripts/run_bootstrap_node.sh index 253da58d..1c456f01 100755 --- a/testnet/scripts/run_bootstrap_node.sh +++ b/testnet/scripts/run_bootstrap_node.sh @@ -3,15 +3,18 @@ set -e CONSENSUS_PRIV_KEY=$BOOTSTRAP_NODE_KEY +DA_VOTER_KEY=$BOOTSTRAP_NODE_KEY NET_NODE_KEY=$BOOTSTRAP_NODE_KEY OVERLAY_NODES=$(/etc/nomos/scripts/consensus_node_list.sh) export CONSENSUS_PRIV_KEY \ + DA_VOTER_KEY \ OVERLAY_NODES \ NET_NODE_KEY echo "I am a container ${HOSTNAME} node ${NET_NODE_KEY}" echo "CONSENSUS_PRIV_KEY: ${CONSENSUS_PRIV_KEY}" +echo "DA_VOTER_KEY: ${DA_VOTER_KEY}" echo "OVERLAY_NODES: ${OVERLAY_NODES}" exec /usr/bin/nomos-node /etc/nomos/bootstrap_config.yaml diff --git a/testnet/scripts/run_nomos_node.sh b/testnet/scripts/run_nomos_node.sh index 4c33a934..ec30fad8 100755 --- a/testnet/scripts/run_nomos_node.sh +++ b/testnet/scripts/run_nomos_node.sh @@ -5,6 +5,7 @@ set -e # Set env variables for nomos-node. NET_NODE_KEY=$(/etc/nomos/scripts/register_node.sh) CONSENSUS_PRIV_KEY=$NET_NODE_KEY +DA_VOTER_KEY=$CONSENSUS_PRIV_KEY OVERLAY_NODES=$(/etc/nomos/scripts/consensus_node_list.sh) node_ids=$(etcdctl get "/node/" --prefix --keys-only) @@ -21,12 +22,14 @@ for node_id in $node_ids; do done export CONSENSUS_PRIV_KEY \ + DA_VOTER_KEY \ OVERLAY_NODES \ NET_NODE_KEY \ NET_INITIAL_PEERS echo "I am a container ${HOSTNAME} node ${NET_NODE_KEY}" echo "CONSENSUS_PRIV_KEY: ${CONSENSUS_PRIV_KEY}" +echo "DA_VOTER_KEY: ${DA_VOTER_KEY}" echo "OVERLAY_NODES: ${OVERLAY_NODES}" echo "NET_INITIAL_PEERS: ${NET_INITIAL_PEERS}"