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 committed Mar 14, 2024
2 parents b389d22 + 7b3ea24 commit 39995c4
Show file tree
Hide file tree
Showing 78 changed files with 3,893 additions and 4,558 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_4337.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
Expand All @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
Expand All @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_4337_gas_metering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_4337_upstream_bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
Expand Down
30 changes: 22 additions & 8 deletions .github/workflows/ci_passkey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm run coverage -w modules/passkey
- run: |
npm ci
npm run coverage -w modules/passkey
- uses: coverallsapp/github-action@master
with:
path-to-lcov: modules/passkey/coverage/lcov.info
Expand All @@ -24,12 +25,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm run lint -w modules/passkey
- run: npm run fmt:check -w modules/passkey
- run: npm run build -w modules/passkey
- run: |
npm ci
npm run lint -w modules/passkey
npm run fmt:check -w modules/passkey
npm run build -w modules/passkey
e2e:
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 test:4337 -w modules/passkey
8 changes: 4 additions & 4 deletions .github/workflows/ci_passkey_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
paths:
- 'modules/4337/**'
- 'modules/passkey/**'
- 'examples/safe-4337-passkeys/**'
- 'examples/4337-passkeys/**'

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
Expand All @@ -22,8 +22,8 @@ jobs:
npm run build -w modules/4337
# Reinstall the dependencies so the 4337 dependency includes artifacts
npm ci
npm run lint -w examples/safe-4337-passkeys
npm run build -w examples/safe-4337-passkeys
npm run lint -w examples/4337-passkeys
npm run build -w examples/4337-passkeys
env:
VITE_WC_CLOUD_PROJECT_ID: ${{ secrets.VITE_WC_CLOUD_PROJECT_ID }}
VITE_WC_4337_BUNDLER_URL: ${{ secrets.VITE_WC_4337_BUNDLER_URL }}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This repository contains a collection of modules for the [Safe Smart Account](ht

## Examples

- [Safe + 4337 + Passkeys](./examples/safe-4337-passkeys)
- [Safe + 4337 + Passkeys](./examples/4337-passkeys)
- [4337 Gas Metering](./examples/4337-gas-metering)

## Security and Liability

Expand Down
2 changes: 1 addition & 1 deletion examples/4337-gas-metering/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@safe-global/4337-gas-metering",
"name": "@safe-global/safe-modules-example-4337-gas-metering",
"version": "1.0.0",
"description": "Gas Metering Analysis for Safe with 4337 Module",
"homepage": "https://github.com/safe-global/safe-modules/4337-gas-metering",
Expand Down
4 changes: 2 additions & 2 deletions examples/4337-gas-metering/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/* Completeness */
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
"outDir": "./dist" /* Redirect output structure to the directory. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */
},
"exclude": ["node_modules"],
"exclude": ["node_modules"]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Helpful links:
### Run the app in development mode

```bash
npm run dev -w examples/safe-4337-passkeys
npm run dev -w examples/4337-passkeys
```

## Config adjustments
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "safe-4337-passkeys",
"name": "@safe-global/safe-modules-example-4337-passkeys",
"private": true,
"version": "0.0.0",
"type": "module",
Expand All @@ -11,7 +11,7 @@
},
"dependencies": {
"@web3modal/ethers": "^4.0.5",
"@safe-global/safe-erc4337": "^0.3.0",
"@safe-global/safe-4337": "^0.3.0",
"ethers": "^6.11.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { ethers } from 'ethers'
import { abi as SafeSignerLaunchpadAbi } from '@safe-global/safe-erc4337/build/artifacts/contracts/experimental/SafeSignerLaunchpad.sol/SafeSignerLaunchpad.json'
import { abi as WebAuthnSignerFactoryAbi } from '@safe-global/safe-erc4337/build/artifacts/contracts/experimental/WebAuthnSigner.sol/WebAuthnSignerFactory.json'
import { abi as SetupModuleSetupAbi } from '@safe-global/safe-erc4337/build/artifacts/contracts/SafeModuleSetup.sol/SafeModuleSetup.json'
import { abi as SafeSignerLaunchpadAbi } from '@safe-global/safe-4337/build/artifacts/contracts/experimental/SafeSignerLaunchpad.sol/SafeSignerLaunchpad.json'
import { abi as WebAuthnSignerFactoryAbi } from '@safe-global/safe-4337/build/artifacts/contracts/experimental/WebAuthnSigner.sol/WebAuthnSignerFactory.json'
import { abi as SetupModuleSetupAbi } from '@safe-global/safe-4337/build/artifacts/contracts/SafeModuleSetup.sol/SafeModuleSetup.json'
import {
abi as WebAuthnSignerAbi,
bytecode as WebAuthSignerBytecode,
} from '@safe-global/safe-erc4337/build/artifacts/contracts/experimental/WebAuthnSigner.sol/WebAuthnSigner.json'
import { abi as Safe4337ModuleAbi } from '@safe-global/safe-erc4337/build/artifacts/contracts/Safe4337Module.sol/Safe4337Module.json'
import { abi as SafeProxyFactoryAbi } from '@safe-global/safe-erc4337/build/artifacts/@safe-global/safe-contracts/contracts/proxies/SafeProxyFactory.sol/SafeProxyFactory.json'
} from '@safe-global/safe-4337/build/artifacts/contracts/experimental/WebAuthnSigner.sol/WebAuthnSigner.json'
import { abi as Safe4337ModuleAbi } from '@safe-global/safe-4337/build/artifacts/contracts/Safe4337Module.sol/Safe4337Module.json'
import { abi as SafeProxyFactoryAbi } from '@safe-global/safe-4337/build/artifacts/@safe-global/safe-contracts/contracts/proxies/SafeProxyFactory.sol/SafeProxyFactory.json'
import type {
SafeSignerLaunchpad,
Safe4337Module,
SafeProxyFactory,
WebAuthnSigner,
WebAuthnSignerFactory,
SafeModuleSetup,
} from '@safe-global/safe-erc4337/typechain-types/'
} from '@safe-global/safe-4337/typechain-types/'

