Files
pezkuwi-subxt/substrate/frame/contracts/fixtures/restoration.wat
T
Alexander Theißen 0cccd282a1 contracts: Remove weight pre charging (#8976)
* Remove pre-charging for code size

* Remove pre charging when reading values of fixed size

* Add new versions of API functions that leave out parameters

* Update CHANGELOG.md

* Apply suggestions from code review

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Add v1 for seal_set_rent_allowance

* Remove unneeded trait bound

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-06-25 16:27:01 +00:00

73 lines
1.6 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 "seal1" "seal_restore_to"
(func $seal_restore_to
(param 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 308) (i32.const 304))
(call $assert
(i32.eq
(i32.load (i32.const 304))
(i32.const 64)
)
)
(call $seal_restore_to
;; Pointer to the encoded dest buffer.
(i32.const 340)
;; Pointer to the encoded code hash buffer
(i32.const 308)
;; Pointer to the encoded rent_allowance buffer
(i32.const 296)
;; 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")
;; [296, 304) Rent allowance
(data (i32.const 296) "\32\00\00\00\00\00\00\00")
;; [304, 308) Size of the buffer that holds code_hash + addr
(data (i32.const 304) "\40")
;; [308, 340) code hash of bob (copied by seal_input)
;; [340, 372) addr of bob (copied by seal_input)
)