If the destination account doesn't exist, then the host function should panic.
This behavior might change in case the Self Spawn feature is implemented.
Testing
Testing the Host Function in isolation
Under the svm-runtime there're tests that exercise the host functions without creating a full-blown SVM Runtime.
Add a new host function that will send coins from the current executing account to a destination account.
The host function should live under: https://github.com/spacemeshos/svm/tree/master/crates/runtime
Notes
AccountStorage
(wraps theGlobal State
): https://github.com/spacemeshos/svm/blob/master/crates/state/src/account_storage.rsSelf Spawn
feature is implemented.Testing
Testing the Host Function in isolation
Under the
svm-runtime
there're tests that exercise the host functions without creating a full-blown SVM Runtime.Here is the file containing such tests: https://github.com/spacemeshos/svm/blob/master/crates/runtime/tests/vmcalls_tests.rs
Now, in order to generate Wasm inputs for the tests, please look at the current ones: https://github.com/spacemeshos/svm/tree/master/crates/runtime/tests/wasm
Other Tests
Template
running within the SVM RuntimeThis is not a requirement for that issue. But it's something we'll want to have. One way to achieve that will be by extending this test:
https://github.com/spacemeshos/svm/blob/478d12fddfa87e6230a64010bfd3c0f24ad3164f/crates/runtime/tests/runtime_tests.rs#L311