-
Notifications
You must be signed in to change notification settings - Fork 240
Display gas report table #3842
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: share-contracts-data-store
Are you sure you want to change the base?
Display gas report table #3842
Conversation
|
This change is part of the following stack:
Change managed by git-spice. |
8a9f925 to
8f3b1f6
Compare
8517806 to
73d507a
Compare
| if !contract_info.functions.is_empty() { | ||
| let table = format_table_output(contract_info, name); | ||
| writeln!(f, "\n{table}")?; |
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.
In what case can there be contract without functions? In case it wasn't actually called in tests or some other ones as well?
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.
Actually this shouldn't really happen. It's just an extra cautious step to make sure we don't display an empty table
| use comfy_table::modifiers::UTF8_ROUND_CORNERS; | ||
| use comfy_table::{Cell, Color, Table}; |
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.
Glad someone already made a lib for that and we don't have to deal with printing tables
| Cell::new(report_data.gas_stats.min.to_string()).fg(Color::Green), | ||
| Cell::new(report_data.gas_stats.max.to_string()).fg(Color::Red), | ||
| Cell::new(report_data.gas_stats.mean.round().to_string()).fg(Color::Yellow), |
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 about this coloring. I'd rather eventually have some colors based on values or something. Maybe let's just have them all single color or even just white?
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.
Removed
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.
In case when no functions are invoked, we don't display the table. Maybe we should inform a user by displaying info/warning message?
1c1e984 to
b5ef498
Compare
73d507a to
7c7f179
Compare
b5ef498 to
6bd6031
Compare
7c7f179 to
7aef68f
Compare
We could add a note stating that a gas report hasn't been produced because there were no contract calls, but I'm not sure if that's necessary. Any thoughts @cptartur? |
Towards #3660