-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new approach for benchmarking execute scripts
- Loading branch information
1 parent
6a12b2c
commit ac61010
Showing
8 changed files
with
149 additions
and
182 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 |
---|---|---|
|
@@ -12,3 +12,6 @@ gas_costs.txt | |
|
||
# Move Build Output | ||
build/ | ||
|
||
Calibration.move | ||
gen_smove_instr.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
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
41 changes: 41 additions & 0 deletions
41
pallet/src/assets/move-projects/gas-costs/gen_cal_scripts.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
cd $(dirname $0) | ||
|
||
MOVE_SRC="./sources/Calibration.move" | ||
BASH_SH="./gen_smove_instr.sh" | ||
ITERATIONS=25 | ||
|
||
function write_method() { | ||
printf "script {\n" >> $MOVE_SRC | ||
printf " fun cal_gas_cost_$1(v0: u8" >> $MOVE_SRC | ||
if [ $1 -gt 0 ] | ||
then | ||
for i in $(seq 1 $1) | ||
do | ||
printf ", v$i: u8" >> $MOVE_SRC | ||
done | ||
fi | ||
printf ") {\n" >> $MOVE_SRC | ||
for i in $(seq 0 $1) | ||
do | ||
printf " assert!(v$i == $i, $i);\n" >> $MOVE_SRC | ||
done | ||
printf " }\n" >> $MOVE_SRC | ||
printf "}\n" >> $MOVE_SRC | ||
} | ||
|
||
function write_smove_cmd() { | ||
printf "\nsmove create-transaction -c build/gas-costs/bytecode_scripts/cal_gas_cost_$1.mv --args" >> $BASH_SH | ||
for i in $(seq 0 $1) | ||
do | ||
printf " u8:$i" >> $BASH_SH | ||
done | ||
} | ||
|
||
printf "" > $MOVE_SRC | ||
printf "#!/bin/sh" > $BASH_SH | ||
for i in $(seq 0 $(($ITERATIONS-1))) | ||
do | ||
write_method $i | ||
write_smove_cmd $i | ||
done |
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
Oops, something went wrong.