@@ -68,11 +68,15 @@ cosmos_tx() {
6868 --home /root/.mocad \
6969 --keyring-backend test --chain-id " ${CHAIN_ID} " \
7070 --node tcp://localhost:26657 \
71- --gas auto --gas-adjustment 1.3 -- fees 2000000000000000amoca \
71+ --gas 1000000 --fees 30000000000000000amoca \
7272 --broadcast-mode sync -y --output json) || {
7373 log_error " cosmos_tx broadcast failed: $out "
7474 return 1
7575 }
76+ if [ " $( echo " $out " | jq -r ' .code // 0' ) " != " 0" ]; then
77+ log_error " cosmos_tx CheckTx rejected: $out "
78+ return 1
79+ fi
7680 hash=$( echo " $out " | jq -r ' .txhash // empty' 2> /dev/null)
7781 if [ -z " $hash " ]; then
7882 log_error " cosmos_tx returned no txhash: $out "
@@ -89,11 +93,15 @@ cosmos_tx_on() {
8993 --home /root/.mocad \
9094 --keyring-backend test --chain-id " ${CHAIN_ID} " \
9195 --node tcp://localhost:26657 \
92- --gas auto --gas-adjustment 1.3 -- fees 2000000000000000amoca \
96+ --gas 1000000 --fees 30000000000000000amoca \
9397 --broadcast-mode sync -y --output json) || {
9498 log_error " cosmos_tx_on broadcast failed: $out "
9599 return 1
96100 }
101+ if [ " $( echo " $out " | jq -r ' .code // 0' ) " != " 0" ]; then
102+ log_error " cosmos_tx_on CheckTx rejected: $out "
103+ return 1
104+ fi
97105 hash=$( echo " $out " | jq -r ' .txhash // empty' 2> /dev/null)
98106 if [ -z " $hash " ]; then
99107 log_error " cosmos_tx_on returned no txhash: $out "
@@ -109,25 +117,25 @@ evm_transfer() {
109117 local out hash
110118 out=$( cast send " $1 " --value " $2 " \
111119 --private-key " $VAL0_PRIVKEY " --rpc-url " $EVM_RPC " \
112- --chain-id " $EVM_CHAIN_ID " --json 2>&1 ) || {
120+ --chain-id " $EVM_CHAIN_ID " --gas-price 30000000000 -- json 2>&1 ) || {
113121 log_error " evm_transfer broadcast failed: $out "
114122 return 1
115123 }
116124 hash=$( echo " $out " | jq -r ' .transactionHash // empty' 2> /dev/null)
117125 [ -z " $hash " ] && { log_error " evm_transfer returned no hash: $out " ; return 1; }
118- fw_wait_evm_tx " $hash " 10 " $EVM_RPC "
126+ fw_wait_evm_tx " $hash " 30 " $EVM_RPC " || { log_error " evm_transfer wait timeout: $hash ( $out ) " ; return 1 ; }
119127}
120128
121129evm_send () {
122130 local out hash
123131 out=$( cast send " $@ " --private-key " $VAL0_PRIVKEY " --rpc-url " $EVM_RPC " \
124- --chain-id " $EVM_CHAIN_ID " --json 2>&1 ) || {
132+ --chain-id " $EVM_CHAIN_ID " --gas-price 30000000000 -- json 2>&1 ) || {
125133 log_error " evm_send broadcast failed: $out "
126134 return 1
127135 }
128136 hash=$( echo " $out " | jq -r ' .transactionHash // empty' 2> /dev/null)
129137 [ -z " $hash " ] && { log_error " evm_send returned no hash: $out " ; return 1; }
130- fw_wait_evm_tx " $hash " 10 " $EVM_RPC "
138+ fw_wait_evm_tx " $hash " 30 " $EVM_RPC " || { log_error " evm_send wait timeout: $hash ( $out ) " ; return 1 ; }
131139}
132140
133141evm_call () {
@@ -138,15 +146,15 @@ evm_deploy() {
138146 local bytecode=" $1 "
139147 local output hash
140148 output=$( cast send --private-key " $VAL0_PRIVKEY " --rpc-url " $EVM_RPC " \
141- --chain-id " $EVM_CHAIN_ID " --json --create " $bytecode " 2>&1 ) || {
149+ --chain-id " $EVM_CHAIN_ID " --gas-price 30000000000 -- json --create " $bytecode " 2>&1 ) || {
142150 log_error " evm_deploy broadcast failed: $output "
143151 return 1
144152 }
145153 hash=$( echo " $output " | jq -r ' .transactionHash // empty' 2> /dev/null)
146154 [ -z " $hash " ] && { log_error " evm_deploy returned no hash: $output " ; return 1; }
147- fw_wait_evm_tx " $hash " 10 " $EVM_RPC " || return 1
148- cast receipt " $hash " --rpc-url " $EVM_RPC " --json 2> /dev/null \
149- | jq -r ' .contractAddress // empty' 2> /dev/null
155+ fw_wait_evm_tx " $hash " 30 " $EVM_RPC " || { log_error " evm_deploy wait timeout: $hash ( $output ) " ; return 1; }
156+ local rcpt ; rcpt= $( cast receipt " $hash " --rpc-url " $EVM_RPC " --json 2>&1 ) || { log_error " evm_deploy receipt failed: $rcpt " ; return 1 ; }
157+ echo " $rcpt " | jq -r ' .contractAddress // empty' 2> /dev/null
150158}
151159
152160# Shuffle an array (Fisher-Yates). Usage: shuffle_array array_name
0 commit comments