From 9441244bea11a8d9a5ef5b153141e3ec7f4d1ae8 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 31 Oct 2025 17:45:48 -0300 Subject: [PATCH 01/14] write each batch info to a daily log file --- alerts/sender_with_alert.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/alerts/sender_with_alert.sh b/alerts/sender_with_alert.sh index 9b0ecf0693..34a203e537 100755 --- a/alerts/sender_with_alert.sh +++ b/alerts/sender_with_alert.sh @@ -79,6 +79,25 @@ function send_slack_message() { . alerts/slack.sh "$1" } +LOG_DIR_PATH="./alerts/notification_logs/log_$date_only.txt" +# Creates a log entry in the daily log file +function create_log_entry() { + status="$1" + reason="${2:-}" + + timestamp=$(date +"%Y-%m-%d %H:%M:%S") + + # Keep the date to get the file name + date_only=$(date +"%Y_%m_%d") + + # Check if file exists, if not create it + if [ ! -f "$LOG_DIR_PATH" ]; then + touch "$LOG_DIR_PATH" + fi + + echo "[$timestamp] $status: - $reason" >> "$LOG_DIR_PATH" +} + ################# SEND LOGIC ################# ## Remove Proof Data @@ -91,8 +110,7 @@ mkdir -p ./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proof nonce=$(aligned get-user-nonce --network $NETWORK --user_addr $SENDER_ADDRESS 2>&1 | awk '{print $9}') echo $nonce if ! [[ "$nonce" =~ ^[0-9]+$ ]]; then - echo "Failed getting user nonce, retrying in 10 seconds" - sleep 10 + echo "Failed getting user nonce, exiting" exit 0 fi @@ -129,6 +147,7 @@ while IFS= read -r error; do if [[ -n "$error" ]]; then slack_error_message="Error submitting proof to $NETWORK: $error" send_slack_message "$slack_error_message" + create_log_entry "ERROR" "Error submitting proof to $NETWORK: $error" is_error=1 fi done <<< "$submit_errors" @@ -207,6 +226,7 @@ for proof in ./aligned_verification_data/*.cbor; do echo "$message" send_pagerduty_alert "$message" verified=0 # Some proofs failed, so we should not send the success message + create_log_entry "FAILURE" "Proof verification failed for $proof" break elif echo "$verification" | grep -q verified; then echo "Proof verification succeeded for $proof" @@ -223,6 +243,12 @@ fi echo "$slack_message" send_slack_message "$slack_message" +if [ $verified -eq 1 ]; then + create_log_entry "SUCCESS" "$total_number_proofs proofs submitted and verified ($REPETITIONS sent). Spent $spent_amount ETH ($ $spent_amount_usd) [ ${batch_explorer_urls[@]} ]" +else + create_log_entry "FAILURE" "$total_number_proofs proofs submitted but not verified ($REPETITIONS sent). Spent $spent_amount ETH ($ $spent_amount_usd) [ ${batch_explorer_urls[@]} ]" +fi + ## Remove Proof Data rm -rf ./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/* rm -rf ./aligned_verification_data_$x From 497d6fb4d517f35a099485f3dda14c0e2d67c14b Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 31 Oct 2025 18:48:08 -0300 Subject: [PATCH 02/14] Calculate the log dir path inside the create_log_entry --- alerts/sender_with_alert.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/alerts/sender_with_alert.sh b/alerts/sender_with_alert.sh index 34a203e537..58483a397d 100755 --- a/alerts/sender_with_alert.sh +++ b/alerts/sender_with_alert.sh @@ -79,7 +79,6 @@ function send_slack_message() { . alerts/slack.sh "$1" } -LOG_DIR_PATH="./alerts/notification_logs/log_$date_only.txt" # Creates a log entry in the daily log file function create_log_entry() { status="$1" @@ -87,15 +86,14 @@ function create_log_entry() { timestamp=$(date +"%Y-%m-%d %H:%M:%S") - # Keep the date to get the file name - date_only=$(date +"%Y_%m_%d") + log_file_path="./alerts/notification_logs/log_$(date +"%Y_%m_%d").txt" # Check if file exists, if not create it - if [ ! -f "$LOG_DIR_PATH" ]; then - touch "$LOG_DIR_PATH" + if [ ! -f "$log_file_path" ]; then + touch "$log_file_path" fi - echo "[$timestamp] $status: - $reason" >> "$LOG_DIR_PATH" + echo "[$timestamp] $status: - $reason" >> "$log_file_path" } ################# SEND LOGIC ################# From c878da7e2c6987a9b2818160c138cb88ffcbff59 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 31 Oct 2025 18:50:11 -0300 Subject: [PATCH 03/14] Keep the notification_logs folder --- alerts/notification_logs/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 alerts/notification_logs/.gitkeep diff --git a/alerts/notification_logs/.gitkeep b/alerts/notification_logs/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 From b293c9106ad224894278eab590010042aefedcb3 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 31 Oct 2025 18:58:22 -0300 Subject: [PATCH 04/14] Add an initial version for the summary sender script --- alerts/generate_send_summary.sh | 93 +++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100755 alerts/generate_send_summary.sh diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh new file mode 100755 index 0000000000..27f553839b --- /dev/null +++ b/alerts/generate_send_summary.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +# ENV VARIABLES: +# - REPETITIONS +# - EXPLORER_URL +# - SENDER_ADDRESS +# - RPC_URL +# - EXPLORER_URL +# - NETWORK +# - PRIVATE_KEY +# - VERIFICATION_WAIT_TIME +# - LOGS_BLOCK_RANGE +# - PAGER_DUTY_KEY +# - PAGER_DUTY_EMAIL +# - PAGER_DUTY_SERVICE_ID +# - SLACK_WEBHOOK_URL + +# Load env file from $1 path +source "$1" + +# Determine log file name based on current date +LOG_FILE="./alerts/notification_logs/log_$(date +"%Y_%m_%d").txt" + +batches=0 +submitted_total=0 +verified_total=0 +eth_total="0" +usd_total="0" + +# Read the log file entries and generate a summary +if [[ -f "$LOG_FILE" ]]; then + while IFS= read -r line; do + case "$line" in + *"SUCCESS:"*) + batches=$((batches + 1)) + + proofs_submitted=$(printf '%s\n' "$line" \ + | grep -oE '[0-9]+ proofs submitted' \ + | head -1 \ + | cut -d' ' -f1) + if [[ -n "$proofs_submitted" ]]; then + submitted_total=$((submitted_total + proofs_submitted)) + fi + + proofs_verified=$(printf '%s\n' "$line" \ + | grep -oE '\([0-9]+ sent\)' \ + | grep -oE '[0-9]+' \ + | head -1) + if [[ -n "$proofs_verified" ]]; then + verified_total=$((verified_total + proofs_verified)) + fi + + eth_spent=$(printf '%s\n' "$line" \ + | sed -n 's/.*Spent \([0-9.]*\) ETH.*/\1/p') + if [[ -n "$eth_spent" ]]; then + eth_total=$(echo "$eth_total + $eth_spent" | bc -l) + fi + + usd_spent=$(printf '%s\n' "$line" \ + | sed -n 's/.*(\$ *\([0-9.]*\)).*/\1/p') + if [[ -n "$usd_spent" ]]; then + usd_total=$(echo "$usd_total + $usd_spent" | bc -l) + fi + ;; + esac + done < "$LOG_FILE" + + summary=$( + printf "Proof Submission Summary - %s\n" "$(date +'%Y-%m-%d %H:%M:%S')" + echo "----------------------------------------" + printf "Processed batches : %d\n" "$batches" + printf "Proofs submitted : %d\n" "$submitted_total" + printf "Proofs verified : %d\n" "$verified_total" + printf "Total spent (ETH) : %.12f ETH\n" "$eth_total" + printf "Total spent (USD) : $ %.2f\n" "$usd_total" + echo "----------------------------------------" + ) + + echo "$summary" + + # Send the summary to Slack + if [[ -n "$SLACK_WEBHOOK_URL" ]]; then + safe_summary=$(printf '%s\n' "$summary" | sed 's/"/\\"/g') + curl -s -X POST -H 'Content-type: application/json' \ + --data "{\"text\":\"$safe_summary\"}" \ + "$SLACK_WEBHOOK_URL" >/dev/null 2>&1 + fi +else + echo "Proof Submission Summary - $(date +'%Y-%m-%d %H:%M:%S')" + echo "----------------------------------------" + echo "No log file found for today: $LOG_FILE" + echo "----------------------------------------" +fi From f87071daff6543ecb65f83a342594fe4c10ff068 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 31 Oct 2025 19:13:35 -0300 Subject: [PATCH 05/14] fix: read the verification files from the right files --- alerts/sender_with_alert.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alerts/sender_with_alert.sh b/alerts/sender_with_alert.sh index 58483a397d..3ee22dbd6a 100755 --- a/alerts/sender_with_alert.sh +++ b/alerts/sender_with_alert.sh @@ -210,7 +210,7 @@ verified=1 ## Verify Proofs echo "Verifying $REPETITIONS proofs $x != 0" -for proof in ./aligned_verification_data/*.cbor; do +for proof in ./aligned_verification_data_$x/*.cbor; do ## Validate Proof on Chain verification=$(aligned verify-proof-onchain \ --aligned-verification-data $proof \ From 7f2feddab0782c51d7d1190c971c59f4c7593bad Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 31 Oct 2025 19:33:01 -0300 Subject: [PATCH 06/14] Add the unverified proofs to the summary --- alerts/generate_send_summary.sh | 42 +++++++++++++++++++++++++++++---- alerts/sender_with_alert.sh | 1 - 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh index 27f553839b..698baa0901 100755 --- a/alerts/generate_send_summary.sh +++ b/alerts/generate_send_summary.sh @@ -24,6 +24,7 @@ LOG_FILE="./alerts/notification_logs/log_$(date +"%Y_%m_%d").txt" batches=0 submitted_total=0 verified_total=0 +unverified_total=0 eth_total="0" usd_total="0" @@ -62,17 +63,48 @@ if [[ -f "$LOG_FILE" ]]; then usd_total=$(echo "$usd_total + $usd_spent" | bc -l) fi ;; + *"FAILURE:"*) + batches=$((batches + 1)) + + proofs_submitted=$(printf '%s\n' "$line" \ + | grep -oE '[0-9]+ proofs submitted' \ + | head -1 \ + | cut -d' ' -f1) + if [[ -n "$proofs_submitted" ]]; then + submitted_total=$((submitted_total + proofs_submitted)) + fi + + proofs_unverified=$(printf '%s\n' "$line" \ + | grep -oE '\([0-9]+ sent\)' \ + | grep -oE '[0-9]+' \ + | head -1) + if [[ -n "$proofs_verified" ]]; then + unverified_total=$((verified_total + proofs_verified)) + fi + + eth_spent=$(printf '%s\n' "$line" \ + | sed -n 's/.*Spent \([0-9.]*\) ETH.*/\1/p') + if [[ -n "$eth_spent" ]]; then + eth_total=$(echo "$eth_total + $eth_spent" | bc -l) + fi + + usd_spent=$(printf '%s\n' "$line" \ + | sed -n 's/.*(\$ *\([0-9.]*\)).*/\1/p') + if [[ -n "$usd_spent" ]]; then + usd_total=$(echo "$usd_total + $usd_spent" | bc -l) + fi esac done < "$LOG_FILE" summary=$( printf "Proof Submission Summary - %s\n" "$(date +'%Y-%m-%d %H:%M:%S')" echo "----------------------------------------" - printf "Processed batches : %d\n" "$batches" - printf "Proofs submitted : %d\n" "$submitted_total" - printf "Proofs verified : %d\n" "$verified_total" - printf "Total spent (ETH) : %.12f ETH\n" "$eth_total" - printf "Total spent (USD) : $ %.2f\n" "$usd_total" + printf "Processed batches : %d\n" "$batches" + printf "Proofs submitted : %d\n" "$submitted_total" + printf "Proofs verified : %d\n" "$verified_total" + printf "Proofs not verified : %d\n" "$unverified_total" + printf "Total spent (ETH). : %.12f ETH\n" "$eth_total" + printf "Total spent (USD). : $ %.2f\n" "$usd_total" echo "----------------------------------------" ) diff --git a/alerts/sender_with_alert.sh b/alerts/sender_with_alert.sh index 3ee22dbd6a..14079e5d0a 100755 --- a/alerts/sender_with_alert.sh +++ b/alerts/sender_with_alert.sh @@ -224,7 +224,6 @@ for proof in ./aligned_verification_data_$x/*.cbor; do echo "$message" send_pagerduty_alert "$message" verified=0 # Some proofs failed, so we should not send the success message - create_log_entry "FAILURE" "Proof verification failed for $proof" break elif echo "$verification" | grep -q verified; then echo "Proof verification succeeded for $proof" From e8c7baa72a18a628f56b1a77c1ae649ca972a53e Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 3 Nov 2025 09:43:14 -0300 Subject: [PATCH 07/14] Send messages to Slack only when verification fails --- alerts/sender_with_alert.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/alerts/sender_with_alert.sh b/alerts/sender_with_alert.sh index 14079e5d0a..1c97748482 100755 --- a/alerts/sender_with_alert.sh +++ b/alerts/sender_with_alert.sh @@ -230,16 +230,13 @@ for proof in ./aligned_verification_data_$x/*.cbor; do fi done -if [ $verified -eq 1 ]; then - slack_message="$total_number_proofs proofs submitted and verified. We sent $REPETITIONS proofs. Spent amount: $spent_amount ETH ($ $spent_amount_usd) [ ${batch_explorer_urls[@]} ]" -else +if [ $verified -ne 1 ]; then + ## Send Update to Slack only in case verification failed slack_message="$total_number_proofs proofs submitted but not verified. We sent $REPETITIONS proofs. Spent amount: $spent_amount ETH ($ $spent_amount_usd) [ ${batch_explorer_urls[@]} ]" + echo "$slack_message" + send_slack_message "$slack_message" fi -## Send Update to Slack -echo "$slack_message" -send_slack_message "$slack_message" - if [ $verified -eq 1 ]; then create_log_entry "SUCCESS" "$total_number_proofs proofs submitted and verified ($REPETITIONS sent). Spent $spent_amount ETH ($ $spent_amount_usd) [ ${batch_explorer_urls[@]} ]" else From 4aec0a5556f3a86a45405dfc12aecf48d163c7c9 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 3 Nov 2025 11:44:01 -0300 Subject: [PATCH 08/14] Modify the summary style --- alerts/generate_send_summary.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh index 698baa0901..b5b36807c7 100755 --- a/alerts/generate_send_summary.sh +++ b/alerts/generate_send_summary.sh @@ -97,15 +97,16 @@ if [[ -f "$LOG_FILE" ]]; then done < "$LOG_FILE" summary=$( - printf "Proof Submission Summary - %s\n" "$(date +'%Y-%m-%d %H:%M:%S')" - echo "----------------------------------------" - printf "Processed batches : %d\n" "$batches" - printf "Proofs submitted : %d\n" "$submitted_total" - printf "Proofs verified : %d\n" "$verified_total" - printf "Proofs not verified : %d\n" "$unverified_total" - printf "Total spent (ETH). : %.12f ETH\n" "$eth_total" - printf "Total spent (USD). : $ %.2f\n" "$usd_total" - echo "----------------------------------------" + printf "Daily Proof Submission Summary\n" + printf "From %s 00:00 to %s 23:59\n" "$(date +'%d-%m-%Y')" "$(date +'%d-%m-%Y')" + echo "----------------------------------------------------" + printf "Processed batches: %d\n" "$batches" + printf "Proofs submitted: %d\n" "$submitted_total" + printf "Proofs verified : %d\n" "$verified_total" + printf "Proofs not verified: %d\n" "$unverified_total" + printf "Total spent (ETH): %.12f ETH\n" "$eth_total" + printf "Total spent (USD): $ %.2f\n" "$usd_total" + echo "----------------------------------------------------" ) echo "$summary" From 1076268eb4e9d81f5f22902ae5f634a24511cdb5 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 3 Nov 2025 11:44:34 -0300 Subject: [PATCH 09/14] Move to the correct folder before executing the script steps --- alerts/generate_send_summary.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh index b5b36807c7..9380d6145a 100755 --- a/alerts/generate_send_summary.sh +++ b/alerts/generate_send_summary.sh @@ -21,6 +21,10 @@ source "$1" # Determine log file name based on current date LOG_FILE="./alerts/notification_logs/log_$(date +"%Y_%m_%d").txt" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" +cd .. + batches=0 submitted_total=0 verified_total=0 From a07476718935954a2417b3fc6eda49c2731d82e2 Mon Sep 17 00:00:00 2001 From: JuArce <52429267+JuArce@users.noreply.github.com> Date: Tue, 4 Nov 2025 13:15:26 -0300 Subject: [PATCH 10/14] fix: use correct date for summary --- alerts/generate_send_summary.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh index 9380d6145a..105f5c2e46 100755 --- a/alerts/generate_send_summary.sh +++ b/alerts/generate_send_summary.sh @@ -18,8 +18,10 @@ # Load env file from $1 path source "$1" +DATE=$(date -d "yesterday" +"%Y_%m_%d") + # Determine log file name based on current date -LOG_FILE="./alerts/notification_logs/log_$(date +"%Y_%m_%d").txt" +LOG_FILE="./alerts/notification_logs/log_$DATE.txt" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" @@ -102,11 +104,11 @@ if [[ -f "$LOG_FILE" ]]; then summary=$( printf "Daily Proof Submission Summary\n" - printf "From %s 00:00 to %s 23:59\n" "$(date +'%d-%m-%Y')" "$(date +'%d-%m-%Y')" + printf "From %s 00:00 to %s 23:59\n" "$DATE" "$DATE" echo "----------------------------------------------------" printf "Processed batches: %d\n" "$batches" printf "Proofs submitted: %d\n" "$submitted_total" - printf "Proofs verified : %d\n" "$verified_total" + printf "Proofs verified: %d\n" "$verified_total" printf "Proofs not verified: %d\n" "$unverified_total" printf "Total spent (ETH): %.12f ETH\n" "$eth_total" printf "Total spent (USD): $ %.2f\n" "$usd_total" @@ -123,7 +125,7 @@ if [[ -f "$LOG_FILE" ]]; then "$SLACK_WEBHOOK_URL" >/dev/null 2>&1 fi else - echo "Proof Submission Summary - $(date +'%Y-%m-%d %H:%M:%S')" + echo "Proof Submission Summary - $DATE" echo "----------------------------------------" echo "No log file found for today: $LOG_FILE" echo "----------------------------------------" From 6cd9dbf6a0e1429e826ebce3c5b761ce49195fc4 Mon Sep 17 00:00:00 2001 From: JuArce <52429267+JuArce@users.noreply.github.com> Date: Wed, 5 Nov 2025 17:52:12 -0300 Subject: [PATCH 11/14] fix: send correct proof count fix: send spent by aligned and spent total --- alerts/generate_send_summary.sh | 36 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh index 105f5c2e46..cebd5f1461 100755 --- a/alerts/generate_send_summary.sh +++ b/alerts/generate_send_summary.sh @@ -29,8 +29,11 @@ cd .. batches=0 submitted_total=0 +submitted_by_aligned=0 verified_total=0 unverified_total=0 +eth_by_aligned="0" +usd_by_aligned="0" eth_total="0" usd_total="0" @@ -47,26 +50,29 @@ if [[ -f "$LOG_FILE" ]]; then | cut -d' ' -f1) if [[ -n "$proofs_submitted" ]]; then submitted_total=$((submitted_total + proofs_submitted)) + verified_total=$((verified_total + proofs_submitted)) fi - proofs_verified=$(printf '%s\n' "$line" \ + proofs_submitted_by_aligned=$(printf '%s\n' "$line" \ | grep -oE '\([0-9]+ sent\)' \ | grep -oE '[0-9]+' \ | head -1) - if [[ -n "$proofs_verified" ]]; then - verified_total=$((verified_total + proofs_verified)) + if [[ -n "$proofs_submitted_by_aligned" ]]; then + submitted_by_aligned=$((submitted_by_aligned + proofs_submitted_by_aligned)) fi eth_spent=$(printf '%s\n' "$line" \ | sed -n 's/.*Spent \([0-9.]*\) ETH.*/\1/p') if [[ -n "$eth_spent" ]]; then eth_total=$(echo "$eth_total + $eth_spent" | bc -l) + eth_by_aligned=$(echo "$eth_by_aligned + $eth_spent / $proofs_submitted * $proofs_submitted_by_aligned" | bc -l) fi usd_spent=$(printf '%s\n' "$line" \ | sed -n 's/.*(\$ *\([0-9.]*\)).*/\1/p') if [[ -n "$usd_spent" ]]; then usd_total=$(echo "$usd_total + $usd_spent" | bc -l) + usd_by_aligned=$(echo "$usd_by_aligned + $usd_spent / $proofs_submitted * $proofs_submitted_by_aligned" | bc -l) fi ;; *"FAILURE:"*) @@ -78,26 +84,29 @@ if [[ -f "$LOG_FILE" ]]; then | cut -d' ' -f1) if [[ -n "$proofs_submitted" ]]; then submitted_total=$((submitted_total + proofs_submitted)) + unverified_total=$((unverified_total + proofs_submitted)) fi - proofs_unverified=$(printf '%s\n' "$line" \ + proofs_submitted_by_aligned=$(printf '%s\n' "$line" \ | grep -oE '\([0-9]+ sent\)' \ | grep -oE '[0-9]+' \ | head -1) - if [[ -n "$proofs_verified" ]]; then - unverified_total=$((verified_total + proofs_verified)) + if [[ -n "$proofs_submitted_by_aligned" ]]; then + submitted_by_aligned=$((submitted_by_aligned + proofs_submitted_by_aligned)) fi eth_spent=$(printf '%s\n' "$line" \ | sed -n 's/.*Spent \([0-9.]*\) ETH.*/\1/p') if [[ -n "$eth_spent" ]]; then eth_total=$(echo "$eth_total + $eth_spent" | bc -l) + eth_by_aligned=$(echo "$eth_by_aligned + $eth_spent / $proofs_submitted * $proofs_submitted_by_aligned" | bc -l) fi usd_spent=$(printf '%s\n' "$line" \ | sed -n 's/.*(\$ *\([0-9.]*\)).*/\1/p') if [[ -n "$usd_spent" ]]; then usd_total=$(echo "$usd_total + $usd_spent" | bc -l) + usd_by_aligned=$(echo "$usd_by_aligned + $usd_spent / $proofs_submitted * $proofs_submitted_by_aligned" | bc -l) fi esac done < "$LOG_FILE" @@ -106,12 +115,15 @@ if [[ -f "$LOG_FILE" ]]; then printf "Daily Proof Submission Summary\n" printf "From %s 00:00 to %s 23:59\n" "$DATE" "$DATE" echo "----------------------------------------------------" - printf "Processed batches: %d\n" "$batches" - printf "Proofs submitted: %d\n" "$submitted_total" - printf "Proofs verified: %d\n" "$verified_total" - printf "Proofs not verified: %d\n" "$unverified_total" - printf "Total spent (ETH): %.12f ETH\n" "$eth_total" - printf "Total spent (USD): $ %.2f\n" "$usd_total" + printf "Processed batches: %d\n" "$batches" + printf "Total Proofs submitted: %d\n" "$submitted_total" + printf "Total Proofs verified: %d\n" "$verified_total" + printf "Total Proofs not verified: %d\n" "$unverified_total" + printf "Proofs submitted by Aligned: %d\n" "$submitted_by_aligned" + printf "Total spent by Aligned (ETH): %.12f ETH\n" "$eth_by_aligned" + printf "Total spent by Aligned (USD): $ %.2f\n" "$usd_by_aligned" + printf "Total spent (ETH): %.12f ETH\n" "$eth_total" + printf "Total spent (USD): $ %.2f\n" "$usd_total" echo "----------------------------------------------------" ) From 9f8fa64d7a302200e26fce876b27830830ab4c8c Mon Sep 17 00:00:00 2001 From: JuArce <52429267+JuArce@users.noreply.github.com> Date: Wed, 5 Nov 2025 18:01:01 -0300 Subject: [PATCH 12/14] feat: show proofs sent by 3rd parties --- alerts/generate_send_summary.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh index cebd5f1461..e91ac5a757 100755 --- a/alerts/generate_send_summary.sh +++ b/alerts/generate_send_summary.sh @@ -115,15 +115,16 @@ if [[ -f "$LOG_FILE" ]]; then printf "Daily Proof Submission Summary\n" printf "From %s 00:00 to %s 23:59\n" "$DATE" "$DATE" echo "----------------------------------------------------" - printf "Processed batches: %d\n" "$batches" - printf "Total Proofs submitted: %d\n" "$submitted_total" - printf "Total Proofs verified: %d\n" "$verified_total" - printf "Total Proofs not verified: %d\n" "$unverified_total" - printf "Proofs submitted by Aligned: %d\n" "$submitted_by_aligned" - printf "Total spent by Aligned (ETH): %.12f ETH\n" "$eth_by_aligned" - printf "Total spent by Aligned (USD): $ %.2f\n" "$usd_by_aligned" - printf "Total spent (ETH): %.12f ETH\n" "$eth_total" - printf "Total spent (USD): $ %.2f\n" "$usd_total" + printf "Processed batches: %d\n" "$batches" + printf "Total Proofs submitted: %d\n" "$submitted_total" + printf "Total Proofs verified: %d\n" "$verified_total" + printf "Total Proofs not verified: %d\n" "$unverified_total" + printf "Proofs submitted by Aligned: %d\n" "$submitted_by_aligned" + printf "Proofs submitted by 3rd parties: %d\n" "$((submitted_total - submitted_by_aligned))" + printf "Total spent by Aligned (ETH): %.12f ETH\n" "$eth_by_aligned" + printf "Total spent by Aligned (USD): $ %.2f\n" "$usd_by_aligned" + printf "Total spent (ETH): %.12f ETH\n" "$eth_total" + printf "Total spent (USD): $ %.2f\n" "$usd_total" echo "----------------------------------------------------" ) From c49d3fdbd74943022a9f26ee3e36f644993f9245 Mon Sep 17 00:00:00 2001 From: JuArce <52429267+JuArce@users.noreply.github.com> Date: Thu, 6 Nov 2025 10:50:28 -0300 Subject: [PATCH 13/14] feat: show spent by 3rd parties --- alerts/generate_send_summary.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh index e91ac5a757..48f7ea49b2 100755 --- a/alerts/generate_send_summary.sh +++ b/alerts/generate_send_summary.sh @@ -121,8 +121,10 @@ if [[ -f "$LOG_FILE" ]]; then printf "Total Proofs not verified: %d\n" "$unverified_total" printf "Proofs submitted by Aligned: %d\n" "$submitted_by_aligned" printf "Proofs submitted by 3rd parties: %d\n" "$((submitted_total - submitted_by_aligned))" - printf "Total spent by Aligned (ETH): %.12f ETH\n" "$eth_by_aligned" - printf "Total spent by Aligned (USD): $ %.2f\n" "$usd_by_aligned" + printf "Spent by Aligned (ETH): %.12f ETH\n" "$eth_by_aligned" + printf "Spent by Aligned (USD): $ %.2f\n" "$usd_by_aligned" + printf "Spent by 3rd parties (ETH): %.12f ETH\n" "$(echo "$eth_total - $eth_by_aligned" | bc -l)" + printf "Spent by 3rd parties (USD): $ %.2f\n" "$(echo "$usd_total - $usd_by_aligned" | bc -l)" printf "Total spent (ETH): %.12f ETH\n" "$eth_total" printf "Total spent (USD): $ %.2f\n" "$usd_total" echo "----------------------------------------------------" From 7135273505c26df52b323883f3d1bf6bed849004 Mon Sep 17 00:00:00 2001 From: JuArce <52429267+JuArce@users.noreply.github.com> Date: Thu, 6 Nov 2025 11:28:49 -0300 Subject: [PATCH 14/14] feat: send summary as code block --- alerts/generate_send_summary.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/alerts/generate_send_summary.sh b/alerts/generate_send_summary.sh index 48f7ea49b2..c90b0dfe41 100755 --- a/alerts/generate_send_summary.sh +++ b/alerts/generate_send_summary.sh @@ -115,18 +115,19 @@ if [[ -f "$LOG_FILE" ]]; then printf "Daily Proof Submission Summary\n" printf "From %s 00:00 to %s 23:59\n" "$DATE" "$DATE" echo "----------------------------------------------------" - printf "Processed batches: %d\n" "$batches" - printf "Total Proofs submitted: %d\n" "$submitted_total" - printf "Total Proofs verified: %d\n" "$verified_total" - printf "Total Proofs not verified: %d\n" "$unverified_total" - printf "Proofs submitted by Aligned: %d\n" "$submitted_by_aligned" - printf "Proofs submitted by 3rd parties: %d\n" "$((submitted_total - submitted_by_aligned))" - printf "Spent by Aligned (ETH): %.12f ETH\n" "$eth_by_aligned" - printf "Spent by Aligned (USD): $ %.2f\n" "$usd_by_aligned" - printf "Spent by 3rd parties (ETH): %.12f ETH\n" "$(echo "$eth_total - $eth_by_aligned" | bc -l)" - printf "Spent by 3rd parties (USD): $ %.2f\n" "$(echo "$usd_total - $usd_by_aligned" | bc -l)" - printf "Total spent (ETH): %.12f ETH\n" "$eth_total" - printf "Total spent (USD): $ %.2f\n" "$usd_total" + printf "Processed batches: %d\n" "$batches" + printf "Total Proofs submitted: %d\n" "$submitted_total" + printf "Total Proofs verified: %d\n" "$verified_total" + printf "Total Proofs not verified: %d\n" "$unverified_total" + printf "Submitted by Aligned: %d\n" "$submitted_by_aligned" + printf "Submitted by 3rd parties: %d\n" "$((submitted_total - submitted_by_aligned))" + echo "----------------------------------------------------" + printf "Spent by Aligned (ETH): %.12f ETH\n" "$eth_by_aligned" + printf "Spent by Aligned (USD): $ %.2f\n" "$usd_by_aligned" + printf "Spent by 3rd parties (ETH): %.12f ETH\n" "$(echo "$eth_total - $eth_by_aligned" | bc -l)" + printf "Spent by 3rd parties (USD): $ %.2f\n" "$(echo "$usd_total - $usd_by_aligned" | bc -l)" + printf "Total spent (ETH): %.12f ETH\n" "$eth_total" + printf "Total spent (USD): $ %.2f\n" "$usd_total" echo "----------------------------------------------------" ) @@ -136,7 +137,7 @@ if [[ -f "$LOG_FILE" ]]; then if [[ -n "$SLACK_WEBHOOK_URL" ]]; then safe_summary=$(printf '%s\n' "$summary" | sed 's/"/\\"/g') curl -s -X POST -H 'Content-type: application/json' \ - --data "{\"text\":\"$safe_summary\"}" \ + --data "{\"text\":\"\`\`\`$safe_summary\`\`\`\"}" \ "$SLACK_WEBHOOK_URL" >/dev/null 2>&1 fi else