From bf3929efafd28e9ca8bce189f6b794fb6ab9a7d7 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Fri, 24 Sep 2021 10:14:21 -0400 Subject: [PATCH] chore(contracts): increase optimizer runs to 10,000 I observed a very small savings from increasing the optimizer runs, and no noticable impact on compile time --- packages/contracts/hardhat.config.ts | 4 ++-- .../L1/rollup/CanonicalTransactionChain.gas.spec.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/contracts/hardhat.config.ts b/packages/contracts/hardhat.config.ts index cddbb5972d5c..68d3d6582442 100644 --- a/packages/contracts/hardhat.config.ts +++ b/packages/contracts/hardhat.config.ts @@ -61,7 +61,7 @@ const config: HardhatUserConfig = { { version: '0.8.8', settings: { - optimizer: { enabled: true, runs: 200 }, + optimizer: { enabled: true, runs: 10_000 }, metadata: { bytecodeHash: 'none', }, @@ -75,7 +75,7 @@ const config: HardhatUserConfig = { { version: '0.5.17', // Required for WETH9 settings: { - optimizer: { enabled: true, runs: 200 }, + optimizer: { enabled: true, runs: 10_000 }, outputSelection: { '*': { '*': ['storageLayout'], diff --git a/packages/contracts/test/contracts/L1/rollup/CanonicalTransactionChain.gas.spec.ts b/packages/contracts/test/contracts/L1/rollup/CanonicalTransactionChain.gas.spec.ts index ce625c8e830e..5a6dbd1979b5 100644 --- a/packages/contracts/test/contracts/L1/rollup/CanonicalTransactionChain.gas.spec.ts +++ b/packages/contracts/test/contracts/L1/rollup/CanonicalTransactionChain.gas.spec.ts @@ -163,7 +163,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => { 'Non-calldata overhead gas cost per transaction:', (gasUsed - fixedCalldataCost) / numTxs ) - expectApprox(gasUsed, 1_605_796, { + expectApprox(gasUsed, 1_604_975, { upperPercentDeviation: 0, // Assert a lower bound of 1% reduction on gas cost. If your tests are breaking because your // contracts are too efficient, consider updating the target value! @@ -211,7 +211,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => { 'Non-calldata overhead gas cost per transaction:', (gasUsed - fixedCalldataCost) / numTxs ) - expectApprox(gasUsed, 1_739_811, { + expectApprox(gasUsed, 1_738_990, { upperPercentDeviation: 0, // Assert a lower bound of 1% reduction on gas cost. If your tests are breaking because your // contracts are too efficient, consider updating the target value! @@ -297,7 +297,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => { console.log('Benchmark complete.') console.log('Gas used:', gasUsed) - expectApprox(gasUsed, 217_615, { + expectApprox(gasUsed, 217_218, { upperPercentDeviation: 0, // Assert a lower bound of 1% reduction on gas cost. If your tests are breaking because your // contracts are too efficient, consider updating the target value! @@ -319,7 +319,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => { console.log('Benchmark complete.') console.log('Gas used:', gasUsed) - expectApprox(gasUsed, 156_711, { + expectApprox(gasUsed, 156_314, { upperPercentDeviation: 0, // Assert a lower bound of 1% reduction on gas cost. If your tests are breaking because your // contracts are too efficient, consider updating the target value!