diff --git a/substrate/frame/contracts/fixtures/set_code_hash.wat b/substrate/frame/contracts/fixtures/set_code_hash.wat index 0a7b2e7cbe..b4df1b1331 100644 --- a/substrate/frame/contracts/fixtures/set_code_hash.wat +++ b/substrate/frame/contracts/fixtures/set_code_hash.wat @@ -1,7 +1,7 @@ (module (import "seal0" "seal_input" (func $seal_input (param i32 i32))) (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) - (import "__unstable__" "seal_set_code_hash" (func $seal_set_code_hash (param i32) (result i32))) + (import "seal0" "seal_set_code_hash" (func $seal_set_code_hash (param i32) (result i32))) (import "env" "memory" (memory 1 1)) diff --git a/substrate/frame/contracts/src/benchmarking/mod.rs b/substrate/frame/contracts/src/benchmarking/mod.rs index 84f4cb6083..6411bcb2b5 100644 --- a/substrate/frame/contracts/src/benchmarking/mod.rs +++ b/substrate/frame/contracts/src/benchmarking/mod.rs @@ -448,7 +448,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "__unstable__", + module: "seal0", name: "seal_code_hash", params: vec![ValueType::I32, ValueType::I32, ValueType::I32], return_type: Some(ValueType::I32), @@ -484,7 +484,7 @@ benchmarks! { seal_own_code_hash { let r in 0 .. API_BENCHMARK_BATCHES; let instance = Contract::::new(WasmModule::getter( - "__unstable__", "seal_own_code_hash", r * API_BENCHMARK_BATCH_SIZE + "seal0", "seal_own_code_hash", r * API_BENCHMARK_BATCH_SIZE ), vec![])?; let origin = RawOrigin::Signed(instance.caller.clone()); }: call(origin, instance.addr, 0u32.into(), Weight::MAX, None, vec![]) @@ -2017,7 +2017,7 @@ benchmarks! { let code = WasmModule::::from(ModuleDefinition { memory: Some(ImportedMemory::max::()), imported_functions: vec![ImportedFunction { - module: "__unstable__", + module: "seal0", name: "seal_set_code_hash", params: vec![ ValueType::I32, diff --git a/substrate/frame/contracts/src/tests.rs b/substrate/frame/contracts/src/tests.rs index 9d949eea9b..eaec4df698 100644 --- a/substrate/frame/contracts/src/tests.rs +++ b/substrate/frame/contracts/src/tests.rs @@ -3088,7 +3088,6 @@ fn code_rejected_error_works() { } #[test] -#[cfg(feature = "unstable-interface")] fn set_code_hash() { let (wasm, code_hash) = compile_module::("set_code_hash").unwrap(); let (new_wasm, new_code_hash) = compile_module::("new_set_code_hash_contract").unwrap(); diff --git a/substrate/frame/contracts/src/wasm/mod.rs b/substrate/frame/contracts/src/wasm/mod.rs index f12df06b93..7257fbea63 100644 --- a/substrate/frame/contracts/src/wasm/mod.rs +++ b/substrate/frame/contracts/src/wasm/mod.rs @@ -2407,12 +2407,11 @@ mod tests { } #[test] - #[cfg(feature = "unstable-interface")] fn code_hash_works() { /// calls `seal_code_hash` and compares the result with the constant. const CODE_CODE_HASH: &str = r#" (module - (import "__unstable__" "seal_code_hash" (func $seal_code_hash (param i32 i32 i32) (result i32))) + (import "seal0" "seal_code_hash" (func $seal_code_hash (param i32 i32 i32) (result i32))) (import "env" "memory" (memory 1 1)) ;; size of our buffer is 32 bytes @@ -2460,12 +2459,11 @@ mod tests { } #[test] - #[cfg(feature = "unstable-interface")] fn own_code_hash_works() { /// calls `seal_own_code_hash` and compares the result with the constant. const CODE_OWN_CODE_HASH: &str = r#" (module - (import "__unstable__" "seal_own_code_hash" (func $seal_own_code_hash (param i32 i32))) + (import "seal0" "seal_own_code_hash" (func $seal_own_code_hash (param i32 i32))) (import "env" "memory" (memory 1 1)) ;; size of our buffer is 32 bytes @@ -2546,11 +2544,10 @@ mod tests { } #[test] - #[cfg(feature = "unstable-interface")] fn set_code_hash() { const CODE: &str = r#" (module - (import "__unstable__" "seal_set_code_hash" (func $seal_set_code_hash (param i32) (result i32))) + (import "seal0" "seal_set_code_hash" (func $seal_set_code_hash (param i32) (result i32))) (import "env" "memory" (memory 1 1)) (func $assert (param i32) (block $ok diff --git a/substrate/frame/contracts/src/wasm/runtime.rs b/substrate/frame/contracts/src/wasm/runtime.rs index 7719d512b8..a6f42ba64a 100644 --- a/substrate/frame/contracts/src/wasm/runtime.rs +++ b/substrate/frame/contracts/src/wasm/runtime.rs @@ -147,10 +147,8 @@ pub enum RuntimeCosts { /// Weight of calling `seal_is_contract`. IsContract, /// Weight of calling `seal_code_hash`. - #[cfg(feature = "unstable-interface")] CodeHash, /// Weight of calling `seal_own_code_hash`. - #[cfg(feature = "unstable-interface")] OwnCodeHash, /// Weight of calling `seal_caller_is_origin`. CallerIsOrigin, @@ -225,7 +223,6 @@ pub enum RuntimeCosts { #[cfg(feature = "unstable-interface")] CallRuntime(Weight), /// Weight of calling `seal_set_code_hash` - #[cfg(feature = "unstable-interface")] SetCodeHash, /// Weight of calling `ecdsa_to_eth_address` #[cfg(feature = "unstable-interface")] @@ -245,9 +242,7 @@ impl RuntimeCosts { CopyToContract(len) => s.input_per_byte.saturating_mul(len.into()), Caller => s.caller, IsContract => s.is_contract, - #[cfg(feature = "unstable-interface")] CodeHash => s.code_hash, - #[cfg(feature = "unstable-interface")] OwnCodeHash => s.own_code_hash, CallerIsOrigin => s.caller_is_origin, Address => s.address, @@ -312,7 +307,6 @@ impl RuntimeCosts { #[cfg(feature = "unstable-interface")] CallRuntime(weight) => weight, - #[cfg(feature = "unstable-interface")] SetCodeHash => s.set_code_hash, #[cfg(feature = "unstable-interface")] EcdsaToEthAddress => s.ecdsa_to_eth_address, @@ -1401,7 +1395,7 @@ define_env!(Env, , // # Errors // // `ReturnCode::KeyNotFound` - [__unstable__] seal_code_hash(ctx, account_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { + [seal0] seal_code_hash(ctx, account_ptr: u32, out_ptr: u32, out_len_ptr: u32) -> ReturnCode => { ctx.charge_gas(RuntimeCosts::CodeHash)?; let address: <::T as frame_system::Config>::AccountId = ctx.read_sandbox_memory_as(account_ptr)?; @@ -1420,7 +1414,7 @@ define_env!(Env, , // - `out_ptr`: pointer to the linear memory where the returning value is written to. // - `out_len_ptr`: in-out pointer into linear memory where the buffer length // is read from and the value length is written to. - [__unstable__] seal_own_code_hash(ctx, out_ptr: u32, out_len_ptr: u32) => { + [seal0] seal_own_code_hash(ctx, out_ptr: u32, out_len_ptr: u32) => { ctx.charge_gas(RuntimeCosts::OwnCodeHash)?; let code_hash_encoded = &ctx.ext.own_code_hash().encode(); Ok(ctx.write_sandbox_output(out_ptr, out_len_ptr, code_hash_encoded, false, already_charged)?) @@ -2048,7 +2042,7 @@ define_env!(Env, , // # Errors // // `ReturnCode::CodeNotFound` - [__unstable__] seal_set_code_hash(ctx, code_hash_ptr: u32) -> ReturnCode => { + [seal0] seal_set_code_hash(ctx, code_hash_ptr: u32) -> ReturnCode => { ctx.charge_gas(RuntimeCosts::SetCodeHash)?; let code_hash: CodeHash<::T> = ctx.read_sandbox_memory_as(code_hash_ptr)?; match ctx.ext.set_code_hash(code_hash) {