Skip to content

Conversation

@devin-ai-integration
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 ([email protected])'s request.

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

@vercel
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

@devin-ai-integration
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

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

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"?

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

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.

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

/// Sent from the server after a successul subscription.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[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.

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

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.

@darunrs
Copy link
Contributor

darunrs commented Mar 28, 2025

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

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.

@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!

@devin-ai-integration
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>,

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

5 participants