Skip to content

Commit

Permalink
geyser: remove option block_fail_action (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid authored Nov 18, 2024
1 parent 6d56e68 commit 9ddd78e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 55 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ The minor version will be incremented upon a breaking change and the patch versi
- geyser: use Arc wrapped messages in block message ([#446](https://github.com/rpcpool/yellowstone-grpc/pull/446))
- node: remove generated grpc files ([#447](https://github.com/rpcpool/yellowstone-grpc/pull/447))
- proto: add txn_signature filter ([#445](https://github.com/rpcpool/yellowstone-grpc/pull/445))
- geyser: limit length of filter name ([#448](https://github.com/rpcpool/yellowstone-grpc/pull/448))
- examples: add progress bar to client tool ([#456](https://github.com/rpcpool/yellowstone-grpc/pull/456))
- proto: change error type in mod `convert_from` ([#457](https://github.com/rpcpool/yellowstone-grpc/pull/457))
- proto: add mod `plugin` with `FilterNames` cache ([#458](https://github.com/rpcpool/yellowstone-grpc/pull/458))
- proto: move enum Message from geyser crate ([#459](https://github.com/rpcpool/yellowstone-grpc/pull/459))

### Breaking

- geyser: limit length of filter name ([#448](https://github.com/rpcpool/yellowstone-grpc/pull/448))
- proto: change error type in mod `convert_from` ([#457](https://github.com/rpcpool/yellowstone-grpc/pull/457))
- geyser: remove option `block_fail_action` ([#463](https://github.com/rpcpool/yellowstone-grpc/pull/463))

## 2024-10-04

- yellowstone-grpc-client-simple-2.0.0
Expand Down
3 changes: 1 addition & 2 deletions yellowstone-grpc-geyser/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,5 @@
},
"prometheus": {
"address": "0.0.0.0:8999"
},
"block_fail_action": "log"
}
}
16 changes: 0 additions & 16 deletions yellowstone-grpc-geyser/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ pub struct Config {
pub grpc: ConfigGrpc,
#[serde(default)]
pub prometheus: Option<ConfigPrometheus>,
/// Action on block re-construction error
#[serde(default)]
pub block_fail_action: ConfigBlockFailAction,
/// Collect client filters, processed slot and make it available on prometheus port `/debug_clients`
#[serde(default)]
pub debug_clients_http: bool,
Expand Down Expand Up @@ -394,19 +391,6 @@ pub struct ConfigPrometheus {
pub address: SocketAddr,
}

#[derive(Debug, Clone, Copy, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConfigBlockFailAction {
Log,
Panic,
}

impl Default for ConfigBlockFailAction {
fn default() -> Self {
Self::Log
}
}

fn deserialize_usize_str<'de, D>(deserializer: D) -> Result<usize, D::Error>
where
D: Deserializer<'de>,
Expand Down
37 changes: 3 additions & 34 deletions yellowstone-grpc-geyser/src/grpc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::{
config::{ConfigBlockFailAction, ConfigGrpc, ConfigGrpcFilters},
config::{ConfigGrpc, ConfigGrpcFilters},
filters::Filter,
metrics::{self, DebugClientMessage},
version::GrpcVersionInfo,
Expand Down Expand Up @@ -305,7 +305,6 @@ impl GrpcService {
#[allow(clippy::type_complexity)]
pub async fn create(
config: ConfigGrpc,
block_fail_action: ConfigBlockFailAction,
debug_clients_tx: Option<mpsc::UnboundedSender<DebugClientMessage>>,
is_reload: bool,
) -> anyhow::Result<(
Expand Down Expand Up @@ -391,12 +390,7 @@ impl GrpcService {
.enable_all()
.build()
.expect("Failed to create a new runtime for geyser loop")
.block_on(Self::geyser_loop(
messages_rx,
blocks_meta_tx,
broadcast_tx,
block_fail_action,
));
.block_on(Self::geyser_loop(messages_rx, blocks_meta_tx, broadcast_tx));
});

// Run Server
Expand Down Expand Up @@ -432,7 +426,6 @@ impl GrpcService {
mut messages_rx: mpsc::UnboundedReceiver<Message>,
blocks_meta_tx: Option<mpsc::UnboundedSender<Message>>,
broadcast_tx: broadcast::Sender<(CommitmentLevel, Arc<Vec<Message>>)>,
block_fail_action: ConfigBlockFailAction,
) {
const PROCESSED_MESSAGES_MAX: usize = 31;
const PROCESSED_MESSAGES_SLEEP: Duration = Duration::from_millis(10);
Expand Down Expand Up @@ -462,7 +455,7 @@ impl GrpcService {

// Remove outdated block reconstruction info
match &message {
// On startup we can receive few Confirmed/Finalized slots without BlockMeta message
// On startup we can receive multiple Confirmed/Finalized slots without BlockMeta message
// With saved first Processed slot we can ignore errors caused by startup process
Message::Slot(msg) if processed_first_slot.is_none() && msg.status == CommitmentLevel::Processed => {
processed_first_slot = Some(msg.slot);
Expand Down Expand Up @@ -501,14 +494,6 @@ impl GrpcService {
let reason = reasons.join(",");

metrics::update_invalid_blocks(format!("failed reconstruct {reason}"));
match block_fail_action {
ConfigBlockFailAction::Log => {
error!("failed reconstruct #{slot} {reason}");
}
ConfigBlockFailAction::Panic => {
panic!("failed reconstruct #{slot} {reason}");
}
}
}
}
}
Expand Down Expand Up @@ -549,29 +534,13 @@ impl GrpcService {
Message::Block(_) => "Block",
};
metrics::update_invalid_blocks(format!("unexpected message {kind}"));
match block_fail_action {
ConfigBlockFailAction::Log => {
error!("unexpected message #{} -- {kind} (invalid order)", message.get_slot());
}
ConfigBlockFailAction::Panic => {
panic!("unexpected message #{} -- {kind} (invalid order)", message.get_slot());
}
}
}
}
let mut sealed_block_msg = None;
match &message {
Message::BlockMeta(msg) => {
if slot_messages.block_meta.is_some() {
metrics::update_invalid_blocks("unexpected message: BlockMeta (duplicate)");
match block_fail_action {
ConfigBlockFailAction::Log => {
error!("unexpected message #{} -- BlockMeta (duplicate)", message.get_slot());
}
ConfigBlockFailAction::Panic => {
panic!("unexpected message #{} -- BlockMeta (duplicate)", message.get_slot());
}
}
}
slot_messages.block_meta = Some(Arc::clone(msg));
sealed_block_msg = slot_messages.try_seal();
Expand Down
1 change: 0 additions & 1 deletion yellowstone-grpc-geyser/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ impl GeyserPlugin for Plugin {
let (debug_client_tx, debug_client_rx) = mpsc::unbounded_channel();
let (snapshot_channel, grpc_channel, grpc_shutdown) = GrpcService::create(
config.grpc,
config.block_fail_action,
config.debug_clients_http.then_some(debug_client_tx),
is_reload,
)
Expand Down

0 comments on commit 9ddd78e

Please sign in to comment.