According to this blog using Solidity 0.8.13+ should eliminate the stack too deep error in most cases, however I'm still experiencing in both brownie and hardhat. I've added the following to my hardhat.config.js compilers:

  version: "0.8.13",
  settings: {
    optimizer: {
      enabled: true,
      runs: 200

This isn't the actual code I'm getting the error with, but the error persists nonetheless:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.13;

contract TestStackError {

  event LogValue(uint);

  function logArg(
    uint a1, uint a2, uint a3, uint a4,
    uint a5, uint a6, uint a7, uint a8,
    uint a9, uint a10, uint a11, uint a12,
    uint a13, uint a14, uint a15, uint a16
  ) public {
    emit LogValue(a16);
  • Could you share code that is causing the error?
    – Sky
    May 26, 2022 at 19:19
  • @Sky sure, I added an example
    – MShakeG
    May 26, 2022 at 19:26

1 Answer 1


Looks like it's still pretty experimental, not default, and you have to make some other changes too:


The important part:

You can enable the new pipeline using the --πšŸπš’πšŠ-πš’πš› commandline switch or by setting πšœπšŽπšπšπš’πš—πšπšœ.πšŸπš’πšŠπ™Έπš to πšπš›πšžπšŽ in Standard JSON input (i.e. at the same level where you would have the optimizer key).

Your Answer

By clicking β€œPost Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.