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/.changelog/v0.23.1/bug-fixes/1991-fix-pgf-payment-crash.md b/.changelog/v0.23.1/bug-fixes/1991-fix-pgf-payment-crash.md new file mode 100644 index 0000000000..226fe081a5 --- /dev/null +++ b/.changelog/v0.23.1/bug-fixes/1991-fix-pgf-payment-crash.md @@ -0,0 +1,2 @@ +- Fixed a bug that would cause the ledger to crash on a failed PGF payment. + ([\#1991](https://github.com/anoma/namada/pull/1991)) \ No newline at end of file diff --git a/.changelog/v0.23.1/summary.md b/.changelog/v0.23.1/summary.md new file mode 100644 index 0000000000..77faf26967 --- /dev/null +++ b/.changelog/v0.23.1/summary.md @@ -0,0 +1 @@ +Namada 0.23.1 is a patch release fixing a potential ledger crash on the pgf module. diff --git a/CHANGELOG.md b/CHANGELOG.md index 36c2fca982..0b36b247eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # CHANGELOG +## v0.23.1 + +Namada 0.23.1 is a patch release fixing a potential ledger crash on the pgf module. + +### BUG FIXES + +- Fixed a bug that would cause the ledger to crash on a failed PGF payment. + ([\#1991](https://github.com/anoma/namada/pull/1991)) + ## v0.23.0 Namada is a minor release that improves the ethereum bridge, the IBC mechanism, and fixes some general protocol bugs. diff --git a/Cargo.lock b/Cargo.lock index 96d2797112..510f1973d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3930,7 +3930,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "namada" -version = "0.23.0" +version = "0.23.1" dependencies = [ "assert_matches", "async-trait", @@ -4000,7 +4000,7 @@ dependencies = [ [[package]] name = "namada_apps" -version = "0.23.0" +version = "0.23.1" dependencies = [ "ark-serialize", "ark-std", @@ -4090,7 +4090,7 @@ dependencies = [ [[package]] name = "namada_benchmarks" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", @@ -4105,7 +4105,7 @@ dependencies = [ [[package]] name = "namada_core" -version = "0.23.0" +version = "0.23.1" dependencies = [ "ark-bls12-381", "ark-ec", @@ -4164,7 +4164,7 @@ dependencies = [ [[package]] name = "namada_encoding_spec" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "itertools 0.10.5", @@ -4175,7 +4175,7 @@ dependencies = [ [[package]] name = "namada_ethereum_bridge" -version = "0.23.0" +version = "0.23.1" dependencies = [ "assert_matches", "borsh 1.0.0-alpha.4", @@ -4200,7 +4200,7 @@ dependencies = [ [[package]] name = "namada_macros" -version = "0.23.0" +version = "0.23.1" dependencies = [ "proc-macro2", "quote", @@ -4209,7 +4209,7 @@ dependencies = [ [[package]] name = "namada_proof_of_stake" -version = "0.23.0" +version = "0.23.1" dependencies = [ "assert_matches", "borsh 1.0.0-alpha.4", @@ -4278,7 +4278,7 @@ dependencies = [ [[package]] name = "namada_test_utils" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "namada_core", @@ -4287,7 +4287,7 @@ dependencies = [ [[package]] name = "namada_tests" -version = "0.23.0" +version = "0.23.1" dependencies = [ "assert_cmd", "async-trait", @@ -4336,7 +4336,7 @@ dependencies = [ [[package]] name = "namada_tx_prelude" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", @@ -4351,7 +4351,7 @@ dependencies = [ [[package]] name = "namada_vm_env" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "masp_primitives", @@ -4360,7 +4360,7 @@ dependencies = [ [[package]] name = "namada_vp_prelude" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", diff --git a/Cargo.toml b/Cargo.toml index 0302bc4281..c1ef55bae8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ keywords = ["blockchain", "privacy", "crypto", "protocol", "network"] license = "GPL-3.0" readme = "README.md" repository = "https://github.com/anoma/namada" -version = "0.23.0" +version = "0.23.1" [workspace.dependencies] ark-bls12-381 = {version = "0.3"} diff --git a/apps/src/lib/node/ledger/shell/finalize_block.rs b/apps/src/lib/node/ledger/shell/finalize_block.rs index 61fa9ed34f..f7f63d2a3b 100644 --- a/apps/src/lib/node/ledger/shell/finalize_block.rs +++ b/apps/src/lib/node/ledger/shell/finalize_block.rs @@ -801,13 +801,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, @@ -850,18 +853,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); diff --git a/apps/src/lib/node/ledger/shell/governance.rs b/apps/src/lib/node/ledger/shell/governance.rs index 80d3e4ac53..8f2d3a9b4c 100644 --- a/apps/src/lib/node/ledger/shell/governance.rs +++ b/apps/src/lib/node/ledger/shell/governance.rs @@ -378,19 +378,28 @@ where } }, PGFAction::Retro(target) => { - token::transfer( + match token::transfer( storage, token, &ADDRESS, &target.target, target.amount, - )?; - tracing::info!( - "Execute RetroPgf from proposal id {}: sent {} to {}.", - proposal_id, - target.amount.to_string_native(), - target.target - ); + ) { + Ok(()) => tracing::info!( + "Execute RetroPgf from proposal id {}: sent {} to {}.", + proposal_id, + target.amount.to_string_native(), + target.target + ), + Err(e) => tracing::warn!( + "Error in RetroPgf transfer from proposal id {}, \ + amount {} to {}: {}", + proposal_id, + target.amount.to_string_native(), + target.target, + e + ), + } } } } diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 5e3dd3513c..7ab11f5ab1 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -3250,7 +3250,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "namada" -version = "0.23.0" +version = "0.23.1" dependencies = [ "async-trait", "bimap", @@ -3311,7 +3311,7 @@ dependencies = [ [[package]] name = "namada_core" -version = "0.23.0" +version = "0.23.1" dependencies = [ "ark-bls12-381", "ark-ec", @@ -3365,7 +3365,7 @@ dependencies = [ [[package]] name = "namada_ethereum_bridge" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", @@ -3386,7 +3386,7 @@ dependencies = [ [[package]] name = "namada_macros" -version = "0.23.0" +version = "0.23.1" dependencies = [ "proc-macro2", "quote", @@ -3395,7 +3395,7 @@ dependencies = [ [[package]] name = "namada_proof_of_stake" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "data-encoding", @@ -3453,7 +3453,7 @@ dependencies = [ [[package]] name = "namada_test_utils" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "namada_core", @@ -3462,7 +3462,7 @@ dependencies = [ [[package]] name = "namada_tests" -version = "0.23.0" +version = "0.23.1" dependencies = [ "async-trait", "chrono", @@ -3493,7 +3493,7 @@ dependencies = [ [[package]] name = "namada_tx_prelude" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", @@ -3508,7 +3508,7 @@ dependencies = [ [[package]] name = "namada_vm_env" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "masp_primitives", @@ -3517,7 +3517,7 @@ dependencies = [ [[package]] name = "namada_vp_prelude" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", @@ -3531,7 +3531,7 @@ dependencies = [ [[package]] name = "namada_wasm" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "getrandom 0.2.9", @@ -5806,7 +5806,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "tx_template" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "getrandom 0.2.9", @@ -5929,7 +5929,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vp_template" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "getrandom 0.2.9", diff --git a/wasm/tx_template/Cargo.toml b/wasm/tx_template/Cargo.toml index dbccfaba16..1a8b27053c 100644 --- a/wasm/tx_template/Cargo.toml +++ b/wasm/tx_template/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "GPL-3.0" name = "tx_template" resolver = "2" -version = "0.23.0" +version = "0.23.1" [lib] crate-type = ["cdylib"] diff --git a/wasm/vp_template/Cargo.toml b/wasm/vp_template/Cargo.toml index 3e8b64262d..5d287de054 100644 --- a/wasm/vp_template/Cargo.toml +++ b/wasm/vp_template/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "GPL-3.0" name = "vp_template" resolver = "2" -version = "0.23.0" +version = "0.23.1" [lib] crate-type = ["cdylib"] diff --git a/wasm/wasm_source/Cargo.toml b/wasm/wasm_source/Cargo.toml index 7ed59af169..fa00c06445 100644 --- a/wasm/wasm_source/Cargo.toml +++ b/wasm/wasm_source/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "GPL-3.0" name = "namada_wasm" resolver = "2" -version = "0.23.0" +version = "0.23.1" [lib] crate-type = ["cdylib"] diff --git a/wasm_for_tests/tx_memory_limit.wasm b/wasm_for_tests/tx_memory_limit.wasm index 2a4a048803..aa759bd8f9 100755 Binary files a/wasm_for_tests/tx_memory_limit.wasm and b/wasm_for_tests/tx_memory_limit.wasm differ diff --git a/wasm_for_tests/tx_mint_tokens.wasm b/wasm_for_tests/tx_mint_tokens.wasm index cf955c08ef..72f622cb2c 100755 Binary files a/wasm_for_tests/tx_mint_tokens.wasm and b/wasm_for_tests/tx_mint_tokens.wasm differ diff --git a/wasm_for_tests/tx_no_op.wasm b/wasm_for_tests/tx_no_op.wasm index 5b5edf87b2..312d207049 100755 Binary files a/wasm_for_tests/tx_no_op.wasm and b/wasm_for_tests/tx_no_op.wasm differ diff --git a/wasm_for_tests/tx_proposal_code.wasm b/wasm_for_tests/tx_proposal_code.wasm index 0ddcc839f3..b90d24d1a1 100755 Binary files a/wasm_for_tests/tx_proposal_code.wasm and b/wasm_for_tests/tx_proposal_code.wasm differ diff --git a/wasm_for_tests/tx_read_storage_key.wasm b/wasm_for_tests/tx_read_storage_key.wasm index bc41ec9ba2..5febbdc202 100755 Binary files a/wasm_for_tests/tx_read_storage_key.wasm and b/wasm_for_tests/tx_read_storage_key.wasm differ diff --git a/wasm_for_tests/tx_write.wasm b/wasm_for_tests/tx_write.wasm index 22d768f098..b6431f382a 100755 Binary files a/wasm_for_tests/tx_write.wasm and b/wasm_for_tests/tx_write.wasm differ diff --git a/wasm_for_tests/tx_write_storage_key.wasm b/wasm_for_tests/tx_write_storage_key.wasm index 5d600d185f..a0fb758ae9 100755 Binary files a/wasm_for_tests/tx_write_storage_key.wasm and b/wasm_for_tests/tx_write_storage_key.wasm differ diff --git a/wasm_for_tests/vp_always_false.wasm b/wasm_for_tests/vp_always_false.wasm index e7cf9bdd75..2e0679fdfd 100755 Binary files a/wasm_for_tests/vp_always_false.wasm and b/wasm_for_tests/vp_always_false.wasm differ diff --git a/wasm_for_tests/vp_always_true.wasm b/wasm_for_tests/vp_always_true.wasm index 22e47a4849..2848bb65ed 100755 Binary files a/wasm_for_tests/vp_always_true.wasm and b/wasm_for_tests/vp_always_true.wasm differ diff --git a/wasm_for_tests/vp_eval.wasm b/wasm_for_tests/vp_eval.wasm index adee09fbf1..933a24a1b7 100755 Binary files a/wasm_for_tests/vp_eval.wasm and b/wasm_for_tests/vp_eval.wasm differ diff --git a/wasm_for_tests/vp_memory_limit.wasm b/wasm_for_tests/vp_memory_limit.wasm index 782c241c1a..4d93436596 100755 Binary files a/wasm_for_tests/vp_memory_limit.wasm and b/wasm_for_tests/vp_memory_limit.wasm differ diff --git a/wasm_for_tests/vp_read_storage_key.wasm b/wasm_for_tests/vp_read_storage_key.wasm index 57ed6dd892..7ec28691e2 100755 Binary files a/wasm_for_tests/vp_read_storage_key.wasm and b/wasm_for_tests/vp_read_storage_key.wasm differ diff --git a/wasm_for_tests/wasm_source/Cargo.lock b/wasm_for_tests/wasm_source/Cargo.lock index dfedb2406a..327aa0f732 100644 --- a/wasm_for_tests/wasm_source/Cargo.lock +++ b/wasm_for_tests/wasm_source/Cargo.lock @@ -3250,7 +3250,7 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "namada" -version = "0.23.0" +version = "0.23.1" dependencies = [ "async-trait", "bimap", @@ -3311,7 +3311,7 @@ dependencies = [ [[package]] name = "namada_core" -version = "0.23.0" +version = "0.23.1" dependencies = [ "ark-bls12-381", "ark-ec", @@ -3365,7 +3365,7 @@ dependencies = [ [[package]] name = "namada_ethereum_bridge" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", @@ -3386,7 +3386,7 @@ dependencies = [ [[package]] name = "namada_macros" -version = "0.23.0" +version = "0.23.1" dependencies = [ "proc-macro2", "quote", @@ -3395,7 +3395,7 @@ dependencies = [ [[package]] name = "namada_proof_of_stake" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "data-encoding", @@ -3453,7 +3453,7 @@ dependencies = [ [[package]] name = "namada_test_utils" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "namada_core", @@ -3462,7 +3462,7 @@ dependencies = [ [[package]] name = "namada_tests" -version = "0.23.0" +version = "0.23.1" dependencies = [ "async-trait", "chrono", @@ -3493,7 +3493,7 @@ dependencies = [ [[package]] name = "namada_tx_prelude" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", @@ -3508,7 +3508,7 @@ dependencies = [ [[package]] name = "namada_vm_env" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "masp_primitives", @@ -3517,7 +3517,7 @@ dependencies = [ [[package]] name = "namada_vp_prelude" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "borsh-ext", @@ -3531,7 +3531,7 @@ dependencies = [ [[package]] name = "namada_wasm_for_tests" -version = "0.23.0" +version = "0.23.1" dependencies = [ "borsh 1.0.0-alpha.4", "getrandom 0.2.9", diff --git a/wasm_for_tests/wasm_source/Cargo.toml b/wasm_for_tests/wasm_source/Cargo.toml index 07ae535c61..10a8fc84a2 100644 --- a/wasm_for_tests/wasm_source/Cargo.toml +++ b/wasm_for_tests/wasm_source/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "GPL-3.0" name = "namada_wasm_for_tests" resolver = "2" -version = "0.23.0" +version = "0.23.1" [lib] crate-type = ["cdylib"]