Skip to content

Commit 4de91af

Browse files
authored
fix(chain-1974): use fixed size slice for signature param in recover_eth_address (#100)
* fix(chain-1974): use fixed size slice for signature param in recover_eth_address * chore: impl review feedback
1 parent f02692a commit 4de91af

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

solana/programs/bridge/src/base_to_solana/internal/signatures.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ pub fn recover_unique_evm_addresses(
4646

4747
/// Recovers the Ethereum address from a 65-byte Secp256k1 signature over the given message hash.
4848
/// Returns the 20-byte EVM address (keccak(pubkey)[12..32]).
49-
pub fn recover_eth_address(signature: &[u8], message_hash: &[u8; 32]) -> Result<[u8; 20]> {
50-
if signature.len() != 65 {
51-
return err!(SignatureError::InvalidSignatureLength);
52-
}
53-
49+
pub fn recover_eth_address(signature: &[u8; 65], message_hash: &[u8; 32]) -> Result<[u8; 20]> {
5450
let recovery_id = signature[64];
5551
let recovery_id = recovery_id - 27;
5652
if recovery_id >= 2 {
@@ -73,8 +69,6 @@ pub fn recover_eth_address(signature: &[u8], message_hash: &[u8; 32]) -> Result<
7369

7470
#[error_code]
7571
pub enum SignatureError {
76-
#[msg("Invalid signature length")]
77-
InvalidSignatureLength,
7872
#[msg("Invalid recovery ID")]
7973
InvalidRecoveryId,
8074
#[msg("Signature verification failed")]

0 commit comments

Comments
 (0)