Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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(sdk): fix client tls connections #2223
feat(sdk): fix client tls connections #2223
Changes from 2 commits
ab91e07
2f60720
01282fb
df80c15
b400b0e
20f84ce
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Unhandled
Result
types detected inTransportClient
method calls.The recent changes to
with_uri
andwith_uri_and_settings
methods introduceResult<Self, Self::Error>
returns, enhancing error handling capabilities. However, several usages of these methods do not handle theResult
, which could lead to unhandled errors and potential application instability.Please address the following instances to ensure proper error handling:
packages/rs-sdk/src/platform/types/evonode.rs: let client_result = Self::Client::with_uri_and_settings(uri.clone(), settings, &pool);
packages/rs-dapi-client/src/dapi_client.rs: let mut transport_client = R::Client::with_uri_and_settings(
packages/rs-dapi-client/src/transport/grpc.rs: fn with_uri(uri: Uri, pool: &ConnectionPool) -> Result<Self, Self::Error> {
packages/rs-dapi-client/src/transport/grpc.rs: fn with_uri_and_settings(
packages/rs-dapi-client/src/transport/grpc.rs: fn with_uri(uri: Uri, pool: &ConnectionPool) -> Result<Self, Self::Error> {
packages/rs-dapi-client/src/transport/grpc.rs: fn with_uri_and_settings(
Ensure that each method call appropriately handles the
Result
using the?
operator,match
statements, or other suitable error handling mechanisms.🔗 Analysis chain
Potential breaking changes and testing recommendation.
The modifications to both
with_uri
andwith_uri_and_settings
methods improve error handling, which aligns with the PR objective of fixing client TLS connections. However, these changes may be breaking if not all implementations and usages have been updated accordingly.TransportClient
have been updated to match the new signatures.Result
return type correctly.Run the following script to find potential usage of these methods that might need updating:
Please confirm that comprehensive testing has been performed to validate these changes across the entire codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 923
Script:
Length of output: 2254
Check failure on line 8 in packages/rs-dapi-client/src/transport/grpc.rs
GitHub Actions / Rust packages (rs-dapi-client) / Linting
failed to resolve: could not find `core` in `dapi_grpc`
Check failure on line 9 in packages/rs-dapi-client/src/transport/grpc.rs
GitHub Actions / Rust packages (rs-dapi-client) / Linting
unresolved import `dapi_grpc::core`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant TLS root certificates configuration
In the
create_channel
function, bothwith_native_roots()
andwith_webpki_roots()
are called on the TLS configuration. These methods set the root certificate store, and calling both may lead to unintended behavior as they might overwrite each other. To ensure the TLS configuration is set correctly, consider using only one of these methods based on the desired root certificates source.Apply this diff to fix the redundancy:
ClientTlsConfig::new() - .with_native_roots() .with_webpki_roots(),
📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Review the use of gRPC status code for error handling
When handling errors from
create_channel
, the code wraps the error usingStatus::failed_precondition
. TheFAILED_PRECONDITION
status code indicates that the system is in an invalid state for the operation to execute. Since channel creation failure might be due to connectivity issues or misconfigurations, consider whetherStatus::unavailable
orStatus::internal
might more accurately represent the error type.Apply this diff if you decide to change the status code: