From c40fca742796081e3652edd7d6261773344c7fd8 Mon Sep 17 00:00:00 2001 From: Jay Paik Date: Thu, 4 Jan 2024 20:47:15 -0500 Subject: [PATCH] chore: add optimized-build profile --- .gitignore | 3 ++- README.md | 3 +++ foundry.toml | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b8896348..6bbaff28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Foundry build and cache directories out/ +out-optimized/ cache/ node_modules/ @@ -8,4 +9,4 @@ report/ lcov.info # secret -.env \ No newline at end of file +.env diff --git a/README.md b/README.md index 1b4018e5..9822f627 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,9 @@ forge build # or use the lite profile to reduce compilation time FOUNDRY_PROFILE=lite forge build + +# for faster IR builds (to check contract sizes) +FOUNDRY_PROFILE=optimized-build forge build --sizes ``` ## Syntax check diff --git a/foundry.toml b/foundry.toml index 2d276cd1..ffb522b1 100644 --- a/foundry.toml +++ b/foundry.toml @@ -17,6 +17,12 @@ runs=500 fail_on_revert = true depth = 10 +[profile.optimized-build] +via_ir = true +script = 'src' +test = 'src' +out = 'out-optimized' + [profile.lite] solc = '0.8.21' via_ir = false @@ -44,4 +50,4 @@ goerli = "${GOERLI_RPC_URL}" mainnet = { key = "${ETHERSCAN_API_KEY}" } goerli = { key = "${ETHERSCAN_API_KEY}" } -# See more config options https://github.com/foundry-rs/foundry/tree/master/config \ No newline at end of file +# See more config options https://github.com/foundry-rs/foundry/tree/master/config