[contracts] API host functions: remove seal_ name prefix + enable aliasing (#12126)

* works but ugly

* refactored + renamed host fns

* fixed tests

* fix benchmarks

* updated marco docs

* Update frame/contracts/proc-macro/src/lib.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* fix for the duplicated prefixed alias bug + test

* refactored a bit

* fix warnings + try to make macro rustdoc compile

* fmt after clearing

* examples update + nocompile

* add seal_ prefixes to unstable host functions

* updated after a review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
This commit is contained in:
Sasha Gryaznov
2022-09-07 11:54:17 +03:00
committed by GitHub
parent 56e536f6e8
commit d8e9fff3e4
5 changed files with 262 additions and 162 deletions
@@ -1,6 +1,6 @@
;; This passes its input to `seal_call_runtime` and returns the return value to its caller.
(module
(import "__unstable__" "seal_call_runtime" (func $seal_call_runtime (param i32 i32) (result i32)))
(import "__unstable__" "call_runtime" (func $call_runtime (param i32 i32) (result i32)))
(import "seal0" "seal_input" (func $seal_input (param i32 i32)))
(import "seal0" "seal_return" (func $seal_return (param i32 i32 i32)))
(import "env" "memory" (memory 1 1))
@@ -17,7 +17,7 @@
)
;; Just use the call passed as input and store result to memory
(i32.store (i32.const 0)
(call $seal_call_runtime
(call $call_runtime
(i32.const 4) ;; Pointer where the call is stored
(i32.load (i32.const 0)) ;; Size of the call
)