Skip to content

Commit 6231ba7

Browse files
committed
feat(core/solana): optional program reference for SetComputeUnitLimit
1 parent 4aa242b commit 6231ba7

File tree

5 files changed

+74
-3
lines changed

5 files changed

+74
-3
lines changed

common/defs/solana/programs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@
10561056
"optional": false
10571057
}
10581058
],
1059-
"references": [],
1059+
"references": ["program_ref"],
10601060
"references_required": 0,
10611061
"ui_properties": [
10621062
{

common/defs/solana/programs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ _This file is generated by `programs.md.mako` via `make solana_templates`, do no
281281
| Label | Value | Type |
282282
|-------|-------|------|
283283
| Units | `units` | `u32` |
284+
| _(not shown)_ | `program_ref` | `account` |
284285

285286
### (3) Set Compute Unit Price
286287

common/tests/fixtures/solana/sign_tx.compute_budget_program.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,71 @@
348348
"result": {
349349
"expected_signature": "28ea83fcee7c5e51678e04aa72d37018fd41240ec0c3262268b2dc449971bcc2705ac7d9d24515b9a2c23fe59343d9732466a2207a30ca4f4d84c0ee31451f00"
350350
}
351+
},
352+
{
353+
"description": "Jito Transfer With Compute Budget",
354+
"parameters": {
355+
"address": "m/44'/501'/0'/0'",
356+
"construct": {
357+
"version": null,
358+
"header": {
359+
"signers": 1,
360+
"readonly_signers": 0,
361+
"readonly_non_signers": 3
362+
},
363+
"accounts": [
364+
"14CCvQzQzHCVgZM3j9soPnXuJXh1RmCfwLVUcdfbZVBS",
365+
"ETxHeBBcuw9Yu4dGuP3oXrD12V5RECvmi8ogQ9PkjyVF",
366+
"11111111111111111111111111111111",
367+
"ComputeBudget111111111111111111111111111111",
368+
"asgardprogram111111111111111111111111111111"
369+
],
370+
"blockhash": "2p4rYZAaFfV5Uk5ugdG5KPNty9Uda9B3b4gWB8qnNqak",
371+
"instructions": [
372+
{
373+
"program_index": 3,
374+
"accounts": {},
375+
"data": {
376+
"instruction_id": 1,
377+
"bytes": 2048
378+
}
379+
},
380+
{
381+
"program_index": 3,
382+
"accounts": {
383+
"program_ref": 4
384+
},
385+
"data": {
386+
"instruction_id": 2,
387+
"units": 200000
388+
}
389+
},
390+
{
391+
"program_index": 3,
392+
"accounts": {},
393+
"data": {
394+
"instruction_id": 3,
395+
"lamports": 8000
396+
}
397+
},
398+
{
399+
"program_index": 2,
400+
"accounts": {
401+
"funding_account": 0,
402+
"recipient_account": 1
403+
},
404+
"data": {
405+
"instruction_id": 2,
406+
"lamports": 20000000
407+
}
408+
}
409+
],
410+
"luts": []
411+
}
412+
},
413+
"result": {
414+
"expected_signature": "d0168dab377aef237fb54312afaae9906645355278623d9abfc6e06fd7b63ba5acf36d5f9fe22860f1644c88d81b66317ef605244ce6a121740d0d0331073d05"
415+
}
351416
}
352417
]
353418
}

core/src/apps/solana/transaction/instructions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ class ComputeBudgetProgramRequestHeapFrameInstruction(Instruction):
549549
class ComputeBudgetProgramSetComputeUnitLimitInstruction(Instruction):
550550
units: int
551551

552+
program_ref: Account | None
553+
552554
class ComputeBudgetProgramSetComputeUnitPriceInstruction(Instruction):
553555
lamports: int
554556

@@ -2363,7 +2365,7 @@ def get_instruction(
23632365
),
23642366
),
23652367
0,
2366-
(),
2368+
("program_ref",),
23672369
(
23682370
UIProperty(
23692371
"units",

tests/device_tests/solana/construct/instructions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,10 @@ class ComputeBudgetProgramInstruction(Enum):
549549

550550
ComputeBudgetProgram_SetComputeUnitLimit = Struct(
551551
"program_index" / Byte,
552-
"accounts" / CompactStruct(),
552+
"accounts"
553+
/ CompactStruct(
554+
"program_ref" / Optional(Byte),
555+
),
553556
"data"
554557
/ CompactStruct(
555558
"instruction_id" / Const(2, Byte),

0 commit comments

Comments
 (0)