-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
(fix): correctly redact private keys in traces #6995 #7049
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.
tysm, this is great, smol nit
pending @klkvr and @DaniPopes
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.
lgtm
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.
lgtm
Motivation
Fixes issue of private keys not being redacted in traces.
Previously there was a logical error causing inputs to not correctly be redacted.
Closes #6995
Solution
This change should cover all cheatcode cases where a
private key
is passed (directly or through theWallet
struct) or is returned.This includes missing cases:
createWallet(...)
getNonce(Wallet)
signP256(uint256,bytes32)
sign(Wallet,bytes32)
I've added a parameterized test to verify all cases (incl. exceptions) and in a way so it is easy to maintain.
To be able to quickly check the proposed fixes I've created a minimal repo: https://github.com/zerosnacks/foundry-pr-6995
PS: dummy data included in the test was generated using the dummy private key of
0x90F79bf6EB2c4f870365E785982E1f101E93b906
, one of the Anvil defaults.