Lesson 9: Compile error - stack too deep #345
-
Lesson 9 was going great until I got to the point where we refactored the code and added "deployerKey". There were some other modifications with this, like grabbing the private key from my .env file with Yet when I tried to build after making the changes and clearing the code errors, I received the "Compile error - stack too deep" error. I know to use the Any idea of the root cause, or how I can keep this from happening in the future? I don't have any unused variables. I'm trying to figure out better optimizations. Stanzas don't seem too long. I just don't get how a simple change like that may have impacted the compiler so much. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hey @RichardPalladino , Can you send you github repo . So, we can easily debug this error |
Beta Was this translation helpful? Give feedback.
-
@RichardPalladino following line in your |
Beta Was this translation helpful? Give feedback.
-
I solved my issuse by changing address(raffle) from stack to Memory and not removing any of the above varibale, from addConsumer.addConsumer(
vrfCoordinator,
subscriptionId,
address(raffle),
deployerKey
); To address raffleAddress = address(raffle);
addConsumer.addConsumer(
vrfCoordinator,
subscriptionId,
raffleAddress,
deployerKey
); |
Beta Was this translation helpful? Give feedback.
@RichardPalladino following line in your
RaffleTest.t.sol
file is causing this error.(entranceFee, interval, vrfCoordinator, gasHash, subscriptionId, callbackGasLimit, linkToken, deployerKey) = helperConfig.activeNetworkConfig();
try removing one variable from this tuple and your code will work fine. i.e. you can removesubscriptionId
as you are not using it in this file. your line should look like this after removing this variable,(entranceFee, interval, vrfCoordinator, gasHash, , callbackGasLimit, linkToken, deployerKey) = helperConfig.activeNetworkConfig();
. @sharonphiliplima I think you are facing the same issue, try this if it works. Otherwise, you can share your repo here so I can…