From 82e31f69654b4d1d875ee7a26899587e266f3347 Mon Sep 17 00:00:00 2001 From: derpy-duck <115193320+derpy-duck@users.noreply.github.com> Date: Fri, 16 Jun 2023 06:44:55 -0400 Subject: [PATCH] Relayer: Import sdk in relayer engine (#3095) * Update relayer engine dockerfile to import SDK, and reduce timeout * fix import * Add ethereum config folder --- .github/workflows/build.yml | 2 +- Tiltfile | 5 +- .../relayer-engine-v2/Dockerfile | 54 +------------------ .../relayer-engine-v2/package.json | 2 +- 4 files changed, 5 insertions(+), 58 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af455f373..0c5f731ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: # temporarily set --guardiand_loglevel=info to debug https://github.com/wormhole-foundation/wormhole/issues/3052 - run: tilt ci -- --ci --namespace=$DEPLOY_NS --num=2 --guardiand_loglevel=info - timeout-minutes: 40 + timeout-minutes: 25 # Clean up k8s resources - run: kubectl delete --namespace=$DEPLOY_NS service,statefulset,configmap,pod,job --all diff --git a/Tiltfile b/Tiltfile index aaf401865..1ff873586 100644 --- a/Tiltfile +++ b/Tiltfile @@ -517,9 +517,8 @@ if generic_relayer: docker_build( ref = "relayer-engine", context = ".", - only = ["./ethereum", "./relayer/generic_relayer", "./sdk", "./solana"], - dockerfile = "relayer/generic_relayer/relayer-engine-v2/Dockerfile", - ignore = ["./ethereum/node_modules", "./sdk/js/src/relayer/__tests__"] + only = ["./relayer/generic_relayer", "./ethereum/ts-scripts/relayer/config"], + dockerfile = "relayer/generic_relayer/relayer-engine-v2/Dockerfile" ) k8s_yaml_with_ns("devnet/relayer-engine.yaml") diff --git a/relayer/generic_relayer/relayer-engine-v2/Dockerfile b/relayer/generic_relayer/relayer-engine-v2/Dockerfile index cde658655..020916de8 100644 --- a/relayer/generic_relayer/relayer-engine-v2/Dockerfile +++ b/relayer/generic_relayer/relayer-engine-v2/Dockerfile @@ -8,15 +8,9 @@ RUN apt-get update && apt-get -y install \ git python make curl netcat RUN npm i typescript -g -RUN curl -L https://foundry.paradigm.xyz | bash -RUN $HOME/.foundry/bin/foundryup -RUN ls $HOME/.foundry/bin -# Run as user, otherwise, npx explodes. -RUN mv /root/.foundry/bin/forge /bin/forge USER 1000 - RUN mkdir -p /home/node/app RUN mkdir -p /home/node/.npm @@ -25,8 +19,6 @@ WORKDIR /home/node/app # Fix git ssh error RUN git config --global url."https://".insteadOf ssh:// -# Support additional root CAs -COPY ./ethereum/README.md cert.pem* /certs/ # Node ENV NODE_EXTRA_CA_CERTS=/certs/cert.pem ENV NODE_OPTIONS=--use-openssl-ca @@ -35,50 +27,7 @@ RUN if [ -e /certs/cert.pem ]; then npm config set cafile /certs/cert.pem; fi # git RUN if [ -e /certs/cert.pem ]; then git config --global http.sslCAInfo /certs/cert.pem; fi -WORKDIR /home/node/app/ethereum - -# Only invalidate the npm install step if package.json changed -COPY --chown=node:node ./ethereum/package.json . -COPY --chown=node:node ./ethereum/package-lock.json . -COPY --chown=node:node ./ethereum/.env.test .env - - -# We want to cache node_modules *and* incorporate it into the final image. -RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \ - --mount=type=cache,uid=1000,gid=1000,target=/ethereum/node_modules \ - npm ci && \ - cp -R node_modules node_modules_cache - - -# Amusingly, Debian's coreutils version has a bug where mv believes that -# the target is on a different fs and does a full recursive copy for what -# could be a renameat syscall. Alpine does not have this bug. -RUN rm -rf node_modules && mv node_modules_cache node_modules - -COPY --chown=node:node ./ethereum . - - - -#typechain needs to be on the path -USER root -RUN npm i --save-dev --global typechain -RUN forge install --no-git --no-commit -RUN apt-get install tree -RUN make dependencies -RUN tree -L 1; forge build -o build-forge -RUN typechain --target=ethers-v5 --out-dir=./ethers-contracts ./build-forge/!\(test\).sol/*.json - - - -#Ethereum setup above this line should eventually be removed once the TS SDK is set up - -# Add the SDK -WORKDIR /home/node/app/ -COPY --chown=node:node ./sdk ./sdk -COPY --chown=node:node ./solana/idl ./solana/idl -WORKDIR /home/node/app/sdk/js/ -RUN npm ci -RUN npm run build +COPY --chown=node:node ./ethereum/ts-scripts/relayer/config/ ./ethereum/ts-scripts/relayer/config/ #Path matters so as to not break imports WORKDIR /home/node/app/relayer/generic_relayer/relayer-engine-v2/ @@ -87,7 +36,6 @@ WORKDIR /home/node/app/relayer/generic_relayer/relayer-engine-v2/ COPY --chown=node:node /relayer/generic_relayer/relayer-engine-v2/package.json . COPY --chown=node:node /relayer/generic_relayer/relayer-engine-v2/package-lock.json . - # We want to cache node_modules *and* incorporate it into the final image. RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \ --mount=type=cache,uid=1000,gid=1000,target=/relayer/generic_relayer/relayer-engine-v2/node_modules \ diff --git a/relayer/generic_relayer/relayer-engine-v2/package.json b/relayer/generic_relayer/relayer-engine-v2/package.json index 7faa67ddd..03764f7a4 100644 --- a/relayer/generic_relayer/relayer-engine-v2/package.json +++ b/relayer/generic_relayer/relayer-engine-v2/package.json @@ -17,7 +17,7 @@ "author": "Joe Howarth", "license": "ISC", "dependencies": { - "@certusone/wormhole-sdk": "file:../../../sdk/js", + "@certusone/wormhole-sdk": "^0.9.19-beta.0", "@improbable-eng/grpc-web-node-http-transport": "^0.15.0", "@types/clone": "^2.1.1", "@types/koa": "^2.13.5",