-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(solana-receiver-js-sdk): verify & post TWAPs #2186
feat(solana-receiver-js-sdk): verify & post TWAPs #2186
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
…b/solana-receiver-js-sdk/post-twap-updates
postTwapUpdates
function
…b/solana-receiver-js-sdk/post-twap-updates
postTwapUpdates
function…b/solana-receiver-js-sdk/post-twap-updates
interface VaaInstructionGroups { | ||
initInstructions: InstructionWithEphemeralSigners[]; | ||
writeFirstPartInstructions: InstructionWithEphemeralSigners[]; | ||
writeSecondPartAndVerifyInstructions: InstructionWithEphemeralSigners[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe initInstructions
and writeFirstPartInstructions
could be in the same group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm yeah they can be consolidated. but i think for newcomers to the code, seeing them split out as (init, writeFirstPart, writeSecondPart) is a little conceptually clearer imo
Co-authored-by: guibescos <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tyvm
Purpose
Add
postTwapUpdates
and associated functions to the Solana Receiver JS SDK, which enables users to verify and post TWAP updates from Hermes to the Pyth Receiver contract on Solana. This allows the TWAPs to be consumed on-chain.Implementation details
This SDK uses the same instruction layout as in the rust CLI, which is implemented in
buildPostEncodedVaasForTwapInstructions
.Compared with the standard layout from
postPriceUpdates
(callingbuildPostEncodedVaaInstructions
twice for the the start & end VAAs), the new layout uses 1 less transaction and has more efficient packing.The IDL file that describes the receiver contract interface was manually updated to reflect the new
postTwapUpdate
function. We couldn't auto generate the new IDL because the account data models were moved from the receiver contract to the rust SDK at some point after the initial IDL was created. The new IDL wouldn't contain the necessary accounts.anchor-lang 0.30.0
, which introduced a new "build IDL via compilation" strategy, which allows them to pull in types from external crates (like our SDK) into the IDL. However, we are on anchor0.28.0
, and0.30.0
introduces several breaking changes. Critically, the wormhole SDKs have a hard dependency on0.28.0
. We could fork it and upgrade it to 0.30.0 ourselves to unblock our own upgrade path, but that would be a time consuming process.Misc: update README, tune CLI ix compute budgets, add example. Example relies on HermesClient update, coming soon.
Testing
Manually tested, no test suite for the JS SDK.