mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-06-13 11:41:10 +00:00
ongoing work on rust runner
This commit is contained in:
@@ -11,10 +11,10 @@ mod alloc;
|
||||
mod storage;
|
||||
|
||||
use std::env;
|
||||
use parity_wasm::interpreter::ModuleInstanceInterface;
|
||||
|
||||
fn main() {
|
||||
/// First, load wasm contract as a module
|
||||
|
||||
// First, load wasm contract as a module
|
||||
wasm_utils::init_log();
|
||||
|
||||
let args = env::args().collect::<Vec<_>>();
|
||||
@@ -25,17 +25,17 @@ fn main() {
|
||||
|
||||
let module = parity_wasm::deserialize_file(&args[1]).expect("Module deserialization to succeed");
|
||||
|
||||
/// Second, create program instance
|
||||
// Second, create program instance
|
||||
let program = parity_wasm::interpreter::ProgramInstance::new().expect("Program instance to be created");
|
||||
|
||||
/// Add module to the programm
|
||||
program.add_module("contract", module);
|
||||
// Add module to the programm
|
||||
let module_instance = program.add_module("contract", module).expect("Module to be added successfully");
|
||||
|
||||
/// Create allocator
|
||||
// Create allocator
|
||||
let mut allocator = alloc::Arena::new(5*1024*1024);
|
||||
|
||||
// Invoke _call method of the module
|
||||
module_instance.execute_export("_call", vec![]).expect("_call to execute successfully");
|
||||
|
||||
/// Invoke _call method of the module
|
||||
|
||||
/// ???
|
||||
// ???
|
||||
}
|
||||
Reference in New Issue
Block a user