Moves utils/command_line.py to utils/command_line/{common.py, command_output.py}
Removes all_paths_in_one command line option
Adds command_line options
--contracts takes list of files/directories. However, only the first file is considered for the contract as now. Replaces previously used program option. --contracts is not a positional argument as it takes multiple parameters. The command line interface does not look good in that way.
--group-config: The group configuration file
--init: Initialize sub-command
The options are just added. These options are not used by tealer at the moment.
Commit 2:
__main__.py:
validates the supplied command line options. The validations include, for example, only one of --init or --detect or --print is used.
When --detect is used with --group-config, the tool initializes Tealer using the config and outputs dot files for function cfgs. The main.py is changed to handle this case specially.
execution_context/transactions.py
Adds Transaction and GroupTransaction. The usual pattern of making member variables private(_...) and creating properties for the variables is not followed here. Can be updated to use that pattern.
teal/functions.py
Adds Function class
teal/instructions/instructions.py
Adds custom instruction to represent error blocks in functions.
teal/parse_functions.py
Adds function documentation and utils to construct function CFG given the dispatch path.
copy_main_cfg function creates a copy of the __main__ CFG.
construct_function creates the CFG for function using the dispatch path. The dispatch path is the list of blocks from contract entry to the function entry block.
teal/parse_teal.py
Renames _first_pass, _second_pass, _fourth_pass, _identify_subroutine_blocks. Removes the _ in the beginning allowing them to be used in teal/parse_functions.py.
teal/subroutine.py
Adds called_subroutine property to the Subroutine class. Returns list of all subroutines called by the subroutine.
teal/teal.py
Adds _functions and _contract_type attributes to Teal class.
tealer.py
Adds Tealer class
utils/command_line/common.py
Adds helper functions
validate_command_line_options: Validates command line options
handle_detect: handles --detect and --group-config special case.
init_tealer_group_config: Given the group-config, creates contracts, functions and group transactions objects. Initializes tealer using them
utils/command_line/group_config.py
Adds classes to represent user group-config. Also adds utils to_yaml and from_yaml for conversions from and to yaml.
for parsing yaml, Initially tried PyYaml. But, while writing from objects to yaml file. The output had "hard to read" indentation for lists. So, used ruamel.yaml for it.
utlils/teal_enums.py
Adds utils functions transaction_type_from_txt and contract_type_from_txt.
Changes:
Commit 1:
all_paths_in_one
command line option--contracts
takes list of files/directories. However, only the first file is considered for the contract as now. Replaces previously usedprogram
option.--contracts
is not a positional argument as it takes multiple parameters. The command line interface does not look good in that way.--group-config
: The group configuration file--init
: Initialize sub-commandCommit 2:
__main__.py
:--init
or--detect
or--print
is used.--detect
is used with--group-config
, the tool initializes Tealer using the config and outputs dot files for function cfgs. The main.py is changed to handle this case specially._...
) and creating properties for the variables is not followed here. Can be updated to use that pattern.__main__
CFG._first_pass
,_second_pass
,_fourth_pass
,_identify_subroutine_blocks
. Removes the_
in the beginning allowing them to be used in teal/parse_functions.py.called_subroutine
property to the Subroutine class. Returns list of all subroutines called by the subroutine.--detect
and--group-config
special case.Commit 3: