Beispiel #1
0
    def __init__(self, slither, logger):
        super(PrinterInheritanceGraph, self).__init__(slither, logger)

        inheritance = [x.inheritance for x in slither.contracts]
        self.inheritance = set(
            [item for sublist in inheritance for item in sublist])

        # Create a lookup of direct shadowing instances.
        self.direct_overshadowing_functions = {}
        shadows = detect_function_shadowing(slither.contracts, True, False)
        for overshadowing_instance in shadows:
            overshadowing_function = overshadowing_instance[2]

            # Add overshadowing function entry.
            if overshadowing_function not in self.direct_overshadowing_functions:
                self.direct_overshadowing_functions[
                    overshadowing_function] = set()
            self.direct_overshadowing_functions[overshadowing_function].add(
                overshadowing_instance)

        # Create a lookup of shadowing state variables.
        # Format: { colliding_variable : set([colliding_variables]) }
        self.overshadowing_state_variables = {}
        shadows = detect_state_variable_shadowing(slither.contracts)
        for overshadowing_instance in shadows:
            overshadowing_state_var = overshadowing_instance[1]
            overshadowed_state_var = overshadowing_instance[3]

            # Add overshadowing variable entry.
            if overshadowing_state_var not in self.overshadowing_state_variables:
                self.overshadowing_state_variables[
                    overshadowing_state_var] = set()
            self.overshadowing_state_variables[overshadowing_state_var].add(
                overshadowed_state_var)
    def __init__(self, slither, logger):
        super().__init__(slither, logger)

        inheritance = [x.inheritance for x in slither.contracts]
        self.inheritance = {item for sublist in inheritance for item in sublist}

        self.overshadowing_state_variables = {}
        shadows = detect_state_variable_shadowing(slither.contracts)
        for overshadowing_instance in shadows:
            overshadowing_state_var = overshadowing_instance[1]
            overshadowed_state_var = overshadowing_instance[3]

            # Add overshadowing variable entry.
            if overshadowing_state_var not in self.overshadowing_state_variables:
                self.overshadowing_state_variables[overshadowing_state_var] = set()
            self.overshadowing_state_variables[overshadowing_state_var].add(overshadowed_state_var)