-
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: allow supplying function name via forge script --sig
#7518
Conversation
Hmm any more context here to jog my memory? From an initial read of the PR description this sounds like a nice UX improvement that should be safe. I guess one potential footgun—which seems to be mitigated based on your description—is if you have: function run(uint x) public {
run(x, defaultY);
}
function run(uint x, uint y) public {
// --- snip ---
} and execute But otherwise this lgtm and I might need to think more to remember another footgun we discussed |
I believe it was this one: #5282
yeah, that's why we reject duplicates instead of potentialy trying to match by arguments count
I think this PR will encourage users to not have such overloads in scripts, as with this this change you can avoid typing function parameters at all by just having unique names, so no need to have logic for overloads handling imo |
Thanks! Ok, I'm onboard with the behavior suggested in this PR and not supporting overloads |
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.
that's a pretty neat UX improvement.
could we test the failure case for overloaded functions in a test?
Motivation
Having script function with many arguments can be annoying as you have to write stuff like
forge script --sig run(address,uint256,(address,uint256)...
With this PR if only function name is provided as
--sig
argument and there is exactly one function with such name in the script ABI, then it will be used. Example above becomes justforge script --sig 'run' 'ARG 1' 'ARG 2'
cc @mds1 I remember we had discussion related to script UX and you mentioned that such UX improvements might result in footguns, so curious to know what you think about this