From 0947855d20644fd0354f3018fb40766079f06be7 Mon Sep 17 00:00:00 2001 From: sashass1315 Date: Mon, 2 Feb 2026 11:33:57 +0200 Subject: [PATCH] perf: remove extra allocations in BLS point decoding --- ethereum/consensus-core/src/types/bls.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ethereum/consensus-core/src/types/bls.rs b/ethereum/consensus-core/src/types/bls.rs index a9167c15..085a05e8 100644 --- a/ethereum/consensus-core/src/types/bls.rs +++ b/ethereum/consensus-core/src/types/bls.rs @@ -25,8 +25,8 @@ pub struct Signature { impl PublicKey { pub(crate) fn point(&self) -> Result { - let bytes = self.inner.inner.to_vec(); - let bytes = bytes.as_slice().try_into()?; + let bytes: &[u8] = &self.inner.inner; + let bytes = bytes.try_into()?; let point_opt = G1Affine::from_compressed(bytes); if point_opt.is_some().into() { Ok(point_opt.unwrap()) @@ -53,8 +53,8 @@ impl Signature { } fn point(&self) -> Result { - let bytes = self.inner.inner.to_vec(); - let bytes = bytes.as_slice().try_into()?; + let bytes: &[u8] = &self.inner.inner; + let bytes = bytes.try_into()?; let point_opt = G2Affine::from_compressed(bytes); if point_opt.is_some().into() { Ok(point_opt.unwrap())