Skip to content

Commit 1fc5fd4

Browse files
committed
Add test
1 parent 3317621 commit 1fc5fd4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/tests/pep.sh

+19
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,25 @@ if [ "$RESULT" != "$AGG_KEY_HEIGHT" ]; then
307307
exit 1
308308
fi
309309

310+
FIRST_ENCRYPTED_TX_HEIGHT=$($BINARY query pep list-encrypted-tx --node $CHAIN2_NODE -o json | jq '.encryptedTxArray[0].encryptedTx[0].processedAtChainHeight')
311+
SECOND_ENCRYPTED_TX_HEIGHT=$($BINARY query pep list-encrypted-tx --node $CHAIN2_NODE -o json | jq '.encryptedTxArray[0].encryptedTx[1].processedAtChainHeight')
312+
313+
echo "First Encrypted tx processed at height: $FIRST_ENCRYPTED_TX_HEIGHT, 2nd one processed at: $SECOND_ENCRYPTED_TX_HEIGHT"
314+
315+
FIRST_EVENT=$(curl -s http://localhost:26657/block_results?height=$FIRST_ENCRYPTED_TX_HEIGHT | jq '.result.begin_block_events[] | select(.type == "reverted-encrypted-tx") | .attributes[] | select(.key == "reason") | .value')
316+
if [[ "$FIRST_EVENT" != *"insufficient fees"* ]]; then
317+
echo "ERROR: Pep module expected first encrypted tx failed with reason insufficient fee, got: $FIRST_EVENT instead"
318+
exit 1
319+
fi
320+
echo "First Encrypted TX Failed with Reason: $FIRST_EVENT as expected."
321+
322+
SECOND_EVENT=$(curl -s http://localhost:26657/block_results?height=$SECOND_ENCRYPTED_TX_HEIGHT | jq '.result.begin_block_events[] | select(.type == "executed-encrypted-tx") | .attributes[] | select(.key == "events") | .value')
323+
if [[ "$SECOND_EVENT" != *"coin_received"* ]]; then
324+
echo "ERROR: Pep module expected second encrypted tx succeeded with events, got: $SECOND_EVENT instead"
325+
exit 1
326+
fi
327+
echo "Second Encrypted TX succeeded with Events: $(echo $SECOND_EVENT | jq) as expected."
328+
310329
echo ""
311330
echo "###########################################################"
312331
echo "# SUCCESSFULLY TESTED #"

0 commit comments

Comments
 (0)