Files
pezkuwi-subxt/substrate/frame/contracts/fixtures/data/ok_trap_revert.wat
T
PG Herveou 64effd0e6f 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
2023-11-10 13:22:47 +02:00

36 lines
959 B
WebAssembly Text Format

(module
(import "seal0" "seal_input" (func $seal_input (param i32 i32)))
(import "seal0" "seal_return" (func $seal_return (param i32 i32 i32)))
(import "env" "memory" (memory 1 1))
(func (export "deploy")
(call $ok_trap_revert)
)
(func (export "call")
(call $ok_trap_revert)
)
(func $ok_trap_revert
(i32.store (i32.const 4) (i32.const 4))
(call $seal_input (i32.const 0) (i32.const 4))
(block $IF_2
(block $IF_1
(block $IF_0
(br_table $IF_0 $IF_1 $IF_2
(i32.load8_u (i32.const 0))
)
(unreachable)
)
;; 0 = return with success
return
)
;; 1 = revert
(call $seal_return (i32.const 1) (i32.const 0) (i32.const 0))
(unreachable)
)
;; 2 = trap
(unreachable)
)
)