From afe7a58995237b0376746bdbddfa2cde5905fa88 Mon Sep 17 00:00:00 2001 From: Pavel Strakhov Date: Thu, 4 Sep 2025 12:47:21 +0100 Subject: [PATCH 1/2] feat(lazer): add allowed feeds per publisher and feature flags to state --- .../proto/governance_instruction.proto | 35 +++++++++++++++++++ lazer/publisher_sdk/proto/state.proto | 26 +++++++++++--- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/lazer/publisher_sdk/proto/governance_instruction.proto b/lazer/publisher_sdk/proto/governance_instruction.proto index e4d3c1fb08..2e0e7b768c 100644 --- a/lazer/publisher_sdk/proto/governance_instruction.proto +++ b/lazer/publisher_sdk/proto/governance_instruction.proto @@ -93,6 +93,8 @@ message GovernanceInstructionItem { AddFeed add_feed = 111; UpdateFeed update_feed = 112; RemoveFeed remove_feed = 113; + AddFeatureFlag add_feature_flag = 114; + RemoveFeatureFlag remove_feature_flag = 115; } } @@ -187,6 +189,9 @@ message UpdatePublisher { RemovePublisherPublicKeys remove_publisher_public_keys = 103; SetPublisherPublicKeys set_publisher_public_keys = 104; SetPublisherActive set_publisher_active = 105; + AddPublisherAllowedFeedIds add_publisher_allowed_feed_ids = 106; + RemovePublisherAllowedFeedIds remove_publisher_allowed_feed_ids = 107; + SetPublisherAllowedFeedIds set_publisher_allowed_feed_ids = 108; } } @@ -217,6 +222,24 @@ message SetPublisherPublicKeys { repeated bytes public_keys = 1; } +// Allow publisher to publish for the specified feeds. +message AddPublisherAllowedFeedIds { + // Must not be empty. + repeated bytes allowed_feed_ids_to_add = 1; +} + +// Disallow publisher to publish for the specified feeds. +message RemovePublisherAllowedFeedIds { + // Must not be empty. + repeated bytes allowed_feed_ids_to_remove = 1; +} + +// Allow publisher to publish for only the specified feeds. +// Remove all previous allowances. +message SetPublisherAllowedFeedIds { + repeated bytes allowed_feed_ids = 1; +} + message SetPublisherActive { // [required] optional bool is_active = 1; @@ -326,3 +349,15 @@ message DisableFeedInShard { // governance instruction is processed. optional google.protobuf.Timestamp disable_in_shard_timestamp = 1; } + +// Add a new feature flag. +message AddFeatureFlag { + // [required] Feature flag to add. + optional string feature_flag = 1; +} + +// Remove a feature flag. +message RemoveFeatureFlag { + // [required] Feature flag to remove. + optional string feature_flag = 1; +} diff --git a/lazer/publisher_sdk/proto/state.proto b/lazer/publisher_sdk/proto/state.proto index 383aefc3d8..438ee01308 100644 --- a/lazer/publisher_sdk/proto/state.proto +++ b/lazer/publisher_sdk/proto/state.proto @@ -46,6 +46,8 @@ message State { repeated Publisher publishers = 8; // List of governance sources. repeated GovernanceSourceState governance_sources = 9; + // Currently active feature flags. Feature flags influence the aggregator's behavior. + repeated string feature_flags = 10; } // An item of the state describing a publisher. @@ -58,6 +60,8 @@ message Publisher { repeated bytes public_keys = 3; // [required] If true, the publisher is active, i.e. it's allowed to publish updates. optional bool is_active = 4; + // IDs of the feeds for which the publisher's price will be included in the aggregate. + repeated uint32 allowed_feed_ids = 5; } enum FeedState { @@ -112,6 +116,8 @@ message Feed { optional FeedState state = 107; // [required] Feed kind. optional FeedKind kind = 108; + // [required] Current aggregated data of the feed. + optional FeedDataFields aggregated_data = 109; // [required] Feed status in the current shard. Disabled feeds will not be visible in @@ -158,16 +164,21 @@ message FeedData { optional google.protobuf.Timestamp source_timestamp = 1; // [required] Timestamp of the publisher. optional google.protobuf.Timestamp publisher_timestamp = 2; + // [required] Values of the data fields. + optional FeedDataFields fields = 3; +} + +message FeedDataFields { // [optional] Best executable price. Can be absent if no data is available. Never present for funding rate feeds. - optional int64 price = 3; + optional int64 price = 1; // [optional] Best bid price. Can be absent if no data is available. Never present for funding rate feeds. - optional int64 best_bid_price = 4; + optional int64 best_bid_price = 2; // [optional] Best ask price. Can be absent if no data is available. Never present for funding rate feeds. - optional int64 best_ask_price = 5; + optional int64 best_ask_price = 3; // [optional] Funding rate. Can be absent if no data is available. Can only be present for funding rate feeds. - optional int64 funding_rate = 6; + optional int64 funding_rate = 4; // [optional] Funding rate interval. Can be absent if no data is available. Can only be present for funding rate feeds. - optional google.protobuf.Duration funding_rate_interval = 7; + optional google.protobuf.Duration funding_rate_interval = 5; } // State associated with a governance source. @@ -206,6 +217,8 @@ message Permissions { // including operations added in the future. UPDATE_FEED = 112; REMOVE_FEED = 113; + ADD_FEATURE_FLAG = 114; + REMOVE_FEATURE_FLAG = 115; } enum UpdateGovernanceSourceAction { @@ -222,6 +235,9 @@ message Permissions { REMOVE_PUBLISHER_PUBLIC_KEYS = 103; SET_PUBLISHER_PUBLIC_KEYS = 104; SET_PUBLISHER_ACTIVE = 105; + ADD_PUBLISHER_ALLOWED_FEED_IDS = 106; + REMOVE_PUBLISHER_ALLOWED_FEED_IDS = 107; + SET_PUBLISHER_ALLOWED_FEED_IDS = 108; } enum UpdateFeedAction { From 981d61410af6d5c9a03f1192773c958bbaa8126c Mon Sep 17 00:00:00 2001 From: Pavel Strakhov Date: Thu, 4 Sep 2025 15:33:05 +0100 Subject: [PATCH 2/2] feat(lazer): add allowed_feed_ids to AddPublisher, bump pyth-lazer-publisher-sdk version --- Cargo.lock | 2 +- lazer/publisher_sdk/proto/governance_instruction.proto | 2 ++ lazer/publisher_sdk/rust/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 883bc86f0b..30a916f3de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5761,7 +5761,7 @@ dependencies = [ [[package]] name = "pyth-lazer-publisher-sdk" -version = "0.9.0" +version = "0.10.0" dependencies = [ "anyhow", "fs-err", diff --git a/lazer/publisher_sdk/proto/governance_instruction.proto b/lazer/publisher_sdk/proto/governance_instruction.proto index 2e0e7b768c..7ae892dfe4 100644 --- a/lazer/publisher_sdk/proto/governance_instruction.proto +++ b/lazer/publisher_sdk/proto/governance_instruction.proto @@ -176,6 +176,8 @@ message AddPublisher { repeated bytes public_keys = 3; // [required] If true, the publisher is active, i.e. it's allowed to publish updates. optional bool is_active = 4; + // IDs of the feeds for which the publisher's price will be included in the aggregate. + repeated uint32 allowed_feed_ids = 5; } message UpdatePublisher { diff --git a/lazer/publisher_sdk/rust/Cargo.toml b/lazer/publisher_sdk/rust/Cargo.toml index 522ad3ce71..329486c12c 100644 --- a/lazer/publisher_sdk/rust/Cargo.toml +++ b/lazer/publisher_sdk/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyth-lazer-publisher-sdk" -version = "0.9.0" +version = "0.10.0" edition = "2021" description = "Pyth Lazer Publisher SDK types." license = "Apache-2.0"