Loading video player...
Stack-too-deep is the Solidity error every dev has hit. The EVM stack maxes out at 16 accessible slots and the legacy compiler refuses to spill — so you end up wrapping half your function in `{ }` blocks or splitting it in two just to make it compile. via_ir kills that whole class of workarounds with a single flag in foundry.toml. No contract rewrite. This is a hands-on walkthrough after watching Nikola Matić's `via_ir` speedrun at the Solidity Summit. The practitioner story got buried under the compilation flowchart in that talk — so this video runs in the opposite order: see the pain, see the fix, then unpack why it works. What you get: • A real Swap contract that hits stack-too-deep on the legacy pipeline, the three workarounds (scope block, function split, struct packing) every Solidity dev reaches for, and a typed walkthrough of each • A live Foundry demo — flip via_ir = true, forge build, function compiles, scope block deleted, tests pass, gas snapshot moves in our favor • A 5-stage compilation-pipeline deep-dive that explains the counterintuitive payoff: via_ir uses MORE intermediate variables, not fewer, and that's exactly why it produces fewer stack errors • The honest tradeoffs: compile time goes up, a few edge gas cases still favor legacy, and full stack-too-deep elimination waits on EOF Chapters: 00:00 Stack-too-deep, killed by one flag 00:10 The talk that buried the lede 00:26 16 slots and the workarounds we used to write 01:16 via_ir = true — live Foundry demo 02:54 More variables, fewer errors 03:51 The 5-stage compilation pipeline 06:30 Tradeoffs — compile time, edge gas, EOF 07:15 Recap — turn it on Links: • Full walkthrough and copy-able code samples — https://ethereum-blockchain-developer.com/solidity-examples/via-ir-walkthrough • Nikola Matić's via_ir speedrun (Solidity Summit) — https://www.youtube.com/watch?v=3ljewa1__UM • via_ir docs — https://docs.soliditylang.org/en/latest/ir-breaking-changes.html • Foundry config reference — https://book.getfoundry.sh/reference/config/solidity-compiler 🤖 My stance on AI - clearly you can hear it: the voice is my cloned voice. But the script is real, the walkthrough is real, the learning is real. I am living in a noisy environment at the moment, with kids screaming going on etc. I wish I could deliver a studio quality recording, but the trade-off of my voice clone sounding a bit AI is a trade-off I take. #solidity #via_ir #stacktoodeep