From fa34061b00e632799fa40aec9acaae1964ea2b24 Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Wed, 23 Aug 2023 17:20:13 +0800 Subject: [PATCH 1/4] Enable DST20 optimisation --- lib/ain-contracts/build.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/ain-contracts/build.rs b/lib/ain-contracts/build.rs index 927a7fbe15..226308d1c4 100644 --- a/lib/ain-contracts/build.rs +++ b/lib/ain-contracts/build.rs @@ -3,7 +3,9 @@ use std::fs; use std::path::PathBuf; use anyhow::format_err; -use ethers_solc::{Project, ProjectPathsConfig, Solc}; +use ethers_solc::artifacts::output_selection::OutputSelection; +use ethers_solc::artifacts::{Optimizer, Settings}; +use ethers_solc::{Project, ProjectPathsConfig, Solc, SolcConfig}; fn main() -> Result<(), Box> { // compile solidity project @@ -26,8 +28,28 @@ fn main() -> Result<(), Box> { .sources(&root) .build()?; + let solc_config = SolcConfig::builder() + .settings(Settings { + stop_after: None, + remappings: vec![], + optimizer: Optimizer { + enabled: Some(true), + runs: Some(10000), + details: None, + }, + model_checker: None, + metadata: None, + output_selection: OutputSelection::default_output_selection(), + evm_version: None, + via_ir: None, + debug: None, + libraries: Default::default(), + }) + .build(); + let project = Project::builder() .solc(solc) + .solc_config(solc_config) .paths(paths) .set_auto_detect(true) .no_artifacts() From 49a136bfed6f718b652e3c52926717e7092d509c Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Thu, 24 Aug 2023 16:04:13 +0800 Subject: [PATCH 2/4] Use maximum number of runs --- lib/ain-contracts/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ain-contracts/build.rs b/lib/ain-contracts/build.rs index 226308d1c4..a5e186b6cd 100644 --- a/lib/ain-contracts/build.rs +++ b/lib/ain-contracts/build.rs @@ -34,7 +34,7 @@ fn main() -> Result<(), Box> { remappings: vec![], optimizer: Optimizer { enabled: Some(true), - runs: Some(10000), + runs: Some(usize::MAX), details: None, }, model_checker: None, From 03d58f3cf5f1f6434b32439cc537961d13cfad0b Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Fri, 25 Aug 2023 16:21:59 +0800 Subject: [PATCH 3/4] Use u32::MAX --- lib/ain-contracts/build.rs | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/ain-contracts/build.rs b/lib/ain-contracts/build.rs index a5e186b6cd..7b42d184bd 100644 --- a/lib/ain-contracts/build.rs +++ b/lib/ain-contracts/build.rs @@ -3,8 +3,7 @@ use std::fs; use std::path::PathBuf; use anyhow::format_err; -use ethers_solc::artifacts::output_selection::OutputSelection; -use ethers_solc::artifacts::{Optimizer, Settings}; +use ethers_solc::artifacts::Optimizer; use ethers_solc::{Project, ProjectPathsConfig, Solc, SolcConfig}; fn main() -> Result<(), Box> { @@ -28,24 +27,13 @@ fn main() -> Result<(), Box> { .sources(&root) .build()?; - let solc_config = SolcConfig::builder() - .settings(Settings { - stop_after: None, - remappings: vec![], - optimizer: Optimizer { - enabled: Some(true), - runs: Some(usize::MAX), - details: None, - }, - model_checker: None, - metadata: None, - output_selection: OutputSelection::default_output_selection(), - evm_version: None, - via_ir: None, - debug: None, - libraries: Default::default(), - }) - .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) From 77b1794fd8a73457d787179aff48db9a4ef5cd34 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Wed, 6 Sep 2023 15:28:37 +0800 Subject: [PATCH 4/4] nightly fmt --- lib/ain-contracts/build.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ain-contracts/build.rs b/lib/ain-contracts/build.rs index bb972af3e5..55a37fc2c6 100644 --- a/lib/ain-contracts/build.rs +++ b/lib/ain-contracts/build.rs @@ -1,8 +1,7 @@ use std::{env, fs, path::PathBuf}; use anyhow::format_err; -use ethers_solc::artifacts::Optimizer; -use ethers_solc::{Project, ProjectPathsConfig, Solc, SolcConfig}; +use ethers_solc::{artifacts::Optimizer, Project, ProjectPathsConfig, Solc, SolcConfig}; fn main() -> Result<(), Box> { // compile solidity project