diff --git a/frame/contracts/src/wasm/mod.rs b/frame/contracts/src/wasm/mod.rs index e81b94bf53127..7c98ee7cf5b1a 100644 --- a/frame/contracts/src/wasm/mod.rs +++ b/frame/contracts/src/wasm/mod.rs @@ -2281,7 +2281,7 @@ mod tests { "#; let output = execute(CODE_IS_CONTRACT, vec![], MockExt::default()).unwrap(); - // The mock ext just returns the same data that was passed as the subject. + // The mock ext just always returns 1u32 (`true`). assert_eq!( output, ExecReturnValue { flags: ReturnFlags::empty(), data: Bytes(1u32.encode()) }, @@ -2294,18 +2294,20 @@ mod tests { const CODE_CALLER_IS_ORIGIN: &str = r#" ;; This runs `caller_is_origin` check on zero account address (module - (import "__unstable__" "seal_caller_is_origin" (func $seal_is_contract (result i32))) + (import "__unstable__" "seal_caller_is_origin" (func $seal_caller_is_origin (result i32))) (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) (import "env" "memory" (memory 1 1)) - ;; [0, 4) here we store the return code of the `seal_caller_is_origin` + ;; [0, 4) here the return code of the `seal_caller_is_origin` will be stored + ;; we initialize it with non-zero value to be sure that it's being overwritten below + (data (i32.const 0) "\10\10\10\10") (func (export "deploy")) (func (export "call") (i32.store - (i32.const 4) - (call $seal_is_contract) + (i32.const 0) + (call $seal_caller_is_origin) ) ;; exit with success and take `seal_caller_is_origin` return code to the output buffer (call $seal_return (i32.const 0) (i32.const 0) (i32.const 4)) @@ -2314,7 +2316,7 @@ mod tests { "#; let output = execute(CODE_CALLER_IS_ORIGIN, vec![], MockExt::default()).unwrap(); - // The mock ext just returns the same data that was passed as the subject. + // The mock ext just always returns 0u32 (`false`) assert_eq!( output, ExecReturnValue { flags: ReturnFlags::empty(), data: Bytes(0u32.encode()) },