Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(node-manager): ✨ adds maintain cli command #2119

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion node-launchpad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ reqwest = { version = "0.12.2", default-features = false, features = [
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107"
signal-hook = "0.3.17"
sn-node-manager = { version = "0.10.3", path = "../sn_node_manager" }
sn-node-manager = { version = "0.11.3", path = "../sn_node_manager" }
sn_peers_acquisition = { version = "0.5.0", path = "../sn_peers_acquisition" }
sn-releases = "~0.2.6"
sn_service_management = { version = "0.3.11", path = "../sn_service_management" }
Expand Down
10 changes: 5 additions & 5 deletions node-launchpad/src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub trait Component {
/// # Returns
///
/// * `Result<()>` - An Ok result or an error.
#[expect(unused_variables)]
#[allow(unused_variables)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we leave these as expect please, otherwise we can drop the lint

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with rust, but I couldn't cargo build with those remaining as expect. Unless there's some cargo config settings that need to be set?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I think it might be because it was a new feature that was stablizied in the latest rust version. Could you run rustup update && rustup default stable and try compiling it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that it does allow me to build but results in a lot more orange and red in my IDE.. Also is there a way to force a rustc version so that it warns others before attempting to build? -- Looks like maybe

[package]
rust-version = "1.81.0"

fn register_action_handler(&mut self, tx: UnboundedSender<Action>) -> Result<()> {
Ok(())
}
Expand All @@ -51,7 +51,7 @@ pub trait Component {
/// # Returns
///
/// * `Result<()>` - An Ok result or an error.
#[expect(unused_variables)]
#[allow(unused_variables)]
fn register_config_handler(&mut self, config: Config) -> Result<()> {
Ok(())
}
Expand Down Expand Up @@ -93,7 +93,7 @@ pub trait Component {
/// # Returns
///
/// * `Result<Option<Action>>` - An action to be processed or none.
#[expect(unused_variables)]
#[allow(unused_variables)]
fn handle_key_events(&mut self, key: KeyEvent) -> Result<Vec<Action>> {
Ok(vec![])
}
Expand All @@ -106,7 +106,7 @@ pub trait Component {
/// # Returns
///
/// * `Result<Option<Action>>` - An action to be processed or none.
#[expect(unused_variables)]
#[allow(unused_variables)]
fn handle_mouse_events(&mut self, mouse: MouseEvent) -> Result<Vec<Action>> {
Ok(vec![])
}
Expand All @@ -119,7 +119,7 @@ pub trait Component {
/// # Returns
///
/// * `Result<Option<Action>>` - An action to be processed or none.
#[expect(unused_variables)]
#[allow(unused_variables)]
fn update(&mut self, action: Action) -> Result<Option<Action>> {
Ok(None)
}
Expand Down
4 changes: 2 additions & 2 deletions node-launchpad/src/components/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ impl Status {
self.node_table_state.select(Some(i));
}

#[expect(dead_code)]
#[allow(dead_code)]
fn unselect_table_item(&mut self) {
self.node_table_state.select(None);
}

#[expect(dead_code)]
#[allow(dead_code)]
fn get_service_name_of_selected_table_item(&self) -> Option<String> {
let Some(service_idx) = self.node_table_state.selected() else {
warn!("No item selected from table, not removing anything");
Expand Down
12 changes: 6 additions & 6 deletions node-launchpad/src/node_mgmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,23 @@ async fn scale_down_nodes(config: &NodeConfig, count: u16) {
config.data_dir_path.clone(),
true,
None,
None,
config.home_network,
false,
None,
None,
None,
None, // We don't care about the port, as we are scaling down
config.owner.clone(),
config.safenode_path.clone(),
config.peers_args.clone(),
None,
None,
config.safenode_path.clone(),
None,
config.upnp,
None,
None,
VerbosityLevel::Minimal,
None,
VerbosityLevel::Minimal
)
.await
{
Expand Down Expand Up @@ -361,23 +361,23 @@ async fn add_nodes(
config.data_dir_path.clone(),
true,
None,
None,
config.home_network,
false,
None,
None,
None,
port_range,
config.owner.clone(),
config.safenode_path.clone(),
config.peers_args.clone(),
None,
None,
config.safenode_path.clone(),
None,
config.upnp,
None,
None,
VerbosityLevel::Minimal,
None,
VerbosityLevel::Minimal
)
.await
{
Expand Down
2 changes: 1 addition & 1 deletion sn_cli/src/files/files_uploader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl FilesUploader {
Ok(failed_chunks)
}

#[expect(clippy::type_complexity)]
#[allow(clippy::type_complexity)]
fn spawn_upload_events_handler(
mut chunk_manager: ChunkManager,
make_data_public: bool,
Expand Down
2 changes: 1 addition & 1 deletion sn_client/src/acc_packet/user_secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn account_wallet_secret_key(
Ok(MainSecretKey::new(sk))
}

#[expect(dead_code)] // as yet unused, will be used soon
#[allow(dead_code)] // as yet unused, will be used soon
/// Derive an xorname from the mnemonic for the account to store data.
pub(crate) fn account_root_xorname(mnemonic: bip39::Mnemonic, passphrase: &str) -> Result<XorName> {
let seed = mnemonic.to_seed(passphrase);
Expand Down
2 changes: 1 addition & 1 deletion sn_client/src/chunks/pac_man.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(crate) enum DataMapLevel {
Additional(DataMap),
}

#[expect(unused)]
#[allow(unused)]
pub(crate) fn encrypt_from_path(path: &Path, output_dir: &Path) -> Result<(Chunk, Vec<XorName>)> {
let (data_map, mut encrypted_chunks) = self_encryption::encrypt_from_file(path, output_dir)?;

Expand Down
2 changes: 1 addition & 1 deletion sn_client/src/uploader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ trait UploaderInterface: Send + Sync {
task_result_sender: mpsc::Sender<TaskResult>,
);

#[expect(clippy::too_many_arguments)]
#[allow(clippy::too_many_arguments)]
fn submit_get_store_cost_task(
&mut self,
client: Client,
Expand Down
4 changes: 2 additions & 2 deletions sn_faucet/src/faucet_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ async fn respond_to_donate_request(
}

#[cfg(not(feature = "gifting"))]
#[expect(clippy::unused_async)]
#[allow(clippy::unused_async)]
async fn respond_to_gift_request(
_client: Client,
_key: String,
Expand Down Expand Up @@ -457,7 +457,7 @@ async fn startup_server(client: Client) -> Result<()> {
// Create a semaphore with a single permit
let semaphore = Arc::new(Semaphore::new(1));

#[expect(unused)]
#[allow(unused)]
let mut balances = HashMap::<String, NanoTokens>::new();
#[cfg(feature = "distribution")]
{
Expand Down
2 changes: 1 addition & 1 deletion sn_networking/src/record_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ fn positive_input_0_1_sigmoid(x: f64) -> f64 {
1.0 / (1.0 + (-30.0 * (x - 0.5)).exp())
}

#[expect(trivial_casts)]
#[allow(trivial_casts)]
#[cfg(test)]
mod tests {

Expand Down
4 changes: 2 additions & 2 deletions sn_node/src/bin/safenode/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct Opt {
/// - Linux: $HOME/.local/share/safe/node/<peer-id>/logs
/// - macOS: $HOME/Library/Application Support/safe/node/<peer-id>/logs
/// - Windows: C:\Users\<username>\AppData\Roaming\safe\node\<peer-id>\logs
#[expect(rustdoc::invalid_html_tags)]
#[allow(rustdoc::invalid_html_tags)]
#[clap(long, default_value_t = LogOutputDestArg::DataDir, value_parser = parse_log_output, verbatim_doc_comment)]
log_output_dest: LogOutputDestArg,

Expand Down Expand Up @@ -124,7 +124,7 @@ struct Opt {
/// - Linux: $HOME/.local/share/safe/node/<peer-id>
/// - macOS: $HOME/Library/Application Support/safe/node/<peer-id>
/// - Windows: C:\Users\<username>\AppData\Roaming\safe\node\<peer-id>
#[expect(rustdoc::invalid_html_tags)]
#[allow(rustdoc::invalid_html_tags)]
#[clap(long, verbatim_doc_comment)]
root_dir: Option<PathBuf>,

Expand Down
2 changes: 1 addition & 1 deletion sn_node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl RunningNode {
/// - Linux: $HOME/.local/share/safe/node/<peer-id>
/// - macOS: $HOME/Library/Application Support/safe/node/<peer-id>
/// - Windows: C:\Users\<username>\AppData\Roaming\safe\node\<peer-id>
#[expect(rustdoc::invalid_html_tags)]
#[allow(rustdoc::invalid_html_tags)]
pub fn root_dir_path(&self) -> PathBuf {
self.network.root_dir_path().clone()
}
Expand Down
2 changes: 1 addition & 1 deletion sn_node/tests/spend_simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@
// /// Double spend a transaction whose outputs are all UTXO.
// /// Returns the set of input cashnotes to double spend and the keys of the output cashnotes that will be unspendable
// /// after the attack.
// #[expect(clippy::type_complexity)]
// #[allow(clippy::type_complexity)]
// fn get_cashnotes_to_double_spend(
// our_id: WalletId,
// state: &mut State,
Expand Down
2 changes: 1 addition & 1 deletion sn_node_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "GPL-3.0"
name = "sn-node-manager"
readme = "README.md"
repository = "https://github.com/maidsafe/safe_network"
version = "0.10.3"
version = "0.11.3"

[[bin]]
name = "safenode-manager"
Expand Down
Loading
Loading