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

Using safe-singleton-factory for module deployment #477

Merged
merged 11 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
29 changes: 22 additions & 7 deletions modules/4337/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This changelog only contains changes starting from version 0.2.0

# Version 0.3.0
# Version 0.3.1
remedcu marked this conversation as resolved.
Show resolved Hide resolved

## Compiler settings

Expand All @@ -16,18 +16,33 @@ The official deployments support the EntryPoint v0.7.0 with the canonical deploy

## Expected addresses

- `SafeModuleSetup` at `0x2dd68b007B46fBe91B9A7c3EDa5A7a1063cB5b47`
- `Safe4337Module` at `0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226`
- `SafeModuleSetup` at `0xF2C2C95C168Ef121b052B4c518889CFe166cB4Fa`
- `Safe4337Module` at `0x68C77b778228823a06e3CbcDA816d46D80B1C728`
remedcu marked this conversation as resolved.
Show resolved Hide resolved

## Changes
remedcu marked this conversation as resolved.
Show resolved Hide resolved

### Security Fixes
### General

None
- Using the [`safe-singleton-factory`](https://github.com/safe-global/safe-singleton-factory) to deploy contracts.

### Compatibility Fixes
# Version 0.3.0

## Compiler settings

None
Solidity compiler: [0.8.23](https://github.com/ethereum/solidity/releases/tag/v0.8.23)

Solidity optimizer: enabled with 10.000.000 runs

## Supported EntryPoint

The official deployments support the EntryPoint v0.7.0 with the canonical deployment at `0x0000000071727De22E5E9d8BAf0edAc6f37da032`.

## Expected addresses

- `SafeModuleSetup` at `0x2dd68b007B46fBe91B9A7c3EDa5A7a1063cB5b47`
- `Safe4337Module` at `0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226`

## Changes

### General

Expand Down
2 changes: 1 addition & 1 deletion modules/4337/certora/conf/Safe4337Module.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"verify": "Safe4337Module:certora/specs/Safe4337Module.spec",
"packages": [
"@account-abstraction=../../node_modules/.pnpm/@account-abstraction+contracts@0.7.0/node_modules/@account-abstraction",
"@safe-global=../../node_modules/.pnpm/@safe-global+safe-contracts@1.4.1-build.0_ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@6.0.4_/node_modules/@safe-global"
"@safe-global=../../node_modules/.pnpm/@safe-global+safe-contracts@1.4.1-build.0_ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10_/node_modules/@safe-global"
]
}
2 changes: 1 addition & 1 deletion modules/4337/certora/conf/SignatureLengthCheck.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"verify": "Safe4337ModuleHarness:certora/specs/SignatureLengthCheck.spec",
"packages": [
"@account-abstraction=../../node_modules/.pnpm/@account-abstraction+contracts@0.7.0/node_modules/@account-abstraction",
"@safe-global=../../node_modules/.pnpm/@safe-global+safe-contracts@1.4.1-build.0_ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@6.0.4_/node_modules/@safe-global"
"@safe-global=../../node_modules/.pnpm/@safe-global+safe-contracts@1.4.1-build.0_ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10_/node_modules/@safe-global"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"verify": "Safe4337Module:certora/specs/TransactionExecutionMethods.spec",
"packages": [
"@account-abstraction=../../node_modules/.pnpm/@account-abstraction+contracts@0.7.0/node_modules/@account-abstraction",
"@safe-global=../../node_modules/.pnpm/@safe-global+safe-contracts@1.4.1-build.0_ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@6.0.4_/node_modules/@safe-global"
"@safe-global=../../node_modules/.pnpm/@safe-global+safe-contracts@1.4.1-build.0_ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10_/node_modules/@safe-global"
]
}
2 changes: 1 addition & 1 deletion modules/4337/certora/conf/ValidationDataLastBitOne.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"verify": "Safe4337Module:certora/specs/ValidationDataLastBitOne.spec",
"packages": [
"@account-abstraction=../../node_modules/.pnpm/@account-abstraction+contracts@0.7.0/node_modules/@account-abstraction",
"@safe-global=../../node_modules/.pnpm/@safe-global+safe-contracts@1.4.1-build.0_ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@6.0.4_/node_modules/@safe-global"
"@safe-global=../../node_modules/.pnpm/@safe-global+safe-contracts@1.4.1-build.0_ethers@6.13.1_bufferutil@4.0.8_utf-8-validate@5.0.10_/node_modules/@safe-global"
]
}
30 changes: 26 additions & 4 deletions modules/4337/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import 'hardhat-deploy'
import dotenv from 'dotenv'
import type { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types'
import yargs from 'yargs/yargs'
import { getSingletonFactoryInfo } from '@safe-global/safe-singleton-factory'
import { DeterministicDeploymentInfo } from 'hardhat-deploy/dist/types'
import './src/tasks/localVerify'
import './src/tasks/deployContracts'
import './src/tasks/codesize'

const argv = yargs(process.argv.slice(2))
.options({ network: { type: 'string', default: 'hardhat' } })
Expand All @@ -30,10 +35,6 @@ if (['mainnet', 'sepolia', 'polygon', 'amoy'].includes(argv.network) && INFURA_K
throw new Error(`Could not find Infura key in env, unable to connect to network ${argv.network}`)
}

import './src/tasks/localVerify'
import './src/tasks/deployContracts'
import './src/tasks/codesize'

const solidityVersion = SOLIDITY_VERSION || '0.8.23'
const soliditySettings = SOLIDITY_SETTINGS
? JSON.parse(SOLIDITY_SETTINGS)
Expand All @@ -45,6 +46,26 @@ const soliditySettings = SOLIDITY_SETTINGS
},
}

