Skip to content

Commit

Permalink
fix test-gas-per-function on V4
Browse files Browse the repository at this point in the history
  • Loading branch information
kroggen committed Oct 17, 2023
1 parent 07b830e commit bf1f5b1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ get_receipt() {
#echo "output: $output"

if [[ $output == *"tx not found"* ]]; then
sleep 0.5
sleep 0.4
counter=$((counter+1))
if [ $counter -gt 10 ]; then
echo "Error: tx not found: $txhash"
Expand Down
27 changes: 20 additions & 7 deletions tests/test-gas-per-function-v4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ fork_version=$1

echo "-- deploy --"

../bin/aergoluac --payload ../contract/vm_dummy/test_files/gas_per_function.lua > payload.out

txhash=$(../bin/aergocli --keystore . --password bmttest \
contract deploy AmPpcKvToDCUkhT1FJjdbNvR4kNDhLFJGHkSqfjWe3QmHm96qv4R \
--payload `cat payload.out` | jq .hash | sed 's/"//g')
deploy ../contract/vm_dummy/test_files/gas_per_function.lua

get_receipt $txhash

Expand All @@ -20,9 +16,26 @@ address=$(cat receipt.json | jq .contractAddress | sed 's/"//g')
assert_equals "$status" "CREATED"


echo "-- transfer funds to the contract --"

from=AmPpcKvToDCUkhT1FJjdbNvR4kNDhLFJGHkSqfjWe3QmHm96qv4R

txhash=$(../bin/aergocli --keystore . --password bmttest \
sendtx --from $from --to $address --amount 5aergo \
| jq .hash | sed 's/"//g')

get_receipt $txhash

status=$(cat receipt.json | jq .status | sed 's/"//g')
ret=$(cat receipt.json | jq .ret | sed 's/"//g')

assert_equals "$status" "SUCCESS"
assert_equals "$ret" "{}"


echo "-- get account's nonce --"

account_state=$(../bin/aergocli getstate --address AmPpcKvToDCUkhT1FJjdbNvR4kNDhLFJGHkSqfjWe3QmHm96qv4R)
account_state=$(../bin/aergocli getstate --address $from)
nonce=$(echo $account_state | jq .nonce | sed 's/"//g')


Expand Down Expand Up @@ -145,7 +158,7 @@ add_test "system.getCreator" 143761
add_test "system.getOrigin" 144261

add_test "contract.send" 144321
add_test "contract.balance" 144402
#add_test "contract.balance" 144402
add_test "contract.deploy" 168092
add_test "contract.call" 159738
add_test "contract.pcall" 160659
Expand Down

0 comments on commit bf1f5b1

Please sign in to comment.