From f37ae44a1c10aa8b406a6f675afddf91261c6b5b Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Tue, 29 Oct 2024 19:21:06 +0400 Subject: [PATCH] keep storing table for sc executor --- .../executor/wasmtime/src/instance_wrapper.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/substrate/client/executor/wasmtime/src/instance_wrapper.rs b/substrate/client/executor/wasmtime/src/instance_wrapper.rs index cfab9dc82a39..562c27899c58 100644 --- a/substrate/client/executor/wasmtime/src/instance_wrapper.rs +++ b/substrate/client/executor/wasmtime/src/instance_wrapper.rs @@ -104,8 +104,10 @@ impl InstanceWrapper { })?; let memory = get_linear_memory(&instance, &mut store)?; + let table = get_table(&instance, &mut store); store.data_mut().memory = Some(memory); + store.data_mut().table = table; Ok(InstanceWrapper { instance, store, _release_instance_handle }) } @@ -181,6 +183,17 @@ fn get_linear_memory(instance: &Instance, ctx: impl AsContextMut) -> Result Option { + instance + .get_export(ctx, "__indirect_function_table") + .as_ref() + .cloned() + .and_then(Extern::into_table) +} + + /// Functions related to memory. impl InstanceWrapper { pub(crate) fn store(&self) -> &Store {