diff --git a/.changelog/unreleased/bug-fixes/1999-fix-pgf-stewards-funding.md b/.changelog/unreleased/bug-fixes/1999-fix-pgf-stewards-funding.md new file mode 100644 index 0000000000..73ae0da0da --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1999-fix-pgf-stewards-funding.md @@ -0,0 +1,2 @@ +- Fixed the pgf stewards reward to be constant regardless of the number of + stewards. ([\#1999](https://github.com/anoma/namada/pull/1999)) \ No newline at end of file diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 53252065f1..cc14275c4d 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -828,13 +828,16 @@ where pgf_parameters.pgf_inflation_rate / Dec::from(epochs_per_year); let pgf_inflation = Dec::from(total_tokens) * pgf_pd_rate; + let stewards = pgf::get_stewards(&self.wl_storage)?; let pgf_stewards_pd_rate = pgf_parameters.stewards_inflation_rate / Dec::from(epochs_per_year); let pgf_steward_inflation = Dec::from(total_tokens) * pgf_stewards_pd_rate; + let total_pgf_stewards_inflation = + pgf_steward_inflation * Dec::from(stewards.len()); let pgf_inflation_amount = - token::Amount::from(pgf_inflation + pgf_steward_inflation); + token::Amount::from(pgf_inflation + total_pgf_stewards_inflation); credit_tokens( &mut self.wl_storage, @@ -877,18 +880,9 @@ where } // Pgf steward inflation - let stewards = pgf::get_stewards(&self.wl_storage)?; - - let pgf_steward_reward = match stewards.len() { - 0 => Dec::zero(), - _ => pgf_steward_inflation - .trunc_div(&Dec::from(stewards.len())) - .unwrap_or_default(), - }; - for steward in stewards { for (address, percentage) in steward.reward_distribution { - let pgf_steward_reward = pgf_steward_reward + let pgf_steward_reward = pgf_steward_inflation .checked_mul(&percentage) .unwrap_or_default(); let reward_amount = token::Amount::from(pgf_steward_reward);