diff --git a/modules/attestation-report/src/report.rs b/modules/attestation-report/src/report.rs index 51d333c6..d422fdba 100644 --- a/modules/attestation-report/src/report.rs +++ b/modules/attestation-report/src/report.rs @@ -88,7 +88,7 @@ pub struct EndorsedAttestationVerificationReport { impl EndorsedAttestationVerificationReport { pub fn get_avr(&self) -> Result { - serde_json::from_slice(self.avr.as_bytes()).map_err(Error::serde_json) + serde_json::from_slice(self.avr.as_ref()).map_err(Error::serde_json) } } diff --git a/modules/attestation-report/src/verification.rs b/modules/attestation-report/src/verification.rs index e0685bf1..84485a77 100644 --- a/modules/attestation-report/src/verification.rs +++ b/modules/attestation-report/src/verification.rs @@ -71,7 +71,7 @@ pub fn verify_report( report_cert .verify_signature( &webpki::RSA_PKCS1_2048_8192_SHA256, - report.avr.as_bytes(), + report.avr.as_ref(), &report.signature, ) .map_err(|e| Error::web_pki(e.to_string()))?; diff --git a/modules/lcp-client/src/errors.rs b/modules/lcp-client/src/errors.rs index 56f487b4..773f5245 100644 --- a/modules/lcp-client/src/errors.rs +++ b/modules/lcp-client/src/errors.rs @@ -58,7 +58,11 @@ define_error! { IbcProto [TraceError] - |_| { "IBCProto error" } + |_| { "IBCProto error" }, + + StringFromUtf8Error + [TraceError] + |_| { "FromUtf8 error" }, } } @@ -91,3 +95,9 @@ impl From for Error { Self::commitment_proof(value) } } + +impl From for Error { + fn from(value: alloc::string::FromUtf8Error) -> Self { + Self::string_from_utf8_error(value) + } +} diff --git a/modules/lcp-client/src/message.rs b/modules/lcp-client/src/message.rs index 881d0dcd..4352819c 100644 --- a/modules/lcp-client/src/message.rs +++ b/modules/lcp-client/src/message.rs @@ -67,7 +67,7 @@ impl TryFrom for RegisterEnclaveKeyMessage { fn try_from(value: RawRegisterEnclaveKeyMessage) -> Result { Ok(RegisterEnclaveKeyMessage { report: EndorsedAttestationVerificationReport { - avr: value.report, + avr: String::from_utf8(value.report)?, signature: value.signature, signing_cert: value.signing_cert, }, @@ -80,7 +80,7 @@ impl TryFrom for RegisterEnclaveKeyMessage { impl From for RawRegisterEnclaveKeyMessage { fn from(value: RegisterEnclaveKeyMessage) -> Self { RawRegisterEnclaveKeyMessage { - report: (&value.report.avr).try_into().unwrap(), + report: value.report.avr.into_bytes(), signature: value.report.signature, signing_cert: value.report.signing_cert, operator_signature: value.operator_signature.unwrap_or_default(), diff --git a/proto/definitions/ibc/lightclients/lcp/v1/lcp.proto b/proto/definitions/ibc/lightclients/lcp/v1/lcp.proto index e4e98bf8..d9e52489 100644 --- a/proto/definitions/ibc/lightclients/lcp/v1/lcp.proto +++ b/proto/definitions/ibc/lightclients/lcp/v1/lcp.proto @@ -13,7 +13,7 @@ message UpdateClientMessage { } message RegisterEnclaveKeyMessage { - string report = 1; + bytes report = 1; bytes signature = 2; bytes signing_cert = 3; bytes operator_signature = 4; diff --git a/proto/src/descriptor.bin b/proto/src/descriptor.bin index d1334fd8..cf8cc629 100644 Binary files a/proto/src/descriptor.bin and b/proto/src/descriptor.bin differ diff --git a/proto/src/prost/ibc.lightclients.lcp.v1.rs b/proto/src/prost/ibc.lightclients.lcp.v1.rs index 1f4f2518..8a24045e 100644 --- a/proto/src/prost/ibc.lightclients.lcp.v1.rs +++ b/proto/src/prost/ibc.lightclients.lcp.v1.rs @@ -9,8 +9,8 @@ pub struct UpdateClientMessage { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterEnclaveKeyMessage { - #[prost(string, tag = "1")] - pub report: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "1")] + pub report: ::prost::alloc::vec::Vec, #[prost(bytes = "vec", tag = "2")] pub signature: ::prost::alloc::vec::Vec, #[prost(bytes = "vec", tag = "3")]