Code Monkey home page Code Monkey logo

pyth-crosschain's People

Contributors

0xfirefist avatar aditya520 avatar ali-bahjati avatar anihamde avatar cctdaniel avatar chase-45 avatar danimhr avatar drozdziak1 avatar erancx avatar evan-gray avatar guibescos avatar hendrikhofstadt avatar hernandp avatar ilovebusinessdevelopment avatar jayantk avatar justinschuldt avatar kcsongor avatar kev1n-peters avatar keyvankhademi avatar leoluk avatar m30m avatar njk-64 avatar optke3 avatar reisen avatar riateche avatar sejeff avatar swimricky avatar thmzlt avatar tompntn avatar ysavchenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyth-crosschain's Issues

Anchor 0.30.0 build issue using pyth-solana-receiver-sdk 0.1.0

Anchor 0.30.0 (haven't tried to the other versions) cannot build programs with dependency pyth-solana-receiver-sdk 0.1.0
solana-program 1.18.10

Screenshot from 2024-04-29 21-59-47

To reproduce:

  1. Create a new program
anchor init pyth-anchor-build-error
  1. Add dependency: pyth-solana-receiver-sdk = "0.1.0"
  2. Try to build program
anchor build

Pyth Network on Hedera

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()

Screenshot 2024-03-12 at 6 06 57 PM

Do you think the SDK is down or has some problems?

Would appreciate any insights or help debugging this.

Error: axios_1.default.create is not a function

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.

Module not found: Error: Can't resolve 'bn.js'

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

p2w-terra-relay: Move all default values to env file.

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.

Program is failing on WSL

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

Fix Balance Querying and it's metric in terra relay

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.

Price Pusher failed to execute message

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.

p2w-terra-relay: Cache ethereum builds

These 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.

[aptos] Aptos tests do not compile

#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).

public fun update_cache_for_test(updates: vector<PriceUpdate>) {
pyth::update_cache(updates);
}

which calls:
public(friend) fun update_cache(updates: vector<PriceInfo>) {
while (!vector::is_empty(&updates)) {
let update = vector::pop_back(&mut updates);
if (is_fresh_update(&update)) {
let price_feed = *price_info::get_price_feed(&update);
let price_identifier = price_feed::get_price_identifier(&price_feed);
state::set_latest_price_info(
*price_identifier,
update,
);
event::emit_price_feed_update(price_feed, timestamp::now_microseconds());
}
};
vector::destroy_empty(updates);
}

Upgrade pyth sui sdk to use latest sui.js

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):

  • JsonRpcProvider has been deprecated
  • the sui.js sdk has been broken down into smaller modules
  • the bcs library also seems to be pretty different

Pyth EVM contract should accept prices outside of min/max timestamp if none were available within

In the following section, the Pyth contract checks for the validity of the provided price update:

if (
publishTime >= config.minPublishTime &&
publishTime <= config.maxPublishTime &&
(!config.checkUniqueness ||
config.minPublishTime > prevPublishTime)
) {
fillPriceFeedFromPriceInfo(
priceFeeds,
k,
priceId,
info,
publishTime
);
}

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.

status page for pyth.network

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

price pusher Error: gas required exceeds allowance

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

Ethereum OracleSwap exmaple package issue

When I tried to run the app frontend, it said cannot find module '@pythnetwork/pyth-evm-js' or its corresponding type declarations. as the pyth-evm-js has been moved to pyth-crosschain, which package should I change to?

Screenshot 2023-05-23 at 4 47 46 PM

contract dependency about wormhole

local = "../../../../wormhole/sui/wormhole"

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.

Price publisher address on zkSync goerli testnet seems to be outdated

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?

Improve pyth2wormhole deployment

After we've successfully deployed pyth2wormhole into devnet and mainnet, it's time for some maintenance.

  1. Migrate K8s deployment to a Helm chart
  2. Move env variables to a config file
  3. Docker image shouldn't run as a root user, instead add a pyth account
  4. Move Github Action to use caching (currently build takes 30m)
  5. Attest may use only a python image rather than a complete Solana image. This should reduce the image size and its blast radius
  6. Monitor balance using pyth-observer
  7. Improve logging handlers
  8. Include git SHA in image tag

