Skip to content

Commit 8996aa2

Browse files
committed
skip unncessarily verifying erc1271 signature + remove stray dbg
1 parent 6be3247 commit 8996aa2

File tree

1 file changed

+27
-32
lines changed

1 file changed

+27
-32
lines changed

aa-core/src/signer.rs

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl<C: Chain + Clone> SmartAccountSigner<C> {
248248
}
249249

250250
/// Verify ERC-1271 signature
251-
async fn verify_erc1271(&self, hash: B256, signature: &str) -> Result<bool, EngineError> {
251+
pub async fn verify_erc1271(&self, hash: B256, signature: &str) -> Result<bool, EngineError> {
252252
let signature_bytes = hex::decode(signature.strip_prefix("0x").unwrap_or(signature))
253253
.map_err(|_| EngineError::ValidationError {
254254
message: "Invalid signature hex".to_string(),
@@ -263,15 +263,10 @@ impl<C: Chain + Clone> SmartAccountSigner<C> {
263263
.await
264264
{
265265
Ok(response) => {
266-
dbg!(response);
267266
let expected_magic = ERC1271Contract::isValidSignatureCall::SELECTOR;
268267
Ok(response.as_slice() == expected_magic)
269268
}
270-
Err(e) => {
271-
let data = e.as_revert_data().unwrap();
272-
dbg!(decode_revert_reason(data.as_ref()));
273-
Ok(false)
274-
}
269+
Err(e) => Ok(false),
275270
}
276271
}
277272

@@ -333,16 +328,16 @@ impl<C: Chain + Clone> SmartAccountSigner<C> {
333328

334329
if is_deployed {
335330
// Verify ERC-1271 signature for deployed accounts
336-
let message_hash = self.hash_message(message, format);
337-
let is_valid = self.verify_erc1271(message_hash, &signature).await?;
338-
339-
if is_valid {
340-
Ok(signature)
341-
} else {
342-
Err(EngineError::ValidationError {
343-
message: "ERC-1271 signature validation failed".to_string(),
344-
})
345-
}
331+
// let message_hash = self.hash_message(message, format);
332+
// let is_valid = self.verify_erc1271(message_hash, &signature).await?;
333+
334+
// if is_valid {
335+
Ok(signature)
336+
// } else {
337+
// Err(EngineError::ValidationError {
338+
// message: "ERC-1271 signature validation failed".to_string(),
339+
// })
340+
// }
346341
} else {
347342
// Create ERC-6492 signature for undeployed accounts
348343
self.create_erc6492_signature(&signature).await
@@ -359,21 +354,21 @@ impl<C: Chain + Clone> SmartAccountSigner<C> {
359354

360355
if is_deployed {
361356
// Verify ERC-1271 signature for deployed accounts
362-
let typed_data_hash =
363-
typed_data
364-
.eip712_signing_hash()
365-
.map_err(|_e| EngineError::ValidationError {
366-
message: "Failed to compute typed data hash".to_string(),
367-
})?;
368-
let is_valid = self.verify_erc1271(typed_data_hash, &signature).await?;
369-
370-
if is_valid {
371-
Ok(signature)
372-
} else {
373-
Err(EngineError::ValidationError {
374-
message: "ERC-1271 signature validation failed".to_string(),
375-
})
376-
}
357+
// let typed_data_hash =
358+
// typed_data
359+
// .eip712_signing_hash()
360+
// .map_err(|_e| EngineError::ValidationError {
361+
// message: "Failed to compute typed data hash".to_string(),
362+
// })?;
363+
// let is_valid = self.verify_erc1271(typed_data_hash, &signature).await?;
364+
365+
// if is_valid {
366+
Ok(signature)
367+
// } else {
368+
// Err(EngineError::ValidationError {
369+
// message: "ERC-1271 signature validation failed".to_string(),
370+
// })
371+
// }
377372
} else {
378373
// Create ERC-6492 signature for undeployed accounts
379374
self.create_erc6492_signature(&signature).await

0 commit comments

Comments
 (0)