Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
The previous assumption that the wasm-code was compiled with rustc mi…
…ght be wrong now, that the code comes from the blockchain. Added Notes about that.
  • Loading branch information
gnunicorn committed Jul 4, 2018
commit aa88a4554686df6783bfb3ba225c587e370afa37
4 changes: 3 additions & 1 deletion substrate/executor/src/wasm_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ impl WasmExecutor {
let memory = intermediate_instance
.not_started_instance()
.export_by_name("memory")
// TODO: with code coming from the blockchain it isn't strictly been compiled with rustc anymore.
// these assumptions are probably not true anymore
.expect("all modules compiled with rustc should have an export named 'memory'; qed")
.as_memory()
.expect("in module generated by rustc export named 'memory' should be a memory; qed")
Expand Down Expand Up @@ -537,7 +539,7 @@ impl CodeExecutor for WasmExecutor {
method: &str,
data: &[u8],
) -> Result<Vec<u8>> {
let module = Module::from_buffer(code).expect("all modules compiled with rustc are valid wasm code; qed");
let module = Module::from_buffer(code)?;
self.call_in_wasm_module(ext, &module, method, data)
}
}
Expand Down