From fa126618f5a801d16e223e2d07ecb733da176941 Mon Sep 17 00:00:00 2001 From: Simone Date: Wed, 15 Jan 2025 18:09:49 +0100 Subject: [PATCH] Fix foundry optimizer key --- crytic_compile/platform/hardhat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crytic_compile/platform/hardhat.py b/crytic_compile/platform/hardhat.py index 35a02122..964da77b 100755 --- a/crytic_compile/platform/hardhat.py +++ b/crytic_compile/platform/hardhat.py @@ -74,7 +74,8 @@ def hardhat_like_parsing( version_from_config = loaded_json["solcVersion"] # TODO supper vyper input_json = loaded_json["input"] compiler = "solc" if input_json["language"] == "Solidity" else "vyper" - optimized = input_json["settings"]["optimizer"]["enabled"] + # Foundry has the optimizer dict empty when the "optimizer" key is not set in foundry.toml + optimized = input_json["settings"]["optimizer"].get("enabled", False) compilation_unit.compiler_version = CompilerVersion( compiler=compiler, version=version_from_config, optimized=optimized