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

Bugs fixed in strongly connected components and cyclomatic complexity algorithms #1617

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

bart1e
Copy link
Contributor

@bart1e bart1e commented Jan 21, 2023

File code_complexity.py had two bugs in it. This PR fixes both of them.

The first bug was related to strongly connected components algorithm: the final DFS (or assign in this case) should be performed on reversed postorder order instead on just postorder.

The second issue concerned calculating cyclomatic complexity: P in the formula should be a number of connected components (always 1 in case of solidity functions) instead of strongly connected components.

@bart1e bart1e changed the base branch from master to dev January 21, 2023 16:04
@0xalpharush
Copy link
Contributor

0xalpharush commented Jan 21, 2023

As an aside, it may be useful to create helper methods on functions to get nodes in postorder and reverse postorder.

@montyly
Copy link
Member

montyly commented Jan 23, 2023

great catch @bart1e ;)

@montyly montyly merged commit b6d6294 into crytic:dev Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants