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

Fix responder ID usage in FVR #2446

Merged
merged 1 commit into from
Aug 31, 2022
Merged
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
6 changes: 6 additions & 0 deletions fog/view/server/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ impl From<mc_util_uri::UriParseError> for RouterServerError {
}
}

impl From<mc_util_uri::UriConversionError> for RouterServerError {
fn from(src: mc_util_uri::UriConversionError) -> Self {
RouterServerError::ViewStoreError(format!("{}", src))
}
}

pub fn router_server_err_to_rpc_status(
context: &str,
src: RouterServerError,
Expand Down
5 changes: 3 additions & 2 deletions fog/view/server/src/router_request_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use mc_fog_api::{
use mc_fog_uri::FogViewStoreUri;
use mc_fog_view_enclave_api::ViewEnclaveProxy;
use mc_util_grpc::{rpc_invalid_arg_error, ConnectionUriGrpcioChannel};
use std::{collections::BTreeMap, str::FromStr, sync::Arc};
use mc_util_uri::ConnectionUri;
use std::{collections::BTreeMap, sync::Arc};

const RETRY_COUNT: usize = 3;

Expand Down Expand Up @@ -222,7 +223,7 @@ async fn authenticate_view_store<E: ViewEnclaveProxy>(
view_store_url: FogViewStoreUri,
logger: Logger,
) -> Result<(), RouterServerError> {
let view_store_id = ResponderId::from_str(&view_store_url.to_string())?;
let view_store_id = view_store_url.responder_id()?;
let client_auth_request = enclave.view_store_init(view_store_id.clone())?;
let grpc_env = Arc::new(
grpcio::EnvBuilder::new()
Expand Down
3 changes: 2 additions & 1 deletion fog/view/server/src/shard_responses_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use mc_fog_api::{
view_grpc::FogViewStoreApiClient,
};
use mc_fog_uri::FogViewStoreUri;
use mc_util_uri::ConnectionUri;
use std::{str::FromStr, sync::Arc};

/// The result of processing the MultiViewStoreQueryResponse from each Fog View
Expand Down Expand Up @@ -52,7 +53,7 @@ pub fn process_shard_responses(
let store_uri = FogViewStoreUri::from_str(response.get_fog_view_store_uri())?;
match response.get_status() {
MultiViewStoreQueryResponseStatus::SUCCESS => {
let store_responder_id = ResponderId::from_str(&store_uri.to_string())?;
let store_responder_id = store_uri.responder_id()?;
new_query_responses.push((store_responder_id, response.take_query_response()));
}
// The shard was unable to produce a query response because the Fog View Store
Expand Down