-
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.
chore: update execute benchmark test
- the final `execute` benchmarks with a script that access modules and storage
- Loading branch information
Showing
6 changed files
with
142 additions
and
114 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
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
34 changes: 6 additions & 28 deletions
34
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 |
---|---|---|
@@ -1,41 +1,19 @@ | ||
#!/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 | ||
} | ||
ALICE=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY | ||
BOB=5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty | ||
|
||
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 | ||
cp build/gas-costs/bytecode_scripts/mint.mv build/gas-costs/bytecode_scripts/mint_$1.mv | ||
printf "\nsmove create-transaction -c build/gas-costs/bytecode_scripts/mint_$1.mv --args signer:$BOB address:$ALICE u64:$1" >> $BASH_SH | ||
} | ||
|
||
printf "" > $MOVE_SRC | ||
printf "#!/bin/sh" > $BASH_SH | ||
for i in $(seq 0 $(($ITERATIONS-1))) | ||
for i in $(seq 1 $(($ITERATIONS))) | ||
do | ||
write_method $i | ||
write_smove_cmd $i | ||
done | ||
printf "\nsmove create-transaction -c build/gas-costs/bytecode_scripts/publish_basic_balance.mv --args signer:$ALICE" >> $BASH_SH |
21 changes: 21 additions & 0 deletions
21
pallet/src/assets/move-projects/gas-costs/sources/GetCoin.move
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,21 @@ | ||
script { | ||
use CafeAccount::BasicCoin; | ||
|
||
fun publish_basic_balance(s: signer) { | ||
BasicCoin::publish_balance(&s); | ||
} | ||
} | ||
|
||
script { | ||
use CafeAccount::BasicCoin; | ||
|
||
fun mint(module_owner: signer, rx_addr: address, amount: u64) { | ||
//BasicCoin::mint(&module_owner, rx_addr, amount); | ||
|
||
let i = 1; | ||
while (i <= amount) { | ||
BasicCoin::mint(&module_owner, rx_addr, 1); | ||
i = i + 1 | ||
}; | ||
} | ||
} |
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