echidna icon indicating copy to clipboard operation
echidna copied to clipboard

Errors running echidna - solc-args

Open JABirchall opened this issue 2 years ago • 4 comments

solc fails to complile large contract which require optimize to compile successful.

But cryptic-compile fails to compile the contract when ran through echidna even with solc-args "optmize" set. Does solc-args get passed through the cryptic-compiles solc-args argument?

examples: crytic-compile LargeContract.sol Fails - Stack too deep when compiling inline assembly: Variable value0 is 1 slot(s) too deep inside the stack. crytic-compile --solc-args="optimize" LargeContract.sol Succeeds

slither LargeContract.sol Fails - crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation Compiler error: Stack too deep when compiling inline assembly: Variable value0 is 1 slot(s) too deep inside the stack. slither LargeContract.sol --solc-args="optimize" Succeeds

echidna-test LargeContract.sol --contract LargeContract Fails - CryticCompile:Invalid solc compilation Compiler error: Stack too deep when compiling inline assembly: Variable value0 is 1 slot(s) too deep inside the stack. echidna-test LargeContract.sol --solc-args="optimize" --contract LargeContract Fails - echidna-test: Error running slither: echidna-test LargeContract.sol --solc-args="optimize" --crytic-args="solc-args optimize" --contract LargeContract Tryna figure out a way to pass through solc-args to crytic

JABirchall avatar Aug 10 '22 20:08 JABirchall

I dunno what im trying to find with this issue. But each individual tool works alone, but using echidna it all falls apart.

Slither has no errors running it standalone, but echidna somehow thinks it does error.

JABirchall avatar Aug 10 '22 20:08 JABirchall

Hi! I suspect crytic-compile is getting the options through echidna, but not slither. Echidna calls slither with "ignore-compile" set, so normally any compilation options are not needed, but IIRC ignore-compile does not have any impact when you're using a standalone .sol file (as there's no pre-built artifacts to read like you'd have with Hardhat or another framework). Can you do a short experiment to confirm?

  1. Create a slither.config.json in the current directory with the following content:
{
"solc_args": "optimize"
}
  1. Run echidna-test LargeContract.sol --solc-args="optimize" --contract LargeContract

elopez avatar Aug 10 '22 21:08 elopez

@elopez that worked, thanks.

JABirchall avatar Aug 11 '22 22:08 JABirchall

Cool! Then we should probably add the missing arguments to the Slither call 🤔 Let's leave this issue open so we can track the fix.

elopez avatar Aug 12 '22 07:08 elopez

This also helped me, thanks

brucdarc avatar Dec 14 '22 07:12 brucdarc

I think we can close this one, and perhaps add some documentation about it in building secure contracts.

ggrieco-tob avatar Jan 12 '23 19:01 ggrieco-tob