From af3e94d60143c46360396be758892ecab3651d43 Mon Sep 17 00:00:00 2001 From: leafaar Date: Tue, 23 Dec 2025 13:52:21 -0300 Subject: [PATCH 1/2] feat(plugin-agave): toggle account/transaction update + account max size filter --- .gitignore | 1 + plugin-agave/src/config.rs | 22 ++++++++++++++++++++++ plugin-agave/src/plugin.rs | 24 +++++++++++++++++++++--- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6d051e91..e2b89f11 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ db plugin-agave/config.dev.json plugin-agave/fixtures/blocks richat/config.dev.yml +.local # Solana test-ledger diff --git a/plugin-agave/src/config.rs b/plugin-agave/src/config.rs index 3236e579..f8de3813 100644 --- a/plugin-agave/src/config.rs +++ b/plugin-agave/src/config.rs @@ -23,6 +23,7 @@ pub struct Config { pub metrics: Option, pub tokio: ConfigTokio, pub channel: ConfigChannel, + pub filters: ConfigFilters, pub quic: Option, pub grpc: Option, } @@ -90,3 +91,24 @@ impl ConfigChannel { } } } + +#[derive(Debug, Clone, Copy, Deserialize)] +#[serde(deny_unknown_fields, default)] +pub struct ConfigFilters { + /// Enable/disable account update notifications + pub enable_account_update: bool, + /// Enable/disable transaction update notifications + pub enable_transaction_update: bool, + /// Maximum account data size to send, if None no limit + pub max_account_data_size: Option, +} + +impl Default for ConfigFilters { + fn default() -> Self { + Self { + enable_account_update: true, + enable_transaction_update: true, + max_account_data_size: None, + } + } +} diff --git a/plugin-agave/src/plugin.rs b/plugin-agave/src/plugin.rs index da981b6c..b7e91d7f 100644 --- a/plugin-agave/src/plugin.rs +++ b/plugin-agave/src/plugin.rs @@ -1,7 +1,7 @@ use { crate::{ channel::Sender, - config::Config, + config::{Config, ConfigFilters}, metrics, protobuf::{ProtobufEncoder, ProtobufMessage}, version::VERSION, @@ -59,6 +59,7 @@ pub struct PluginInner { encoder: ProtobufEncoder, shutdown: CancellationToken, tasks: Vec<(&'static str, PluginTask)>, + filters: ConfigFilters, } impl PluginInner { @@ -146,6 +147,7 @@ impl PluginInner { encoder: config.channel.encoder, shutdown, tasks, + filters: config.filters, }) } } @@ -212,6 +214,14 @@ impl GeyserPlugin for Plugin { }; let inner = self.inner.as_ref().expect("initialized"); + + // Filter by account data size + if let Some(max_size) = inner.filters.max_account_data_size { + if account.data.len() > max_size { + return Ok(()); + } + } + inner .messages .push(ProtobufMessage::Account { slot, account }, inner.encoder); @@ -307,7 +317,11 @@ impl GeyserPlugin for Plugin { } fn account_data_notifications_enabled(&self) -> bool { - true + self.inner + .as_ref() + .expect("initialized") + .filters + .enable_account_update } fn account_data_snapshot_notifications_enabled(&self) -> bool { @@ -315,7 +329,11 @@ impl GeyserPlugin for Plugin { } fn transaction_notifications_enabled(&self) -> bool { - true + self.inner + .as_ref() + .expect("initialized") + .filters + .enable_transaction_update } fn entry_notifications_enabled(&self) -> bool { From b23fc01d122b5966c2c680cc9ceea393fcca20aa Mon Sep 17 00:00:00 2001 From: leafaar Date: Tue, 23 Dec 2025 13:59:56 -0300 Subject: [PATCH 2/2] chore: bump version + changelog --- CHANGELOG.md | 8 ++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- plugin-agave/Cargo.toml | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc146e77..91c2790b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,14 @@ The minor version will be incremented upon a breaking change and the patch versi ### Breaking +## 2025-12-23 + +- richat-plugin-agave-v7.1.0 + +### Features + +- plugin-agave: add option to disable/enable account/transaction updates + filter account data size ([#171](https://github.com/lamports-dev/richat/pull/171)) + ## 2025-12-22 - richat-shared-v7.2.0 diff --git a/Cargo.lock b/Cargo.lock index 1a46f066..ac257701 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3897,7 +3897,7 @@ dependencies = [ [[package]] name = "richat-plugin-agave" -version = "7.0.0" +version = "7.1.0" dependencies = [ "agave-geyser-plugin-interface", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index f4871d32..ae7ca806 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ regex = "1.11.1" richat-client = { path = "client", version = "7.0.0" } richat-filter = { path = "filter", version = "7.0.0" } richat-metrics = { path = "metrics", version = "1.0.1" } -richat-plugin-agave = { path = "plugin-agave", version = "7.0.0" } +richat-plugin-agave = { path = "plugin-agave", version = "7.1.0" } richat-proto = { path = "proto", version = "7.0.0" } richat-shared = { path = "shared", version = "7.2.0", default-features = false } rocksdb = "0.24.0" diff --git a/plugin-agave/Cargo.toml b/plugin-agave/Cargo.toml index ed5cef94..d255fb8d 100644 --- a/plugin-agave/Cargo.toml +++ b/plugin-agave/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "richat-plugin-agave" -version = "7.0.0" +version = "7.1.0" authors = { workspace = true } edition = { workspace = true } description = "Richat Agave Geyser Plugin"