Skip to content

lazer/sui: Update V2 API#3680

Draft
matej-douro wants to merge 5 commits into
mainfrom
matej/sui-lazer-channel-v2
Draft

lazer/sui: Update V2 API#3680
matej-douro wants to merge 5 commits into
mainfrom
matej/sui-lazer-channel-v2

Conversation

@matej-douro
Copy link
Copy Markdown
Contributor

@matej-douro matej-douro commented May 12, 2026

Summary

Adds V2 version of API, including support for fixed_rate@1000ms channel ID.

Rationale

As we need to extend Channel type to support the new variant, and it is currently a Sui enum, we will need to release a new API alongside the existing one to pass upgrade checks on-chain. To avoid the same problem in the future, new Channel type is a wrapped integer, following MarketSession convention. Old API will be deprecated, moving as much internal logic into V2 as possible.

Notes

At some point we may decide to replace V1 exports with failing stubs, but right now we'll keep supporting existing contracts that use V1. In case of future redeploy, we should use the opportunity to remove old API completely.

TODOs

  • devnet upgrade test
  • testnet upgrade & validation

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-reference Ready Ready Preview, Comment May 14, 2026 7:51am
component-library Ready Ready Preview, Comment May 14, 2026 7:51am
developer-hub Ready Ready Preview, Comment May 14, 2026 7:51am
entropy-explorer Ready Ready Preview, Comment May 14, 2026 7:51am
insights Ready Ready Preview, Comment May 14, 2026 7:51am
proposals Ready Ready Preview, Comment May 14, 2026 7:51am
staking Ready Ready Preview, Comment May 14, 2026 7:51am

Request Review

Copy link
Copy Markdown
Contributor

@tejasbadadare tejasbadadare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

Comment on lines +137 to +142
let update = parse_and_verify_le_ecdsa_update_v2(&state, &clock, TEST_LAZER_UPDATE);

// If we reach this point, the function successfully verified & parsed the payload (no assertion failures)
// Validate that the fields have correct values
assert_eq!(update.timestamp(), 1771252161800000);
assert!(update.channel().is_fixed_rate_200ms());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a fixed_rate@1000ms update in this test to validate that ChannelV2 works?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do 👍

@linear
Copy link
Copy Markdown

linear Bot commented May 12, 2026

PFC-249

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

tx.pure.vector("u8", update),
],
target: `${id}::pyth_lazer::parse_and_verify_le_ecdsa_update`,
target: `${id}::pyth_lazer::parse_and_verify_le_ecdsa_update_v2`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 SDK breaking change: return type changes from update::Update to update_v2::Update

The SDK function addParseAndVerifyLeEcdsaUpdateCall at lazer/contracts/sui/sdk/js/src/index.ts:18 now calls parse_and_verify_le_ecdsa_update_v2 instead of parse_and_verify_le_ecdsa_update. This changes the on-chain return type from pyth_lazer::update::Update to pyth_lazer::update_v2::Update. Any existing deployed consumer smart contracts that accept update::Update as a parameter will fail at transaction execution time when used with the updated SDK, because the types are incompatible on-chain. The package version at lazer/contracts/sui/sdk/js/package.json:59 remains 0.3.0 and was not bumped despite this being a breaking change. Per REVIEW.md guidelines, public packages with changes should have their version bumped — suggest a minor bump to 0.4.0 (since semver 0.x allows breaking changes in minor versions).

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants