ongoing work on rust runner

This commit is contained in:
NikVolf
2017-05-12 14:22:58 +03:00
parent db28fe95b6
commit c93212f5f4
3 changed files with 19 additions and 18 deletions
+9 -9
View File
@@ -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
/// ???
// ???
}