diff --git a/core/src/proxy/auth.rs b/core/src/proxy/auth.rs index 39821e12ef..f23397c43d 100644 --- a/core/src/proxy/auth.rs +++ b/core/src/proxy/auth.rs @@ -45,7 +45,7 @@ pub async fn generate_auth_tokens( auth_service_client: &mut AuthServiceClient, // used to sign challenges keypair: &Keypair, -) -> crate::proxy::Result<( +) -> crate::proxy::ProxyResult<( Token, /* access_token */ Token, /* refresh_token */ )> { @@ -105,7 +105,7 @@ pub async fn maybe_refresh_auth_tokens( cluster_info: &Arc, connection_timeout: &Duration, refresh_within_s: u64, -) -> crate::proxy::Result<( +) -> crate::proxy::ProxyResult<( Option, // access token Option, // refresh token )> { @@ -159,7 +159,7 @@ pub async fn maybe_refresh_auth_tokens( pub async fn refresh_access_token( auth_service_client: &mut AuthServiceClient, refresh_token: &Token, -) -> crate::proxy::Result { +) -> crate::proxy::ProxyResult { let response = auth_service_client .refresh_access_token(RefreshAccessTokenRequest { refresh_token: refresh_token.value.clone(), @@ -172,7 +172,7 @@ pub async fn refresh_access_token( /// An invalid token is one where any of its fields are None or the token itself is None. /// Performs the necessary validations on the auth tokens before returning, /// i.e. it is safe to call .unwrap() on the token fields from the call-site. -fn get_validated_token(maybe_token: Option) -> crate::proxy::Result { +fn get_validated_token(maybe_token: Option) -> crate::proxy::ProxyResult { let token = maybe_token .ok_or_else(|| ProxyError::BadAuthenticationToken("received a null token".to_string()))?; if token.expires_at_utc.is_none() { diff --git a/core/src/proxy/block_engine_stage.rs b/core/src/proxy/block_engine_stage.rs index 7fdd20568c..c376e91e5a 100644 --- a/core/src/proxy/block_engine_stage.rs +++ b/core/src/proxy/block_engine_stage.rs @@ -193,7 +193,7 @@ impl BlockEngineStage { exit: &Arc, block_builder_fee_info: &Arc>, connection_timeout: &Duration, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { // Get a copy of configs here in case they have changed at runtime let keypair = cluster_info.keypair().clone(); @@ -294,7 +294,7 @@ impl BlockEngineStage { connection_timeout: &Duration, keypair: Arc, cluster_info: &Arc, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { let subscribe_packets_stream = timeout( *connection_timeout, client.subscribe_packets(block_engine::SubscribePacketsRequest {}), @@ -369,7 +369,7 @@ impl BlockEngineStage { keypair: Arc, cluster_info: &Arc, connection_timeout: &Duration, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { const METRICS_TICK: Duration = Duration::from_secs(1); const MAINTENANCE_TICK: Duration = Duration::from_secs(10 * 60); let refresh_within_s: u64 = METRICS_TICK.as_secs().saturating_mul(3).saturating_div(2); @@ -453,7 +453,7 @@ impl BlockEngineStage { maybe_bundles_response: Result, Status>, bundle_sender: &Sender>, block_engine_stats: &mut BlockEngineStageStats, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { let bundles_response = maybe_bundles_response?.ok_or(ProxyError::GrpcStreamDisconnected)?; let bundles: Vec = bundles_response .bundles @@ -491,7 +491,7 @@ impl BlockEngineStage { banking_packet_sender: &BankingPacketSender, trust_packets: bool, block_engine_stats: &mut BlockEngineStageStats, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { if let Some(batch) = resp.batch { if batch.packets.is_empty() { saturating_add_assign!(block_engine_stats.num_empty_packets, 1); diff --git a/core/src/proxy/fetch_stage_manager.rs b/core/src/proxy/fetch_stage_manager.rs index 06bb96d613..3d3a81ce35 100644 --- a/core/src/proxy/fetch_stage_manager.rs +++ b/core/src/proxy/fetch_stage_manager.rs @@ -1,5 +1,5 @@ use { - crate::proxy::{relayer_stage::RelayerConfig, HeartbeatEvent, ProxyError, Result}, + crate::proxy::{relayer_stage::RelayerConfig, HeartbeatEvent, ProxyError, ProxyResult}, crossbeam_channel::{select, tick, Receiver, Sender}, solana_client::connection_cache::Protocol, solana_gossip::{cluster_info::ClusterInfo, contact_info}, @@ -79,8 +79,9 @@ impl FetchStageManager { packet_intercept_rx: &Receiver, packet_tx: &Sender, exit: &Arc, - ) -> Result<()> { + ) -> ProxyResult<()> { // Contact info to gossip to the network if no heartbeats are received from relayer + let my_fallback_contact_info = cluster_info.my_contact_info(); let local_relayer_config = global_relayer_config.lock().unwrap().clone(); diff --git a/core/src/proxy/mod.rs b/core/src/proxy/mod.rs index 4792a986ef..ed1e8b9ebf 100644 --- a/core/src/proxy/mod.rs +++ b/core/src/proxy/mod.rs @@ -21,7 +21,7 @@ use { tonic::Status, }; -pub type Result = std::result::Result; +pub type ProxyResult = Result; type HeartbeatEvent = (SocketAddr, SocketAddr); #[derive(Error, Debug)] diff --git a/core/src/proxy/relayer_stage.rs b/core/src/proxy/relayer_stage.rs index 2553305dbe..bfa64bad55 100644 --- a/core/src/proxy/relayer_stage.rs +++ b/core/src/proxy/relayer_stage.rs @@ -192,7 +192,7 @@ impl RelayerStage { banking_packet_sender: &BankingPacketSender, exit: &Arc, connection_timeout: &Duration, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { // Get a copy of configs here in case they have changed at runtime let keypair = cluster_info.keypair().clone(); @@ -284,7 +284,7 @@ impl RelayerStage { keypair: Arc, cluster_info: &Arc, connection_timeout: &Duration, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { let heartbeat_event: HeartbeatEvent = { let tpu_config = timeout( *connection_timeout, @@ -354,7 +354,7 @@ impl RelayerStage { keypair: Arc, cluster_info: &Arc, connection_timeout: &Duration, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { const METRICS_TICK: Duration = Duration::from_secs(1); let refresh_within_s: u64 = METRICS_TICK.as_secs().saturating_mul(3).saturating_div(2); @@ -433,7 +433,7 @@ impl RelayerStage { trust_packets: bool, banking_packet_sender: &BankingPacketSender, relayer_stats: &mut RelayerStageStats, - ) -> crate::proxy::Result<()> { + ) -> crate::proxy::ProxyResult<()> { match subscribe_packets_resp.msg { None => { saturating_add_assign!(relayer_stats.num_empty_messages, 1);