Skip to content

Commit

Permalink
Use Stackup bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
tkiapril committed Dec 13, 2023
1 parent eaa42bc commit 59a4071
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 16 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/docker-build-stackup-bundler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build stackup-bundler docker image

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/mothership-l2launcher-stackup-bundler

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
id-token: write

steps:
- uses: actions/checkout@v3

- id: stackup-bundler-changes
uses: tj-actions/changed-files@v35
with:
files: "stackup-bundler"

- name: Install cosign
if: github.event_name != 'pull_request' && steps.stackup-bundler-changes.outputs.any_changed == 'true' && github.repository_owner == 'planetarium'
uses: sigstore/cosign-installer@v3.1.1

- name: Set up Docker Buildx
if: steps.stackup-bundler-changes.outputs.any_changed == 'true'
uses: docker/setup-buildx-action@v3.0.0

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request' && steps.stackup-bundler-changes.outputs.any_changed == 'true' && github.repository_owner == 'planetarium'
uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
if: steps.stackup-bundler-changes.outputs.any_changed == 'true'
uses: docker/metadata-action@v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build and push Docker image
id: build-and-push
if: steps.stackup-bundler-changes.outputs.any_changed == 'true'
uses: docker/build-push-action@v5.0.0
with:
context: "https://github.com/stackup-wallet/stackup-bundler.git"
platforms: linux/amd64,linux/arm64/v8
push: ${{ github.event_name != 'pull_request' && github.repository_owner == 'planetarium' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' && steps.stackup-bundler-changes.outputs.any_changed == 'true' && github.repository_owner == 'planetarium' }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
env:
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# L2launcher

This repository contains base `docker-compose.yml` template to setup [Optimism Stack] and optional
[Skandha Bundler] with a CLI script to fill out required environment variables into .env.
[Stackup Bundler] with a CLI script to fill out required environment variables into .env.

[Optimism Stack]: https://stack.optimism.io/
[Skandha Bundler]: https://github.com/etherspot/skandha
[Stackup Bundler]: https://github.com/stackup-wallet/stackup-bundler

## Usage

Expand All @@ -20,7 +20,7 @@ This repository contains base `docker-compose.yml` template to setup [Optimism S
- SEQUENCER_KEY
- L1_RPC
- L2_CHAIN_ID
- ERC4337_BUNDLER_KEY (optional, used for Skandha Bundler)
- ERC4337_BUNDLER_KEY (optional, used for Stackup Bundler)

[Docker]: https://docs.docker.com/engine/install/
[Deno]: https://deno.com/
Expand All @@ -40,7 +40,7 @@ You can find output files at `out` directory, `.env` and `docker-compose.yml`.
If every required environment variables are set or present in `.env` file, you can just run
`docker compose up -d` with `templates/docker-compose.yml` directly without running the CLI.

However, the base compose template doesn't include Skandha Bundler and BlockScout explorer, so you
However, the base compose template doesn't include Stackup Bundler and BlockScout explorer, so you
might need to copy `templates/docker-compose-bundler.yml` and
`templates/docker-compose-blockscout.yml` templates respectively into the base compose template or
setup manually.
5 changes: 4 additions & 1 deletion cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if (
}

if (
await Confirm.prompt({ message: "Add Skandha bundler to docker-compose.yml?", ...confirmOptions })
await Confirm.prompt({ message: "Add Stackup bundler to docker-compose.yml?", ...confirmOptions })
) {
dockerComposeYml += "\n" + await fetchTemplate("templates/docker-compose-bundler.yml");
if (!env.ERC4337_BUNDLER_KEY) {
Expand All @@ -100,6 +100,9 @@ if (
env.ERC4337_BUNDLER_KEY = generatePrivateKey();
console.log("Generated a random bundler account.");
}
if (env.ERC4337_BUNDLER_KEY.startsWith('0x')) {
env.ERC4337_BUNDLER_KEY = env.ERC4337_BUNDLER_KEY.slice(2);
}
}
}

Expand Down
18 changes: 7 additions & 11 deletions templates/docker-compose-bundler.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
skandha-bundler:
container_name: skandha-bundler
image: etherspot/skandha
stackup-bundler:
container_name: stackup-bundler
image: ghcr.io/planetarium/mothership-l2launcher-stackup-bundler:latest
ports:
- 14337:14337
- 4337:4337/tcp
depends_on:
op-geth:
condition: service_healthy
environment:
SKANDHA_NETWORKS: dev
SKANDHA_DEV_RPC: http://op-geth:8545
SKANDHA_DEV_ENTRYPOINTS: ${ERC4337_ENTRYPOINT:-0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789}
SKANDHA_DEV_RELAYER: ${ERC4337_BUNDLER_KEY}
command:
- standalone
- --redirectRpc
ERC4337_BUNDLER_ETH_CLIENT_URL: http://op-geth:8545
ERC4337_BUNDLER_SUPPORTED_ENTRY_POINTS: ${ERC4337_ENTRYPOINT:-0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789}
ERC4337_BUNDLER_PRIVATE_KEY: ${ERC4337_BUNDLER_KEY}

0 comments on commit 59a4071

Please sign in to comment.