Browse Source

chore(fortuna): Add log message for updating the commitment (#2644)

* add log message

* fix typo
Jayant Krishnamurthy 6 months ago
parent
commit
f5923cd960
2 changed files with 6 additions and 2 deletions
  1. 5 2
      apps/fortuna/src/keeper/commitment.rs
  2. 1 0
      apps/fortuna/src/keeper/fee.rs

+ 5 - 2
apps/fortuna/src/keeper/commitment.rs

@@ -48,8 +48,11 @@ pub async fn update_commitments_if_necessary(
     }
     let threshold =
         ((provider_info.max_num_hashes as f64) * UPDATE_COMMITMENTS_THRESHOLD_FACTOR) as u64;
-    if provider_info.sequence_number - provider_info.current_commitment_sequence_number > threshold
-    {
+    let outstanding_requests =
+        provider_info.sequence_number - provider_info.current_commitment_sequence_number;
+    if outstanding_requests > threshold {
+        // NOTE: This log message triggers a grafana alert. If you want to change the text, please change the alert also.
+        tracing::warn!("Update commitments threshold reached -- possible outage or DDOS attack. Number of outstanding requests: {:?} Threshold: {:?}", outstanding_requests, threshold);
         let seq_number = provider_info.sequence_number - 1;
         let provider_revelation = chain_state
             .state

+ 1 - 0
apps/fortuna/src/keeper/fee.rs

@@ -64,6 +64,7 @@ pub async fn withdraw_fees_if_necessary(
         let contract_call = contract.withdraw_as_fee_manager(provider_address, fees);
         send_and_confirm(contract_call).await?;
     } else if keeper_balance < min_balance {
+        // NOTE: This log message triggers a grafana alert. If you want to change the text, please change the alert also.
         tracing::warn!("Keeper balance {:?} is too low (< {:?}) but provider fees are not sufficient to top-up.", keeper_balance, min_balance)
     }