Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Adjust compiler settings and document optimizer usage #99

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.20'
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: { evmVersion: 'london', ...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
Loading