Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slither does not handle multiple contracts with the same name across compilation units #2107

Closed
hacker-DOM opened this issue Sep 1, 2023 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@hacker-DOM
Copy link
Contributor

Consider the codebase https://github.com/hacker-DOM/reference-resolving/tree/ecd8bf0e91a3636104b5ffc805537eaac2eeb8d7

These are the results for inheritance-graph and call-graph, both of which are wrong

image

image

@montyly
Copy link
Member

montyly commented Sep 5, 2023

Indeed the printers merge contracts with the same name, which they should not. We will update the printer.

@0xalpharush 0xalpharush added bug Something isn't working good first issue Good for newcomers labels Sep 29, 2023
@0xalpharush
Copy link
Contributor

We need to make these id's unique across compilation unit

return f"cluster_{contract.id}_{contract.name}"
# return unique id for contract function to use as node name
def _function_node(contract: Contract, function: Union[Function, Variable]) -> str:
return f"{contract.id}_{function.name}"

ret += f"{contract.name} -> {contract.immediate_inheritance[0]};\n"
else:
for i, immediate_inheritance in enumerate(contract.immediate_inheritance):
ret += f'{contract.name} -> {immediate_inheritance} [ label="{i + 1}" ];\n'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants