fdg.preprocessing package

Submodules

fdg.preprocessing.address_collection module

fdg.preprocessing.address_collection.collect_addresses_in_constructor(location: str, value: str)[source]
fdg.preprocessing.address_collection.collect_value_for_sender(condition: str)[source]

fdg.preprocessing.instruction_coverage module

class fdg.preprocessing.instruction_coverage.InstructionCoverage(functions: list)[source]

Bases: object

call_at_end_of_preprocessing()[source]
collect_function_instructions(global_state: GlobalState)[source]
compute_coverage()[source]
print_state_info(global_state: GlobalState, opcode: str, given_opcode: str | None = None, target_function: str | None = None)[source]
update_coverage(global_state: GlobalState, opcode: str)[source]

fdg.preprocessing.preprocess module

class fdg.preprocessing.preprocess.Preprocessing(method_identifiers: dict, state, contract_address)[source]

Bases: object

main_preprocessing_end(iteration: int)[source]
main_preprocessing_start(iteration: int, laserEVM)[source]
fdg.preprocessing.preprocess.execute_preprocessing(address, laserEVM)[source]
fdg.preprocessing.preprocess.log = <Logger fdg.preprocessing.preprocess (WARNING)>[source]
For each function:

need to collect conditions instruction indices read/write slots

expression to slot map (can not simplify expression, because the slot information can be lost if the expression can simplified to a concrete value.

concrete addresses used in the contract, which may be used to check against msg.sender which is implemented an array of three concrete addresses by default

fdg.preprocessing.read_in_conditions module

class fdg.preprocessing.read_in_conditions.ReadInCondition(functions: list)[source]

Bases: object

add_conditions(function: str, address: int, condition: BitVec)[source]
collect_conditions(state: GlobalState)[source]

extract the location(slot) of the storage read in conditions :param state: :return:

extract_read_slots_in_conditions()[source]
print_read_slot_info()[source]

fdg.preprocessing.write_read_info module

class fdg.preprocessing.write_read_info.Function_Write_Read_Info(all_functions: list)[source]

Bases: object

print_write_read_info()[source]
refine_read_write_slots()[source]
update_sload(state: GlobalState)[source]

read locations from address note: from an address (instruction) different state variables can be read at differnt loops :param state: :return:

update_sstore(state: GlobalState)[source]

get write location note: from an address (instruction), different state variables can be written in different loops.

Parameters:

state

Returns:

Module contents