mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
04b185e3d4
* 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
79 lines
1.7 KiB
WebAssembly Text Format
79 lines
1.7 KiB
WebAssembly Text Format
(module
|
|
(import "seal0" "seal_set_storage" (func $seal_set_storage (param i32 i32 i32)))
|
|
(import "seal0" "seal_input" (func $seal_input (param i32 i32)))
|
|
(import "seal0" "seal_restore_to"
|
|
(func $seal_restore_to
|
|
(param i32 i32 i32 i32 i32 i32 i32 i32)
|
|
)
|
|
)
|
|
(import "env" "memory" (memory 1 1))
|
|
|
|
(func $assert (param i32)
|
|
(block $ok
|
|
(br_if $ok
|
|
(get_local 0)
|
|
)
|
|
(unreachable)
|
|
)
|
|
)
|
|
|
|
(func (export "call")
|
|
;; copy code hash to contract memory
|
|
(call $seal_input (i32.const 264) (i32.const 304))
|
|
(call $assert
|
|
(i32.eq
|
|
(i32.load (i32.const 304))
|
|
(i32.const 32)
|
|
)
|
|
)
|
|
|
|
(call $seal_restore_to
|
|
;; Pointer and length of the encoded dest buffer.
|
|
(i32.const 256)
|
|
(i32.const 8)
|
|
;; Pointer and length of the encoded code hash buffer
|
|
(i32.const 264)
|
|
(i32.const 32)
|
|
;; Pointer and length of the encoded rent_allowance buffer
|
|
(i32.const 296)
|
|
(i32.const 8)
|
|
;; Pointer and number of items in the delta buffer.
|
|
;; This buffer specifies multiple keys for removal before restoration.
|
|
(i32.const 100)
|
|
(i32.const 1)
|
|
)
|
|
)
|
|
(func (export "deploy")
|
|
;; Data to restore
|
|
(call $seal_set_storage
|
|
(i32.const 0)
|
|
(i32.const 0)
|
|
(i32.const 4)
|
|
)
|
|
|
|
;; ACL
|
|
(call $seal_set_storage
|
|
(i32.const 100)
|
|
(i32.const 0)
|
|
(i32.const 4)
|
|
)
|
|
)
|
|
|
|
;; Data to restore
|
|
(data (i32.const 0) "\28")
|
|
|
|
;; Buffer that has ACL storage keys.
|
|
(data (i32.const 100) "\01")
|
|
|
|
;; Address of bob
|
|
(data (i32.const 256) "\02\00\00\00\00\00\00\00")
|
|
|
|
;; [264, 296) Code hash of SET_RENT (copied here by seal_input)
|
|
|
|
;; [296, 304) Rent allowance
|
|
(data (i32.const 296) "\32\00\00\00\00\00\00\00")
|
|
|
|
;; [304, 308) Size of SET_RENT buffer
|
|
(data (i32.const 304) "\20")
|
|
)
|