Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Stabilize seal_delegate_call (#11037)
Browse files Browse the repository at this point in the history
  • Loading branch information
athei authored Mar 15, 2022
1 parent 8b26ac9 commit cc282f8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion frame/contracts/fixtures/delegate_call.wat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(import "seal0" "seal_input" (func $seal_input (param i32 i32)))
(import "seal0" "seal_get_storage" (func $seal_get_storage (param i32 i32 i32) (result i32)))
(import "seal0" "seal_set_storage" (func $seal_set_storage (param i32 i32 i32)))
(import "__unstable__" "seal_delegate_call" (func $seal_delegate_call (param i32 i32 i32 i32 i32 i32) (result i32)))
(import "seal0" "seal_delegate_call" (func $seal_delegate_call (param i32 i32 i32 i32 i32 i32) (result i32)))
(import "env" "memory" (memory 3 3))

;; [0, 32) storage key
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ benchmarks! {
let code = WasmModule::<T>::from(ModuleDefinition {
memory: Some(ImportedMemory::max::<T>()),
imported_functions: vec![ImportedFunction {
module: "__unstable__",
module: "seal0",
name: "seal_delegate_call",
params: vec![
ValueType::I32,
Expand Down
1 change: 0 additions & 1 deletion frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,6 @@ fn deploy_and_call_other_contract() {
}

#[test]
#[cfg(feature = "unstable-interface")]
fn delegate_call() {
let (caller_wasm, caller_code_hash) = compile_module::<Test>("delegate_call").unwrap();
let (callee_wasm, callee_code_hash) = compile_module::<Test>("delegate_call_lib").unwrap();
Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ mod tests {
;; output_ptr: u32,
;; output_len_ptr: u32
;;) -> u32
(import "__unstable__" "seal_delegate_call" (func $seal_delegate_call (param i32 i32 i32 i32 i32 i32) (result i32)))
(import "seal0" "seal_delegate_call" (func $seal_delegate_call (param i32 i32 i32 i32 i32 i32) (result i32)))
(import "env" "memory" (memory 1 1))
(func (export "call")
(drop
Expand Down
7 changes: 1 addition & 6 deletions frame/contracts/src/wasm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ pub enum RuntimeCosts {
/// Base weight of calling `seal_call`.
CallBase,
/// Weight of calling `seal_delegate_call` for the given input size.
#[cfg(feature = "unstable-interface")]
DelegateCallBase,
/// Weight of the transfer performed during a call.
CallSurchargeTransfer,
Expand Down Expand Up @@ -272,7 +271,6 @@ impl RuntimeCosts {
.saturating_add(s.take_storage_per_byte.saturating_mul(len.into())),
Transfer => s.transfer,
CallBase => s.call,
#[cfg(feature = "unstable-interface")]
DelegateCallBase => s.delegate_call,
CallSurchargeTransfer => s.call_transfer_surcharge,
CallInputCloned(len) => s.call_per_cloned_byte.saturating_mul(len.into()),
Expand Down Expand Up @@ -389,7 +387,6 @@ bitflags! {
enum CallType {
/// Execute another instantiated contract
Call { callee_ptr: u32, value_ptr: u32, gas: u64 },
#[cfg(feature = "unstable-interface")]
/// Execute deployed code in the context (storage, account ID, value) of the caller contract
DelegateCall { code_hash_ptr: u32 },
}
Expand All @@ -398,7 +395,6 @@ impl CallType {
fn cost(&self) -> RuntimeCosts {
match self {
CallType::Call { .. } => RuntimeCosts::CallBase,
#[cfg(feature = "unstable-interface")]
CallType::DelegateCall { .. } => RuntimeCosts::DelegateCallBase,
}
}
Expand Down Expand Up @@ -763,7 +759,6 @@ where
flags.contains(CallFlags::ALLOW_REENTRY),
)
},
#[cfg(feature = "unstable-interface")]
CallType::DelegateCall { code_hash_ptr } => {
if flags.contains(CallFlags::ALLOW_REENTRY) {
return Err(Error::<E::T>::InvalidCallFlags.into())
Expand Down Expand Up @@ -1129,7 +1124,7 @@ define_env!(Env, <E: Ext>,
// `ReturnCode::CalleeReverted`: Output buffer is returned.
// `ReturnCode::CalleeTrapped`
// `ReturnCode::CodeNotFound`
[__unstable__] seal_delegate_call(
[seal0] seal_delegate_call(
ctx,
flags: u32,
code_hash_ptr: u32,
Expand Down

0 comments on commit cc282f8

Please sign in to comment.