crytic / tealer

Static Analyzer for Teal
GNU Affero General Public License v3.0
61 stars 14 forks source link

Store original source code for instructions and add colors to CFG edges #135

Closed S3v3ru5 closed 1 year ago

S3v3ru5 commented 1 year ago

Changes:

E.g cfg_dot

Basic-block level tealer comments are added in a separate row at the top of the block. Every basic block would contain a comment containing basic block's id and the total cost of executing instructions in that basic block.

Instruction level tealer comments are displayed directly above the instruction. For example, see "ApplicationID is 0 in Creation Txn" on txn ApplicationId instruction in basic-block 0.

All tealer added comments are made bold for better distinction.

Entry block of a subroutine contains a comment describing its name, see "Subroutine addupton_0" comment in basic-block 12.

Instructions BZ/BNZ either jump to a location in the code and execute from there or continue the execution from the next instruction in the source code. Outgoing edges of basic blocks ending with BZ/BNZ have a "green" outgoing edge and "red" outgoing edge. "green" edge is taken if the condition to take the JUMP is satisfied (jump branch) and "red" edge represents the default branch(no jump is taken).

Additionally, the edge representing a call to a subroutine has an orange color to differentiate normal branches from subroutine calls. And each of the basic blocks that are part of a subroutine has an "orange" border color for the same reason.

Note that, currently all subroutine blocks have the same border color i.e blocks of Subroutine 1, subroutine 2, and ... have the same orange border color. However, it might be best to use different border colors for each of subroutine for better UX.