-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e2e: moving integration e2e to babylon-sdk #68
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
97e2741
ibcsim-bcd
SebastianElvis b99e7c2
bump go version and add client controller
SebastianElvis f804fc5
migrate bcd consumer integration test
SebastianElvis af50727
babylond image
SebastianElvis 4af58ca
add test
SebastianElvis d0724ec
cleanup e2e cmd
SebastianElvis 09374bd
fix e2e
SebastianElvis 9f953e6
add integration e2e ci
SebastianElvis 0ee6e1b
bump ci tmpl
SebastianElvis 47160c0
try fix
SebastianElvis 23937e9
try
SebastianElvis 2445531
try
SebastianElvis c6a409e
try
SebastianElvis 2e6b74f
try
SebastianElvis 4ec9563
try sudo
SebastianElvis 354ec34
Integration e2e test #2 (#70)
maurolacy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: integration-e2e | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build IBC Simulator BCD Image | ||
run: make build-ibcsim-bcd | ||
|
||
- name: Build Babylond Image | ||
run: make build-babylond | ||
|
||
- name: Cache Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.23 | ||
|
||
- name: Run Integration Tests | ||
run: sudo make test-e2e-bcd-consumer-integration | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
BABYLON_SDK_FULL_PATH := $(shell git rev-parse --show-toplevel) | ||
|
||
babylond: babylond-rmi | ||
docker build --tag babylonlabs-io/babylond -f babylond/Dockerfile ${BABYLON_SDK_FULL_PATH} | ||
|
||
babylond-rmi: | ||
docker rmi babylonlabs-io/babylond --force 2>/dev/null; true | ||
|
||
ibcsim-bcd: | ||
docker build --tag babylonlabs-io/ibcsim-bcd -f ibcsim-bcd/Dockerfile ${BABYLON_SDK_FULL_PATH} | ||
|
||
ibcsim-bcd-rmi: | ||
docker rmi babylonlabs-io/ibcsim-bcd 2>/dev/null; true | ||
|
||
start-bcd-consumer-integration: stop-bcd-consumer-integration | ||
ibcsim-bcd/pre-deployment.sh | ||
docker compose -f ibcsim-bcd/docker-compose.yml up -d | ||
|
||
stop-bcd-consumer-integration: | ||
docker compose -f ibcsim-bcd/docker-compose.yml down | ||
rm -rf ibcsim-bcd/.testnets | ||
|
||
.PHONY: ibcsim-bcd ibcsim-bcd-rmi start-bcd-consumer-integration stop-bcd-consumer-integration babylond babylond-rmi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
FROM golang:1.23-alpine AS build-env | ||
|
||
# Customize to your build env | ||
|
||
# TARGETPLATFORM should be one of linux/amd64 or linux/arm64. | ||
ARG TARGETPLATFORM="linux/amd64" | ||
# Version to build. Default is empty | ||
ARG VERSION="base/consumer-chain-support" | ||
ARG BABYLON_BUILD_OPTIONS="" | ||
ARG COSMOS_BUILD_OPTIONS="" | ||
|
||
# Use muslc for static libs | ||
ARG BUILD_TAGS="muslc" | ||
ARG LEDGER_ENABLED="false" | ||
|
||
|
||
# Install cli tools for building and final image | ||
RUN apk add --update --no-cache make git bash gcc linux-headers eudev-dev ncurses-dev openssh curl jq | ||
RUN apk add --no-cache musl-dev | ||
|
||
# Build | ||
WORKDIR /go/src/github.com/babylonlabs-io/babylon | ||
# Clone repo | ||
RUN git clone https://github.com/babylonlabs-io/babylon.git /go/src/github.com/babylonlabs-io/babylon | ||
# If version is set, then checkout this version | ||
RUN if [ -n "${VERSION}" ]; then \ | ||
git fetch origin tag ${VERSION} --no-tags ; \ | ||
git checkout -f ${VERSION}; \ | ||
fi | ||
|
||
# Cosmwasm - Download correct libwasmvm version | ||
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | cut -d ' ' -f 2) && \ | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \ | ||
-O /lib/libwasmvm_muslc.$(uname -m).a && \ | ||
# verify checksum | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ | ||
sha256sum /lib/libwasmvm_muslc.$(uname -m).a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$(uname -m) | cut -d ' ' -f 1) | ||
|
||
RUN LEDGER_ENABLED=$LEDGER_ENABLED \ | ||
BABYLON_BUILD_OPTIONS=$BABYLON_BUILD_OPTIONS \ | ||
COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ | ||
BUILD_TAGS=$BUILD_TAGS \ | ||
LINK_STATICALLY=true \ | ||
make build | ||
|
||
FROM alpine:3.14 AS run | ||
# Create a user | ||
RUN addgroup --gid 1137 -S babylon && adduser --uid 1137 -S babylon -G babylon | ||
RUN apk add bash curl jq | ||
|
||
# Label should match your github repo | ||
ARG VERSION | ||
LABEL org.opencontainers.image.source="https://github.com/babylonlabs-io/babylond:${VERSION}" | ||
|
||
# Install Libraries | ||
# COPY --from=build-env /usr/lib/libgcc_s.so.1 /lib/ | ||
# COPY --from=build-env /lib/ld-musl*.so.1* /lib | ||
|
||
COPY --from=build-env /go/src/github.com/babylonlabs-io/babylon/build/babylond /bin/babylond | ||
|
||
# Set home directory and user | ||
WORKDIR /home/babylon | ||
RUN chown -R babylon /home/babylon | ||
USER babylon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
FROM debian:bullseye-slim AS build-env | ||
|
||
RUN apt-get update && apt-get install -y git make gcc wget | ||
|
||
WORKDIR /work | ||
|
||
ARG TARGETARCH | ||
|
||
# Download and install Go | ||
ENV GOLANG_VERSION 1.21.4 | ||
RUN wget -q https://golang.org/dl/go${GOLANG_VERSION}.linux-${TARGETARCH}.tar.gz && \ | ||
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-${TARGETARCH}.tar.gz && \ | ||
rm go${GOLANG_VERSION}.linux-${TARGETARCH}.tar.gz | ||
# Set Go environment variables | ||
ENV PATH /usr/local/go/bin:$PATH | ||
ENV GOPATH /go | ||
ENV PATH $GOPATH/bin:$PATH | ||
|
||
ENV GO111MODULE on | ||
ENV RELAYER_TAG v2.5.2 | ||
|
||
# Install the relayer | ||
RUN git clone https://github.com/cosmos/relayer.git | ||
RUN cd relayer && git fetch origin && git checkout ${RELAYER_TAG} && make install && cd - | ||
|
||
# build bcd | ||
COPY . /work/babylon-sdk | ||
RUN cd babylon-sdk && \ | ||
make build && \ | ||
cd - | ||
|
||
FROM debian:bullseye-slim AS run | ||
|
||
RUN apt-get update && apt-get install -y bash curl jq wget | ||
|
||
# Install libraries | ||
# Cosmwasm - Download correct libwasmvm version | ||
COPY --from=build-env /work/babylon-sdk/demo/go.mod /tmp | ||
RUN WASMVM_VERSION=$(grep github.com/CosmWasm/wasmvm /tmp/go.mod | cut -d' ' -f2) && \ | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.$(uname -m).so \ | ||
-O /lib/libwasmvm.$(uname -m).so && \ | ||
# verify checksum | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ | ||
sha256sum /lib/libwasmvm.$(uname -m).so | grep $(cat /tmp/checksums.txt | grep libwasmvm.$(uname -m) | cut -d ' ' -f 1) | ||
RUN rm -f /tmp/go.mod | ||
|
||
# Copy binaries | ||
COPY --from=build-env /go/bin/rly /usr/bin/rly | ||
COPY --from=build-env /work/babylon-sdk/demo/build/bcd /usr/bin/bcd | ||
|
||
WORKDIR /ibcsim-bcd | ||
COPY contrib/images/ibcsim-bcd/wrapper.sh /ibcsim-bcd/wrapper.sh | ||
COPY contrib/images/ibcsim-bcd/setup-bcd.sh /ibcsim-bcd/setup-bcd.sh | ||
COPY --from=build-env /work/babylon-sdk/tests/testdata/babylon_contract.wasm /ibcsim-bcd/babylon_contract.wasm | ||
COPY --from=build-env /work/babylon-sdk/tests/testdata/btc_staking.wasm /ibcsim-bcd/btc_staking.wasm | ||
COPY --from=build-env /work/babylon-sdk/tests/testdata/btc_finality.wasm /ibcsim-bcd/btc_finality.wasm | ||
|
||
ENV BABYLON_HOME=/data/node1/babylond | ||
ENV BABYLON_NODE_RPC="http://babylondnode1:26657" | ||
ENV RELAYER_CONF_DIR=/data/relayer | ||
ENV CONSUMER_CONF=/data/bcd | ||
ENV UPDATE_CLIENTS_INTERVAL=20s | ||
|
||
ENTRYPOINT ["/ibcsim-bcd/wrapper.sh"] | ||
CMD [] | ||
STOPSIGNAL SIGTERM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
services: | ||
babylondnode0: | ||
container_name: babylondnode0 | ||
image: "babylonlabs-io/babylond" | ||
command: > | ||
babylond --home /babylondhome start --log_level trace --trace --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log | ||
cap_add: | ||
- SYS_PTRACE | ||
security_opt: | ||
- seccomp:unconfined | ||
ports: | ||
- "26656-26657:26656-26657" | ||
- "1317:1317" | ||
- "9090:9090" | ||
- "2345:2345" | ||
volumes: | ||
- .testnets/node0/babylond:/babylondhome:Z | ||
networks: | ||
localnet: | ||
ipv4_address: 192.168.10.2 | ||
|
||
babylondnode1: | ||
container_name: babylondnode1 | ||
image: "babylonlabs-io/babylond" | ||
command: > | ||
babylond --home /babylondhome start --log_level trace --trace --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log | ||
cap_add: | ||
- SYS_PTRACE | ||
security_opt: | ||
- seccomp:unconfined | ||
ports: | ||
- "26666-26667:26656-26657" | ||
- "1318:1317" | ||
- "9091:9090" | ||
- "2346:2345" | ||
volumes: | ||
- .testnets/node1/babylond:/babylondhome:Z | ||
networks: | ||
localnet: | ||
ipv4_address: 192.168.10.3 | ||
|
||
ibcsim-bcd: | ||
container_name: ibcsim-bcd | ||
image: babylonlabs-io/ibcsim-bcd | ||
ports: | ||
- "5183:5183" | ||
- "26676-26677:26656-26657" | ||
- "1319:1317" | ||
- "9092:9090" | ||
- "2347:2345" | ||
volumes: | ||
- .testnets:/data:Z | ||
networks: | ||
localnet: | ||
ipv4_address: 192.168.10.17 | ||
depends_on: | ||
- babylondnode0 | ||
- babylondnode1 | ||
restart: unless-stopped | ||
|
||
networks: | ||
localnet: | ||
driver: bridge | ||
ipam: | ||
driver: default | ||
config: | ||
- subnet: 192.168.10.0/25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
# Create new directory that will hold node and services' configuration | ||
mkdir -p ibcsim-bcd/.testnets && chmod -R 777 ibcsim-bcd/.testnets | ||
echo "Creating and configuring testnet directory..." | ||
docker run --rm -v $(pwd)/ibcsim-bcd/.testnets:/data babylonlabs-io/babylond \ | ||
babylond testnet init-files --v 2 -o /data \ | ||
--starting-ip-address 192.168.10.2 --keyring-backend=test \ | ||
--chain-id chain-test --epoch-interval 10 \ | ||
--btc-finalization-timeout 2 --btc-confirmation-depth 1 \ | ||
--minimum-gas-prices 0.000006ubbn \ | ||
--btc-base-header 0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff7f2002000000 \ | ||
--btc-network regtest --additional-sender-account \ | ||
--slashing-pk-script "76a914010101010101010101010101010101010101010188ab" \ | ||
--slashing-rate 0.1 \ | ||
--min-commission-rate 0.05 \ | ||
--covenant-quorum 1 \ | ||
--covenant-pks "bb50e2d89a4ed70663d080659fe0ad4b9bc3e06c17a227433966cb59ceee020d" # should be updated if `covenant-keyring` dir is changed` | ||
|
||
# Create separate subpaths for each component and copy relevant configuration | ||
chmod -R 777 ibcsim-bcd/.testnets | ||
echo "Testnet directory created and configured successfully." |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to create a comprehensive
test-e2e
target in the Makefile, and call it from here. I'm pushing a companion / follow-up PR with some small improvements, if you don't mind.Update: #70.