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
+12 -12
View File
@@ -1,14 +1,14 @@
(module
(import "env" "ext_transfer" (func $ext_transfer (param i32 i32 i32 i32) (result i32)))
(import "env" "ext_set_storage" (func $ext_set_storage (param i32 i32 i32)))
(import "env" "ext_clear_storage" (func $ext_clear_storage (param i32)))
(import "env" "ext_set_rent_allowance" (func $ext_set_rent_allowance (param i32 i32)))
(import "env" "ext_input" (func $ext_input (param i32 i32)))
(import "seal0" "seal_transfer" (func $seal_transfer (param i32 i32 i32 i32) (result i32)))
(import "seal0" "seal_set_storage" (func $seal_set_storage (param i32 i32 i32)))
(import "seal0" "seal_clear_storage" (func $seal_clear_storage (param i32)))
(import "seal0" "seal_set_rent_allowance" (func $seal_set_rent_allowance (param i32 i32)))
(import "seal0" "seal_input" (func $seal_input (param i32 i32)))
(import "env" "memory" (memory 1 1))
;; insert a value of 4 bytes into storage
(func $call_0
(call $ext_set_storage
(call $seal_set_storage
(i32.const 1)
(i32.const 0)
(i32.const 4)
@@ -17,7 +17,7 @@
;; remove the value inserted by call_1
(func $call_1
(call $ext_clear_storage
(call $seal_clear_storage
(i32.const 1)
)
)
@@ -26,7 +26,7 @@
(func $call_2
(call $assert
(i32.eq
(call $ext_transfer (i32.const 68) (i32.const 8) (i32.const 76) (i32.const 8))
(call $seal_transfer (i32.const 68) (i32.const 8) (i32.const 76) (i32.const 8))
(i32.const 0)
)
)
@@ -48,7 +48,7 @@
(func (export "call")
(local $input_size i32)
(i32.store (i32.const 64) (i32.const 64))
(call $ext_input (i32.const 1024) (i32.const 64))
(call $seal_input (i32.const 1024) (i32.const 64))
(set_local $input_size
(i32.load (i32.const 64))
)
@@ -76,16 +76,16 @@
;; Set into storage a 4 bytes value
;; Set call set_rent_allowance with input
(func (export "deploy")
(call $ext_set_storage
(call $seal_set_storage
(i32.const 0)
(i32.const 0)
(i32.const 4)
)
(call $ext_input
(call $seal_input
(i32.const 0)
(i32.const 64)
)
(call $ext_set_rent_allowance
(call $seal_set_rent_allowance
(i32.const 0)
(i32.load (i32.const 64))
)