mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
contracts: Add instantiation_nonce API (#12800)
* Add `instantiation_nonce` API * Fixes for tests * Update frame/contracts/src/schedule.rs Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
c336eae64a
commit
770afb9ee3
@@ -163,6 +163,7 @@ struct HostFn {
|
||||
enum HostFnReturn {
|
||||
Unit,
|
||||
U32,
|
||||
U64,
|
||||
ReturnCode,
|
||||
}
|
||||
|
||||
@@ -171,6 +172,7 @@ impl HostFnReturn {
|
||||
let ok = match self {
|
||||
Self::Unit => quote! { () },
|
||||
Self::U32 | Self::ReturnCode => quote! { ::core::primitive::u32 },
|
||||
Self::U64 => quote! { ::core::primitive::u64 },
|
||||
};
|
||||
quote! {
|
||||
::core::result::Result<#ok, ::wasmi::core::Trap>
|
||||
@@ -241,6 +243,7 @@ impl HostFn {
|
||||
let msg = r#"Should return one of the following:
|
||||
- Result<(), TrapReason>,
|
||||
- Result<ReturnCode, TrapReason>,
|
||||
- Result<u64, TrapReason>,
|
||||
- Result<u32, TrapReason>"#;
|
||||
let ret_ty = match item.clone().sig.output {
|
||||
syn::ReturnType::Type(_, ty) => Ok(ty.clone()),
|
||||
@@ -303,6 +306,7 @@ impl HostFn {
|
||||
let returns = match ok_ty_str.as_str() {
|
||||
"()" => Ok(HostFnReturn::Unit),
|
||||
"u32" => Ok(HostFnReturn::U32),
|
||||
"u64" => Ok(HostFnReturn::U64),
|
||||
"ReturnCode" => Ok(HostFnReturn::ReturnCode),
|
||||
_ => Err(err(arg1.span(), &msg)),
|
||||
}?;
|
||||
|
||||
Reference in New Issue
Block a user