-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📖 Include Version and Configuration Information in Gas Snapshots (#282)
### 🕓 Changelog This commit adds a Bash script, `generate_gas_snapshot.sh`, that includes version and configuration information into the gas snapshot files to improve traceability. Specifically, it prepends the `vyper` commit version, the `forge` commit version, and `vyper` configuration settings (e.g. optimisation mode) to the `snapshot` files. The script also supports generating snapshots for the `default-venom` profile using the `--venom` flag. Eventually, we pin the specific `vyper` commit [`d8f4032355773cd5e57e8902bd50808490de39b5`](vyperlang/vyper@d8f4032) as the subsequent commit [`fdc05d6029816ef57294e98753d9a3d60c761ab8`](vyperlang/vyper@fdc05d6) (PR [#4039](vyperlang/vyper#4039)) currently breaks our `venom`-based tests (refer to issue [#4288](vyperlang/vyper#4288) for details). --------- Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
- Loading branch information
1 parent
850d0df
commit 3b63a27
Showing
13 changed files
with
308 additions
and
180 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,2 +1,3 @@ | ||
plugins: | ||
- "prettier-plugin-solidity" | ||
- "prettier-plugin-sh" |
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
Submodule forge-std
updated
4 files
+181 −0 | CONTRIBUTING.md | |
+16 −0 | README.md | |
+53 −8 | src/Vm.sol | |
+2 −2 | test/Vm.t.sol |
Submodule openzeppelin-contracts
updated
3 files
+1 −1 | docs/modules/ROOT/pages/erc1155.adoc | |
+2 −2 | docs/modules/ROOT/pages/erc4626.adoc | |
+1 −1 | docs/modules/ROOT/pages/governance.adoc |
Submodule solady
updated
18 files
+11 −10 | .github/workflows/ci-all-via-ir.yml | |
+16 −14 | .github/workflows/ci.yml | |
+2 −1 | README.md | |
+1 −1 | foundry.toml | |
+1 −1 | package.json | |
+58 −0 | prep/gen-globalized-lib.js | |
+28 −7 | src/utils/LibClone.sol | |
+990 −0 | src/utils/g/DynamicArrayLib.sol | |
+1,317 −0 | src/utils/g/DynamicBufferLib.sol | |
+735 −0 | src/utils/g/EnumerableSetLib.sol | |
+819 −0 | src/utils/g/JSONParserLib.sol | |
+240 −0 | src/utils/g/LibBitmap.sol | |
+318 −0 | src/utils/g/LibMap.sol | |
+505 −0 | src/utils/g/LibPRNG.sol | |
+387 −0 | src/utils/g/LibRLP.sol | |
+572 −0 | src/utils/g/MinHeapLib.sol | |
+721 −0 | src/utils/g/RedBlackTreeLib.sol | |
+31 −3 | test/LibClone.t.sol |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
# Set the default values. | ||
OUTPUT_FILE=".gas-snapshot" | ||
FOUNDRY_PROFILE="default" | ||
TEMP_FILE=$(mktemp) | ||
|
||
# Utility function to print usage. | ||
print_usage() { | ||
echo "Usage: $0 [--venom]" | ||
echo " --venom Use Venom configuration" | ||
} | ||
|
||
# Utility function to prepend content to the output file. | ||
prepend_to_output() { | ||
echo "$1" >> "$TEMP_FILE" | ||
} | ||
|
||
# Parse the command line arguments. | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--venom) | ||
OUTPUT_FILE=".gas-snapshot-venom" | ||
FOUNDRY_PROFILE="default-venom" | ||
;; | ||
--help) | ||
print_usage | ||
exit 0 | ||
;; | ||
*) | ||
echo "Error: Unknown parameter passed: $1" | ||
print_usage | ||
exit 1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
# Set the environment variable. | ||
export FOUNDRY_PROFILE | ||
|
||
# Generate the snapshot file. | ||
forge snapshot --snap "$OUTPUT_FILE" | ||
|
||
# Prepare the content to be prepended. | ||
prepend_to_output "Vyper version: $(vyper --version)" | ||
prepend_to_output "Forge version: $(forge --version)" | ||
prepend_to_output "Vyper config:" | ||
forge config --json | jq -r ".vyper" >> "$TEMP_FILE" | ||
prepend_to_output "==========================================" | ||
prepend_to_output "██╗░░░██╗██╗░░░██╗██████╗░███████╗██████╗░" | ||
prepend_to_output "██║░░░██║╚██╗░██╔╝██╔══██╗██╔════╝██╔══██╗" | ||
prepend_to_output "╚██╗░██╔╝░╚████╔╝░██████╔╝█████╗░░██████╔╝" | ||
prepend_to_output "░╚████╔╝░░░╚██╔╝░░██╔═══╝░██╔══╝░░██╔══██╗" | ||
prepend_to_output "░░╚██╔╝░░░░░██║░░░██║░░░░░███████╗██║░░██║" | ||
prepend_to_output "░░░╚═╝░░░░░░╚═╝░░░╚═╝░░░░░╚══════╝╚═╝░░╚═╝" | ||
prepend_to_output "==========================================" | ||
|
||
# Prepend the prepared content to the snapshot file. | ||
cat "$TEMP_FILE" "$OUTPUT_FILE" > "${OUTPUT_FILE}.tmp" && mv "${OUTPUT_FILE}.tmp" "$OUTPUT_FILE" | ||
|
||
# Clean up the temporary file. | ||
rm "$TEMP_FILE" | ||
|
||
echo "Gas snapshot generated in $OUTPUT_FILE" |