Exemplo n.º 1
0
class TestValidateTaskToCompute(object):
    @pytest.fixture(autouse=True)
    def setUp(self):
        (REQUESTOR_ETHEREUM_PRIVATE_KEY,
         REQUESTOR_ETHERUM_PUBLIC_KEY) = generate_ecc_key_pair()
        self.task_to_compute = TaskToComputeFactory(
            requestor_ethereum_public_key=encode_hex(
                REQUESTOR_ETHERUM_PUBLIC_KEY))
        self.task_to_compute.generate_ethsig(REQUESTOR_ETHEREUM_PRIVATE_KEY)
        self.task_to_compute.sign_all_promissory_notes(
            deposit_contract_address=settings.GNT_DEPOSIT_CONTRACT_ADDRESS,
            private_key=REQUESTOR_ETHEREUM_PRIVATE_KEY,
        )

    def test_that_valid_task_to_compute_doesnt_raise_any_exception(self):
        try:
            validate_task_to_compute(self.task_to_compute)
        except Exception as exception:  # pylint: disable=broad-except
            assert False, f"Unexpected exception has been raised: {str(exception)}"

    def test_that_other_messages_than_task_to_compute_causes_message_validation_error(
            self):  # pylint: disable=no-self-use
        wrong_message = ComputeTaskDefFactory()
        with pytest.raises(ConcentValidationError) as exception_wrapper:
            validate_task_to_compute(wrong_message)
        assert_that(exception_wrapper.value.error_code).is_equal_to(
            ErrorCode.MESSAGE_INVALID)
Exemplo n.º 2
0
 def setUp(self):
     (REQUESTOR_ETHEREUM_PRIVATE_KEY,
      REQUESTOR_ETHERUM_PUBLIC_KEY) = generate_ecc_key_pair()
     self.task_to_compute = TaskToComputeFactory(
         requestor_ethereum_public_key=encode_hex(
             REQUESTOR_ETHERUM_PUBLIC_KEY))
     self.task_to_compute.generate_ethsig(REQUESTOR_ETHEREUM_PRIVATE_KEY)
     self.task_to_compute.sign_all_promissory_notes(
         deposit_contract_address=settings.GNT_DEPOSIT_CONTRACT_ADDRESS,
         private_key=REQUESTOR_ETHEREUM_PRIVATE_KEY,
     )
Exemplo n.º 3
0
def create_signed_task_to_compute(
    deadline: int,
    timestamp: Optional[Union[datetime.datetime, str]] = None,
    provider_public_key: Optional[bytes] = None,
    requestor_public_key: Optional[bytes] = None,
    requestor_ethereum_public_key: Optional[bytes] = None,
    requestor_ethereum_private_key: Optional[bytes] = None,
    provider_ethereum_public_key: Optional[bytes] = None,
    want_to_compute_task: Optional[WantToComputeTask] = None,
    price: int = 1,
    size: int = 1,
    package_hash: str = 'sha1:57786d92d1a6f7eaaba1c984db5e108c68b03f0d',
    script_src: Optional[str] = None,
) -> TaskToCompute:
    with freeze_time(timestamp):
        compute_task_def = ComputeTaskDefFactory(
            deadline=deadline,
            extra_data={
                'output_format': 'png',
                'scene_file': '/golem/resources/golem-header-light.blend',
                'frames': [1],
                'script_src': script_src,
            })
        if script_src is not None:
            compute_task_def['extra_data']['script_src'] = script_src
        want_to_compute_task = want_to_compute_task if want_to_compute_task is not None else WantToComputeTaskFactory(
            provider_public_key=encode_hex(provider_public_key)
            if provider_public_key is not None else
            _get_provider_hex_public_key(),
            provider_ethereum_public_key=encode_hex(
                provider_ethereum_public_key) if provider_ethereum_public_key
            is not None else encode_hex(PROVIDER_ETHEREUM_PUBLIC_KEY),
        )
        want_to_compute_task = sign_message(want_to_compute_task,
                                            PROVIDER_PRIVATE_KEY)
        task_to_compute = TaskToComputeFactory(
            requestor_public_key=encode_hex(requestor_public_key)
            if requestor_public_key is not None else
            _get_requestor_hex_public_key(),
            compute_task_def=compute_task_def,
            want_to_compute_task=want_to_compute_task,
            requestor_ethereum_public_key=encode_hex(
                requestor_ethereum_public_key) if requestor_ethereum_public_key
            is not None else encode_hex(REQUESTOR_ETHEREUM_PUBLIC_KEY),
            price=price,
            size=size,
            package_hash=package_hash,
        )
        task_to_compute.generate_ethsig(
            requestor_ethereum_private_key if requestor_ethereum_private_key
            is not None else REQUESTOR_ETHEREUM_PRIVATE_KEY)
        signed_task_to_compute: TaskToCompute = sign_message(
            task_to_compute, REQUESTOR_PRIVATE_KEY)
        return signed_task_to_compute
    def test_that_validate_all_messages_identical_should_raise_http400_when_not_all_task_to_compute_are_identical(
            self):
        task_to_compute = TaskToComputeFactory()
        different_task_to_compute = TaskToComputeFactory(requestor_id=b'')
        list_of_not_identical_task_to_compute = [
            task_to_compute,
            task_to_compute,
            different_task_to_compute,
        ]

        with self.assertRaises(ConcentValidationError):
            validate_all_messages_identical(
                list_of_not_identical_task_to_compute)
