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

Storage method of control flow diagram #2364

Open
zhangzone opened this issue Mar 14, 2024 · 2 comments
Open

Storage method of control flow diagram #2364

zhangzone opened this issue Mar 14, 2024 · 2 comments
Labels
question Further information is requested

Comments

@zhangzone
Copy link

Hello, may I ask if the control flow diagram in Slither is stored in bytecode format or in the semantics of solidity. Is the control flow diagram stored in a data structure? I need to use Slither's control flow chart data and data dependencies.

@0xalpharush
Copy link
Member

0xalpharush commented Mar 14, 2024

Each function has a control flow graph (CFG) with its list of nodes aka blocks. Each node has sons aka successors or outgoing edges and fathers aka predecessors or incoming edges. The CFG is based off the solidity AST and reflects the control flow of if-else, for loop, while loop, and break/continue statements. For example, an if-statement node will have two sons, the branch taken if the condition is true and the branch taken if false. You can see the CFG using slither test.sol --print cfg.

There is an example of how to use the data dependency API here

@zhangzone
Copy link
Author

Hello, does Slither convert functions into nodes when transforming the control flow graph, such as custom functions or Solidity's built-in functions like call? I noticed that there are no node types specifically related to functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants