Skip to content

Commit

Permalink
Merge pull request #431 from singnet/grpc_certificate_issue_fix
Browse files Browse the repository at this point in the history
Snet CLI/SDK | Fixes grpc certificate validation issue
  • Loading branch information
DhivakharVenkatachalam authored Oct 7, 2021
2 parents a66c3ac + c88c40a commit ed33a4b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import web3
from snet.sdk.payment_strategies.payment_staregy import PaymentStrategy
from snet.snet_cli.utils.utils import RESOURCES_PATH, add_to_path

from snet.sdk.root_certificate import root_certificate

class FreeCallPaymentStrategy(PaymentStrategy):

Expand Down Expand Up @@ -40,7 +40,7 @@ def is_free_call_available(self, service_client):
if endpoint_object.scheme == "http":
channel = grpc.insecure_channel(channel_endpoint)
elif endpoint_object.scheme == "https":
channel = grpc.secure_channel(channel_endpoint, grpc.ssl_channel_credentials())
channel = grpc.secure_channel(channel_endpoint, grpc.ssl_channel_credentials(root_certificates=root_certificate))
else:
raise ValueError('Unsupported scheme in service metadata ("{}")'.format(endpoint_object.scheme))

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/snet/sdk/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "v2.0.9"
__version__ = "v3.0.0"

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/snet_cli/snet/snet_cli/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from grpc_tools.protoc import main as protoc

from snet import snet_cli
from snet.snet_cli.resources.root_certificate import certificate

RESOURCES_PATH = PurePath(os.path.dirname(snet_cli.__file__)).joinpath("resources")

Expand Down Expand Up @@ -260,7 +261,7 @@ def open_grpc_channel(endpoint):
options = [('grpc.max_send_message_length', _GB),
('grpc.max_receive_message_length', _GB)]
if (endpoint.startswith("https://")):
return grpc.secure_channel(remove_http_https_prefix(endpoint), grpc.ssl_channel_credentials())
return grpc.secure_channel(remove_http_https_prefix(endpoint), grpc.ssl_channel_credentials(root_certificates=certificate))
return grpc.insecure_channel(remove_http_https_prefix(endpoint))


Expand Down
2 changes: 1 addition & 1 deletion packages/snet_cli/snet/snet_cli/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "v2.0.7"
__version__ = "v2.0.8"

0 comments on commit ed33a4b

Please sign in to comment.