Background
Morph L1 data fee calculation has two paths:
- Real transactions use
CalculateL1DataFee(tx), which calls tx.MarshalBinary() and preserves the actual transaction type and fields.
- Simulation / estimation paths use
EstimateL1DataFeeForMessage(msg, ...), which rebuilds a transaction from types.Message via rollup/fees.asUnsignedTx() before encoding it for fee calculation.
The fallback path currently reconstructs only legacy, access-list, dynamic-fee, and MorphTx transactions.
Problem
types.Message already carries EIP-7702 authorizations via SetCodeAuthorizations(), and execution uses them. However, rollup/fees.asUnsignedTx() does not reconstruct a SetCodeTx, so EIP-7702 authorization data is omitted from the bytes used for L1 data fee estimation.
This can under-estimate L1 data fee in simulation / estimation paths such as morph_estimateL1DataFee and gas allowance calculations. The real signed transaction path is not affected because it uses the actual encoded transaction bytes.
There is also a transaction-type exactness concern for EIP-2930 with an empty access list: fallback encoding should preserve the requested tx type rather than infer type only from field shape where possible.
Scope
- Make the fallback L1 fee encoding path reconstruct transactions by explicit tx type / message semantics instead of losing type-specific fields.
- Add a
SetCodeTx branch when msg.SetCodeAuthorizations() is non-empty.
- Preserve chain id, nonce, gas caps, value, data, access list, target address, and authorization list.
- Review EIP-2930 empty access-list behavior and preserve typed transaction encoding where the request/message indicates access-list tx semantics.
- Keep the real transaction path
CalculateL1DataFee(tx) unchanged.
Acceptance Criteria
- EIP-7702 fallback L1 fee encoding includes the authorization list bytes.
- Tests show the L1 fee estimate differs from plain EIP-1559 when authorization list data is present.
- Existing Legacy / EIP-2930 / EIP-1559 / MorphTx L1 fee fallback behavior remains covered.
- Tests fail before the fix and pass after it.
Background
Morph L1 data fee calculation has two paths:
CalculateL1DataFee(tx), which callstx.MarshalBinary()and preserves the actual transaction type and fields.EstimateL1DataFeeForMessage(msg, ...), which rebuilds a transaction fromtypes.Messageviarollup/fees.asUnsignedTx()before encoding it for fee calculation.The fallback path currently reconstructs only legacy, access-list, dynamic-fee, and MorphTx transactions.
Problem
types.Messagealready carries EIP-7702 authorizations viaSetCodeAuthorizations(), and execution uses them. However,rollup/fees.asUnsignedTx()does not reconstruct aSetCodeTx, so EIP-7702 authorization data is omitted from the bytes used for L1 data fee estimation.This can under-estimate L1 data fee in simulation / estimation paths such as
morph_estimateL1DataFeeand gas allowance calculations. The real signed transaction path is not affected because it uses the actual encoded transaction bytes.There is also a transaction-type exactness concern for EIP-2930 with an empty access list: fallback encoding should preserve the requested tx type rather than infer type only from field shape where possible.
Scope
SetCodeTxbranch whenmsg.SetCodeAuthorizations()is non-empty.CalculateL1DataFee(tx)unchanged.Acceptance Criteria