Skip to content

Commit

Permalink
pyth2wormhole: rename p2w-client service to p2w-attest
Browse files Browse the repository at this point in the history
Change-Id: I34a53146919c12ab41b958cc8cd57108ee509faa
  • Loading branch information
Stan Drozd authored and Stanislaw Drozd committed Nov 15, 2021
1 parent 19c475e commit 05edb3d
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 31 deletions.
20 changes: 5 additions & 15 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
26 changes: 15 additions & 11 deletions devnet/p2w-client.yaml → devnet/p2w-attest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,3 +43,7 @@ spec:
port: 2000
periodSeconds: 1
failureThreshold: 300
ports:
- containerPort: 4343
name: p2w-attest
protocol: TCP
41 changes: 41 additions & 0 deletions devnet/p2w-relay.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions devnet/pyth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ spec:
selector:
app: pyth
ports:
- port: 8898
name: pyth-tx
protocol: TCP
- port: 4242
name: pyth-accounts
protocol: TCP
Expand Down
1 change: 1 addition & 0 deletions solana/Dockerfile.wasm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
10 changes: 8 additions & 2 deletions third_party/pyth/p2w-sdk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 05edb3d

Please sign in to comment.