From 10a3a4d36d15c81144ad8013dcab69719c1bf3f1 Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Thu, 10 Oct 2024 14:38:28 +0200 Subject: [PATCH] fix(sidecar): keystore validation logic --- bolt-sidecar/src/signer/keystore.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bolt-sidecar/src/signer/keystore.rs b/bolt-sidecar/src/signer/keystore.rs index e05373503..931cd1f53 100644 --- a/bolt-sidecar/src/signer/keystore.rs +++ b/bolt-sidecar/src/signer/keystore.rs @@ -12,6 +12,7 @@ use eyre::eyre; use lighthouse_bls::Keypair; use lighthouse_eth2_keystore::Keystore; +use ssz::Encode; use crate::crypto::bls::BLSSig; @@ -50,11 +51,11 @@ impl KeystoreSigner { root: [u8; 32], public_key: [u8; BLS_PUBLIC_KEY_BYTES_LEN], ) -> eyre::Result { - // NOTE: is this a good comparison? let sk = self .keypairs .iter() - .find(|kp| kp.pk.as_hex_string() == hex::encode(public_key)) + // NOTE: need to check if this method returns just the raw bytes + .find(|kp| kp.pk.as_ssz_bytes() == public_key.as_ref()) .ok_or(eyre!("could not find private key associated to public key"))?; let sig = hex::decode(sk.sk.sign(root.into()).to_string())?;