From 9ddd78e11ebb8aac9a181789e707a2f49d4c1eb1 Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Mon, 18 Nov 2024 17:04:08 +0200 Subject: [PATCH] geyser: remove option `block_fail_action` (#463) --- CHANGELOG.md | 6 +++-- yellowstone-grpc-geyser/config.json | 3 +-- yellowstone-grpc-geyser/src/config.rs | 16 ------------ yellowstone-grpc-geyser/src/grpc.rs | 37 +++------------------------ yellowstone-grpc-geyser/src/plugin.rs | 1 - 5 files changed, 8 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06e1100b..7b1af8dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/yellowstone-grpc-geyser/config.json b/yellowstone-grpc-geyser/config.json index 2e15d719..6103fc48 100644 --- a/yellowstone-grpc-geyser/config.json +++ b/yellowstone-grpc-geyser/config.json @@ -77,6 +77,5 @@ }, "prometheus": { "address": "0.0.0.0:8999" - }, - "block_fail_action": "log" + } } diff --git a/yellowstone-grpc-geyser/src/config.rs b/yellowstone-grpc-geyser/src/config.rs index 31024b32..32681bde 100644 --- a/yellowstone-grpc-geyser/src/config.rs +++ b/yellowstone-grpc-geyser/src/config.rs @@ -18,9 +18,6 @@ pub struct Config { pub grpc: ConfigGrpc, #[serde(default)] pub prometheus: Option, - /// 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, @@ -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 where D: Deserializer<'de>, diff --git a/yellowstone-grpc-geyser/src/grpc.rs b/yellowstone-grpc-geyser/src/grpc.rs index b398e0a1..d6984fbe 100644 --- a/yellowstone-grpc-geyser/src/grpc.rs +++ b/yellowstone-grpc-geyser/src/grpc.rs @@ -1,6 +1,6 @@ use { crate::{ - config::{ConfigBlockFailAction, ConfigGrpc, ConfigGrpcFilters}, + config::{ConfigGrpc, ConfigGrpcFilters}, filters::Filter, metrics::{self, DebugClientMessage}, version::GrpcVersionInfo, @@ -305,7 +305,6 @@ impl GrpcService { #[allow(clippy::type_complexity)] pub async fn create( config: ConfigGrpc, - block_fail_action: ConfigBlockFailAction, debug_clients_tx: Option>, is_reload: bool, ) -> anyhow::Result<( @@ -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 @@ -432,7 +426,6 @@ impl GrpcService { mut messages_rx: mpsc::UnboundedReceiver, blocks_meta_tx: Option>, broadcast_tx: broadcast::Sender<(CommitmentLevel, Arc>)>, - block_fail_action: ConfigBlockFailAction, ) { const PROCESSED_MESSAGES_MAX: usize = 31; const PROCESSED_MESSAGES_SLEEP: Duration = Duration::from_millis(10); @@ -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); @@ -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}"); - } - } } } } @@ -549,14 +534,6 @@ 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; @@ -564,14 +541,6 @@ impl GrpcService { 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(); diff --git a/yellowstone-grpc-geyser/src/plugin.rs b/yellowstone-grpc-geyser/src/plugin.rs index 6927ec7d..0267afae 100644 --- a/yellowstone-grpc-geyser/src/plugin.rs +++ b/yellowstone-grpc-geyser/src/plugin.rs @@ -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, )