mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
contracts: Allow () -> (i32) for backwards compatibility (#8656)
This commit is contained in:
committed by
GitHub
parent
70f008b9f1
commit
166568b029
@@ -273,13 +273,17 @@ impl<'a, T: Config> ContractModule<'a, T> {
|
||||
|
||||
// Then check the signature.
|
||||
// Both "call" and "deploy" has a () -> () function type.
|
||||
// We still support () -> (i32) for backwards compatibility.
|
||||
let func_ty_idx = func_entries.get(fn_idx as usize)
|
||||
.ok_or_else(|| "export refers to non-existent function")?
|
||||
.type_ref();
|
||||
let Type::Function(ref func_ty) = types
|
||||
.get(func_ty_idx as usize)
|
||||
.ok_or_else(|| "function has a non-existent type")?;
|
||||
if !(func_ty.params().is_empty() && func_ty.results().is_empty()) {
|
||||
if !(
|
||||
func_ty.params().is_empty() &&
|
||||
(func_ty.results().is_empty() || func_ty.results() == [ValueType::I32])
|
||||
) {
|
||||
return Err("entry point has wrong signature");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user