[price-service] Move to top (#474)

* Move price service to top

* Update the paths and docs

* A little cleanup
This commit is contained in:
Ali Behjati 2023-01-13 16:26:43 +01:00 committed by GitHub
parent ad864c697a
commit 0e55d0808d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 50 additions and 24 deletions

View File

@ -38,7 +38,7 @@ jobs:
AWS_REGION: us-east-1 AWS_REGION: us-east-1
- run: | - run: |
DOCKER_BUILDKIT=1 docker build -f tilt-devnet/docker-images/Dockerfile.wasm -o type=local,dest=. . DOCKER_BUILDKIT=1 docker build -f tilt-devnet/docker-images/Dockerfile.wasm -o type=local,dest=. .
DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f third_party/pyth/price-service/Dockerfile.price_service . DOCKER_BUILDKIT=1 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f price-service/Dockerfile.price_service .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
env: env:
ECR_REGISTRY: public.ecr.aws ECR_REGISTRY: public.ecr.aws

View File

@ -1,7 +1,7 @@
# Pyth2Wormhole # Pyth Crosschain
This repository acts as a monorepo for the various components that make up This repository acts as a monorepo for the various components that make up
Pyth2Wormhole. The base repository is a fork from Certus One's reference Pyth Crosschain. The base repository is a fork from Certus One's reference
[Wormhole][] implementation in order to take advantage of the existing tooling [Wormhole][] implementation in order to take advantage of the existing tooling
for building projects based on Wormhole's various SDKs. Much of the existing for building projects based on Wormhole's various SDKs. Much of the existing
documentation from there will also apply to this repository. documentation from there will also apply to this repository.
@ -10,36 +10,38 @@ documentation from there will also apply to this repository.
Within this monorepo you will find the following subprojects: Within this monorepo you will find the following subprojects:
## Pyth2Wormhole Solana ## Wormhole Attester
> solana/pyth2wormhole > wormhole-attester
The main Pyth implementation currently exists as an [on-chain contract][] on The main Pyth implementation currently exists as an [on-chain contract][] on
Solana. In order to expose these prices cross-chain, the Pyth2Wormhole Solana Solana. In order to expose these prices cross-chain, the Wormhole Attester
contract acts as a sender for Pyth prices. At regular intervals the Pyth contract acts as a sender for Pyth prices. At regular intervals the Pyth
contract will observe the current Pyth price for selected products, and produce contract will observe the current Pyth price for selected products, and produce
an attestation which is then relayed over Wormhole to be consumed by the an attestation which is then relayed over Wormhole to be consumed by the
various P2W receiver contracts. various receiver contracts.
[on-chain contract]: https://github.com/pyth-network/pyth-client [on-chain contract]: https://github.com/pyth-network/pyth-client
## Pyth2Wormhole Ethereum ## Target Chains
> ethereum/contracts/pyth ### Ethereum
The Ethereum P2W contract acts as a receiver for Pyth prices relayed from the > target-chains/ethereum/contracts/pyth
P2W Solana contract. It also provides a public API for other Ethereum contracts
The Ethereum contract acts as a receiver for Pyth prices relayed from the
Wormhole Attester. It also provides a public API for other Ethereum contracts
that can be used to consume Pyth prices. For a guide on using this API to that can be used to consume Pyth prices. For a guide on using this API to
consume Pyth price feeds see [pyth-evm-sdk][] which contains documented consume Pyth price feeds see [pyth-sdk-solidity][] which contains documented
examples. examples.
[pyth-evm-sdk]: https://github.com/pyth-network/pyth-sdk-solidity [pyth-sdk-solidity]: https://github.com/pyth-network/pyth-sdk-solidity
## Pyth2Wormhole Price Service ## Price Service
> third_party/pyth > price-service
The P2W Price Service is an off-chain service which constantly observes the The Price Service is an off-chain service which constantly observes the
Wormhole network watching for price attestations emitted from the Pyth Solana Wormhole network watching for price attestations emitted from the Pyth Solana
contract. It exposes all observed attestations via a public API over HTTPS/WSS contract. It exposes all observed attestations via a public API over HTTPS/WSS
which can be consumed by client-side applications that wish to use Pyth pricing which can be consumed by client-side applications that wish to use Pyth pricing

View File

@ -241,7 +241,7 @@ k8s_resource(
docker_build( docker_build(
ref = "pyth-price-service", ref = "pyth-price-service",
context = ".", context = ".",
dockerfile = "third_party/pyth/price-service/Dockerfile.price_service", dockerfile = "price-service/Dockerfile.price_service",
) )
k8s_yaml_with_ns("tilt-devnet/k8s/pyth-price-service.yaml") k8s_yaml_with_ns("tilt-devnet/k8s/pyth-price-service.yaml")
k8s_resource( k8s_resource(
@ -249,7 +249,6 @@ k8s_resource(
resource_deps = ["pyth", "p2w-attest", "spy", "eth-devnet", "wasm-gen"], resource_deps = ["pyth", "p2w-attest", "spy", "eth-devnet", "wasm-gen"],
port_forwards = [ port_forwards = [
port_forward(4202, container_port = 4200, name = "Rest API (Status + Query) [:4202]", host = webHost), port_forward(4202, container_port = 4200, name = "Rest API (Status + Query) [:4202]", host = webHost),
port_forward(6202, container_port = 6200, name = "WSS API [:6202]", host = webHost),
port_forward(8083, container_port = 8081, name = "Prometheus [:8083]", host = webHost)], port_forward(8083, container_port = 8081, name = "Prometheus [:8083]", host = webHost)],
labels = ["pyth"] labels = ["pyth"]
) )

View File

@ -10,7 +10,7 @@ WORKDIR ${BASE_PATH}/${P2W_SDK_REL_PATH}
COPY --chown=pyth:pyth ${P2W_SDK_REL_PATH} . COPY --chown=pyth:pyth ${P2W_SDK_REL_PATH} .
RUN npm ci && npm run build && npm cache clean --force RUN npm ci && npm run build && npm cache clean --force
ARG PRICE_SERVICE_REL_PATH=third_party/pyth/price-service ARG PRICE_SERVICE_REL_PATH=price-service
WORKDIR ${BASE_PATH}/${PRICE_SERVICE_REL_PATH} WORKDIR ${BASE_PATH}/${PRICE_SERVICE_REL_PATH}
COPY --chown=pyth:pyth ${PRICE_SERVICE_REL_PATH} . COPY --chown=pyth:pyth ${PRICE_SERVICE_REL_PATH} .
RUN npm ci && npm run build && npm cache clean --force RUN npm ci && npm run build && npm cache clean --force

View File

@ -57,7 +57,7 @@ Then, build the image from [the repo root](../../../) like below. It will create
local image named `pyth_price_service`. local image named `pyth_price_service`.
``` ```
$ docker buildx build -f third_party/pyth/price-service/Dockerfile.price_service -t pyth_price_service . $ docker buildx build -f price-service/Dockerfile.price_service -t pyth_price_service .
``` ```
If you wish to build price service without docker, please follow the instruction of the price service If you wish to build price service without docker, please follow the instruction of the price service

View File

@ -11,7 +11,7 @@
"dependencies": { "dependencies": {
"@certusone/wormhole-sdk": "^0.1.4", "@certusone/wormhole-sdk": "^0.1.4",
"@certusone/wormhole-spydk": "^0.0.1", "@certusone/wormhole-spydk": "^0.0.1",
"@pythnetwork/p2w-sdk-js": "file:../p2w-sdk/js", "@pythnetwork/p2w-sdk-js": "file:../third_party/pyth/p2w-sdk/js",
"@pythnetwork/pyth-sdk-js": "^1.1.0", "@pythnetwork/pyth-sdk-js": "^1.1.0",
"@types/cors": "^2.8.12", "@types/cors": "^2.8.12",
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
@ -54,6 +54,31 @@
}, },
"../p2w-sdk/js": { "../p2w-sdk/js": {
"name": "@pythnetwork/p2w-sdk-js", "name": "@pythnetwork/p2w-sdk-js",
"version": "1.0.0",
"extraneous": true,
"license": "MIT",
"dependencies": {
"@certusone/wormhole-sdk": "0.2.1",
"@improbable-eng/grpc-web-node-http-transport": "^0.14.1",
"@pythnetwork/pyth-sdk-js": "^1.1.0"
},
"devDependencies": {
"@openzeppelin/contracts": "^4.2.0",
"@typechain/ethers-v5": "^7.1.2",
"@types/long": "^4.0.1",
"@types/node": "^16.6.1",
"copy-dir": "^1.3.0",
"find": "^0.3.0",
"prettier": "^2.3.2",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.3.5"
},
"peerDependencies": {
"@solana/web3.js": "^1.24.0"
}
},
"../third_party/pyth/p2w-sdk/js": {
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -2208,7 +2233,7 @@
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
}, },
"node_modules/@pythnetwork/p2w-sdk-js": { "node_modules/@pythnetwork/p2w-sdk-js": {
"resolved": "../p2w-sdk/js", "resolved": "../third_party/pyth/p2w-sdk/js",
"link": true "link": true
}, },
"node_modules/@pythnetwork/pyth-sdk-js": { "node_modules/@pythnetwork/pyth-sdk-js": {
@ -10604,7 +10629,7 @@
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
}, },
"@pythnetwork/p2w-sdk-js": { "@pythnetwork/p2w-sdk-js": {
"version": "file:../p2w-sdk/js", "version": "file:../third_party/pyth/p2w-sdk/js",
"requires": { "requires": {
"@certusone/wormhole-sdk": "0.2.1", "@certusone/wormhole-sdk": "0.2.1",
"@improbable-eng/grpc-web-node-http-transport": "^0.14.1", "@improbable-eng/grpc-web-node-http-transport": "^0.14.1",

View File

@ -31,7 +31,7 @@
"dependencies": { "dependencies": {
"@certusone/wormhole-sdk": "^0.1.4", "@certusone/wormhole-sdk": "^0.1.4",
"@certusone/wormhole-spydk": "^0.0.1", "@certusone/wormhole-spydk": "^0.0.1",
"@pythnetwork/p2w-sdk-js": "file:../p2w-sdk/js", "@pythnetwork/p2w-sdk-js": "file:../third_party/pyth/p2w-sdk/js",
"@pythnetwork/pyth-sdk-js": "^1.1.0", "@pythnetwork/pyth-sdk-js": "^1.1.0",
"@types/cors": "^2.8.12", "@types/cors": "^2.8.12",
"@types/express": "^4.17.13", "@types/express": "^4.17.13",