Skip to content

Commit

Permalink
chore: Add CHANGELOG and extend error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikthebird committed Sep 5, 2024
1 parent c09d19e commit 53643a3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packages/vm/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ impl<A: BackendApi, S: Storage, Q: Querier> Environment<A, S, Q> {
})?;
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 {
Expand Down
13 changes: 10 additions & 3 deletions packages/vm/src/errors/vm_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(),
}
}
Expand Down

0 comments on commit 53643a3

Please sign in to comment.