Skip to content

Commit a22e932

Browse files
committed
Initial draft.
1 parent d036aa2 commit a22e932

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
simd: 'XXXX'
3+
title: Charge CUs for ABIv0/v1 instructions
4+
authors:
5+
- Alexander Meißner (Anza)
6+
category: Standard
7+
type: Core
8+
status: Idea
9+
created: 2026-01-23
10+
feature: TBD
11+
---
12+
13+
## Summary
14+
15+
Charge CUs for account data and instruction data better reflecting the cost
16+
incurred on a validator in ABI v0 and v1.
17+
18+
## Motivation
19+
20+
- ABIv0/v1 only charge CUs for account data length in the call edge of CPI,
21+
not at all in the top-level
22+
- ABIv0/v1 do not charge CUs for instruction data length, neither in CPI nor
23+
the top-level
24+
25+
## Dependencies
26+
27+
This proposal soft depends either one of the following proposals:
28+
29+
- **[SIMD-0177]: Program Runtime ABI v2**
30+
31+
ABIv2 will offer an alternative path which does not charge these CUs.
32+
33+
- **[SIMD-0370]: Remove Compute Unit Block Limit**
34+
35+
If the alternative (ABIv2) is not offered in time the increased CUs per IX
36+
would reach the block packing limit quicker. It thus would have to be
37+
increased or removed.
38+
39+
[SIMD-0177]: https://github.com/solana-foundation/solana-improvement-documents/pull/177
40+
[SIMD-0370]: https://github.com/solana-foundation/solana-improvement-documents/pull/370
41+
42+
## New Terminology
43+
44+
None
45+
46+
## Detailed Design
47+
48+
Independent of any SIMD a validator should already charge CUs according to
49+
`cpi_bytes_per_unit` for:
50+
51+
- instruction data length at the ABIv0 and ABIv1 CPI call edge
52+
- original account data length of the callee at the ABIv0 and ABIv1 CPI call
53+
edge
54+
55+
Starting with activation of the feature gate associated with SIMD-0339 a
56+
validator should already charge CUs for:
57+
58+
- number of account metas at the ABIv0 and ABIv1 CPI call edge
59+
- number of account infos at the ABIv0 and ABIv1 CPI call edge
60+
61+
Starting with activation of the feature gate associated with this SIMD a
62+
validator must charge CUs according to `cpi_bytes_per_unit` for:
63+
64+
- instruction data length in ABIv0 and ABIv1 serialization
65+
- account data length before the instruction in ABIv0 serialization
66+
- account data length before the instruction + 10 KiB in ABIv1
67+
serialization
68+
- account data length after the instruction in ABIv0 and ABIv1 deserialization
69+
- original account data length of the caller at the ABIv0 and ABIv1 CPI return
70+
edge
71+
72+
## Alternatives Considered
73+
74+
This is inevitable especially when the network uses larger account sizes.
75+
76+
## Impact
77+
78+
An instruction will be charged for **each byte of instruction data**:
79+
80+
- at top-level: 1 time instead of 0 times (xUndefined or +Undefined%)
81+
- at any CPI level: 2 times instead of 1 time (x2 or +100%)
82+
83+
In the normal case of accounts not being resized an instruction will be charged
84+
for **each byte of every instruction account**:
85+
86+
- at top-level: 2 times instead of 0 times (xUndefined or +Undefined%)
87+
- at top-level + one CPI level: 6 times instead of 1 time (x6 or +500%)
88+
- at top-level + two CPI levels: 10 times instead of 2 times (x5 or +400%)
89+
- at top-level + three CPI levels: 14 times instead of 3 times (x4.66 or +377%)
90+
- at top-level + four CPI levels: 18 times instead of 4 times (x4.5 or +350%)
91+
92+
## Security Considerations
93+
94+
None
95+
96+
## Drawbacks
97+
98+
It will break existing TX building as the CUs required will be significantly
99+
increased. To counter this we either have to offer an alternative (ABIv2) or
100+
adjust the CU price / fees and block packing limits.

0 commit comments

Comments
 (0)