import {
SAFE_SIGNER_LAUNCHPAD_ADDRESS,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion modules/4337/contracts/Safe4337Module.sol
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ contract Safe4337Module is IAccount, HandlerContext, CompatibilityFallbackHandle
// solhint-disable-next-line no-inline-assembly
assembly ("memory-safe") {
// Since the `encodedSafeOp` value's memory layout is identical to the result of `abi.encode`-ing the
// individual `SafeOp` fields, we can pass it directly to `keccak256`. Additionally, there are 13
// individual `SafeOp` fields, we can pass it directly to `keccak256`. Additionally, there are 14
// 32-byte fields to hash, for a length of `14 * 32 = 448` bytes.
safeOpStructHash := keccak256(encodedSafeOp, 448)
}
Expand Down
1 change: 0 additions & 1 deletion modules/4337/contracts/experimental/WebAuthnSigner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pragma solidity >=0.8.0;
import {SignatureValidatorConstants} from "./SignatureValidatorConstants.sol";
import {IUniqueSignerFactory} from "./SafeSignerLaunchpad.sol";
import {SignatureValidator} from "./SignatureValidator.sol";
import {SignatureValidatorConstants} from "./SignatureValidatorConstants.sol";
import {IWebAuthnVerifier, WebAuthnConstants} from "./verifiers/WebAuthnVerifier.sol";

struct SignatureData {
Expand Down
2 changes: 0 additions & 2 deletions modules/4337/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ const userConfig: HardhatUserConfig = {
tags: ['dev', 'safe'],
},
hardhat: {
blockGasLimit: 100000000,
gas: 100000000,
gasPrice: 10000000000,
tags: ['test'],
},
Expand Down
12 changes: 7 additions & 5 deletions modules/4337/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@safe-global/safe-erc4337",
"name": "@safe-global/safe-4337",
"version": "0.3.0",
"description": "Safe Module for ERC-4337 support",
"homepage": "https://github.com/safe-global/safe-modules/tree/main/modules/4337",
Expand All @@ -14,8 +14,9 @@
"build"
],
"scripts": {
"build": "hardhat compile",
"build": "npm run build:sol && npm run build:ts",
"build:ts": "npx rimraf dist && tsc",
"build:sol": "npx rimraf build && hardhat compile",
"test": "hardhat test --deploy-fixture",
"test:e2e": "./test/e2e/run.sh",
"test:e2e:upstream": "USE_UPSTREAM_BUNDLER=1 ./test/e2e/run.sh",
Expand All @@ -31,7 +32,8 @@
"fmt": "prettier --write ./contracts/**/*.sol",
"fmt:check": "prettier --check ./**/*.sol",
"prepack": "npm run build",
"prepublish": "npx rimraf build && npm run build && npm run build:ts"
"prepublish": "npm run build",
"postinstall": "npm run build"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -72,10 +74,10 @@
},
"overrides": {
"@safe-global/safe-contracts": {
"ethers": "^6.8.0"
"ethers": "^6.11.0"
}
},
"dependencies": {
"@safe-global/safe-contracts": "^1.4.1"
"@safe-global/safe-contracts": "^1.4.1-build.0"
}
}
3 changes: 3 additions & 0 deletions modules/passkey/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage/
dist/
typechain-types/
Loading

0 comments on commit 39995c4

Please sign in to comment.