-
Notifications
You must be signed in to change notification settings - Fork 14
Conversation
* refactoring `svm-storage2` tests
* renamed `AppSettings` to `Config`
They can't be used for now since wasmer doesn't support multi result values yet.
|
||
helpers::buffer_create(ctx.data, ARGS_BUF_ID, func_buf.len() as u32); | ||
let func_size = func_buf.len(); | ||
let view = &memory.view::<u8>()[0..func_size]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about bound checking for the memory size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not happen here.
when we allocate memory we know the size of the func_buf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you're currently don't check it there - do you mean that you will add that check later, or that you'll verify that func_buf
size is less than 1 page size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The
validate_template
will check thatfunc_buf
isn't big enough. - The
alloc_wasmer_memory
will have to allocate enough memory for the program to run.
I've added an issue: #140
@@ -458,7 +453,7 @@ where | |||
func_index | |||
} | |||
|
|||
fn prepare_args_and_memory(&self, tx: &AppTransaction) -> Vec<wasmer_runtime::Value> { | |||
fn prepare_func_args(&self, tx: &AppTransaction) -> Vec<wasmer_runtime::Value> { | |||
debug!("runtime `prepare_args_and_memory`"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prepare_args_and_memory
-> prepare_func_args
?
// 3) executing an app-transaction | ||
let func_idx = 1; | ||
let func_buf = vec![0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80]; | ||
let func_buf_ptr = WasmValue::I32(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give more explanations how this works (in conjunction with the runtime_func_buf.wast
code)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an idea of how to make it easier to understand.
I prefer to open a new PR that will add two new vmcalls (that we'll need)
and change the test to be easier
// is larger than the `func_buf`. | ||
// | ||
// Each wasm instance memory contains at least one `WASM Page`. (A `Page` size is 64KB) | ||
// The `len(func_buf)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not clear.
Motivation
This PR removes the
Buffer
primitive fromSVM
and uses plainWasm Memory
instead.Future PRs:
See also:
Allow configuration of default memory wasmerio/wasmer#1360