diff --git a/Cargo.lock b/Cargo.lock index 2339aff34bcd49dffa02d3b23594e8d84a5e82a0..69395bf281e8f17637cd70b32e328f8eaf21ff1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9571,7 +9571,7 @@ dependencies = [ [[package]] name = "pallet-assets" -version = "29.0.0" +version = "29.1.0" dependencies = [ "frame-benchmarking", "frame-support", diff --git a/prdoc/pr_4118.prdoc b/prdoc/pr_4118.prdoc new file mode 100644 index 0000000000000000000000000000000000000000..20f36c1b0a37cc330c23115daa59f7a6c14b3c6a --- /dev/null +++ b/prdoc/pr_4118.prdoc @@ -0,0 +1,13 @@ +title: "pallet assets: minor improvement on errors returned for some calls" + +doc: + - audience: Runtime Dev + description: | + Some calls in pallet assets have better errors. No new error is introduced, only more sensible choice are made. + - audience: Runtime User + description: | + Some calls in pallet assets have better errors. No new error is introduced, only more sensible choice are made. + +crates: + - name: pallet-assets + bump: minor diff --git a/substrate/frame/assets/Cargo.toml b/substrate/frame/assets/Cargo.toml index 3b95750c14c8c9c78ad86442085580810e447f5a..ed6df77e15232d7249fdcdb5da41a673ef420994 100644 --- a/substrate/frame/assets/Cargo.toml +++ b/substrate/frame/assets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-assets" -version = "29.0.0" +version = "29.1.0" authors.workspace = true edition.workspace = true license = "Apache-2.0" diff --git a/substrate/frame/assets/src/functions.rs b/substrate/frame/assets/src/functions.rs index 8791aaa736b350292cfce58c4d4067f3e8af101b..4a5fb06ee2c82ecce0f936d546f317b157fb9722 100644 --- a/substrate/frame/assets/src/functions.rs +++ b/substrate/frame/assets/src/functions.rs @@ -491,7 +491,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> { let d = Asset::<T, I>::get(&id).ok_or(Error::<T, I>::Unknown)?; ensure!( d.status == AssetStatus::Live || d.status == AssetStatus::Frozen, - Error::<T, I>::AssetNotLive + Error::<T, I>::IncorrectStatus ); let actual = Self::decrease_balance(id.clone(), target, amount, f, |actual, details| { diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs index 6891f04dfb51aae356a708112a7bba284e894be2..c6b379e1d060600f8c531ef75c3663cbb667e230 100644 --- a/substrate/frame/assets/src/lib.rs +++ b/substrate/frame/assets/src/lib.rs @@ -987,7 +987,7 @@ pub mod pallet { let d = Asset::<T, I>::get(&id).ok_or(Error::<T, I>::Unknown)?; ensure!( d.status == AssetStatus::Live || d.status == AssetStatus::Frozen, - Error::<T, I>::AssetNotLive + Error::<T, I>::IncorrectStatus ); ensure!(origin == d.freezer, Error::<T, I>::NoPermission); let who = T::Lookup::lookup(who)?; @@ -1024,7 +1024,7 @@ pub mod pallet { let details = Asset::<T, I>::get(&id).ok_or(Error::<T, I>::Unknown)?; ensure!( details.status == AssetStatus::Live || details.status == AssetStatus::Frozen, - Error::<T, I>::AssetNotLive + Error::<T, I>::IncorrectStatus ); ensure!(origin == details.admin, Error::<T, I>::NoPermission); let who = T::Lookup::lookup(who)?; @@ -1113,7 +1113,7 @@ pub mod pallet { Asset::<T, I>::try_mutate(id.clone(), |maybe_details| { let details = maybe_details.as_mut().ok_or(Error::<T, I>::Unknown)?; - ensure!(details.status == AssetStatus::Live, Error::<T, I>::LiveAsset); + ensure!(details.status == AssetStatus::Live, Error::<T, I>::AssetNotLive); ensure!(origin == details.owner, Error::<T, I>::NoPermission); if details.owner == owner { return Ok(()) @@ -1669,7 +1669,7 @@ pub mod pallet { let d = Asset::<T, I>::get(&id).ok_or(Error::<T, I>::Unknown)?; ensure!( d.status == AssetStatus::Live || d.status == AssetStatus::Frozen, - Error::<T, I>::AssetNotLive + Error::<T, I>::IncorrectStatus ); ensure!(origin == d.freezer, Error::<T, I>::NoPermission); let who = T::Lookup::lookup(who)?;