Skip to content

fix: ignore compute budget parsing#17

Draft
bmuddha wants to merge 1 commit into
mainfrom
bmuddha/hfix/compute-budget-ignore
Draft

fix: ignore compute budget parsing#17
bmuddha wants to merge 1 commit into
mainfrom
bmuddha/hfix/compute-budget-ignore

Conversation

@bmuddha
Copy link
Copy Markdown
Collaborator

@bmuddha bmuddha commented Apr 15, 2026

Summary by CodeRabbit

  • Refactor
    • Simplified transaction fee-payer validation logic for improved efficiency.

@bmuddha bmuddha requested a review from GabrielePicco April 15, 2026 15:43
@bmuddha bmuddha self-assigned this Apr 15, 2026
@bmuddha bmuddha changed the title fix: ignore compute budger parsing fix: ignore compute budget parsing Apr 15, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Walkthrough

Modified transaction processor to replace compute budget instruction processing with default compute budget limits in the fee-payer validation function, eliminating associated error counter increments during this validation step.

Changes

Cohort / File(s) Summary
Compute Budget Validation Refactor
src/transaction_processor.rs
Replaced process_compute_budget_instructions() call with ComputeBudgetLimits::default() in validate_transaction_fee_payer, removing compute budget instruction parsing and associated error counter updates from the fee-payer validation path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix: ignore compute budget parsing' directly describes the main change: replacing compute-budget instruction parsing with a default value, effectively ignoring that parsing in fee-payer validation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bmuddha/hfix/compute-budget-ignore

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/transaction_processor.rs (2)

32-32: 🧹 Nitpick | 🔵 Trivial

Unused import in production code.

process_compute_budget_instructions is imported but no longer used in production code after the change at line 639. It's only referenced by test code. Consider either:

  1. Moving this import inside the #[cfg(test)] module, or
  2. Using #[cfg(test)] conditional compilation for this import
♻️ Suggested refactor
-    solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions,

Then add inside the #[cfg(test)] mod tests block:

use solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/transaction_processor.rs` at line 32, The import
solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions
is unused in production and should be conditionally compiled for tests; either
move that use into the existing #[cfg(test)] mod tests block (add use
solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions;
inside the tests module) or wrap the top-level import with #[cfg(test)] so it is
only compiled for tests, ensuring no unused-import warning in production while
keeping the symbol available to test code.

2581-2610: ⚠️ Potential issue | 🔴 Critical

Test will fail due to removed compute budget parsing.

This test expects validate_transaction_nonce_and_fee_payer to reject transactions with duplicate set_compute_unit_limit instructions by returning TransactionError::DuplicateInstruction(1u8) and incrementing error_counters.invalid_compute_budget.

With the change at line 639 replacing process_compute_budget_instructions() with ComputeBudgetLimits::default(), compute budget instructions are no longer validated during fee payer validation, so this test will fail.

Either:

  1. Remove/update this test if the behavior change is intentional, or
  2. Reconsider the change at line 639 if this validation is still needed
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/transaction_processor.rs` around lines 2581 - 2610, The test
test_validate_transaction_fee_payer_invalid_compute_budget now fails because
validate_transaction_nonce_and_fee_payer no longer parses compute-budget
instructions (the call to process_compute_budget_instructions was replaced with
ComputeBudgetLimits::default()), so duplicate set_compute_unit_limit
instructions are not detected and error_counters.invalid_compute_budget isn't
incremented; to fix, either restore compute-budget parsing/validation inside
validate_transaction_nonce_and_fee_payer by calling
process_compute_budget_instructions (or equivalent logic) so
DuplicateInstruction(1u8) is returned and error_counters.invalid_compute_budget
is incremented, or if the behavioral change is intentional, update/remove the
test test_validate_transaction_fee_payer_invalid_compute_budget to reflect the
new behavior (and any expectations around TransactionError::DuplicateInstruction
and error_counters.invalid_compute_budget).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/transaction_processor.rs`:
- Line 32: The import
solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions
is unused in production and should be conditionally compiled for tests; either
move that use into the existing #[cfg(test)] mod tests block (add use
solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions;
inside the tests module) or wrap the top-level import with #[cfg(test)] so it is
only compiled for tests, ensuring no unused-import warning in production while
keeping the symbol available to test code.
- Around line 2581-2610: The test
test_validate_transaction_fee_payer_invalid_compute_budget now fails because
validate_transaction_nonce_and_fee_payer no longer parses compute-budget
instructions (the call to process_compute_budget_instructions was replaced with
ComputeBudgetLimits::default()), so duplicate set_compute_unit_limit
instructions are not detected and error_counters.invalid_compute_budget isn't
incremented; to fix, either restore compute-budget parsing/validation inside
validate_transaction_nonce_and_fee_payer by calling
process_compute_budget_instructions (or equivalent logic) so
DuplicateInstruction(1u8) is returned and error_counters.invalid_compute_budget
is incremented, or if the behavioral change is intentional, update/remove the
test test_validate_transaction_fee_payer_invalid_compute_budget to reflect the
new behavior (and any expectations around TransactionError::DuplicateInstruction
and error_counters.invalid_compute_budget).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2ae7080e-7aaf-4176-aa53-6b30def68188

📥 Commits

Reviewing files that changed from the base of the PR and between 5ea30a7 and 5bd8b4d.

📒 Files selected for processing (1)
  • src/transaction_processor.rs

@bmuddha bmuddha marked this pull request as draft April 15, 2026 15:49
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.

1 participant