-
Notifications
You must be signed in to change notification settings - Fork 2k
refactor: safer ffi function and return non hex as string #2520
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
What do you think about catching stderr and also printing that if the verbosity is high enough? There were times when I wanted to debug a script I was calling from FFI and it would be nice to be able to log from the script by writing to stderr |
good point, should print this if verbosity is high enough will add |
9465806
to
64f64cf
Compare
.map_err(util::encode_error)?; | ||
.map_err(|err| util::encode_error(format!("Failed to execute command: {}", err)))?; | ||
|
||
if state.config.verbosity >= 3 { |
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.
Not sure how I feel about this since it's w/o context - tests are run in parallel, so this is potentially going to be printed next to something entirely unrelated
Talked about maybe adding a CheatcodeFailed(string msg, string[] context)
error type or something we could revert with instead to solve this, but that's obviously a bigger piece of work. Unsure if you want to wait with this stderr thing until then? Also removes the need to pass verbosity
to the cheatcode inspector.
I also wrote about something similar a long time ago here: #928
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.
Agree with bjerg, would recommend we skip that change here and think about it a bit more in #928
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 modulo the bjerg comment
.map_err(util::encode_error)?; | ||
.map_err(|err| util::encode_error(format!("Failed to execute command: {}", err)))?; | ||
|
||
if state.config.verbosity >= 3 { |
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.
Agree with bjerg, would recommend we skip that change here and think about it a bit more in #928
64f64cf
to
f44b6c7
Compare
reverted, perhaps we need some kind of |
* refactor: use slashed paths * refactor: safer ffi function and return non hex as string (#2520) * bump ethers * rm leftover
Coming back to this, because this has hit me multiple times with a very undesirable outcome. So: Is there any compelling argument to continue a script execution if |
Exploring |
* refactor: use slashed paths * refactor: safer ffi function and return non hex as string (foundry-rs#2520) * bump ethers * rm leftover
Motivation
Solution
decode if output is hex otherwise return output as is