[wormhole-attester] Move p2w-sdk inside wormhole_attester directory (#534)
* Move p2w-sdk to wormhole_attester * Update references to the sdk
This commit is contained in:
parent
3af759b790
commit
70fd0a6c15
|
@ -4,13 +4,13 @@ on:
|
|||
pull_request:
|
||||
paths:
|
||||
- target_chains/cosmwasm/**
|
||||
- third_party/pyth/p2w-sdk/rust/**
|
||||
- wormhole_attester/sdk/rust/**
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- target_chains/cosmwasm/**
|
||||
- third_party/pyth/p2w-sdk/rust/**
|
||||
- wormhole_attester/sdk/rust/**
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
|
|
@ -58,16 +58,3 @@ repos:
|
|||
entry: cargo +nightly clippy --manifest-path ./target_chains/cosmwasm/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
|
||||
pass_filenames: false
|
||||
files: target_chains/cosmwasm
|
||||
# Hooks for p2w-sdk/rust
|
||||
- id: cargo-fmt-p2w-sdk
|
||||
name: Cargo format for p2w-sdk
|
||||
language: "rust"
|
||||
entry: cargo +nightly fmt --manifest-path ./third_party/pyth/p2w-sdk/rust/Cargo.toml --all -- --config-path rustfmt.toml
|
||||
pass_filenames: false
|
||||
files: third_party/pyth/p2w-sdk/rust
|
||||
- id: cargo-clippy-p2w-sdk
|
||||
name: Cargo clippy for p2w-sdk
|
||||
language: "rust"
|
||||
entry: cargo +nightly clippy --manifest-path ./third_party/pyth/p2w-sdk/rust/Cargo.toml --tests --fix --allow-dirty --allow-staged -- -D warnings
|
||||
pass_filenames: false
|
||||
files: third_party/pyth/p2w-sdk/rust
|
||||
|
|
|
@ -4,10 +4,10 @@ ARG BASE_PATH=/usr/src/pyth2wormhole
|
|||
RUN addgroup -S pyth -g 10001 && adduser -S pyth -G pyth -u 10001
|
||||
USER pyth
|
||||
|
||||
# Adds p2w-sdk/js dependency
|
||||
ARG P2W_SDK_REL_PATH=third_party/pyth/p2w-sdk/js
|
||||
WORKDIR ${BASE_PATH}/${P2W_SDK_REL_PATH}
|
||||
COPY --chown=pyth:pyth ${P2W_SDK_REL_PATH} .
|
||||
# Adds wormhole_attester/sdk/js dependency
|
||||
ARG ATTESTER_SDK_REL_PATH=wormhole_attester/sdk/js
|
||||
WORKDIR ${BASE_PATH}/${ATTESTER_SDK_REL_PATH}
|
||||
COPY --chown=pyth:pyth ${ATTESTER_SDK_REL_PATH} .
|
||||
RUN npm ci && npm run build && npm cache clean --force
|
||||
|
||||
ARG PRICE_SERVICE_REL_PATH=price_service/server
|
||||
|
|
|
@ -46,14 +46,14 @@ price service you should:
|
|||
|
||||
## Build an image
|
||||
|
||||
First, build the wasm files from [the repo root](../../../) like below. This command generates the wasm files necessary
|
||||
for parsing Pyth messages coming from Wormhole and stores them on [this](../p2w-sdk/js/src/solana/p2w-core) directory.
|
||||
First, build the wasm files from [the repo root](../../) like below. This command generates the wasm files necessary
|
||||
for parsing Pyth messages coming from Wormhole and stores them on [this](../../wormhole_attester/sdk/js) directory.
|
||||
|
||||
```
|
||||
docker buildx build -f Dockerfile.wasm -o type=local,dest=. .
|
||||
docker buildx build -f tilt_devnet/docker_images/Dockerfile.wasm -o type=local,dest=. .
|
||||
```
|
||||
|
||||
Then, build the image from [the repo root](../../../) like below. It will create a
|
||||
Then, build the image from [the repo root](../../) like below. It will create a
|
||||
local image named `pyth_price_server`.
|
||||
|
||||
```
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.9.9",
|
||||
"@certusone/wormhole-spydk": "^0.0.1",
|
||||
"@pythnetwork/p2w-sdk-js": "file:../../third_party/pyth/p2w-sdk/js",
|
||||
"@pythnetwork/pyth-sdk-js": "^1.1.0",
|
||||
"@pythnetwork/wormhole-attester-sdk": "file:../../wormhole_attester/sdk/js",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/morgan": "^1.9.3",
|
||||
|
@ -53,34 +53,7 @@
|
|||
"utf-8-validate": "^5.0.9"
|
||||
}
|
||||
},
|
||||
"../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": {
|
||||
"name": "@pythnetwork/p2w-sdk-js",
|
||||
"../../wormhole_attester/sdk/js": {
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -2826,15 +2799,15 @@
|
|||
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
|
||||
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
|
||||
},
|
||||
"node_modules/@pythnetwork/p2w-sdk-js": {
|
||||
"resolved": "../../third_party/pyth/p2w-sdk/js",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@pythnetwork/pyth-sdk-js": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pythnetwork/pyth-sdk-js/-/pyth-sdk-js-1.1.0.tgz",
|
||||
"integrity": "sha512-IfZI/D+7HiA01TfzuA7Fh0SMhsE+hZWoI1pt48G+XMbNkXhiZG4lSQJRsnquSEY06YAFcAX2D66cFtV6BHy8IA=="
|
||||
},
|
||||
"node_modules/@pythnetwork/wormhole-attester-sdk": {
|
||||
"resolved": "../../wormhole_attester/sdk/js",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@scure/base": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz",
|
||||
|
@ -12340,8 +12313,13 @@
|
|||
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
|
||||
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
|
||||
},
|
||||
"@pythnetwork/p2w-sdk-js": {
|
||||
"version": "file:../../third_party/pyth/p2w-sdk/js",
|
||||
"@pythnetwork/pyth-sdk-js": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pythnetwork/pyth-sdk-js/-/pyth-sdk-js-1.1.0.tgz",
|
||||
"integrity": "sha512-IfZI/D+7HiA01TfzuA7Fh0SMhsE+hZWoI1pt48G+XMbNkXhiZG4lSQJRsnquSEY06YAFcAX2D66cFtV6BHy8IA=="
|
||||
},
|
||||
"@pythnetwork/wormhole-attester-sdk": {
|
||||
"version": "file:../../wormhole_attester/sdk/js",
|
||||
"requires": {
|
||||
"@certusone/wormhole-sdk": "0.2.1",
|
||||
"@improbable-eng/grpc-web-node-http-transport": "^0.14.1",
|
||||
|
@ -12358,11 +12336,6 @@
|
|||
"typescript": "^4.3.5"
|
||||
}
|
||||
},
|
||||
"@pythnetwork/pyth-sdk-js": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pythnetwork/pyth-sdk-js/-/pyth-sdk-js-1.1.0.tgz",
|
||||
"integrity": "sha512-IfZI/D+7HiA01TfzuA7Fh0SMhsE+hZWoI1pt48G+XMbNkXhiZG4lSQJRsnquSEY06YAFcAX2D66cFtV6BHy8IA=="
|
||||
},
|
||||
"@scure/base": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz",
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.9.9",
|
||||
"@certusone/wormhole-spydk": "^0.0.1",
|
||||
"@pythnetwork/p2w-sdk-js": "file:../../third_party/pyth/p2w-sdk/js",
|
||||
"@pythnetwork/pyth-sdk-js": "^1.1.0",
|
||||
"@pythnetwork/wormhole-attester-sdk": "file:../../wormhole_attester/sdk/js",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/morgan": "^1.9.3",
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
getBatchSummary,
|
||||
parseBatchPriceAttestation,
|
||||
priceAttestationToPriceFeed,
|
||||
} from "@pythnetwork/p2w-sdk-js";
|
||||
} from "@pythnetwork/wormhole-attester-sdk";
|
||||
import { HexString, PriceFeed } from "@pythnetwork/pyth-sdk-js";
|
||||
import LRUCache from "lru-cache";
|
||||
import { DurationInSec, sleep, TimestampInSec } from "./helpers";
|
||||
|
|
|
@ -13,7 +13,10 @@ export function initLogger(config?: { logLevel?: string }) {
|
|||
|
||||
let transport: any;
|
||||
// tslint:disable:no-console
|
||||
console.log("p2w_api is logging to the console at level [%s]", logLevel);
|
||||
console.log(
|
||||
"price_service is logging to the console at level [%s]",
|
||||
logLevel
|
||||
);
|
||||
|
||||
transport = new winston.transports.Console({
|
||||
level: logLevel,
|
||||
|
|
|
@ -1155,15 +1155,6 @@ version = "0.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "p2w-sdk"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"pyth-sdk 0.5.0",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-wasm"
|
||||
version = "0.42.2"
|
||||
|
@ -1272,8 +1263,8 @@ dependencies = [
|
|||
"hex",
|
||||
"k256 0.9.6",
|
||||
"lazy_static",
|
||||
"p2w-sdk",
|
||||
"pyth-sdk 0.7.0",
|
||||
"pyth-wormhole-attester-sdk",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
|
@ -1310,6 +1301,15 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyth-wormhole-attester-sdk"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"pyth-sdk 0.5.0",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.21"
|
||||
|
|
|
@ -28,7 +28,7 @@ generic-array = { version = "0.14.4" }
|
|||
hex = "0.4.2"
|
||||
lazy_static = "1.4.0"
|
||||
bigint = "4"
|
||||
p2w-sdk = { path = "../../../../third_party/pyth/p2w-sdk/rust" }
|
||||
pyth-wormhole-attester-sdk = { path = "../../../../wormhole_attester/sdk/rust" }
|
||||
pyth-sdk = "0.7.0"
|
||||
byteorder = "1.4.3"
|
||||
cosmwasm-schema = "1.1.9"
|
||||
|
|
|
@ -54,7 +54,7 @@ use {
|
|||
WasmMsg,
|
||||
WasmQuery,
|
||||
},
|
||||
p2w_sdk::{
|
||||
pyth_wormhole_attester_sdk::{
|
||||
BatchPriceAttestation,
|
||||
PriceAttestation,
|
||||
PriceStatus,
|
||||
|
@ -513,7 +513,7 @@ mod test {
|
|||
SystemResult,
|
||||
Uint128,
|
||||
},
|
||||
p2w_sdk::PriceAttestation,
|
||||
pyth_wormhole_attester_sdk::PriceAttestation,
|
||||
std::time::Duration,
|
||||
};
|
||||
|
||||
|
@ -707,7 +707,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_create_price_feed_from_price_attestation_status_trading() {
|
||||
let price_attestation = PriceAttestation {
|
||||
price_id: p2w_sdk::Identifier::new([0u8; 32]),
|
||||
price_id: pyth_wormhole_attester_sdk::Identifier::new([0u8; 32]),
|
||||
price: 100,
|
||||
conf: 100,
|
||||
expo: 100,
|
||||
|
@ -756,7 +756,7 @@ mod test {
|
|||
|
||||
fn test_create_price_feed_from_price_attestation_not_trading(status: PriceStatus) {
|
||||
let price_attestation = PriceAttestation {
|
||||
price_id: p2w_sdk::Identifier::new([0u8; 32]),
|
||||
price_id: pyth_wormhole_attester_sdk::Identifier::new([0u8; 32]),
|
||||
price: 100,
|
||||
conf: 100,
|
||||
expo: 100,
|
||||
|
@ -797,7 +797,7 @@ mod test {
|
|||
let (mut deps, env) = setup_test();
|
||||
|
||||
let price_attestation = PriceAttestation {
|
||||
price_id: p2w_sdk::Identifier::new([0u8; 32]),
|
||||
price_id: pyth_wormhole_attester_sdk::Identifier::new([0u8; 32]),
|
||||
price: 100,
|
||||
conf: 100,
|
||||
expo: 100,
|
||||
|
@ -850,7 +850,7 @@ mod test {
|
|||
let (mut deps, env) = setup_test();
|
||||
|
||||
let price_attestation = PriceAttestation {
|
||||
price_id: p2w_sdk::Identifier::new([0u8; 32]),
|
||||
price_id: pyth_wormhole_attester_sdk::Identifier::new([0u8; 32]),
|
||||
price: 100,
|
||||
conf: 100,
|
||||
expo: 100,
|
||||
|
|
|
@ -6,7 +6,7 @@ use {
|
|||
WriteBytesExt,
|
||||
},
|
||||
cosmwasm_std::Binary,
|
||||
p2w_sdk::ErrBox,
|
||||
pyth_wormhole_attester_sdk::ErrBox,
|
||||
schemars::JsonSchema,
|
||||
serde::{
|
||||
Deserialize,
|
||||
|
|
|
@ -73,10 +73,10 @@ contract("Pyth", function () {
|
|||
);
|
||||
});
|
||||
|
||||
// NOTE(2022-05-02): Raw hex payload obtained from format serialization unit tests in `p2w-sdk/rust`
|
||||
// NOTE(2022-05-02): Raw hex payload obtained from format serialization unit tests in `wormhole_attester/sdk/rust`
|
||||
// Latest known addition: wire format v3
|
||||
//
|
||||
// Tests rely on a p2w-sdk mock price/prod ID generation rule:
|
||||
// Tests rely on a wormhole_attester/sdk/rust mock price/prod ID generation rule:
|
||||
// nthProdByte(n) = n % 256, starting with n=1
|
||||
// nthPriceByte(n) = 255 - (n % 256), starting with n=1
|
||||
//
|
||||
|
|
|
@ -1839,15 +1839,6 @@ dependencies = [
|
|||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "p2w-sdk"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"hex 0.4.3",
|
||||
"pyth-sdk 0.5.0",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-scale-codec"
|
||||
version = "2.3.1"
|
||||
|
@ -2039,8 +2030,8 @@ dependencies = [
|
|||
"nom",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"p2w-sdk",
|
||||
"pyth-sdk 0.7.0",
|
||||
"pyth-wormhole-attester-sdk",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_wormhole",
|
||||
|
@ -2077,6 +2068,15 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyth-wormhole-attester-sdk"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"hex 0.4.3",
|
||||
"pyth-sdk 0.5.0",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
[package]
|
||||
name = "pyth-near"
|
||||
version = "0.1.0"
|
||||
authors = ["Pyth Data Association"]
|
||||
edition = "2021"
|
||||
description = "A Pyth Receiver for Near"
|
||||
name = "pyth-near"
|
||||
version = "0.1.0"
|
||||
authors = ["Pyth Data Association"]
|
||||
edition = "2021"
|
||||
description = "A Pyth Receiver for Near"
|
||||
|
||||
[lib]
|
||||
name = "pyth"
|
||||
crate-type = ["cdylib", "lib"]
|
||||
name = "pyth"
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
||||
[dependencies]
|
||||
byteorder = { version = "1.4.3" }
|
||||
hex = { version = "0.4.3" }
|
||||
near-sdk = { version = "4.1.1" }
|
||||
nom = { version = "7.1.2" }
|
||||
num-traits = { version = "0.2.15" }
|
||||
num-derive = { version = "0.3.3" }
|
||||
p2w-sdk = { path = "../../../third_party/pyth/p2w-sdk/rust" }
|
||||
pyth-sdk = { version = "0.7.0" }
|
||||
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
strum = { version = "0.24.1", features = ["derive"] }
|
||||
thiserror = { version = "1.0.38" }
|
||||
wormhole-core = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
byteorder = { version = "1.4.3" }
|
||||
hex = { version = "0.4.3" }
|
||||
near-sdk = { version = "4.1.1" }
|
||||
nom = { version = "7.1.2" }
|
||||
num-traits = { version = "0.2.15" }
|
||||
num-derive = { version = "0.3.3" }
|
||||
pyth-wormhole-attester-sdk = { path = "../../../wormhole_attester/sdk/rust" }
|
||||
pyth-sdk = { version = "0.7.0" }
|
||||
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
strum = { version = "0.24.1", features = ["derive"] }
|
||||
thiserror = { version = "1.0.38" }
|
||||
wormhole-core = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
|
||||
[patch.crates-io]
|
||||
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
|
||||
[dev-dependencies]
|
||||
lazy_static = { version = "1.4.0" }
|
||||
serde_json = { version = "1.0.91" }
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
tokio = { version = "1.23.0", features = ["full"] }
|
||||
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
workspaces = { version = "0.7.0" }
|
||||
wormhole-core = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
lazy_static = { version = "1.4.0" }
|
||||
serde_json = { version = "1.0.91" }
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
tokio = { version = "1.23.0", features = ["full"] }
|
||||
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
workspaces = { version = "0.7.0" }
|
||||
wormhole-core = { git = "https://github.com/wormhole-foundation/wormhole" }
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
opt-level = 3
|
||||
lto = "fat"
|
||||
debug = false
|
||||
panic = "abort"
|
||||
overflow-checks = true
|
||||
codegen-units = 1
|
||||
opt-level = 3
|
||||
lto = "fat"
|
||||
debug = false
|
||||
panic = "abort"
|
||||
overflow-checks = true
|
||||
|
|
|
@ -27,7 +27,7 @@ use {
|
|||
Promise,
|
||||
StorageUsage,
|
||||
},
|
||||
p2w_sdk::BatchPriceAttestation,
|
||||
pyth_wormhole_attester_sdk::BatchPriceAttestation,
|
||||
state::{
|
||||
Price,
|
||||
PriceFeed,
|
||||
|
|
|
@ -10,7 +10,7 @@ use {
|
|||
Serialize,
|
||||
},
|
||||
},
|
||||
p2w_sdk::PriceAttestation,
|
||||
pyth_wormhole_attester_sdk::PriceAttestation,
|
||||
wormhole::Chain as WormholeChain,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
near_sdk::json_types::U128,
|
||||
p2w_sdk::{
|
||||
pyth_wormhole_attester_sdk::{
|
||||
BatchPriceAttestation,
|
||||
Identifier,
|
||||
PriceAttestation,
|
||||
|
|
|
@ -5,7 +5,6 @@ RUN apt-get update && apt-get install -yq python3 libudev-dev ncat
|
|||
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
|
||||
|
||||
ADD governance/remote_executor /usr/src/governance/remote_executor
|
||||
ADD third_party/pyth/p2w-sdk/rust /usr/src/third_party/pyth/p2w-sdk/rust
|
||||
ADD wormhole_attester /usr/src/wormhole_attester
|
||||
|
||||
WORKDIR /usr/src/wormhole_attester
|
||||
|
|
|
@ -18,8 +18,8 @@ RUN apk del build-base # No longer needed after EVM build
|
|||
|
||||
USER pyth
|
||||
|
||||
# Adds p2w-sdk/js dependency
|
||||
ARG P2W_SDK_REL_PATH=third_party/pyth/p2w-sdk/js
|
||||
# Adds wormhole_attester/sdk/js dependency
|
||||
ARG P2W_SDK_REL_PATH=wormhole_attester/sdk/js
|
||||
|
||||
WORKDIR ${BASE_PATH}/${P2W_SDK_REL_PATH}
|
||||
ADD --chown=pyth:pyth ${P2W_SDK_REL_PATH} .
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.1.4",
|
||||
"@certusone/wormhole-spydk": "^0.0.1",
|
||||
"@pythnetwork/p2w-sdk-js": "file:../p2w-sdk/js",
|
||||
"@pythnetwork/wormhole-attester-sdk": "file:../../../wormhole_attester/sdk/js",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
"@solana/web3.js": "^1.24.0",
|
||||
"@terra-money/terra.js": "^3.1.3",
|
||||
|
@ -43,8 +43,8 @@
|
|||
"typescript": "^4.3.5"
|
||||
}
|
||||
},
|
||||
"../p2w-sdk/js": {
|
||||
"name": "@pythnetwork/p2w-sdk-js",
|
||||
"../../../wormhole_attester/sdk/js": {
|
||||
"name": "@pythnetwork/wormhole-attester-sdk",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@ -2056,8 +2056,8 @@
|
|||
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
|
||||
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
|
||||
},
|
||||
"node_modules/@pythnetwork/p2w-sdk-js": {
|
||||
"resolved": "../p2w-sdk/js",
|
||||
"node_modules/@pythnetwork/wormhole-attester-sdk": {
|
||||
"resolved": "../../../wormhole_attester/sdk/js",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@sinonjs/commons": {
|
||||
|
@ -9299,8 +9299,8 @@
|
|||
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
|
||||
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
|
||||
},
|
||||
"@pythnetwork/p2w-sdk-js": {
|
||||
"version": "file:../p2w-sdk/js",
|
||||
"@pythnetwork/wormhole-attester-sdk": {
|
||||
"version": "file:../../../wormhole_attester/sdk/js",
|
||||
"requires": {
|
||||
"@certusone/wormhole-sdk": "0.2.1",
|
||||
"@improbable-eng/grpc-web-node-http-transport": "^0.14.1",
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
"typescript": "^4.3.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pythnetwork/p2w-sdk-js": "file:../p2w-sdk/js",
|
||||
"@certusone/wormhole-sdk": "^0.1.4",
|
||||
"@certusone/wormhole-spydk": "^0.0.1",
|
||||
"@pythnetwork/wormhole-attester-sdk": "file:../../../wormhole_attester/sdk/js",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
"@solana/web3.js": "^1.24.0",
|
||||
"@terra-money/terra.js": "^3.1.3",
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
import {
|
||||
parseBatchPriceAttestation,
|
||||
getBatchSummary,
|
||||
} from "@pythnetwork/p2w-sdk-js";
|
||||
} from "@pythnetwork/wormhole-attester-sdk";
|
||||
|
||||
import { importCoreWasm } from "@certusone/wormhole-sdk/lib/cjs/solana/wasm";
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import { hexToUint8Array } from "@certusone/wormhole-sdk";
|
|||
import { importCoreWasm } from "@certusone/wormhole-sdk/lib/cjs/solana/wasm";
|
||||
|
||||
import { PythUpgradable__factory, PythUpgradable } from "../evm/bindings/";
|
||||
import { parseBatchPriceAttestation } from "@pythnetwork/p2w-sdk-js";
|
||||
import { parseBatchPriceAttestation } from "@pythnetwork/wormhole-attester-sdk";
|
||||
|
||||
let WH_WASM: any = null;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
BatchPriceAttestation,
|
||||
getBatchAttestationHashKey,
|
||||
getBatchSummary,
|
||||
} from "@pythnetwork/p2w-sdk-js";
|
||||
} from "@pythnetwork/wormhole-attester-sdk";
|
||||
|
||||
const mutex = new Mutex();
|
||||
let condition = new CondVar();
|
||||
|
|
|
@ -20,7 +20,7 @@ FROM cosmwasm/workspace-optimizer:0.12.11@sha256:b6b0b1d5ed76dafd0ec0d3812a1e7a2
|
|||
COPY target_chains/cosmwasm/Cargo.lock /code/
|
||||
COPY target_chains/cosmwasm/Cargo.toml /code/
|
||||
COPY target_chains/cosmwasm/contracts /code/contracts
|
||||
COPY third_party/pyth/p2w-sdk/rust /third_party/pyth/p2w-sdk/rust
|
||||
COPY wormhole_attester/sdk/rust /wormhole_attester/sdk/rust
|
||||
RUN --mount=type=cache,target=/code/target,id=cosmwasm_pyth_target --mount=type=cache,target=/usr/local/cargo/registry optimize_workspace.sh
|
||||
|
||||
# Contract deployment stage
|
||||
|
|
|
@ -48,7 +48,6 @@ WORKDIR /usr/src/
|
|||
|
||||
ADD wormhole_attester wormhole_attester
|
||||
ADD governance/remote_executor governance/remote_executor
|
||||
ADD third_party/pyth/p2w-sdk/rust third_party/pyth/p2w-sdk/rust
|
||||
RUN mkdir -p /opt/solana/deps
|
||||
|
||||
ENV EMITTER_ADDRESS="11111111111111111111111111111115"
|
||||
|
|
|
@ -17,7 +17,7 @@ ENV EMITTER_ADDRESS="11111111111111111111111111111115"
|
|||
ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"
|
||||
|
||||
COPY wormhole_attester wormhole_attester
|
||||
COPY third_party third_party
|
||||
COPY governance/remote_executor governance/remote_executor
|
||||
|
||||
# wasm-bindgen 0.2.74 generates JavaScript bindings for SystemInstruction exported from solana-program 1.9.4.
|
||||
# The generated JavaScript references a non-existent function (wasm.__wbg_systeminstruction_free) that leads
|
||||
|
@ -28,12 +28,12 @@ ARG SED_REMOVE_INVALID_REFERENCE="/^\s*wasm.__wbg_systeminstruction_free(ptr);$/
|
|||
# TODO: it appears that wasm-pack ignores our lockfiles even with --locked
|
||||
|
||||
# Run unit tests
|
||||
WORKDIR /usr/src/third_party/pyth/p2w-sdk/rust
|
||||
WORKDIR /usr/src/wormhole_attester/sdk/rust
|
||||
RUN cargo test --locked && \
|
||||
/usr/local/cargo/bin/wasm-pack build --target bundler -d bundler -- --features wasm --locked && \
|
||||
/usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm --locked
|
||||
|
||||
FROM scratch AS export
|
||||
|
||||
COPY --from=build /usr/src/third_party/pyth/p2w-sdk/rust/bundler third_party/pyth/p2w-sdk/js/src/solana/p2w-core/bundler
|
||||
COPY --from=build /usr/src/third_party/pyth/p2w-sdk/rust/nodejs third_party/pyth/p2w-sdk/js/src/solana/p2w-core/nodejs
|
||||
COPY --from=build /usr/src/wormhole_attester/sdk/rust/bundler wormhole_attester/sdk/js/src/wasm/bundler
|
||||
COPY --from=build /usr/src/wormhole_attester/sdk/rust/nodejs wormhole_attester/sdk/js/src/wasm/nodejs
|
||||
|
|
|
@ -2336,18 +2336,6 @@ dependencies = [
|
|||
"syn 1.0.94",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "p2w-sdk"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"pyth-sdk 0.5.0",
|
||||
"pyth-sdk-solana 0.5.0",
|
||||
"serde",
|
||||
"solana-program",
|
||||
"solitaire",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.11.2"
|
||||
|
@ -2697,9 +2685,9 @@ name = "pyth-wormhole-attester"
|
|||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"p2w-sdk",
|
||||
"pyth-client",
|
||||
"pyth-sdk-solana 0.5.0",
|
||||
"pyth-wormhole-attester-sdk",
|
||||
"rocksalt",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
|
@ -2721,10 +2709,10 @@ dependencies = [
|
|||
"http",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"p2w-sdk",
|
||||
"prometheus",
|
||||
"pyth-sdk-solana 0.6.1",
|
||||
"pyth-wormhole-attester",
|
||||
"pyth-wormhole-attester-sdk",
|
||||
"serde",
|
||||
"serde_yaml",
|
||||
"sha3 0.10.6",
|
||||
|
@ -2753,6 +2741,19 @@ dependencies = [
|
|||
"solana-sdk",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyth-wormhole-attester-sdk"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"hex",
|
||||
"pyth-sdk 0.5.0",
|
||||
"pyth-sdk-solana 0.5.0",
|
||||
"serde",
|
||||
"solana-program",
|
||||
"solitaire",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "qstring"
|
||||
version = "0.7.2"
|
||||
|
@ -5176,6 +5177,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[workspace]
|
||||
members = ["client", "program", "governance"]
|
||||
members = ["client", "program", "governance", "sdk/rust"]
|
||||
|
|
|
@ -23,7 +23,7 @@ env_logger = "0.8.4"
|
|||
log = "0.4.14"
|
||||
wormhole-bridge-solana = {git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9"}
|
||||
pyth-wormhole-attester = {path = "../program"}
|
||||
p2w-sdk = { path = "../../third_party/pyth/p2w-sdk/rust", features=["solana"] }
|
||||
pyth-wormhole-attester-sdk = { path = "../sdk/rust", features=["solana"] }
|
||||
pyth-sdk-solana = "0.6.1"
|
||||
serde = "1"
|
||||
serde_yaml = "0.8"
|
||||
|
@ -32,7 +32,6 @@ solana-client = "=1.10.31"
|
|||
solana-program = "=1.10.31"
|
||||
solana-sdk = "=1.10.31"
|
||||
solana-transaction-status = "=1.10.31"
|
||||
# solitaire-client = {path = "../../solitaire/client"}
|
||||
solitaire = {git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.8.9"}
|
||||
tokio = {version = "1", features = ["sync", "rt-multi-thread", "time"]}
|
||||
futures = "0.3.21"
|
||||
|
|
|
@ -42,7 +42,6 @@ use {
|
|||
trace,
|
||||
warn,
|
||||
},
|
||||
p2w_sdk::P2WEmitter,
|
||||
pyth_sdk_solana::state::{
|
||||
load_mapping_account,
|
||||
load_price_account,
|
||||
|
@ -60,6 +59,7 @@ use {
|
|||
},
|
||||
AttestData,
|
||||
},
|
||||
pyth_wormhole_attester_sdk::P2WEmitter,
|
||||
solana_client::nonblocking::rpc_client::RpcClient,
|
||||
solana_program::{
|
||||
hash::Hash,
|
||||
|
|
|
@ -19,7 +19,6 @@ use {
|
|||
warn,
|
||||
LevelFilter,
|
||||
},
|
||||
p2w_sdk::P2WEmitter,
|
||||
prometheus::{
|
||||
register_histogram,
|
||||
register_int_counter,
|
||||
|
@ -51,6 +50,7 @@ use {
|
|||
RLMutex,
|
||||
HEALTHCHECK_STATE,
|
||||
},
|
||||
pyth_wormhole_attester_sdk::P2WEmitter,
|
||||
sha3::{
|
||||
Digest,
|
||||
Sha3_256,
|
||||
|
|
|
@ -21,7 +21,7 @@ rocksalt = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.
|
|||
solana-program = "=1.10.31"
|
||||
borsh = "=0.9.3"
|
||||
pyth-client = "0.2.2"
|
||||
p2w-sdk = { path = "../../third_party/pyth/p2w-sdk/rust", features = ["solana"] }
|
||||
pyth-wormhole-attester-sdk = { path = "../sdk/rust", features = ["solana"] }
|
||||
serde = { version = "1", optional = true}
|
||||
serde_derive = { version = "1", optional = true}
|
||||
serde_json = { version = "1", optional = true}
|
||||
|
|
|
@ -18,13 +18,13 @@ use {
|
|||
accounts::BridgeData,
|
||||
types::ConsistencyLevel,
|
||||
},
|
||||
p2w_sdk::{
|
||||
pyth_sdk_solana::state::PriceStatus,
|
||||
pyth_wormhole_attester_sdk::{
|
||||
BatchPriceAttestation,
|
||||
Identifier,
|
||||
P2WEmitter,
|
||||
PriceAttestation,
|
||||
},
|
||||
pyth_sdk_solana::state::PriceStatus,
|
||||
solana_program::{
|
||||
clock::Clock,
|
||||
program::{
|
||||
|
|
|
@ -14,10 +14,10 @@ RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
|
|||
npm ci
|
||||
COPY sdk/js .
|
||||
|
||||
# Build p2w-sdk in dir preserving directory structure
|
||||
WORKDIR /usr/src/third_party/pyth/p2w-sdk/js/
|
||||
COPY third_party/pyth/p2w-sdk/js/package.json third_party/pyth/p2w-sdk/js/package-lock.json ./
|
||||
# Build wormhole sdk attester in dir preserving directory structure
|
||||
WORKDIR /usr/src/wormhole_attester/sdk/js/
|
||||
COPY wormhole_attester/sdk/js/package.json wormhole_attester/sdk/js/package-lock.json ./
|
||||
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
|
||||
npm ci
|
||||
COPY third_party/pyth/p2w-sdk .
|
||||
COPY wormhole_attester/sdk .
|
||||
RUN npm run build-test
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "@pythnetwork/p2w-sdk-js",
|
||||
"name": "@pythnetwork/wormhole-attester-sdk",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pythnetwork/p2w-sdk-js",
|
||||
"name": "@pythnetwork/wormhole-attester-sdk",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "@pythnetwork/p2w-sdk-js",
|
||||
"name": "@pythnetwork/wormhole-attester-sdk",
|
||||
"version": "1.0.0",
|
||||
"description": "TypeScript library for interacting with Pyth2Wormhole",
|
||||
"types": "lib/index.d.ts",
|
|
@ -8,9 +8,9 @@ let _P2W_WASM: any;
|
|||
async function importWasm() {
|
||||
if (!_P2W_WASM) {
|
||||
if (typeof window === "undefined") {
|
||||
_P2W_WASM = await import("./solana/p2w-core/nodejs/p2w_sdk");
|
||||
_P2W_WASM = await import("./wasm/nodejs/pyth_wormhole_attester_sdk");
|
||||
} else {
|
||||
_P2W_WASM = await import("./solana/p2w-core/bundler/p2w_sdk");
|
||||
_P2W_WASM = await import("./wasm/bundler/pyth_wormhole_attester_sdk");
|
||||
}
|
||||
}
|
||||
return _P2W_WASM;
|
|
@ -635,7 +635,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "p2w-sdk"
|
||||
name = "pyth-wormhole-attester-sdk"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"hex",
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "p2w-sdk"
|
||||
name = "pyth-wormhole-attester-sdk"
|
||||
version = "0.1.1"
|
||||
authors = ["Wormhole Contributors <contact@certus.one>"]
|
||||
edition = "2018"
|
Loading…
Reference in New Issue