Skip to content

Commit

Permalink
proto: add timestamp field to SubscribeUpdate message
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Jun 10, 2024
1 parent 44bc8e8 commit 1deefb6
Show file tree
Hide file tree
Showing 18 changed files with 963 additions and 38 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- 'master'
- 'v1.16'
- 'v1.17'
- 'v1.18'
tags:
- 'v*'
- 'tools-v*'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- 'master'
- 'v1.16'
- 'v1.17'
- 'v1.17-gamma'
- 'v1.18-gamma'
workflow_dispatch:

env:
Expand Down
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ The minor version will be incremented upon a breaking change and the patch versi

## 2024-02-06

- yellowstone-grpc-client-1.13.0+solana.1.17.20.gamma
- yellowstone-grpc-geyser-1.12.0+solana.1.17.20.gamma
- yellowstone-grpc-proto-1.12.0+solana.1.17.20.gamma
- yellowstone-grpc-tools-1.0.0-rc.9+solana.1.17.20.gamma

### Features

- proto: add `timestamp` field to `SubscribeUpdate` message

## 2024-02-06

- yellowstone-grpc-client-1.13.0+solana.1.17.20
- yellowstone-grpc-geyser-1.12.0+solana.1.17.20
- yellowstone-grpc-proto-1.12.0+solana.1.17.20
Expand Down Expand Up @@ -228,6 +239,17 @@ The minor version will be incremented upon a breaking change and the patch versi

