refactor: prefer conversion methods to infallable casts

This commit is contained in:
Lucille L. Blumire 2025-04-17 15:53:55 +01:00
parent 2dea589c0e
commit 0768b0ad67
No known key found for this signature in database
GPG key ID: D168492023622329
2 changed files with 4 additions and 4 deletions

View file

@ -15,7 +15,7 @@ use sha3::{Digest, Keccak256};
pub fn recover_signer(sig: &[u8; 65], root_hash: &Message) -> Result<[u8; 20]> {
let sig = RecoverableSignature::from_compact(
&sig[0..64],
RecoveryId::try_from(sig[64] as i32 - 27)?,
RecoveryId::try_from(i32::from(sig[64]) - 27)?,
)?;
let public = SECP256K1.recover_ecdsa(root_hash, &sig)?;
Ok(public_key_to_ethereum_address(&public))