mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 15:41:02 +00:00
25de5b5c78
* Transition getter functions to not use scratch buffer * Remove scratch buffer from ext_get_storage * Remove scratch buffer from ext_call * Remove scratch buffer from ext_instantiate * Add ext_input and remove scratch buffer * Rework error handling (changes RPC exposed data) * ext_return passes a flags field instead of a return code * Flags is only for seal and not for the caller * flags: u32 replaced status_code: u8 in RPC exposed type * API functions use a unified error type (ReturnCode) * ext_transfer now traps on error to be consistent with call and instantiate * Remove the no longer used `Dispatched` event * Updated inline documentation * Prevent skipping of copying the output for getter API * Return gas_consumed from the RPC contracts call interface * Updated COMPLEXTITY.md * Rename ext_gas_price to ext_weight_to_fee * Align comments with spaces * Removed no longer used `ExecError` * Remove possible panic in `from_typed_value` * Use a struct as associated data for SpecialTrap::Return * Fix nits in COMPLEXITY.md * Renamed SpecialTrap to TrapReason * Fix test * Finish renaming special_trap -> trap_reason * Remove no longer used get_runtime_storage * fixup! Remove no longer used get_runtime_storage * Removed tabs for comment aligment
79 lines
1.7 KiB
WebAssembly Text Format
79 lines
1.7 KiB
WebAssembly Text Format
(module
|
|
(import "env" "ext_set_storage" (func $ext_set_storage (param i32 i32 i32)))
|
|
(import "env" "ext_input" (func $ext_input (param i32 i32)))
|
|
(import "env" "ext_restore_to"
|
|
(func $ext_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 $ext_input (i32.const 264) (i32.const 304))
|
|
(call $assert
|
|
(i32.eq
|
|
(i32.load (i32.const 304))
|
|
(i32.const 32)
|
|
)
|
|
)
|
|
|
|
(call $ext_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 $ext_set_storage
|
|
(i32.const 0)
|
|
(i32.const 0)
|
|
(i32.const 4)
|
|
)
|
|
|
|
;; ACL
|
|
(call $ext_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 ext_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")
|
|
)
|