Skip to content

Commit b55689b

Browse files
authored
refactor: use relayer in docker compose and update makefile
2 parents 58fa8e5 + 0a3677e commit b55689b

File tree

7 files changed

+64
-381
lines changed

7 files changed

+64
-381
lines changed

.github/workflows/docker.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121

2222
- name: Set up Docker Buildx
2323
uses: docker/setup-buildx-action@v3
24+
with:
25+
install: true
2426

2527
- name: Log in to GitHub Container Registry
2628
uses: docker/login-action@v3
@@ -35,4 +37,5 @@ jobs:
3537
context: .
3638
file: ./hyperlane/Dockerfile
3739
push: true
40+
platforms: linux/amd64,linux/arm64
3841
tags: ghcr.io/${{ github.repository_owner }}/hyperlane-init:latest

Makefile

Lines changed: 22 additions & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
1-
VERSION := $(shell echo $(shell git describe --tags 2>/dev/null || git log -1 --format='%h') | sed 's/^v//')
2-
COMMIT := $(shell git rev-parse --short HEAD)
3-
DOCKER := $(shell which docker)
4-
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
5-
IMAGE := ghcr.io/tendermint/docker-build-proto:latest
6-
DOCKER_PROTO_BUILDER := docker run -v $(shell pwd):/workspace --workdir /workspace $(IMAGE)
71
PROJECT_NAME=$(shell basename "$(PWD)")
8-
HTTPS_GIT := https://github.com/celestiaorg/celestia-zkevm-ibc-demo
9-
SIMAPP_GHCR_REPO := ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/simapp
10-
CELESTIA_PROVER_GHCR_REPO := ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/celestia-prover
11-
EVM_PROVER_GHCR_REPO := ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/evm-prover
12-
INDEXER_GHCR_REPO := ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/indexer
13-
14-
# process linker flags
15-
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=celestia-zkevm-ibc-demo \
16-
-X github.com/cosmos/cosmos-sdk/version.AppName=celestia-zkevm-ibc-demo \
17-
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
18-
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
19-
20-
BUILD_FLAGS := -tags "ledger" -ldflags '$(ldflags)'
212

223
## help: Get more info on make commands.
234
help: Makefile
245
@echo " Choose a command run in "$(PROJECT_NAME)":"
256
@sed -n 's/^##//p' $< | sort | column -t -s ':' | sed -e 's/^/ /'
267
.PHONY: help
278

28-
## install-dependencies: Install all dependencies needed for the demo.
29-
install-dependencies:
30-
@echo "--> Setting up Solidity IBC Eureka submodule"
31-
@cd ./solidity-ibc-eureka && bun install && just install-operator
32-
.PHONY: install-dependencies
33-
349
## check-dependencies: Check if all dependencies are installed.
3510
check-dependencies:
3611
@echo "--> Checking if all dependencies are installed"
@@ -46,223 +21,50 @@ check-dependencies:
4621
echo "Error: forge is not installed. Please install Foundry."; \
4722
exit 1; \
4823
fi
49-
@if command -v bun >/dev/null 2>&1; then \
50-
echo "bun is installed."; \
51-
else \
52-
echo "Error: bun is not installed. Please install bun."; \
53-
exit 1; \
54-
fi
55-
@if command -v just >/dev/null 2>&1; then \
56-
echo "just is installed."; \
57-
else \
58-
echo "Error: just is not installed. Please install just."; \
59-
exit 1; \
60-
fi
6124
@if command -v cargo prove >/dev/null 2>&1; then \
6225
echo "cargo prove is installed."; \
6326
else \
6427
echo "Error: succinct is not installed. Please install SP1."; \
6528
exit 1; \
6629
fi
67-
@if command -v operator >/dev/null 2>&1; then \
68-
echo "operator is installed."; \
69-
else \
70-
echo "Error: operator is not installed. Please run install-dependencies."; \
71-
exit 1; \
72-
fi
7330
@echo "All dependencies are installed."
7431
.PHONY: check-dependencies
7532

76-
## demo: Run the entire demo.
77-
demo:
78-
@make start
79-
@make setup
80-
@make transfer
81-
@make transfer-back
82-
.PHONY: demo
83-
8433
## start: Start all Docker containers for the demo.
8534
start:
35+
@echo "--> Starting all Docker containers"
8636
@docker compose up --detach
8737
.PHONY: start
8838

