This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated check-size script to show percentage
- Loading branch information
Showing
2 changed files
with
4 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
#!/bin/bash | ||
s=$(brownie compile --size) | ||
s=$(brownie compile --size | sed 's/\x1b\[[0-9;]*m//g') # strip ansi color from brownie output | ||
echo "${s}" | ||
regex='============ Deployment Bytecode Sizes ============\s*(\w+)\s+-\s+([0-9,B]+)\s+\(' | ||
regex='============ Deployment Bytecode Sizes ============\s*(\w+)\s+-\s+([0-9,B]+)\s+\(([0-9.]+%)\)' | ||
[[ "$s" =~ $regex ]] | ||
largest_contract=${BASH_REMATCH[1]} | ||
largest_size=$(echo "${BASH_REMATCH[2]}" | sed -e 's/,//g' -e 's/B//g') | ||
largest_percent=${BASH_REMATCH[3]} | ||
|
||
limit=24576 | ||
echo "$largest_contract is $largest_size bytes ($largest_percent of $limit byte size limit)." | ||
if (( largest_size > limit)); then | ||
echo "$largest_contract is $largest_size bytes (over size limit of $limit bytes)." | ||
exit 1 | ||
else | ||
echo "$largest_contract is $largest_size bytes (under size limit of $limit bytes)." | ||
fi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters