Skip to content

Add runtime checks in get_inputs test to check expected inputs on the Rust side #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 120 additions & 3 deletions tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,127 @@
;; Functions
(func (export #entrypoint) (param i32)
(block 0 (param v0 i32)
(call #miden_tx_kernel_sys::get_inputs v0)
(br (block 1)))
(let (v1 i32) (const.i32 0))
(let (v2 i32) (global.load i32 (global.symbol #__stack_pointer)))
(let (v3 i32) (const.i32 16))
(let (v4 i32) (sub.wrapping v2 v3))
(let (v5 (ptr i32)) (global.symbol #__stack_pointer))
(store v5 v4)
(let (v6 i32) (const.i32 4))
(let (v7 i32) (add.wrapping v4 v6))
(call #miden_tx_kernel_sys::get_inputs v7)
(let (v8 u32) (cast v4))
(let (v9 u32) (add.checked v8 12))
(let (v10 u32) (mod.unchecked v9 2))
(assertz v10)
(let (v11 (ptr i32)) (inttoptr v9))
(let (v12 i32) (load v11))
(let (v13 i1) (eq v12 0))
(let (v14 i32) (zext v13))
(let (v15 i1) (neq v14 0))
(condbr v15 (block 2) (block 3)))

(block 1
(block 1)

(block 2
(unreachable))

(block 3
(let (v16 u32) (cast v4))
(let (v17 u32) (add.checked v16 8))
(let (v18 u32) (mod.unchecked v17 2))
(assertz v18)
(let (v19 (ptr i32)) (inttoptr v17))
(let (v20 i32) (load v19))
(let (v21 u32) (cast v20))
(let (v22 u32) (mod.unchecked v21 2))
(assertz v22)
(let (v23 (ptr felt)) (inttoptr v21))
(let (v24 felt) (load v23))
(let (v25 i64) (const.i64 4294967295))
(let (v26 felt) (cast v25))
(assert.eq v26 v24)
(let (v27 i32) (const.i32 1))
(let (v28 i1) (eq v12 v27))
(let (v29 i32) (zext v28))
(let (v30 i1) (neq v29 0))
(condbr v30 (block 2) (block 4)))

(block 4
(let (v31 u32) (cast v20))
(let (v32 u32) (add.checked v31 4))
(let (v33 u32) (mod.unchecked v32 2))
(assertz v33)
(let (v34 (ptr felt)) (inttoptr v32))
(let (v35 felt) (load v34))
(let (v36 i64) (const.i64 1))
(let (v37 felt) (cast v36))
(assert.eq v37 v35)
(let (v38 i32) (const.i32 2))
(let (v39 u32) (bitcast v12))
(let (v40 u32) (bitcast v38))
(let (v41 i1) (lte v39 v40))
(let (v42 i32) (sext v41))
(let (v43 i1) (neq v42 0))
(condbr v43 (block 2) (block 5)))

(block 5
(let (v44 u32) (cast v20))
(let (v45 u32) (add.checked v44 8))
(let (v46 u32) (mod.unchecked v45 2))
(assertz v46)
(let (v47 (ptr felt)) (inttoptr v45))
(let (v48 felt) (load v47))
(let (v49 i64) (const.i64 0))
(let (v50 felt) (cast v49))
(assert.eq v50 v48)
(let (v51 i32) (const.i32 3))
(let (v52 i1) (eq v12 v51))
(let (v53 i32) (zext v52))
(let (v54 i1) (neq v53 0))
(condbr v54 (block 2) (block 6)))

(block 6
(let (v55 u32) (cast v20))
(let (v56 u32) (add.checked v55 12))
(let (v57 u32) (mod.unchecked v56 2))
(assertz v57)
(let (v58 (ptr felt)) (inttoptr v56))
(let (v59 felt) (load v58))
(let (v60 i64) (const.i64 4294967295))
(let (v61 felt) (cast v60))
(assert.eq v61 v59)
(let (v62 i32) (const.i32 8))
(let (v63 i32) (add.wrapping v0 v62))
(let (v64 i32) (const.i32 4))
(let (v65 i32) (add.wrapping v4 v64))
(let (v66 i32) (const.i32 8))
(let (v67 i32) (add.wrapping v65 v66))
(let (v68 u32) (cast v67))
(let (v69 u32) (mod.unchecked v68 2))
(assertz v69)
(let (v70 (ptr i32)) (inttoptr v68))
(let (v71 i32) (load v70))
(let (v72 u32) (cast v63))
(let (v73 u32) (mod.unchecked v72 2))
(assertz v73)
(let (v74 (ptr i32)) (inttoptr v72))
(store v74 v71)
(let (v75 u32) (cast v4))
(let (v76 u32) (add.checked v75 4))
(let (v77 u32) (mod.unchecked v76 2))
(assertz v77)
(let (v78 (ptr i64)) (inttoptr v76))
(let (v79 i64) (load v78))
(let (v80 u32) (cast v0))
(let (v81 u32) (mod.unchecked v80 2))
(assertz v81)
(let (v82 (ptr i64)) (inttoptr v80))
(store v82 v79)
(let (v83 i32) (const.i32 16))
(let (v84 i32) (add.wrapping v4 v83))
(let (v85 (ptr i32)) (global.symbol #__stack_pointer))
(store v85 v84)
(ret))
)

Expand Down
Loading
Loading