Why we chose to use Hardhat and Foundry together #394
codenamejason
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Why we chose to use Hardhat and Foundry together
TL;DR;
The choice of testing and deployment frameworks can significantly impact the development workflow and efficiency. Opting for Forge for testing and Hardhat for deployment seemed like a balanced approach, leveraging the strengths of each framework:
Forge for Testing:
Hardhat for Deployment:
This bifurcated approach allows our team to harness the specialized functionalities and advantages of both frameworks, potentially leading to a more streamlined and effective development process. The key is to ensure smooth interoperability between the two frameworks, which may require some additional configuration or tooling, but could result in a powerful and flexible development setup.
Deployment with Hardhat:
Hardhat and Foundry are two distinct frameworks used for developing and deploying smart contracts on the Ethereum blockchain. Here's an overview of some differences between Hardhat and Foundry deployments, particularly focusing on the handling of proxy upgradeable contracts:
Deployment of Proxy Upgradeable Contracts:
upgrades.deployProxy
method being used for this purpose in Hardhat [1].Configuration:
hardhat.config.js
file, and Foundry generating afoundry.toml
file upon project creation.foundry.toml
file are related to tests such as verbosity, account, balance, gas price, etc [2].Usability & Complexity:
Templates:
Project Structure:
Foundry's apparent lack of support for deploying proxy upgradeable contracts as seamlessly as Hardhat—is consistent with the information sourced. This might necessitate additional steps or different methods to achieve a similar result when using Foundry.
Testing with Forge
Testing smart contracts is a crucial aspect of blockchain development to ensure the robustness and security of the code. Both Forge (a part of the Foundry framework) and Hardhat offer tools for testing, though they have distinct differences in their approach and functionalities:
Language Utilized for Testing:
Testing Commands and Functionalities:
forge test
: To run the project's tests.forge snapshot
: To create a snapshot of each test's gas usage.forge coverage
: To generate coverage reports [5].Performance:
Implementation Language:
Additional Testing Features in Forge:
Ease of Use for Solidity Developers:
Compile Time:
Testing, Building, and Deployment:
Sources:
[1]
[2]
[3]
[4]
[5]
Beta Was this translation helpful? Give feedback.
All reactions