Skip to content

update foundry.toml with configuration settings to fix forge build is…#53

Merged
Zahnentferner merged 2 commits into
DjedAlliance:mainfrom
VishwajeetTulse:main
Mar 5, 2026
Merged

update foundry.toml with configuration settings to fix forge build is…#53
Zahnentferner merged 2 commits into
DjedAlliance:mainfrom
VishwajeetTulse:main

Conversation

@VishwajeetTulse

@VishwajeetTulse VishwajeetTulse commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Addressed Issues:

Fixes #52

Screen shots:

image image image

Additional Notes:

The build fails on recent Foundry versions (tested on v1.6.0-rc1) because the HebeSwap submodule (lib/hebeswap-contract) pins pragma solidity 0.8.13;, forcing Foundry's auto-detected Solc to 0.8.13. This version cannot handle the deep inline assembly in src/test/utils/Console.sol (5,204 lines), resulting in a Stack too deep error.

Changes (4 lines added to foundry.toml):

  • via_ir = true : Switches to the Yul IR compilation pipeline, which has a smarter stack allocator that spills variables to memory when the stack exceeds 16 slots.
  • optimizer = true + optimizer_runs = 200 : Required alongside via_ir for the Yul codegen to perform stack-to-memory moves.
  • evm_version = 'london' : Ensures bytecode compatibility with target chains (Milkomeda C1, ETC) that don't support post-London opcodes like PUSH0.

No Solidity source files, submodules, or tests were modified. The foundry.lock file was also added to lock submodule dependency versions for reproducible builds.

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions.
  • If applicable, I have made corresponding changes or additions to the documentation.
  • If applicable, I have made corresponding changes or additions to tests.
  • My changes generate no new warnings or errors.
  • I have joined the Stability Nexus's Discord server and I will share a link to this PR with the project maintainers there.
  • I have read the Contribution Guidelines.
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.

⚠️ AI Notice - Important!

I have used Github Copilot to discuss and understand the scope of the issue and it's fix.

Summary by CodeRabbit

  • Chores
    • Updated build configuration to enable additional compiler optimizations and intermediate-mode compilation, and increased optimization tuning for improved build performance and resulting binaries.

@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93fb627 and f0d1be2.

📒 Files selected for processing (1)
  • foundry.toml
🚧 Files skipped from review as they are similar to previous changes (1)
  • foundry.toml

📝 Walkthrough

Walkthrough

Updated foundry.toml to enable IR compilation and the optimizer, and set optimizer runs to 200; remappings remain present.

Changes

Cohort / File(s) Summary
Foundry configuration
foundry.toml
Added via_ir = true, optimizer = true, and optimizer_runs = 200; left existing remappings intact.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 Tweaking toml with a hop and a cheep,
IR enabled while the optimizer sleeps.
Two hundred runs, neat and spry,
The forge will try, the forge will fly. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating foundry.toml with configuration settings to fix the forge build issue referenced in issue #52.
Linked Issues check ✅ Passed The PR successfully addresses issue #52 by enabling via_ir and optimizer settings to resolve the Stack too deep error without modifying source files or submodules.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the Stack too deep compilation error; only foundry.toml and foundry.lock were modified as intended.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@VishwajeetTulse

Copy link
Copy Markdown
Contributor Author

Hey @yogesh0509 can you review this?

@yogesh0509

Copy link
Copy Markdown
Member

Is there any benefit to hardcode the evm version to "london"?

@VishwajeetTulse

Copy link
Copy Markdown
Contributor Author

@yogesh0509 No, evm_version = 'london' isn't necessary for fixing the build error. The stack-too-deep issue is resolved by via_ir = true with the optimizer enabled. I added it during debugging and didn't clean it up. I'll remove it.

@VishwajeetTulse

Copy link
Copy Markdown
Contributor Author

Hey @Zahnentferner, as @yogesh0509 has approved the changes, you can merge this PR.

@Zahnentferner Zahnentferner merged commit b5308e4 into DjedAlliance:main Mar 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Forge build fails with "Stack too deep" on recent Foundry versions

3 participants