-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix/cast abi strict args #11189
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?
Fix/cast abi strict args #11189
Conversation
@@ -1809,10 +1809,7 @@ impl SimpleCast { | |||
let func = get_func(sig)?; | |||
match encode_function_args(&func, args) { | |||
Ok(res) => Ok(hex::encode_prefixed(&res[4..])), | |||
Err(e) => eyre::bail!( |
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.
Let's also handle the abi_encode_packed
branch in CastSubcommand::AbiEncode
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.
invoked by cast abi-encode "<signature>" <value> --packed
"Could not ABI encode the function and arguments. Did you pass in the right types?\nError\n{}", | ||
e | ||
), | ||
Err(e) => eyre::bail!("{}", e), |
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.
Err(e) => eyre::bail!("{}", e), | |
Err(e) => eyre::bail!( | |
"Could not ABI encode the function and arguments: {}", | |
e | |
), |
Hi @simon0820s thanks for your PR! Glad to see #5053 being fixed, the current behavior of silently accepting additional arguments can be a footgun Some small notes |
Motivation
Fixes #5053
Solution
Add validation that arguments exactly match parameters before encode arguments and add tests for this validation.
PR Checklist