mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Stabilize seal_debug_message (#9550)
* Stableize `seal_debug_message` * Update changelog * Enable more tests * Cargo fmt
This commit is contained in:
committed by
GitHub
parent
91929c589f
commit
199b2883af
@@ -1039,7 +1039,7 @@ benchmarks! {
|
||||
let code = WasmModule::<T>::from(ModuleDefinition {
|
||||
memory: Some(ImportedMemory { min_pages: 1, max_pages: 1 }),
|
||||
imported_functions: vec![ImportedFunction {
|
||||
module: "__unstable__",
|
||||
module: "seal0",
|
||||
name: "seal_debug_message",
|
||||
params: vec![ValueType::I32, ValueType::I32],
|
||||
return_type: Some(ValueType::I32),
|
||||
|
||||
@@ -2615,7 +2615,6 @@ fn reinstrument_does_charge() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
fn debug_message_works() {
|
||||
let (wasm, code_hash) = compile_module::<Test>("debug_message_works").unwrap();
|
||||
|
||||
@@ -2638,7 +2637,6 @@ fn debug_message_works() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
fn debug_message_logging_disabled() {
|
||||
let (wasm, code_hash) = compile_module::<Test>("debug_message_logging_disabled").unwrap();
|
||||
|
||||
@@ -2663,7 +2661,6 @@ fn debug_message_logging_disabled() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
fn debug_message_invalid_utf8() {
|
||||
let (wasm, code_hash) = compile_module::<Test>("debug_message_invalid_utf8").unwrap();
|
||||
|
||||
|
||||
@@ -1932,11 +1932,10 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
fn debug_message_works() {
|
||||
const CODE_DEBUG_MESSAGE: &str = r#"
|
||||
(module
|
||||
(import "__unstable__" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32)))
|
||||
(import "seal0" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32)))
|
||||
(import "env" "memory" (memory 1 1))
|
||||
|
||||
(data (i32.const 0) "Hello World!")
|
||||
@@ -1959,11 +1958,10 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
fn debug_message_invalid_utf8_fails() {
|
||||
const CODE_DEBUG_MESSAGE_FAIL: &str = r#"
|
||||
(module
|
||||
(import "__unstable__" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32)))
|
||||
(import "seal0" "seal_debug_message" (func $seal_debug_message (param i32 i32) (result i32)))
|
||||
(import "env" "memory" (memory 1 1))
|
||||
|
||||
(data (i32.const 0) "\fc")
|
||||
|
||||
@@ -69,7 +69,6 @@ pub enum ReturnCode {
|
||||
NotCallable = 8,
|
||||
/// The call to `seal_debug_message` had no effect because debug message
|
||||
/// recording was disabled.
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
LoggingDisabled = 9,
|
||||
/// The call dispatched by `seal_call_runtime` was executed but returned an error.
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
@@ -175,7 +174,6 @@ pub enum RuntimeCosts {
|
||||
/// Weight of calling `seal_deposit_event` with the given number of topics and event size.
|
||||
DepositEvent { num_topic: u32, len: u32 },
|
||||
/// Weight of calling `seal_debug_message`.
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
DebugMessage,
|
||||
/// Weight of calling `seal_set_rent_allowance`.
|
||||
SetRentAllowance,
|
||||
@@ -250,7 +248,6 @@ impl RuntimeCosts {
|
||||
.deposit_event
|
||||
.saturating_add(s.deposit_event_per_topic.saturating_mul(num_topic.into()))
|
||||
.saturating_add(s.deposit_event_per_byte.saturating_mul(len.into())),
|
||||
#[cfg(feature = "unstable-interface")]
|
||||
DebugMessage => s.debug_message,
|
||||
SetRentAllowance => s.set_rent_allowance,
|
||||
SetStorage(len) =>
|
||||
@@ -1748,7 +1745,7 @@ define_env!(Env, <E: Ext>,
|
||||
// not being executed as an RPC. For example, they could allow users to disable logging
|
||||
// through compile time flags (cargo features) for on-chain deployment. Additionally, the
|
||||
// return value of this function can be cached in order to prevent further calls at runtime.
|
||||
[__unstable__] seal_debug_message(ctx, str_ptr: u32, str_len: u32) -> ReturnCode => {
|
||||
[seal0] seal_debug_message(ctx, str_ptr: u32, str_len: u32) -> ReturnCode => {
|
||||
ctx.charge_gas(RuntimeCosts::DebugMessage)?;
|
||||
if ctx.ext.append_debug_buffer("") {
|
||||
let data = ctx.read_sandbox_memory(str_ptr, str_len)?;
|
||||
|
||||
Reference in New Issue
Block a user