lea-improvement-proposals

Abstract

This LIP proposes replacing the original CTE v1.0 Tag 10 "Index Reference" field with a more versatile structure named the "Index and Extended Data Field" (or "IxData Field" for short). This new structure utilizes the previously reserved bits 1-0 of the header byte to introduce four sub-types, enabling the efficient encoding of: legacy 4-bit indices, standard variable-length integers (ULEB128/SLEB128), common fixed-size data types (integers, floats), and single-byte constants (including booleans). This enhances the expressiveness and efficiency of the CTE format.

Motivation

The original CTE v1.0 specification defined the Tag 10 field solely as a 1-byte reference containing a 4-bit index (0-15) into preceding key or signature lists. While useful, this is limiting. Applications built on CTE often require encoding other fundamental data types compactly, such as:

  1. Integers larger than 15 or needing variable-length encoding for efficiency.
  2. Signed integers.
  3. Standard fixed-size types like int32, uint64, float, and double without the overhead of the generic Command Data field.
  4. Atomic boolean values (true/false) or other single-byte markers (like null) in a highly compact, unambiguous way.

This proposal addresses these needs by repurposing the Tag 10 field. By using the two previously reserved bits (1-0) as a sub-type selector, we can introduce multiple data formats under a single tag, significantly increasing the utility and efficiency of the CTE format while maintaining partial backwards compatibility for the original index reference use case.

Specification

This LIP replaces Section 4.3 of the CTE v1.0 specification document entirely with the following:


4.3. Index and Extended Data Field (IxData Field) (Tag 10)


4.3.1. Sub-Type 00: Legacy Index Reference


4.3.2. Sub-Type 01: Variable-Length Encoded Integer (Varint)


4.3.3. Sub-Type 10: Fixed Data Type


4.3.4. Sub-Type 11: Single-Byte Constant/Marker


Rationale

Backwards Compatibility

This proposal introduces new interpretations for the Tag 10 field based on the value of bits 1-0.

Adoption of this LIP requires updating CTE processors to recognize and handle all four defined sub-types of the Tag 10 IxData Field. This change effectively defines CTE v1.1.

Security Considerations

This LIP is licensed under the MIT License, in alignment with the main LEA Project License.