From 5549612db2ced79c74e6daaac111b0bd0dc987a3 Mon Sep 17 00:00:00 2001 From: sugargoat Date: Wed, 19 Jun 2024 11:45:36 -0700 Subject: [PATCH 1/4] Remove ip checking --- full-service/src/bin/main.rs | 13 ------------- full-service/src/lib.rs | 1 - validator/service/src/bin/main.rs | 8 -------- 3 files changed, 22 deletions(-) diff --git a/full-service/src/bin/main.rs b/full-service/src/bin/main.rs index b27a0bd3c..6beda2ca7 100644 --- a/full-service/src/bin/main.rs +++ b/full-service/src/bin/main.rs @@ -13,7 +13,6 @@ use mc_connection::ConnectionManager; use mc_consensus_scp::QuorumSet; use mc_fog_report_resolver::FogResolver; use mc_full_service::{ - check_host, config::{APIConfig, NetworkConfig, WebhookConfig}, wallet::{consensus_backed_rocket, validator_backed_rocket, APIKeyState, WalletState}, ValidatorLedgerSyncThread, WalletDb, WalletService, @@ -27,7 +26,6 @@ use rocket::{launch, Build, Rocket}; use std::{ env, net::IpAddr, - process::exit, str::FromStr, sync::{Arc, RwLock}, }; @@ -39,7 +37,6 @@ extern crate diesel_migrations; // Exit codes. const EXIT_NO_DATABASE_CONNECTION: i32 = 2; const EXIT_WRONG_PASSWORD: i32 = 3; -const EXIT_INVALID_HOST: i32 = 4; #[launch] fn rocket() -> Rocket { @@ -50,16 +47,6 @@ fn rocket() -> Rocket { let config = APIConfig::parse(); - // Exit if the user is not in an authorized country. - if !cfg!(debug_assertions) - && !config.offline - && config.validator.is_none() - && check_host::check_host_is_allowed_country_and_region().is_err() - { - eprintln!("Could not validate host"); - exit(EXIT_INVALID_HOST); - } - let (logger, global_logger_guard) = create_app_logger(o!()); // This is necessary to prevent the logger from being reset when it goes out of diff --git a/full-service/src/lib.rs b/full-service/src/lib.rs index c748ad6e0..e98657562 100644 --- a/full-service/src/lib.rs +++ b/full-service/src/lib.rs @@ -5,7 +5,6 @@ #![feature(proc_macro_hygiene, decl_macro)] #![feature(assert_matches)] -pub mod check_host; pub mod config; pub mod db; mod error; diff --git a/validator/service/src/bin/main.rs b/validator/service/src/bin/main.rs index 87bfd8fd2..83daa560f 100644 --- a/validator/service/src/bin/main.rs +++ b/validator/service/src/bin/main.rs @@ -6,7 +6,6 @@ use clap::Parser; use mc_attest_core::MrSigner; use mc_attestation_verifier::{TrustedIdentity, TrustedMrSignerIdentity}; use mc_common::logger::{create_app_logger, log, o}; -use mc_full_service::check_host; use mc_ledger_sync::{LedgerSyncServiceThread, PollingNetworkState, ReqwestTransactionsFetcher}; use mc_validator_service::{Config, Service}; use std::{ @@ -15,7 +14,6 @@ use std::{ }; // Exit codes. -const EXIT_INVALID_HOST: i32 = 4; fn main() { mc_common::setup_panic_handler(); @@ -25,12 +23,6 @@ fn main() { let config = Config::parse(); - // Exit if the user is not in an authorized country. - if check_host::check_host_is_allowed_country_and_region().is_err() { - eprintln!("Could not validate host"); - exit(EXIT_INVALID_HOST); - } - log::info!(logger, "Read Configs: {:?}", config); // Create enclave trusted identity. From 4367f90f6f56b08c950afab5db7927a3b9294a95 Mon Sep 17 00:00:00 2001 From: sugargoat Date: Wed, 19 Jun 2024 11:46:08 -0700 Subject: [PATCH 2/4] Remove ip checking Signed-off-by: sugargoat --- validator/service/src/bin/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/validator/service/src/bin/main.rs b/validator/service/src/bin/main.rs index 83daa560f..6b1bb6d81 100644 --- a/validator/service/src/bin/main.rs +++ b/validator/service/src/bin/main.rs @@ -8,10 +8,7 @@ use mc_attestation_verifier::{TrustedIdentity, TrustedMrSignerIdentity}; use mc_common::logger::{create_app_logger, log, o}; use mc_ledger_sync::{LedgerSyncServiceThread, PollingNetworkState, ReqwestTransactionsFetcher}; use mc_validator_service::{Config, Service}; -use std::{ - process::exit, - sync::{Arc, RwLock}, -}; +use std::sync::{Arc, RwLock}; // Exit codes. From a4334f09b3ea2982562421ab7ac2a3f4b7655b95 Mon Sep 17 00:00:00 2001 From: sugargoat Date: Wed, 19 Jun 2024 11:47:14 -0700 Subject: [PATCH 3/4] Fix up erroneous removal Signed-off-by: sugargoat --- validator/service/src/bin/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/validator/service/src/bin/main.rs b/validator/service/src/bin/main.rs index 6b1bb6d81..83daa560f 100644 --- a/validator/service/src/bin/main.rs +++ b/validator/service/src/bin/main.rs @@ -8,7 +8,10 @@ use mc_attestation_verifier::{TrustedIdentity, TrustedMrSignerIdentity}; use mc_common::logger::{create_app_logger, log, o}; use mc_ledger_sync::{LedgerSyncServiceThread, PollingNetworkState, ReqwestTransactionsFetcher}; use mc_validator_service::{Config, Service}; -use std::sync::{Arc, RwLock}; +use std::{ + process::exit, + sync::{Arc, RwLock}, +}; // Exit codes. From 1364599bfd7c80048136b4f6216fd1b9795b760e Mon Sep 17 00:00:00 2001 From: sugargoat Date: Wed, 19 Jun 2024 11:49:40 -0700 Subject: [PATCH 4/4] Fix up erroneous removal Signed-off-by: sugargoat --- full-service/src/bin/main.rs | 1 + validator/service/src/bin/main.rs | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/full-service/src/bin/main.rs b/full-service/src/bin/main.rs index 6beda2ca7..3de9b77b0 100644 --- a/full-service/src/bin/main.rs +++ b/full-service/src/bin/main.rs @@ -26,6 +26,7 @@ use rocket::{launch, Build, Rocket}; use std::{ env, net::IpAddr, + process::exit, str::FromStr, sync::{Arc, RwLock}, }; diff --git a/validator/service/src/bin/main.rs b/validator/service/src/bin/main.rs index 83daa560f..9f0eb5947 100644 --- a/validator/service/src/bin/main.rs +++ b/validator/service/src/bin/main.rs @@ -13,8 +13,6 @@ use std::{ sync::{Arc, RwLock}, }; -// Exit codes. - fn main() { mc_common::setup_panic_handler(); let _sentry_guard = mc_common::sentry::init();