Skip to content

Commit bef4073

Browse files
authored
[price-service/client] Crash by default on WsError (#934)
* [price-service/client] Crash by default on WsError * Update docker-compose files * Update package versions again
1 parent 4f41525 commit bef4073

File tree

10 files changed

+84
-47
lines changed

10 files changed

+84
-47
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

price_pusher/docker-compose.mainnet.sample.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
spy:
33
# Find latest Guardian images in https://github.com/wormhole-foundation/wormhole/pkgs/container/guardiand
4-
image: ghcr.io/wormhole-foundation/guardiand:v2.17.0
4+
image: ghcr.io/wormhole-foundation/guardiand:v2.19.0
55
command:
66
- "spy"
77
- "--nodeKey"
@@ -16,7 +16,7 @@ services:
1616
- "warn"
1717
price-service:
1818
# Find latest price service images https://gallery.ecr.aws/pyth-network/xc-server
19-
image: public.ecr.aws/pyth-network/xc-server:v3.0.3
19+
image: public.ecr.aws/pyth-network/xc-server:v3.0.8
2020
environment:
2121
SPY_SERVICE_HOST: "spy:7072"
2222
SPY_SERVICE_FILTERS: |
@@ -32,8 +32,8 @@ services:
3232
]
3333
REST_PORT: "4200"
3434
PROM_PORT: "8081"
35-
READINESS_SPY_SYNC_TIME_SECONDS: "20"
36-
READINESS_NUM_LOADED_SYMBOLS: "50"
35+
READINESS_SPY_SYNC_TIME_SECONDS: "5"
36+
READINESS_NUM_LOADED_SYMBOLS: "280"
3737
LOG_LEVEL: warning
3838
WORMHOLE_CLUSTER: mainnet
3939
healthcheck:
@@ -50,12 +50,20 @@ services:
5050
depends_on:
5151
- spy
5252
price-pusher:
53-
build:
54-
context: .
55-
# Uncomment this line (and comment out the above lines) to use a prebuilt image. Replace <version>
56-
# with the latest released image of the price pusher from this repo release page:
57-
# https://github.com/pyth-network/pyth-crosschain/releases
58-
# image: public.ecr.aws/pyth-network/xc-price-pusher:v<version>
53+
# Use this to build the price pusher from source. A dependency of the pusher docker
54+
# image is the pyth-crosschain monorepo lerna docker image. Build lerna image
55+
# using the following command from the repo root:
56+
# `docker buildx build -f tilt_devnet/docker_images/Dockerfile.lerna -t lerna .`
57+
#
58+
# Please note that the docker build from source only works in x86_64 platforms
59+
# and doesn't work on arm platforms (like Apple M1/M2).
60+
#
61+
# build:
62+
# context: .
63+
64+
# Replace <version> with the latest released image of the price pusher from here:
65+
# https://gallery.ecr.aws/pyth-network/xc-price-pusher
66+
image: public.ecr.aws/pyth-network/xc-price-pusher:v<version>
5967
restart: always
6068
command:
6169
- "--"

