pyth-network / pyth-crosschain Goto Github PK
View Code? Open in Web Editor NEWCrosschain Pyth programs and utilities
Home Page: https://pyth.network
License: Other
Crosschain Pyth programs and utilities
Home Page: https://pyth.network
License: Other
Hello! I'm currently delving into Pyth Network on Hedera, but I'm encountering some issues getting it to work.
I've created a simple contract:
contract PythPriceFeed {
/// @notice HBAR/USD price feed ID can be found here: [Pyth Network Price Feed IDs](https://pyth.network/developers/price-feed-ids)
bytes32 constant HBAR_USD_PRICE_ID = 0x3728e591097635310e6341af53db8b7ee42da9b3a8d918f9463ce9cca886dfbd;
/// @notice Pyth contract addresses can be found here: [Pyth Network Contract Addresses](https://docs.pyth.network/price-feeds/contract-addresses/evm)
address constant TESTNET_PYTH_CONTRACT_ADDRESS = 0xA2aa501b19aff244D90cc15a4Cf739D2725B5729;
/// @dev Initialize Pyth instance
IPyth pyth;
constructor() {
pyth = IPyth(TESTNET_PYTH_CONTRACT_ADDRESS);
}
function getPrice(bytes32 _priceId) view external returns (PythStructs.Price memory) {
return pyth.getPrice(_priceId);
}
}
I deployed this contract using Remix IDE and verified it on the Hedera testnet, which can be found here. However, when I attempt to call the .getPrice()
method, the transaction is reverted with the error CONTRACT_REVERT_EXECUTED
:
call to PythPriceFeed.getPrice
call to PythPriceFeed.getPrice errored: Error occurred: [Request ID: f7d0511e-23c2-4ab9-8804-6f4a82d8666e] execution reverted: CONTRACT_REVERT_EXECUTED.
[Request ID: f7d0511e-23c2-4ab9-8804-6f4a82d8666e] execution reverted: CONTRACT_REVERT_EXECUTED
In addition to the above, I went to your API reference on your docs page at https://docs.pyth.network/price-feeds/api-reference/evm/get-price to try out the getPrice() method, the transaction there also get reverted but with StalePrice()
Do you think the SDK is down or has some problems?
Would appreciate any insights or help debugging this.
I got an error when running the following command to install the ethereum contract
x@x:~/codes/pyth-crosschain/target_chains/ethereum/contracts$ npx lerna run build --scope="@pythnetwork/pyth-evm-contract" --include-dependencies
lerna notice cli v8.1.2
lerna ERR! ECONFIGWORKSPACES The "useWorkspaces" option has been removed. By default lerna will resolve your packages using your package manager's workspaces configuration. Alternatively, you can manually provide a list of package globs to be used instead via the "packages" option in lerna.json.
and my environment
x@x:~/codes/pyth-crosschain/target_chains/ethereum/contracts$ npm -v
10.2.4
x@x:~/codes/pyth-crosschain/target_chains/ethereum/contracts$ node -v
v20.11.0
x@x:~/codes/pyth-crosschain/target_chains/ethereum/contracts$ uname -a
Linux x 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
x@x:~/codes/pyth-crosschain/target_chains/ethereum/contracts$
This package is referenced by the price service JS REST server, but is not visible on NPM:
I'm guessing this is currently published as a private NPM, please make available as public if so. Thank you!
This comes from running build-contracts.ts script on windows platform.
It looks like basename is a command in unix/linux and not windows. It would be nice to specify that in the readmes.
We want to create both relay and attest images.
This should also built with caching layers.
The console.log messages in the price update system reports "None of the above values passed the threshold. No push needed."
as a catch-all. This message is misleading as it suggests a normal non-update condition. However, critical failures in data polling, corruption, staleness... will also lead to this message.
I am using amd64. I am working on Windows 11 Pro with WSL2(Ubuntu)
I am getting the following error:
Received new price feed update from Pyth price service: SOL/USD ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d
Received new price feed update from Pyth price service: USDT/USD 2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b
Received new price feed update from Pyth price service: LDO/USD c63e2a7f37a04e5e614c07238bedb25dcc38927fba8fe890597a593c0b2fa4ad
Received new price feed update from Pyth price service: ENA/USD b7910ba7322db020416fcac28b48c01212fd9cc8fbcbaf7d30477ed8605f6bd4
Received new price feed update from Pyth price service: ETH/USD ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace
Received new price feed update from Pyth price service: PEPE/USD d69731a2e74ac1ce884fc3890f7ee324b6deb66147055249568869ed700882e4
An unidentified error has occured:
undefined
/home/node/price_pusher/lib/evm/evm.js:190
throw err;
^
Error: ALREADY_EXISTS: already known
at /home/node/node_modules/web3-provider-engine/subproviders/provider.js:19:36
at /home/node/node_modules/web3-providers-http/lib/index.js:127:13
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.13.0
npm ERR! Lifecycle script `start` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: @pythnetwork/[email protected]
npm ERR! at location: /home/node/price_pusher
I am sending prices to the gnosis.
This is the command I am using:
/usr/bin/docker run \
--name pyth-price-pusher-primary \
-v $(pwd)/config:/config \
public.ecr.aws/pyth-network/xc-price-pusher:v6.6.0 \
-- \
evm \
--endpoint "https://rpc.ankr.com/gnosis/XXXXXXXXXXX" \
--mnemonic-file "/config/mnemonic" \
--pyth-contract-address "0x2880aB155794e7179c9eE2e38200202908C17B43" \
--price-service-endpoint "https://hermes.pyth.network" \
--price-config-file "/config/price-config.yaml" \
--polling-frequency 5
Currently it's tightly coupled with relaying themselves and it added a lot of unnecessary complexity.
Also the metric is using timestamp as label makes time series work (for dashboarding) ugly and hard.
In the following section, the Pyth contract checks for the validity of the provided price update:
pyth-crosschain/target_chains/ethereum/contracts/contracts/pyth/Pyth.sol
Lines 517 to 530 in 16832ab
As we see, it is a hard requirement that the publishTime of the update be within [config.minTimestamp, config.maxTimestamp]
. However, it's possible that no signed VAA exists for the provided interval. In such a case, we would see the following for the price update:
publishTime > config.maxTimestamp
AND prevPublishTime < config.minTimestamp
In such a case, the price update should be accepted as valid.
I'm using PriceServiceConnection
from price-service-client
, currently it's throwing runtime error in my react app as,
Error:
axios_1.default.create is not a function
TypeError: axios_1.default.create is not a function
at new PriceServiceConnection
Code:
const connection = new PriceServiceConnection("https://hermes.pyth.network");
package.json
"dependencies": {
"@pythnetwork/price-service-client": "^1.8.2",
"@pythnetwork/pyth-sdk-solidity": "^2.4.0",
"@web3modal/ethereum": "^2.3.0",
"@web3modal/react": "^2.3.0",
"axios": "^1.6.7",
"ethers": "^5.7.2",
"lodash.debounce": "^4.0.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-qr-code": "^2.0.12",
"react-query": "^3.39.3",
"react-router-dom": "^6.21.3",
"react-scripts": "5.0.1",
"react-toastify": "^10.0.3",
"sass": "^1.70.0",
"wagmi": "^0.12.12"
},
"devDependencies": {
"@typechain/ethers-v5": "^11.1.2",
"@types/lodash.debounce": "^4.0.9",
"@types/node": "^16.18.71",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"eslint": "^8.56.0",
"eslint-plugin-react": "^7.33.2",
"typechain": "^8.3.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
Note: I have installed axios for other APIs, I tried installing specific version reauired by price-service-client but that didn't help.
Hi!
We need to monitor all endpoints that our RPC calls, and there is some EVM addresses like:
AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J for mainnet
and
BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2 for devnet
How can I monitor that are they accessible?
There is some status page?
Regards,
Juliano
After we've successfully deployed pyth2wormhole into devnet and mainnet, it's time for some maintenance.
root
user, instead add a pyth accountpython
image rather than a complete Solana image. This should reduce the image size and its blast radiusThese will cause CI to take very long time and each change in the code will cause a massive rebuild which takes time.
It would be good to do the Ethereum builds separately and cache it.
OOM after running 7 hours, running with a config having 25 assets
Polled an EVM on chain price for feed AAPL/USD (afcc9a5bb5eefd55e12b6f0b4c8e6bccf72b785134ee232a5d175afd082e8832).
Polled an EVM on chain price for feed AMZN/USD (095e126b86f4f416a21da0c44b997a379e8647514a1b78204ca0a6267801d00f).
<--- Last few GCs --->
[18:0x5d5d2f0] 26436885 ms: Mark-sweep 4024.2 (4139.9) -> 4012.0 (4141.2) MB, 5717.2 / 0.4 ms (average mu = 0.578, current mu = 0.530) task; scavenge might not succeed
[18:0x5d5d2f0] 26450079 ms: Mark-sweep 4025.7 (4141.4) -> 4013.6 (4142.9) MB, 5694.2 / 0.3 ms (average mu = 0.574, current mu = 0.568) task; scavenge might not succeed
[18:0x5d5d2f0] 26465084 ms: Mark-sweep 4027.5 (4143.2) -> 4015.3 (4144.4) MB, 6474.9 / 0.3 ms (average mu = 0.571, current mu = 0.568) task; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0xb6b850 node::Abort() [node]
2: 0xa806a6 [node]
3: 0xd52140 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xd524e7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xf2fbe5 [node]
6: 0xf420cd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
7: 0xfb1124 v8::internal::ScavengeJob::Task::RunInternal() [node]
8: 0xe2187b non-virtual thunk to v8::internal::CancelableTask::Run() [node]
9: 0xbd6684 [node]
10: 0xbd9aee node::PerIsolatePlatformData::FlushForegroundTasksInternal() [node]
11: 0x1652906 [node]
12: 0x1664e44 [node]
13: 0x165326e uv_run [node]
14: 0xaafa2d node::SpinEventLoop(node::Environment*) [node]
15: 0xbb11f4 node::NodeMainInstance::Run() [node]
16: 0xb26c44 node::LoadSnapshotDataAndRun(node::SnapshotData const**, node::InitializationResult const*) [node]
17: 0xb2a83f node::Start(int, char**) [node]
18: 0x7fa0a93c7d0a __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
19: 0xaad7ee _start [node]
Aborted (core dumped)
Now p2w-relay and p2w-api use manual parsing logic, it's better to use the sdk for it.
In the package docs on npm it says
HermesClient also allows subscribing to real-time price updates over a Server-Sent Events (SSE) connection:
// Streaming price updates
const eventSource = await connection.getStreamingPriceUpdates(priceIds);
Although I thing the correct method is getPriceUpdatesStream
import { AptosPriceServiceConnection } from '@pythnetwork/pyth-aptos-js'
"@pythnetwork/pyth-aptos-js": "^1.4.2",
"@pythnetwork/pyth-common-js": "^1.4.0",
Error:
Module not found: Error: Can't resolve 'bn.js' in '/home/cot-zzq/my-first-dapp/client/node_modules/@pythnetwork/price-service-sdk/lib'
There have been a couple of breaking changes between the current sui version in the pyth sdk (0.37) and the latest version (0.49):
It would be great if the price pusher accepted an array of gRPC endpoints and attempted to cycle through them on errors, rather than to spin up multiple instances of the price-pusher that each connect to a different endpoint.
I'm using Anchor 0.30.1 version. I installed pyth-solana-receiver-sdk 0.3.0 version but build fails with this kind of errors.
error[E0599]: no function or associated item named `get_full_path` found for struct `MerklePriceUpdate` in the current scope
error[E0599]: no function or associated item named `create_type` found for struct `MerklePriceUpdate` in the current scope
error[E0599]: no function or associated item named `insert_types` found for struct `MerklePriceUpdate` in the current scope
Here is the full error log.
Stack Exchange: Cargo complaning about unmatchable version requirements with pyth-solana-receiver-sdk
and serde_with
crates
I'm trying to add creating a stub Pyth Solana Receiver. Encountered some dependency issues even though I have used the right version of serde_with
that is compatible with 1solana-sdkused in the repo
v1.16.0`. Do you have any recommendations?
(as seen here)[https://github.com/solana-labs/solana/blob/v1.16.20/Cargo.toml#L284)
It looks like this change #766 is not included in the current container images: http://localhost:4200/api/latest_price_feeds?ids[]=0xca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6&target_chain=evm returns a 400 with "target_chain" is not allowed
(using docker-compose.testnet.yaml
which specifies image public.ecr.aws/pyth-network/xc-server:v3.0.0
).
Can you publish a new image with the latest changes? Thanks!
Hermes provides two APIs to return VAA.
I decode VAA returned by /api/get_vaa
and it works fine.
// VAA comes from:
// curl -X 'GET' \
// 'https://hermes.pyth.network/api/get_vaa?id=e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43&publish_time=1690576641' \
// -H 'accept: application/json'
let vaa = "AQAAAAMNADrd3uvPmeTpxEank33LJTq0aCXgzI0IU0tOqNW4uEE9YlXzuzIJmjkp5hgEuGo5DJEe8ZDnVIwAblxc1t5Fn94BAr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AAAAABcjAAAAAGTEJwA=";
let vaa_bytes = base64::engine::general_purpose::STANDARD.decode(vaa).unwrap();
let vaa: Vaa<&RawMessage> = serde_wormhole::from_slice(vaa_bytes.as_ref()).unwrap();
let (header, body): (Header, Body<&RawMessage>) = vaa.into();
println!("{:#?}", header);
println!("{:#?}", body);
let batch: BatchPriceAttestation = BatchPriceAttestation::deserialize(body.payload.as_ref()).unwrap();
println!("{:#?}", batch);
However it fails when I replace the VAA string with what /api/latest_vaas
returns.
// VAA comes from
// curl -X 'GET' \
// 'https://hermes.pyth.network/api/latest_vaas?ids%5B%5D=e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43&ids%5B%5D=ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace' \
// -H 'accept: application/json'
let vaa = "UE5BVQEAAAADuAEAAAADDQDTuQ0duc99uikTONt89WcCWOacXi9v5rxRUgqP1g8bSQLsOwxIDMPKVn/ZFpc6tMOH5/CFZWVx2+14qjDMxnKFAQKUETfItEQQJ1DypBG85t6vOZ7cwlV6jt+K2aWjfGvLcjnUr2K1fe7bLB2FS1pTL0Rjn9hm/s99c9KxE0Ctqq3UAARpOWf2AJl6G9WOAirPyINuw3X48lBIXY7Pi0mfJ5qyH3WwEPRnnwH70OMCE2YvGpqnQHX/Axd8XMMaHbedZxYRAQZYhsJI5hfQSVpONa9m82Yo2qjEumTRI1y2s/7FALjd/hVVnIo0kcKolYuPQ583fILv+lAvDgCOGXx+sA8PYuiaAAc5O8rYNXvLl9TJVbqYr5EKmmFA26yOTegcKsp/CqW8zFRA3rP4VcvEa7aiKsX2mEefAsGTUFcAnchQnmT2youJAQgR4wM6tcZaMANYK2ktbxumpEvxq/STVM0lfedvhSj2fStV3QGAzfbF7T3VPuBSivhSlBG1peVWTww0gs8KBfoNAAmVkDyNeOzZ+BYF3D9S98DqAtuCF2tAWvhqTMEgYXKcTFKVcQJQkGFVp7k+v4O1tYFABMsx2b+bh24zSAAcFED6AAr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AAABlXEVBAAAAAGVcRUEAAAAu8lwmSAAAAAAFhl3NCjPQY7sJ+GJCSeaX6muhlHgB03nJzr9VL7IQwk170GcCURN/S5rEftC+Sfs7WMCrEgg7xLM6Kd8qyIOT5NKpa7dFOvaQefFirdy7745u47N1Vzq2ZD2tXznLO+8tSSDFOhXmweeej8shBGQ4J2St5S8nOXu/rwWOEAxMGX6GyactEwANRrOO39mQfn1th6BNlQ3Grjzdy5DPwznyCR20sNg2P/BdU+MlBTtUD+MnLszQk630DS+tMjee0VqapBV3XDDI/Rgmueir";
// Same code as the above
Error
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Invalid magic [56, 7F, D9, 16], expected [50, 32, 57, 48]"'
My question is, how to decode VAA returned by /api/latest_vaas
? Very appreciate it if someone could give an sample code.
BTW, from the updatePriceFeeds
in sol code, I find that there are two branch to decode price feed, one use ACCUMULATOR_MAGIC
and one decodes as price batch. What are their differences?
I'm running the Dockerfile public.ecr.aws/pyth-network/xc-price-pusher:v5.7.0 on injective and running into an error.
config:
{
"grpc-endpoint": "https://testnet.chain.grpc-web.injective.network",
"pyth-contract-address": "inj1z60tg0tekdzcasenhuuwq3htjcd5slmgf7gpez",
"price-service-endpoint": "https://hermes-beta.pyth.network",
"mnemonic-file": "./mnemonic",
"price-config-file": "./price-config.testnet.sample.yaml",
"network": "testnet"
}
and price-config
- alias: INJ/USD
id: "0x2d9315a88f3019f8efa88dfe9c0f0843712da0bac814461e27733f6b83eb51b3"
time_difference: 60
price_deviation: 0.5
confidence_ratio: 1
early_update:
time_difference: 30
price_deviation: 0.5
confidence_ratio: 0.1
- alias: USDC/USD
id: "0x41f3625971ca2ed2263e78573fe5ce23e13d2558ed3f2e47ab0f84fb9e7ae722"
time_difference: 60
price_deviation: 1
confidence_ratio: 1
early_update:
time_difference: 30
price_deviation: 0.5
confidence_ratio: 0.1
- alias: USDT/USD
id: "0x1fc18861232290221461220bd4e2acd1dcdfbc89c84092c93c18bdc7756c1588"
time_difference: 60
price_deviation: 1
confidence_ratio: 1
early_update:
time_difference: 30
price_deviation: 0.5
confidence_ratio: 0.1
I get this notice at the top (probably unrelated)
secp256k1 unavailable, reverting to browser version
and the error message
Error executing messages
Error: failed to execute message; message index: 0: Generic error: Querier contract error: codespace: wasm, code: 9: execute wasm contract failed [!injective!labs/[email protected]/x/wasm/keeper/keeper.go:394] With gas wanted: '50000000' and gas used: '232359'
at TxGrpcApi.<anonymous> (/home/node/price_pusher/node_modules/@injectivelabs/sdk-ts/dist/cjs/core/modules/tx/api/TxGrpcApi.js:109:61)
at Generator.throw (<anonymous>)
at rejected (/home/node/price_pusher/node_modules/@injectivelabs/sdk-ts/dist/cjs/core/modules/tx/api/TxGrpcApi.js:6:65)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'chain-error',
code: -1,
originalMessage: "Generic error: Querier contract error: codespace: wasm, code: 9: execute wasm contract failed [!injective!labs/[email protected]/x/wasm/keeper/keeper.go:394] With gas wanted: '50000000' and gas used: '232359'",
name: 'TransactionException',
errorClass: 'TransactionException',
context: '',
contextModule: '',
contextCode: 5
}
There isn't much information in the error message so I'm not really sure where to go from here.
Documentation notes that updatePriceFeeds
requires a small fee for storing new prices on-chain, however it's unclear why parsePriceFeedUpdates
also requires a fee when it does not actually commit to on-chain storage.
It is better to keep dev and prod deployment configurations the same and also e2e test that queries terra contracts makes more sense.
It is suggested by Eran in #107
This would make deploying much easier on platforms like digital ocean which use encrypted env vars.
PythStructs will cause an error when using the forge script to deploy contracts. The error message will be: "Script failed: Expected bytecode, but instead found unlinked bytecode with placeholder: 65759db3abb9c68754ca4eab7e42deed6d".
#370 Added the very useful update_cache_for_test
function for updating the pyth price cache in move unit tests. The new function takes vector<PriceUpdate>
as an argument, however PriceUpdate
is not an existing struct, and the pyth::update_cache
function should instead take vector<PriceUpdate>
as an argument.
Also the comment placement on the new function causes a compiler warning (which also prevents aptos unit tests from running).
pyth-crosschain/aptos/contracts/sources/pyth.move
Lines 485 to 487 in 9d5cc53
pyth-crosschain/aptos/contracts/sources/pyth.move
Lines 183 to 197 in 9d5cc53
Facing a bunch of Unbound module errors when sui move build
on target_chains/sui/contracts/
error[E03002]: unbound module
┌─ ./sources/state.move:188:9
│
188 │ package_utils::assert_version(
│ ^^^^^^^^^^^^^ Unbound module alias 'package_utils'
error[E03004]: unbound type
┌─ ./sources/state.move:210:13
│
210 │ ): &mut ConsumedVAAs {
│ ^^^^^^^^^^^^ Unbound type 'ConsumedVAAs' in current scope
error[E03004]: unbound type
┌─ ./sources/state.move:223:13
│
223 │ ): &mut ConsumedVAAs {
│ ^^^^^^^^^^^^ Unbound type 'ConsumedVAAs' in current scope
warning[W09002]: unused variable
┌─ ./sources/state.move:227:56
│
227 │ public(friend) fun current_package(_: &LatestOnly, self: &State): ID {
│ ^^^^ Unused parameter 'self'. Consider removing or prefixing with an underscore: '_self'
│
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')
error[E03002]: unbound module
┌─ ./sources/state.move:228:9
│
228 │ package_utils::current_package(&self.id)
│ ^^^^^^^^^^^^^ Unbound module alias 'package_utils'
warning[W09002]: unused variable
┌─ ./sources/state.move:289:9
│
289 │ package_digest: Bytes32
│ ^^^^^^^^^^^^^^ Unused parameter 'package_digest'. Consider removing or prefixing with an underscore: '_package_digest'
│
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')
error[E03004]: unbound type
┌─ ./sources/state.move:289:25
│
289 │ package_digest: Bytes32
│ ^^^^^^^ Unbound type 'Bytes32' in current scope
warning[W09002]: unused variable
┌─ ./sources/state.move:291:13
│
291 │ let cap = &mut self.upgrade_cap;
│ ^^^ Unused local variable 'cap'. Consider removing or prefixing with an underscore: '_cap'
│
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')
error[E03002]: unbound module
┌─ ./sources/state.move:292:9
│
292 │ package_utils::authorize_upgrade(&mut self.id, cap, package_digest)
│ ^^^^^^^^^^^^^ Unbound module alias 'package_utils'
warning[W09002]: unused variable
┌─ ./sources/state.move:303:9
│
303 │ receipt: UpgradeReceipt
│ ^^^^^^^ Unused parameter 'receipt'. Consider removing or prefixing with an underscore: '_receipt'
│
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')
warning[W09002]: unused variable
┌─ ./sources/state.move:305:13
│
305 │ let cap = &mut self.upgrade_cap;
│ ^^^ Unused local variable 'cap'. Consider removing or prefixing with an underscore: '_cap'
│
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')
error[E03002]: unbound module
┌─ ./sources/state.move:306:9
│
306 │ package_utils::commit_upgrade(&mut self.id, cap, receipt)
│ ^^^^^^^^^^^^^ Unbound module alias 'package_utils'
warning[W09002]: unused variable
┌─ ./sources/state.move:311:40
│
311 │ public(friend) fun migrate_version(self: &mut State) {
│ ^^^^ Unused parameter 'self'. Consider removing or prefixing with an underscore: '_self'
│
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')
error[E03002]: unbound module
┌─ ./sources/state.move:312:9
│
312 │ package_utils::migrate_version(
│ ^^^^^^^^^^^^^ Unbound module alias 'package_utils'
warning[W09002]: unused variable
┌─ ./sources/state.move:324:9
│
324 │ self: &State,
│ ^^^^ Unused parameter 'self'. Consider removing or prefixing with an underscore: '_self'
│
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')
error[E03004]: unbound type
┌─ ./sources/state.move:325:17
│
325 │ digest: Bytes32
│ ^^^^^^^ Unbound type 'Bytes32' in current scope
error[E03002]: unbound module
┌─ ./sources/state.move:327:26
│
327 │ let authorized = package_utils::authorized_digest(&self.id);
│ ^^^^^^^^^^^^^ Unbound module alias 'package_utils'
warning[W09002]: unused variable
┌─ ./sources/state.move:349:13
│
349 │ let upgrade_cap = &self.upgrade_cap;
│ ^^^^^^^^^^^ Unused local variable 'upgrade_cap'. Consider removing or prefixing with an underscore: '_upgrade_cap'
│
= This warning can be suppressed with '#[allow(unused_variable)]' applied to the 'module' or module member ('const', 'fun', or 'struct')
error[E03002]: unbound module
┌─ ./sources/state.move:350:9
│
350 │ package_utils::init_package_info(
│ ^^^^^^^^^^^^^ Unbound module alias 'package_utils'
error[E03002]: unbound module
┌─ ./sources/state.move:360:9
│
360 │ package_utils::remove_package_info(&mut self.id);
│ ^^^^^^^^^^^^^ Unbound module alias 'package_utils'
error[E03002]: unbound module
┌─ ./sources/state.move:365:65
│
365 │ sui::dynamic_field::add(&mut self.id, CurrentDigest {}, bytes32::from_bytes(b"new build"));
│
Help needed to build and test sui contracts
these two calls deliver different length of response:
anyone who could explain this, or is it documented somewhere? thanks!
Currently the CI sets up tilt and waits for all services to be healthy/ready. Within tilt all of our packages are built but only some of them are tested (js ones).
It's good to either include them in Tilt or set up different pipeline for them. Tilt is not recommended because Tilt CI is very hard to inspect and debug.
Currently, 0xF532F2C1bB7b67E08f7D8B76f9fF804D0831725e
address is indicated in the official document, but the contract does not actually exist.
Perhaps the zkSync testnet was reset in Feb after the contract was deployed in Jan.
Can you redeploy the contract and update the address?
Currently default values exists in multiple places which is redundant. It's better to keep them in only one place and all of them together. So making them required and having default ones in env.sample is a good option.
how to get the aptos price identifier from the coin type string (e.g. "0x1::aptos_coin::AptosCoin") ,i cannot find the related doc or code, appreciated if provide the related doc/code
Dear team:
When I'm using the new version of @pythnetwork/price-service-client
^1.8.2
will encounter Error: Cannot find module 'bn.js'
For PR #1458
Why put bn.js under devDependencies instead of dependencies?
This will prevent us from installing bn.js when installing node module @pythnetwork/price-service-client
Description:
I am trying to build a price service client in Rust and attempting to establish a WebSocket connection to the endpoint wss://hermes.pyth.network/. However, I am encountering an issue where the connection fails with the error message: Websocket connection failed: HTTP error: 200 OK. I expected the WebSocket handshake to receive a 101 Switching Protocols response.
Environment:
Rust version:
rustc 1.78.0 (9b00956e5 2024-04-29)
Crates:
tokio-tungstenite = { version = "0.22.0", features = ["rustls-tls-native-roots", "native-tls"] }
Endpoint:
wss://hermes.pyth.network/
pub async fn start_web_socket(&mut self) {
if self.ws_client.is_some() {
return;
}
log::info!("Creating Web Socket client");
log::info!("Endpoint: {}", self.endpoint);
match connect_async(&self.endpoint).await {
Ok((ws_stream, _)) => {
self.ws_client = Some(ws_stream);
self.ws_user_closed = false;
self.ws_failed_attempts = 0;
self.heartbeat().await;
}
Err(e) => {
log::error!("Websocket connection failed: {e}");
}
}
}
The public api has changed and we need to fix the query code. it's a very simple change.
running on Aribtrum Goerli, which cost a lot of extra gas as its L1 georli gas price is too high now
Some of the above values passed the threshold. Will push the price.
Pushing [
'0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b',
'0x997e0bf451cb36b4aea096e6b5c254d700922211dd933d9d17c467f0d6f34321',
'0x73dc009953c83c944690037ea477df627657f45c14f16ad3a61089c5a3f9f4f2',
'0x31775e1d6897129e8a84eeba975778fb50015b88039e9bc140bbd839694ac0ae',
'0x37f40d2898159e8f2e52b93cb78f47cc3829a31e525ab975c49cc5c5d9176378',
'0xd2c2c1f2bba8e0964f9589e060c2ee97f5e19057267ac3284caef3bd50bd2cb5',
'0xd7566a3ba7f7286ed54f4ae7e983f4420ae0b1e0f3892e11f9c4ab107bbad7b9',
'0xbcbdc2755bd74a2065f9d3283c2b8acbd898e473bdb90a6764b3dbd467c56ecd',
'0xc1b12769f6633798d45adfd62bfc70114839232e2949b01fb3d3f927d2606154',
'0x2646ca1e1186fd2bb48b2ab3effa841d233b7e904b2caebb19c8030784a89c97',
'0xb762d257b4bbce7935a8251b3e060977cfab1ed21770e8b431beff4cb7f41137'
]
Update fee: 6
Polled an EVM on chain price for feed BTC/USD (f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b).
Polled an EVM on chain price for feed ETH/USD (ca80ba6dc32e08d06f1aa886011eed1d77c77be9eb761cc10d72b7d0a2fd57a6).
Using gas price: 100000000 and nonce: 92
Polled an EVM on chain price for feed LTC/USD (997e0bf451cb36b4aea096e6b5c254d700922211dd933d9d17c467f0d6f34321).
An unidentified error has occured:
undefined
/code/lib/evm/evm.js:179
throw err;
^
Error: gas required exceeds allowance (2087137016)
at /code/node_modules/web3-provider-engine/subproviders/provider.js:19:36
at /code/node_modules/web3-providers-http/lib/index.js:127:13
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.13.0
I found the following issue when deploying on Sui's testnet using the instructions in the link below:
https://docs.pyth.network/price-feeds/use-real-time-data/sui#pyth-dependency
Error:
Error executing transaction: Failure { error: "PublishUpgradeMissingDependency in command 0", }
I believe the Pyth package with the id: 0xf7114cc10266d90c0c9e4b84455bddf29b40bd78fe56832c7ac98682c3daa95b is using the following wormhole package: 0xcc029e2810f17f9f43f52262f40026a71fbdca40ed3803ad2884994361910b7e in the testnet.
This can be verified in Suiscan: https://suiscan.xyz/testnet/object/0xf7114cc10266d90c0c9e4b84455bddf29b40bd78fe56832c7ac98682c3daa95b
The documentation points to a different wormhole package: 0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94
As described in #120
Please change to using git dependency
, then we can directly use in our package
USAGE:
Pyth = { git = "https://github.com/pyth-network/pyth-crosschain.git", subdir = "target_chains/sui/contracts/", rev = "sui/audit_fixes"}
ERROR:
Caused by:
0: Resolving dependencies for package 'Pyth'
1: Path cannot access parent of current directory: ../wormhole/sui/wormhole.
The problem is that if in a transaction there be multiple updatePriceFeeds calls there's no way to understand which batch belongs to which call by solely relying on events. However calling this function multiple times has no benefits and probably won't happen at all.
A suggested solution is to parse the transaction logs manually and aggregate the events, this can solve the problem because logs of a transaction are ordered and we can use the order to solve the above problem.
Currently, the generic relayer logic handles retries on whole arrays of VAAs. This is a problem, because it prevents the chain-specific bottom half from efficiently retrying only the things that have failed without doubling the generic part's work.
From a design POV we might want to put handling multiple batches and retries in a single place - either the generic Relay.relay()
caller half, or the chain-specific SomechainRelay.relay()
body.
Both options appear to remove the corner cases and come with their pros and cons.
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.