CHIP: Targeted Virtual Machine Limits

By fixing poorly-targeted limits, we can make Bitcoin Cash contracts more powerful (without increasing validation costs).

A new Cash Improvement Proposal (CHIP) is now available: CHIP-2021-05-vm-limits: Targeted Virtual Machine Limits.

This proposal replaces several poorly-targeted virtual machine (VM) limits with alternatives which protect against the same malicious cases while significantly increasing the power of the Bitcoin Cash contract system:

  • the 520-byte stack element size limit is raised to 10,000 bytes.
  • The 201 operation limit is removed.
  • A new cumulative hashing limit is introduced, limiting contracts to 660 digest iterations per evaluation.
  • A new stack memory usage limit is introduced, limiting contracts to 130,000 bytes of data on the stack.

The proposal intentionally avoids modifying other properties of the current VM:

  • The limits on maximum standard input bytecode length (A.K.A. MAX_TX_IN_SCRIPT_SIG_SIZE – 1,650 bytes), maximum VM bytecode length (A.K.A. MAX_SCRIPT_SIZE – 10,000 bytes), maximum standard transaction byte-length (A.K.A. MAX_STANDARD_TX_SIZE – 100,000 bytes) and consensus-maximum transaction byte-length (A.K.A. MAX_TX_SIZE – 1,000,000 bytes) are not modified.
  • The cost and incentives around blockchain “data storage” are not measurably affected.
  • The worst-case transaction validation processing and memory requirements of the VM are not measurably affected.

The full technical specification is provided in the CHIP.

Feedback and review is appreciated, please join the discussion on the Bitcoin Cash Research Forum or submit an issue on GitHub. Thanks!