geyser: remove startup_status (#230)
This commit is contained in:
parent
7bd3596c34
commit
8f1cc8bdf4
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -12,17 +12,30 @@ The minor version will be incremented upon a breaking change and the patch versi
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
### Breaking
|
||||||
|
|
||||||
|
## 2023-11-01
|
||||||
|
|
||||||
|
- @triton-one/yellowstone-grpc:0.3.0
|
||||||
|
- yellowstone-grpc-client-1.12.0+solana.1.17.1
|
||||||
|
- yellowstone-grpc-geyser-1.11.0+solana.1.17.1
|
||||||
|
- yellowstone-grpc-proto-1.11.0+solana.1.17.1
|
||||||
|
- yellowstone-grpc-tools-1.0.0-rc.6+solana.1.17.1
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
- geyser: trigger end of startup when parent slot 0 seen in `update_slot_status` notification because `notify_end_of_startup` is not triggered when cluster started from genesis ([#207](https://github.com/rpcpool/yellowstone-grpc/pull/207))
|
- geyser: trigger end of startup when parent slot 0 seen in `update_slot_status` notification because `notify_end_of_startup` is not triggered when cluster started from genesis ([#207](https://github.com/rpcpool/yellowstone-grpc/pull/207))
|
||||||
- tools: correctly handle SIGINT in kafka ([#219](https://github.com/rpcpool/yellowstone-grpc/pull/219))
|
- tools: correctly handle SIGINT in kafka ([#219](https://github.com/rpcpool/yellowstone-grpc/pull/219))
|
||||||
- geyser: use Ordering::Relaxed instead of SeqCst ([#221](https://github.com/rpcpool/yellowstone-grpc/pull/221))
|
- geyser: use Ordering::Relaxed instead of SeqCst ([#221](https://github.com/rpcpool/yellowstone-grpc/pull/221))
|
||||||
- proto: add optional field `ping` to `SubscribeRequest` ([#227](https://github.com/rpcpool/yellowstone-grpc/pull/227))
|
- proto: add optional field `ping` to `SubscribeRequest` ([#227](https://github.com/rpcpool/yellowstone-grpc/pull/227))
|
||||||
|
- geyser: remove startup_status (allow reload plugin) ([#230](https://github.com/rpcpool/yellowstone-grpc/pull/230))
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
- proto: add optional field `filter_by_commitment` to Slots filter ([#223](https://github.com/rpcpool/yellowstone-grpc/pull/223))
|
- proto: add optional field `filter_by_commitment` to Slots filter ([#223](https://github.com/rpcpool/yellowstone-grpc/pull/223))
|
||||||
|
|
||||||
### Breaking
|
|
||||||
|
|
||||||
## 2023-10-19
|
## 2023-10-19
|
||||||
|
|
||||||
- yellowstone-grpc-tools-1.0.0-rc.5+solana.1.17.1
|
- yellowstone-grpc-tools-1.0.0-rc.5+solana.1.17.1
|
||||||
|
|
|
@ -4948,7 +4948,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yellowstone-grpc-client"
|
name = "yellowstone-grpc-client"
|
||||||
version = "1.11.1+solana.1.17.1"
|
version = "1.12.0+solana.1.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures",
|
"futures",
|
||||||
|
@ -4962,7 +4962,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yellowstone-grpc-client-simple"
|
name = "yellowstone-grpc-client-simple"
|
||||||
version = "1.10.0+solana.1.17.1"
|
version = "1.11.0+solana.1.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"backoff",
|
"backoff",
|
||||||
|
@ -4985,7 +4985,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yellowstone-grpc-geyser"
|
name = "yellowstone-grpc-geyser"
|
||||||
version = "1.10.0+solana.1.17.1"
|
version = "1.11.0+solana.1.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.21.4",
|
"base64 0.21.4",
|
||||||
|
@ -5017,7 +5017,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yellowstone-grpc-proto"
|
name = "yellowstone-grpc-proto"
|
||||||
version = "1.10.0+solana.1.17.1"
|
version = "1.11.0+solana.1.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
@ -5032,7 +5032,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yellowstone-grpc-tools"
|
name = "yellowstone-grpc-tools"
|
||||||
version = "1.0.0-rc.5+solana.1.17.1"
|
version = "1.0.0-rc.6+solana.1.17.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -1,10 +1,10 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"examples/rust", # 1.10.0+solana.1.17.1
|
"examples/rust", # 1.11.0+solana.1.17.1
|
||||||
"yellowstone-grpc-client", # 1.11.1+solana.1.17.1
|
"yellowstone-grpc-client", # 1.12.0+solana.1.17.1
|
||||||
"yellowstone-grpc-geyser", # 1.10.0+solana.1.17.1
|
"yellowstone-grpc-geyser", # 1.11.0+solana.1.17.1
|
||||||
"yellowstone-grpc-proto", # 1.10.0+solana.1.17.1
|
"yellowstone-grpc-proto", # 1.11.0+solana.1.17.1
|
||||||
"yellowstone-grpc-tools", # 1.0.0-rc.5+solana.1.17.1
|
"yellowstone-grpc-tools", # 1.0.0-rc.6+solana.1.17.1
|
||||||
]
|
]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yellowstone-grpc-client-simple"
|
name = "yellowstone-grpc-client-simple"
|
||||||
version = "1.10.0+solana.1.17.1"
|
version = "1.11.0+solana.1.17.1"
|
||||||
authors = ["Triton One"]
|
authors = ["Triton One"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@triton-one/yellowstone-grpc",
|
"name": "@triton-one/yellowstone-grpc",
|
||||||
"version": "0.2.1",
|
"version": "0.3.0",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"author": "Triton One",
|
"author": "Triton One",
|
||||||
"description": "Yellowstone gRPC Geyser Node.js Client",
|
"description": "Yellowstone gRPC Geyser Node.js Client",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yellowstone-grpc-client"
|
name = "yellowstone-grpc-client"
|
||||||
version = "1.11.1+solana.1.17.1"
|
version = "1.12.0+solana.1.17.1"
|
||||||
authors = ["Triton One"]
|
authors = ["Triton One"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Yellowstone gRPC Geyser Simple Client"
|
description = "Yellowstone gRPC Geyser Simple Client"
|
||||||
|
@ -16,7 +16,7 @@ http = "0.2.8"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tonic = { version = "0.10.2", features = ["gzip", "tls", "tls-roots"] }
|
tonic = { version = "0.10.2", features = ["gzip", "tls", "tls-roots"] }
|
||||||
tonic-health = "0.10.2"
|
tonic-health = "0.10.2"
|
||||||
yellowstone-grpc-proto = { path = "../yellowstone-grpc-proto", version = "1.10.0+solana.1.17.1" }
|
yellowstone-grpc-proto = { path = "../yellowstone-grpc-proto", version = "1.11.0+solana.1.17.1" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "1.32.0", features = ["macros"] }
|
tokio = { version = "1.32.0", features = ["macros"] }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yellowstone-grpc-geyser"
|
name = "yellowstone-grpc-geyser"
|
||||||
version = "1.10.0+solana.1.17.1"
|
version = "1.11.0+solana.1.17.1"
|
||||||
authors = ["Triton One"]
|
authors = ["Triton One"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Yellowstone gRPC Geyser Plugin"
|
description = "Yellowstone gRPC Geyser Plugin"
|
||||||
|
|
|
@ -9,26 +9,16 @@ use {
|
||||||
ReplicaEntryInfoVersions, ReplicaTransactionInfoVersions, Result as PluginResult,
|
ReplicaEntryInfoVersions, ReplicaTransactionInfoVersions, Result as PluginResult,
|
||||||
SlotStatus,
|
SlotStatus,
|
||||||
},
|
},
|
||||||
std::{
|
std::{sync::Arc, time::Duration},
|
||||||
sync::{
|
|
||||||
atomic::{AtomicU8, Ordering},
|
|
||||||
Arc,
|
|
||||||
},
|
|
||||||
time::Duration,
|
|
||||||
},
|
|
||||||
tokio::{
|
tokio::{
|
||||||
runtime::Runtime,
|
runtime::Runtime,
|
||||||
sync::{mpsc, Notify},
|
sync::{mpsc, Notify},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const STARTUP_END_OF_RECEIVED: u8 = 1 << 0;
|
|
||||||
const STARTUP_PROCESSED_RECEIVED: u8 = 1 << 1;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct PluginInner {
|
pub struct PluginInner {
|
||||||
runtime: Runtime,
|
runtime: Runtime,
|
||||||
startup_status: AtomicU8,
|
|
||||||
snapshot_channel: Option<crossbeam_channel::Sender<Option<Message>>>,
|
snapshot_channel: Option<crossbeam_channel::Sender<Option<Message>>>,
|
||||||
grpc_channel: mpsc::UnboundedSender<Message>,
|
grpc_channel: mpsc::UnboundedSender<Message>,
|
||||||
grpc_shutdown: Arc<Notify>,
|
grpc_shutdown: Arc<Notify>,
|
||||||
|
@ -53,15 +43,8 @@ impl Plugin {
|
||||||
where
|
where
|
||||||
F: FnOnce(&PluginInner) -> PluginResult<()>,
|
F: FnOnce(&PluginInner) -> PluginResult<()>,
|
||||||
{
|
{
|
||||||
// Full block reconstruction will fail before first processed slot received
|
|
||||||
let inner = self.inner.as_ref().expect("initialized");
|
let inner = self.inner.as_ref().expect("initialized");
|
||||||
if inner.startup_status.load(Ordering::Relaxed)
|
|
||||||
== STARTUP_END_OF_RECEIVED | STARTUP_PROCESSED_RECEIVED
|
|
||||||
{
|
|
||||||
f(inner)
|
f(inner)
|
||||||
} else {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +80,6 @@ impl GeyserPlugin for Plugin {
|
||||||
|
|
||||||
self.inner = Some(PluginInner {
|
self.inner = Some(PluginInner {
|
||||||
runtime,
|
runtime,
|
||||||
startup_status: AtomicU8::new(0),
|
|
||||||
snapshot_channel,
|
snapshot_channel,
|
||||||
grpc_channel,
|
grpc_channel,
|
||||||
grpc_shutdown,
|
grpc_shutdown,
|
||||||
|
@ -122,6 +104,7 @@ impl GeyserPlugin for Plugin {
|
||||||
slot: u64,
|
slot: u64,
|
||||||
is_startup: bool,
|
is_startup: bool,
|
||||||
) -> PluginResult<()> {
|
) -> PluginResult<()> {
|
||||||
|
self.with_inner(|inner| {
|
||||||
let account = match account {
|
let account = match account {
|
||||||
ReplicaAccountInfoVersions::V0_0_1(_info) => {
|
ReplicaAccountInfoVersions::V0_0_1(_info) => {
|
||||||
unreachable!("ReplicaAccountInfoVersions::V0_0_1 is not supported")
|
unreachable!("ReplicaAccountInfoVersions::V0_0_1 is not supported")
|
||||||
|
@ -131,40 +114,33 @@ impl GeyserPlugin for Plugin {
|
||||||
}
|
}
|
||||||
ReplicaAccountInfoVersions::V0_0_3(info) => info,
|
ReplicaAccountInfoVersions::V0_0_3(info) => info,
|
||||||
};
|
};
|
||||||
let message = Message::Account((account, slot, is_startup).into());
|
|
||||||
|
|
||||||
|
let message = Message::Account((account, slot, is_startup).into());
|
||||||
if is_startup {
|
if is_startup {
|
||||||
let inner = self.inner.as_ref().expect("initialized");
|
|
||||||
if let Some(channel) = &inner.snapshot_channel {
|
if let Some(channel) = &inner.snapshot_channel {
|
||||||
match channel.send(Some(message)) {
|
match channel.send(Some(message)) {
|
||||||
Ok(()) => MESSAGE_QUEUE_SIZE.inc(),
|
Ok(()) => MESSAGE_QUEUE_SIZE.inc(),
|
||||||
Err(_) => panic!("failed to send message to startup queue: channel closed"),
|
Err(_) => panic!("failed to send message to startup queue: channel closed"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
} else {
|
} else {
|
||||||
self.with_inner(|inner| {
|
|
||||||
inner.send_message(message);
|
inner.send_message(message);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn notify_end_of_startup(&self) -> PluginResult<()> {
|
fn notify_end_of_startup(&self) -> PluginResult<()> {
|
||||||
let inner = self.inner.as_ref().expect("initialized");
|
self.with_inner(|inner| {
|
||||||
|
|
||||||
inner
|
|
||||||
.startup_status
|
|
||||||
.fetch_or(STARTUP_END_OF_RECEIVED, Ordering::Relaxed);
|
|
||||||
|
|
||||||
if let Some(channel) = &inner.snapshot_channel {
|
if let Some(channel) = &inner.snapshot_channel {
|
||||||
match channel.send(None) {
|
match channel.send(None) {
|
||||||
Ok(()) => MESSAGE_QUEUE_SIZE.inc(),
|
Ok(()) => MESSAGE_QUEUE_SIZE.inc(),
|
||||||
Err(_) => panic!("failed to send message to startup queue: channel closed"),
|
Err(_) => panic!("failed to send message to startup queue: channel closed"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_slot_status(
|
fn update_slot_status(
|
||||||
|
@ -173,28 +149,10 @@ impl GeyserPlugin for Plugin {
|
||||||
parent: Option<u64>,
|
parent: Option<u64>,
|
||||||
status: SlotStatus,
|
status: SlotStatus,
|
||||||
) -> PluginResult<()> {
|
) -> PluginResult<()> {
|
||||||
let inner = self.inner.as_ref().expect("initialized");
|
|
||||||
// if plugin run on genesis of network, notify_end_of_startup will not be triggered, and slot 0 will not
|
|
||||||
// come through this function.
|
|
||||||
if parent == Some(0) {
|
|
||||||
inner
|
|
||||||
.startup_status
|
|
||||||
.fetch_or(STARTUP_END_OF_RECEIVED, Ordering::Relaxed);
|
|
||||||
}
|
|
||||||
if status == SlotStatus::Processed {
|
|
||||||
let _ = inner.startup_status.compare_exchange(
|
|
||||||
STARTUP_END_OF_RECEIVED,
|
|
||||||
STARTUP_END_OF_RECEIVED | STARTUP_PROCESSED_RECEIVED,
|
|
||||||
Ordering::Relaxed,
|
|
||||||
Ordering::Relaxed,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.with_inner(|inner| {
|
self.with_inner(|inner| {
|
||||||
let message = Message::Slot((slot, parent, status).into());
|
let message = Message::Slot((slot, parent, status).into());
|
||||||
inner.send_message(message);
|
inner.send_message(message);
|
||||||
prom::update_slot_status(status, slot);
|
prom::update_slot_status(status, slot);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yellowstone-grpc-proto"
|
name = "yellowstone-grpc-proto"
|
||||||
version = "1.10.0+solana.1.17.1"
|
version = "1.11.0+solana.1.17.1"
|
||||||
authors = ["Triton One"]
|
authors = ["Triton One"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Yellowstone gRPC Geyser Protobuf Definitions"
|
description = "Yellowstone gRPC Geyser Protobuf Definitions"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yellowstone-grpc-tools"
|
name = "yellowstone-grpc-tools"
|
||||||
version = "1.0.0-rc.5+solana.1.17.1"
|
version = "1.0.0-rc.6+solana.1.17.1"
|
||||||
authors = ["Triton One"]
|
authors = ["Triton One"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Yellowstone gRPC Tools"
|
description = "Yellowstone gRPC Tools"
|
||||||
|
|
Loading…
Reference in New Issue