price_pusher/docker-compose.testnet.sample.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
spy:
33
# Find latest Guardian images in https://github.com/wormhole-foundation/wormhole/pkgs/container/guardiand
4-
image: ghcr.io/wormhole-foundation/guardiand:v2.17.0
4+
image: ghcr.io/wormhole-foundation/guardiand:v2.19.0
55
command:
66
- "spy"
77
- "--nodeKey"
@@ -16,7 +16,7 @@ services:
1616
- "warn"
1717
price-service:
1818
# Find latest price service images https://gallery.ecr.aws/pyth-network/xc-server
19-
image: public.ecr.aws/pyth-network/xc-server:v3.0.3
19+
image: public.ecr.aws/pyth-network/xc-server:v3.0.8
2020
environment:
2121
SPY_SERVICE_HOST: "spy:7072"
2222
SPY_SERVICE_FILTERS: |
@@ -32,8 +32,8 @@ services:
3232
]
3333
REST_PORT: "4200"
3434
PROM_PORT: "8081"
35-
READINESS_SPY_SYNC_TIME_SECONDS: "20"
36-
READINESS_NUM_LOADED_SYMBOLS: "50"
35+
READINESS_SPY_SYNC_TIME_SECONDS: "5"
36+
READINESS_NUM_LOADED_SYMBOLS: "280"
3737
LOG_LEVEL: warning
3838
WORMHOLE_CLUSTER: testnet
3939
healthcheck:
@@ -50,12 +50,20 @@ services:
5050
depends_on:
5151
- spy
5252
price-pusher:
53-
build:
54-
context: .
55-
# Uncomment this line (and comment out the above lines) to use a prebuilt image. Replace <version>
56-
# with the latest released image of the price pusher from this repo release page:
57-
# https://github.com/pyth-network/pyth-crosschain/releases
58-
# image: public.ecr.aws/pyth-network/xc-price-pusher:v<version>
53+
# Use this to build the price pusher from source. A dependency of the pusher docker
54+
# image is the pyth-crosschain monorepo lerna docker image. Build lerna image
55+
# using the following command from the repo root:
56+
# `docker buildx build -f tilt_devnet/docker_images/Dockerfile.lerna -t lerna .`
57+
#
58+
# Please note that the docker build from source only works in x86_64 platforms
59+
# and doesn't work on arm platforms (like Apple M1/M2).
60+
#
61+
# build:
62+
# context: .
63+
64+
# Replace <version> with the latest released image of the price pusher from here:
65+
# https://gallery.ecr.aws/pyth-network/xc-price-pusher
66+
image: public.ecr.aws/pyth-network/xc-price-pusher:v<version>
5967
restart: always
6068
command:
6169
- "--"

price_pusher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-pusher",
3-
"version": "5.4.3",
3+
"version": "5.4.4",
44
"description": "Pyth Price Pusher",
55
"homepage": "https://pyth.network",
66
"main": "lib/index.js",

