Skip to content

Commit

Permalink
fix: simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Sep 18, 2024
1 parent cb051ea commit 8b8a864
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion test/basic-e2e.bats
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ setup() {
# case 2: Transaction rejected as sender attempts to transfer more than it has in its wallet.
# Transaction will fail pre-validation check on the node and will be dropped subsequently from the pool
# without recording it on the chain and hence nonce will not change
local sender_balance=$(cast balance "$sender_addr" --ether --rpc-url "$rpc_url") || return 1
local sender_balance=$(cast balance "$sender_addr" --ether --rpc-url "$rpc_url") || return 1
local excessive_value=$(echo "$sender_balance + 1" | bc)"ether"
run sendTx "$private_key" "$receiver" "$excessive_value"
assert_failure
Expand Down
14 changes: 5 additions & 9 deletions test/helpers/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ function sendTx() {
return 1
fi

if [[ "$value_or_function_sig" =~ ^[0-9]+(ether)?$ ]]; then
checkBalances "$sender_addr" "$receiver" "$value_or_function_sig" "$tx_hash" "$sender_initial_balance" "$receiver_initial_balance"
if [[ $? -ne 0 ]]; then
echo "Error: Balance not updated correctly."
return 1
fi
checkBalances "$sender_addr" "$receiver" "$value_or_function_sig" "$tx_hash" "$sender_initial_balance" "$receiver_initial_balance"
if [[ $? -ne 0 ]]; then
echo "Error: Balance not updated correctly."
return 1
fi
else
# Case: Smart contract transaction (contract interaction with function signature and parameters)
Expand Down Expand Up @@ -162,10 +160,8 @@ function sendTx() {

# Extract the transaction hash from the output
local tx_hash=$(echo "$cast_output" | grep 'transactionHash' | awk '{print $2}' | tail -n 1)
echo "Tx hash: $tx_hash"

if [[ -z "$tx_hash" ]]; then
echo "Error: Failed to extract transaction hash."
echo "Error: Failed to extract transaction hash (transaction hash '$tx_hash')."
return 1
fi
fi
Expand Down

0 comments on commit 8b8a864

Please sign in to comment.