Background
morph-reth stores original encoded transaction bytes for real transactions, so real L1 fee calculation preserves the actual MorphTxEnvelope variant. Simulation paths such as eth_call / eth_estimateGas may not have original signed transaction bytes, so MorphTxEnv::encode_for_l1_fee() rebuilds an envelope for L1 fee accounting.
Problem
build_ethereum_envelope_for_l1_fee() currently infers the fallback transaction type from field shape:
- no dynamic fee and no access list => Legacy
- access list and no dynamic fee => EIP-2930
- otherwise => EIP-1559
This misses EIP-7702 entirely, dropping authorization_list from simulated fee bytes. It can also mis-encode EIP-2930 transactions with an empty access list as Legacy because the type is inferred from access_list.is_empty().
Scope
- Make
MorphTxEnv::encode_for_l1_fee() / build_ethereum_envelope_for_l1_fee() preserve explicit transaction type where possible.
- Add EIP-7702 fallback encoding using
TxEip7702, including authorization list data.
- Preserve EIP-2930 typed encoding even when the access list is empty if
tx_type == 0x01.
- Keep Legacy, EIP-1559, L1 message, MorphTx, and unsupported blob behavior explicit.
- Add focused tests for the fallback encoder.
Acceptance Criteria
- EIP-7702 fallback L1 fee encoding includes authorization list data.
- Empty-access-list EIP-2930 fallback encoding remains typed as EIP-2930, not Legacy.
- Existing Legacy / EIP-1559 / MorphTx fallback behavior is unchanged.
- Tests fail before the fix and pass after it.
Background
morph-rethstores original encoded transaction bytes for real transactions, so real L1 fee calculation preserves the actualMorphTxEnvelopevariant. Simulation paths such aseth_call/eth_estimateGasmay not have original signed transaction bytes, soMorphTxEnv::encode_for_l1_fee()rebuilds an envelope for L1 fee accounting.Problem
build_ethereum_envelope_for_l1_fee()currently infers the fallback transaction type from field shape:This misses EIP-7702 entirely, dropping
authorization_listfrom simulated fee bytes. It can also mis-encode EIP-2930 transactions with an empty access list as Legacy because the type is inferred fromaccess_list.is_empty().Scope
MorphTxEnv::encode_for_l1_fee()/build_ethereum_envelope_for_l1_fee()preserve explicit transaction type where possible.TxEip7702, including authorization list data.tx_type == 0x01.Acceptance Criteria