price_service/client/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/price-service-client",
3-
"version": "1.6.0",
3+
"version": "1.6.1",
44
"description": "Pyth price service client",
55
"author": {
66
"name": "Pyth Data Association"

price_service/client/js/src/PriceServiceConnection.ts

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class PriceServiceConnection {
6262
private wsClient: undefined | ResilientWebSocket;
6363
private wsEndpoint: undefined | string;
6464

65-
private logger: undefined | Logger;
65+
private logger: Logger;
6666

6767
private priceFeedRequestConfig: PriceFeedRequestConfig;
6868

@@ -96,9 +96,30 @@ export class PriceServiceConnection {
9696

9797
this.priceFeedCallbacks = new Map();
9898

99-
this.logger = config?.logger;
99+
// Default logger is console for only warnings and errors.
100+
this.logger = config?.logger || {
101+
trace: () => {},
102+
debug: () => {},
103+
info: () => {},
104+
warn: console.warn,
105+
error: console.error,
106+
};
107+
100108
this.onWsError = (error: Error) => {
101-
this.logger?.error(error);
109+
this.logger.error(error);
110+
111+
// Exit the process if it is running in node.
112+
if (
113+
typeof process !== "undefined" &&
114+
typeof process.exit === "function"
115+
) {
116+
this.logger.error("Halting the process due to the websocket error");
117+
process.exit(1);
118+
} else {
119+
this.logger.error(
120+
"Cannot halt process. Please handle the websocket error."
121+
);
122+
}
102123
};
103124

104125
this.wsEndpoint = makeWebsocketUrl(endpoint);
@@ -333,28 +354,28 @@ export class PriceServiceConnection {
333354
binary: this.priceFeedRequestConfig.binary,
334355
};
335356

336-
this.logger?.info("Resubscribing to existing price feeds.");
357+
this.logger.info("Resubscribing to existing price feeds.");
337358
this.wsClient?.send(JSON.stringify(message));
338359
}
339360
};
340361

341362
this.wsClient.onMessage = (data: WebSocket.Data) => {
342-
this.logger?.info(`Received message ${data.toString()}`);
363+
this.logger.info(`Received message ${data.toString()}`);
343364

344365
let message: ServerMessage;
345366

346367
try {
347368
message = JSON.parse(data.toString()) as ServerMessage;
348369
} catch (e: any) {
349-
this.logger?.error(`Error parsing message ${data.toString()} as JSON.`);
350-
this.logger?.error(e);
370+
this.logger.error(`Error parsing message ${data.toString()} as JSON.`);
371+
this.logger.error(e);
351372
this.onWsError(e);
352373
return;
353374
}
354375

355376
if (message.type === "response") {
356377
if (message.status === "error") {
357-
this.logger?.error(
378+
this.logger.error(
358379
`Error response from the websocket server ${message.error}.`
359380
);
360381
this.onWsError(new Error(message.error));
@@ -364,10 +385,10 @@ export class PriceServiceConnection {
364385
try {
365386
priceFeed = PriceFeed.fromJson(message.price_feed);
366387
} catch (e: any) {
367-
this.logger?.error(
388+
this.logger.error(
368389
`Error parsing price feeds from message ${data.toString()}.`
369390
);
370-
this.logger?.error(e);
391+
this.logger.error(e);
371392
this.onWsError(e);
372393
return;
373394
}
@@ -378,7 +399,7 @@ export class PriceServiceConnection {
378399
}
379400
}
380401
} else {
381-
this.logger?.warn(
402+
this.logger.warn(
382403
`Ignoring unsupported server response ${data.toString()}.`
383404
);
384405
}

price_service/server/docker-compose.mainnet.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
spy:
33
# Find latest Guardian images in https://github.com/wormhole-foundation/wormhole/pkgs/container/guardiand
4-
image: ghcr.io/wormhole-foundation/guardiand:v2.17.0
4+
image: ghcr.io/wormhole-foundation/guardiand:v2.19.0
55
restart: on-failure
66
command:
77
- "spy"
@@ -17,7 +17,7 @@ services:
1717
- "warn"
1818
price-service:
1919
# Find latest price service images https://gallery.ecr.aws/pyth-network/xc-server
20-
image: public.ecr.aws/pyth-network/xc-server:v3.0.3
20+
image: public.ecr.aws/pyth-network/xc-server:v3.0.8
2121
restart: on-failure
2222
# Or alternatively use a locally built image
2323
# image: pyth_price_server
@@ -36,8 +36,8 @@ services:
3636
]
3737
REST_PORT: "4200"
3838
PROM_PORT: "8081"
39-
READINESS_SPY_SYNC_TIME_SECONDS: "20"
40-
READINESS_NUM_LOADED_SYMBOLS: "50"
39+
READINESS_SPY_SYNC_TIME_SECONDS: "5"
40+
READINESS_NUM_LOADED_SYMBOLS: "280"
4141
LOG_LEVEL: warning
4242
WORMHOLE_CLUSTER: mainnet
4343
DB_API_CLUSTER: pythnet

price_service/server/docker-compose.testnet.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
spy:
33
# Find latest Guardian images in https://github.com/wormhole-foundation/wormhole/pkgs/container/guardiand
4-
image: ghcr.io/wormhole-foundation/guardiand:v2.17.0
4+
image: ghcr.io/wormhole-foundation/guardiand:v2.19.0
55
restart: on-failure
66
command:
77
- "spy"
@@ -17,7 +17,7 @@ services:
1717
- "warn"
1818
price-service:
1919
# Find latest price service images https://gallery.ecr.aws/pyth-network/xc-server
20-
image: public.ecr.aws/pyth-network/xc-server:v3.0.3
20+
image: public.ecr.aws/pyth-network/xc-server:v3.0.8
2121
restart: on-failure
2222
# Or alternatively use a locally built image
2323
# image: pyth_price_server
@@ -36,8 +36,8 @@ services:
3636
]
3737
REST_PORT: "4200"
3838
PROM_PORT: "8081"
39-
READINESS_SPY_SYNC_TIME_SECONDS: "20"
40-
READINESS_NUM_LOADED_SYMBOLS: "50"
39+
READINESS_SPY_SYNC_TIME_SECONDS: "5"
40+
READINESS_NUM_LOADED_SYMBOLS: "280"
4141
LOG_LEVEL: warning
4242
WORMHOLE_CLUSTER: testnet
4343
DB_API_CLUSTER: devnet

target_chains/cosmwasm/sdk/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-terra-js",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Pyth Network Terra Utils in JS",
55
"homepage": "https://pyth.network",
66
"author": {

target_chains/ethereum/sdk/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-evm-js",
3-
"version": "1.20.0",
3+
"version": "1.20.1",
44
"description": "Pyth Network EVM Utils in JS",
55
"homepage": "https://pyth.network",
66
"author": {

0 commit comments

Comments
 (0)