Skip to content

Commit

Permalink
adding dryrun trace test and expected app trace (#161)
Browse files Browse the repository at this point in the history
* adding dryrun trace test and expected app trace

* adding protocol-version to dryrunResponse objects

* changed the format

* Adding more descriptive given

* adding large dryrun, change format

* Update features/unit/dryrun_trace.feature

Co-authored-by: Zeph Grunschlag <[email protected]>

* Update features/unit/dryrun_trace.feature

Co-authored-by: Zeph Grunschlag <[email protected]>

* Update features/unit/dryrun_trace.feature

Co-authored-by: Zeph Grunschlag <[email protected]>

* adding dryrun for error condition

* add the error trace to the scenarios

* adding unit name to readme table, fmt example table

* rm extra lines

Co-authored-by: Zeph Grunschlag <[email protected]>
  • Loading branch information
barnjamin and tzaffi authored Mar 21, 2022
1 parent 6bcf846 commit f3ec8a5
Show file tree
Hide file tree
Showing 9 changed files with 10,461 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ These reside in the [unit features directory](features/unit)
| @unit.transactions | Transaction encoding tests. |
| @unit.transactions.keyreg | Keyreg encoding tests. |
| @unit.transactions.payment | Payment encoding tests. |
| @unit.dryrun.trace.application | DryrunResult formatting tests. |

### Integration Tests

Expand Down
17 changes: 17 additions & 0 deletions features/resources/v2algodclient_responsejsons/app_trace.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pc# |ln# |source |scratch |stack
1 |1 |intcblock 0 4 1 5 2 | |[]
8 |2 |bytecblock 0x43726561746f72 0x... | |[]
72 |3 |intc_0 | |[]
73 |4 |txn ApplicationID | |[0]
75 |5 |== | |[0, 0]
76 |6 |bz label1 | |[1]
79 |7 |bytec_0 | |[]
80 |8 |txn Sender | |[0x43726561746f72]
82 |9 |app_global_put | |[0x43726561746f72, 0xa01e926fb...
83 |10 |txn NumAppArgs | |[]
85 |11 |intc_1 | |[0]
86 |12 |== | |[0, 4]
87 |13 |bz label2 | |[0]
311 |163 |intc_0 | |[]
312 |164 |return | |[0]
315 |168 | | |[0]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"error":"","txns":[{"app-call-messages":["ApprovalProgram","REJECT"],"app-call-trace":[{"line":1,"pc":1,"stack":[]},{"line":2,"pc":8,"stack":[]},{"line":3,"pc":72,"stack":[]},{"line":4,"pc":73,"stack":[{"bytes":"","type":2,"uint":0}]},{"line":5,"pc":75,"stack":[{"bytes":"","type":2,"uint":0},{"bytes":"","type":2,"uint":0}]},{"line":6,"pc":76,"stack":[{"bytes":"","type":2,"uint":1}]},{"line":7,"pc":79,"stack":[]},{"line":8,"pc":80,"stack":[{"bytes":"Q3JlYXRvcg==","type":1,"uint":0}]},{"line":9,"pc":82,"stack":[{"bytes":"Q3JlYXRvcg==","type":1,"uint":0},{"bytes":"oB6Sb71Xwm/GFWTy634W4gWUkQLccmwbq5Hz7qvLE0o=","type":1,"uint":0}]},{"line":10,"pc":83,"stack":[]},{"line":11,"pc":85,"stack":[{"bytes":"","type":2,"uint":0}]},{"line":12,"pc":86,"stack":[{"bytes":"","type":2,"uint":0},{"bytes":"","type":2,"uint":4}]},{"line":13,"pc":87,"stack":[{"bytes":"","type":2,"uint":0}]},{"line":163,"pc":311,"stack":[]},{"line":164,"pc":312,"stack":[{"bytes":"","type":2,"uint":0}]},{"line":168,"pc":315,"stack":[{"bytes":"","type":2,"uint":0}]}],"disassembly":["// version 2","intcblock 0 4 1 5 2","bytecblock 0x43726561746f72 0x526567426567696e 0x526567456e64 0x566f7465426567696e 0x566f7465456e64 0x7265676973746572 0x766f7465 0x766f746564","intc_0","txn ApplicationID","==","bz label1","bytec_0","txn Sender","app_global_put","txn NumAppArgs","intc_1","==","bz label2","bytec_1","txn ApplicationArgs 0","btoi","app_global_put","bytec_2","txn ApplicationArgs 1","btoi","app_global_put","bytec_3","txn ApplicationArgs 2","btoi","app_global_put","bytec 4","txn ApplicationArgs 3","btoi","app_global_put","intc_2","return","label1:","intc_3","txn OnCompletion","==","bz label3","bytec_0","app_global_get","txn Sender","==","bz label2","intc_2","return","label3:","intc_1","txn OnCompletion","==","bz label4","bytec_0","app_global_get","txn Sender","==","bz label2","intc_2","return","label4:","intc 4","txn OnCompletion","==","bnz label5","txn ApplicationArgs 0","bytec 5","==","bnz label6","txn ApplicationArgs 0","bytec 6","==","bnz label7","intc_0","return","label7:","global Round","bytec_3","app_global_get","\u003e=","global Round","bytec 4","app_global_get","\u003c=","\u0026\u0026","bz label2","intc_0","txn ApplicationID","app_opted_in","bz label2","intc_0","txn ApplicationID","bytec 7","app_local_get","bnz label8","txn ApplicationID","txn ApplicationArgs 1","app_global_get_ex","bnz label9","pop","intc_0","label9:","intc_2","+","store 1","txn ApplicationArgs 1","load 1","app_global_put","intc_0","bytec 7","txn ApplicationArgs 1","app_local_put","intc_2","return","label8:","pop","intc_2","return","label6:","global Round","bytec_1","app_global_get","\u003e=","global Round","bytec_2","app_global_get","\u003c=","\u0026\u0026","bz label2","intc_2","return","label5:","global Round","bytec 4","app_global_get","\u003e","bnz label10","intc_0","txn ApplicationID","bytec 7","app_local_get_ex","bnz label11","pop","intc_2","return","label11:","store 1","txn ApplicationID","load 1","app_global_get_ex","store 3","store 4","load 3","bnz label12","intc_2","return","label12:","load 4","intc_2","-","store 2","load 1","load 2","app_global_put","intc_2","return","label2:","intc_0","return","label10:","intc_2","return",""],"global-delta":[{"key":"Creator","value":{"action":2,"bytes":"oB6Sb71Xwm/GFWTy634W4gWUkQLccmwbq5Hz7qvLE0o=","uint":0}}]}]}
{"error":"","protocol-version":"future","txns":[{"app-call-messages":["ApprovalProgram","REJECT"],"app-call-trace":[{"line":1,"pc":1,"stack":[]},{"line":2,"pc":8,"stack":[]},{"line":3,"pc":72,"stack":[]},{"line":4,"pc":73,"stack":[{"bytes":"","type":2,"uint":0}]},{"line":5,"pc":75,"stack":[{"bytes":"","type":2,"uint":0},{"bytes":"","type":2,"uint":0}]},{"line":6,"pc":76,"stack":[{"bytes":"","type":2,"uint":1}]},{"line":7,"pc":79,"stack":[]},{"line":8,"pc":80,"stack":[{"bytes":"Q3JlYXRvcg==","type":1,"uint":0}]},{"line":9,"pc":82,"stack":[{"bytes":"Q3JlYXRvcg==","type":1,"uint":0},{"bytes":"oB6Sb71Xwm/GFWTy634W4gWUkQLccmwbq5Hz7qvLE0o=","type":1,"uint":0}]},{"line":10,"pc":83,"stack":[]},{"line":11,"pc":85,"stack":[{"bytes":"","type":2,"uint":0}]},{"line":12,"pc":86,"stack":[{"bytes":"","type":2,"uint":0},{"bytes":"","type":2,"uint":4}]},{"line":13,"pc":87,"stack":[{"bytes":"","type":2,"uint":0}]},{"line":163,"pc":311,"stack":[]},{"line":164,"pc":312,"stack":[{"bytes":"","type":2,"uint":0}]},{"line":168,"pc":315,"stack":[{"bytes":"","type":2,"uint":0}]}],"disassembly":["// version 2","intcblock 0 4 1 5 2","bytecblock 0x43726561746f72 0x526567426567696e 0x526567456e64 0x566f7465426567696e 0x566f7465456e64 0x7265676973746572 0x766f7465 0x766f746564","intc_0","txn ApplicationID","==","bz label1","bytec_0","txn Sender","app_global_put","txn NumAppArgs","intc_1","==","bz label2","bytec_1","txn ApplicationArgs 0","btoi","app_global_put","bytec_2","txn ApplicationArgs 1","btoi","app_global_put","bytec_3","txn ApplicationArgs 2","btoi","app_global_put","bytec 4","txn ApplicationArgs 3","btoi","app_global_put","intc_2","return","label1:","intc_3","txn OnCompletion","==","bz label3","bytec_0","app_global_get","txn Sender","==","bz label2","intc_2","return","label3:","intc_1","txn OnCompletion","==","bz label4","bytec_0","app_global_get","txn Sender","==","bz label2","intc_2","return","label4:","intc 4","txn OnCompletion","==","bnz label5","txn ApplicationArgs 0","bytec 5","==","bnz label6","txn ApplicationArgs 0","bytec 6","==","bnz label7","intc_0","return","label7:","global Round","bytec_3","app_global_get","\u003e=","global Round","bytec 4","app_global_get","\u003c=","\u0026\u0026","bz label2","intc_0","txn ApplicationID","app_opted_in","bz label2","intc_0","txn ApplicationID","bytec 7","app_local_get","bnz label8","txn ApplicationID","txn ApplicationArgs 1","app_global_get_ex","bnz label9","pop","intc_0","label9:","intc_2","+","store 1","txn ApplicationArgs 1","load 1","app_global_put","intc_0","bytec 7","txn ApplicationArgs 1","app_local_put","intc_2","return","label8:","pop","intc_2","return","label6:","global Round","bytec_1","app_global_get","\u003e=","global Round","bytec_2","app_global_get","\u003c=","\u0026\u0026","bz label2","intc_2","return","label5:","global Round","bytec 4","app_global_get","\u003e","bnz label10","intc_0","txn ApplicationID","bytec 7","app_local_get_ex","bnz label11","pop","intc_2","return","label11:","store 1","txn ApplicationID","load 1","app_global_get_ex","store 3","store 4","load 3","bnz label12","intc_2","return","label12:","load 4","intc_2","-","store 2","load 1","load 2","app_global_put","intc_2","return","label2:","intc_0","return","label10:","intc_2","return",""],"global-delta":[{"key":"Creator","value":{"action":2,"bytes":"oB6Sb71Xwm/GFWTy634W4gWUkQLccmwbq5Hz7qvLE0o=","uint":0}}]}]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"error": "", "protocol-version": "future", "txns": [{"app-call-messages": ["ApprovalProgram", "REJECT", "logic eval error: logic eval error: concat arg 1 wanted []byte but got uint64. Details: pc=278, opcodes=concat\nload 0\nconcat\n. Details: pc=204, opcodes=intc_1 // 0\nitxn_field Fee\nitxn_submit\n"], "app-call-trace": [{"line": 1, "pc": 1, "stack": []}, {"line": 2, "pc": 6, "stack": []}, {"line": 3, "pc": 13, "stack": []}, {"line": 4, "pc": 15, "stack": [{"bytes": "", "type": 2, "uint": 16}]}, {"line": 5, "pc": 16, "stack": [{"bytes": "", "type": 2, "uint": 16}, {"bytes": "", "type": 2, "uint": 0}]}, {"line": 6, "pc": 17, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 7, "pc": 20, "stack": []}, {"line": 8, "pc": 22, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 9, "pc": 24, "stack": [{"bytes": "", "type": 2, "uint": 0}, {"bytes": "", "type": 2, "uint": 5}]}, {"line": 10, "pc": 25, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 11, "pc": 28, "stack": []}, {"line": 12, "pc": 30, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 13, "pc": 32, "stack": [{"bytes": "", "type": 2, "uint": 0}, {"bytes": "", "type": 2, "uint": 4}]}, {"line": 14, "pc": 33, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 15, "pc": 36, "stack": []}, {"line": 16, "pc": 38, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 17, "pc": 40, "stack": [{"bytes": "", "type": 2, "uint": 0}, {"bytes": "", "type": 2, "uint": 2}]}, {"line": 18, "pc": 41, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 19, "pc": 44, "stack": []}, {"line": 20, "pc": 46, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 21, "pc": 47, "stack": [{"bytes": "", "type": 2, "uint": 0}, {"bytes": "", "type": 2, "uint": 1}]}, {"line": 22, "pc": 48, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 23, "pc": 51, "stack": []}, {"line": 24, "pc": 54, "stack": [{"bytes": "0MiMjQ==", "type": 1, "uint": 0}]}, {"line": 25, "pc": 60, "stack": [{"bytes": "0MiMjQ==", "type": 1, "uint": 0}, {"bytes": "0MiMjQ==", "type": 1, "uint": 0}]}, {"line": 26, "pc": 61, "stack": [{"bytes": "", "type": 2, "uint": 1}]}, {"line": 38, "pc": 81, "stack": []}, {"line": 103, "pc": 177, "stack": []}, {"line": 104, "pc": 178, "stack": []}, {"line": 105, "pc": 180, "stack": [{"bytes": "", "type": 2, "uint": 6}]}, {"line": 106, "pc": 182, "stack": []}, {"line": 107, "pc": 185, "stack": [{"bytes": "AA==", "type": 1, "uint": 0}]}, {"line": 108, "pc": 186, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 109, "pc": 188, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 110, "pc": 190, "stack": []}, {"line": 111, "pc": 193, "stack": [{"bytes": "AQ==", "type": 1, "uint": 0}]}, {"line": 112, "pc": 194, "stack": [{"bytes": "", "type": 2, "uint": 1}]}, {"line": 113, "pc": 196, "stack": [{"bytes": "", "type": 2, "uint": 17}]}, {"line": 114, "pc": 198, "stack": []}, {"line": 115, "pc": 199, "stack": [{"bytes": "2HaZ7w==", "type": 1, "uint": 0}]}, {"line": 116, "pc": 201, "stack": []}, {"line": 117, "pc": 202, "stack": [{"bytes": "", "type": 2, "uint": 0}]}, {"line": 118, "pc": 204, "stack": []}, {"error": "logic eval error: concat arg 1 wanted []byte but got uint64. Details: pc=278, opcodes=concat\nload 0\nconcat\n", "line": 118, "pc": 204, "stack": []}], "cost": 18446744073709551059, "disassembly": ["#pragma version 6", "intcblock 1 0 10", "bytecblock 0xd87699ef", "txn ApplicationID", "intc_1 // 0", "==", "bnz label1", "txn OnCompletion", "pushint 5", "==", "bnz label2", "txn OnCompletion", "pushint 4", "==", "bnz label3", "txn OnCompletion", "pushint 2", "==", "bnz label4", "txn OnCompletion", "intc_0 // 1", "==", "bnz label5", "txna ApplicationArgs 0", "pushbytes 0xd0c88c8d // 0xd0c88c8d", "==", "bnz label6", "txna ApplicationArgs 0", "bytec_0 // 0xd87699ef", "==", "bnz label7", "err", "label7:", "callsub label8", "callsub label9", "intc_0 // 1", "return", "label6:", "callsub label10", "callsub label9", "intc_0 // 1", "return", "label5:", "intc_0 // 1", "return", "label4:", "intc_0 // 1", "return", "label3:", "txn Sender", "global CreatorAddress", "==", "return", "label2:", "txn Sender", "global CreatorAddress", "==", "return", "label1:", "intc_0 // 1", "return", "label13:", "store 3", "pushbytes 0x30313233343536373839 // \"0123456789\"", "load 3", "intc_0 // 1", "extract3", "retsub", "label15:", "store 2", "load 2", "intc_1 // 0", "==", "bnz label11", "load 2", "intc_2 // 10", "/", "intc_1 // 0", ">", "bnz label12", "pushbytes 0x // \"\"", "label16:", "load 2", "intc_2 // 10", "%", "callsub label13", "concat", "b label14", "label12:", "load 2", "intc_2 // 10", "/", "load 2", "swap", "callsub label15", "swap", "store 2", "b label16", "label11:", "pushbytes 0x30 // \"0\"", "label14:", "retsub", "label10:", "itxn_begin", "pushint 6", "itxn_field TypeEnum", "txna ApplicationArgs 2", "btoi", "txnas Assets", "itxn_field Assets", "txna ApplicationArgs 1", "btoi", "txnas Applications", "itxn_field ApplicationID", "bytec_0 // 0xd87699ef", "itxn_field ApplicationArgs", "intc_1 // 0", "itxn_field Fee", "itxn_submit", "itxna Logs 0", "extract 6 0", "retsub", "label8:", "txna Assets 0", "asset_params_get AssetName", "store 1", "store 0", "pushbytes 0x496e2061707020696420 // \"In app id \"", "txn ApplicationID", "callsub label15", "concat", "pushbytes 0x207768696368207761732063616c6c65642077697468206173736574206e616d6520 // \" which was called with asset name \"", "concat", "load 0", "concat", "retsub", "label17:", "store 5", "load 5", "len", "itob", "extract 6 2", "load 5", "concat", "retsub", "label9:", "store 4", "pushbytes 0x151f7c75 // 0x151f7c75", "load 4", "callsub label17", "concat", "log", "retsub", ""]}]}
45 changes: 45 additions & 0 deletions features/resources/v2algodclient_responsejsons/error_app_trace.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
pc# |ln# |source |scratch |stack
1 |1 |intcblock 1 0 10 | |[]
6 |2 |bytecblock 0xd87699ef | |[]
13 |3 |txn ApplicationID | |[]
15 |4 |intc_1 // 0 | |[16]
16 |5 |== | |[16, 0]
17 |6 |bnz label1 | |[0]
20 |7 |txn OnCompletion | |[]
22 |8 |pushint 5 | |[0]
24 |9 |== | |[0, 5]
25 |10 |bnz label2 | |[0]
28 |11 |txn OnCompletion | |[]
30 |12 |pushint 4 | |[0]
32 |13 |== | |[0, 4]
33 |14 |bnz label3 | |[0]
36 |15 |txn OnCompletion | |[]
38 |16 |pushint 2 | |[0]
40 |17 |== | |[0, 2]
41 |18 |bnz label4 | |[0]
44 |19 |txn OnCompletion | |[]
46 |20 |intc_0 // 1 | |[0]
47 |21 |== | |[0, 1]
48 |22 |bnz label5 | |[0]
51 |23 |txna ApplicationArgs 0 | |[]
54 |24 |pushbytes 0xd0c88c8d // 0xd0c8... | |[0xd0c88c8d]
60 |25 |== | |[0xd0c88c8d, 0xd0c88c8d]
61 |26 |bnz label6 | |[1]
81 |38 |callsub label10 | |[]
177 |103 |itxn_begin | |[]
178 |104 |pushint 6 | |[]
180 |105 |itxn_field TypeEnum | |[6]
182 |106 |txna ApplicationArgs 2 | |[]
185 |107 |btoi | |[0x00]
186 |108 |txnas Assets | |[0]
188 |109 |itxn_field Assets | |[0]
190 |110 |txna ApplicationArgs 1 | |[]
193 |111 |btoi | |[0x01]
194 |112 |txnas Applications | |[1]
196 |113 |itxn_field ApplicationID | |[17]
198 |114 |bytec_0 // 0xd87699ef | |[]
199 |115 |itxn_field ApplicationArgs | |[0xd87699ef]
201 |116 |intc_1 // 0 | |[]
202 |117 |itxn_field Fee | |[0]
204 |118 |itxn_submit | |[]
204 |118 |!! logic eval error: concat ar... | |[]
Loading

0 comments on commit f3ec8a5

Please sign in to comment.