From 2f5e8e0bcd0ba4233b632a0e79bd2f1d606d236f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Wed, 9 Jul 2025 08:59:55 +0100 Subject: [PATCH] feat: forbid running mixnode + entry on the same node (#5878) --- nym-node/src/cli/commands/run/mod.rs | 1 + nym-node/src/config/mod.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/nym-node/src/cli/commands/run/mod.rs b/nym-node/src/cli/commands/run/mod.rs index 8b568150ed..703e47662b 100644 --- a/nym-node/src/cli/commands/run/mod.rs +++ b/nym-node/src/cli/commands/run/mod.rs @@ -78,6 +78,7 @@ pub(crate) async fn execute(mut args: Args) -> Result<(), NymNodeError> { } config }; + config.validate()?; if !config.modes.any_enabled() { warn!("this node is going to run without mixnode or gateway support! consider providing `mode` value"); diff --git a/nym-node/src/config/mod.rs b/nym-node/src/config/mod.rs index eca9289872..dfaa7eaef4 100644 --- a/nym-node/src/config/mod.rs +++ b/nym-node/src/config/mod.rs @@ -426,6 +426,13 @@ impl Config { pub fn validate(&self) -> Result<(), NymNodeError> { self.mixnet.validate()?; + // it's not allowed to run mixnode mode alongside entry mode + if self.modes.mixnode && self.modes.entry { + return Err(NymNodeError::config_validation_failure( + "illegal modes configuration - node cannot run as a mixnode and an entry gateway", + )); + } + Ok(()) } }