Skip to content

tests(solana-indexer) PR 5.2: Add unit tests for solana-indexer ingester component#4550

Merged
squadgazzz merged 73 commits into
mainfrom
solana-indexer-PR5.2-bootstrap
Jul 3, 2026
Merged

tests(solana-indexer) PR 5.2: Add unit tests for solana-indexer ingester component#4550
squadgazzz merged 73 commits into
mainfrom
solana-indexer-PR5.2-bootstrap

Conversation

@tilacog

@tilacog tilacog commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This PR adds a mock stream test suite for the Solana ingester component.

It covers transaction, account, and slot forwarding, plus handling of ignored updates, malformed transactions, stream errors, clean shutdown, and closed decoder receivers.


This is a follow-up PR to #4549

tilacog and others added 13 commits June 8, 2026 17:36
Local tombi was 0.9.0; CI uses 1.1.0 which produces different output.
Introduces the traits/ module per the PR-sequence plan. The trait surface is intentionally narrow:
it covers only what the consumer components need, not the full surface of the underlying library.

traits/store.rs:
- Store (PostgreSQL boundary)

traits/solana_client.rs:
- SolanaClient (RPC boundary)

We don't need a trait to represent the Yelllowstone gRPC system boundary because that can be
represented by a trait bound in the (upcoming) Ingester struct implementation.
Fills in the ingester run loop for the solana-indexer.
- Create crates/solana-indexer/src/indexer/ingester/tests.rs with mock-stream
  tests covering tx/account/slot forwarding, ignored updates, malformed
  tx skipping, stream errors, clean shutdown, and closed decoder receiver.
- Link the test module in ingester.rs with #[cfg(test)] mod tests.
- Extend types::wire re-exports to cover the geyser types used by the
  tests, keeping imports local to the crate's wire surface.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a comprehensive suite of unit tests for the Ingester component, covering transaction and account updates, slot updates, ignored messages, malformed signatures, and stream error handling. To support these tests, additional Yellowstone gRPC proto types are exported in wire.rs. No critical issues found.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@tilacog tilacog changed the title Add simple unit tests for solana-indexer ingester Add unit tests for solana-indexer ingester component Jun 22, 2026
tilacog added 2 commits June 22, 2026 19:11
Patches remote memory exhaustion DoS in quinn-proto via unbounded
out-of-order stream reassembly. Transitive dep via solana-client.
Patches remote memory exhaustion DoS in quinn-proto via unbounded
out-of-order stream reassembly. Transitive dep via solana-client.
@tilacog tilacog changed the title Add unit tests for solana-indexer ingester component PR 5 — Add unit tests for solana-indexer ingester component Jun 23, 2026
@tilacog tilacog changed the title PR 5 — Add unit tests for solana-indexer ingester component PR 5.2 — Add unit tests for solana-indexer ingester component Jun 23, 2026
@tilacog tilacog changed the title PR 5.2 — Add unit tests for solana-indexer ingester component tests(solana-indexer) PR 5.2: Add unit tests for solana-indexer ingester component Jun 23, 2026

@MartinquaXD MartinquaXD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I guess.

#[tokio::test]
async fn transaction_update_with_valid_signature_is_forwarded() {
let signature = signature(1);
let (mut ingester, mut rx, _) = ingester(stream::iter(vec![tx_update(42, 1)]));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let (mut ingester, mut rx, _) = ingester(stream::iter(vec![tx_update(42, 1)]));
let (mut ingester, mut rx, _) = ingester(stream::iter([tx_update(42, 1)]));

No needed to first create a vector.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

update_oneof: Some(UpdateOneof::Transaction(SubscribeUpdateTransaction {
slot: 2,
transaction: Some(SubscribeUpdateTransactionInfo {
signature: vec![1, 2, 3],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is (most likely) not a valid signature which is a good indicator that this should use a proper new type to encode things like the size requirements of a signature.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The size requirement is already enforced, no? Signature here is solana_sdk::Signature, a [u8; 64] newtype, and Signature::try_from rejects anything that isn't 64 bytes. That vec![1, 2, 3] is the proto wire field, and this test exists to prove we reject it at the boundary. A crate-local wrapper would just forward to the same check, so it'd add indirection without new validation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That vec![1, 2, 3] is the proto wire field

Ah, that type comes like that from the geyser crate. Still seems odd to me that they don't have stricter size requirements on the wire format but I guess we have no choice then. Also perhaps I'm missing something and solana signatures can have variable length.

….2-bootstrap

# Conflicts:
#	Cargo.lock
#	crates/solana-indexer/src/indexer/ingester.rs
…ootstrap

# Conflicts:
#	crates/solana-indexer/src/lib.rs
…-bootstrap

# Conflicts:
#	crates/solana-indexer/src/indexer/ingester.rs
…-bootstrap

# Conflicts:
#	crates/solana-indexer/src/indexer/ingester.rs
…ootstrap

# Conflicts:
#	Cargo.lock
#	crates/solana-indexer/src/types/errors.rs
Base automatically changed from solana-indexer/PR5.1-bootstrap to main July 3, 2026 09:04
@squadgazzz squadgazzz enabled auto-merge July 3, 2026 09:05
…bootstrap

# Conflicts:
#	Cargo.lock
#	crates/solana-indexer/src/indexer/decoder.rs
#	crates/solana-indexer/src/indexer/ingester.rs
#	crates/solana-indexer/src/indexer/watchdog.rs
#	crates/solana-indexer/src/types/mod.rs
#	crates/solana-indexer/src/types/recovery.rs
#	crates/solana-indexer/src/types/wire.rs
@squadgazzz squadgazzz disabled auto-merge July 3, 2026 09:28
@squadgazzz squadgazzz enabled auto-merge July 3, 2026 09:28
@squadgazzz squadgazzz added this pull request to the merge queue Jul 3, 2026
Merged via the queue into main with commit e7e48be Jul 3, 2026
20 checks passed
@squadgazzz squadgazzz deleted the solana-indexer-PR5.2-bootstrap branch July 3, 2026 09:42
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants