spacemeshos / svm

SVM - Spacemesh Virtual Machine
https://spacemesh.io
MIT License
85 stars 14 forks source link

SDK adapt the original host functions related to the obsolete "sm" namespace #445

Open YaronWittenstein opened 2 years ago

YaronWittenstein commented 2 years ago

This PR refers to this piece of code: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/sdk-host-ffi/src/ext.rs#L47-L71

As you can see, the SDK expects part of the host functions to sit under the "sm" namespace when importing them. This design is a relic of the times before moving the Global State to sit under the Rustland.

The Runtime doesn't expect any external functions imports as a dependency anymore with the new design. It means that each host function used is intrinsic to SVM and sits under the svm namespace.

Here is where we register the imports functions before running the Wasm code: https://github.com/spacemeshos/svm/blob/6edb73de199fafce0953f82af061ca1090ff911c/crates/runtime/src/runtime/runtime.rs#L298

So we need to decide what to do with each of the current host functions obsolete definitions under svm-sdk-ffi

Note

Each host function we'll decide to implement inside SVM should be renamed to be prefixed as svm_ and not sm_. (as explained above - we no longer support the sm or any other external imports).