Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(signer): small refactor in signer utils #1615

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions crates/signer/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

use alloy_primitives::{keccak256, Address};
use elliptic_curve::sec1::ToEncodedPoint;
use k256::{
ecdsa::{SigningKey, VerifyingKey},
AffinePoint,
};
use k256::ecdsa::{SigningKey, VerifyingKey};

/// Converts an ECDSA private key to its corresponding Ethereum Address.
#[inline]
Expand All @@ -16,7 +13,7 @@ pub fn secret_key_to_address(secret_key: &SigningKey) -> Address {
/// Converts an ECDSA public key to its corresponding Ethereum address.
#[inline]
pub fn public_key_to_address(pubkey: &VerifyingKey) -> Address {
let affine: &AffinePoint = pubkey.as_ref();
let affine = pubkey.as_ref();
let encoded = affine.to_encoded_point(false);
raw_public_key_to_address(&encoded.as_bytes()[1..])
}
Expand Down