pyth-network / pyth-client Goto Github PK
View Code? Open in Web Editor NEWClient API for on-chain pyth programs
Home Page: https://pyth.network
License: Apache License 2.0
Client API for on-chain pyth programs
Home Page: https://pyth.network
License: Apache License 2.0
In file included from /home/ubuntu/solana-test/pyth-client/pc/manager.cpp:1:
In file included from /home/ubuntu/solana-test/pyth-client/pc/manager.hpp:5:
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:136:10: error: 'pc::init_mapping::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::create_account * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::create_account *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:137:10: error: 'pc::init_mapping::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::init_mapping * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::init_mapping *')
void on_response( rpc::program_subscribe * ) override;
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:138:10: error: 'pc::init_mapping::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::signature_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::signature_subscribe *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:195:10: error: 'pc::add_mapping::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::create_account * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::create_account *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:196:10: error: 'pc::add_mapping::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::add_mapping * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::add_mapping *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:197:10: error: 'pc::add_mapping::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::signature_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::signature_subscribe *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:228:10: error: 'pc::add_product::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::create_account * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::create_account *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:229:10: error: 'pc::add_product::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::signature_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::signature_subscribe *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:230:10: error: 'pc::add_product::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::add_product * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::add_product *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:263:10: error: 'pc::upd_product::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::signature_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::signature_subscribe *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:264:10: error: 'pc::upd_product::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::upd_product * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::upd_product *')
void on_response( rpc::program_subscribe * ) override;
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:300:10: error: 'pc::add_price::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::create_account * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::create_account *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:301:10: error: 'pc::add_price::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::signature_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::signature_subscribe *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:302:10: error: 'pc::add_price::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::add_price * ) override;
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::add_price *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:336:10: error: 'pc::init_price::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::signature_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::signature_subscribe *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:337:10: error: 'pc::init_price::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::init_price * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::init_price *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:367:10: error: 'pc::add_publisher::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::add_publisher * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::add_publisher *')
void on_response( rpc::program_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:368:10: error: 'pc::add_publisher::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::signature_subscribe * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::signature_subscribe *')
void on_response( rpc::program_subscribe * ) override;
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:399:10: error: 'pc::del_publisher::on_response' hides overloaded virtual function [-Werror,-Woverloaded-virtual]
void on_response( rpc::del_publisher * ) override;
^
/home/ubuntu/solana-test/pyth-client/pc/request.hpp:102:10: note: hidden overloaded virtual function 'pc::request::on_response' declared here: type mismatch at 1st parameter ('rpc::program_subscribe *' vs 'rpc::del_publisher *')
void on_response( rpc::program_subscribe * ) override;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/pc.dir/build.make:141: CMakeFiles/pc.dir/pc/manager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:98: CMakeFiles/pc.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
pyth client (testnet) is crashing with the following error:
pythd: invalid or corrupt product account
Startup arguments:
pythd -r pyth-testnet-rpc-1.solana.p2p.org:80:80 -k /app/pyth-client/keystore -d -w /app/pyth-client/dashboard -x
Log file leading up to the crash is attached.
pyth-client.log.gz
afl-clang-fast
(https://github.com/google/AFL/tree/master/llvm_mode).
In the case of blockchain environments that are not as busy, the capture compressed file tends not to update until pythd is stopped. Please consider a feature that allows pythd to write more frequently, in spite of the state of the buffer.
manager logic for refreshing the block height is counting updates, not slots
pythd
version - 2.9.1
command: home/pyth/pyth-client/build/pythd -r nginx:7899:7900 -t pyth-tx-server-mainnet:8898 -k $KDIR -w /home/pyth/pyth-client/dashboard"
When pythd
reconnects to the Solana RPC we see either of the following logs:
[2021-11-29T14:37:24.923149Z 11 INF rpc_connected ]
[2021-11-29T14:37:24.896228Z 11 ERR rpc_websocket_reset ] error=fail to read [11 Resource temporarily unavailable],host=nginx:7899:7900,port=7899
[2021-11-29T05:09:28.396393Z 11 ERR rpc_http_reset ] error=fail to read [11 Resource temporarily unavailable],host=nginx:7899:7900,port=7899
[2021-11-29T05:09:28.451638Z 11 INF rpc_connected
After the reconnect happens, we are unable to post price_update
because of the following JSON RPC error:
Error code: -32002 message: not ready to publish - check rpc / pyth_tx connection
We don't see any matching pythx
errors. The only way for us to fix this is to restart the pythd
process.
Ideally pythd
would be able to handle those JSON RPC requests without having to restart it after a RPC reconnect.
dashboard.js:
pyth-client/dashboard/dashboard.js
Line 128 in 0a614b6
ws = new WebSocket('ws://{{ ws_host }}:{{ ws_port }}')
index.html:
pyth-client/dashboard/index.html
Line 9 in 0a614b6
<h2>pyth dashboard {{ dashboard_name }}
#ifdef __cplusplus
and extern "C"
boilerplate.constexpr
s.pc_
, pd_
, etc.) with namespace/class-scoping.We had a few questions about the pythd dashboard referenced in your documentation [here]
(https://urldefense.com/v3/__https:/docs.pyth.network/publish-data*running-the-dashboard__;Iw!!GSt_xZU7050wKg!qOrCVC6LYuM9QkJT5v0UNKyt_FzhxX27xu4cI4ccru8FsSs_jcyUmeVdd1nmza1ybJXCPL-5Ms6r6d3DVKvlSaw$).
First, the dashboard is broken. The file dashboard/dashboard.js attempts to make a websocket connection to pythd at a hardcoded URL: ws://localhost:8910. This is a problem for multiple reasons:
• You might not want to view the dashboard on the same host on which you’re running pythd.
• Even if you are viewing the dashboard on the same host as pythd’s docker container, the container’s published port is unlikely to be 8910.
The dashboard, as-is, only works if the browser you’re viewing it on is on the same host as pythd and the published port of pythd’s container is 8910. Can your team fix this?
Second, the dashboard doesn’t seem very useful to a publisher. It shows a view of the current aggregated state of all symbols. It might be more useful to us if it was a view of what pythd was seeing from its clients and sending to the broader pyth network. Is that something that you could change?
Thanks,
pythd
does not natively support connecting to HTTPS endpoints.
#49 is a brittle workaround. Several users are having issues connecting to nodes that require TLS. Having to manage an additional NGINX instance is an added maintenance burden and introduces another single point of failure.
Please consider using a HTTP client library such as
If pythd
is being used in dashboard form (with -x
) it should not need access to a publisher private key. If this file is not present in the key directory it will crash on startup.
Consider a segmented log and capture file writing scheme for long runs of the pyth processes, with a configurable maximum segment file size.
Hi everyone!
We tried to use the the price webosocket endpoint with the jsonrpc library of parity.
We could not manage to make it work because the subscribe endpoint is expected to provide a subscription ID straight in the result
field of the rpc response. But the current implementation is wrapping the ID in an object with a subscription
field.
We checked various websocket subscription implementations over JSONRPC and all of them were answering with the ID straight in the result
field.
I updated the endpoint to be compliant with the common implementation PR #20 (I also linked many known implementations of it which are behaving correctly).
Any chance we get this merged? I don't know whether there are more stuff to change so feel free to give a strong review on my changes.
NOTE: even your website is using the common implementation for the price feed :)
I've created a PR to fix this issue. #253
Running CLion inspections over the repo reveals lots of issues, such as:
explicit
single-argument constructorsoverride
specifiersWe should clean these up and protect against future static analysis failures with automation, using CLion's inspect.sh
or a tool like clang-tidy
.
As a first step, add a second GitHub Action which installs and runs extra tools on top of the base docker.yaml
.
Would love to take this for a spin on Mac.
Replace the qsort module, which was a temporary workaround for lack of sort in the Solana library.
It's possible for one Solana node to be behind another Solana node. In determining the leader, arb several Solana rpc nodes.
A lot of Solana shared node providers use tokens in the url to authenticate.
Pythd doesn't seem to accept such urls in the rpc_host parameter.
Are there any plans to support them?
When I'm about to create a solana key pair, it says I don't have permission
I have no name!@116c6ad4bcb5:/home/pyth/pyth-client/build$ ./pyth init_key -k $KDIR
pyth: failed to create key_store directory [13 Permission denied]
Hi,
I'm trying to use pythd with mainnet-beta, but I can't connect. It runs fine using devnet, but mainet-beta fails.
./pythd -k $KDIR -r $RHOST
[2021-10-01T10:01:03.758888Z 722534 INF publish_key ] key_name=CZfEVuDoUKEgpyuoBtTHDkUcetvyKrTKWfPJsYfqv355
[2021-10-01T10:01:03.758935Z 722534 INF mapping_key ] key_name=AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J
[2021-10-01T10:01:03.758949Z 722534 INF program_key ] key_name=FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH
[2021-10-01T10:01:03.796309Z 722534 INF listening ] port=8910,content_dir=
[2021-10-01T10:01:03.796316Z 722534 INF initialized ] version=2,rpc_host=api.mainnet-beta.solana.com,tx_host=localhost,capture_file=,commitment=confirmed,publish_interval(ms)=227
[2021-10-01T10:01:03.865403Z 722534 INF rpc_connected ]
[2021-10-01T10:01:03.926304Z 722534 INF received_recent_block_hash ] curr_slot=99230323,hash_slot=99230269,round_trip_time(ms)=30.283889
[2021-10-01T10:01:03.957041Z 722534 INF add_mapping ] account=AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J,num_products=43
[2021-10-01T10:01:03.987762Z 722534 INF add_product ] account=5uKdRzB3FzdmwyCHrqSGq4u2URja617jqtKkM71BVrkw,attr={"asset_type":"Crypto","symbol":"BCH/USD","country":"US","quote_currency":"USD","description":"BCH/USD","tenor":"Spot","generic_symbol":"BCHUSD"}
[2021-10-01T10:01:03.988206Z 722534 INF add_product ] account=ETuC4VK6kuHfxc9MCU14dASfnGBfzgFUVCs1oVowawHb,attr={"asset_type":"Crypto","symbol":"LTC/USD","country":"US","quote_currency":"USD","description":"LTC/USD","tenor":"Spot","generic_symbol":"LTCUSD"}
[2021-10-01T10:01:03.988539Z 722534 INF add_product ] account=4aDoSXJ5o3AuvL7QFeR6h44jALQfTmUUCTVGDD6aoJTM,attr={"asset_type":"Crypto","symbol":"BTC/USD","country":"US","quote_currency":"USD","description":"BTC/USD","tenor":"Spot","generic_symbol":"BTCUSD"}
[2021-10-01T10:01:03.988871Z 722534 INF add_product ] account=4ANvG59u4YToJnVi2CkZbbfTE9mWHpyNbMmm69R43E3q,attr={"asset_type":"Crypto","symbol":"BNB/USD","country":"US","quote_currency":"USD","description":"BNB/USD","tenor":"Spot","generic_symbol":"BNBUSD"}
[2021-10-01T10:01:03.989246Z 722534 INF add_product ] account=GeSpWQucSvWhaXVvC2RJihpne9dCdL25pn46BTiDLyYs,attr={"asset_type":"Crypto","symbol":"DOGE/USD","country":"US","quote_currency":"USD","description":"DOGE/USD","tenor":"Spot","generic_symbol":"XDGUSD"}
[2021-10-01T10:01:03.989538Z 722534 INF add_product ] account=Av6XyAMJnyi68FdsKSPYgzfXGjYrrt6jcAMwtvzLCqaM,attr={"asset_type":"Crypto","symbol":"USDT/USD","country":"US","quote_currency":"USD","description":"USDT/USD","tenor":"Spot","generic_symbol":"USDTUSD"}
[2021-10-01T10:01:03.989866Z 722534 INF add_product ] account=ALP8SdU9oARYVLgLR7LrqMNCYBnhtnQz1cj6bwgwQmgj,attr={"asset_type":"Crypto","symbol":"SOL/USD","country":"US","quote_currency":"USD","description":"SOL/USD","tenor":"Spot","generic_symbol":"SOLUSD"}
[2021-10-01T10:01:03.990104Z 722534 INF add_product ] account=8GWTTbNiXdmyZREXbjsZBmCRuzdPrW55dnZGDkTRjWvb,attr={"asset_type":"Crypto","symbol":"USDC/USD","country":"US","quote_currency":"USD","description":"USDC/USD","tenor":"Spot","generic_symbol":"USDCUSD"}
[2021-10-01T10:01:03.990411Z 722534 INF add_product ] account=EMkxjGC1CQ7JLiutDbfYb7UKb3zm9SJcUmr1YicBsdpZ,attr={"asset_type":"Crypto","symbol":"ETH/USD","country":"US","quote_currency":"USD","description":"ETH/USD","tenor":"Spot","generic_symbol":"ETHUSD"}
[2021-10-01T10:01:03.990688Z 722534 INF add_product ] account=6T1eJbKWyhZXEjmuBej9gPk3SRTagzrEQovCSwAWD57P,attr={"asset_type":"Crypto","symbol":"SRM/USD","country":"US","quote_currency":"USD","description":"SRM/USD","tenor":"Spot","generic_symbol":"SRMUSD"}
[2021-10-01T10:01:04.020090Z 722534 ERR rpc_http_reset ] error=fail to read [104 Connection reset by peer],host=api.mainnet-beta.solana.com,port=80
[2021-10-01T10:01:04.088382Z 722534 ERR rpc_websocket_reset ] error=failed to handshake websocket: Too Many Requests,host=api.mainnet-beta.solana.com,port=80
[2021-10-01T10:01:06.083764Z 722534 ERR rpc_websocket_reset ] error=failed to handshake websocket: Too Many Requests,host=api.mainnet-beta.solana.com,port=80
[2021-10-01T10:01:10.084534Z 722534 ERR rpc_websocket_reset ] error=failed to handshake websocket: Too Many Requests,host=api.mainnet-beta.solana.com,port=80
[2021-10-01T10:01:18.086001Z 722534 INF rpc_connected ]
[2021-10-01T10:01:18.152652Z 722534 INF received_recent_block_hash ] curr_slot=99230356,hash_slot=99230321,round_trip_time(ms)=33.398536
[2021-10-01T10:01:18.186456Z 722534 INF add_mapping ] account=AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J,num_products=43
[2021-10-01T10:01:18.186835Z 722534 INF add_product ] account=5uKdRzB3FzdmwyCHrqSGq4u2URja617jqtKkM71BVrkw,attr={"asset_type":"Crypto","symbol":"BCH/USD","country":"US","quote_currency":"USD","description":"BCH/USD","tenor":"Spot","generic_symbol":"BCHUSD"}
[2021-10-01T10:01:18.187316Z 722534 INF add_price ] account=5ALDzwcRJfSyGdGyhP3kP628aqBNHZzLuVww7o9kdspe,product=5uKdRzB3FzdmwyCHrqSGq4u2URja617jqtKkM71BVrkw,symbol=BCH/USD,price_type=price,version=2,exponent=-8,num_publishers=9
[2021-10-01T10:01:18.187568Z 722534 INF add_product ] account=ETuC4VK6kuHfxc9MCU14dASfnGBfzgFUVCs1oVowawHb,attr={"asset_type":"Crypto","symbol":"LTC/USD","country":"US","quote_currency":"USD","description":"LTC/USD","tenor":"Spot","generic_symbol":"LTCUSD"}
[2021-10-01T10:01:18.188111Z 722534 INF add_price ] account=8RMnV1eD55iqUFJLMguPkYBkq8DCtx81XcmAja93LvRR,product=ETuC4VK6kuHfxc9MCU14dASfnGBfzgFUVCs1oVowawHb,symbol=LTC/USD,price_type=price,version=2,exponent=-8,num_publishers=11
[2021-10-01T10:01:18.188375Z 722534 INF add_product ] account=4aDoSXJ5o3AuvL7QFeR6h44jALQfTmUUCTVGDD6aoJTM,attr={"asset_type":"Crypto","symbol":"BTC/USD","country":"US","quote_currency":"USD","description":"BTC/USD","tenor":"Spot","generic_symbol":"BTCUSD"}
[2021-10-01T10:01:18.188793Z 722534 INF add_price ] account=GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU,product=4aDoSXJ5o3AuvL7QFeR6h44jALQfTmUUCTVGDD6aoJTM,symbol=BTC/USD,price_type=price,version=2,exponent=-8,num_publishers=17
[2021-10-01T10:01:18.189053Z 722534 INF add_product ] account=4ANvG59u4YToJnVi2CkZbbfTE9mWHpyNbMmm69R43E3q,attr={"asset_type":"Crypto","symbol":"BNB/USD","country":"US","quote_currency":"USD","description":"BNB/USD","tenor":"Spot","generic_symbol":"BNBUSD"}
[2021-10-01T10:01:18.221274Z 722534 ERR rpc_http_reset ] error=fail to read [104 Connection reset by peer],host=api.mainnet-beta.solana.com,port=80
[2021-10-01T10:01:19.088638Z 722534 INF rpc_connected ]
[2021-10-01T10:01:19.160880Z 722534 INF received_recent_block_hash ] curr_slot=99230359,hash_slot=99230322,round_trip_time(ms)=37.319143
pythd: Connection rate limits exceeded, contact your app developer or [email protected].
[2021-10-01T10:01:19.193679Z 722534 INF pythd_teardown
I want to publish EUR/USD
price. From the docs at
https://github.com/pyth-network/pyth-client/blob/main/doc/getting_started.md,
After building pyth-client, I should:
pyth_tx -r $KHOST
test_publish -k $KDIR -r $KHOST -t $THOST
test_publish::on_response
callbacks to be triggered when the test publisher program receives a message from pyth_tx
, and then inside that callback, there's the chance for me to publish the price (I haven't figured out exactly how yet).Q1: However, I notice that test_publish::on_response
never ever gets called. Why?
Digging some more into the test_publish.cpp
code, I notice that test_connect
's pub1_
and pub2_
members are created but never used, and that test_connect::get_price
is not implemented. So these missing parts (unused member, unimplemented method) seem to suggest that test_publish.cpp
is incomplete, specifically missing parts on how to actually publish price. Also, putting the missing implementations aside, are the SYMBOL1
and SYMBOL2
in the construction of the 2 test_publish
objects arbitrary, or must they correspond to existing instruments in the solana network?
Q2: Exactly, how should one publish price, for say, EUR/USD
, step-by-step, using libpc? I tried to understand the docs and reading the sources but it doesn't seem so clear.
if rpc_client::reset is called with outstanding requests, the mapping from id to request type gets cleared and the subsequent processing of responses results can use the wrong message type
there is no need to have these admin functions implemented in C++
also, many of these should be bundled into the same transaction to avoid undesirable behavior (price account added but no initialized, etc)
testing the slack integration
Headers in HTTP should be processed case-insentively, however the pythd proxy relies on the headers being capitalised. This causes issues when attempting to place the Pythd websocket interface behind a proxy (or using a client that uses lower-case headers).
Relevant locations in the pythd source (AFAICT):
./net_socket.cpp:1059: if ( !get_header_val( "Sec-WebSocket-Key", key ) ) {
./net_socket.cpp:1028: 0 == __builtin_strncmp( "Upgrade", hdr, hlen ) &&
The first causes a 'hang' (the connection just stalls) if Sec-WebSocket-Key is specified with any other capitalisation. The second case causes websocket upgrades to not be processed at all and the pythd API returns 404 (as it doesn't attempt websocket upgrades).
after connecting without issue for about a month, I am now getting the following error:
ClientConnectorCertificateError: Cannot connect to host api.devnet.solana.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
The snippet presented in github was used to test the connection but the error remains:
from pythclient.pythclient import PythClient
from pythclient.pythaccounts import PythPriceAccount
from pythclient.utils import get_key
solana_network="devnet"
async with PythClient(
first_mapping_account_key=get_key(solana_network, "mapping"),
program_key=get_key(solana_network, "program") if use_program else None,
) as c:
await c.refresh_all_prices()
products = await c.get_products()
for p in products:
print(p.attrs)
prices = await p.get_prices()
for _, pr in prices.items():
print(
pr.price_type,
pr.aggregate_price_status,
pr.aggregate_price,
"p/m",
pr.aggregate_price_confidence_interval,
)
I am running python 3.10 at the moment.
Add a get_product
method, equivalent to pyth get_product
to the pythd websocket API
Stack size in solana is fairly limited to 4096bytes, and with the release of pyth v2 price accounts making it difficult to be able to reference price accounts. Zero copy serialization/deserialization would pretty much resolve this issue.
Hello,
I'm trying to use a RPC host at rpcpool.com with a URL that looks like this: my-subdomain.rpcpool.com/some-path
When I pass that URL as the rpc host with the -r
flag, the pythd
daemon fails with the following error:
pythd: failed to resolve host
I traced the source code and confirmed that getaddrinfo
is being called with the entire URL and not just the hostname, which is where it's failing.
I'm guessing this is the same underlying issue as #93 but it's hard to tell since they didn't mention where it's failing for them.
pythd crashes with the following when getenv ( "HOME" )
returns nullptr:
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
Aborted
HOME
being undefined is not common and in my case may be an artifact of what nitro-cli
is doing under the hood, but figured this would be helpful for anyone who runs into the same issue. A quick test to ensure the envvar is defined and provide less cryptic output may also be helpful.
Currently pyth has get_product_list
which returns a list of product keys. In order to see price details you have to call get_product [product_key]
many times.
Add a get_all_product_data
command which prints all products, prices and publisher details in a single query.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.