Skip to content

Commit

Permalink
Merge branch 'master' into msg-wrap-arc
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Nov 14, 2024
2 parents 19f4aad + 6d56e68 commit 0e413ba
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 28 deletions.
6 changes: 1 addition & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ insert_final_newline = true
[*.{diff,md}]
trim_trailing_whitespace = false

[*.{js,json}]
indent_style = space
indent_size = 2

[*.proto]
[*.{js,json,proto,toml}]
indent_style = space
indent_size = 2

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ The minor version will be incremented upon a breaking change and the patch versi
- geyser: limit length of filter name ([#448](https://github.com/rpcpool/yellowstone-grpc/pull/448))
- geyser: wrap messages in Arc ([#449](https://github.com/rpcpool/yellowstone-grpc/pull/449))
- 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

Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[workspace]
resolver = "2"
members = [
"examples/rust", # 2.0.0
"yellowstone-grpc-client", # 2.0.0
"yellowstone-grpc-geyser", # 2.0.0
"yellowstone-grpc-proto", # 2.0.0
"examples/rust", # 2.0.0
"yellowstone-grpc-client", # 2.0.0
"yellowstone-grpc-geyser", # 2.0.0
"yellowstone-grpc-proto", # 2.0.0
]

[workspace.package]
Expand Down
2 changes: 1 addition & 1 deletion yellowstone-grpc-geyser/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"blocks_meta": {
"max": 1
},
"entry": {
"entries": {
"max": 1
}
}
Expand Down
6 changes: 3 additions & 3 deletions yellowstone-grpc-geyser/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pub struct ConfigGrpcFilters {
pub transactions_status: ConfigGrpcFiltersTransactions,
pub blocks: ConfigGrpcFiltersBlocks,
pub blocks_meta: ConfigGrpcFiltersBlocksMeta,
pub entry: ConfigGrpcFiltersEntry,
pub entries: ConfigGrpcFiltersEntries,
}

impl ConfigGrpcFilters {
Expand Down Expand Up @@ -376,12 +376,12 @@ impl Default for ConfigGrpcFiltersBlocksMeta {

#[derive(Debug, Clone, Deserialize)]
#[serde(default, deny_unknown_fields)]
pub struct ConfigGrpcFiltersEntry {
pub struct ConfigGrpcFiltersEntries {
#[serde(deserialize_with = "deserialize_usize_str")]
pub max: usize,
}

impl Default for ConfigGrpcFiltersEntry {
impl Default for ConfigGrpcFiltersEntries {
fn default() -> Self {
Self { max: usize::MAX }
}
Expand Down
10 changes: 5 additions & 5 deletions yellowstone-grpc-geyser/src/filters.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use {
crate::config::{
ConfigGrpcFilters, ConfigGrpcFiltersAccounts, ConfigGrpcFiltersBlocks,
ConfigGrpcFiltersBlocksMeta, ConfigGrpcFiltersEntry, ConfigGrpcFiltersSlots,
ConfigGrpcFiltersBlocksMeta, ConfigGrpcFiltersEntries, ConfigGrpcFiltersSlots,
ConfigGrpcFiltersTransactions,
},
base64::{engine::general_purpose::STANDARD as base64_engine, Engine},
Expand Down Expand Up @@ -124,7 +124,7 @@ impl Filter {
FilterTransactionsType::TransactionStatus,
names,
)?,
entries: FilterEntries::new(&config.entry, &limit.entry, names)?,
entries: FilterEntries::new(&config.entry, &limit.entries, names)?,
blocks: FilterBlocks::new(&config.blocks, &limit.blocks, names)?,
blocks_meta: FilterBlocksMeta::new(&config.blocks_meta, &limit.blocks_meta, names)?,
commitment: Self::decode_commitment(config.commitment)?,
Expand All @@ -137,7 +137,7 @@ impl Filter {
}

fn decode_commitment(commitment: Option<i32>) -> anyhow::Result<CommitmentLevel> {
let commitment = commitment.unwrap_or(CommitmentLevel::Processed as i32);
let commitment = commitment.unwrap_or(CommitmentLevelProto::Processed as i32);
CommitmentLevelProto::try_from(commitment)
.map(Into::into)
.map_err(|_error| {
Expand Down Expand Up @@ -787,7 +787,7 @@ struct FilterEntries {
impl FilterEntries {
fn new(
configs: &HashMap<String, SubscribeRequestFilterEntry>,
limit: &ConfigGrpcFiltersEntry,
limit: &ConfigGrpcFiltersEntries,
names: &mut FilterNames,
) -> anyhow::Result<Self> {
ConfigGrpcFilters::check_max(configs.len(), limit.max)?;
Expand Down Expand Up @@ -1006,7 +1006,6 @@ pub fn parse_accounts_data_slice_create(
#[cfg(test)]
mod tests {
use {
super::{FilterName, FilterNames},
crate::{config::ConfigGrpcFilters, filters::Filter},
solana_sdk::{
hash::Hash,
Expand All @@ -1023,6 +1022,7 @@ mod tests {
SubscribeRequestFilterTransactions,
},
plugin::{
filter::{FilterName, FilterNames},
message::{Message, MessageTransaction, MessageTransactionInfo},
message_ref::{
MessageFilters as FilteredMessageFilters, MessageRef as FilteredMessageRef,
Expand Down
8 changes: 4 additions & 4 deletions yellowstone-grpc-geyser/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl BlockMetaStorage {
}

fn parse_commitment(commitment: Option<i32>) -> Result<CommitmentLevel, Status> {
let commitment = commitment.unwrap_or(CommitmentLevel::Processed as i32);
let commitment = commitment.unwrap_or(CommitmentLevelProto::Processed as i32);
CommitmentLevelProto::try_from(commitment)
.map(Into::into)
.map_err(|_error| {
Expand Down Expand Up @@ -547,13 +547,13 @@ impl GrpcService {
Message::BlockMeta(_) => "BlockMeta",
Message::Block(_) => "Block",
};
metrics::update_invalid_blocks(format!("unexpected message {}", kind));
metrics::update_invalid_blocks(format!("unexpected message {kind}"));
match block_fail_action {
ConfigBlockFailAction::Log => {
error!("unexpected message #{} -- {} (invalid order)", message.get_slot(), kind);
error!("unexpected message #{} -- {kind} (invalid order)", message.get_slot());
}
ConfigBlockFailAction::Panic => {
panic!("unexpected message #{} -- {} (invalid order)", message.get_slot(), kind);
panic!("unexpected message #{} -- {kind} (invalid order)", message.get_slot());
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions yellowstone-grpc-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,18 @@ tonic-build = { workspace = true }

[features]
default = ["convert", "tonic-compression"]
convert = ["dep:bincode", "dep:solana-account-decoder", "dep:solana-sdk", "dep:solana-transaction-status"]
convert = [
"dep:bincode",
"dep:solana-account-decoder",
"dep:solana-sdk",
"dep:solana-transaction-status",
]
plugin = [
"convert",
"dep:agave-geyser-plugin-interface",
"dep:bytes",
"dep:smallvec",
"dep:thiserror"
"convert",
"dep:agave-geyser-plugin-interface",
"dep:bytes",
"dep:smallvec",
"dep:thiserror",
]
plugin-bench = ["plugin", "dep:prost_011", "dep:solana-storage-proto"]
tonic-compression = ["tonic/gzip", "tonic/zstd"]
Expand Down

0 comments on commit 0e413ba

Please sign in to comment.