-
Notifications
You must be signed in to change notification settings - Fork 189
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(sozo): add --stats
flag to output stats of the build artifacts
#1799
feat(sozo): add --stats
flag to output stats of the build artifacts
#1799
Conversation
2- Print stats method in build.rs 3- Compare_agains_limit in statistics.rs
16695bf
to
5e0e1b6
Compare
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.
Thanks for the contribution. I have some feedbacks.
I think we can be more conservative with how the stats are being displayed. Requesting for the stats should imo just output the raw stats independent of any limitations imposed by the networks.
And also having to read from a file just for two fields is a bit too excessive imo. And i don't see how --stats-limits
flag would be used much currently as no other Starknet-based networks exist that are imposing these limits.
This is in consideration that only a handful of users will deploy to the mainnet/testnet at the moment.
Agree on the more conservative display. About the % I guess this was the original goal of the issue, but we may drop the limitation display and only have a warning based on this limitation?
I suggested the file into the discord thinking that we may have more, and to avoid having one flag for each limit. But if from the previous point we go without limits being displayed, we could remove it. In general having the limits could be interesting to get an idea of the current size of the contracts in projection for a deployment on Starknet network (which was a track during the game-jam). |
Some thoughts: -The stats are always shown no matter if they pass or not the limits. (The 3 possible messages are just informative only for awareness to comply maintaining the starknet network stable and optimized). -If they pass the limitations this will not prevent the contracts from being built. -According to some conversations we had, the first iteration consisted only of showing the number of felts by contract and the actual size of the file, in future we might include # Cairo steps per contract, Gas consumption, model size, etc. Thus the creation of the .json constants file. I was just preparing the land for future adds :D In any case if the limits is not a go. I can delete the 3 messages and only show number of felts by contract and size file. Please let me know so I can make the modifications :D Thanks in advance! |
i definitely missed the conversation then.
I think defining the limits statically should suffice instead of having to import from a file. I would not be too concern with future proofing, we can change it as needed as it's pretty straightforward :)
though i believe the limits would be useful, i just don't think showing it by default is a nice approach. perhaps we can use a different flag for showing the stats against the limits, and keep the wdyt? |
Agree
I like a lot this approach. I will do the modifications to this PR to separate the limit/comparison logic from this issue so we only show the raw stats. Thanks for the responses :D |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1799 +/- ##
==========================================
+ Coverage 70.34% 70.51% +0.16%
==========================================
Files 308 309 +1
Lines 34826 35024 +198
==========================================
+ Hits 24500 24696 +196
- Misses 10326 10328 +2 ☔ View full report in Codecov by Sentry. |
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.
few thoughts:
Yup, i think this PR is good. lets keep it simple and focus only on displaying the stats. We can think about how to integrate the limits stuff in a different one. |
i think displaying the stats in a table would look nice and appear much more organized.
wdyt? cc @glihm @lambda-0x |
--stats
flag to output stats of the build artifacts
The length of contracts name may be very different based on the fully qualified path. But we have a plan to use namespaces instead. So basically, when namespaces will be implemented, we will only have the namespace name, and the contract name ( So I guess in the meantime, we can take the longer name and fit to it. And for the sizes, same thing, we should define a limit in number of digits that we know it will not be reached. EDIT: to illustrate my comment on the table header:
|
95d1b6a
to
5c263e4
Compare
i like this. then perhaps we can do something like this for the limits later:
|
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.
looks good so far.
i dont wanna be a PITA, but have some feedbacks on error handling and also some style nits to maintain some form of code aesthetics
bin/sozo/tests/test_data/sierra_compiled_contracts/contracts_test.contract_class.json
Outdated
Show resolved
Hide resolved
Hey not a PITA at all, I really like and value these comments and tips in order to make my future PR's cleaner. Thank you very much. |
1c18eb5
to
e1472d4
Compare
0030dad
to
b81daef
Compare
b81daef
to
2113549
Compare
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.
Great job @fabrobles92! Nice to see some tests also to cover the use-cases. 👍
Some comments below for the review:
- Let compiler infer types
c0f7466
to
7e0f742
Compare
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.
Great job @fabrobles92!
Looks good to me for a first iteration. @kariy do you have any additional inputs for the scope of this PR?
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.. nice work, thanks!
Usage: sozo build --stats
Included the option of --stats for when we do a sozo build; the command will output the number of felts in a contract_sierra.json and also the size of the file..
Closes DOJ-286
Closes #1081