I seem to be having an issue running "solidity-coverage" i get the following error
CompilerError: Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack.
Error in plugin solidity-coverage: HardhatError: HH600: Compilation failed
I'm not sure i understand why, since when i run yarn compile i get no issues. Is there anyway i can debug? It doesn't necessarily tell me what contract is having an issue compiling.
The “stack too deep” error is a limitation of the current code generator. The EVM stack only has 16 slots and that’s sometimes not enough to fit all the local variables, parameters and/or return variables. The solution is to move some of them to memory, which is more expensive but at least makes your code compile.
Without being able to do this the compiler can’t do much else than just stop and give up when it gets into such a situation. It also can’t really tell you exactly where the problem is because it’s not caused by any particular line of code. It could potentially show you the general area that was being compiled when it happened but it would require adapting error reporting just for this particular type of error and it’s really just a half-measure. It’s better to focus on finishing the new code generator and proper support for moving stuff to memory. Until then unfortunately you have work around this problem manually by rearranging your code in a way that makes it take less stack space.
Having tons of parameters is generally not a considered a good style anyway and grouping them into structs is recommended.
Also note that some types require more than 1 stack slot so the limit is not exactly 16 locals/parameters. It also depends on what types you use.
This error arises when using the pragma abi v2. Removing local variables in the contract implementation will not help here (assuming there are less than 16 which seems to be the case). Running compilation with optimization turned on removes the error, unfortunately this is not possible when running solidity coverage.
It looks strange that you didn't specify the location like memory or calldata in that example, my issue was that I had less than 16 inputs but one of them was an array with calldata, I just changed it to memory and it worked well