Skip to content

Commit 21a3806

Browse files
PatStilesMarcosNicolauuri-99JuArce
authored
feat(alerts): Add slack alerts for task submission sender (#1734)
Co-authored-by: nicolau <[email protected]> Co-authored-by: Urix <[email protected]> Co-authored-by: Julian Arce <[email protected]>
1 parent 6c08f81 commit 21a3806

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

alerts/sender_with_alert.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,15 @@ do
9393

9494
## Generate Proof
9595
nonce=$(aligned get-user-nonce --batcher_url $BATCHER_URL --user_addr $SENDER_ADDRESS 2>&1 | awk '{print $9}')
96+
echo $nonce
97+
if ! [[ "$nonce" =~ ^[0-9]+$ ]]; then
98+
echo "Failed getting user nonce, retrying in 10 seconds"
99+
sleep 10
100+
continue
101+
fi
102+
96103
x=$((nonce + 1)) # So we don't have any issues with nonce = 0
97-
echo "Generating proof $x != 0"
104+
echo "Generating proof $x != 0, nonce: $nonce"
98105
go run ./scripts/test_files/gnark_groth16_bn254_infinite_script/cmd/main.go $x
99106

100107
## Send Proof
@@ -114,6 +121,25 @@ do
114121
2>&1)
115122

116123
echo "$submit"
124+
125+
submit_errors=$(echo "$submit" | grep -oE 'ERROR[^]]*]([^[]*)' | sed 's/^[^]]*]//;s/[[:space:]]*$//')
126+
127+
# Loop through each error found and print with the custom message
128+
is_error=0
129+
while IFS= read -r error; do
130+
if [[ -n "$error" ]]; then
131+
slack_error_message="Error submitting proof to $NETWORK: $error"
132+
send_slack_message "$slack_error_message"
133+
is_error=1
134+
fi
135+
done <<< "$submit_errors"
136+
137+
if [ $is_error -eq 1 ]; then
138+
echo "Error submitting proofs to $NETWORK, retrying in 60 seconds"
139+
send_slack_message "Error submitting proofs to $NETWORK, retrying in 60 seconds"
140+
sleep 60
141+
continue
142+
fi
117143

118144
echo "Waiting $VERIFICATION_WAIT_TIME seconds for verification"
119145
sleep $VERIFICATION_WAIT_TIME

0 commit comments

Comments
 (0)