mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
Contracts move fixtures to new crate (#2246)
Small PR that introduce a new crate that will host RISC-V & wasm fixtures for testing pallet-contracts
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
;; Stores a value of the passed size.
|
||||
(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 "env" "memory" (memory 16 16))
|
||||
|
||||
;; [0, 32) storage key
|
||||
(data (i32.const 0) "\01")
|
||||
|
||||
;; [32, 36) buffer where input is copied (expected size of storage item)
|
||||
|
||||
;; [36, 40) size of the input buffer
|
||||
(data (i32.const 36) "\04")
|
||||
|
||||
(func $assert (param i32)
|
||||
(block $ok
|
||||
(br_if $ok
|
||||
(get_local 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
|
||||
(func (export "call")
|
||||
(call $seal_input (i32.const 32) (i32.const 36))
|
||||
|
||||
;; assert input size == 4
|
||||
(call $assert
|
||||
(i32.eq
|
||||
(i32.load (i32.const 36))
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
|
||||
;; place a value in storage, the size of which is specified by the call input.
|
||||
;; we don't care about the contents of the storage item
|
||||
(call $seal_set_storage
|
||||
(i32.const 0) ;; Pointer to storage key
|
||||
(i32.const 0) ;; Pointer to value
|
||||
(i32.load (i32.const 32)) ;; Size of value
|
||||
)
|
||||
)
|
||||
|
||||
(func (export "deploy"))
|
||||
)
|
||||
Reference in New Issue
Block a user