pyth2wormhole: rename p2w-client service to p2w-attest

Change-Id: I34a53146919c12ab41b958cc8cd57108ee509faa
This commit is contained in:
Stan Drozd 2021-10-28 13:48:43 +02:00 committed by Stanislaw Drozd
parent 19c475e4a6
commit 05edb3d14f
7 changed files with 71 additions and 31 deletions

View File

@ -198,30 +198,20 @@ if pyth:
# pyth2wormhole client autoattester
docker_build(
ref = "p2w-client",
ref = "p2w-attest",
context = ".",
only = ["./solana", "./third_party"],
dockerfile = "./third_party/pyth/Dockerfile.p2w-client",
dockerfile = "./third_party/pyth/Dockerfile.p2w-attest",
ignore = ["./solana/*/target"],
)
k8s_yaml_with_ns("devnet/p2w-client.yaml")
k8s_yaml_with_ns("devnet/p2w-attest.yaml")
k8s_resource(
"p2w-client",
resource_deps = ["solana-devnet", "pyth"],
"p2w-attest",
resource_deps = ["solana-devnet", "pyth", "guardian"],
port_forwards = [],
)
# pyth2wormhole JS SDK test
local_resource(
name = "p2w-sdk-test",
resource_deps = ["wasm-gen"],
deps = ["third_party/pyth", "ethereum", "sdk"],
cmd = "tilt docker build -- -f ./third_party/pyth/p2w-sdk/Dockerfile .",
env = {"DOCKER_BUILDKIT": "1"},
)
k8s_yaml_with_ns("devnet/eth-devnet.yaml")
k8s_resource("eth-devnet", port_forwards = [

View File

@ -2,38 +2,38 @@
apiVersion: v1
kind: Service
metadata:
name: p2w-client
name: p2w-attest
labels:
app: p2w-client
app: p2w-attest
spec:
ports:
- port: 8001
name: http
- port: 4343
name: p2w-attest
protocol: TCP
clusterIP: None
selector:
app: p2w-client
app: p2w-attest
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: p2w-client
name: p2w-attest
spec:
selector:
matchLabels:
app: p2w-client
serviceName: p2w-client
app: p2w-attest
serviceName: p2w-attest
replicas: 1
template:
metadata:
labels:
app: p2w-client
app: p2w-attest
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 0
containers:
- name: p2w-client
image: p2w-client
- name: p2w-attest
image: p2w-attest
command:
- python3
- /usr/src/pyth/p2w_autoattest.py
@ -43,3 +43,7 @@ spec:
port: 2000
periodSeconds: 1
failureThreshold: 300
ports:
- containerPort: 4343
name: p2w-attest
protocol: TCP

41
devnet/p2w-relay.yaml Normal file
View File

@ -0,0 +1,41 @@
---
apiVersion: v1
kind: Service
metadata:
name: p2w-relay
labels:
app: p2w-relay
spec:
clusterIP: None
selector:
app: p2w-relay
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: p2w-relay
spec:
selector:
matchLabels:
app: p2w-relay
serviceName: p2w-relay
replicas: 1
template:
metadata:
labels:
app: p2w-relay
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 0
containers:
- name: p2w-relay
image: p2w-relay
command:
- node
- /usr/src/third_party/pyth/p2w-sdk/lib/autorelayer.js
tty: true
readinessProbe:
tcpSocket:
port: 2000
periodSeconds: 1
failureThreshold: 300

View File

@ -10,9 +10,6 @@ spec:
selector:
app: pyth
ports:
- port: 8898
name: pyth-tx
protocol: TCP
- port: 4242
name: pyth-accounts
protocol: TCP

View File

@ -76,6 +76,7 @@ COPY --from=build /usr/src/bridge/pyth2wormhole/program/bundler third_party/pyth
COPY --from=build /usr/src/bridge/bridge/program/bundler explorer/wasm/core
COPY --from=build /usr/src/bridge/modules/token_bridge/program/bundler explorer/wasm/token
COPY --from=build /usr/src/bridge/modules/nft_bridge/program/bundler explorer/wasm/nft
COPY --from=build /usr/src/bridge/bridge/program/bundler third_party/pyth/p2w-sdk/src/solana/wormhole-core
COPY --from=build /usr/src/bridge/bridge/program/nodejs sdk/js/src/solana/core-node
COPY --from=build /usr/src/bridge/modules/token_bridge/program/nodejs sdk/js/src/solana/token-node

View File

@ -13,5 +13,6 @@ RUN --mount=type=cache,target=/root/.cache \
chmod a+rx /usr/src/pyth/*.py
ENV P2W_OWNER_KEYPAIR="/usr/src/solana/keys/p2w_owner.json"
ENV P2W_ATTESTATIONS_PORT="4343"
ENV PYTH_PUBLISHER_KEYPAIR="/usr/src/solana/keys/pyth_publisher.json"
ENV PYTH_PROGRAM_KEYPAIR="/usr/src/solana/keys/pyth_program.json"

View File

@ -12,9 +12,15 @@ ADD sdk/js/ .
RUN --mount=type=cache,target=/home/node/.npm \
npm ci
# Build p2w-sdk
# Build p2w-sdk in dir preserving directory structure
WORKDIR /usr/src/third_party/pyth/p2w-sdk
COPY third_party/pyth/p2w-sdk/package.json third_party/pyth/p2w-sdk/package-lock.json .
RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.npm \
npm ci
WORKDIR /usr/src/third_party/pyth/p2w-sdk
COPY third_party/pyth/p2w-sdk .
RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.npm \
npm ci && npm run build-test && npm run test
npm run build-test