Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions lazer/publisher_sdk/proto/governance_instruction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -174,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 {
Expand All @@ -187,6 +191,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;
}
}

Expand Down Expand Up @@ -217,6 +224,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;
Expand Down Expand Up @@ -326,3 +351,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;
}
26 changes: 21 additions & 5 deletions lazer/publisher_sdk/proto/state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

i was wondering which one makes more sense, allowed_feed_ids per publishers or allowed_pub_ids per price feeds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a symmetric many-to-many relationship, so it's fine in either case. In the memory representation we can also reverse it if needed. Having a property on publisher makes governance actions look more natural.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like line 140 anticipated it being added in Feed, outdated now:
// TODO: list of permissioned publisher IDs.

}

enum FeedState {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lazer/publisher_sdk/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down