Relayer: Import sdk in relayer engine (#3095)

* Update relayer engine dockerfile to import SDK, and reduce timeout

* fix import

* Add ethereum config folder
This commit is contained in:
derpy-duck 2023-06-16 06:44:55 -04:00 committed by GitHub
parent a98406550a
commit 82e31f6965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 58 deletions

View File

@ -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

View File

@ -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")

View File

@ -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 \

View File

@ -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",