v0.2.9-pre.005-fix.001

This commit is contained in:
2026-08-24 12:53:15 +02:00
parent dca0a4b809
commit 15e3402e1c
5 changed files with 151 additions and 47 deletions

View File

@@ -1,6 +1,7 @@
// file: crates/ksp-onchain-transport-lib/src/grpc_subscribe.rs
// version: 3
// version: 4
#[cfg(test)]
const MAX_GRPC_SUBSCRIBE_ACCOUNT_DATA_LENGTH_BYTES: usize = 512 * 1024 * 1024;
const MAX_GRPC_SUBSCRIBE_ACCOUNT_PREDICATE_COUNT: usize = 256;
const MAX_GRPC_SUBSCRIBE_ACCOUNT_SELECTOR_COUNT: usize = 50_000;
@@ -11,8 +12,11 @@ const MAX_GRPC_SUBSCRIBE_FILTER_GROUP_COUNT: usize = 1_024;
const MAX_GRPC_SUBSCRIBE_FILTER_NAME_LENGTH_BYTES: usize = 128;
const MAX_GRPC_SUBSCRIBE_MEMCMP_BYTES: usize = 1024 * 1024;
const MAX_GRPC_SUBSCRIBE_MEMCMP_TEXT_LENGTH_BYTES: usize = 2 * 1024 * 1024;
#[cfg(test)]
const MAX_GRPC_SUBSCRIBE_SLOT_DEAD_ERROR_LENGTH_BYTES: usize = 16 * 1024;
#[cfg(test)]
const MAX_GRPC_SUBSCRIBE_UPDATE_FILTER_COUNT: usize = 1_024;
#[cfg(test)]
const YELLOWSTONE_TRANSACTION_SIGNATURE_LENGTH_BYTES: usize = 64;
/// Validated logical filter name used by the standard Yellowstone `SubscribeRequest` maps.
@@ -558,7 +562,7 @@ impl YellowstoneSubscribeSlotFilter {
}
#[cfg(test)]
fn to_wire(&self) -> yellowstone_grpc_proto::geyser::SubscribeRequestFilterSlots {
fn to_wire(self) -> yellowstone_grpc_proto::geyser::SubscribeRequestFilterSlots {
return yellowstone_grpc_proto::geyser::SubscribeRequestFilterSlots {
filter_by_commitment: self.filter_by_commitment,
interslot_updates: self.interslot_updates,
@@ -1258,7 +1262,7 @@ fn decode_slot_update(wire: yellowstone_grpc_proto::geyser::SubscribeUpdate) ->
value if value == yellowstone_grpc_proto::geyser::SlotStatus::SlotDead as i32 => crate::YellowstoneSlotStatus::Dead,
_ => return invalid_subscribe_response("slot.status", "Yellowstone slot update contains an unknown status"),
};
if update.dead_error.as_ref().is_some_and(|value| value.len() > MAX_GRPC_SUBSCRIBE_SLOT_DEAD_ERROR_LENGTH_BYTES) {
if update.dead_error.as_ref().is_some_and(|value| return value.len() > MAX_GRPC_SUBSCRIBE_SLOT_DEAD_ERROR_LENGTH_BYTES) {
return invalid_subscribe_response("slot.dead_error", "Yellowstone dead-slot diagnostic exceeds the KSP bound");
}
return std::result::Result::Ok(crate::YellowstoneSlotUpdate {