From d4da00bc8ba3b8cf6341f005d71da887542888c3 Mon Sep 17 00:00:00 2001 From: Marco Granelli Date: Wed, 18 Oct 2023 19:52:24 +0200 Subject: [PATCH 1/2] Fixes pgf inflation --- apps/src/lib/node/ledger/shell/finalize_block.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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); From 05fbe1f798021978127df05c1d8ef8f744e7dacf Mon Sep 17 00:00:00 2001 From: Marco Granelli Date: Thu, 19 Oct 2023 11:53:22 +0200 Subject: [PATCH 2/2] Changelog #1999 --- .../unreleased/bug-fixes/1999-fix-pgf-stewards-funding.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changelog/unreleased/bug-fixes/1999-fix-pgf-stewards-funding.md 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