Skip to content

Commit 25758dc

Browse files
authored
Merge pull request #1065 from opentensor/spiigot/log-drand-deserializion
Log Drand Deserializion
2 parents ed8a892 + 81345c1 commit 25758dc

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pallets/drand/src/lib.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,13 @@ impl<T: Config> Pallet<T> {
392392
let mut last_stored_round = LastStoredRound::<T>::get();
393393
let latest_pulse_body = Self::fetch_drand_latest().map_err(|_| "Failed to query drand")?;
394394
let latest_unbounded_pulse: DrandResponseBody = serde_json::from_str(&latest_pulse_body)
395-
.map_err(|_| "Drand: Failed to serialize response body to pulse")?;
395+
.map_err(|_| {
396+
log::warn!(
397+
"Drand: Response that failed to deserialize: {}",
398+
latest_pulse_body
399+
);
400+
"Drand: Failed to serialize response body to pulse"
401+
})?;
396402
let latest_pulse = latest_unbounded_pulse
397403
.try_into_pulse()
398404
.map_err(|_| "Drand: Received pulse contains invalid data")?;
@@ -417,7 +423,14 @@ impl<T: Config> Pallet<T> {
417423
let pulse_body = Self::fetch_drand_by_round(round)
418424
.map_err(|_| "Drand: Failed to query drand for round")?;
419425
let unbounded_pulse: DrandResponseBody = serde_json::from_str(&pulse_body)
420-
.map_err(|_| "Drand: Failed to serialize response body to pulse")?;
426+
.map_err(|_| {
427+
log::warn!(
428+
"Drand: Response that failed to deserialize for round {}: {}",
429+
round,
430+
pulse_body
431+
);
432+
"Drand: Failed to serialize response body to pulse"
433+
})?;
421434
let pulse = unbounded_pulse
422435
.try_into_pulse()
423436
.map_err(|_| "Drand: Received pulse contains invalid data")?;

0 commit comments

Comments
 (0)