Add ComputeBudget SetComputeUnitPrice and SetComputeUnitLimit instructions and composers - #25
Merged
Conversation
Let any transaction composed with Solace attach a compute unit price — the priority fee validators use to order transactions during congestion. The instruction encodes the SetComputeUnitPrice directive (1-byte index 3 + le_u64 micro-lamports) and takes no accounts — the composer registers only the Compute Budget program and resolves its index at compose time. Add unit and validator-backed integration tests, a Compute Budget page to the docs site, rows to the bundled builder/composer tables, and bump to 0.1.7. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Complete the ComputeBudget coverage started with SetComputeUnitPrice so a transaction can also cap its compute units — and, paired with a compute unit price, pin down the exact priority fee it pays. The instruction encodes the SetComputeUnitLimit directive (1-byte index 2 + le_u32 units) and takes no accounts. The composer test asserts the exact on-chain fee implied by a 10k-unit limit at 1M micro-lamports per unit. Extends the Compute Budget docs page, the bundled builder and composer tables, and the 0.1.7 changelog entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fulf
force-pushed
the
feature/compute-budget-set-compute-unit-price
branch
from
July 3, 2026 09:04
cd3eb96 to
725b5de
Compare
sebscholl
requested changes
Jul 3, 2026
sebscholl
left a comment
Collaborator
There was a problem hiding this comment.
Looks good with the exception of the two tests that seem to not be validating the relevant subject.
The convention of the gem is to prove the relevant behavior in both a sponsored and non sponsored transaction. Please just update that accordingly, as I believe that both tests commented on simply tests a transfer worked as opposed to priority fees/computer budgets being appropriately applied.
The sponsored and non-sponsored cases asserted balances that would pass even if the compute budget instruction never made it on-chain. Each test now uses only its own composer: both files decode the composed transaction and assert the instruction is present with the exact payload, the sponsored and non-sponsored cases confirm the transaction is valid, the price tests assert the priority fee is deducted, and the limit tests add a case where the node rejects a transaction that exceeds the requested limit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fulf
force-pushed
the
feature/compute-budget-set-compute-unit-price
branch
from
July 3, 2026 13:23
93893df to
2d13c2b
Compare
Contributor
Author
|
@sebscholl updated the tests to:
LMK if this is better 🙇 |
sebscholl
requested changes
Jul 4, 2026
Use sequentially organized before blocks with instance variables instead of let statements, matching the price composer test. Rename describe blocks to the behavior actually under test, and merge the sponsored/non-sponsored blocks — they asserted nothing payer-specific and were the same test once named honestly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sebscholl
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Compute Budget program support and bumps the gem to 0.1.7:
Instructions::ComputeBudget::SetComputeUnitPriceInstruction+ composer — priority fee (u83+le_u64micro-lamports)Instructions::ComputeBudget::SetComputeUnitLimitInstruction+ composer — compute unit cap (u82+le_u32units)Includes unit and validator-backed composer tests (one pins the exact on-chain fee implied by limit × price), plus a Compute Budget docs page and table/sidebar entries.
rake test: 345 runs, 0 failures ·rubocop: clean🤖 Generated with Claude Code