Skip to content

Commit

Permalink
Improve debug logs for failures in rewards calculations
Browse files Browse the repository at this point in the history
This makes it so when an error occurs from reading from storage it
shows up on the logs rather than just returning None
  • Loading branch information
mariari committed Feb 8, 2023
1 parent c9d4c38 commit 970341f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions core/src/ledger/storage/masp_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,30 @@ where
.expect("");

//// Values from the last epoch
let last_inflation: u64 =
wl_storage.read(&token::last_inflation(addr))?.expect("");
let last_inflation: u64 = wl_storage
.read(&token::last_inflation(addr))
.expect("failure to read last inflation")
.expect("");

let last_locked_ratio: Decimal =
wl_storage.read(&token::last_locked_ratio(addr))?.expect("");
let last_locked_ratio: Decimal = wl_storage
.read(&token::last_locked_ratio(addr))
.expect("failure to read last inflation")
.expect("");

//// Parameters for each token
let max_reward_rate: Decimal = wl_storage
.read(&token::parameters::max_reward_rate(addr))?
.read(&token::parameters::max_reward_rate(addr))
.expect("max reward should properly decode")
.expect("");

let kp_gain_nom: Decimal = wl_storage
.read(&token::parameters::kp_sp_gain(addr))?
.read(&token::parameters::kp_sp_gain(addr))
.expect("kp_gain_nom reward should properly decode")
.expect("");

let kd_gain_nom: Decimal = wl_storage
.read(&token::parameters::kd_sp_gain(addr))?
.read(&token::parameters::kd_sp_gain(addr))
.expect("kd_gain_nom reward should properly decode")
.expect("");

let locked_target_ratio: Decimal = wl_storage
Expand Down

0 comments on commit 970341f

Please sign in to comment.