Skip to content

Commit

Permalink
feat: Submit MsgUpdateClient to tendermint light client (#67)
Browse files Browse the repository at this point in the history
Closes step two of
#31.

A few changes in this PR, can split them into separate PRs if reviewers
request:
1. Checkout submodules in CI workflows lint and test.
2. Sort makefile commands alphabetically. Add a new `make relay` command
that does step 2.
3. Update README with an important step to apply a diff in
`solidity-ibc-eureka/justfile`. The diff is needed so that the
Tendermint light client on the EVM roll-up supports Groth16 and has the
correct verifier key (from the celestia-prover)
4. Enable debug mode on Reth node (can revert if requested)
5. Add `curl` to the Celestia-prover for debugging purposes (can revert
if requested)
6. Update solidity-ibc-eureka version
7. Modify the prover proto to return hex-encoded verifier keys. This
made it easier to plumb directly into the EVM contract and Tendermint
light client set-up (can revert if requested)
8. Add a line to celestia-prover README to show example usage of `Info`
endpoint
9. Add a debug-txhash script to help debug failed EVM transactions (can
revert if requested)
10. Refactor the `extractDeployedContractAddresses` to utils package so
that it can be used in multiple places
11. Refactor the `transfer` script

## Testing

I can't run the celestia-prover in Docker because
#89 but if
I run it locally, it works:

```
$ make relay
go run testing/demo/pkg/relay/main.go
Extracted deployed contract addresses: utils.ContractAddresses{ERC20:"0xa05915fd6e32a1aa7e67d800164cacb12487142d", Escrow:"0xc4515dd838dd640d6839933b33ff8d19640c1231", IBCStore:"0xf73bd8a7184bec941b3f9ef5e6f6df981e105535", ICS07Tendermint:"0xe53275a1fca119e1c5eeb32e7a72e54835a63936", ICS20Transfer:"0xb1c938f5ba4b3593377f399e12175e8db0c787ff", ICS26Router:"0x48fd1226d797400779bbfaf1706f5fb8da04ae91", ICSCore:"0x7e7ad18adc99b94d4c728fdf13d4de97b926a0d8"}
Getting celestia prover info...
Got celestia prover info. StateTransitionVerifierKey: 0x0081282e1279b92586a3330c1cd83a3f0910299bdc7be90ac1a24b2a0826523bInvoking icsCore.UpdateClient...
Transaction hash: 0x6370b144be660a5d8f798c45fe3f1942735e7a86063dc1834b61013f04de3b11
Block number: 170
Gas used: 289132
Logs: []
recvBlockNumber 170
```
  • Loading branch information
rootulp authored Jan 28, 2025
1 parent 9492aba commit 4bad2b9
Show file tree
Hide file tree
Showing 20 changed files with 620 additions and 151 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
Expand Down
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BUILD_FLAGS := -tags "ledger" -ldflags '$(ldflags)'
## help: Get more info on make commands.
help: Makefile
@echo " Choose a command run in "$(PROJECT_NAME)":"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@sed -n 's/^##//p' $< | sort | column -t -s ':' | sed -e 's/^/ /'
.PHONY: help

## install-dependencies: Install all dependencies needed for the demo.
Expand Down Expand Up @@ -72,8 +72,8 @@ check-dependencies:
.PHONY: check-dependencies

## start: Start all processes needed for the demo.
start: stop
@docker compose up -d
start:
@docker compose up --detach
.PHONY: start

## setup: Set up the IBC clients and channels.
Expand All @@ -90,6 +90,13 @@ transfer:
@go run ./testing/demo/pkg/transfer/
.PHONY: transfer

## relay: Relay the token transfer from simapp to the EVM roll-up.
relay:
# Note: this is split out from transfer to speed up local development. This
# command can be merged into transfer to make the demo fewer steps to run.
go run testing/demo/pkg/relay/main.go
.PHONY: relay

## stop: Stop all processes and remove the tmp directory.
stop:
@echo "--> Stopping all processes"
Expand All @@ -106,7 +113,7 @@ build-simapp: mod
@go build $(BUILD_FLAGS) -o build/ ./simapp/simd/
.PHONY: build-simapp

## build: Build the simapp binary.
## build: Build the simapp the binaries into the ./build directory.
build: build-simapp
.PHONY: build

Expand All @@ -116,6 +123,10 @@ install-simapp:
@go install $(BUILD_FLAGS) ./simapp/simd/
.PHONY: install-simapp

## install: Install the simapp binary into the $GOPATH/bin directory.
install: install-simapp
.PHONY: install

## mod: Update all go.mod files.
mod:
@echo "--> Updating go.mod"
Expand Down Expand Up @@ -221,4 +232,5 @@ demo:
@make start
@make setup
@make transfer
@make relay
.PHONY: demo
39 changes: 33 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,41 @@ For more information refer to the [architecture document](./ARCHITECTURE.md). No
git submodule update
```

1. Apply this diff to the `solidity-ibc-eureka/justfile`:

```diff
genesis-sp1-ics07: build-sp1-programs
@echo "Generating the genesis file..."
- RUST_LOG=info cargo run --bin operator --release -- genesis -o scripts/genesis.json
+ RUST_LOG=info cargo run --bin operator --release -- genesis --proof-type groth16 -o scripts/genesis.json
+ @echo "--> Setting the verifier key in scripts/genesis.json"
+ @sed -i '' 's|"updateClientVkey": "0x00d003b09381282af2781e5ec015aae610d766a08fffd4ac45d2e6dad736ead3"|"updateClientVkey": "0x0081282e1279b92586a3330c1cd83a3f0910299bdc7be90ac1a24b2a0826523b"|' scripts/genesis.json
+ @echo "--> Set the verifier key to 0x0081282e1279b92586a3330c1cd83a3f0910299bdc7be90ac1a24b2a0826523b."
```

1. Create and populate the `.env` file

```shell
cp .env.example .env
# Modify the .env file and set `SP1_PROVER=network` and `SP1_PRIVATE_KEY="PRIVATE_KEY"` to the SP1 prover network private key from Celestia 1Password.
```

1. Modify the `docker-compose.yml` file and set `SP1_PROVER=network` and `SP1_PRIVATE_KEY="PRIVATE_KEY"` to the SP1 prover network private key from Celestia 1Password.

```diff
celestia-prover:
image: ghcr.io/celestiaorg/celestia-zkevm-ibc-demo/celestia-prover:latest
container_name: celestia-prover
environment:
# TENDERMINT_RPC_URL should be the SimApp which is acting as a substitute
# for Celestia (with IBC Eurekea enabled).
- TENDERMINT_RPC_URL=http://simapp-validator:26657
- RPC_URL=http://reth:8545
- PROTO_DESCRIPTOR_PATH=proto_descriptor.bin
+ - SP1_PROVER=network
+ - SP1_PRIVATE_KEY=PRIVATE_KEY
```

1. Install contract dependencies and the SP1 Tendermint light client operator binary from solidity-ibc-eureka.

```shell
Expand All @@ -63,15 +91,14 @@ For more information refer to the [architecture document](./ARCHITECTURE.md). No
make setup
```

1. Transfer tokens from SimApp to the EVM roll-up.
1. Run the demo

```shell
# Transfer tokens from SimApp to the EVM roll-up.
make transfer
```

1. To stop and teardown the test environment (when you're finished)
```shell
# Relay the token transfer
make relay
# To stop and teardown the test environment (when you're finished)
make stop
```

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
--chain /testapp_files/eth-genesis.json
--http
--http.addr 0.0.0.0
--http.api eth,net
--http.api eth,net,debug
--authrpc.addr 0.0.0.0
--authrpc.jwtsecret /testapp_files/jwt.hex
--datadir /.tmp/eth-home
Expand Down
1 change: 1 addition & 0 deletions docker/celestia_prover.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
libssl3 \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*

# Copy binary from builder
Expand Down
45 changes: 37 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ require (
cosmossdk.io/math v1.4.0
github.com/consensys/gnark v0.11.0
github.com/consensys/gnark-crypto v0.14.0
github.com/cosmos/solidity-ibc-eureka/abigen v0.0.0-20241207083532-66bed7cfbbe1
github.com/cosmos/solidity-ibc-eureka/abigen v0.0.0
github.com/ethereum/go-ethereum v1.14.12
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/srdtrk/solidity-ibc-eureka/e2e/v8 v8.0.0-00010101000000-000000000000
google.golang.org/grpc v1.68.1
google.golang.org/protobuf v1.35.2
)
Expand All @@ -51,10 +52,13 @@ require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/DataDog/datadog-go v4.8.3+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/attestantio/go-eth2-client v0.21.11 // indirect
github.com/avast/retry-go/v4 v4.5.1 // indirect
github.com/aws/aws-sdk-go v1.44.224 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
Expand Down Expand Up @@ -91,13 +95,18 @@ require (
github.com/desertbit/timer v1.0.1 // indirect
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.9+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.7.0 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/ferranbt/fastssz v0.1.3 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/getsentry/sentry-go v0.28.1 // indirect
Expand All @@ -107,10 +116,11 @@ require (
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/goccy/go-yaml v1.9.2 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/protobuf v1.3.3 // indirect
github.com/golang/glog v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
Expand All @@ -137,13 +147,14 @@ require (
github.com/hashicorp/go-metrics v0.5.3 // indirect
github.com/hashicorp/go-plugin v1.6.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
github.com/holiman/uint256 v1.3.1 // indirect
github.com/huandu/go-clone v1.6.0 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
Expand All @@ -153,6 +164,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.9 // indirect
Expand All @@ -163,6 +175,7 @@ require (
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/minio/highwayhash v1.0.3 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -173,16 +186,21 @@ require (
github.com/oklog/run v1.1.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
github.com/pk910/dynamic-ssz v0.0.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.60.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/prysmaticlabs/go-bitfield v0.0.0-20240328144219-a1caa50c3a1e // indirect
github.com/r3labs/sse/v2 v2.10.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/ronanh/intcomp v1.1.0 // indirect
github.com/rs/cors v1.11.1 // indirect
Expand All @@ -194,6 +212,7 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/strangelove-ventures/interchaintest/v8 v8.3.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.13 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
Expand All @@ -213,6 +232,7 @@ require (
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/net v0.30.0 // indirect
Expand All @@ -222,10 +242,13 @@ require (
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/api v0.186.0 // indirect
google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -236,11 +259,17 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

// Replaces directives copied from solidity-ibc-eureka.
replace (
// Replace ibc-go with the most recent commit on the feat/ibc-eureka branch.
// ea4e73629c55e35537467d9f032da5be8082b468 is the recent commit as of this writing.
// See https://github.com/cosmos/ibc-go/tree/feat/ibc-eureka
github.com/cosmos/ibc-go/v9 => github.com/cosmos/ibc-go/v9 v9.0.0-20241218142801-ea4e73629c55
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
github.com/ChainSafe/go-schnorrkel/1 => github.com/ChainSafe/go-schnorrkel v1.0.0
github.com/cosmos/ibc-go/modules/light-clients/08-wasm => github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.0.0-20241123151201-3d84b47307b9
github.com/cosmos/ibc-go/v9 => github.com/cosmos/ibc-go/v9 v9.0.0-20241123151201-3d84b47307b9
github.com/cosmos/solidity-ibc-eureka/abigen => ./solidity-ibc-eureka/abigen
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/misko9/go-substrate-rpc-client/v4 => github.com/DimitrisJim/go-substrate-rpc-client/v4 v4.0.0-20240717100841-406da076c1d5
github.com/srdtrk/solidity-ibc-eureka/e2e/v8 => ./solidity-ibc-eureka/e2e/interchaintestv8
github.com/strangelove-ventures/interchaintest/v8 => github.com/DimitrisJim/interchaintest/v8 v8.0.0-20240717102845-beba523a47ff
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7
)
Loading

0 comments on commit 4bad2b9

Please sign in to comment.