Skip to content

Enforce more constraints on transactions #1223

@mcintyre94

Description

@mcintyre94

Motivation

Currently transactions are limited to 1232 bytes, which makes it difficult to exceed a number of constraints on transactions. These are enforced by the validator but not currently by Kit. They become trivially easy to exceed given 4096 byte transactions.

See constraints in SIMD for V1 transactions

value max specified by this SIMD prior max max implied by format
transaction size 4096 1232 4096
signatures per transaction 12 12 42
num accounts 64 64 96
num instructions 64 64 255
accounts/instruction 255 255 255

Transaction size is covered separately by #1221 and should not be changed in this issue, which is a prerequisite for that

But signature count, account count, instruction count, are all able to be exceeded with 4096 byte transactions, but explicitly not relaxed for v1 transactions. This means that these constraints apply to all transaction versions.

accounts/instruction is unchanged, and probably currently implicitly covered by its encoder, which likely throws if we try to encode a longer array length. But it probably makes sense to give it the same error handling as the others.

Kit should not allow transactions that violate these constraints to be compiled.

Details

  • This is a prerequisite for SIMD 296 - Larger Transaction Size #1221, as it becomes very easy to accidentally violate these constraints with a 4096 byte transaction. But these constraints also apply to legacy/v0 transactions, so this work can be done independently
  • We need a helpful error for each constraint
  • At a minimum, we probably want to throw in compileTransactionMessage if the input transaction message violates any constraints
  • We need to think carefully about making sure the transaction planner API enforces these constraints as it is packing transactions

Supersedes #1102, which only considers the instruction count

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions