contracts: Run start function (#1367)

Fixes #116 

Start function wasn't allowed in a contract. Now it is allowed and is
being run.

It was disallowed because it is not used by Rust and supporting it made
the code more complex. However, not running the start function violates
the wasm standard. This makes life harder for some languages (see linked
ticket).
This commit is contained in:
Alexander Theißen authored and GitHub committed 2023-09-11 22:45:18 +02:00
1 parent 44dbb73945
commit c879d1d582
6 files changed
+197 -171

No files matched your search

@@ -58,7 +58,13 @@ impl<T: Config> From<&WasmModule<T>> for Sandbox {
.add_fuel(u64::MAX)
.expect("We've set up engine to fuel consuming mode; qed");
let entry_point = instance.get_export(&store, "call").unwrap().into_func().unwrap();
let entry_point = instance
.start(&mut store)
.unwrap()
.get_export(&store, "call")
.unwrap()
.into_func()
.unwrap();
Self { entry_point, store }
}
}