Skip to content

Commit

Permalink
Merge branch 'main' into gelato-4337
Browse files Browse the repository at this point in the history
  • Loading branch information
remedcu authored Mar 18, 2024
2 parents af539ba + 4ad1f0c commit 1849ac9
Show file tree
Hide file tree
Showing 80 changed files with 1,368 additions and 1,832 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/certora_4337.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,13 @@ jobs:
strategy:
matrix:
rule: ['verify4337Module.sh', 'verifyTransactionExecutionMethods.sh', 'verifyValidationData.sh']
defaults:
run:
working-directory: ./modules/4337
steps:
- uses: actions/checkout@v3

- name: Install python
uses: actions/setup-python@v4
with: { python-version: 3.11 }

- name: Install java
uses: actions/setup-java@v3
with: { java-version: '17', java-package: jre, distribution: semeru }

- name: Install certora cli
run: pip install -Iv certora-cli==6.1.3

Expand All @@ -47,6 +40,7 @@ jobs:
run: npm ci

- name: Verify rule ${{ matrix.rule }}
working-directory: ./modules/4337
run: |
echo "key length" ${#CERTORAKEY}
chmod +x ./certora/scripts/${{ matrix.rule }}
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/ci_4337.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
node-version: 20.x
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm run build -w modules/4337 && npm run build:ts -w modules/4337
- run: npm run coverage -w modules/4337
- run: |
npm ci
npm run coverage -w modules/4337
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand All @@ -33,7 +33,7 @@ jobs:
cache-dependency-path: package-lock.json
- run: |
npm ci
npm run test:e2e -w modules/4337
npm run test:4337 -w modules/4337
lint:
runs-on: ubuntu-latest
steps:
Expand All @@ -43,6 +43,7 @@ jobs:
node-version: 20.x
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm run lint -w modules/4337
- run: npm run fmt:check -w modules/4337
- run: |
npm ci
npm run lint -w modules/4337
npm run fmt:check -w modules/4337
9 changes: 5 additions & 4 deletions .github/workflows/ci_4337_gas_metering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
node-version: 20.x
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm run fmt:check -w examples/4337-gas-metering
- run: npm run lint -w examples/4337-gas-metering
- run: npm run build -w examples/4337-gas-metering
- run: |
npm ci
npm run fmt:check -w examples/4337-gas-metering
npm run lint -w examples/4337-gas-metering
npm run build -w examples/4337-gas-metering
19 changes: 19 additions & 0 deletions .github/workflows/ci_4337_local_bundler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: safe-modules-4337-local-bundler
on:
push:
paths:
- 'packages/4337-local-bundler/**'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
cache-dependency-path: package-lock.json
- run: |
npm ci
npm run lint -w packages/4337-local-bundler
7 changes: 5 additions & 2 deletions .github/workflows/ci_4337_upstream_bundler.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 4337 Module End-to-End Tests With Upstream Bundler
name: 4337 End-to-End Tests With Upstream Bundler
on:
schedule:
# * is a special character in YAML so you have to quote this string
Expand All @@ -7,6 +7,8 @@ on:
push:
paths:
- 'modules/4337/**'
- 'modules/passkey/**'
- 'packages/4337-local-bundler/**'

jobs:
e2e-upstream-bundler:
Expand All @@ -20,4 +22,5 @@ jobs:
cache-dependency-path: package-lock.json
- run: |
npm ci
npm run test:e2e:upstream -w modules/4337
npm run test:4337:upstream -w modules/4337
npm run test:4337:upstream -w modules/passkey
4 changes: 0 additions & 4 deletions .github/workflows/ci_passkey_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ jobs:
cache: npm
cache-dependency-path: package-lock.json
- run: |
npm ci
# Build the 4337 module so the app can use the artifacts
npm run build -w modules/4337
# Reinstall the dependencies so the 4337 dependency includes artifacts
npm ci
npm run lint -w examples/4337-passkeys
npm run build -w examples/4337-passkeys
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
modules/**
examples/**
modules/**
packages/**
3 changes: 1 addition & 2 deletions examples/4337-gas-metering/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"alchemy:erc721": "tsx ./alchemy/alchemy.ts erc721",
"alchemy:erc721:paymaster": "tsx ./alchemy/alchemy.ts erc721 paymaster=true",
"alchemy": "tsx ./alchemy/alchemy.ts",
"build": "npx rimraf dist && tsc",
"build": "rimraf dist && tsc",
"fmt": "prettier --write .",
"fmt:check": "prettier --check .",
"lint": "eslint ./alchemy && eslint ./gelato && eslint ./pimlico && eslint ./utils",
Expand Down Expand Up @@ -60,7 +60,6 @@
"devDependencies": {
"@gelatonetwork/relay-sdk": "^5.5.6",
"@types/node": "20.11.18",
"rimraf": "^5.0.5",
"tsx": "4.7.1",
"typescript": "^5.3.3"
}
Expand Down
8 changes: 4 additions & 4 deletions modules/4337/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ const userConfig: HardhatUserConfig = {
networks: {
localhost: {
url: 'http://localhost:8545',
tags: ['dev', 'safe'],
tags: ['dev', 'entrypoint', 'safe'],
},
hardhat: {
gasPrice: 10000000000,
tags: ['test'],
tags: ['test', 'entrypoint', 'safe'],
},
mainnet: {
...sharedNetworkConfig,
Expand All @@ -88,12 +88,12 @@ const userConfig: HardhatUserConfig = {
sepolia: {
...sharedNetworkConfig,
url: `https://sepolia.infura.io/v3/${INFURA_KEY}`,
tags: ['dev'],
tags: ['dev', 'entrypoint'],
},
amoy: {
...sharedNetworkConfig,
url: `https://polygon-amoy.infura.io/v3/${INFURA_KEY}`,
tags: ['dev'],
tags: ['dev', 'entrypoint'],
},
...customNetwork,
},
Expand Down
22 changes: 11 additions & 11 deletions modules/4337/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
],
"scripts": {
"build": "npm run build:sol && npm run build:ts",
"build:ts": "npx rimraf dist && tsc",
"build:sol": "npx rimraf build && hardhat compile",
"build:ts": "rimraf dist && tsc",
"build:sol": "rimraf build typechain-types && hardhat compile",
"test": "hardhat test --deploy-fixture",
"test:e2e": "./test/e2e/run.sh",
"test:e2e:upstream": "USE_UPSTREAM_BUNDLER=1 ./test/e2e/run.sh",
"test:all": "npm run test && npm run test:e2e",
"test:4337": "4337-local-bundler-test",
"test:4337:upstream": "USE_UPSTREAM_BUNDLER=1 4337-local-bundler-test",
"test:all": "npm run test && npm run test:4337",
"coverage": "hardhat coverage",
"codesize": "hardhat codesize",
"benchmark": "npm run test benchmark/*.ts",
Expand All @@ -31,9 +31,7 @@
"lint:ts": "eslint ./src --fix && eslint ./test --fix",
"fmt": "prettier --write ./contracts/**/*.sol",
"fmt:check": "prettier --check ./**/*.sol",
"prepack": "npm run build",
"prepublish": "npm run build",
"postinstall": "npm run build"
"prepare": "npm run build"
},
"repository": {
"type": "git",
Expand All @@ -54,6 +52,8 @@
"@noble/curves": "^1.3.0",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@openzeppelin/contracts": "^5.0.2",
"@safe-global/safe-4337-local-bundler": "^0.0.0",
"@safe-global/safe-4337-provider": "^0.0.0",
"@simplewebauthn/server": "9.0.0",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
Expand All @@ -63,8 +63,8 @@
"debug": "^4.3.4",
"dotenv": "^16.4.4",
"ethers": "^6.11.1",
"hardhat": "^2.20.1",
"hardhat-deploy": "0.11.45",
"hardhat": "^2.21.0",
"hardhat-deploy": "^0.12.1",
"husky": "^9.0.11",
"solc": "^0.8.24",
"solhint": "^4.1.1",
Expand All @@ -74,7 +74,7 @@
},
"overrides": {
"@safe-global/safe-contracts": {
"ethers": "^6.11.0"
"ethers": "^6.11.1"
}
},
"dependencies": {
Expand Down
26 changes: 2 additions & 24 deletions modules/4337/src/deploy/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
import EntryPoint from '@account-abstraction/contracts/artifacts/EntryPoint.json'
import { DeployFunction } from 'hardhat-deploy/types'
import { deployEntryPoint } from '@safe-global/safe-4337-local-bundler'

const ENTRY_POINT = process.env.DEPLOYMENT_ENTRY_POINT_ADDRESS

const deploy: DeployFunction = async ({ deployments, getNamedAccounts, network }) => {
const { deployer } = await getNamedAccounts()
const { deploy } = deployments

if (network.tags.dev || network.tags.test) {
await deploy('EntryPoint', {
from: deployer,
contract: EntryPoint,
args: [],
log: true,
deterministicDeployment: '0x90d8084deab30c2a37c45e8d47f49f2f7965183cb6990a98943ef94940681de3',
})
} else if (!ENTRY_POINT) {
throw new Error('DEPLOYMENT_ENTRY_POINT_ADDRESS must be set')
}
}

deploy.tags = ['entrypoint']

export default deploy
export default deployEntryPoint
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const deploy: DeployFunction = async ({ deployments, getNamedAccounts, network }
const { deployer } = await getNamedAccounts()
const { deploy } = deployments

const entryPoint = await deployments.get('EntryPoint')

const p256Verifier = await deploy('P256Verifier', {
from: deployer,
args: [],
Expand All @@ -28,6 +30,15 @@ const deploy: DeployFunction = async ({ deployments, getNamedAccounts, network }
log: true,
deterministicDeployment: true,
})

await deploy('SafeSignerLaunchpad', {
from: deployer,
args: [entryPoint.address],
log: true,
deterministicDeployment: true,
})
}

deploy.dependencies = ['entrypoint']

export default deploy
2 changes: 0 additions & 2 deletions modules/4337/src/deploy/libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ const deploy: DeployFunction = async ({ deployments, getNamedAccounts }) => {
})
}

