Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #224 from getwax/219-additional-zk-email-recovery-…
Browse files Browse the repository at this point in the history
…reference-implementations

219 additional zk email recovery reference implementations
  • Loading branch information
jacque006 authored Apr 2, 2024
2 parents f547b9a + 33fe632 commit 29b8099
Show file tree
Hide file tree
Showing 54 changed files with 1,515 additions and 261 deletions.
8 changes: 7 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
url = https://github.com/foundry-rs/forge-std
[submodule "packages/plugins/lib/openzeppelin-contracts"]
path = packages/plugins/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "packages/plugins/lib/safe-contracts"]
path = packages/plugins/lib/safe-contracts
url = https://github.com/safe-global/safe-contracts
Expand All @@ -28,3 +28,9 @@
[submodule "packages/plugins/lib/kernel"]
path = packages/plugins/lib/kernel
url = https://github.com/zerodevapp/kernel
[submodule "packages/plugins/lib/erc7579-implementation"]
path = packages/plugins/lib/erc7579-implementation
url = https://github.com/erc7579/erc7579-implementation
[submodule "packages/plugins/lib/reference-implementation"]
path = packages/plugins/lib/reference-implementation
url = https://github.com/erc6900/reference-implementation
3 changes: 2 additions & 1 deletion packages/plugins/config/bundler.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"gasFactor": "1",
"port": "3000",
"entryPoint": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"network": "http://127.0.0.1:8545",
"entryPoint": "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
"beneficiary": "0xd21934eD8eAf27a67f0A70042Af50A1D6d195E81",
"minBalance": "1",
"mnemonic": "./workdir/mnemonic.txt",
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ out = "out"
libs = [
"lib",
]
solc_version = "0.8.23"

allow_paths = [
"../../primitives",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function getRemappings() {

const config: HardhatUserConfig = {
solidity: {
version: "0.8.19",
version: "0.8.23",
settings: {
optimizer: {
enabled: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/lib/account-abstraction
1 change: 1 addition & 0 deletions packages/plugins/lib/erc7579-implementation
Submodule erc7579-implementation added at 42aa53
2 changes: 1 addition & 1 deletion packages/plugins/lib/openzeppelin-contracts
1 change: 1 addition & 0 deletions packages/plugins/lib/reference-implementation
2 changes: 1 addition & 1 deletion packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@getwax/circuits": "../zkp"
},
"devDependencies": {
"@account-abstraction/contracts": "^0.6.0",
"@account-abstraction/contracts": "0.7.0",
"@account-abstraction/utils": "^0.6.0",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
Expand Down
7 changes: 5 additions & 2 deletions packages/plugins/remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
openzeppelin-contracts/=lib/openzeppelin-contracts/
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
account-abstraction/=lib/account-abstraction/
@eth-infinitism/account-abstraction/=lib/reference-implementation/lib/account-abstraction/contracts/
account-abstraction/=lib/account-abstraction/contracts/
safe-contracts/=lib/safe-contracts/
kernel/=lib/kernel/
I4337/=lib/kernel/lib/I4337/src/
solady/=lib/kernel/lib/solady/src/
solady/=lib/kernel/lib/solady/src/
erc7579-implementation/=lib/erc7579-implementation/
erc6900-reference-implementation/=lib/reference-implementation/src/
28 changes: 21 additions & 7 deletions packages/plugins/script/deploy_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import DeterministicDeployer from "../lib-ts/deterministic-deployer/Deterministi
import {
SimulateTxAccessor__factory,
SafeProxyFactory__factory,
TokenCallbackHandler__factory,
CompatibilityFallbackHandler__factory,
CreateCall__factory,
MultiSend__factory,
Expand All @@ -16,6 +15,8 @@ import {
BLSOpen__factory,
} from "../typechain-types";
import makeDevFaster from "../test/e2e/utils/makeDevFaster";
import { TokenCallbackHandler__factory } from "../typechain-types/factories/lib/safe-contracts/contracts/handler/TokenCallbackHandler__factory";
import bundlerConfig from "./../config/bundler.config.json";

async function deploy() {
const { NODE_URL, MNEMONIC } = process.env;
Expand All @@ -36,12 +37,6 @@ async function deploy() {
MultiSendCallOnly__factory,
SignMessageLib__factory,
BLSOpen__factory,
DeterministicDeployer.link(BLSSignatureAggregator__factory, [
{
"lib/account-abstraction/contracts/samples/bls/lib/BLSOpen.sol:BLSOpen":
deployer.calculateAddress(BLSOpen__factory, []),
},
]),
];

for (const contractFactory of contractFactories) {
Expand All @@ -51,6 +46,25 @@ async function deploy() {
console.log(`deployed ${contractName} to ${await contract.getAddress()}`);
}

const blsSignatureAggregatorFactory = DeterministicDeployer.link(
BLSSignatureAggregator__factory,
[
{
"lib/account-abstraction/contracts/samples/bls/lib/BLSOpen.sol:BLSOpen":
deployer.calculateAddress(BLSOpen__factory, []),
},
],
);
const blsSignatureAggregator = await deployer.connectOrDeploy(
blsSignatureAggregatorFactory,
[bundlerConfig.entryPoint],
);
console.log(
`deployed ${
BLSSignatureAggregator__factory.name.split("_")[0]
} to ${await blsSignatureAggregator.getAddress()}`,
);

const safeDeployer = await DeterministicDeployer.initSafeVersion(wallet);

const safeContractFactories = [
Expand Down
16 changes: 0 additions & 16 deletions packages/plugins/script/patched-bundler-727838b.dockerfile

This file was deleted.

10 changes: 3 additions & 7 deletions packages/plugins/script/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
DOCKER_NETWORK=packages-plugins-docker-network

GETH_IMAGE=ethereum/client-go:v1.13.5
BUNDLER_IMAGE=patched-bundler-727838b
BUNDLER_IMAGE=accountabstraction/bundler:0.7.0

GETH_CONTAINER=geth${RANDOM}
BUNDLER_CONTAINER=bundler${RANDOM}
Expand Down Expand Up @@ -78,13 +78,9 @@ docker exec ${GETH_CONTAINER} geth \
# Deploy common contracts
yarn hardhat run "${SCRIPT_DIR}/deploy_all.ts" --network localhost

if ! docker images | grep -q "${BUNDLER_IMAGE}"; then
echo "Building '${BUNDLER_IMAGE}'..."
# Build the Docker image from the Dockerfile
docker build -f "${SCRIPT_DIR}/${BUNDLER_IMAGE}.dockerfile" -t "${BUNDLER_IMAGE}" .
fi

# Start ERC-4337 bundler
docker pull ${BUNDLER_IMAGE}

docker run --rm -i --name ${BUNDLER_CONTAINER} -p 3000:3000 -v "$PWD"/config:/app/workdir:ro --network=${DOCKER_NETWORK} ${BUNDLER_IMAGE} \
--network http://${GETH_CONTAINER}:8545 \
&
Expand Down
Loading

0 comments on commit 29b8099

Please sign in to comment.