diff --git a/ant-node-manager/src/add_services/config.rs b/ant-node-manager/src/add_services/config.rs index 7aac0eaeb6..b2037bbc86 100644 --- a/ant-node-manager/src/add_services/config.rs +++ b/ant-node-manager/src/add_services/config.rs @@ -85,7 +85,6 @@ pub struct InstallNodeServiceCtxBuilder { pub metrics_port: Option, pub node_ip: Option, pub node_port: Option, - pub owner: Option, pub peers_args: PeersArgs, pub rewards_address: RewardsAddress, pub rpc_socket_addr: SocketAddr, @@ -132,10 +131,6 @@ impl InstallNodeServiceCtxBuilder { args.push(OsString::from("--metrics-server-port")); args.push(OsString::from(metrics_port.to_string())); } - if let Some(owner) = self.owner { - args.push(OsString::from("--owner")); - args.push(OsString::from(owner)); - } if let Some(log_files) = self.max_archived_log_files { args.push(OsString::from("--max-archived-log-files")); args.push(OsString::from(log_files.to_string())); @@ -193,7 +188,6 @@ pub struct AddNodeServiceOptions { pub network_id: Option, pub node_ip: Option, pub node_port: Option, - pub owner: Option, pub peers_args: PeersArgs, pub rewards_address: RewardsAddress, pub rpc_address: Option, @@ -327,7 +321,6 @@ mod tests { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124") .unwrap(), @@ -363,7 +356,6 @@ mod tests { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124") .unwrap(), @@ -400,7 +392,6 @@ mod tests { network_id: Some(5), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124") .unwrap(), @@ -490,7 +481,6 @@ mod tests { builder.node_ip = Some(Ipv4Addr::new(192, 168, 1, 1)); builder.node_port = Some(12345); builder.metrics_port = Some(9090); - builder.owner = Some("test-owner".to_string()); builder.peers_args.addrs = vec![ "/ip4/127.0.0.1/tcp/8080".parse().unwrap(), "/ip4/192.168.1.1/tcp/8081".parse().unwrap(), @@ -531,8 +521,6 @@ mod tests { "12345", "--metrics-server-port", "9090", - "--owner", - "test-owner", "--max-archived-log-files", "10", "--max-log-files", diff --git a/ant-node-manager/src/add_services/mod.rs b/ant-node-manager/src/add_services/mod.rs index 76e8d46c12..842040b49c 100644 --- a/ant-node-manager/src/add_services/mod.rs +++ b/ant-node-manager/src/add_services/mod.rs @@ -78,16 +78,6 @@ pub async fn add_node( check_port_availability(port_option, &node_registry.nodes)?; } - let owner = match &options.owner { - Some(owner) => { - if owner.chars().any(|c| c.is_uppercase()) { - warn!("Owner name ({owner}) contains uppercase characters and will be converted to lowercase"); - } - Some(owner.to_lowercase()) - } - None => None, - }; - let antnode_file_name = options .antnode_src_path .file_name() @@ -213,7 +203,6 @@ pub async fn add_node( network_id: options.network_id, node_ip: options.node_ip, node_port, - owner: owner.clone(), peers_args: options.peers_args.clone(), rewards_address: options.rewards_address, rpc_socket_addr, @@ -254,7 +243,6 @@ pub async fn add_node( rewards_address: options.rewards_address, reward_balance: None, rpc_socket_addr, - owner: owner.clone(), peer_id: None, peers_args: options.peers_args.clone(), pid: None, diff --git a/ant-node-manager/src/add_services/tests.rs b/ant-node-manager/src/add_services/tests.rs index 58eaf31162..e1b2bea58a 100644 --- a/ant-node-manager/src/add_services/tests.rs +++ b/ant-node-manager/src/add_services/tests.rs @@ -142,7 +142,6 @@ async fn add_genesis_node_should_use_latest_version_and_add_one_service() -> Res network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -177,7 +176,6 @@ async fn add_genesis_node_should_use_latest_version_and_add_one_service() -> Res network_id: None, node_ip: None, node_port: None, - owner: None, peers_args, rpc_address: None, rpc_port: None, @@ -300,7 +298,6 @@ async fn add_genesis_node_should_return_an_error_if_there_is_already_a_genesis_n node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: peers_args.clone(), pid: None, @@ -347,7 +344,6 @@ async fn add_genesis_node_should_return_an_error_if_there_is_already_a_genesis_n network_id: None, node_ip: None, node_port: None, - owner: None, peers_args, rpc_address: Some(custom_rpc_address), rpc_port: None, @@ -437,7 +433,6 @@ async fn add_genesis_node_should_return_an_error_if_count_is_greater_than_1() -> network_id: None, node_ip: None, node_port: None, - owner: None, peers_args, rpc_address: None, rpc_port: None, @@ -534,7 +529,6 @@ async fn add_node_should_use_latest_version_and_add_three_services() -> Result<( name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), antnode_path: node_data_dir @@ -583,7 +577,6 @@ async fn add_node_should_use_latest_version_and_add_three_services() -> Result<( name: "antnode2".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8083), @@ -632,7 +625,6 @@ async fn add_node_should_use_latest_version_and_add_three_services() -> Result<( name: "antnode3".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8085), @@ -668,7 +660,6 @@ async fn add_node_should_use_latest_version_and_add_three_services() -> Result<( network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -815,7 +806,6 @@ async fn add_node_should_update_the_environment_variables_inside_node_registry() name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -850,7 +840,6 @@ async fn add_node_should_update_the_environment_variables_inside_node_registry() network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -946,7 +935,6 @@ async fn add_new_node_should_add_another_service() -> Result<()> { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1006,7 +994,6 @@ async fn add_new_node_should_add_another_service() -> Result<()> { peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8083), - owner: None, antnode_path: node_data_dir .to_path_buf() .join("antnode2") @@ -1039,7 +1026,6 @@ async fn add_new_node_should_add_another_service() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -1203,7 +1189,6 @@ async fn add_node_should_create_service_file_with_first_arg() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1360,7 +1345,6 @@ async fn add_node_should_create_service_file_with_peers_args() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1512,7 +1496,6 @@ async fn add_node_should_create_service_file_with_local_arg() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1668,7 +1651,6 @@ async fn add_node_should_create_service_file_with_network_contacts_url_arg() -> network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1823,7 +1805,6 @@ async fn add_node_should_create_service_file_with_testnet_arg() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1975,7 +1956,6 @@ async fn add_node_should_create_service_file_with_ignore_cache_arg() -> Result<( network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -2128,7 +2108,6 @@ async fn add_node_should_create_service_file_with_custom_bootstrap_cache_path() network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -2274,7 +2253,6 @@ async fn add_node_should_create_service_file_with_network_id() -> Result<()> { network_id: Some(5), node_ip: None, node_port: None, - owner: None, peers_args: Default::default(), rpc_address: None, rpc_port: None, @@ -2418,7 +2396,6 @@ async fn add_node_should_use_custom_ip() -> Result<()> { network_id: None, node_ip: Some(custom_ip), node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -2516,7 +2493,6 @@ async fn add_node_should_use_custom_ports_for_one_service() -> Result<()> { name: "antnode1".to_string(), node_ip: None, node_port: Some(custom_port), - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -2552,7 +2528,6 @@ async fn add_node_should_use_custom_ports_for_one_service() -> Result<()> { network_id: None, node_ip: None, node_port: Some(PortRange::Single(custom_port)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -2810,7 +2785,6 @@ async fn add_node_should_use_a_custom_port_range() -> Result<()> { network_id: None, node_ip: None, node_port: Some(PortRange::Range(12000, 12002)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -2886,7 +2860,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_is_used() -> R node_ip: None, node_port: Some(12000), number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -2931,7 +2904,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_is_used() -> R network_id: None, node_ip: None, node_port: Some(PortRange::Single(12000)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3004,7 +2976,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_in_range_is_us network_id: None, node_ip: None, node_port: Some(12000), - owner: None, peers_args: PeersArgs::default(), number: 1, peer_id: None, @@ -3050,7 +3021,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_in_range_is_us network_id: None, node_ip: None, node_port: Some(PortRange::Range(12000, 12002)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3129,7 +3099,6 @@ async fn add_node_should_return_an_error_if_port_and_node_count_do_not_match() - network_id: None, node_ip: None, node_port: Some(PortRange::Range(12000, 12002)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3213,7 +3182,6 @@ async fn add_node_should_return_an_error_if_multiple_services_are_specified_with network_id: None, node_ip: None, node_port: Some(PortRange::Single(12000)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3359,7 +3327,6 @@ async fn add_node_should_set_random_ports_if_enable_metrics_server_is_true() -> network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3497,7 +3464,6 @@ async fn add_node_should_set_max_archived_log_files() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3636,7 +3602,6 @@ async fn add_node_should_set_max_log_files() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3889,7 +3854,6 @@ async fn add_node_should_use_a_custom_port_range_for_metrics_server() -> Result< network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3962,7 +3926,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_is_use node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -4007,7 +3970,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_is_use network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -4082,7 +4044,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_in_ran node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -4127,7 +4088,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_in_ran network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -4363,7 +4323,6 @@ async fn add_node_should_use_a_custom_port_range_for_the_rpc_server() -> Result< network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: Some(PortRange::Range(20000, 20002)), @@ -4447,7 +4406,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_is_used() node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -4492,7 +4450,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_is_used() network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: Some(PortRange::Single(8081)), @@ -4567,7 +4524,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_in_range_i node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -4612,7 +4568,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_in_range_i network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: Some(PortRange::Range(8081, 8082)), @@ -4708,7 +4663,6 @@ async fn add_node_should_disable_upnp_and_home_network_if_nat_status_is_public() name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -4743,7 +4697,6 @@ async fn add_node_should_disable_upnp_and_home_network_if_nat_status_is_public() network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -4836,7 +4789,6 @@ async fn add_node_should_enable_upnp_if_nat_status_is_upnp() -> Result<()> { name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -4871,7 +4823,6 @@ async fn add_node_should_enable_upnp_if_nat_status_is_upnp() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -4964,7 +4915,6 @@ async fn add_node_should_enable_home_network_if_nat_status_is_private() -> Resul name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -4999,7 +4949,6 @@ async fn add_node_should_enable_home_network_if_nat_status_is_private() -> Resul network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -5086,7 +5035,6 @@ async fn add_node_should_return_an_error_if_nat_status_is_none_but_auto_set_nat_ network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -5708,7 +5656,6 @@ async fn add_node_should_not_delete_the_source_binary_if_path_arg_is_used() -> R name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -5744,7 +5691,6 @@ async fn add_node_should_not_delete_the_source_binary_if_path_arg_is_used() -> R network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -5838,7 +5784,6 @@ async fn add_node_should_apply_the_home_network_flag_if_it_is_used() -> Result<( name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -5874,7 +5819,6 @@ async fn add_node_should_apply_the_home_network_flag_if_it_is_used() -> Result<( network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -5968,7 +5912,6 @@ async fn add_node_should_add_the_node_in_user_mode() -> Result<()> { name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -6004,7 +5947,6 @@ async fn add_node_should_add_the_node_in_user_mode() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -6095,7 +6037,6 @@ async fn add_node_should_add_the_node_with_upnp_enabled() -> Result<()> { name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -6131,7 +6072,6 @@ async fn add_node_should_add_the_node_with_upnp_enabled() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -6168,145 +6108,6 @@ async fn add_node_should_add_the_node_with_upnp_enabled() -> Result<()> { Ok(()) } -#[tokio::test] -async fn add_node_should_assign_an_owner_in_lowercase() -> Result<()> { - let tmp_data_dir = assert_fs::TempDir::new()?; - let node_reg_path = tmp_data_dir.child("node_reg.json"); - - let latest_version = "0.96.4"; - let temp_dir = assert_fs::TempDir::new()?; - let node_data_dir = temp_dir.child("data"); - node_data_dir.create_dir_all()?; - let node_logs_dir = temp_dir.child("logs"); - node_logs_dir.create_dir_all()?; - let antnode_download_path = temp_dir.child(ANTNODE_FILE_NAME); - antnode_download_path.write_binary(b"fake antnode bin")?; - - let mut node_registry = NodeRegistry { - auditor: None, - daemon: None, - environment_variables: None, - faucet: None, - nat_status: None, - nodes: vec![], - save_path: node_reg_path.to_path_buf(), - }; - - let mut mock_service_control = MockServiceControl::new(); - let mut seq = Sequence::new(); - mock_service_control - .expect_get_available_port() - .times(1) - .returning(|| Ok(8081)) - .in_sequence(&mut seq); - - mock_service_control - .expect_install() - .with( - eq(ServiceInstallCtx { - args: vec![ - OsString::from("--rpc"), - OsString::from("127.0.0.1:8081"), - OsString::from("--root-dir"), - OsString::from( - node_data_dir - .to_path_buf() - .join("antnode1") - .to_string_lossy() - .to_string(), - ), - OsString::from("--log-output-dest"), - OsString::from( - node_logs_dir - .to_path_buf() - .join("antnode1") - .to_string_lossy() - .to_string(), - ), - OsString::from("--owner"), - OsString::from("discord_username"), - OsString::from("--rewards-address"), - OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), - OsString::from("evm-custom"), - OsString::from("--rpc-url"), - OsString::from("http://localhost:8545/"), - OsString::from("--payment-token-address"), - OsString::from("0x5FbDB2315678afecb367f032d93F642f64180aa3"), - OsString::from("--data-payments-address"), - OsString::from("0x8464135c8F25Da09e49BC8782676a84730C318bC"), - ], - autostart: false, - contents: None, - environment: None, - label: "antnode1".parse()?, - program: node_data_dir - .to_path_buf() - .join("antnode1") - .join(ANTNODE_FILE_NAME), - username: Some(get_username()), - working_directory: None, - }), - eq(false), - ) - .times(1) - .returning(|_, _| Ok(())) - .in_sequence(&mut seq); - - add_node( - AddNodeServiceOptions { - auto_restart: false, - auto_set_nat_flags: false, - count: None, - delete_antnode_src: true, - enable_metrics_server: false, - env_variables: None, - home_network: false, - log_format: None, - max_archived_log_files: None, - max_log_files: None, - metrics_port: None, - network_id: None, - node_ip: None, - node_port: None, - owner: Some("Discord_Username".to_string()), - peers_args: PeersArgs::default(), - rpc_address: None, - rpc_port: None, - antnode_dir_path: temp_dir.to_path_buf(), - antnode_src_path: antnode_download_path.to_path_buf(), - service_data_dir_path: node_data_dir.to_path_buf(), - service_log_dir_path: node_logs_dir.to_path_buf(), - upnp: false, - user: Some(get_username()), - user_mode: false, - version: latest_version.to_string(), - evm_network: EvmNetwork::Custom(CustomNetwork { - rpc_url_http: "http://localhost:8545".parse()?, - payment_token_address: RewardsAddress::from_str( - "0x5FbDB2315678afecb367f032d93F642f64180aa3", - )?, - data_payments_address: RewardsAddress::from_str( - "0x8464135c8F25Da09e49BC8782676a84730C318bC", - )?, - }), - rewards_address: RewardsAddress::from_str( - "0x03B770D9cD32077cC0bF330c13C114a87643B124", - )?, - }, - &mut node_registry, - &mock_service_control, - VerbosityLevel::Normal, - ) - .await?; - - assert_eq!( - node_registry.nodes[0].owner, - Some("discord_username".to_string()) - ); - - Ok(()) -} - #[tokio::test] async fn add_node_should_auto_restart() -> Result<()> { let tmp_data_dir = assert_fs::TempDir::new()?; @@ -6362,8 +6163,6 @@ async fn add_node_should_auto_restart() -> Result<()> { .to_string_lossy() .to_string(), ), - OsString::from("--owner"), - OsString::from("discord_username"), OsString::from("--rewards-address"), OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), OsString::from("evm-custom"), @@ -6407,7 +6206,6 @@ async fn add_node_should_auto_restart() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: Some("discord_username".to_string()), peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, diff --git a/ant-node-manager/src/bin/cli/main.rs b/ant-node-manager/src/bin/cli/main.rs index b440cb09d8..fa6dbb71c7 100644 --- a/ant-node-manager/src/bin/cli/main.rs +++ b/ant-node-manager/src/bin/cli/main.rs @@ -191,15 +191,6 @@ pub enum SubCmd { /// services, which in this case would be 5. The range must also go from lower to higher. #[clap(long, value_parser = PortRange::parse)] node_port: Option, - /// Specify the owner for the node service. - /// - /// This is mainly used for the 'Beta Rewards' programme, for linking your Discord username - /// to the node. - /// - /// If the option is not used, the node will assign its own username and the service will - /// run as normal. - #[clap(long)] - owner: Option, /// Provide a path for the antnode binary to be used by the service. /// /// Useful for creating the service using a custom built binary. @@ -862,19 +853,6 @@ pub enum LocalSubCmd { node_version: Option, #[command(flatten)] peers: PeersArgs, - /// Specify the owner for each node in the local network - /// - /// The argument exists to support testing scenarios. - #[clap(long, conflicts_with = "owner_prefix")] - owner: Option, - /// Use this argument to launch each node in the network with an individual owner. - /// - /// Assigned owners will take the form "prefix_1", "prefix_2" etc., where "prefix" will be - /// replaced by the value specified by this argument. - /// - /// The argument exists to support testing scenarios. - #[clap(long, conflicts_with = "owner")] - owner_prefix: Option, /// Specify a port for the RPC service(s). /// /// If not used, ports will be selected at random. @@ -972,20 +950,6 @@ pub enum LocalSubCmd { /// The version and path arguments are mutually exclusive. #[clap(long, conflicts_with = "build")] node_version: Option, - /// Specify the owner for each node in the local network - /// - /// The argument exists to support testing scenarios. - #[clap(long, conflicts_with = "owner_prefix")] - owner: Option, - /// Use this argument to launch each node in the network with an individual owner. - /// - /// Assigned owners will take the form "prefix_1", "prefix_2" etc., where "prefix" will be - /// replaced by the value specified by this argument. - /// - /// The argument exists to support testing scenarios. - #[clap(long)] - #[clap(long, conflicts_with = "owner")] - owner_prefix: Option, /// Specify a port for the RPC service(s). /// /// If not used, ports will be selected at random. @@ -1083,7 +1047,6 @@ async fn main() -> Result<()> { network_id, node_ip, node_port, - owner, path, peers, rewards_address, @@ -1111,7 +1074,6 @@ async fn main() -> Result<()> { network_id, node_ip, node_port, - owner, peers, rewards_address, rpc_address, @@ -1223,8 +1185,6 @@ async fn main() -> Result<()> { node_port, node_version, log_format, - owner, - owner_prefix, peers, rpc_port, rewards_address, @@ -1246,8 +1206,6 @@ async fn main() -> Result<()> { node_port, node_version, log_format, - owner, - owner_prefix, peers, rpc_port, rewards_address, @@ -1269,8 +1227,6 @@ async fn main() -> Result<()> { node_path, node_port, node_version, - owner, - owner_prefix, rpc_port, rewards_address, evm_network, @@ -1292,8 +1248,6 @@ async fn main() -> Result<()> { node_port, node_version, log_format, - owner, - owner_prefix, rpc_port, rewards_address, evm_network, diff --git a/ant-node-manager/src/cmd/local.rs b/ant-node-manager/src/cmd/local.rs index 2f0b3b465b..736f7806f7 100644 --- a/ant-node-manager/src/cmd/local.rs +++ b/ant-node-manager/src/cmd/local.rs @@ -34,8 +34,6 @@ pub async fn join( node_port: Option, node_version: Option, log_format: Option, - owner: Option, - owner_prefix: Option, _peers_args: PeersArgs, rpc_port: Option, rewards_address: RewardsAddress, @@ -78,8 +76,6 @@ pub async fn join( metrics_port, node_count: count, node_port, - owner, - owner_prefix, peers: None, rpc_port, skip_validation, @@ -119,8 +115,6 @@ pub async fn run( node_port: Option, node_version: Option, log_format: Option, - owner: Option, - owner_prefix: Option, rpc_port: Option, rewards_address: RewardsAddress, evm_network: Option, @@ -188,8 +182,6 @@ pub async fn run( metrics_port, node_port, node_count: count, - owner, - owner_prefix, peers: None, rpc_port, skip_validation, diff --git a/ant-node-manager/src/cmd/node.rs b/ant-node-manager/src/cmd/node.rs index 5ab42c0ea8..3812834811 100644 --- a/ant-node-manager/src/cmd/node.rs +++ b/ant-node-manager/src/cmd/node.rs @@ -52,7 +52,6 @@ pub async fn add( network_id: Option, node_ip: Option, node_port: Option, - owner: Option, mut peers_args: PeersArgs, rewards_address: RewardsAddress, rpc_address: Option, @@ -129,7 +128,6 @@ pub async fn add( network_id, node_ip, node_port, - owner, peers_args, rewards_address, rpc_address, @@ -598,7 +596,6 @@ pub async fn maintain_n_running_nodes( network_id: Option, node_ip: Option, node_port: Option, - owner: Option, peers_args: PeersArgs, rewards_address: RewardsAddress, rpc_address: Option, @@ -703,7 +700,6 @@ pub async fn maintain_n_running_nodes( network_id, node_ip, Some(PortRange::Single(port)), - owner.clone(), peers_args.clone(), rewards_address, rpc_address, diff --git a/ant-node-manager/src/lib.rs b/ant-node-manager/src/lib.rs index 8b2aaee95b..e0d6d908d3 100644 --- a/ant-node-manager/src/lib.rs +++ b/ant-node-manager/src/lib.rs @@ -771,7 +771,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -885,7 +884,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -964,7 +962,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1083,7 +1080,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1175,7 +1171,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1277,7 +1272,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1378,7 +1372,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1449,7 +1442,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1512,7 +1504,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1573,7 +1564,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1637,7 +1627,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1712,7 +1701,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1852,7 +1840,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1953,7 +1940,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2099,7 +2085,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2257,7 +2242,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2410,7 +2394,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2564,7 +2547,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2743,7 +2725,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2915,7 +2896,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3093,7 +3073,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3254,7 +3233,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3424,7 +3402,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3604,7 +3581,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3779,7 +3755,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3949,7 +3924,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4129,7 +4103,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4290,7 +4263,6 @@ network_id: None, network_id: None, node_ip: None, node_port: None, - owner: None, number: 1, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", @@ -4456,7 +4428,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4618,7 +4589,6 @@ network_id: None, number: 1, node_ip: Some(Ipv4Addr::new(192, 168, 1, 1)), node_port: None, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4783,7 +4753,6 @@ network_id: None, number: 1, node_ip: None, node_port: Some(12000), - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4944,7 +4913,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5109,7 +5077,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5272,7 +5239,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5437,7 +5403,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5483,171 +5448,6 @@ network_id: None, Ok(()) } - #[tokio::test] - async fn upgrade_should_retain_owner() -> Result<()> { - let current_version = "0.1.0"; - let target_version = "0.2.0"; - - let tmp_data_dir = assert_fs::TempDir::new()?; - let current_install_dir = tmp_data_dir.child("antnode_install"); - current_install_dir.create_dir_all()?; - - let current_node_bin = current_install_dir.child("antnode"); - current_node_bin.write_binary(b"fake antnode binary")?; - let target_node_bin = tmp_data_dir.child("antnode"); - target_node_bin.write_binary(b"fake antnode binary")?; - - let mut mock_service_control = MockServiceControl::new(); - let mut mock_rpc_client = MockRpcClient::new(); - - // before binary upgrade - mock_service_control - .expect_get_process_pid() - .with(eq(current_node_bin.to_path_buf().clone())) - .times(1) - .returning(|_| Ok(1000)); - mock_service_control - .expect_stop() - .with(eq("antnode1"), eq(false)) - .times(1) - .returning(|_, _| Ok(())); - - // after binary upgrade - mock_service_control - .expect_uninstall() - .with(eq("antnode1"), eq(false)) - .times(1) - .returning(|_, _| Ok(())); - mock_service_control - .expect_install() - .with( - eq(ServiceInstallCtx { - args: vec![ - OsString::from("--rpc"), - OsString::from("127.0.0.1:8081"), - OsString::from("--root-dir"), - OsString::from("/var/antctl/services/antnode1"), - OsString::from("--log-output-dest"), - OsString::from("/var/log/antnode/antnode1"), - OsString::from("--owner"), - OsString::from("discord_username"), - OsString::from("--rewards-address"), - OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), - OsString::from("evm-arbitrum-one"), - ], - autostart: false, - contents: None, - environment: None, - label: "antnode1".parse()?, - program: current_node_bin.to_path_buf(), - username: Some("ant".to_string()), - working_directory: None, - }), - eq(false), - ) - .times(1) - .returning(|_, _| Ok(())); - - // after service restart - mock_service_control - .expect_start() - .with(eq("antnode1"), eq(false)) - .times(1) - .returning(|_, _| Ok(())); - mock_service_control - .expect_wait() - .with(eq(3000)) - .times(1) - .returning(|_| ()); - mock_service_control - .expect_get_process_pid() - .with(eq(current_node_bin.to_path_buf().clone())) - .times(1) - .returning(|_| Ok(100)); - - mock_rpc_client.expect_node_info().times(1).returning(|| { - Ok(NodeInfo { - pid: 2000, - peer_id: PeerId::from_str("12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR")?, - data_path: PathBuf::from("/var/antctl/services/antnode1"), - log_path: PathBuf::from("/var/log/antnode/antnode1"), - version: target_version.to_string(), - uptime: std::time::Duration::from_secs(1), // the service was just started - wallet_balance: 0, - }) - }); - mock_rpc_client - .expect_network_info() - .times(1) - .returning(|| { - Ok(NetworkInfo { - connected_peers: Vec::new(), - listeners: Vec::new(), - }) - }); - - let mut service_data = NodeServiceData { - auto_restart: false, - connected_peers: None, - data_dir_path: PathBuf::from("/var/antctl/services/antnode1"), - evm_network: EvmNetwork::ArbitrumOne, - home_network: false, - listen_addr: None, - log_dir_path: PathBuf::from("/var/log/antnode/antnode1"), - log_format: None, - max_archived_log_files: None, - max_log_files: None, - metrics_port: None, - network_id: None, - node_ip: None, - node_port: None, - number: 1, - owner: Some("discord_username".to_string()), - peer_id: Some(PeerId::from_str( - "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", - )?), - peers_args: PeersArgs::default(), - pid: Some(1000), - rewards_address: RewardsAddress::from_str( - "0x03B770D9cD32077cC0bF330c13C114a87643B124", - )?, - reward_balance: Some(AttoTokens::zero()), - rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), - antnode_path: current_node_bin.to_path_buf(), - service_name: "antnode1".to_string(), - status: ServiceStatus::Running, - upnp: false, - user: Some("ant".to_string()), - user_mode: false, - version: current_version.to_string(), - }; - let service = NodeService::new(&mut service_data, Box::new(mock_rpc_client)); - - let mut service_manager = ServiceManager::new( - service, - Box::new(mock_service_control), - VerbosityLevel::Normal, - ); - - service_manager - .upgrade(UpgradeOptions { - auto_restart: false, - env_variables: None, - force: false, - start_service: true, - target_bin_path: target_node_bin.to_path_buf(), - target_version: Version::parse(target_version).unwrap(), - }) - .await?; - - assert_eq!( - service_manager.service.service_data.owner, - Some("discord_username".to_string()) - ); - - Ok(()) - } - #[tokio::test] async fn upgrade_should_retain_auto_restart() -> Result<()> { let current_version = "0.1.0"; @@ -5694,8 +5494,6 @@ network_id: None, OsString::from("/var/antctl/services/antnode1"), OsString::from("--log-output-dest"), OsString::from("/var/log/antnode/antnode1"), - OsString::from("--owner"), - OsString::from("discord_username"), OsString::from("--rewards-address"), OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), OsString::from("evm-arbitrum-one"), @@ -5767,7 +5565,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: Some("discord_username".to_string()), peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5856,8 +5653,6 @@ network_id: None, OsString::from("/var/antctl/services/antnode1"), OsString::from("--log-output-dest"), OsString::from("/var/log/antnode/antnode1"), - OsString::from("--owner"), - OsString::from("discord_username"), OsString::from("--rewards-address"), OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), OsString::from("evm-custom"), @@ -5943,7 +5738,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: Some("discord_username".to_string()), peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -6033,8 +5827,6 @@ network_id: None, OsString::from("/var/antctl/services/antnode1"), OsString::from("--log-output-dest"), OsString::from("/var/log/antnode/antnode1"), - OsString::from("--owner"), - OsString::from("discord_username"), OsString::from("--rewards-address"), OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), OsString::from("evm-custom"), @@ -6120,7 +5912,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: Some("discord_username".to_string()), peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -6285,7 +6076,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -6370,7 +6160,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peers_args: PeersArgs::default(), peer_id: None, pid: None, @@ -6439,7 +6228,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peers_args: PeersArgs::default(), pid: Some(1000), peer_id: Some(PeerId::from_str( @@ -6523,7 +6311,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peers_args: PeersArgs::default(), pid: Some(1000), peer_id: Some(PeerId::from_str( @@ -6602,7 +6389,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, pid: None, peers_args: PeersArgs::default(), peer_id: None, @@ -6679,7 +6465,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, pid: None, peers_args: PeersArgs::default(), peer_id: None, diff --git a/ant-node-manager/src/local.rs b/ant-node-manager/src/local.rs index 6acd1d6531..a7ed6529cb 100644 --- a/ant-node-manager/src/local.rs +++ b/ant-node-manager/src/local.rs @@ -43,7 +43,6 @@ pub trait Launcher { log_format: Option, metrics_port: Option, node_port: Option, - owner: Option, rpc_socket_addr: SocketAddr, rewards_address: RewardsAddress, evm_network: Option, @@ -67,18 +66,12 @@ impl Launcher for LocalSafeLauncher { log_format: Option, metrics_port: Option, node_port: Option, - owner: Option, rpc_socket_addr: SocketAddr, rewards_address: RewardsAddress, evm_network: Option, ) -> Result<()> { let mut args = Vec::new(); - if let Some(owner) = owner { - args.push("--owner".to_string()); - args.push(owner); - } - if first { args.push("--first".to_string()) } @@ -218,8 +211,6 @@ pub struct LocalNetworkOptions { pub metrics_port: Option, pub node_port: Option, pub node_count: u16, - pub owner: Option, - pub owner_prefix: Option, pub peers: Option>, pub rpc_port: Option, pub skip_validation: bool, @@ -289,7 +280,6 @@ pub async fn run_network( let rpc_client = RpcClient::from_socket_addr(rpc_socket_addr); let number = (node_registry.nodes.len() as u16) + 1; - let owner = get_node_owner(&options.owner_prefix, &options.owner, &number); let node = run_node( RunNodeOptions { first: true, @@ -298,7 +288,6 @@ pub async fn run_network( interval: options.interval, log_format: options.log_format, number, - owner, rpc_socket_addr, rewards_address: options.rewards_address, evm_network: options.evm_network.clone(), @@ -337,7 +326,6 @@ pub async fn run_network( let rpc_client = RpcClient::from_socket_addr(rpc_socket_addr); let number = (node_registry.nodes.len() as u16) + 1; - let owner = get_node_owner(&options.owner_prefix, &options.owner, &number); let node = run_node( RunNodeOptions { first: false, @@ -346,7 +334,6 @@ pub async fn run_network( interval: options.interval, log_format: options.log_format, number, - owner, rpc_socket_addr, rewards_address: options.rewards_address, evm_network: options.evm_network.clone(), @@ -386,7 +373,6 @@ pub struct RunNodeOptions { pub metrics_port: Option, pub node_port: Option, pub number: u16, - pub owner: Option, pub rpc_socket_addr: SocketAddr, pub rewards_address: RewardsAddress, pub evm_network: Option, @@ -405,7 +391,6 @@ pub async fn run_node( run_options.log_format, run_options.metrics_port, run_options.node_port, - run_options.owner.clone(), run_options.rpc_socket_addr, run_options.rewards_address, run_options.evm_network.clone(), @@ -439,7 +424,6 @@ pub async fn run_node( node_ip: None, node_port: run_options.node_port, number: run_options.number, - owner: run_options.owner, peer_id: Some(peer_id), peers_args: PeersArgs { first: run_options.first, @@ -513,18 +497,6 @@ async fn validate_network(node_registry: &mut NodeRegistry, peers: Vec, - owner: &Option, - number: &u16, -) -> Option { - if let Some(prefix) = owner_prefix { - Some(format!("{}_{}", prefix, number)) - } else { - owner.clone() - } -} - #[cfg(test)] mod tests { use super::*; @@ -569,13 +541,12 @@ mod tests { eq(None), eq(None), eq(None), - eq(None), eq(rpc_socket_addr), eq(rewards_address), eq(None), ) .times(1) - .returning(|_, _, _, _, _, _, _, _| Ok(())); + .returning(|_, _, _, _, _, _, _| Ok(())); mock_launcher .expect_wait() .with(eq(100)) @@ -618,7 +589,6 @@ mod tests { metrics_port: None, node_port: None, number: 1, - owner: None, rpc_socket_addr, rewards_address, evm_network: None, diff --git a/ant-node-manager/src/rpc.rs b/ant-node-manager/src/rpc.rs index 1af38833ff..c47a0927ba 100644 --- a/ant-node-manager/src/rpc.rs +++ b/ant-node-manager/src/rpc.rs @@ -77,7 +77,6 @@ pub async fn restart_node_service( network_id: current_node_clone.network_id, node_ip: current_node_clone.node_ip, node_port: current_node_clone.get_antnode_port(), - owner: current_node_clone.owner.clone(), peers_args: current_node_clone.peers_args.clone(), rewards_address: current_node_clone.rewards_address, rpc_socket_addr: current_node_clone.rpc_socket_addr, @@ -193,7 +192,6 @@ pub async fn restart_node_service( network_id: current_node_clone.network_id, node_ip: current_node_clone.node_ip, node_port: None, - owner: None, peers_args: current_node_clone.peers_args.clone(), rewards_address: current_node_clone.rewards_address, rpc_socket_addr: current_node_clone.rpc_socket_addr, @@ -223,7 +221,6 @@ pub async fn restart_node_service( node_ip: current_node_clone.node_ip, node_port: None, number: new_node_number as u16, - owner: None, peer_id: None, peers_args: current_node_clone.peers_args.clone(), pid: None, diff --git a/ant-node/src/bin/antnode/main.rs b/ant-node/src/bin/antnode/main.rs index 3397d81461..5b6cc51144 100644 --- a/ant-node/src/bin/antnode/main.rs +++ b/ant-node/src/bin/antnode/main.rs @@ -178,10 +178,6 @@ struct Opt { #[clap(long)] rpc: Option, - /// Specify the owner(readable discord user name). - #[clap(long)] - owner: Option, - #[cfg(feature = "open-metrics")] /// Specify the port for the OpenMetrics server. /// @@ -308,8 +304,8 @@ fn main() -> Result<()> { // another process with these args. #[cfg(feature = "local")] rt.spawn(init_metrics(std::process::id())); - let initial_peres = rt.block_on(opt.peers.get_addrs(None, Some(100)))?; - debug!("Node's owner set to: {:?}", opt.owner); + + let initial_peers = rt.block_on(opt.peers.get_addrs(None, Some(100)))?; let restart_options = rt.block_on(async move { let mut node_builder = NodeBuilder::new( keypair, @@ -321,7 +317,7 @@ fn main() -> Result<()> { #[cfg(feature = "upnp")] opt.upnp, ); - node_builder.initial_peers(initial_peres); + node_builder.initial_peers(initial_peers); node_builder.bootstrap_cache(bootstrap_cache); node_builder.is_behind_home_network(opt.home_network); #[cfg(feature = "open-metrics")] diff --git a/ant-service-management/src/node.rs b/ant-service-management/src/node.rs index 3c281ba4b7..cd92f6bac0 100644 --- a/ant-service-management/src/node.rs +++ b/ant-service-management/src/node.rs @@ -110,11 +110,6 @@ impl ServiceStateActions for NodeService<'_> { args.push(OsString::from(max_log_files.to_string())); } - if let Some(owner) = &self.service_data.owner { - args.push(OsString::from("--owner")); - args.push(OsString::from(owner)); - } - args.push(OsString::from("--rewards-address")); args.push(OsString::from( self.service_data.rewards_address.to_string(), @@ -288,8 +283,6 @@ pub struct NodeServiceData { pub max_log_files: Option, #[serde(default)] pub metrics_port: Option, - #[serde(default)] - pub owner: Option, pub network_id: Option, #[serde(default)] pub node_ip: Option, diff --git a/node-launchpad/src/node_mgmt.rs b/node-launchpad/src/node_mgmt.rs index 18780b4f2b..7e41b19dbe 100644 --- a/node-launchpad/src/node_mgmt.rs +++ b/node-launchpad/src/node_mgmt.rs @@ -429,7 +429,6 @@ async fn scale_down_nodes(config: &NodeConfig, count: u16) { config.network_id, None, None, // We don't care about the port, as we are scaling down - config.owner.clone(), config.peers_args.clone(), RewardsAddress::from_str(config.rewards_address.as_str()).unwrap(), None, @@ -503,7 +502,6 @@ async fn add_nodes( config.network_id, None, port_range, - config.owner.clone(), config.peers_args.clone(), RewardsAddress::from_str(config.rewards_address.as_str()).unwrap(), None,