89-
## relay-local: Start a local instance of the hyperlane relayer (NOTE: This is temporary and should be removed in favour of Docker).
90-
relay-local:
91-
@echo "--> Starting hyperlane relayer"
92-
@cd local && CONFIG_FILES=./config/config.json ./relayer
93-
.PHONY: relay-local
94-
95-
## setup: Set up the IBC light clients.
96-
setup:
97-
@echo "--> Creating genesis.json for Tendermint light client"
98-
@cd ./solidity-ibc-eureka && cargo run --quiet --bin operator --release -- genesis -o scripts/genesis.json --proof-type groth16
99-
@echo "--> Creating IBC light clients"
100-
@go run ./testing/demo/pkg/setup/
101-
.PHONY: setup
39+
## stop: Stop all Docker containers and remove volumes.
40+
stop:
41+
@echo "--> Stopping all Docker containers"
42+
@docker compose down -v
43+
.PHONY: stop
10244

103-
## transfer: Transfer tokens from simapp to the EVM roll-up.
45+
## transfer: Transfer tokens from celestia-app to the EVM roll-up.
10446
transfer:
105-
@echo "--> Transferring tokens from simapp to the EVM roll-up"
106-
@go run ./testing/demo/pkg/transfer/ transfer
47+
@echo "--> Transferring tokens from celestia-app to the EVM roll-up"
48+
@docker run --rm \
49+
--network celestia-zkevm-hl-testnet_celestia-zkevm-net \
50+
--volume celestia-zkevm-hl-testnet_celestia-app:/home/celestia/.celestia-app \
51+
ghcr.io/celestiaorg/celestia-app-standalone:feature-zk-execution-ism \
52+
tx warp transfer 0x726f757465725f61707000000000000000000000000000010000000000000000 1234 0x000000000000000000000000d7958B336f0019081Ad2279B2B7B7c3f744Bce0a "1000" \
53+
--from default --fees 400utia --max-hyperlane-fee 100utia --node http://celestia-validator:26657 --yes
10754
.PHONY: transfer
10855

109-
## transfer-back: Transfer tokens back from the EVM roll-up to simapp.
56+
## transfer-back: Transfer tokens back from the EVM roll-up to celestia-app.
57+
# TODO: https://github.com/celestiaorg/celestia-zkevm-hl-testnet/issues/34
11058
transfer-back:
111-
@echo "--> Transferring tokens back from the EVM roll-up to simapp"
59+
@echo "--> Transferring tokens back from the EVM roll-up to celestia-app"
11260
@go run ./testing/demo/pkg/transfer/ transfer-back
11361
.PHONY: transfer-back
11462

