Skip to content

Commit 6c32e6c

Browse files
authored
feat(lazer): add allowed feeds per publisher, aggregated prices and feature flags to state (#3019)
* feat(lazer): add allowed feeds per publisher and feature flags to state * feat(lazer): add allowed_feed_ids to AddPublisher, bump pyth-lazer-publisher-sdk version
1 parent 4213d78 commit 6c32e6c

File tree

4 files changed

+60
-7
lines changed

4 files changed

+60
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazer/publisher_sdk/proto/governance_instruction.proto

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ message GovernanceInstructionItem {
9393
AddFeed add_feed = 111;
9494
UpdateFeed update_feed = 112;
9595
RemoveFeed remove_feed = 113;
96+
AddFeatureFlag add_feature_flag = 114;
97+
RemoveFeatureFlag remove_feature_flag = 115;
9698
}
9799
}
98100

@@ -174,6 +176,8 @@ message AddPublisher {
174176
repeated bytes public_keys = 3;
175177
// [required] If true, the publisher is active, i.e. it's allowed to publish updates.
176178
optional bool is_active = 4;
179+
// IDs of the feeds for which the publisher's price will be included in the aggregate.
180+
repeated uint32 allowed_feed_ids = 5;
177181
}
178182

179183
message UpdatePublisher {
@@ -187,6 +191,9 @@ message UpdatePublisher {
187191
RemovePublisherPublicKeys remove_publisher_public_keys = 103;
188192
SetPublisherPublicKeys set_publisher_public_keys = 104;
189193
SetPublisherActive set_publisher_active = 105;
194+
AddPublisherAllowedFeedIds add_publisher_allowed_feed_ids = 106;
195+
RemovePublisherAllowedFeedIds remove_publisher_allowed_feed_ids = 107;
196+
SetPublisherAllowedFeedIds set_publisher_allowed_feed_ids = 108;
190197
}
191198
}
192199

@@ -217,6 +224,24 @@ message SetPublisherPublicKeys {
217224
repeated bytes public_keys = 1;
218225
}
219226

227+
// Allow publisher to publish for the specified feeds.
228+
message AddPublisherAllowedFeedIds {
229+
// Must not be empty.
230+
repeated bytes allowed_feed_ids_to_add = 1;
231+
}
232+
233+
// Disallow publisher to publish for the specified feeds.
234+
message RemovePublisherAllowedFeedIds {
235+
// Must not be empty.
236+
repeated bytes allowed_feed_ids_to_remove = 1;
237+
}
238+
239+
// Allow publisher to publish for only the specified feeds.
240+
// Remove all previous allowances.
241+
message SetPublisherAllowedFeedIds {
242+
repeated bytes allowed_feed_ids = 1;
243+
}
244+
220245
message SetPublisherActive {
221246
// [required]
222247
optional bool is_active = 1;
@@ -326,3 +351,15 @@ message DisableFeedInShard {
326351
// governance instruction is processed.
327352
optional google.protobuf.Timestamp disable_in_shard_timestamp = 1;
328353
}
354+
355+
// Add a new feature flag.
356+
message AddFeatureFlag {
357+
// [required] Feature flag to add.
358+
optional string feature_flag = 1;
359+
}
360+
361+
// Remove a feature flag.
362+
message RemoveFeatureFlag {
363+
// [required] Feature flag to remove.
364+
optional string feature_flag = 1;
365+
}

lazer/publisher_sdk/proto/state.proto

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ message State {
4646
repeated Publisher publishers = 8;
4747
// List of governance sources.
4848
repeated GovernanceSourceState governance_sources = 9;
49+
// Currently active feature flags. Feature flags influence the aggregator's behavior.
50+
repeated string feature_flags = 10;
4951
}
5052

5153
// An item of the state describing a publisher.
@@ -58,6 +60,8 @@ message Publisher {
5860
repeated bytes public_keys = 3;
5961
// [required] If true, the publisher is active, i.e. it's allowed to publish updates.
6062
optional bool is_active = 4;
63+
// IDs of the feeds for which the publisher's price will be included in the aggregate.
64+
repeated uint32 allowed_feed_ids = 5;
6165
}
6266

6367
enum FeedState {
@@ -112,6 +116,8 @@ message Feed {
112116
optional FeedState state = 107;
113117
// [required] Feed kind.
114118
optional FeedKind kind = 108;
119+
// [required] Current aggregated data of the feed.
120+
optional FeedDataFields aggregated_data = 109;
115121

116122

117123
// [required] Feed status in the current shard. Disabled feeds will not be visible in
@@ -158,16 +164,21 @@ message FeedData {
158164
optional google.protobuf.Timestamp source_timestamp = 1;
159165
// [required] Timestamp of the publisher.
160166
optional google.protobuf.Timestamp publisher_timestamp = 2;
167+
// [required] Values of the data fields.
168+
optional FeedDataFields fields = 3;
169+
}
170+
171+
message FeedDataFields {
161172
// [optional] Best executable price. Can be absent if no data is available. Never present for funding rate feeds.
162-
optional int64 price = 3;
173+
optional int64 price = 1;
163174
// [optional] Best bid price. Can be absent if no data is available. Never present for funding rate feeds.
164-
optional int64 best_bid_price = 4;
175+
optional int64 best_bid_price = 2;
165176
// [optional] Best ask price. Can be absent if no data is available. Never present for funding rate feeds.
166-
optional int64 best_ask_price = 5;
177+
optional int64 best_ask_price = 3;
167178
// [optional] Funding rate. Can be absent if no data is available. Can only be present for funding rate feeds.
168-
optional int64 funding_rate = 6;
179+
optional int64 funding_rate = 4;
169180
// [optional] Funding rate interval. Can be absent if no data is available. Can only be present for funding rate feeds.
170-
optional google.protobuf.Duration funding_rate_interval = 7;
181+
optional google.protobuf.Duration funding_rate_interval = 5;
171182
}
172183

173184
// State associated with a governance source.
@@ -206,6 +217,8 @@ message Permissions {
206217
// including operations added in the future.
207218
UPDATE_FEED = 112;
208219
REMOVE_FEED = 113;
220+
ADD_FEATURE_FLAG = 114;
221+
REMOVE_FEATURE_FLAG = 115;
209222
}
210223

211224
enum UpdateGovernanceSourceAction {
@@ -222,6 +235,9 @@ message Permissions {
222235
REMOVE_PUBLISHER_PUBLIC_KEYS = 103;
223236
SET_PUBLISHER_PUBLIC_KEYS = 104;
224237
SET_PUBLISHER_ACTIVE = 105;
238+
ADD_PUBLISHER_ALLOWED_FEED_IDS = 106;
239+
REMOVE_PUBLISHER_ALLOWED_FEED_IDS = 107;
240+
SET_PUBLISHER_ALLOWED_FEED_IDS = 108;
225241
}
226242

227243
enum UpdateFeedAction {

lazer/publisher_sdk/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-lazer-publisher-sdk"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
edition = "2021"
55
description = "Pyth Lazer Publisher SDK types."
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)