diff --git a/packages/syft-job/src/syft_job/client.py b/packages/syft-job/src/syft_job/client.py index 47803d00afa..0d8630ce4a0 100644 --- a/packages/syft-job/src/syft_job/client.py +++ b/packages/syft-job/src/syft_job/client.py @@ -669,7 +669,7 @@ def _job_has_all_files(self, ref: JobRef) -> bool: submission_dir = self.manager.submission_dir(ref) declared = metadata.headers.get(SUBMISSION_HASH_HEADER) if declared: - return code_hash(submission_dir) == declared + return code_hash(submission_dir, as_sent=True) == declared return has_listed_files(submission_dir, metadata.files) def _request_has_all_files(self, ref: RequestRef) -> bool: diff --git a/packages/syft-job/src/syft_job/submission.py b/packages/syft-job/src/syft_job/submission.py index b69f8b89742..1cb8b3b8576 100644 --- a/packages/syft-job/src/syft_job/submission.py +++ b/packages/syft-job/src/syft_job/submission.py @@ -108,12 +108,15 @@ def _digest( ) -> str: digest = hashlib.sha256() files = sorted( - path - for path in submission_dir.rglob("*") - if path.is_file() - and not _is_skipped(relative := path.relative_to(submission_dir)) - and (entries is None or relative.parts[0] in entries) - and relative.as_posix() not in skip + ( + path + for path in submission_dir.rglob("*") + if path.is_file() + and not _is_skipped(relative := path.relative_to(submission_dir)) + and (entries is None or relative.parts[0] in entries) + and relative.as_posix() not in skip + ), + key=lambda p: p.relative_to(submission_dir).as_posix(), ) for path in files: content = _as_sent(path) if as_sent else path.read_bytes()