Skip to content

feat(anvil): added anvil_impersonateSignature #11195

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Soubhik-10
Copy link
Contributor

@Soubhik-10 Soubhik-10 commented Aug 4, 2025

closes #5381

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great,

as an example test we want a basic function that uses ecrecover that then asserts that the result is the fake address that we installed before invoking this function

@Soubhik-10 Soubhik-10 changed the title feat(anvil): added anvil recover sig feat(anvil): added anvilRecoverSignature Aug 6, 2025
@Soubhik-10 Soubhik-10 marked this pull request as ready for review August 6, 2025 12:19
@Soubhik-10 Soubhik-10 requested a review from mattsse August 6, 2025 12:33
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost there

Comment on lines +100 to +104
/// A custom ecrecover precompile that supports cheat-based signature overrides.
#[derive(Clone, Debug)]
pub struct CheatEcrecover {
cheats: Arc<CheatsManager>,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can move this to end of file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after the impls of this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep exactly

@Soubhik-10 Soubhik-10 changed the title feat(anvil): added anvilRecoverSignature feat(anvil): added anvilImpersonateSignature Aug 7, 2025
@Soubhik-10 Soubhik-10 changed the title feat(anvil): added anvilImpersonateSignature feat(anvil): added anvil_impersonateSignature Aug 7, 2025
@Soubhik-10 Soubhik-10 requested a review from mattsse August 7, 2025 12:46
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last tiny nit

Comment on lines +100 to +104
/// A custom ecrecover precompile that supports cheat-based signature overrides.
#[derive(Clone, Debug)]
pub struct CheatEcrecover {
cheats: Arc<CheatsManager>,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep exactly

Comment on lines +123 to +126
let v = padded[63];
if !(padded[32..63].iter().all(|&b| b == 0) && (v == 27 || v == 28)) {
return Ok(PrecompileOutput::new(ECRECOVER_BASE, Bytes::new()));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can skip this because we can treat this as valid if the sig is an invalid but impersonated signature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Add anvil_recoverSignature
2 participants