How to decode price info from VAA returned by Hermes API?

Hermes provides two APIs to return VAA.

I decode VAA returned by /api/get_vaaand 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 = "AQAAAAMNADrd3uvPmeTpxEank33LJTq0aCXgzI0IU0tOqNW4uEE9YlXzuzIJmjkp5hgEuGo5DJEe8ZDnVIwAblxc1t5Fn94BArPF7O4rGOXc2D19Wk7GU201txV0dLQOgcwtEUbTKAQBM+9yftjYDqreTC7lwk7O9d+IgioMVY7U+5irD6fHHQIAA7e5KincW1lyUK55U8ZVGl0wRmgLVFg/OBO/cbttPwR8WS/Cm5sVSLymeDqooJojuIcBTth9N/IdlcMfAgAC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oc3////4AAAABaURYFwAAAAAAN2PvwEAAAAaAAAAHgAAAABkxCcBAAAAAGTEJwEAAAAAZMQnAAAAAAWmXdkOAAAAAADWoc0AAAAAZMQm/0jWAz1zPieVDC4DUeJQVJHNkVSCT3FtlRNRTHS5+Y9YPdK2NoakUOxykN86HgtYPASB9lE1Ht+nY285rtVc+KMAAAAFpjBJwgAAAAAA5Je+////+AAAAAWlu3CwAAAAAADZuk8BAAAAHQAAACAAAAAAZMQnAQAAAABkxCcBAAAAAGTEJwAAAAAFpjBJwgAAAAAA5Je+AAAAAGTEJwA1FbOGHo/pPl9UC6QHfCFkBHgrhtXngHezy/0nMTqzvOYt9si0qF/hpn20TcEt5dszD3rGa3LcZYr+3w9KQVtDAAACqqjJ5uAAAAAAJ5exAv////gAAAKqIfaFYAAAAAAlSPCIAQAAABsAAAAgAAAAAGTEJwEAAAAAZMQnAQAAAABkxCcAAAACqqjJ5uAAAAAAJ5exAgAAAABkxCcAm19z4AdefXA3YBIYDdupQnL2jYXq5BBOM1VhyYIlPUGhnQSsaWx6ZhbSkcfl0Td8yL5DfDJ7da213ButdF/K6AAAAAAEV20rAAAAAAABxsz////4AAAAAARUUlEAAAAAAAGnwwEAAAAVAAAAFgAAAABkxCcBAAAAAGTEJwEAAAAAZMQnAAAAAAAEV20rAAAAAAABxswAAAAAZMQnAOh2/NEwrdiYSjOqtSrza8G5+CLJ6+N286py1jCXThXw3O9Q3QpM0tzBfkXfFnbcszahGmHGnfegKZsBUMZy0lwAAAAAAHZnkQAAAAAAABKZ////+AAAAAAAdfseAAAAAAAAEV0BAAAAHAAAACAAAAAAZMQnAQAAAABkxCcBAAAAAGTEJwAAAAAAAHZm3AAAAAAAABcjAAAAAGTEJwA=";
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+bh24zSAAcFED6AArnts8J+xGTgC2jCkD8fto4LctwzP76K323e68Hc+zFfEoaVSRyagpUcuOQTthV25z3zWbqXsrhOlB1tMRZorg+AQzx/O+sc1NQS5OsaJS5QlZ+yg6wYnCyud2YGYGx4gEZGgnMn0brM3ziXF67owwEMNTIpbF0TEr9bJwBKS4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SSDFOhXmweeej8shBGQ4J2St5S8nOXu/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?

OOM

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)

CI Run tests

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.

evm-watcher: Logging multiple call to `updatePriceFeeds` doesn't work.

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.

:bug: chore: the wormhole's package id for Sui's testnet is wrong in the documentation

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

p2w-terra-relay: Re-evaluate retry logic/multi-message relaying

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.

Install the ethereum contract error: lerna ERR! ECONFIGWORKSPACES The "useWorkspaces" option has been removed.

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$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.