Skip to content

Commit 8ad30ca

Browse files
chore(fortuna): improve fee withdrawal logs, dont error log on pkey unique constraint violation (#2852)
* chore(fortuna): improve fee withdrawal logs, dont error log on pkey unique violation * bump ver
1 parent 78982eb commit 8ad30ca

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/fortuna/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fortuna"
3-
version = "8.2.0"
3+
version = "8.2.1"
44
edition = "2021"
55

66
[lib]

apps/fortuna/src/history.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,18 @@ impl History {
357357
}
358358
};
359359
if let Err(e) = result {
360-
tracing::error!("Failed to update request status: {}", e);
360+
match e.as_database_error() {
361+
Some(db_error) if db_error.is_unique_violation() => {
362+
tracing::info!(
363+
"Failed to insert request, request already exists: Chain ID: {}, Sequence: {}",
364+
network_id,
365+
sequence
366+
);
367+
}
368+
_ => {
369+
tracing::error!("Failed to update request status: {}", e);
370+
}
371+
}
361372
}
362373
}
363374

apps/fortuna/src/keeper/fee.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ async fn calculate_fair_fee_withdrawal_amount<M: Middleware + 'static>(
4444
.await
4545
.map_err(|e| anyhow!("Error while getting current keeper balance. error: {:?}", e))?;
4646

47+
tracing::info!(
48+
"Contract has available fees: {:?}, current keeper ({:?}) has balance: {:?}",
49+
available_fees,
50+
keeper_address,
51+
current_balance
52+
);
53+
4754
// Calculate total funds across all keepers + available fees
4855
let mut total_funds = current_balance + available_fees;
4956

@@ -55,6 +62,7 @@ async fn calculate_fair_fee_withdrawal_amount<M: Middleware + 'static>(
5562
e
5663
)
5764
})?;
65+
tracing::info!("Keeper address {:?} has balance: {:?}", address, balance);
5866
total_funds += balance;
5967
}
6068

@@ -174,7 +182,7 @@ pub async fn withdraw_fees_if_necessary(
174182
if withdrawal_amount < min_withdrawal_amount {
175183
// We don't have enough to meaningfully top up the balance.
176184
// NOTE: This log message triggers a grafana alert. If you want to change the text, please change the alert also.
177-
tracing::warn!("Keeper balance {:?} is too low (< {:?}) but provider fees are not sufficient to top-up.", keeper_balance, min_balance);
185+
tracing::warn!("Keeper balance {:?} is too low (< {:?}) but provider fees are not sufficient to top-up. (withdrawal_amount={:?} < min_withdrawal_amount={:?})", keeper_balance, min_balance, withdrawal_amount, min_withdrawal_amount);
178186
return Ok(());
179187
}
180188

0 commit comments

Comments
 (0)