diff --git a/.github/workflows/docker-build-stackup-bundler.yml b/.github/workflows/docker-build-stackup-bundler.yml new file mode 100644 index 0000000..ab25563 --- /dev/null +++ b/.github/workflows/docker-build-stackup-bundler.yml @@ -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 + with: + repository: "stackup-wallet/stackup-bundler" + + - id: stackup-bundler-changes + uses: tj-actions/changed-files@v35 + + - 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 }} diff --git a/README.md b/README.md index 4096b4f..5ad716f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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/ @@ -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. diff --git a/cli.ts b/cli.ts index 8331df2..68f5c44 100755 --- a/cli.ts +++ b/cli.ts @@ -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) { @@ -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); + } } } diff --git a/templates/docker-compose-bundler.yml b/templates/docker-compose-bundler.yml index 3962980..55eda61 100644 --- a/templates/docker-compose-bundler.yml +++ b/templates/docker-compose-bundler.yml @@ -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}