From 3a7f3ae0026354e71d3dc97c1a4a56f33a85a3dd Mon Sep 17 00:00:00 2001 From: Natchica Date: Thu, 11 Sep 2025 10:17:28 +0200 Subject: [PATCH] fix(errors): remove invalid enclave challenge private key error --- post-compute/src/compute/errors.rs | 2 -- post-compute/src/compute/signer.rs | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/post-compute/src/compute/errors.rs b/post-compute/src/compute/errors.rs index 36978aa..b6bfcdd 100644 --- a/post-compute/src/compute/errors.rs +++ b/post-compute/src/compute/errors.rs @@ -15,8 +15,6 @@ pub enum ReplicateStatusCause { PostComputeEncryptionPublicKeyMissing, #[error("Unexpected error occurred")] PostComputeFailedUnknownIssue, - #[error("Invalid enclave challenge private key")] - PostComputeInvalidEnclaveChallengePrivateKey, #[error("Invalid TEE signature")] PostComputeInvalidTeeSignature, #[error("Failed to upload to IPFS")] diff --git a/post-compute/src/compute/signer.rs b/post-compute/src/compute/signer.rs index 3dc9701..6760dd3 100644 --- a/post-compute/src/compute/signer.rs +++ b/post-compute/src/compute/signer.rs @@ -27,7 +27,7 @@ use alloy_signer_local::PrivateKeySigner; /// # Errors /// /// This function will return an error in the following situations: -/// * The provided private key cannot be parsed as a valid `PrivateKeySigner` (returns `PostComputeInvalidEnclaveChallengePrivateKey`) +/// * The provided private key cannot be parsed as a valid `PrivateKeySigner` (returns `PostComputeInvalidTeeSignature`) /// * The signing operation fails (returns `PostComputeInvalidTeeSignature`) /// /// # Example @@ -49,7 +49,7 @@ pub fn sign_enclave_challenge( ) -> Result { let signer: PrivateKeySigner = enclave_challenge_private_key .parse::() - .map_err(|_| ReplicateStatusCause::PostComputeInvalidEnclaveChallengePrivateKey)?; + .map_err(|_| ReplicateStatusCause::PostComputeInvalidTeeSignature)?; let signature: Signature = signer .sign_message_sync(&hex_string_to_byte_array(message_hash)) @@ -144,7 +144,7 @@ mod tests { assert!( matches!( result, - Err(err) if err == ReplicateStatusCause::PostComputeInvalidEnclaveChallengePrivateKey + Err(err) if err == ReplicateStatusCause::PostComputeInvalidTeeSignature ), "Should return missing TEE challenge private key error" );