- solana: update to 1.17.16 ([#274](https://github.com/rpcpool/yellowstone-grpc/pull/274))

## 2024-01-09

- yellowstone-grpc-client-1.13.0+solana.1.17.15.gamma
- yellowstone-grpc-geyser-1.12.0+solana.1.17.15.gamma
- yellowstone-grpc-proto-1.12.0+solana.1.17.15.gamma
- yellowstone-grpc-tools-1.0.0-rc.9+solana.1.17.15.gamma

### Features

- proto: add `timestamp` field to `SubscribeUpdate` message

## 2024-01-08

- yellowstone-grpc-client-1.13.0+solana.1.17.15
Expand All @@ -240,6 +262,17 @@ The minor version will be incremented upon a breaking change and the patch versi
- proto: add more convert functions ([#264](https://github.com/rpcpool/yellowstone-grpc/pull/264))
- geyser: set plugin name to `{name}-{version}` ([#270](https://github.com/rpcpool/yellowstone-grpc/pull/270))

## 2023-12-24

- yellowstone-grpc-client-1.13.0+solana.1.16.21
- yellowstone-grpc-geyser-1.12.0+solana.1.16.21
- yellowstone-grpc-proto-1.12.0+solana.1.16.21
- yellowstone-grpc-tools-1.0.0-rc.10+solana.1.16.21

### Features

- proto: add `timestamp` field to `SubscribeUpdate` message

## 2023-12-22

- yellowstone-grpc-client-1.12.0+solana.1.17.12
Expand Down
11 changes: 6 additions & 5 deletions Cargo.lock

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

15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[workspace]
resolver = "2"
members = [
"examples/rust", # 1.13.0+solana.1.18.15
"yellowstone-grpc-client", # 1.15.0+solana.1.18.15
"yellowstone-grpc-geyser", # 1.15.0+solana.1.18.15
"yellowstone-grpc-proto", # 1.14.0+solana.1.18.15
"yellowstone-grpc-tools", # 1.0.0-rc.11+solana.1.18.15
"examples/rust", # 1.13.0+solana.1.18.15.gamma
"yellowstone-grpc-client", # 1.15.0+solana.1.18.15.gamma
"yellowstone-grpc-geyser", # 1.15.0+solana.1.18.15.gamma
"yellowstone-grpc-proto", # 1.14.0+solana.1.18.15.gamma
"yellowstone-grpc-tools", # 1.0.0-rc.11+solana.1.18.15.gamma
]

[workspace.package]
Expand Down Expand Up @@ -48,6 +48,7 @@ log = "0.4.17"
maplit = "1.0.2"
prometheus = "0.13.2"
prost = "0.12.1"
prost-types = "0.12.1"
protobuf-src = "1.1.0"
rdkafka = "0.34.0"
scylla = "0.13.0"
Expand All @@ -72,8 +73,8 @@ tracing = "0.1.37"
tracing-subscriber = "0.3.17"
uuid = "1.8.0"
vergen = "8.2.1"
yellowstone-grpc-client = { path = "yellowstone-grpc-client", version = "=1.15.0+solana.1.18.15" }
yellowstone-grpc-proto = { path = "yellowstone-grpc-proto", version = "=1.14.0+solana.1.18.15" }
yellowstone-grpc-client = { path = "yellowstone-grpc-client", version = "=1.15.0+solana.1.18.15.gamma" }
yellowstone-grpc-proto = { path = "yellowstone-grpc-proto", version = "=1.14.0+solana.1.18.15.gamma" }

[profile.release]
debug = true
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-client-simple"
version = "1.13.0+solana.1.18.14"
version = "1.13.0+solana.1.18.14.gamma"
authors = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion yellowstone-grpc-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-client"
version = "1.15.0+solana.1.18.15"
version = "1.15.0+solana.1.18.15.gamma"
authors = { workspace = true }
edition = { workspace = true }
description = "Yellowstone gRPC Geyser Simple Client"
Expand Down
2 changes: 1 addition & 1 deletion yellowstone-grpc-geyser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-geyser"
version = "1.15.0+solana.1.18.15"
version = "1.15.0+solana.1.18.15.gamma"
authors = { workspace = true }
edition = { workspace = true }
description = "Yellowstone gRPC Geyser Plugin"
Expand Down
23 changes: 15 additions & 8 deletions yellowstone-grpc-geyser/src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ use {
std::{
collections::{HashMap, HashSet},
str::FromStr,
time::SystemTime,
},
yellowstone_grpc_proto::prelude::{
subscribe_request_filter_accounts_filter::Filter as AccountsFilterDataOneof,
subscribe_request_filter_accounts_filter_memcmp::Data as AccountsFilterMemcmpOneof,
subscribe_update::UpdateOneof, CommitmentLevel, SubscribeRequest,
SubscribeRequestAccountsDataSlice, SubscribeRequestFilterAccounts,
SubscribeRequestFilterAccountsFilter, SubscribeRequestFilterBlocks,
SubscribeRequestFilterBlocksMeta, SubscribeRequestFilterEntry, SubscribeRequestFilterSlots,
SubscribeRequestFilterTransactions, SubscribeUpdate, SubscribeUpdatePong,
yellowstone_grpc_proto::{
prelude::{
subscribe_request_filter_accounts_filter::Filter as AccountsFilterDataOneof,
subscribe_request_filter_accounts_filter_memcmp::Data as AccountsFilterMemcmpOneof,
subscribe_update::UpdateOneof, CommitmentLevel, SubscribeRequest,
SubscribeRequestAccountsDataSlice, SubscribeRequestFilterAccounts,
SubscribeRequestFilterAccountsFilter, SubscribeRequestFilterBlocks,
SubscribeRequestFilterBlocksMeta, SubscribeRequestFilterEntry,
SubscribeRequestFilterSlots, SubscribeRequestFilterTransactions, SubscribeUpdate,
SubscribeUpdatePong,
},
prost_types::Timestamp,
},
};

Expand Down Expand Up @@ -158,6 +163,7 @@ impl Filter {
Some(SubscribeUpdate {
filters,
update_oneof: Some(message.to_proto(&self.accounts_data_slice)),
timestamp: Some(Timestamp::from(SystemTime::now())),
})
}
}),
Expand All @@ -168,6 +174,7 @@ impl Filter {
self.ping.map(|id| SubscribeUpdate {
filters: vec![],
update_oneof: Some(UpdateOneof::Pong(SubscribeUpdatePong { id })),
timestamp: Some(Timestamp::from(SystemTime::now())),
})
}
}
Expand Down
3 changes: 3 additions & 0 deletions yellowstone-grpc-geyser/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use {
atomic::{AtomicUsize, Ordering},
Arc,
},
time::SystemTime,
},
tokio::{
fs,
Expand Down Expand Up @@ -56,6 +57,7 @@ use {
SubscribeUpdateSlot, SubscribeUpdateTransaction, SubscribeUpdateTransactionInfo,
SubscribeUpdateTransactionStatus, TransactionError as SubscribeUpdateTransactionError,
},
prost_types::Timestamp,
},
};

Expand Down Expand Up @@ -1315,6 +1317,7 @@ impl Geyser for GrpcService {
let ping_msg = SubscribeUpdate {
filters: vec![],
update_oneof: Some(UpdateOneof::Ping(SubscribeUpdatePing {})),
timestamp: Some(Timestamp::from(SystemTime::now())),
};

loop {
Expand Down
3 changes: 2 additions & 1 deletion yellowstone-grpc-proto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-proto"
version = "1.14.0+solana.1.18.15"
version = "1.14.0+solana.1.18.15.gamma"
authors = { workspace = true }
edition = { workspace = true }
description = "Yellowstone gRPC Geyser Protobuf Definitions"
Expand All @@ -13,6 +13,7 @@ publish = true
[dependencies]
bincode = { workspace = true }
prost = { workspace = true }
prost-types = { workspace = true }
solana-account-decoder = { workspace = true }
solana-sdk = { workspace = true }
solana-transaction-status = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions yellowstone-grpc-proto/proto/geyser.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
syntax = "proto3";

import "google/protobuf/timestamp.proto";
import public "solana-storage.proto";

option go_package = "github.com/rpcpool/solana-geyser-grpc/golang/proto";
Expand Down Expand Up @@ -104,6 +105,7 @@ message SubscribeUpdate {
SubscribeUpdateBlockMeta block_meta = 7;
SubscribeUpdateEntry entry = 8;
}
google.protobuf.Timestamp timestamp = 11;
}

message SubscribeUpdateAccount {
Expand Down
2 changes: 1 addition & 1 deletion yellowstone-grpc-proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub mod prelude {
pub use super::{geyser::*, solana::storage::confirmed_block::*};
}

pub use {prost, tonic};
pub use {prost, prost_types, tonic};

pub mod convert_to {
use {
Expand Down
2 changes: 1 addition & 1 deletion yellowstone-grpc-tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yellowstone-grpc-tools"
version = "1.0.0-rc.11+solana.1.18.15"
version = "1.0.0-rc.11+solana.1.18.15.gamma"
authors = { workspace = true }
edition = { workspace = true }
description = "Yellowstone gRPC Tools"
Expand Down
8 changes: 4 additions & 4 deletions yellowstone-grpc-tools/src/bin/grpc-google-pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ impl ArgsAction {
.context("failed to get message from gRPC")?;

match &message {
SubscribeUpdate { filters: _, update_oneof: Some(UpdateOneof::Ping(_)) } => prom::recv_inc(GprcMessageKind::Ping),
SubscribeUpdate { filters: _, update_oneof: Some(UpdateOneof::Pong(_)) } => prom::recv_inc(GprcMessageKind::Pong),
SubscribeUpdate { filters: _, update_oneof: Some(value) } => {
SubscribeUpdate { filters: _, update_oneof: Some(UpdateOneof::Ping(_)), timestamp: _ } => prom::recv_inc(GprcMessageKind::Ping),
SubscribeUpdate { filters: _, update_oneof: Some(UpdateOneof::Pong(_)), timestamp: _ } => prom::recv_inc(GprcMessageKind::Pong),
SubscribeUpdate { filters: _, update_oneof: Some(value), timestamp: _ } => {
if let UpdateOneof::Slot(slot) = value {
prom::set_slot_tip(
CommitmentLevel::try_from(slot.status).expect("valid commitment"),
Expand All @@ -196,7 +196,7 @@ impl ArgsAction {

prom::recv_inc(prom_kind);
},
SubscribeUpdate { filters: _, update_oneof: None } => anyhow::bail!("received empty updat emessage"),
SubscribeUpdate { filters: _, update_oneof: None, timestamp: _ } => anyhow::bail!("received empty updat emessage"),
};
}
};
Expand Down
19 changes: 12 additions & 7 deletions yellowstone-grpc-tools/src/kafka/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use {
atomic::{AtomicUsize, Ordering},
Arc,
},
time::SystemTime,
},
tokio::{
sync::{broadcast, mpsc, Notify},
Expand All @@ -24,13 +25,16 @@ use {
},
tonic_health::server::health_reporter,
tracing::{error, info},
yellowstone_grpc_proto::prelude::{
geyser_server::{Geyser, GeyserServer},
subscribe_update::UpdateOneof,
GetBlockHeightRequest, GetBlockHeightResponse, GetLatestBlockhashRequest,
GetLatestBlockhashResponse, GetSlotRequest, GetSlotResponse, GetVersionRequest,
GetVersionResponse, IsBlockhashValidRequest, IsBlockhashValidResponse, PingRequest,
PongResponse, SubscribeRequest, SubscribeUpdate, SubscribeUpdatePing,
yellowstone_grpc_proto::{
prelude::{
geyser_server::{Geyser, GeyserServer},
subscribe_update::UpdateOneof,
GetBlockHeightRequest, GetBlockHeightResponse, GetLatestBlockhashRequest,
GetLatestBlockhashResponse, GetSlotRequest, GetSlotResponse, GetVersionRequest,
GetVersionResponse, IsBlockhashValidRequest, IsBlockhashValidResponse, PingRequest,
PongResponse, SubscribeRequest, SubscribeUpdate, SubscribeUpdatePing,
},
prost_types::Timestamp,
},
};

Expand Down Expand Up @@ -119,6 +123,7 @@ impl Geyser for GrpcService {
let ping_msg = SubscribeUpdate {
filters: vec![],
update_oneof: Some(UpdateOneof::Ping(SubscribeUpdatePing {})),
timestamp: Some(Timestamp::from(SystemTime::now())),
};

loop {
Expand Down
Loading

0 comments on commit 1deefb6

Please sign in to comment.