-
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: add log hints to integers parsed in verbose output #4745
Feat: add log hints to integers parsed in verbose output #4745
Conversation
This seems nice, I like it, thanks! What do you think of using exponents instead, e.g. showing
|
Configuration for traces sounds like a really cool feature! Definitely looking forward to it. I like the idea of shorter exponents, I'll work on it asap. if we have a number like
|
Good question, off the cuff I'd say 4-5 significant figures is probably a sane default to keep it simple for now, since you can always look directly to the left to see the full number with full precision, using your example I think |
[x ether]
to Uints parsed in verbose output
Added exponential notation hints and updated PR title :) |
take by value Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
…docs to functions
I moved the helper function to the |
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.
smol nit, otherwise lgtm
Fixed some CI tests - should be good now |
whoops, sorry totally forgot about this! |
Motivation
Added log hints on Uint values printed by the logger converted in Ether.
Closes #4743
Solution
I added a simple helper:
format_uint_with_ether_conversion
which appends a dimmed[x ether]
text at the end of the parsed Uint.I added some heuristics to try and make the hints more useful for debugging: the conversion is skipped if the amount is
0
, if it's less than0.0001 ether
or more than1 million
ether.Notes
Preview
Here is a preview of what it looks like:
I've also tested it on
uniswap/permit2
to see how it would look like on a larger codebase. Here's a test taken from that repo: