Commit 02ed403
committed
fix(solana): derive the omitted compute-unit limit instead of assuming the cap
When a transaction carries no SetComputeUnitLimit, the runtime requests
200,000 compute units per non-ComputeBudget instruction, capped at 1,400,000 --
it does not request the cap unconditionally. Assuming the cap could not
understate the fee, but it overstated it badly: a transfer alongside a
unit-price instruction is charged on 200,000 CUs and the device displayed
seven times that as the "Maximum priority fee".
Deriving the limit keeps the no-understatement property, because it is exactly
what the runtime will charge, and makes the screen describe the transaction
actually being signed.
The test that pinned the old rule is updated. It now covers the realistic
1-instruction case and the cap, which SOL_MAX_INSTRUCTIONS (8) lets a
transaction reach exactly with seven non-budget instructions -- so the clamp
stays as defence rather than as a reachable path.1 parent defc9ea commit 02ed403
2 files changed
Lines changed: 63 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
802 | 815 | | |
803 | 816 | | |
804 | 817 | | |
805 | 818 | | |
806 | | - | |
| 819 | + | |
807 | 820 | | |
808 | 821 | | |
| 822 | + | |
809 | 823 | | |
810 | 824 | | |
811 | 825 | | |
812 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
813 | 830 | | |
814 | 831 | | |
815 | 832 | | |
| |||
820 | 837 | | |
821 | 838 | | |
822 | 839 | | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
823 | 855 | | |
824 | 856 | | |
825 | 857 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
674 | 696 | | |
675 | 697 | | |
676 | | - | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
677 | 701 | | |
678 | 702 | | |
679 | 703 | | |
| |||
0 commit comments