building-secure-contracts icon indicating copy to clipboard operation
building-secure-contracts copied to clipboard

Is Hardhat compatible in the End to End Test Example?

Open BarrySauce opened this issue 3 years ago • 4 comments

Basically I was trying to replace Truffle with Hardhat in this example (https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/end-to-end-testing.md), since Hardhat can offer multiple solc version support when compiling.

So the contracts I am using is the same as those in the drizzle-box example. Etheno can successfully record the transaction and then I tried using Echidna to run the end to end test. But there is error occuring:

Screenshot 2022-05-16 at 3 00 29 AM

I searched in Echidna and Crytic-compile repo and found the similar issues: Echidna: https://github.com/crytic/echidna/issues/631 crytic-compile: https://github.com/crytic/crytic-compile/issues/164 https://github.com/crytic/crytic-compile/issues/236

Then I checked my build-info file and I found it's located in the artifacts/build-info directory, there's only one build info json file. So I am wondering why crytic-compile output the "No such file or directory: 'artifacts/build-info'" error, since I did not make any special directory for the build info json file.

Screenshot 2022-05-16 at 3 05 50 AM

May I ask if there's any special argument needs to be added to the yaml config file? I tried to modify the cryticArgs option, but the same error occured, my config file hardhat.yaml shows below:

Screenshot 2022-05-16 at 3 14 38 AM

BarrySauce avatar May 15 '22 19:05 BarrySauce

Hardhat should work, but we need to check this particular example. We will investigate during the week.

gustavo-grieco avatar May 15 '22 19:05 gustavo-grieco

Hardhat should work, but we need to check this particular example. We will investigate during the week.

@ggrieco-tob Hi sir, basically the reason I prefer hardhat over truffle is because that it can import different solc compilers with different version so that it can compile a whole project of contracts written in different solidity pragma. But now it seems that truffle cannot provide this kind of feature, it can only import one solc compiler so it is actually not quite compatible with the end-to-end method.

May I know if crytic-compile provides the similar functionality to hardhat?

BarrySauce avatar May 23 '22 03:05 BarrySauce

crytic-compile allows to specify a solc version, but it will not allow multiple versions. You should use hardhat for that. Btw, I still need to investigate this issue, sorry :disappointed:

gustavo-grieco avatar May 23 '22 08:05 gustavo-grieco

crytic-compile allows to specify a solc version, but it will not allow multiple versions. You should use hardhat for that. Btw, I still need to investigate this issue, sorry 😞

Ok got it, never mind sir, I will also try to investigate and find a way to solve it, thank you for your support 👍

BarrySauce avatar May 23 '22 09:05 BarrySauce