Exemplo n.º 5
0
 def setUp(self):
     self.task_to_compute_1 = TaskToComputeFactory(
         requestor_ethereum_public_key=encode_hex(REQUESTOR_PUB_ETH_KEY),
         requestor_public_key=encode_hex(REQUESTOR_PUBLIC_KEY),
         want_to_compute_task=WantToComputeTaskFactory(
             provider_public_key=encode_hex(PROVIDER_PUBLIC_KEY), ),
     )
     self.task_to_compute_1.generate_ethsig(REQUESTOR_PRIV_ETH_KEY)
     self.task_to_compute_2 = TaskToComputeFactory(
         requestor_ethereum_public_key=encode_hex(REQUESTOR_PUB_ETH_KEY),
         requestor_public_key=encode_hex(REQUESTOR_PUBLIC_KEY),
         want_to_compute_task=WantToComputeTaskFactory(
             provider_public_key=encode_hex(PROVIDER_PUBLIC_KEY), ),
     )
     self.task_to_compute_2.generate_ethsig(REQUESTOR_PRIV_ETH_KEY)
Exemplo n.º 6
0
def create_signed_task_to_compute(
        task_id,
        subtask_id,
        deadline,
        timestamp=None,
        provider_public_key=None,
        requestor_public_key=None,
        requestor_ethereum_public_key=REQUESTOR_ETHEREUM_PUBLIC_KEY,
        provider_ethereum_public_key=PROVIDER_ETHEREUM_PUBLIC_KEY,
        price=0):
    with freeze_time(timestamp):
        compute_task_def = ComputeTaskDefFactory(
            task_id=task_id,
            subtask_id=subtask_id,
            deadline=deadline,
        )
        task_to_compute = TaskToComputeFactory(
            provider_public_key=provider_public_key if provider_public_key
            is not None else _get_provider_hex_public_key(),
            requestor_public_key=requestor_public_key if requestor_public_key
            is not None else _get_requestor_hex_public_key(),
            compute_task_def=compute_task_def,
            requestor_ethereum_public_key=requestor_ethereum_public_key,
            provider_ethereum_public_key=provider_ethereum_public_key,
            price=price,
            size=1,
        )
        sign_message(task_to_compute, REQUESTOR_PRIVATE_KEY)
        return task_to_compute