const deterministicDeployment = (network: string): DeterministicDeploymentInfo => {
const info = getSingletonFactoryInfo(parseInt(network))
if (!info) {
throw new Error(`
Safe factory not found for network ${network}. You can request a new deployment at https://github.com/safe-global/safe-singleton-factory.
For more information, see https://github.com/safe-global/safe-smart-account#replay-protection-eip-155
`)
}

const gasLimit = BigInt(info.gasLimit)
const gasPrice = BigInt(info.gasPrice)

return {
factory: info.address,
deployer: info.signerAddress,
funding: String(gasLimit * gasPrice),
signedTx: info.transaction,
}
}

const customNetwork = NODE_URL
? {
custom: {
Expand Down Expand Up @@ -98,6 +119,7 @@ const userConfig: HardhatUserConfig = {
},
...customNetwork,
},
deterministicDeployment,
namedAccounts: {
deployer: 0,
},
Expand Down
2 changes: 0 additions & 2 deletions modules/allowances/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import '@nomicfoundation/hardhat-toolbox'
import 'hardhat-deploy'

import './tasks/deploy_verify'

import dotenv from 'dotenv'
import { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types'
import { DeterministicDeploymentInfo } from 'hardhat-deploy/dist/types'
Expand Down
1 change: 0 additions & 1 deletion modules/allowances/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@openzeppelin/contracts": "^5.0.2",
"@safe-global/safe-deployments": "^1.37.0",
"@safe-global/safe-singleton-factory": "^1.0.25",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/mocha": "^10.0.7",
Expand Down
9 changes: 5 additions & 4 deletions modules/passkey/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ EVM target: Paris

## Expected addresses

- `SafeWebAuthnSignerFactory` at `TBD`
- `SafeWebAuthnSharedSigner` at `TBD`
- `DaimoP256Verifier` at `0xc2b78104907F722DABAc4C69f826a522B2754De4`
- `FCLP256Verifier` at `TBD`
- `SafeWebAuthnSignerFactory` at `0x1d31F259eE307358a26dFb23EB365939E8641195`
- `SafeWebAuthnSharedSigner` at `0x94a4F6affBd8975951142c3999aEAB7ecee555c2`
- `DaimoP256Verifier` at `0xfd08a316255D83133c5d74EcF62B625414f68C14`
remedcu marked this conversation as resolved.
Show resolved Hide resolved
- `FCLP256Verifier` at `0xA86e0054C51E4894D88762a017ECc5E5235f5DBA`
remedcu marked this conversation as resolved.
Show resolved Hide resolved

## Changes

Expand All @@ -28,6 +28,7 @@ EVM target: Paris
- Index the `signer` field for `Created` event in the `SafeWebAuthnSignerFactory` contract.
- Use more consistent compiler version pragmas throughout the contracts.
- Initial release of the `SafeWebAuthnSharedSigner` contract.
- Using the [`safe-singleton-factory`](https://github.com/safe-global/safe-singleton-factory) to deploy contracts.

# Version 0.2.0

Expand Down
23 changes: 23 additions & 0 deletions modules/passkey/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { HttpNetworkUserConfig } from 'hardhat/types'
import './src/tasks/codesize'
import './src/tasks/deployContracts'
import './src/tasks/localVerify'
import { getSingletonFactoryInfo } from "@safe-global/safe-singleton-factory";
import { DeterministicDeploymentInfo } from "hardhat-deploy/dist/types";

dotenv.config()
const { CUSTOM_NODE_URL, MNEMONIC, ETHERSCAN_API_KEY, PK } = process.env
Expand Down Expand Up @@ -43,6 +45,26 @@ const compilerSettings = {
},
}

const deterministicDeployment = (network: string): DeterministicDeploymentInfo => {
const info = getSingletonFactoryInfo(parseInt(network));
if (!info) {
throw new Error(`
Safe factory not found for network ${network}. You can request a new deployment at https://github.com/safe-global/safe-singleton-factory.
For more information, see https://github.com/safe-global/safe-smart-account#replay-protection-eip-155
`);
}

const gasLimit = BigInt(info.gasLimit)
const gasPrice = BigInt(info.gasPrice)

return {
factory: info.address,
deployer: info.signerAddress,
funding: String(gasLimit * gasPrice),
signedTx: info.transaction,
};
};

const config: HardhatUserConfig = {
paths: {
artifacts: 'build/artifacts',
Expand All @@ -65,6 +87,7 @@ const config: HardhatUserConfig = {
},
...customNetwork,
},
deterministicDeployment,
solidity: {
compilers: [compilerSettings],
overrides: {
Expand Down
22 changes: 22 additions & 0 deletions modules/recovery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

# Version 0.1.1
remedcu marked this conversation as resolved.
Show resolved Hide resolved

## Compiler settings

Solidity compiler: [0.8.20](https://github.com/ethereum/solidity/releases/tag/v0.8.20)

Solidity optimizer: enabled via IR with 1.000.000 runs

## Recovery Period

The recovery period is 14 days.

## Expected addresses

- `SocialRecoveryModule` at `0x9BacD92F4687Db306D7ded5d4513a51EA05df25b`

## Changes

### General

- Using the [`safe-singleton-factory`](https://github.com/safe-global/safe-singleton-factory) to deploy contracts.

# Version 0.1.0

## Compiler settings
Expand Down
23 changes: 23 additions & 0 deletions modules/recovery/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'hardhat-deploy'
import dotenv from 'dotenv'
import type { HardhatUserConfig, HttpNetworkUserConfig } from 'hardhat/types'
import yargs from 'yargs/yargs'
import { getSingletonFactoryInfo } from "@safe-global/safe-singleton-factory";
import { DeterministicDeploymentInfo } from "hardhat-deploy/dist/types";

import './src/tasks/deployContracts'
import './src/tasks/localVerify'
Expand Down Expand Up @@ -42,6 +44,26 @@ const customNetwork = CUSTOM_NODE_URL
}
: {}

const deterministicDeployment = (network: string): DeterministicDeploymentInfo => {
const info = getSingletonFactoryInfo(parseInt(network));
if (!info) {
throw new Error(`
Safe factory not found for network ${network}. You can request a new deployment at https://github.com/safe-global/safe-singleton-factory.
For more information, see https://github.com/safe-global/safe-smart-account#replay-protection-eip-155
`);
}

const gasLimit = BigInt(info.gasLimit)
const gasPrice = BigInt(info.gasPrice)

return {
factory: info.address,
deployer: info.signerAddress,
funding: String(gasLimit * gasPrice),
signedTx: info.transaction,
};
};

const userConfig: HardhatUserConfig = {
paths: {
artifacts: 'build/artifacts',
Expand Down Expand Up @@ -71,6 +93,7 @@ const userConfig: HardhatUserConfig = {
},
...customNetwork,
},
deterministicDeployment,
namedAccounts: {
deployer: 0,
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"pnpm": "^9"
},
"devDependencies": {
"@safe-global/safe-singleton-factory": "^1.0.31",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"eslint": "^8.57.0",
Expand Down
Loading
Loading