ucsb-seclab / sailfish

Data and code for the IEEE S&P'22 paper SAILFISH: Vetting Smart Contract State-Inconsistency Bugs in Seconds
47 stars 11 forks source link

How to do inter-contract analysis? #3

Closed Troublor closed 2 years ago

Troublor commented 2 years ago

I noticed that there are options --inter-contract-call and --contracts-mapping-file-path to support inter-contract analysis. Could you please give some instructions about how to set the structure of --contract-dir and the --contracts-mapping-file-path? I am quite confused trying to read source code.

As an example, if I want to analyze UniswapV2Router, which will invoke UniswapV2Pair. How can I analyze this case?

priyankabose commented 2 years ago

In its current implementation, Sailfish can do inter-contract analysis only when the callee contract address is present within the source, and performs backward data dependence analysis to infer the contract address explained in the paper.

Also, while invoking Sailfish with --inter-contract-call , one needs to provide a file that contains the mapping between the contract address and the file name (where the contract is defined) to analyze. An example file is in the code/test_cases. Please note that the callee contract should be in the same directory as that of the caller contract.