Exemplo n.º 7
0
 def _get_deserialized_task_to_compute(
     self,
     timestamp: int = None,
     deadline = None,
     task_id: str = '1',
     subtask_id: str = '2',
     compute_task_def = None,
     requestor_id: bytes = None,
     requestor_public_key: bytes = None,
     requestor_ethereum_public_key: bytes = None,
     provider_id: bytes = None,
     provider_public_key: bytes = None,
     provider_ethereum_public_key: bytes = None,
     price = 0,
     package_hash: str = 'sha1:230fb0cad8c7ed29810a2183f0ec1d39c9df3f4a',
     sign_with_private_key = None,
     size=1,
 ):
     """ Returns TaskToCompute deserialized. """
     compute_task_def = (
         compute_task_def if compute_task_def is not None else self._get_deserialized_compute_task_def(
             task_id=task_id,
             subtask_id=subtask_id,
             deadline=deadline,
         )
     )
     assert isinstance(requestor_id, str) or requestor_id is None
     assert isinstance(requestor_public_key, str) or requestor_public_key is None
     assert isinstance(provider_id, str) or provider_id is None
     assert isinstance(provider_public_key, str) or provider_public_key is None
     with freeze_time(timestamp or self._get_timestamp_string()):
         task_to_compute = TaskToComputeFactory(
             compute_task_def=compute_task_def,
             requestor_id=(
                 requestor_id if requestor_id is not None else self._get_requestor_hex_public_key()
             ),
             requestor_public_key            = (
                 requestor_public_key if requestor_public_key is not None else self._get_requestor_hex_public_key()
             ),
             requestor_ethereum_public_key   = (
                 requestor_ethereum_public_key if requestor_ethereum_public_key is not None else self._get_requestor_ethereum_hex_public_key()
             ),
             provider_id                     = (
                 provider_id if provider_id is not None else self._get_provider_hex_public_key()
             ),
             provider_public_key             = (
                 provider_public_key if provider_public_key is not None else self._get_provider_hex_public_key()
             ),
             provider_ethereum_public_key    = (
                 provider_ethereum_public_key if provider_ethereum_public_key is not None else self._get_provider_ethereum_hex_public_key()
             ),
             price=price,
             package_hash=package_hash,
             size=size,
         )
         task_to_compute = self._sign_message(
             task_to_compute,
             sign_with_private_key,
         )
     return task_to_compute
Exemplo n.º 8
0
 def setUp(self):
     self.task_to_compute_1 = TaskToComputeFactory(
         requestor_ethereum_address=encode_hex(REQUESTOR_PUBLIC_KEY),
         requestor_ethereum_public_key=encode_hex(REQUESTOR_PUB_ETH_KEY),
         requestor_public_key=encode_hex(REQUESTOR_PUBLIC_KEY),
         provider_ethereum_address=encode_hex(PROVIDER_PUBLIC_KEY),
         provider_ethereum_public_key=encode_hex(PROVIDER_PUB_ETH_KEY),
         provider_public_key=encode_hex(PROVIDER_PUBLIC_KEY),
     )
     self.task_to_compute_2 = TaskToComputeFactory(
         requestor_ethereum_address=encode_hex(REQUESTOR_PUBLIC_KEY),
         requestor_ethereum_public_key=encode_hex(REQUESTOR_PUB_ETH_KEY),
         requestor_public_key=encode_hex(REQUESTOR_PUBLIC_KEY),
         provider_ethereum_address=encode_hex(PROVIDER_PUBLIC_KEY),
         provider_ethereum_public_key=encode_hex(PROVIDER_PUB_ETH_KEY),
         provider_public_key=encode_hex(PROVIDER_PUBLIC_KEY),
     )
Exemplo n.º 9
0
def create_signed_task_to_compute(
    task_id,
    subtask_id,
    deadline,
    timestamp=None,
    provider_public_key=None,
    requestor_public_key=None,
    requestor_ethereum_public_key=None,
    provider_ethereum_public_key=None,
    price=0,
    size=1,
    package_hash='sha1:57786d92d1a6f7eaaba1c984db5e108c68b03f0d',
    script_src=None,
):
    with freeze_time(timestamp):
        compute_task_def = ComputeTaskDefFactory(
            task_id=task_id,
            subtask_id=subtask_id,
            deadline=deadline,
            extra_data={
                'output_format': 'png',
                'scene_file': 'golem-header-light.blend',
                'frames': [1],
                'script_src': script_src,
            })
        if script_src is not None:
            compute_task_def['extra_data']['script_src'] = script_src
        task_to_compute = TaskToComputeFactory(
            provider_public_key=provider_public_key if provider_public_key
            is not None else _get_provider_hex_public_key(),
            requestor_public_key=requestor_public_key if requestor_public_key
            is not None else _get_requestor_hex_public_key(),
            compute_task_def=compute_task_def,
            requestor_ethereum_public_key=requestor_ethereum_public_key
            if requestor_ethereum_public_key is not None else
            REQUESTOR_ETHEREUM_PUBLIC_KEY,
            provider_ethereum_public_key=provider_ethereum_public_key
            if provider_ethereum_public_key is not None else
            PROVIDER_ETHEREUM_PUBLIC_KEY,
            price=price,
            size=size,
            package_hash=package_hash,
        )
        sign_message(task_to_compute, REQUESTOR_PRIVATE_KEY)
        return task_to_compute
    def test_that_validate_all_messages_identical_should_not_raise_http400_when_all_task_to_compute_are_identical(
            self):
        task_to_compute = TaskToComputeFactory()
        copied_task_to_compute = deepcopy(task_to_compute)
        # validation function should not raise exception for difference in encrypted parameter
        copied_task_to_compute.encrypted = True
        self.assertEqual(copied_task_to_compute.encrypted, True)
        self.assertEqual(task_to_compute.encrypted, False)
        list_of_identical_task_to_compute = [
            task_to_compute,
            copied_task_to_compute,
            task_to_compute,
        ]

        try:
            validate_all_messages_identical(list_of_identical_task_to_compute)
        except Http400:
            self.fail()
