SIMD-0406
Maximum instruction accounts
Feature Gate Status
DqbnFPASg7tHmZ6qfpdrt2M6MWoSeiicWPXxPhxqFCQ
Min Agave: v4.0.0
TL;DR
This SIMD imposes a hard restriction on the maximum number of account references that an instruction may declare. There is already a limit of 255 account references imposed during serialization in ABI v0 and v1, but it does not currently apply to builtin invocations or precompiles.
Summary
This SIMD imposes a hard restriction on the maximum number of account references that an instruction may declare. There is already a limit of 255 account references imposed during serialization in ABI v0 and v1, but it does not currently apply to builtin invocations or precompiles.
Motivation
Although there can only be a maximum of 35 account keys in the legacy message format and 256 in the v0 format, instructions can have up to 65535 (`u16::MAX`) accounts, each being a `u8` index referencing a transaction account. Allowing instructions to reference more accounts than what the message format allows is not necessary. On one hand there is a limit of 255 accounts for CPI and user deployed programs, on the other, builtins and precompiles do not need as many accounts as the message format allows. Furthermore, since there can only be 256 unique pubkeys in a transaction, any instruction referencing more than 256 will have aliased references, requiring the validator to deduplicate them, even though they are unused.
Impact
Calls to user deployed programs from top level instructions and CPIs will not be impacted, since there is already a limit in place. Instructions that invoke builtin programs or precompiles will error out if they have more than 255 accounts.
Security Considerations
None.