Skip to content

Commit

Permalink
Adjust compiler settings and document optimizer usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mmv08 committed Oct 18, 2023
1 parent 06c2936 commit 9b3bcbd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions 4337/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ npx hardhat --network <network> etherscan-verify
npx hardhat --network <network> local-verify
```

### Compiler settings

The project uses Solidity compiler version `0.8.21` with 10 million optimizer runs, as we want to optimize for the code execution costs. The evm version is set to `paris`, because not all of our target networks support the opcodes introduced in the `Shanghai` EVM upgrade.

After careful consideration, we decided to enable the optimizer for the following reasons:
- The most critical functionality is handled by the Safe and Entrypoint contracts, such as signature checks and replay protection.
- The Entrypoint contract uses the optimizer

#### Custom Networks

It is possible to use the `NODE_URL` env var to connect to any EVM based network via an RPC endpoint. This connection then can be used with the `custom` network.
Expand Down
6 changes: 3 additions & 3 deletions 4337/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import './src/tasks/local_verify'
import './src/tasks/deploy_contracts'
import './src/tasks/show_codesize'

const primarySolidityVersion = SOLIDITY_VERSION || '0.8.14'
const soliditySettings = !!SOLIDITY_SETTINGS ? JSON.parse(SOLIDITY_SETTINGS) : { optimizer: { enabled: true, runs: 200 } }
const primarySolidityVersion = SOLIDITY_VERSION || '0.8.21'
const soliditySettings = !!SOLIDITY_SETTINGS ? JSON.parse(SOLIDITY_SETTINGS) : { optimizer: { enabled: true, runs: 10_000_000 } }

const userConfig: HardhatUserConfig = {
paths: {
Expand All @@ -47,7 +47,7 @@ const userConfig: HardhatUserConfig = {
sources: 'contracts',
},
solidity: {
compilers: [{ version: primarySolidityVersion, settings: soliditySettings }, { version: '0.6.12' }, { version: '0.5.17' }],
compilers: [{ version: primarySolidityVersion, settings: { evmVersion: 'paris', ...soliditySettings }}, { version: '0.6.12' }, { version: '0.5.17' }],
},
networks: {
hardhat: {
Expand Down

0 comments on commit 9b3bcbd

Please sign in to comment.