@@ -1651,6 +1651,58 @@ function test_send_from() {
1651
1651
assert_eq " $( get_allowance " $contract_addr " ' a' ' b' ) " 0
1652
1652
}
1653
1653
1654
+ function measure_transfer_gas() {
1655
+ set -e
1656
+ local contract_addr=" $1 "
1657
+
1658
+ log_test_header
1659
+
1660
+ local tx_hash
1661
+
1662
+ # Deposit to "a"
1663
+ quiet deposit " $contract_addr " ' a' 10
1664
+
1665
+ local b_balance=$( get_balance " $contract_addr " ' b' )
1666
+
1667
+ local transfer_message=' {"transfer":{"recipient":"' " ${ADDRESS[b]} " ' ","amount":"5"}}'
1668
+ local transfer_response
1669
+ tx_hash=" $( compute_execute " $contract_addr " " $transfer_message " ${FROM[a]} --gas 1500000) "
1670
+ # Notice the `!` before the command - it is EXPECTED to fail.
1671
+ ! transfer_response=" $( wait_for_compute_tx " $tx_hash " ' waiting for transfer from "a" to "b" to process' ) "
1672
+ ! transfer_response_not_compute=" $( wait_for_tx " $tx_hash " ' waiting for transfer from "a" to "b" to process' ) "
1673
+
1674
+ assert_ne " $( get_balance " $contract_addr " ' b' ) " $b_balance
1675
+
1676
+ echo $transfer_response_not_compute
1677
+ # echo "$(extract_gas "$transfer_response")"
1678
+ }
1679
+
1680
+ function measure_transfer_with_decoys_gas() {
1681
+ set -e
1682
+ local contract_addr=" $1 "
1683
+
1684
+ log_test_header
1685
+
1686
+ local tx_hash
1687
+
1688
+ # Deposit to "a"
1689
+ quiet deposit " $contract_addr " ' a' 10
1690
+
1691
+ local b_balance=$( get_balance " $contract_addr " ' b' )
1692
+
1693
+ local transfer_message=' {"transfer":{"recipient":"' " ${ADDRESS[b]} " ' ","amount":"5", "entropy":"TXlQYXN3b3JkMTIz", "decoys":["secret1kmgdagt5efcz2kku0ak9ezfgntg29g2vr88q0e","secret18vd8fpwxzck93qlwghaj6arh4p7c5n8978vsyg","secret1qqq8g6cjht0qfemed6nmrgjp8gajhnw3panxcf","secret1qqg9z5473z4f842c9nddc2942mj82lw8h7n5uf","secret1qqjmkf275wwaeevkkmqdk5xw2j7k5u5c8j7e9y"]}}'
1694
+ local transfer_response
1695
+ tx_hash=" $( compute_execute " $contract_addr " " $transfer_message " ${FROM[a]} --gas 1500000) "
1696
+ # Notice the `!` before the command - it is EXPECTED to fail.
1697
+ ! transfer_response=" $( wait_for_compute_tx " $tx_hash " ' waiting for transfer from "a" to "b" to process' ) "
1698
+ ! transfer_response_not_compute=" $( wait_for_tx " $tx_hash " ' waiting for transfer from "a" to "b" to process' ) "
1699
+
1700
+ echo $transfer_response_not_compute
1701
+ assert_ne " $( get_balance " $contract_addr " ' b' ) " $b_balance
1702
+
1703
+ # echo "$(extract_gas "$transfer_response")"
1704
+ }
1705
+
1654
1706
function main() {
1655
1707
log ' <####> Starting integration tests <####>'
1656
1708
log " secretcli version in the docker image is: $( secretcli version) "
@@ -1690,6 +1742,9 @@ function main() {
1690
1742
test_send_from " $contract_addr " register
1691
1743
test_send_from " $contract_addr " skip-register
1692
1744
1745
+ measure_transfer_gas " $contract_addr "
1746
+ measure_transfer_with_decoys_gas " $contract_addr "
1747
+
1693
1748
log ' Tests completed successfully'
1694
1749
1695
1750
# If everything else worked, return successful status
0 commit comments