From fa4d6b146d472029ec8283fd29a29000143551aa Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Wed, 6 Sep 2023 15:29:01 +0800 Subject: [PATCH] evm: Enable DST20 optimisation (#2375) * Enable DST20 optimisation * Use maximum number of runs * Use u32::MAX * nightly fmt --------- Co-authored-by: Prasanna Loganathar --- lib/ain-contracts/build.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ain-contracts/build.rs b/lib/ain-contracts/build.rs index 8c8a474330..55a37fc2c6 100644 --- a/lib/ain-contracts/build.rs +++ b/lib/ain-contracts/build.rs @@ -1,7 +1,7 @@ use std::{env, fs, path::PathBuf}; use anyhow::format_err; -use ethers_solc::{Project, ProjectPathsConfig, Solc}; +use ethers_solc::{artifacts::Optimizer, Project, ProjectPathsConfig, Solc, SolcConfig}; fn main() -> Result<(), Box> { // compile solidity project @@ -26,8 +26,17 @@ fn main() -> Result<(), Box> { .sources(&root) .build()?; + let mut solc_config = SolcConfig::builder().build(); + + solc_config.settings.optimizer = Optimizer { + enabled: Some(true), + runs: Some(u32::MAX as usize), + details: None, + }; + let project = Project::builder() .solc(solc) + .solc_config(solc_config) .paths(paths) .set_auto_detect(true) .no_artifacts()