deploy.tags = ['libraries']

export default deploy
1 change: 0 additions & 1 deletion modules/4337/src/deploy/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ const deploy: DeployFunction = async ({ deployments, getNamedAccounts, network }
}

deploy.dependencies = ['entrypoint']
deploy.tags = ['mock']

export default deploy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ const deploy: DeployFunction = async ({ deployments, getNamedAccounts }) => {
}

deploy.dependencies = ['entrypoint']
deploy.tags = ['modules']

export default deploy
40 changes: 2 additions & 38 deletions modules/4337/src/deploy/safe.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,3 @@
import MultiSend from '@safe-global/safe-contracts/build/artifacts/contracts/libraries/MultiSend.sol/MultiSend.json'
import SafeProxyFactory from '@safe-global/safe-contracts/build/artifacts/contracts/proxies/SafeProxyFactory.sol/SafeProxyFactory.json'
import SafeL2 from '@safe-global/safe-contracts/build/artifacts/contracts/SafeL2.sol/SafeL2.json'
import { DeployFunction } from 'hardhat-deploy/types'
import { deploySafe } from '@safe-global/safe-4337-local-bundler'

const deploy: DeployFunction = async ({ deployments, getNamedAccounts, network }) => {
if (!network.tags.safe && !network.tags.test) {
return
}

const { deployer } = await getNamedAccounts()
const { deploy } = deployments

await deploy('MultiSend', {
from: deployer,
contract: MultiSend,
args: [],
log: true,
deterministicDeployment: true,
})
await deploy('SafeL2', {
from: deployer,
contract: SafeL2,
args: [],
log: true,
deterministicDeployment: true,
})
await deploy('SafeProxyFactory', {
from: deployer,
contract: SafeProxyFactory,
args: [],
log: true,
deterministicDeployment: true,
})
}

deploy.tags = ['safe']

export default deploy
export default deploySafe
Loading

0 comments on commit 1849ac9

Please sign in to comment.