From 9b6c746aa45062cca782fca3660cfcc3ba4fbb74 Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Tue, 10 Dec 2024 17:51:03 +0100 Subject: [PATCH 1/2] chore: add small test --- bolt-cli/src/common/hash.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bolt-cli/src/common/hash.rs b/bolt-cli/src/common/hash.rs index 0816134c2..9d9c4eb01 100644 --- a/bolt-cli/src/common/hash.rs +++ b/bolt-cli/src/common/hash.rs @@ -22,3 +22,25 @@ pub fn compress_bls_pubkey(pubkey: &BlsPublicKey) -> CompressedHash { CompressedHash::from_slice(hash.get(0..20).expect("hash is longer than 20 bytes")) } + +#[cfg(test)] +mod tests { + use ethereum_consensus::crypto::PublicKey as BlsPublicKey; + + use crate::common::hash::compress_bls_pubkey; + + #[test] + fn test_compute_pubkey_hash() -> eyre::Result<()> { + let pubkey = "8fa1c53218bdcbb4c8eb27a6c92b8147ca557717a6aeb1f5c347559255b421e5c7327ab047662be883fde91947ae0334"; + let pubkey = BlsPublicKey::try_from(hex::decode(pubkey)?.as_slice())?; + + let hash = compress_bls_pubkey(&pubkey); + assert_eq!( + hex::encode(hash), + "9bf58e9a809e502234ece758ac401741d6c1a30d", + "hash should match the expected value" + ); + + Ok(()) + } +} From fb71e3312a44fc368cea59c45a81b736d4a94cbe Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:52:30 +0100 Subject: [PATCH 2/2] fix: cli test action --- .github/workflows/bolt_cli_ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/bolt_cli_ci.yml b/.github/workflows/bolt_cli_ci.yml index ee5017549..6d93de5bc 100644 --- a/.github/workflows/bolt_cli_ci.yml +++ b/.github/workflows/bolt_cli_ci.yml @@ -32,9 +32,6 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - - name: Install Protoc - uses: arduino/setup-protoc@v3 - - name: Cache cargo registry uses: Swatinem/rust-cache@v2 with: