Feat: add log hints to integers parsed in verbose output#4745
Feat: add log hints to integers parsed in verbose output#4745mattsse merged 9 commits intofoundry-rs:masterfrom
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 |
|
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_conversionwhich 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 etheror more than1 millionether.Notes
Preview
Here is a preview of what it looks like:
I've also tested it on
uniswap/permit2to see how it would look like on a larger codebase. Here's a test taken from that repo: