Skip to content

fix(aperture): omit empty inner instruction groups - #1837

Open
erkancamli wants to merge 2 commits into
magicblock-labs:masterfrom
erkancamli:fix/aperture-omit-empty-cpi-groups
Open

erkancamli wants to merge 2 commits into
magicblock-labs:masterfrom
erkancamli:fix/aperture-omit-empty-cpi-groups

Conversation

@erkancamli

Copy link
Copy Markdown
Contributor

What changed

The SVM records one inner instruction group per top-level instruction and leaves the group empty when that instruction made no CPI. group_inner_instructions copied every group, so each instruction without CPIs showed up as {"index": N, "instructions": []} in:

  • getTransaction and getBlock (retained Engine metadata)
  • simulateTransaction with innerInstructions: true
  • TransactionStatusMeta.inner_instructions passed to Geyser plugins

Solana's map_inner_instructions (solana-transaction-status) filters these empty groups, so a transaction with no CPIs has innerInstructions: [] there. This change applies the same filter in the shared grouping helper, so both the retained and the live paths match.

Impact

Response shape only. Clients and plugins that read a group's presence as "this instruction made CPIs" (the Geyser test fixture in this crate uses !groups.is_empty() for exactly that) no longer get a false positive for every transaction. Group indexes are unchanged.

Reviewer notes

The added unit test feeds live_inner_instructions the SVM layout [[], [cpi, cpi], []] and expects only the group at index 1, plus no groups for a transaction without CPIs.

The SVM records one inner instruction group per top-level instruction,
including an empty group when the instruction made no CPI. Aperture
copied every group into transaction metadata, so getTransaction,
getBlock, simulateTransaction with innerInstructions, and Geyser
plugins reported an entry like {"index":0,"instructions":[]} for each
instruction without CPIs.

Solana's map_inner_instructions drops these empty groups. Filter them
the same way so clients that treat a group as evidence of a CPI see the
same metadata as on Solana.
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a31554a and 829341e.

Files selected for processing: 1

  • aperture/src/transaction.rs

No actionable comments were generated in the recent review.

Walkthrough

group_inner_instructions now omits top-level instruction groups with no CPI instructions. Nonempty groups retain their original indexes. A test checks both behaviors and verifies that all-empty input returns no groups.

Changes: Inner-instruction grouping

Layer / File(s) Summary
Filter and validate groups
aperture/src/transaction.rs
group_inner_instructions filters out empty groups and preserves the original indexes of retained groups. A test checks the retained group’s index and instructions, and confirms that all-empty input produces no groups.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: bmuddha

Merge Risk: Minimal · previous review a3155

No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title names the change: empty inner instruction groups are omitted in the aperture crate. It matches the raw summary, which says group_inner_instructions now omits groups with no CPI instructions.…
Description check Passed The description explains the change. It says the SVM leaves an inner instruction group empty when an instruction makes no CPI, and that group_inner_instructions copied those empty groups. It lists the…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: empty inner instruction groups are omitted in the aperture crate. It matches the raw summary, which says group_inner_instructions now omits groups with no CPI instructions. The title uses the conventional fix(scope) prefix and is short and specific.

Full details: Description check

Explanation

The description explains the change. It says the SVM leaves an inner instruction group empty when an instruction makes no CPI, and that group_inner_instructions copied those empty groups. It lists the affected paths (getTransaction, getBlock, simulateTransaction, and Geyser plugin metadata), states that the fix matches Solana's map_inner_instructions filter, and notes that group indexes are unchanged. It also describes the added unit test. This relates directly to the changeset.

Finishing Touches

🧪 Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 10a3ef3 and a31554a.

Files selected for processing: 1

  • aperture/src/transaction.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@bmuddha bmuddha self-assigned this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants