-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(forge): add forge sig-collision cmd #4973
Conversation
I haven't looked closely at this PR yet, but generally supportive of it as this is useful. Some thoughts:
|
I didn't know of all the requests regarding selectors, should we open an issue to collect desired functionalities for subcommands of |
That sgtm, thanks! |
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.
You will also need to run cargo fmt --all
and cargo clippy -p foundry-cli --fix
with the nightly toolchain.
#[clap( | ||
help = "The first of the two contracts for which to look method signature collisions in the form `(<path>:)?<contractname>`.", | ||
value_name = "FIRST_CONTRACT" | ||
)] | ||
pub first_contract: ContractInfo, | ||
|
||
#[clap( | ||
help = "The second of the two contracts for which to look method signature collisions in the form `(<path>:)?<contractname>`.", | ||
value_name = "SECOND_CONTRACT" | ||
)] | ||
pub second_contract: ContractInfo, |
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.
Could you please adhere to the style of the other Clap Parser structs? This would mean the help
and about
are turned into doc comments, and value_name
is removed as it's redundant.
Great guys! I'll scrap this PR and make an issue (#5012) to track desired functionalities for |
Motivation
Easily check for colliding function selectors between two different contracts, especially useful when working with contracts that rely con delegating calls to others.
Solution
add
forge sig-collision
command to scan two contracts and look for matches between their functions' selectors.example
forge sig-collision ./proxy.sol:Proxy ./implementation.sol:Token
where
proxy.sol:Proxy
is:and
implementation.sol:Token
is:outputs >