11563
## query-balance: Query the balance of the receiver in the EVM roll-up.
11664
query-balance:
117-
@echo "--> Querying the balance of the receivier on the EVM roll-up"
118-
@go run ./testing/demo/pkg/transfer/ query-balance
65+
@echo "--> Querying the balance of the receiver on the EVM roll-up"
66+
@cast call 0xa7578551baE89a96C3365b93493AD2D4EBcbAe97 \
67+
"balanceOf(address)(uint256)" \
68+
0xd7958B336f0019081Ad2279B2B7B7c3f744Bce0a \
69+
--rpc-url http://localhost:8545
11970
.PHONY: query-balance
120-
121-
## stop: Stop all Docker containers and remove volumes.
122-
stop:
123-
@echo "--> Stopping all Docker containers"
124-
@docker compose down -v
125-
.PHONY: stop
126-
127-
## build: Build the simapp and indexer binaries into the ./build directory.
128-
build: build-simapp build-indexer
129-
.PHONY: build
130-
131-
## build-simapp: Build the simapp binary into the ./build directory.
132-
build-simapp: mod
133-
@cd ./simapp/simd/
134-
@mkdir -p build/
135-
@go build $(BUILD_FLAGS) -o build/ ./simapp/simd/
136-
.PHONY: build-simapp
137-
138-
## build-indexer: Build the indexer binary
139-
build-indexer:
140-
@cd ./indexer
141-
@mkdir -p build/
142-
@cd indexer && go build $(BUILD_FLAGS) -o build/ .
143-
.PHONY: build-indexer
144-
145-
## build-evm-prover: Build the EVM prover binary
146-
build-evm-prover:
147-
@cargo build --release --bin evm-prover
148-
.PHONY: build-evm-prover
149-
150-
## install: Install the simapp binary into the $GOPATH/bin directory.
151-
install: install-simapp
152-
.PHONY: install
153-
154-
## install-simapp: Build and install the simapp binary into the $GOPATH/bin directory.
155-
install-simapp:
156-
@echo "--> Installing simd"
157-
@go install $(BUILD_FLAGS) ./simapp/simd/
158-
.PHONY: install-simapp
159-
160-
## mod: Update all go.mod files.
161-
mod:
162-
@echo "--> Updating go.mod"
163-
@go mod tidy
164-
.PHONY: mod
165-
166-
## proto-gen: Generate protobuf files. Requires docker.
167-
proto-gen:
168-
@echo "--> Generating Protobuf files"
169-
$(DOCKER_BUF) generate
170-
.PHONY: proto-gen
171-
172-
## proto-lint: Lint protobuf files. Requires docker.
173-
proto-lint:
174-
@echo "--> Linting Protobuf files"
175-
@$(DOCKER_BUF) lint --error-format=json
176-
.PHONY: proto-lint
177-
178-
## proto-check-breaking: Check if there are any breaking change to protobuf definitions.
179-
proto-check-breaking:
180-
@echo "--> Checking if Protobuf definitions have any breaking changes"
181-
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main
182-
.PHONY: proto-check-breaking
183-
184-
## proto-format: Format protobuf files. Requires Docker.
185-
proto-format:
186-
@echo "--> Formatting Protobuf files"
187-
@$(DOCKER_PROTO_BUILDER) find . -name '*.proto' -path "./proto/*" -exec clang-format -i {} \;
188-
.PHONY: proto-format
189-
190-
## docker: Build the all Docker images.
191-
docker: build-simapp-docker build-indexer-docker build-celestia-prover-docker build-evm-prover-docker
192-
.PHONY: docker
193-
194-
## build-simapp-docker: Build the simapp docker image from the current branch. Requires docker.
195-
build-simapp-docker: build-simapp
196-
@echo "--> Building simapp Docker image"
197-
$(DOCKER) build -t $(SIMAPP_GHCR_REPO) --file docker/simapp.Dockerfile .
198-
.PHONY: build-simapp-docker
199-
200-
## build-indexer-docker: Build the indexer docker image. Requires docker.
201-
build-indexer-docker: build-indexer
202-
@echo "--> Building indexer Docker image"
203-
$(DOCKER) build -t $(INDEXER_GHCR_REPO) --file docker/indexer.Dockerfile indexer
204-
.PHONY: build-indexer-docker
205-
206-
## build-celestia-prover-docker: Build the celestia prover docker image from the current branch. Requires docker.
207-
build-celestia-prover-docker:
208-
@echo "--> Building celestia prover Docker image"
209-
$(DOCKER) build -t $(CELESTIA_PROVER_GHCR_REPO) --file docker/celestia_prover.Dockerfile .
210-
.PHONY: build-celestia-prover-docker
211-
212-
## build-evm-prover-docker: Build the EVM prover docker image from the current branch. Requires docker.
213-
build-evm-prover-docker: build-evm-prover
214-
@echo "--> Building EVM prover Docker image"
215-
$(DOCKER) build -t $(EVM_PROVER_GHCR_REPO) --file docker/evm_prover.Dockerfile .
216-
.PHONY: build-evm-prover-docker
217-
218-
# publish: Publish all Docker images to GHCR. Requires Docker and authentication.
219-
publish: publish-simapp-docker publish-celestia-prover-docker publish-evm-prover-docker
220-
.PHONY: publish
221-
222-
## publish-simapp-docker: Publish the simapp docker image to GHCR. Requires Docker and authentication.
223-
publish-simapp-docker:
224-
$(DOCKER) push $(SIMAPP_GHCR_REPO)
225-
.PHONY: publish-simapp-docker
226-
227-
## publish-celestia-prover-docker: Publish the celestia prover docker image. Requires docker.
228-
publish-celestia-prover-docker:
229-
$(DOCKER) push $(CELESTIA_PROVER_GHCR_REPO)
230-
.PHONY: publish-celestia-prover-docker
231-
232-
## publish-evm-prover-docker: Publish the EVM prover docker image. Requires docker.
233-
publish-evm-prover-docker:
234-
$(DOCKER) push $(EVM_PROVER_GHCR_REPO)
235-
.PHONY: publish-evm-prover-docker
236-
237-
## lint: Run all linters; golangci-lint, markdownlint, hadolint, yamllint.
238-
lint:
239-
@echo "--> Running golangci-lint"
240-
@golangci-lint run
241-
@echo "--> Running markdownlint"
242-
@markdownlint --config .markdownlint.yaml '**/*.md'
243-
@echo "--> Running hadolint"
244-
@hadolint docker/**
245-
@echo "--> Running yamllint"
246-
@yamllint --no-warnings . -c .yamllint.yml
247-
.PHONY: lint
248-
249-
## markdown-link-check: Check all markdown links.
250-
markdown-link-check:
251-
@echo "--> Running markdown-link-check"
252-
# Skip the solidity-ibc-eureka directory because we don't want to fix their broken links.
253-
@find . -name \*.md -not -path "./solidity-ibc-eureka/*" -print0 | xargs -0 -n1 markdown-link-check
254-
.PHONY: markdown-link-check
255-
256-
## fmt: Format files per linters golangci-lint and markdownlint.
257-
fmt:
258-
@echo "--> Running golangci-lint --fix"
259-
@golangci-lint run --fix
260-
@echo "--> Running markdownlint --fix"
261-
@markdownlint --fix --quiet --config .markdownlint.yaml .
262-
.PHONY: fmt
263-
264-
## test: Run tests.
265-
test:
266-
@echo "--> Running tests"
267-
@go test -timeout 30m ./...
268-
.PHONY: test

README.md

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
# ZK EVM IBC demo
1+
# ZK EVM Hyperlane
22

33
> [!WARNING]
44
> This repository is a work in progress and under active development.
55
6-
This repo exists to showcase transferring tokens between SimApp (a Cosmos SDK chain representing Celestia) and a ZK proveable EVM via [IBC V2](https://github.com/cosmos/ibc/blob/main/spec/IBC_V2/README.md) (formerly known as IBC Eureka) and the IBC V2 [solidity contracts](https://github.com/cosmos/solidity-ibc-eureka/blob/main/README.md). The diagram below is meant to detail the components involved and, at a high level, how they interact with one another.
7-
8-
![mvp-zk-accounts](./docs/images/mvp-zk-accounts.png)
9-
6+
This repository showcases a bridged token transfer between Celestia and a ZK proveable EVM via [Hyperlane](https://hyperlane.xyz/).
107
For more information refer to the [architecture](./docs/ARCHITECTURE.md). Note that the design is subject to change.
118

129
## Usage
@@ -23,64 +20,52 @@ NETWORK_PRIVATE_KEY="PRIVATE_KEY" to the SP1 prover network private key from Cel
2320
### Prerequisites
2421

2522
1. Install [Docker](https://docs.docker.com/get-docker/)
26-
1. Install [Rust](https://rustup.rs/)
27-
1. Install [Foundry](https://book.getfoundry.sh/getting-started/installation)
28-
1. Install [Bun](https://bun.sh/)
29-
1. Install [Just](https://just.systems/man/en/)
30-
1. Install [SP1](https://docs.succinct.xyz/docs/sp1/getting-started/install)
23+
2. Install [Foundry](https://book.getfoundry.sh/getting-started/installation)
24+
3. Install [Rust](https://rustup.rs/)
25+
4. Install [SP1](https://docs.succinct.xyz/docs/sp1/getting-started/install)
3126

3227
### Steps
3328

34-
1. Fork this repo and clone it
35-
1. Set up the git submodule for `solidity-ibc-eureka`
29+
1. Clone this repository.
3630

3731
```shell
38-
git submodule init
39-
git submodule update
32+
git clone git@github.com:celestiaorg/celestia-zkevm-hl-testnet.git
4033
```
4134

42-
1. Create the `.env` file in this repo
35+
2. Source the provided `.env` file in this repository.
4336

4437
```shell
4538
cp .env.example .env
46-
```
47-
48-
1. Run sp1up
4939
50-
```shell
51-
sp1up
40+
set -a
41+
source .env
42+
set +a
5243
```
5344

54-
1. Install contract dependencies and the SP1 Tendermint light client operator binary from solidity-ibc-eureka.
45+
3. Start the docker compose services.
5546

5647
```shell
57-
make install-dependencies
48+
# Run `make start` or `docker compose up` from the root of the repository
49+
make start
5850
```
5951

60-
1. Build the docker images
52+
4. Allow the `hyperlane-init` service to complete the provisioning of Hyperlane EVM contracts and cosmosnative components.
6153

6254
```shell
63-
make build-celestia-prover-docker
64-
make build-evm-prover-docker
65-
make build-indexer-docker
66-
make build-simapp-docker
55+
# Stream the logs via Docker to observe the status.
56+
docker logs -f hyperlane-init
6757
```
6858

69-
1. Copy the proto_description.bin file one directory up in celestia prover
70-
```shell
71-
cp ./provers/celestia-prover/prover/proto_descriptor.bin ./provers/celestia-prover/
72-
```
59+
5. Run a Hyperlane warp transfer, bridging `utia` from celestia to the reth service.
7360

74-
1. Run the Celestia prover
7561
```shell
76-
cargo run --package celestia-prover
62+
make transfer
7763
```
7864

79-
1. Run the demo in a different terminal window
65+
6. Query the ERC20 balance of the recipient on the reth service.
8066

8167
```shell
82-
# This runs make start, setup, and transfer
83-
make demo
68+
make query-balance
8469
```
8570

8671
## Architecture

0 commit comments

Comments
 (0)