-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ERC-4337 Local Bundler | ||
|
||
This repository contains tools for setting up and using a local ERC-4337 bundler for testing. While on-chain compatibility with the ERC-4337 `EntryPoint` contract is important, arguably the most challenging part of being compatible with the standard is ensuring that the account follows the user operation validation and account deployment rules that are enforced by the off-chain bundlers. As such, this repository provides tools to run a local development node with the reference ERC-4337 bundler for testing purposes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM docker.io/library/node:18 | ||
|
||
# v0.7.0 | ||
ARG TAG=26e4f4c | ||
|
||
RUN git clone https://github.com/eth-infinitism/bundler /src/bundler | ||
WORKDIR /src/bundler | ||
RUN git checkout ${TAG} | ||
RUN git submodule init && git submodule update | ||
|
||
RUN yarn && yarn preprocess | ||
ENTRYPOINT ["yarn", "bundler"] | ||
CMD [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
version: '3.8' | ||
|
||
services: | ||
geth: | ||
image: docker.io/ethereum/client-go:stable | ||
restart: always | ||
environment: | ||
GETH_DEV: 'true' | ||
GETH_HTTP: 'true' | ||
GETH_HTTP_ADDR: '0.0.0.0' | ||
GETH_HTTP_API: 'personal,eth,net,web3,debug' | ||
GETH_HTTP_VHOSTS: '*' | ||
GETH_RPC_ALLOW_UNPROTECTED_TXS: 'true' | ||
ports: | ||
- 8545:8545 | ||
|
||
bundler: | ||
build: | ||
context: . | ||
dockerfile: docker/bundler/Dockerfile | ||
restart: always | ||
command: ['--auto', '--network=http://geth:8545'] | ||
ports: | ||
- 3000:3000 | ||
|
||
bundler-upstream: | ||
build: | ||
context: . | ||
dockerfile: docker/bundler/Dockerfile | ||
args: | ||
TAG: main | ||
restart: always | ||
command: ['--auto', '--network=http://geth:8545'] | ||
ports: | ||
- 3000:3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "@safe-global/safe-4337-local-bundler", | ||
"version": "0.0.0", | ||
"private": true, | ||
"license": "LGPL-3.0-only", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
DOCKER="${DOCKER:-docker}" | ||
|
||
bundler_container="bundler" | ||
if [[ -n "$USE_UPSTREAM_BUNDLER" ]]; then | ||
bundler_container="bundler-upstream" | ||
fi | ||
|
||
"$DOCKER" compose up -d geth "$bundler_container" | ||
|
||
# wait for containers to start up | ||
SECONDS=0 | ||
until curl -fs http://localhost:8545 >/dev/null && curl -fs http://localhost:3000 >/dev/null; do | ||
if [[ $SECONDS -gt 30 ]]; then | ||
echo "ERROR: timeout waiting for local node and bundler to start" | ||
"$DOCKER" compose logs | ||
exit 1 | ||
fi | ||
sleep 1 | ||
done | ||
|
||
hardhat test --deploy-fixture --network localhost --grep '@4337' | ||
success=$? | ||
|
||
"$DOCKER" compose down | ||
|
||
# exit with the E2E test's exit code | ||
exit $success |