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

Encountered no pragma errors #7

Open
Stamp9 opened this issue Aug 28, 2023 · 10 comments
Open

Encountered no pragma errors #7

Stamp9 opened this issue Aug 28, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@Stamp9
Copy link

Stamp9 commented Aug 28, 2023

Hey,

I was trying to run smartbug with smartbugs-wild dataset but encountered many no pragma errors. Given that the paper utilized SmartBugs to analyze the same dataset, I'm wondering why it's not functioning as expected now and how this issue can be resolved. Any information would be appreciated, thanks in advance!

cat /Users/rr/my-repo/cloned/smartbugs-wild/sb_wild.txt | xargs -n 200 ./smartbugs -t smartcheck -f

Welcome to SmartBugs 2.0.7!
Collecting files ...
200 files to analyse
Assembling tasks ...
Error(s) while collecting tasks:
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x0710714a1e30c70aea2dc1254e24292bea7943f4.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x0b8d56c26d8cf16fe1bddf4967753503d974de06.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x41f2d5040726c5328f8366f17041ec012ac8f338.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x44afd8995b70f37c90c2c6a484218f79df86d74a.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x77562e7c5cedf35d3264fd13469b9e9d9fee90cc.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x7fd022cc8b6e019260627fafa1d9c3afece18cef.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xc0c2809aa2a6c38ff1eeac13cff6c0e5cf637e27.sol: no pragma, cannot determine solc version
Welcome to SmartBugs 2.0.7!
Collecting files ...
200 files to analyse
Assembling tasks ...
Error(s) while collecting tasks:
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x9497043f4cd9450867479f3fd873d80d9321094c.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xbc053e4bc868f40beea7d571c808f01ade8dae12.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xe2ff99d71555b62271f74b062d1e2928c4d27b1e.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xe7e01babb53c98f8d84d05dfff64ebb63ed37bf5.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xf01b26626550448606de2b6e7eeda1216d9cd239.sol: no pragma, cannot determine solc version
Welcome to SmartBugs 2.0.7!
Collecting files ...
200 files to analyse
Assembling tasks ...
Error(s) while collecting tasks:
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x073e957bc883693f15ecb14bfced3e8ffc8654c5.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x43bbc7fafb860d974037b8f7dd06b6f6fe799b3e.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xb1d58bad78f33892719cdeba218f8641a71a3f05.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xd5a3a5f35e8db7740ff644752bce389fc958d5c1.sol: no pragma, cannot determine solc version
Welcome to SmartBugs 2.0.7!
Collecting files ...
200 files to analyse
Assembling tasks ...
Error(s) while collecting tasks:
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x0948cc023fa99f12f93dc6dd88d958faac3e07d2.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x11d02e7119cdf769bf887b7c35548ab7f67b3fe0.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x2b84b61394511aba931500e974cb243a852f134b.sol: no compiler found that matches pragma solidity ;
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0x954de93d9f1cd1e2e3ae5964f614cdcc821fac64.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xbacd554538c8037545098a36361f54c4e1d0f94e.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xcf377dfd654676940e2b5a87cf2673def25aeaed.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xd0f51907e541e63ec338e0e210dc33a6c7871096.sol: no pragma, cannot determine solc version
/Users/rr/my-repo/cloned/smartbugs-wild/contracts/0xd494938d0524edadfc239adc2c233e50550fa152.sol: no pragma, cannot determine solc version
@tdurieux
Copy link
Collaborator

tdurieux commented Aug 28, 2023

You executed a different version of SmartBugs that we initially used for that study. SmartBugs v2 tries to determine the version of the required compiler automatically by identifying the pragma in the solidity file.

In those cases, no pragma is present in the file, and therefore no compiler could be identified.

@Stamp9
Copy link
Author

Stamp9 commented Aug 28, 2023

Hi, @tdurieux

Thanks for your quick reply. So, if we intend to analyze the dataset using SmartBugs v2 with some tools, is manually adding the compiler version and pragma the sole approach available? Is there any alternative or more efficient method in your opinion?

@tdurieux
Copy link
Collaborator

You could modify smartbugs to use a default pragma, I expect that the contracts are really old when no pragma is provided.

@gsalzer WDYT?

@Stamp9
Copy link
Author

Stamp9 commented Aug 29, 2023

You could modify smartbugs to use a default pragma, I expect that the contracts are really old when no pragma is provided.

Yes, they are old.
According to the source code, Is it correct that that the minimal version supported by SmartBugs v2 is 0.4.11? If so, does it mean that utilizing a default pragma specifying a Solidity version earlier than 0.4.11 would not align with the compatibility requirements v2? There are also s
ome contract files have earlier version(e.g. pragma solidity 0.4.4), do you have any suggestions for these situations?

@gsalzer
Copy link

gsalzer commented Aug 30, 2023

@Stamp9 I will look at it in a few days. It should be possible to support solc >= 0.4.0. One might also add a command line switch to supply a default solc version.

@gsalzer gsalzer added the enhancement New feature or request label Aug 30, 2023
@MartinY9
Copy link

MartinY9 commented Oct 11, 2023

I have also encountered the same problem when running smartbug with smartbugs-wild dataset, may I ask how to solve this?

@MartinY9
Copy link

I have also encountered the same problem when running smartbug with smartbugs-wild dataset, may I ask how to solve this?

This is a version formatting issue in the dataset, which has been resolved by automatically formatting it through a script.

@gsalzer
Copy link

gsalzer commented Oct 17, 2023

@MartinY9 Thanks for clarification. Can you elaborate the issue a bit? What exactly did you reformat, to which format? Maybe we should apply the reformatting to the original dataset.

@MartinY9
Copy link

@MartinY9 Thanks for clarification. Can you elaborate the issue a bit? What exactly did you reformat, to which format? Maybe we should apply the reformatting to the original dataset.

There are several incorrect formats for writing contract definition versions, such as: "pragma solidity ^ 0.4.18;","pragma solidity 0.4.18;", and "pragma solidity 0.4. 18" and so on. These wrong formats make the program unable to run normally. I wrote a script to address this issue, which was manually checked and proved to be effective.

@gsalzer
Copy link

gsalzer commented Oct 25, 2023

Thanks for the analysis. We will fix it for future users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants