Error: Compiler error (C:\Users\circleci\project\libsolidity\codegen\CompilerUtils.cpp:1459):Stack too deep. Try compiling with --via-ir
(cli) or the
equivalent viaIR: true
(standard JSON) while enabling the optimizer. Otherwise, try removing local variables.
CompilerError: Stack too deep. Try compiling with --via-ir
(cli) or the equivalent viaIR: true
(standard JSON) while enabling the optimizer. Otherwise, try removing local variables.
1 Answer
Funny, i'm facing the same issue.
It's likely because you have too many local variables
Here are answers I found:
And indeed, i had a struct with too many variables. I reduced it (with an array, instead of 5 separate values) and it got fixed !
-
I stopped using array inside struct too. But still getting the same error and I need to have too many variables inside struct and locally so I just run with "--via-ir" that works fine for now will look into it more in future. I look into foundry book might get something from there. Commented May 10 at 15:42
--via-ir
flag with the compile command.