-
Notifications
You must be signed in to change notification settings - Fork 14
Conversation
* Implemented `getters` & `setters` for primitives
…ress` (a thin wrapper around `*const u8`).
6ac6542
to
bd61e4b
Compare
crates/svm-sdk/src/host/ext.rs
Outdated
|
||
/// ### `offset` meaning in this file: | ||
/// | ||
/// The parameter `offset here denotes a memory address integer serving as a pointer to a cell to the current |
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 closing backtick for offset
is missing.
crates/svm-sdk/src/host/ext.rs
Outdated
|
||
/// ### `offset` meaning in this file: | ||
/// | ||
/// The parameter `offset here denotes a memory address integer serving as a pointer to a cell to the current |
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.
"pointer to a cell to the current" -> "pointer to a cell within the current"?
crates/svm-sdk/src/host/ext.rs
Outdated
|
||
/// Signals to SVM that the current running transaction output (a.k.a `returndata`) | ||
/// lays out in memory starting from offset `offset` and its byte-length is `length`. | ||
fn svm_returndata(offset: u32, length: u32); |
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 specify the expected behaviour in case the program fails to call it?
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.
ok
|
||
/// Sends to SVM the logging message that starts | ||
/// at memory offset `offset` (of byte-length `length`) | ||
/// and it's associated message code (for signaling errors severity such as `trace/info/error` etc.) |
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.
Are the message codes / log levels values already defined?
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 don't think we need to restrict it here.
I think that each app can come up with its own error codes.
crates/svm-sdk/src/host/ext.rs
Outdated
/// | ||
/// If other blockchain projects will want to take SVM and use it for their purposes then they | ||
/// should bring their own `host imports`. | ||
#[link(wasm_import_module = "host")] |
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.
Since you already defined the imports as Spacemesh-specific, perhaps also consider importing them as sm
/spacemesh
instead of host
.
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.
good idea
crates/svm-sdk/src/host/ext.rs
Outdated
|
||
/// Signals to SVM that the current running transaction output (a.k.a `returndata`) | ||
/// lays out in memory starting from offset `offset` and its byte-length is `length`. | ||
fn svm_returndata(offset: u32, length: u32); |
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.
Calling it svm_set_returndata
, same as in the Host
trait, will make more sense.
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.
np (I thought it'll be nicer to keep it short but not critical)
crates/svm-sdk/src/host/ext.rs
Outdated
/// Its methods delegate work to the singleton `InnerHost` instance | ||
/// which also implements the `Host` trait and contains the actual implementation of the `Host` trait. | ||
/// | ||
/// In order to get access to this singleton instance one the API user should use `ExtHost::instance()` |
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.
"singleton instance one the API" - redundant word?
Motivation
Ergonomic API to be used when implementing Apps in Rust (for example - in upcoming Vault app).
Removed the
Host Context
(mapping between host fields indexes to blobs),instead, the Host (i.e
go-spacemesh
) will inject these fields as imports to SVM.For example: if SVM running app will want to know its
sender
addressit will call an imported function named:
host_sender
(under wasm namespacehost
).Mock Host API implementation.
Testing the external Host API (
ExtHost
) will be done when testing the Vault app.