crytic / tealer

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

Don't drop unsupported instructions from the CFG #77

Closed geo2a closed 2 years ago

geo2a commented 2 years ago

On encountering an unrecognized instruction when building the CFG, Tealer reports it as "Not found" on stdout, but does not include it into the CFG. I find it rather confusing, since no error is reported and the graph just skips the unsupported instruction.

I see two alternative ways of correcting this behavior:

Example

Consider TEALv6 program that uses the acct_params_get instruction, which is not supported by Tealer:

#pragma version 6
int 0
acct_params_get AcctBalance
!
// a comment
assert
int 0
==

Output before the patch

cfg (1) We see that line 3 is dropped from the CFG. This is the behavior of Tealer on both main and dev.

Output after the patch

cfg Now line 3 is not dropped, but the instruction is marked as "UNSUPPOTED". Line 5 that contains a comment is still dropped, as expected.

geo2a commented 2 years ago

I suspect that the CI fails due to some permission issues. I've run the tests and the checks outlined in the contribution guidelines locally with no issues.

ehildenb commented 2 years ago

@montyly can you have a look here? We want to contribute, but we are unsure how to proceed with the permissions issues.

0xalpharush commented 2 years ago

The tests were failing do to some type annotations (in pytest IIRC) not being natively available in python 3.6. We've been migrating to python 3.8 across our repos recently to address this. All passing here (aside from some mypy error I haven't figured out yet): https://github.com/crytic/tealer/pull/79

montyly commented 2 years ago

This PR was merged with #79. Thanks @geo2a

geo2a commented 2 years ago

Thanks @montyly!