From 53643a3c32bcde8dc777b4cfb1e704f39ae61a33 Mon Sep 17 00:00:00 2001 From: Tomasz Kulik Date: Thu, 5 Sep 2024 10:00:29 +0200 Subject: [PATCH] chore: Add CHANGELOG and extend error msg --- CHANGELOG.md | 6 ++++++ packages/vm/src/environment.rs | 2 +- packages/vm/src/errors/vm_error.rs | 13 ++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 104f1f5b5..ab0434ec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,10 +21,16 @@ and this project adheres to validation. ([#2220]) - cosmwasm-check: Add `--wasm-limits` flag to supply configured limits for static validation. ([#2220]) +- cosmwasm-std: Add `migrate_with_info` call implementation for the extended + `migrate` entrypoint function ([#2212]) +- cosmwasm-vm: Export a new `migrate_with_info` function ([#2212]) +- cosmwasm-derive: Add support for migrate method with + `migrate_info: MigrateInfo` argument. ([#2212]) [#2118]: https://github.com/CosmWasm/cosmwasm/pull/2118 [#2196]: https://github.com/CosmWasm/cosmwasm/pull/2196 [#2220]: https://github.com/CosmWasm/cosmwasm/pull/2220 +[#2212]: https://github.com/CosmWasm/cosmwasm/pull/2212 ### Changed diff --git a/packages/vm/src/environment.rs b/packages/vm/src/environment.rs index 003653218..2a5df1cec 100644 --- a/packages/vm/src/environment.rs +++ b/packages/vm/src/environment.rs @@ -274,7 +274,7 @@ impl Environment { })?; let function_arity = func.param_arity(store); if args.len() != function_arity { - return Err(VmError::function_arity_mismatch()); + return Err(VmError::function_arity_mismatch(function_arity)); }; self.increment_call_depth()?; let res = func.call(store, args).map_err(|runtime_err| -> VmError { diff --git a/packages/vm/src/errors/vm_error.rs b/packages/vm/src/errors/vm_error.rs index a0f87f6a2..5a6260418 100644 --- a/packages/vm/src/errors/vm_error.rs +++ b/packages/vm/src/errors/vm_error.rs @@ -86,8 +86,14 @@ pub enum VmError { WriteAccessDenied { backtrace: BT }, #[error("Maximum call depth exceeded.")] MaxCallDepthExceeded { backtrace: BT }, - #[error("The called function args arity does not match.")] - FunctionArityMismatch { backtrace: BT }, + #[error( + "The called function args arity does not match. The contract's method arity: {}", + contract_method_arity + )] + FunctionArityMismatch { + contract_method_arity: usize, + backtrace: BT, + }, } impl VmError { @@ -245,8 +251,9 @@ impl VmError { } } - pub(crate) fn function_arity_mismatch() -> Self { + pub(crate) fn function_arity_mismatch(contract_method_arity: usize) -> Self { VmError::FunctionArityMismatch { + contract_method_arity, backtrace: BT::capture(), } }