spacemeshos / svm

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

Implement the `svm_transfer` host function #406

Closed YaronWittenstein closed 2 years ago

YaronWittenstein commented 2 years ago

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

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

This 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

neysofu commented 2 years ago

Closed by #419.