Exemplo n.º 11
0
    def setUp(self):
        super().setUp()

        (self.PROVIDER_PRIVATE_KEY,
         self.PROVIDER_PUBLIC_KEY) = generate_ecc_key_pair()
        (self.REQUESTOR_PRIVATE_KEY,
         self.REQUESTOR_PUBLIC_KEY) = generate_ecc_key_pair()

        self.task_to_compute = TaskToComputeFactory()

        self.subtask = store_subtask(
            task_id=self.task_to_compute.task_id,
            subtask_id=self.task_to_compute.subtask_id,
            provider_public_key=self.PROVIDER_PUBLIC_KEY,
            requestor_public_key=self.REQUESTOR_PUBLIC_KEY,
            state=Subtask.SubtaskState.ADDITIONAL_VERIFICATION,
            next_deadline=get_current_utc_timestamp() +
            settings.CONCENT_MESSAGING_TIME,
            task_to_compute=self.task_to_compute,
            report_computed_task=ReportComputedTaskFactory(
                task_to_compute=self.task_to_compute, ))
Exemplo n.º 12
0
def create_signed_task_to_compute(
    deadline: int,
    timestamp: Optional[Union[datetime.datetime, str]] = None,
    provider_public_key: Optional[bytes] = None,
    provider_private_key: Optional[bytes] = None,
    requestor_public_key: Optional[bytes] = None,
    requestor_private_key: Optional[bytes] = None,
    price: int = 1,
    size: int = 1,
    package_hash: str = 'sha1:57786d92d1a6f7eaaba1c984db5e108c68b03f0d',
    render_parameters: Optional[Dict[str, Any]] = None,
) -> TaskToCompute:
    # Temporary workaround for requestor's and provider's keys until all Concent use cases will have payments
    # When we will have payments then all keys will be taken from SCIBaseTest class
    if provider_public_key is None and provider_private_key is None:
        provider_public_key = PROVIDER_PUBLIC_KEY
        provider_private_key = PROVIDER_PRIVATE_KEY
    if requestor_public_key is None and requestor_private_key is None:
        requestor_public_key = REQUESTOR_PUBLIC_KEY
        requestor_private_key = REQUESTOR_PRIVATE_KEY

    with freeze_time(timestamp):
        compute_task_def = ComputeTaskDefFactory(
            deadline=deadline,
            extra_data={
                'output_format':
                'png',
                'scene_file':
                '/golem/resources/golem-header-light.blend',
                'frames': [1],
                'resolution':
                render_parameters.get('resolution')
                if render_parameters is not None else [400, 400],
                'use_compositing':
                render_parameters.get('use_compositing')
                if render_parameters is not None else False,
                'samples':
                render_parameters.get('samples')
                if render_parameters is not None else 0,
                'crops': [{
                    'borders_x':
                    render_parameters['borders_x']
                    if render_parameters is not None else [0.0, 1.0],
                    'borders_y':
                    render_parameters['borders_y']
                    if render_parameters is not None else [0.0, 1.0],
                }]
            })

        task_header: TaskHeader = TaskHeaderFactory(
            task_id=compute_task_def['task_id'],
            sign__privkey=requestor_private_key,
        )

        want_to_compute_task = WantToComputeTaskFactory(
            provider_public_key=encode_hex(provider_public_key),
            task_header=task_header,
            sign__privkey=provider_private_key)

        task_to_compute = TaskToComputeFactory(
            requestor_public_key=encode_hex(requestor_public_key),
            compute_task_def=compute_task_def,
            want_to_compute_task=want_to_compute_task,
            requestor_ethereum_public_key=encode_hex(requestor_public_key),
            price=price,
            size=size,
            package_hash=package_hash,
        )
        task_to_compute.generate_ethsig(requestor_private_key)
        task_to_compute.sign_all_promissory_notes(
            deposit_contract_address=settings.GNT_DEPOSIT_CONTRACT_ADDRESS,
            private_key=requestor_private_key,
        )
        signed_task_to_compute: TaskToCompute = sign_message(
            task_to_compute, requestor_private_key)  # type: ignore
        return signed_task_to_compute
Exemplo n.º 13
0
 def setUp(self):
     self.task_to_compute = TaskToComputeFactory()
Exemplo n.º 14
0
class TestAreEthereumAddressesAndKeysUnique(TestCase):

    def setUp(self):
        self.task_to_compute_1 = TaskToComputeFactory(
            requestor_ethereum_public_key=encode_hex(REQUESTOR_PUB_ETH_KEY),
            requestor_public_key=encode_hex(REQUESTOR_PUBLIC_KEY),
            want_to_compute_task=WantToComputeTaskFactory(
                provider_ethereum_public_key=encode_hex(PROVIDER_PUB_ETH_KEY),
                provider_public_key=encode_hex(PROVIDER_PUBLIC_KEY),
            ),
        )
        self.task_to_compute_1.generate_ethsig(REQUESTOR_PRIV_ETH_KEY)
        self.task_to_compute_2 = TaskToComputeFactory(
            requestor_ethereum_public_key=encode_hex(REQUESTOR_PUB_ETH_KEY),
            requestor_public_key=encode_hex(REQUESTOR_PUBLIC_KEY),
            want_to_compute_task=WantToComputeTaskFactory(
                provider_ethereum_public_key=encode_hex(PROVIDER_PUB_ETH_KEY),
                provider_public_key=encode_hex(PROVIDER_PUBLIC_KEY),
            ),
        )
        self.task_to_compute_2.generate_ethsig(REQUESTOR_PRIV_ETH_KEY)

    def create_subtask_results_accepted_list(  # pylint: disable=no-self-use
        self,
        task_to_compute_1,
        task_to_compute_2,
        subtask_1_signed_by=REQUESTOR_PRIVATE_KEY,
        subtask_2_signed_by=REQUESTOR_PRIVATE_KEY,
    ) -> list:
        subtask_results_accepted_1 = SubtaskResultsAcceptedFactory(
            payment_ts="2018-02-05 12:00:16",
            report_computed_task=ReportComputedTaskFactory(
                task_to_compute=task_to_compute_1
            )
        )
        sign_message(subtask_results_accepted_1, subtask_1_signed_by)
        subtask_results_accepted_2 = SubtaskResultsAcceptedFactory(
            payment_ts="2018-02-05 12:00:16",
            report_computed_task=ReportComputedTaskFactory(
                task_to_compute=task_to_compute_2
            )
        )
        sign_message(subtask_results_accepted_2, subtask_2_signed_by)
        subtask_results_accepted_list = [
            subtask_results_accepted_1,
            subtask_results_accepted_2,
        ]
        return subtask_results_accepted_list

    def test_that_if_the_same_values_given_method_should_return_true(self):
        subtask_results_accepted_list = self.create_subtask_results_accepted_list(self.task_to_compute_1, self.task_to_compute_2)
        result = are_keys_and_addresses_unique_in_message_subtask_results_accepted(subtask_results_accepted_list)
        assert_that(result).is_true()

    def test_that_if_different_requestor_ethereum_public_keys_are_given_method_should_return_false(self):
        self.task_to_compute_2.requestor_ethereum_public_key = encode_hex(DIFFERENT_REQUESTOR_PUB_ETH_KEY)
        self.task_to_compute_2.generate_ethsig(DIFFERENT_REQUESTOR_PRIV_ETH_KEY)
        subtask_results_accepted_list = self.create_subtask_results_accepted_list(self.task_to_compute_1, self.task_to_compute_2)
        result = are_keys_and_addresses_unique_in_message_subtask_results_accepted(subtask_results_accepted_list)
        assert_that(result).is_false()

    def test_that_if_different_requestor_public_keys_are_given_method_should_return_false(self):
        self.task_to_compute_2.requestor_public_key = encode_hex(DIFFERENT_REQUESTOR_PUBLIC_KEY)
        self.task_to_compute_2.generate_ethsig(REQUESTOR_PRIV_ETH_KEY)
        subtask_results_accepted_list = self.create_subtask_results_accepted_list(self.task_to_compute_1, self.task_to_compute_2)
        result = are_keys_and_addresses_unique_in_message_subtask_results_accepted(subtask_results_accepted_list)
        assert_that(result).is_false()

    def test_that_if_different_provider_ethereum_public_keys_are_given_method_should_return_false(self):
        self.task_to_compute_2.want_to_compute_task.provider_ethereum_public_key = encode_hex(DIFFERENT_PROVIDER_PUB_ETH_KEY)
        self.task_to_compute_2.generate_ethsig(REQUESTOR_PRIV_ETH_KEY)
        subtask_results_accepted_list = self.create_subtask_results_accepted_list(self.task_to_compute_1, self.task_to_compute_2)
        result = are_keys_and_addresses_unique_in_message_subtask_results_accepted(subtask_results_accepted_list)
        assert_that(result).is_false()

    def test_that_if_different_provider_public_keys_are_given_method_should_return_false(self):
        self.task_to_compute_2.want_to_compute_task.provider_public_key = encode_hex(DIFFERENT_PROVIDER_PUBLIC_KEY)
        self.task_to_compute_2.generate_ethsig(REQUESTOR_PRIV_ETH_KEY)
        subtask_results_accepted_list = self.create_subtask_results_accepted_list(self.task_to_compute_1, self.task_to_compute_2)
        result = are_keys_and_addresses_unique_in_message_subtask_results_accepted(subtask_results_accepted_list)
        assert_that(result).is_false()

    def test_that_if_messages_are_signed_by_different_requestors_method_should_return_false(self):
        subtask_results_accepted_list = self.create_subtask_results_accepted_list(
            self.task_to_compute_1,
            self.task_to_compute_2,
            subtask_2_signed_by=DIFFERENT_REQUESTOR_PRIVATE_KEY,
        )
        result = are_subtask_results_accepted_messages_signed_by_the_same_requestor(subtask_results_accepted_list)
        assert_that(result).is_false()
Exemplo n.º 15
0
    def _get_deserialized_task_to_compute(
        self,
        timestamp: Union[str, datetime.datetime, None] = None,
        deadline: Union[str, int, None] = None,
        task_id: str = '1',
        subtask_id: str = '2',
        compute_task_def: Optional[ComputeTaskDef] = None,
        requestor_id: Optional[bytes] = None,
        requestor_public_key: Optional[bytes] = None,
        requestor_ethereum_public_key: Optional[bytes] = None,
        provider_id: Optional[bytes] = None,
        provider_public_key: Optional[bytes] = None,
        provider_ethereum_public_key: Optional[bytes] = None,
        price: int = 0,
        package_hash: str = 'sha1:230fb0cad8c7ed29810a2183f0ec1d39c9df3f4a',
        signer_private_key: Optional[bytes] = None,
        size: int = 1,
        frames: Optional[List[int]] = None,
    ) -> TaskToCompute:
        """ Returns TaskToCompute deserialized. """
        compute_task_def = (compute_task_def if compute_task_def is not None
                            else self._get_deserialized_compute_task_def(
                                task_id=task_id,
                                subtask_id=subtask_id,
                                deadline=deadline,
                                frames=frames if frames is not None else [1],
                            ))
        assert isinstance(requestor_id, str) or requestor_id is None
        assert isinstance(requestor_public_key,
                          str) or requestor_public_key is None
        assert isinstance(provider_id, str) or provider_id is None
        assert isinstance(provider_public_key,
                          str) or provider_public_key is None
        assert isinstance(timestamp,
                          (str, datetime.datetime)) or timestamp is None

        with freeze_time(timestamp or get_timestamp_string()):
            task_to_compute = TaskToComputeFactory(
                compute_task_def=compute_task_def,
                requestor_id=(requestor_id if requestor_id is not None else
                              self._get_requestor_hex_public_key()),
                requestor_public_key=(requestor_public_key
                                      if requestor_public_key is not None else
                                      self._get_requestor_hex_public_key()),
                requestor_ethereum_public_key=(
                    requestor_ethereum_public_key
                    if requestor_ethereum_public_key is not None else
                    self._get_requestor_ethereum_hex_public_key()),
                provider_id=(provider_id if provider_id is not None else
                             self._get_provider_hex_public_key()),
                provider_public_key=(provider_public_key
                                     if provider_public_key is not None else
                                     self._get_provider_hex_public_key()),
                provider_ethereum_public_key=(
                    provider_ethereum_public_key
                    if provider_ethereum_public_key is not None else
                    self._get_provider_ethereum_hex_public_key()),
                price=price,
                package_hash=package_hash,
                size=size,
            )
        task_to_compute = self._sign_message(
            task_to_compute,
            signer_private_key,
        )
        return task_to_compute