Переглянути джерело

fix(lazer): add proper aggregated data type to state proto (#3128)

* feat(lazer): add all aggregate fields to state proto

* refactor(lazer): separate publisher and aggregated update types

* chore: remove unnecessary funding timestamp field

* chore: bump version
Pavel Strakhov 1 місяць тому
батько
коміт
1dd2aaae6b
3 змінених файлів з 32 додано та 18 видалено
  1. 6 6
      Cargo.lock
  2. 25 11
      lazer/publisher_sdk/proto/state.proto
  3. 1 1
      lazer/publisher_sdk/rust/Cargo.toml

+ 6 - 6
Cargo.lock

@@ -5675,7 +5675,7 @@ dependencies = [
  "hyper-util",
  "protobuf",
  "pyth-lazer-protocol 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pyth-lazer-publisher-sdk 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pyth-lazer-publisher-sdk 0.16.1",
  "reqwest 0.12.23",
  "serde",
  "serde_json",
@@ -5773,26 +5773,26 @@ dependencies = [
 [[package]]
 name = "pyth-lazer-publisher-sdk"
 version = "0.16.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12646e85d41937fc87c0c5f6692a501ae4f261a58ce52556883af3ee034f391c"
 dependencies = [
  "anyhow",
  "fs-err",
  "protobuf",
  "protobuf-codegen",
- "pyth-lazer-protocol 0.18.1",
+ "pyth-lazer-protocol 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json",
 ]
 
 [[package]]
 name = "pyth-lazer-publisher-sdk"
-version = "0.16.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12646e85d41937fc87c0c5f6692a501ae4f261a58ce52556883af3ee034f391c"
+version = "0.17.0"
 dependencies = [
  "anyhow",
  "fs-err",
  "protobuf",
  "protobuf-codegen",
- "pyth-lazer-protocol 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pyth-lazer-protocol 0.18.1",
  "serde_json",
 ]
 

+ 25 - 11
lazer/publisher_sdk/proto/state.proto

@@ -117,8 +117,7 @@ message Feed {
     // [required] Feed kind.
     optional FeedKind kind = 108;
     // [required] Current aggregated data of the feed.
-    optional FeedDataFields aggregated_data = 109;
-
+    optional FeedAggregateData aggregated_data = 109;
 
     // [required] Feed status in the current shard. Disabled feeds will not be visible in
     // the consumer API for the current shard. This setting should only be used
@@ -136,8 +135,6 @@ message Feed {
     // [optional] If present, the aggregator will disable the feed in the current shard
     // at the specified instant.
     optional google.protobuf.Timestamp disable_in_shard_timestamp = 203;
-
-    // TODO: list of permissioned publisher IDs.
 }
 
 // A part of the feed state related to a particular publisher.
@@ -154,21 +151,30 @@ message FeedPublisherState {
     optional google.protobuf.Timestamp last_publisher_timestamp = 3;
     // [optional] Data of the last update received from this publisher to this feed.
     // Can be absent if no update was ever received or if the last update was deemed no longer relevant.
-    optional FeedData last_feed_data = 4;
+    optional FeedPublisherData last_feed_data = 4;
 }
 
 // Data provided by a publisher for a certain feed.
-message FeedData {
+message FeedPublisherData {
+    // [optional] Best executable price. Can be absent if no data is available. Never present for funding rate feeds.
+    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 = 2;
+    // [optional] Best ask price. Can be absent if no data is available. Never present for funding rate feeds.
+    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 = 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 = 5;
     // [required] Timestamp provided by the source of data that the publisher uses (e.g. an exchange).
     // If no such timestamp is available, it should be set to the same value as `publisher_timestamp`.
-    optional google.protobuf.Timestamp source_timestamp = 1;
+    optional google.protobuf.Timestamp source_timestamp = 6;
     // [required] Timestamp of the publisher.
-    optional google.protobuf.Timestamp publisher_timestamp = 2;
-    // [required] Values of the data fields.
-    optional FeedDataFields fields = 3;
+    optional google.protobuf.Timestamp publisher_timestamp = 7;
 }
 
-message FeedDataFields {
+// Aggregate data derived from all accepted publisher updates.
+message FeedAggregateData {
     // [optional] Best executable price. Can be absent if no data is available. Never present for funding rate feeds.
     optional int64 price = 1;
     // [optional] Best bid price. Can be absent if no data is available. Never present for funding rate feeds.
@@ -179,6 +185,14 @@ message FeedDataFields {
     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 = 5;
+    // [optional] Timestamp of the funding. Can be absent if no data is available.
+    // Can only be present for funding rate feeds.
+    optional google.protobuf.Timestamp funding_timestamp = 6;
+    // [required] Number of publishers that were included in the aggregate.
+    optional uint64 publisher_count = 7;
+    // [optional] Confidence interval for the `price` field. Can be absent if no data is available.
+    // Never present for funding rate feeds.
+    optional int64 confidence = 8;
 }
 
 // State associated with a governance source.

+ 1 - 1
lazer/publisher_sdk/rust/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "pyth-lazer-publisher-sdk"
-version = "0.16.1"
+version = "0.17.0"
 edition = "2021"
 description = "Pyth Lazer Publisher SDK types."
 license = "Apache-2.0"