Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/bridge-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build Bridge Docker Image

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/bridge

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./scripts/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Test Docker image
run: |
docker build -t bridge-test -f scripts/Dockerfile .
# Test that the image has the required tools
docker run --rm bridge-test which forge
docker run --rm bridge-test which cast
docker run --rm bridge-test which jq
# Test that contracts are built
docker run --rm --entrypoint /bin/bash bridge-test -c "cd /app/contracts && forge build --sizes" || true
echo "Docker image built and tested successfully!"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ out/
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/
contracts/broadcast/
contracts/artifacts/

# Docs
docs/
Expand Down
1 change: 0 additions & 1 deletion contracts/artifacts/l1-deploy.json

This file was deleted.

1 change: 0 additions & 1 deletion contracts/artifacts/l2-deploy.json

This file was deleted.

21 changes: 0 additions & 21 deletions contracts/artifacts/middlewareDataProof.json

This file was deleted.

26 changes: 18 additions & 8 deletions e2e/envs/bls-testnet.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
# BLS_SIGNATURE_CHECKER_ADDRESS=0xb7ba8bbc36AA5684fC44D02aD666dF8E23BEEbF8
# OPERATOR_STATE_RETRIEVER_ADDRESS=0xD5D7fB4647cE79740E6e83819EFDf43fa74F8C31

# Holesky
DELEGATION_MANAGER_ADDRESS=0xA44151489861Fe9e3055d95adC98FbD462B948e7
STRATEGY_MANAGER_ADDRESS=0xdfB5f6CE42aAA7830E94ECFCcAd411beF4d4D5b6
LST_CONTRACT_ADDRESS=0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034
LST_STRATEGY_ADDRESS=0x7D704507b76571a51d9caE8AdDAbBFd0ba0e63d3
REGISTRY_COORDINATOR_ADDRESS=0x3e43AA225b5cB026C5E8a53f62572b10D526a50B
BLS_SIGNATURE_CHECKER_ADDRESS=0xca249215e082e17c12bb3c4881839a3f883e5c6b
OPERATOR_STATE_RETRIEVER_ADDRESS=0xB4baAfee917fb4449f5ec64804217bccE9f46C67
# Holesky
# DELEGATION_MANAGER_ADDRESS=0xA44151489861Fe9e3055d95adC98FbD462B948e7
# STRATEGY_MANAGER_ADDRESS=0xdfB5f6CE42aAA7830E94ECFCcAd411beF4d4D5b6
# LST_CONTRACT_ADDRESS=0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034
# LST_STRATEGY_ADDRESS=0x7D704507b76571a51d9caE8AdDAbBFd0ba0e63d3
# REGISTRY_COORDINATOR_ADDRESS=0x3e43AA225b5cB026C5E8a53f62572b10D526a50B
# BLS_SIGNATURE_CHECKER_ADDRESS=0xca249215e082e17c12bb3c4881839a3f883e5c6b
# OPERATOR_STATE_RETRIEVER_ADDRESS=0xB4baAfee917fb4449f5ec64804217bccE9f46C67

# Sepolia
DELEGATION_MANAGER_ADDRESS=0xD4A7E1Bd8015057293f0D0A557088c286942e84b
STRATEGY_MANAGER_ADDRESS=0x2E3D6c0744b10eb0A4e6F679F71554a39Ec47a5D
LST_CONTRACT_ADDRESS=0x00c71b0fcadE911B2feeE9912DE4Fe19eB04ca56
LST_STRATEGY_ADDRESS=0x8b29d91e67b013e855EaFe0ad704aC4Ab086a574
ALLOCATION_MANAGER_ADDRESS=0x42583067658071247ec8CE0A516A58f682002d07
REGISTRY_COORDINATOR_ADDRESS=0x3a8d838578a2459cc45c3f6459b2c2a50b725635
BLS_SIGNATURE_CHECKER_ADDRESS=0x5f520a8517e74eb023b1c826b1b182ae39165a14
OPERATOR_STATE_RETRIEVER_ADDRESS=0x471b515fb829c519abaa9278e944f5c6c43eff27

L1_FORK_URL=
L2_FORK_URL=
Expand Down
31 changes: 31 additions & 0 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Bridge Script Docker Image
# Contains all dependencies to run bridge-to-l2.sh

FROM ghcr.io/foundry-rs/foundry:latest

# Install additional dependencies as root
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
jq \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy contract sources and scripts
COPY contracts/foundry.toml contracts/foundry.toml
COPY contracts/src contracts/src
COPY contracts/script contracts/script
COPY contracts/lib contracts/lib
COPY scripts scripts

# Contracts will be compiled on first run
WORKDIR /app

# Make scripts executable
RUN chmod +x scripts/*.sh

# Default entrypoint
ENTRYPOINT ["/app/scripts/bridge-to-l2.sh"]
60 changes: 60 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Bridge Scripts

Scripts for bridging EigenLayer operator state from L1 to L2.

## bridge-to-l2.sh

Deploys bridge contracts and bridges operator state from an L1 registry coordinator to an L2 mimic contract using mock SP1Helios verification.

### Prerequisites

- [Foundry](https://book.getfoundry.sh/getting-started/installation) installed
- `cast` and `forge` available in PATH
- `jq` installed

### Usage

```bash
# Set required environment variables
export PRIVATE_KEY="0x..."
export L1_RPC_URL="https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY"
export L2_RPC_URL="https://gnosis-mainnet.g.alchemy.com/v2/YOUR_KEY"
export REGISTRY_COORDINATOR_ADDRESS="0x..."

# Run the bridge script
./scripts/bridge-to-l2.sh
```

Or use an env file:

```bash
cp scripts/bridge.env.example scripts/bridge.env
# Edit bridge.env with your values
source scripts/bridge.env && ./scripts/bridge-to-l2.sh
```

### What it does

1. **Deploy L1 Contracts** - Deploys `MiddlewareShim` pointing to the registry coordinator
2. **Deploy L2 Contracts** - Deploys `SP1HeliosMock`, `RegistryCoordinatorMimic`, `BLSSignatureChecker`
3. **Update L1 Shim** - Calls `updateMiddlewareDataHash()` to snapshot operator state
4. **Generate Mock Proof** - Creates storage/account proofs and sets state root on mock
5. **Bridge State** - Runs `UpdateMimic.s.sol` to bridge state to L2

### Skip Deployment

To use existing deployed contracts:

```bash
export SKIP_DEPLOY=true
export L1_DEPLOY_FILE=/path/to/l1-deploy.json
export L2_DEPLOY_FILE=/path/to/l2-deploy.json
./scripts/bridge-to-l2.sh
```

### Output

The script creates these files in `contracts/artifacts/`:
- `l1-deploy.json` - L1 contract addresses
- `l2-deploy.json` - L2 contract addresses
- `middlewareDataProof.json` - Generated storage proof
Loading
Loading