diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..9f970225ad --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +target/ \ No newline at end of file diff --git a/ci/setup_relayer.sh b/ci/setup_relayer.sh new file mode 100644 index 0000000000..be359c28cc --- /dev/null +++ b/ci/setup_relayer.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +echo "Setting up relayer for chains:" +echo Chain: "$CHAIN_A" +echo Chain: "$CHAIN_B" + +# Check gaia version +echo "-------------------------------------------------------------------------------------------------------------------" +echo "Relayer version" +echo "-------------------------------------------------------------------------------------------------------------------" +rrly diff --git a/ci/simple_config.toml b/ci/simple_config.toml new file mode 100644 index 0000000000..bccea9abd7 --- /dev/null +++ b/ci/simple_config.toml @@ -0,0 +1,28 @@ +[global] +timeout = '10s' +strategy = 'naive' + +[[chains]] +id = 'ibc0' +rpc_addr = 'tcp://ibc0:26657' +grpc_addr = 'tcp://localhost:9090' +account_prefix = 'cosmos' +key_name = 'testkey' +store_prefix = 'ibc' +client_ids = ['ethbridge'] +gas = 200000 +clock_drift = '5s' +trusting_period = '14days' + +[[chains]] +id = 'ibc1' +rpc_addr = 'tcp://localhost:26557' +grpc_addr = 'tcp://localhost:9090' +account_prefix = 'cosmos' +key_name = 'testkey' +store_prefix = 'ibc' +client_ids = ['ibconeclient'] +gas = 200000 +clock_drift = '5s' +trusting_period = '14days' + diff --git a/ci/docker-compose.yml b/docker-compose.yml similarity index 76% rename from ci/docker-compose.yml rename to docker-compose.yml index 4989e9cc67..62f673e173 100644 --- a/ci/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: - P2P_PORT=26656 - GRPC_PORT=9090 networks: - localnet: + relaynet: ipv4_address: 192.168.10.2 ibc1: container_name: ibc1 @@ -31,11 +31,21 @@ services: - P2P_PORT=26556 - GRPC_PORT=9091 networks: - localnet: + relaynet: ipv4_address: 192.168.10.3 + relayer: + depends_on: + - ibc0 + - ibc1 + container_name: relayer + image: "informal/relayer" + environment: + - CHAIN_A=ibc0 + - CHAIN_B=ibc1 + - CONFIG=simple_config.toml networks: - localnet: + relaynet: driver: bridge ipam: driver: default diff --git a/ci/gaia.Dockerfile b/docker-gaia.Dockerfile similarity index 90% rename from ci/gaia.Dockerfile rename to docker-gaia.Dockerfile index f107d364d9..9ccbefafb7 100644 --- a/ci/gaia.Dockerfile +++ b/docker-gaia.Dockerfile @@ -32,9 +32,6 @@ ENV GAIA /gaia # Install ca-certificates RUN apk add --update ca-certificates -# Add dependenncies -RUN apk add --no-cache tree - RUN addgroup gaia && \ adduser -S -G gaia gaia -h "$GAIA" @@ -44,10 +41,9 @@ WORKDIR $GAIA # Copy over binaries from the build-env COPY --from=build-env /go/bin/gaiad /usr/bin/gaiad -COPY --from=build-env /go/bin/gaiad /usr/bin/tree # Copy bootstrap script -COPY bootstrap_gaia.sh . +COPY ci/bootstrap_gaia.sh . # Set root to change permission USER root diff --git a/docker-relayer.Dockerfile b/docker-relayer.Dockerfile new file mode 100644 index 0000000000..a08fd23331 --- /dev/null +++ b/docker-relayer.Dockerfile @@ -0,0 +1,52 @@ +##################################################### +#### Build image #### +##################################################### +FROM rust:slim AS build-env + +# Output Rust version +RUN cargo --version + +# Set working dir +WORKDIR /repo + +# Logic to cache cargo dependecies across builds +COPY Cargo.lock . +COPY Cargo.toml . +COPY modules/Cargo.toml /repo/modules/Cargo.toml +COPY proto/Cargo.toml /repo/proto/Cargo.toml +COPY relayer/Cargo.toml /repo/relayer/Cargo.toml +COPY relayer-cli/Cargo.toml /repo/relayer-cli/Cargo.toml +RUN mkdir .cargo +RUN cargo vendor > .cargo/config + +# Copy project files +COPY . . + +# Build files +RUN cargo build --workspace --all + +##################################################### +#### Relayer image #### +##################################################### +FROM rust:slim + +# Copy relayer executable +COPY --from=build-env /repo/target/debug/rrly /usr/bin/rrly + +ENV RELAYER /relayer + +WORKDIR $RELAYER + +COPY /repo/vendor /vendor + +# Copy configuration file +COPY ci/simple_config.toml . + +# Copy setup script +COPY ci/setup_relayer.sh . + +# Make it executable +RUN chmod +x setup_relayer.sh + +# Entrypoint +ENTRYPOINT ["/bin/sh", "-c", "/relayer/setup_relayer.sh"] diff --git a/modules/Cargo.toml b/modules/Cargo.toml index 5aeee146a5..ac8afa736d 100644 --- a/modules/Cargo.toml +++ b/modules/Cargo.toml @@ -14,6 +14,10 @@ description = """ Implementation of the Inter-Blockchain Communication Protocol (IBC). """ +[lib] +name = "ibc" +path = "src/lib.rs" + [features] # This feature grants access to development-time mocking libraries, such as `MockContext` or `MockHeader`. # Depends on the `testgen` suite for generating Tendermint light blocks. diff --git a/proto/Cargo.toml b/proto/Cargo.toml index bc7cb07746..edb0a514ce 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -14,6 +14,10 @@ description = """ ibc-proto is a the Rust implementation of the Cosmos SDK proto structs. """ +[lib] +name = "ibc_proto" +path = "src/lib.rs" + [package.metadata.docs.rs] all-features = true diff --git a/relayer-cli/Cargo.toml b/relayer-cli/Cargo.toml index d16eaa9da2..a7b757a6fc 100644 --- a/relayer-cli/Cargo.toml +++ b/relayer-cli/Cargo.toml @@ -6,6 +6,10 @@ authors = [ "Informal Systems " ] +[[bin]] +name = "rrly" +path = "src/bin/relayer/main.rs" + [dependencies] relayer = { path = "../relayer" } ibc = { path = "../modules" } diff --git a/relayer/Cargo.toml b/relayer/Cargo.toml index 590f36f830..b87fbab26e 100644 --- a/relayer/Cargo.toml +++ b/relayer/Cargo.toml @@ -6,6 +6,10 @@ authors = [ "Informal Systems " ] +[lib] +name = "relayer" +path = "src/lib.rs" + [dependencies] ibc = { path = "../modules" } ibc-proto = { version = "0.4.0", path = "../proto" }