diff --git a/.changelog/unreleased/improvements/4708-params-vp-extra-check.md b/.changelog/unreleased/improvements/4708-params-vp-extra-check.md new file mode 100644 index 00000000000..2ae0636931c --- /dev/null +++ b/.changelog/unreleased/improvements/4708-params-vp-extra-check.md @@ -0,0 +1,2 @@ +- Added a VP check that gov updated parameters are readable. + ([\#4708](https://github.com/anoma/namada/pull/4708)) \ No newline at end of file diff --git a/crates/parameters/src/vp.rs b/crates/parameters/src/vp.rs index 50f3b462b94..dd6e28b9666 100644 --- a/crates/parameters/src/vp.rs +++ b/crates/parameters/src/vp.rs @@ -40,16 +40,20 @@ where }; match key_type { KeyType::PARAMETER | KeyType::UNKNOWN_PARAMETER => { - Gov::is_proposal_accepted(&ctx.pre(), &data)?.ok_or_else( - || { + let is_gov = Gov::is_proposal_accepted(&ctx.pre(), &data)? + .ok_or_else(|| { Error::new_alloc(format!( "Attempted to change a protocol parameter \ from outside of a governance proposal, or \ from a non-accepted governance proposal: \ {key}", )) - }, - ) + }); + is_gov.and_then(|()| { + // ensure that new parameters can be decoded + let _ = crate::read(&ctx.post())?; + Ok(()) + }) } KeyType::UNKNOWN => Ok(()), }