Skip to content
Snippets Groups Projects
Commit 47bb475d authored by Cyrill Leutwiler's avatar Cyrill Leutwiler Committed by GitHub
Browse files

A subtle bug in the bool predicate for checking against chain extension...

A subtle bug in the bool predicate for checking against chain extension imports prevents importing the non-prefixed version even if chain extension are enabled are enabled (#14642)

Signed-off-by: default avatarCyrill Leutwiler <bigcyrill@hotmail.com>
parent c9b54e10
No related merge requests found
;; Call chain extension by passing through input and output of this contract ;; Call chain extension by passing through input and output of this contract
(module (module
(import "seal0" "seal_call_chain_extension" (import "seal0" "call_chain_extension"
(func $seal_call_chain_extension (param i32 i32 i32 i32 i32) (result i32)) (func $call_chain_extension (param i32 i32 i32 i32 i32) (result i32))
) )
(import "seal0" "seal_input" (func $seal_input (param i32 i32))) (import "seal0" "seal_input" (func $seal_input (param i32 i32)))
(import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) (import "seal0" "seal_return" (func $seal_return (param i32 i32 i32)))
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
(call $seal_input (i32.const 4) (i32.const 0)) (call $seal_input (i32.const 4) (i32.const 0))
;; the chain extension passes through the input and returns it as output ;; the chain extension passes through the input and returns it as output
(call $seal_call_chain_extension (call $call_chain_extension
(i32.load (i32.const 4)) ;; id (i32.load (i32.const 4)) ;; id
(i32.const 4) ;; input_ptr (i32.const 4) ;; input_ptr
(i32.load (i32.const 0)) ;; input_len (i32.load (i32.const 0)) ;; input_len
......
...@@ -168,8 +168,8 @@ impl LoadedModule { ...@@ -168,8 +168,8 @@ impl LoadedModule {
let _ = import.ty().func().ok_or("expected a function")?; let _ = import.ty().func().ok_or("expected a function")?;
if !<T as Config>::ChainExtension::enabled() && if !<T as Config>::ChainExtension::enabled() &&
import.name().as_bytes() == b"seal_call_chain_extension" || (import.name().as_bytes() == b"seal_call_chain_extension" ||
import.name().as_bytes() == b"call_chain_extension" import.name().as_bytes() == b"call_chain_extension")
{ {
return Err("Module uses chain extensions but chain extensions are disabled") return Err("Module uses chain extensions but chain extensions are disabled")
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment