Skip to content

feat: migrate from Hardhat to Foundry#5

Merged
grimnote merged 12 commits into
ReineiraOS:mainfrom
madschristensen99:feat/foundry-migration
Apr 20, 2026
Merged

feat: migrate from Hardhat to Foundry#5
grimnote merged 12 commits into
ReineiraOS:mainfrom
madschristensen99:feat/foundry-migration

Conversation

@madschristensen99

Copy link
Copy Markdown
Contributor
  • Remove all Hardhat dependencies and configuration files
  • Configure Foundry with solc 0.8.25, cancun EVM, optimizer runs 200
  • Install OpenZeppelin contracts v5.4.0 and Foundry Upgrades
  • Install Fhenix CoFHE contracts and mock contracts for FHE testing
  • Update package.json with Foundry scripts (build, test, deploy)
  • Create base Deploy and DeployUUPS scripts with UUPS proxy support
  • Add example TimeLockResolver contract with full test coverage (8/8 passing)
  • Add example SimpleUnderwriterPolicy contract with FHE support
  • Update .gitignore for Foundry artifacts (out/, broadcast/, cache_forge/)
  • Remove Hardhat-specific files (hardhat.config.ts, tsconfig.json, scripts/)

Test Results:

  • forge build: ✅ successful
  • forge test: TimeLockResolver tests 8/8 passing
  • SimpleUnderwriterPolicy tests 7/11 passing (FHE mock setup needed)

Ready for deployment testing on Arbitrum Sepolia testnet.

- Remove all Hardhat dependencies and configuration files
- Configure Foundry with solc 0.8.25, cancun EVM, optimizer runs 200
- Install OpenZeppelin contracts v5.4.0 and Foundry Upgrades
- Install Fhenix CoFHE contracts and mock contracts for FHE testing
- Update package.json with Foundry scripts (build, test, deploy)
- Create base Deploy and DeployUUPS scripts with UUPS proxy support
- Add example TimeLockResolver contract with full test coverage (8/8 passing)
- Add example SimpleUnderwriterPolicy contract with FHE support
- Update .gitignore for Foundry artifacts (out/, broadcast/, cache_forge/)
- Remove Hardhat-specific files (hardhat.config.ts, tsconfig.json, scripts/)

Test Results:
- forge build: ✅ successful
- forge test: TimeLockResolver tests 8/8 passing
- SimpleUnderwriterPolicy tests 7/11 passing (FHE mock setup needed)

Ready for deployment testing on Arbitrum Sepolia testnet.
@madschristensen99 madschristensen99 marked this pull request as draft April 17, 2026 15:35
The lib/ folder should be gitignored and managed via forge install.
Users will run 'forge install' to pull dependencies locally.
- Replace Hardhat CI workflow with Foundry commands
- Remove duplicate test.yml workflow
- Update paths to monitor script/ instead of scripts/
- Add forge fmt formatting check
- Run forge build and forge test in CI
- Format all Solidity files with forge fmt
Dependencies in lib/ are gitignored, so CI needs to run 'forge install --no-commit' to download them before building and testing.
The --no-commit flag doesn't exist in forge install command.
forge install doesn't work with .gitmodules, need to use git submodule update --init --recursive
Use 'forge install --no-commit' with explicit package names in CI instead of git submodules. This avoids submodule complexity while keeping lib/ gitignored.
- Remove FHE mock setup that required hardhat dependencies
- Add note that FHE operations require CoFHE precompile (testnet/production)
- Fix COVERAGE_ID usage in tests
- Add vm.warp to avoid timestamp underflow
- All tests now passing: TimeLockResolver 8/8, SimpleUnderwriterPolicy 7/7
@madschristensen99 madschristensen99 marked this pull request as ready for review April 17, 2026 16:03
Add try-catch around vm.writeJson to handle permission errors when running scripts without --ffi flag. Deployment still succeeds and logs contract address.
@0xkkkn 0xkkkn self-requested a review April 18, 2026 04:41
@grimnote grimnote merged commit 1982863 into ReineiraOS:main Apr 20, 2026
3 checks passed
0xkkkn added a commit that referenced this pull request Apr 27, 2026
)

CI:
- forge install FhenixProtocol/cofhe-contracts@v0.1.3 (was unpinned)
- forge install FhenixProtocol/cofhesdk@6af05d94 (= @cofhe/sdk@0.5.1 monorepo) replaces standalone cofhe-mock-contracts

foundry.toml remappings:
- @fhenixprotocol/cofhe-mock-contracts/=lib/cofhe-mock-contracts/contracts/ → @cofhe/mock-contracts/=lib/cofhesdk/packages/mock-contracts/
- Added @cofhe/foundry-plugin/=lib/cofhesdk/packages/foundry-plugin/ (CofheTest helper moved here in v0.5)

reineira.json:
- Removed stale cofhejs / hardhat refs (main migrated to Foundry in #5)
- Added @cofhe/sdk: ^0.5.1, foundry: >=0.2.0

Verified: forge build OK, forge test 15/15 pass.
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.

3 participants