Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Only native host functions #268

Merged
merged 5 commits into from
Jul 13, 2021
Merged

Conversation

YaronWittenstein
Copy link
Contributor

@YaronWittenstein YaronWittenstein commented Jul 11, 2021

The executed SVM-flavored Wasm has imports of function kind.
New kinds of imports (such as Memory/Table/Global) are not expected to be used in the foreseeable future.

The functions imports are grouped into:

SVM Internals:

These host functions deal primarily with managing the Account storage.
The internals are SVM specific and are Node-agnostic.

The internals will be clustered under the svm namespace.

SVM Externals

Here we can inject upon Runtime initialization a functionality that is Node-aware.
It will include features such as:

  • get_balance - asking for the current executed Account balance
  • transfer - sending coins from the current Account to another Account

The externals will be clustered under the sm namespace.

This design should make it easier for other Blockchains to integrate with SVM.
The only requirement is that integrating Blockchain Node will provide functions written in Rust.
(and have a type signature abiding to the Wasmer native host function with env).

Notes:

  • This PR didn't tackle the #[ignore] tests under the runtime-ffi crate.
  • The externals of SVM will be added incrementally. Most of them will talk directly to the upcoming Global-State written in Rust.
  • While working on the code I've started using Account replacing App (see Replacing the term App with Account #264) and did some refactoring along the way.

Depends on:

@YaronWittenstein YaronWittenstein self-assigned this Jul 11, 2021
@YaronWittenstein YaronWittenstein added this to the July 5 Sprint milestone Jul 11, 2021
@YaronWittenstein YaronWittenstein added go-svm Features required for the go-svm or other clients svm svm-c-api SVM C API svm-core SVM core change v0.3 labels Jul 11, 2021
@YaronWittenstein YaronWittenstein marked this pull request as ready for review July 13, 2021 10:34
crates/runtime/src/runtime/config.rs Outdated Show resolved Hide resolved
@YaronWittenstein YaronWittenstein merged commit 1ae86f1 into master Jul 13, 2021
@YaronWittenstein YaronWittenstein deleted the only-native-host-functions branch July 13, 2021 18:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go-svm Features required for the go-svm or other clients svm svm-c-api SVM C API svm-core SVM core change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants