Solana Stream SDK 5.2.1 supports Agave v4.5 with a choice of UDP recovery modes

Solana Stream SDK 5.2.1 supports Agave v4.5 with a choice of UDP recovery modes

ELSOUL LABO B.V. and Validators DAO have released Solana Stream SDK 5.2.1 for Rust on crates.io. Version 5.1.0 introduced Agave v4.5 compatibility and recovery of missing UDP shreds. Version 5.2.0 lets applications choose whether to process only the data shreds they receive or use coding shreds to recover missing data. A receiver racing other feeds can prioritize its next observation, while a receiver collecting transaction history can prioritize coverage. Rust SDK 5.2.1 on crates.io
The 5.2.1 maintenance release updates the Rust dependencies, including the stable Agave crates at 4.4.2. It retains the receiver modes and default introduced in 5.2.0. Upgrading to 5.2.1 brings in fixes to dependencies used for HTTP/2 transport, TLS and Protocol Buffers decoding.
The native Shreds client 2.0.1 is available on npm. The TypeScript SDK 4.1.0 is being prepared for npm. These builds shorten the path from a Shreds gRPC message received in Rust to its JavaScript callback, while preserving the existing JSON format. The Node.js measurements below are from release candidates. The UDP recovery results are for the Rust release.

Compatibility during the Agave v4.5 rollout

Applications can configure shred validation to enforce rules such as SIMD-0504's FEC-set consistency checks from the slot at which they take effect on the relevant cluster. This also lets a receiver replay historical traffic with the rules in effect for each slot. Validation settings and feature activation
Earlier versions already decoded Transaction v1. The 5.1.0 compatibility tests covered the boundary for the number of accounts a transaction uses. In Agave v4.5.0-rc.1 simulations, signed v1 transactions using 65 and 96 accounts succeeded when the SIMD-0596 feature gate was active. A transaction with 97 accounts was rejected even with the gate active. The gate was inactive on Mainnet when checked on December 2.
A standard transaction subscription to Yellowstone 18.0.0-rc5 running with Agave v4.5.0-rc.1 also received signed transactions using 64, 65 and 96 accounts. Applications can read their contents through the SDK. When submitting a transaction, use the execution rules active on the destination cluster. Compatibility results by version

Choosing a UDP recovery mode in Rust SDK 5.2.1

The UDP receiver defaults to recover. No setting is needed, and applications upgrading from 5.1.0 keep this behavior. The receiver delivers a transaction as soon as the necessary data shreds arrive. If some are missing, it can use enough compatible coding shreds to fill the gap. This mode suits a consumer that wants to capture as many transactions as possible from this feed.
For example, an application may use Shreds for an early signal and reconcile missed transactions later using a separate feed such as Yellowstone gRPC. In that design, data-only lets the receiver validate and assemble the data shreds it receives and decode transactions without performing erasure recovery. A later packet does not have to wait behind a repair. If a necessary data shred never arrives, this feed can miss the transaction. The application handles reconciliation. To select this mode, set the following environment variable.
bash
export SHREDS_UDP_RECOVERY_MODE=data-only
Full FEC verification (require_code_match) requires coding shreds and is available with recover.
The two modes were compared in the same optimized build before the 5.2.0 release. In a loopback test where the preceding packet met the repair threshold, p99 time from sending the following healthy transaction’s final packet to decoding it was 17.4 µs with data-only and 495.3 µs with recover. Both modes detected that transaction in all 2,048 trials. To evaluate first observations, compare detection timestamps for the same transactions across the feeds your application uses. Test results

Detecting the next healthy transaction

Detecting the next healthy transaction · p99 from sending its final data shred to decoding the transaction · Coding shred reaching the repair threshold · data-only 17.4 µs / recover 495.3 µs · Duplicate data shred (control) · data-only 17.8 µs / recover 17.9 µs · The following healthy transaction was detected in 2,048 of 2,048 bursts in every case.
p99 from sending its final data shred to decoding the transaction. All bars share a 0–500 µs scale. Same-host Linux x64 loopback. Two UDP packets queued before the receiver reads. The following healthy transaction was detected in 2,048 of 2,048 bursts in every case. ValidatorsDAO/solana-stream #157 · CI 143465789446
The historical replay below compares 5.0.0 with 5.1.0, the version that introduced recovery. Solana distributes blocks in small pieces called shreds. A fixed forward error correction (FEC) set contains 32 data shreds and 32 coding shreds. The coding shreds supply the information needed to reconstruct missing data. The previous SDK recorded coding shreds but could miss a transaction if some of the data needed to decode it never arrived.
The new receiver takes two paths. In its default mode it delivers a component as soon as consecutive data shreds reach its completion boundary. If data is missing, any combination of at least 32 distinct compatible data and coding shreds from the same set enables Reed–Solomon recovery. Before using recovered data, the receiver checks headers, padding, erasure consistency, the Merkle root that identifies the committed set, and the supplied Merkle proofs.

Transaction recovery after shred loss

Both versions detected a transaction in all 128 ordered replays. With data loss, reordering and duplication, detection increased from zero to 128 of 128 replays.
128 replays of the same captured slot, each containing one target transaction. Original order, all data present. 4 data shreds removed per FEC set. Remaining data reversed, one duplicate added. One tile per replay. Lit tiles indicate detections. Signed slot from a local Agave 4.4.2 validator. Two FEC sets per slot. Coding shreds supplied in the loss test. Source: ValidatorsDAO/solana-stream #150
The comparison replayed the same signed slot containing two FEC sets. For each set, the test removed four data shreds, reversed the remaining data shreds, added a duplicate and supplied coding shreds. Across 128 replays, the previous version detected the transaction zero times and the new version detected it 128 times. On the ordered trace, both versions detected it in every replay. Recovery consumes additional CPU time and memory. In this experiment that work retrieved a transaction that the previous receiver missed on the same input.
Applications that require finality should check the required commitment downstream. To authenticate a shred, verify its signature against the trusted public key of the leader for that slot. FEC implementation and verification

Fewer conversions before the JavaScript callback, reaching 23,975 messages per second on one host

The native Shreds gRPC client passes a slot number and an array of bytes from Rust to a JavaScript callback. Previously, it constructed an intermediate JSON value for every byte, collected those values into an array, and serialized that array to a string. The candidate writes the same JSON string directly from a borrowed slice of the received bytes. For one 8 KiB message, Rust allocator calls, including reallocations, fell from 17 to nine.

Shreds delivery to Node.js

Same-host Shreds gRPC throughput rose from 6,965 to 23,975 messages per second. The p99 time from the server write to the JavaScript callback fell from 4.659 ms to 1.513 ms.
Same-runner loopback test from a server write to the JavaScript callback. Linux x64 · Node.js 24 · loopback · 8 KiB × 8,192 messages · up to 32 outstanding. Median of 3 runs per build. All messages arrived. Source: ValidatorsDAO/solana-stream #148
A server on the same Linux x64 host sent 8 KiB messages, with at most 32 outstanding. The test measured time to callback entry. The old and new release builds ran three times each in alternating order. All 8,192 messages in each run arrived in order with the expected contents.
Same-host measurementBeforeAfter
Messages received per second6,96523,975
Median time to callback2.383 ms0.688 ms
p99 time to callback4.659 ms1.513 ms
Process CPU time per 8,192 messages1,356 ms523 ms
The p99 is the time within which 99% of messages reached the callback. A transaction monitor that filters messages on receipt can start evaluating them sooner. The measured interval starts at the same-host server write and ends at callback entry. Remote network transit and work performed inside the callback, such as a database write, have their own costs. Peak process memory rose by about 1 MiB in this test. Measurement conditions and results

Choosing a package and starter

EnvironmentVersionAvailabilityWhen to use it
Rustsolana-stream-sdk 5.2.1Published on crates.ioReceive and recover shreds with the udp feature, or detect transactions for watched programs.
TypeScript / Node.js@validators-dao/solana-stream-sdk 4.1.0Being prepared for npmSubscribe to transactions and accounts through Yellowstone, or build applications using Shreds gRPC.
Native Shreds receiver for Node.js@validators-dao/solana-shreds-client 2.0.1Published on npmThe native receiver also used by the TypeScript SDK. Tested on Linux and macOS, each on x64 and ARM64.
bash
cargo add [email protected] --features udp
TypeScript applications that perform asynchronous writes may also benefit from the updated Geyser starter. It waits for the Promise returned by each handler and processes accepted updates and disconnect events in arrival order. In a slow-handler test, the previous starter started 4,096 handlers concurrently. The new starter ran one and queued 128, as configured. It dropped the remaining 3,967 updates. If delivery consistently outpaces processing, narrow the subscription filters and choose queue capacity and replay behavior according to how much loss the application can tolerate. Geyser starter changes

Share feedback through GitHub Issues

Which updates are most likely to go missing in your environment? Where does time accumulate under load? Which APIs are awkward to use? Include the SDK version, OS and CPU, stream type (UDP, Shreds gRPC or Yellowstone gRPC), and expected and observed behavior so the maintainers can investigate under comparable conditions. Remove API keys and credentials from logs and reproduction steps before sharing them.