Skip to content

Commit

Permalink
refactor: remove hash function from eip 712 message
Browse files Browse the repository at this point in the history
Signed-off-by: Gustavo Inacio <[email protected]>
  • Loading branch information
gusinacio committed Mar 8, 2024
1 parent 1b1d19c commit 7ebda00
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tap_core/src/eip_712_signed_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ impl<M: SolStruct> EIP712SignedMessage<M> {
/// Returns [`Error::InvalidSignature`] if the signature is not valid with provided `verifying_key`
///
pub fn verify(&self, domain_separator: &Eip712Domain, expected_address: Address) -> Result<()> {
let recovery_message_hash = self.hash(domain_separator);
let recovery_message_hash: [u8; 32] =
self.message.eip712_signing_hash(domain_separator).into();
let expected_address: [u8; 20] = expected_address.into();

self.signature
Expand All @@ -62,10 +63,4 @@ impl<M: SolStruct> EIP712SignedMessage<M> {
pub fn unique_hash(&self) -> MessageId {
MessageId(self.message.eip712_hash_struct().into())
}

fn hash(&self, domain_separator: &Eip712Domain) -> [u8; 32] {
let recovery_message_hash: [u8; 32] =
self.message.eip712_signing_hash(domain_separator).into();
recovery_message_hash
}
}

0 comments on commit 7ebda00

Please sign in to comment.