Skip to content

Commit

Permalink
Bubble up CertificateRequest to utils.py (#1496)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1496

`create_and_start_mpc_instance` is the main interface used by mpc games (ex.  https://fburl.com/code/cmfkxuzv).

in this diff, we add the change to fbpcs and update the changelog

Reviewed By: gorel

Differential Revision: D38666369

fbshipit-source-id: 42f2703a6372b1662033bfbecbe3dfdf424672cc
  • Loading branch information
adshastri authored and facebook-github-bot committed Aug 24, 2022
1 parent bfacb02 commit 7ef56d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fbpcs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Types of changes

## [Unreleased]
### Added

- Added an option to specify a CertificateRequest when creating an mpc game instance
### Changed
- Mark validate_container_definition as deprecated in PCSContainerService since it is no longer a public method in ContainerService in fbpcp
### Removed
Expand Down
5 changes: 5 additions & 0 deletions fbpcs/private_computation/service/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import warnings
from typing import Any, DefaultDict, Dict, List, Optional

from fbpcp.entity.certificate_request import CertificateRequest

from fbpcp.entity.container_instance import ContainerInstance
from fbpcp.entity.mpc_instance import MPCInstance, MPCInstanceStatus, MPCParty
from fbpcp.service.mpc import MPCService
Expand Down Expand Up @@ -62,6 +64,7 @@ async def create_and_start_mpc_instance(
game_args: Optional[List[Dict[str, Any]]] = None,
container_timeout: Optional[int] = None,
repository_path: Optional[str] = None,
certificate_request: Optional[CertificateRequest] = None,
) -> MPCInstance:
"""Creates an MPC instance and runs MPC service with it
Expand All @@ -76,6 +79,7 @@ async def create_and_start_mpc_instance(
game_args: arguments that are passed to game binaries by onedocker
container_timeout: optional duration in seconds before cloud containers timeout
repository_path: Path from where we can download the required executable.
certificate_request: Arguments to create a TLS certificate/key pair
Returns:
return: an mpc instance started by mpc service
Expand All @@ -97,6 +101,7 @@ async def create_and_start_mpc_instance(
timeout=container_timeout or DEFAULT_CONTAINER_TIMEOUT_IN_SEC,
version=binary_version,
env_vars=env_vars,
certificate_request=certificate_request,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ async def test_create_and_start_mpc_instance(self, mock_mpc_svc) -> None:
timeout=DEFAULT_CONTAINER_TIMEOUT_IN_SEC,
version=binary_version,
env_vars=env_vars,
certificate_request=None,
),
mock_mpc_svc.start_instance_async.call_args,
)
Expand Down

0 comments on commit 7ef56d6

Please sign in to comment.