crytic / tealer

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

Add group support: support of stateless single transactions #189

Closed S3v3ru5 closed 11 months ago

S3v3ru5 commented 11 months ago

The PR mainly adds the test cases for the group transaction support. If all the test cases pass, then it could be considered that tealer has the basic support for group transactions. Note: All the test cases are not enabled. Test cases will be enabled progressively with the support for different patterns.

tests/group_transactions/basic/logicsig_1.py lists all the test cases.

tests/group_transactions/* contains a basic framework to write tests using the group configuration. To add a test, one would write the group configuration for the protocol and write the expected_output.yaml file. The expected_output.yaml file lists all the vulnerable operations that should be reported by the detector(s).

The config file structure is updated to include the name of the "operation" the group transaction performs.

A new output format GroupTransactionOutput is implemented to represent reported output when analyzing a group by the detectors. The output contains the group, a list of transactions in the group that are vulnerable, and for each transaction list of vulnerable contracts.

The command line handler is updated to run detectors on the config. Previously, the tealer would ignore the detectors, printers when the group_config is given. It is now updated to run the detectors and generate the output.

Sample output:

$ tealer --detect rekey-to --group-config ./tests/group_transactions/basic/config.yaml
Screenshot 2023-09-29 at 1 27 20 PM


The `.teal` files are generated by PyTeal and need not be reviewed.
S3v3ru5 commented 11 months ago

Builds on #186