seal: Change prefix and module name from "ext_" to "seal_" for contract callable functions (#6798)

* seal: Change prefix "ext_" to "seal_" for contract callable functions

The word Ext is a overloaded term in the context of substrate. It usually
is a trait which abstracts away access to external resources usually in order
to mock them away for the purpose of tests. The contract module has its own
`Ext` trait in addition the the substrate `Ext` which makes things even more
confusing.

In order to differentiate the contract callable functions more clearly from
this `Ext` concept we rename them to use the "seal_" prefix instead.

This should change no behaviour at all. This is a pure renaming commit.

* seal: Rename import module from "env" to "seal0"

* seal: Fixup integration test

* seal: Add more tests for new import module names
This commit is contained in:
Alexander Theißen
2020-08-10 15:14:34 +02:00
committed by GitHub
parent f9f8262303
commit 04b185e3d4
29 changed files with 355 additions and 303 deletions
+5 -5
View File
@@ -1,9 +1,9 @@
(module
(import "env" "ext_balance" (func $ext_balance (param i32 i32)))
(import "env" "ext_transfer" (func $ext_transfer (param i32 i32 i32 i32) (result i32)))
(import "seal0" "seal_balance" (func $seal_balance (param i32 i32)))
(import "seal0" "seal_transfer" (func $seal_transfer (param i32 i32 i32 i32) (result i32)))
(import "env" "memory" (memory 1 1))
;; [0, 8) reserved for $ext_balance output
;; [0, 8) reserved for $seal_balance output
;; [8, 16) length of the buffer
(data (i32.const 8) "\08")
@@ -23,7 +23,7 @@
(func (export "call")
;; Send entire remaining balance to the 0 address.
(call $ext_balance (i32.const 0) (i32.const 8))
(call $seal_balance (i32.const 0) (i32.const 8))
;; Balance should be encoded as a u64.
(call $assert
@@ -36,7 +36,7 @@
;; Self-destruct by sending full balance to the 0 address.
(call $assert
(i32.eq
(call $ext_transfer
(call $seal_transfer
(i32.const 16) ;; Pointer to destination address
(i32.const 8) ;; Length of destination address
(i32.const 0) ;; Pointer to the buffer with value to transfer