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
@@ -1,9 +1,9 @@
(module
(import "env" "ext_input" (func $ext_input (param i32 i32)))
(import "env" "ext_balance" (func $ext_balance (param i32 i32)))
(import "env" "ext_call" (func $ext_call (param i32 i32 i64 i32 i32 i32 i32 i32 i32) (result i32)))
(import "env" "ext_instantiate" (func $ext_instantiate (param i32 i32 i64 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
(import "env" "ext_println" (func $ext_println (param i32 i32)))
(import "seal0" "seal_input" (func $seal_input (param i32 i32)))
(import "seal0" "seal_balance" (func $seal_balance (param i32 i32)))
(import "seal0" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32 i32) (result i32)))
(import "seal0" "seal_instantiate" (func $seal_instantiate (param i32 i32 i64 i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
(import "seal0" "seal_println" (func $seal_println (param i32 i32)))
(import "env" "memory" (memory 1 1))
(func $assert (param i32)
@@ -20,7 +20,7 @@
(i32.sub (get_local $sp) (i32.const 16))
(i32.const 8)
)
(call $ext_balance
(call $seal_balance
(i32.sub (get_local $sp) (i32.const 8))
(i32.sub (get_local $sp) (i32.const 16))
)
@@ -41,7 +41,7 @@
(i32.store (i32.const 20) (i32.const 32))
;; Copy input to this contracts memory
(call $ext_input (i32.const 24) (i32.const 20))
(call $seal_input (i32.const 24) (i32.const 20))
;; Input data is the code hash of the contract to be deployed.
(call $assert
@@ -59,7 +59,7 @@
;; Fail to deploy the contract since it returns a non-zero exit status.
(set_local $exit_code
(call $ext_instantiate
(call $seal_instantiate
(i32.const 24) ;; Pointer to the code hash.
(i32.const 32) ;; Length of the code hash.
(i64.const 0) ;; How much gas to devote for the execution. 0 = all.
@@ -86,7 +86,7 @@
;; Fail to deploy the contract due to insufficient gas.
(set_local $exit_code
(call $ext_instantiate
(call $seal_instantiate
(i32.const 24) ;; Pointer to the code hash.
(i32.const 32) ;; Length of the code hash.
(i64.const 187500000) ;; Just enough to pay for the instantiate
@@ -119,7 +119,7 @@
;; Deploy the contract successfully.
(set_local $exit_code
(call $ext_instantiate
(call $seal_instantiate
(i32.const 24) ;; Pointer to the code hash.
(i32.const 32) ;; Length of the code hash.
(i64.const 0) ;; How much gas to devote for the execution. 0 = all.
@@ -167,7 +167,7 @@
;; Call the new contract and expect it to return failing exit code.
(set_local $exit_code
(call $ext_call
(call $seal_call
(i32.const 16) ;; Pointer to "callee" address.
(i32.const 8) ;; Length of "callee" address.
(i64.const 0) ;; How much gas to devote for the execution. 0 = all.
@@ -203,7 +203,7 @@
;; Fail to call the contract due to insufficient gas.
(set_local $exit_code
(call $ext_call
(call $seal_call
(i32.const 16) ;; Pointer to "callee" address.
(i32.const 8) ;; Length of "callee" address.
(i64.const 117500000) ;; Just enough to make the call
@@ -240,7 +240,7 @@
;; Call the contract successfully.
(set_local $exit_code
(call $ext_call
(call $seal_call
(i32.const 16) ;; Pointer to "callee" address.
(i32.const 8) ;; Length of "callee" address.
(i64.const 0) ;; How much gas to devote for the execution. 0 = all.