-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
anvilRecoverSignature
…ndry into anvil-recover-sig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
almost there
/// A custom ecrecover precompile that supports cheat-based signature overrides. | ||
#[derive(Clone, Debug)] | ||
pub struct CheatEcrecover { | ||
cheats: Arc<CheatsManager>, | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep exactly
anvilRecoverSignature
anvilImpersonateSignature
anvilImpersonateSignature
anvil_impersonateSignature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last tiny nit
/// A custom ecrecover precompile that supports cheat-based signature overrides. | ||
#[derive(Clone, Debug)] | ||
pub struct CheatEcrecover { | ||
cheats: Arc<CheatsManager>, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep exactly
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())); | ||
} |
There was a problem hiding this comment.
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
closes #5381