EIP-2972 Legacy transaction wrapping (Wrapped Legacy Transactions)

No call decision · EVM & execution · EIP status Withdrawn · created 2020-09-12

A proposal to leave existing legacy transactions and their signatures unchanged while wrapping them in the new typed transaction (EIP-2718) format, so that past signatures are not invalidated even if the legacy format is eventually removed entirely.

Why it is needed

Ethereum must keep maintaining code in its networking and signing layers to handle the legacy transaction format and its signing rules. To permanently remove this code, there needs to be a way to prevent a situation where transactions signed in the legacy format can no longer be included in blocks, locking up funds. With the introduction of the EIP-2718 typed transaction scheme, two transaction types that remain compatible with legacy signatures can be wrapped in the new typed format. This lets clients progressively remove legacy handling code while still guaranteeing the validity of existing signatures.

What changes

Today

After EIP-2972

Who is affected

In depth

The two transaction types

Type 0x00 is 0x00 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data])), wrapping a legacy transaction without a chain ID. Type 0x01 is 0x01 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0])), wrapping a legacy transaction that includes an EIP-155 chain ID. For both types, the inner RLP portion is signed, processed, and validated in exactly the same way as a legacy transaction; only the final encoding changes. After FORK_BLOCK_NUMBER, the old 9-field RLP legacy transaction format including v, r, s is no longer valid in blocks.

Separating the signature from the signed data

Verifying a legacy transaction's signature required first fully RLP-decoding it, stripping out the signature, then re-encoding the remainder back into RLP, and if an EIP-155 chain ID was present, additionally decoding the v value to include it in the signed data. This proposal encodes yParity, r, s directly at the front in SSZ, so the signature can be extracted immediately just from its byte position without decoding, and the data remaining afterward is exactly the signed RLP data.

Receipts wrapped the same way

Receipts likewise have two types, following the same principle as transactions. Both 0 || ssz.serialize(status, cumulativeGasUsed, logsBloom, logs) and 1 || ssz.serialize(...) are valid receipts, with the content identical to existing legacy receipt handling; only the encoding changes. A log consists of address (bytes20), topics (List[bytes32, 4]), and data (List[uint8, 0xffffff]), and a receipt consists of the fields status, cumulativeGasUsed, logsBloom (BitVector[2048]), and logs (List[Log, 0xffffff]). After FORK_BLOCK_NUMBER, legacy RLP receipts lose validity.

Why SSZ

The original text explains that there is a consensus that RLP is unsuitable for encoding data meant to be hashed, since it cannot be streamed. It notes that SSZ is likely to be included in Ethereum at some point, so clients will probably already have a decoder for it. While variable-length items like logs do require some pointer arithmetic, it explains that manual decoding is not significantly complex even without a full SSZ decoder.

Length limits on logs and log data

logs is List[Log, 0xffffff], and Log's topics and data are likewise capped at List[bytes32, 4] and List[uint8, 0xffffff] respectively. This figure is a practical upper bound arising because EIP-706 limits devp2p messages to a 24-bit length, and the original text states it chose this as a reasonable upper bound, expecting little need for larger values in the near future.

How conflicts with legacy signatures were avoided

EIP-2718 recommends putting the transaction type as the first byte of the signed data, but this proposal cannot do that since it must remain compatible with legacy signatures. Instead, it takes advantage of the fact that EIP-2718 excludes 0xc0 through 0xfe from valid transaction types. Since the first byte of the signature this proposal produces falls exactly within that excluded range, it will not conflict with other types going forward. This signature's value could also overlap with a legacy transaction's, but since both forms are processed identically, it does not matter whether it is included as a legacy or as a typed transaction.

Withdrawn status and remaining open items

This EIP's status is marked Withdrawn. In the original text itself, the hashing or Merkleization method for the block's transaction and receipt roots is left as an empty TODO, and the Test Cases and Implementation sections also remain TBD. In other words, this is a document whose work was halted before the specification was completed, and the provided call records contain nothing about a fork-inclusion decision.

Original EIP · ← EIPs