Skip to content

feat(lazer): add ignoreInvalidFeedIds flag to SDK #2529

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

Merged
merged 19 commits into from
Mar 31, 2025

Conversation

devin-ai-integration[bot]
Copy link
Contributor

This PR adds the ignoreInvalidFeedIds flag to the Lazer SDK to support the new feature in the Pyth Lazer router. When this flag is set to true, subscriptions will proceed with valid feeds and ignore invalid ones, returning categorized lists of successful and failed feeds.

Per user @darun Seethammagari (darun@dourolabs.xyz)'s request.

Link to Devin run: https://app.devin.ai/sessions/050e512b13ce4953bdcc8c4a2407c861

devin-ai-integration bot and others added 4 commits March 27, 2025 17:52
Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
Copy link

vercel bot commented Mar 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2025 2:35pm
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Visit Preview Mar 31, 2025 2:35pm
component-library ⬜️ Ignored (Inspect) Visit Preview Mar 31, 2025 2:35pm
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Mar 31, 2025 2:35pm
insights ⬜️ Ignored (Inspect) Visit Preview Mar 31, 2025 2:35pm
staking ⬜️ Ignored (Inspect) Visit Preview Mar 31, 2025 2:35pm

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@@ -47,6 +48,12 @@ export type JsonBinaryData = {
data: string;
};

export type FailedFeedsDetails = {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggest renaming this to InvalidFeedSubscriptionDetails

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
export type InvalidFeedSubscriptionDetails = {
unknownIds: number[];
unsupportedChannels: number[];
comingSoon: number[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Keeping with the main PR, can you change this to "unstable"?

…ails

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
@@ -50,6 +52,10 @@ pub enum Response {
#[serde(rename_all = "camelCase")]
pub struct SubscribedResponse {
pub subscription_id: SubscriptionId,
#[serde(skip_serializing_if = "Option::is_none")]
pub successful_feeds: Option<Vec<u64>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to a vec of u32

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
@@ -56,6 +63,12 @@ export type Response =
type: "subscribed";
subscriptionId: number;
}
| {
type: "subscribedWithIgnoredFailures";
Copy link
Contributor

Choose a reason for hiding this comment

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

Err sorry let's actually do "subscribedWithInvalidFeeds" instead.

…idFeeds

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
@@ -56,6 +63,12 @@ export type Response =
type: "subscribed";
subscriptionId: number;
}
| {
type: "subscribedWithInvalidFeeds";
Copy link
Contributor

@darunrs darunrs Mar 28, 2025

Choose a reason for hiding this comment

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

one last rename. Let's call this "subscribedWithInvalidFeedIdsIgnored".

@@ -50,6 +52,10 @@ pub enum Response {
#[serde(rename_all = "camelCase")]
pub struct SubscribedResponse {
Copy link
Contributor

@darunrs darunrs Mar 28, 2025

Choose a reason for hiding this comment

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

SubscribedResponse should be unchanged. Add a new struct called SubscribedWithInvalidFeedIdsIgnored. It should match the new structure that is in the JS protocol.

devin-ai-integration bot and others added 2 commits March 28, 2025 18:45
…nvalidFeedIds

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
Comment on lines 69 to 70
successfulFeeds: number[];
failedFeeds: InvalidFeedSubscriptionDetails;
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename successfulFeeds to "subscribedFeedIds" and rename failedFeeds to "ignoredInvalidFeedIds"

pub struct SubscribedWithInvalidFeedIdsIgnoredResponse {
pub subscription_id: SubscriptionId,
pub successful_feeds: Vec<u32>,
pub failed_feeds: serde_json::Value,
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a struct for the failed_feeds called InvalidFeedSubscriptionDetails with the same equivalent type as the JS protocol version. Also, rename successful_feeds to "subscribed_feed_ids" and rename failed_feeds to "ignored_invalid_feed_ids".

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
@@ -40,6 +42,7 @@ pub struct UnsubscribeRequest {
pub enum Response {
Error(ErrorResponse),
Subscribed(SubscribedResponse),
SubscribedWithIgnoredInvalidFeedIds(SubscribedWithInvalidFeedIdsIgnoredResponse),
Copy link
Contributor

Choose a reason for hiding this comment

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

Name this "SubscribedWithInvalidFeedIdsIgnored". The response is named correctly.

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
@darunrs
Copy link
Contributor

darunrs commented Mar 28, 2025

The ignore_invalid_feed_ids field needs to be a part of the SubscriptionParams struct.

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
@@ -358,6 +358,8 @@ pub struct SubscriptionParamsRepr {
#[serde(default = "default_parsed")]
pub parsed: bool,
pub channel: Channel,
#[serde(default)]
pub ignore_invalid_feed_ids: Option<bool>,
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no point to this being an option. Make it a bool and the serde default should default to false. Customers using the old version should submit the old SubscriptionParams struct and it should be deserialized in the Lazer service, defaulting the ignore field if not present.

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
@darunrs darunrs requested a review from tejasbadadare March 29, 2025 00:06
Copy link
Contributor

@merolish merolish left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Contributor Author

Yes, these are lists of feed IDs categorized by error type:

  • unknownIds: Feed IDs that don't exist in the system
  • unsupportedChannels: Feed IDs that don't support the requested channel
  • unstable: Feed IDs marked as "Coming Soon" (unstable feeds)

This categorization provides better customer UX by giving specific information about why each feed ID failed, rather than just a generic error.

Comment on lines 59 to 61
pub unknown_ids: Vec<u32>,
pub unsupported_channels: Vec<u32>,
pub unstable: Vec<u32>,
Copy link
Contributor

Choose a reason for hiding this comment

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

These fields should use PriceFeedId and Channel types.

#[serde(rename_all = "camelCase")]
pub struct SubscribedWithInvalidFeedIdsIgnoredResponse {
pub subscription_id: SubscriptionId,
pub subscribed_feed_ids: Vec<u32>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub subscribed_feed_ids: Vec<u32>,
pub subscribed_feed_ids: Vec<PriceFeedId>,

Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
devin-ai-integration bot and others added 2 commits March 31, 2025 09:58
Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
Co-Authored-By: Darun Seethammagari <darun@dourolabs.xyz>
@darunrs darunrs merged commit ba09a52 into main Mar 31, 2025
11 checks passed
@darunrs darunrs deleted the devin/1743097867-ignore-invalid-feed-ids branch March 31, 2025 19:18
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.

4 participants