Can't Update Price Via Vscode

Hi guys, I updated the price of $BIO on the pyth base contract via basescan. However, when I try doing same via vscode via forking mainnet I get 0x6ce2251a can’t really pinpoint what custom error message this points to

address contractAddress = 0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a;

bytes32 id = 0xd9d22050e7413a16129f1334cd4dd5a359975ce16389cdadae8f677cf46e2839;

updateData[0] = "0x504e41550100000003b801000000040d00b68f0e892457b4821243f5e462d34a369aa4936a8d3b35037c1b6c8a04a9a36476cd1ebbc0a60311e688f20d8dfff6e5cdf42be5ad44a477aca283a7ff20047b0103f6e2adde8f037ca625a1e9f06774e5650015ee9ed08168a32df24e20bfcae1565c45fa34a3e2d25738c3c0380d1bf8c284b487a1efdb1961eb53652bdad16bd30104b2cd90492cd743dec95cddcc0788e1d512e76bb0586e3ebfe02a9ef0170fe82e753ee9e34fbe71741138aeb5e7fd75d686741ffe07e689d2168d6548048c796a01064c2ccd03540dfba573eb34c7ca333077bc5fc12479c17271f5f02af33bcd3a247489f96dced19002e0fe70b3b233a1b8e0d6b3afb1bd5c3bf2757d752c215beb0108b788192773f7aefd8c129f4a75cc5201fe95b12923e835a70b6c5bfbf495ba5a066b4b285d8e3a4cdddc074bf5ed51ada9ed58b1db07296bb3e47620c503b91a000ab4f1aac4759e568d7c0c6509e12884606f927877d94ea24de677fb7767668dc259cdfa5c1d0d16d98f3b887064f760ecca9ba7383cc400aadb46a2f0ae690873010bf44ca2f2afd564afcc8ffbabae88899aa1ac3544d4ad6cf60f99846ec9f865770a07c56d2e4920f9fea195ad3bd660e7adae1f2f56e7fb1e33ad7a1eb00950db000c2da910166d3f7c2e6279f02be39b41db3363bad3c72873cf39120463b848c10e7836bc9ea565c6e5835a743637c475a1135be7311e77cf7f840225590d5c7bd6010d3c78a02ef8dd6f3d8a2701789f45ec27588dafe5cda2cd25b45aed2ef9baa2591b8c4f69a9e4099b4d90df673205c31ade8a6ab52052232eda7e603db4ace9ab000e70e17715875c1e8a236b98526589996ae4beb59a83486d668f091eaf0ee97b5e040883d9a70f39d4d57df764c2f32e3d74dbe6d631a1b9c5a447f4215d20e123000fad5f138dd4b38f07869f943cf44264823a90ea8a771befa1261da63774a0db8a2dabaee1e2155bdc776c0bd12d7843cff28ad773f35a35e855d6df6cfb0f2b700010b535a6b2bbdf478c9728c3a9f9b1c32804647c080a1df804fc908565117082077bcd47d1e17d35be34fbf5c0525a50cc9e1f4ce5af016c7162983115e1bc39a6001164c30404a6b689db35a8a6bc703a028e892f85edce7b31d47af03abe0dbcb144371482c4a8124d719658bbfc421a54992c90ef067ee86358e56758097b56278b006800ad0700000000001ae101faedac5851e32b9b23b5f9411a8c2bac4aae3ed4dd7b811dd1a72ea4aa71000000000787dd08014155575600000000000c95591d0000271095471fe15e1ddf5bec8c9902a2500ab399234eb801005500d9d22050e7413a16129f1334cd4dd5a359975ce16389cdadae8f677cf46e2839000000000044ba93000000000000287cfffffff8000000006800ad07000000006800ad070000000000443e1f000000000000266b0c49e53a13b3b3971c21d9a0e56ee9feaadefaa34ab26512d48efe35fbc704fa0ce9621fc9128cbf6c1f2edad1d5d06d76e6676b4cc7db667adaa11b2c9ddea5a40c3d778a2d361ed1c9409c324ec3cc0433af297d5df786e55ba744a33daffc6419d50acfb52ac513900579bd9110db76c61895a15843327f80cb84744d47deb617a7f8c5c4747aeac357f25e3afe17b2fc377383f3038b5a6bb69aff71722f22f0b032cf24a73a6ac07644a51716321d59bb121d425dd1b8bc73e7dd2555bae4e9cda7cf1d308b26c638d09dc67bb4a4ed67fb394e909c086be03986b47541452a45bad230bb418744d47aa7f5af9eca;

Hi there @c-note thank you for your question!

It seems that you are directly feeding the price feed id to the updatePriceFeeds function.

But you should feed in the update data fetched from EvmPriceServiceConnection to this function. Take a look at our js sdk for some examples:

Give it a try and see if this works

Hello @0xcredence, thanks for your prompt response, the update data I used was gotten from Swagger UI which is were I got the update data I used to update the price via basescan which worked.

@c-note the error doesn’t seem to be related to Pyth and I suspect it is because forking doesn’t fork all the contracts properly (and I have faced it in the past too). Many contracts are used in this call: proxy and main contract for Pyth and proxy and main contract for Wormhole.

For testing I generally recommend using MockPyth contract so you can set your own prices and simulate your desired protocol behaviours with it.

@ali I tried interacting with mainnet via a script not forking the mainnet and still got same error

When you are not forking the contract doesn’t exist. You need to deploy MockPyth as setup phase of your testing and interact with it.

@ali I meant sent a tx via the mainnet paid for gas and all but failed with same error message gotten when I just forked mainnet.

My point is when I interact with fork-mainnet or base mainnet i still get same error message when I make this call via vscode. (But everything works well when I do this via basescan)

@c-note I see, in your code i suspect the fee is wrong. you need to pass the updateData to getUpdateFee method and not the price id.

If that’s not the problem, please send us a reproducible code snippet to run.

@ali The fee is correct, the returns fee as 1 Wei. Here you go

@c-note thanks for sharing this script as it helped a lot to troubleshoot it. The problem is that in forge assigning update data to bytes like that is not right. You need to use hex"deadbeef..." and by fixing it I could send the transaction successfully.

p.s: I found the error was about Wormhole saying the message format is invalid (see this) and it made me realize that the update data format was wrong.

@ali this fixed my issue thanks much.