|
| 1 | +# ADR 0003: Typed Transactions for Sponsorship |
| 2 | + |
| 3 | +## Changelog |
| 4 | + |
| 5 | +* 2026-01-05: Initial draft structure. |
| 6 | + |
| 7 | +## Status |
| 8 | + |
| 9 | +DRAFT Not Implemented |
| 10 | + |
| 11 | +> Please have a look at the [PROCESS](./PROCESS.md#adr-status) page. |
| 12 | +> Use DRAFT if the ADR is in a draft stage (draft PR) or PROPOSED if it's in review. |
| 13 | +
|
| 14 | +## Abstract |
| 15 | + |
| 16 | +This ADR proposes a simplified way to sponsor transactions in reth by using |
| 17 | +typed transactions enabled by EIP-2718. The idea is to define a typed |
| 18 | +transaction format that separates the gas payer from the executor so the cost |
| 19 | +can be covered without altering the normal execution flow. This reduces |
| 20 | +complexity for users and integrations. |
| 21 | + |
| 22 | +## Context |
| 23 | + |
| 24 | +Gas sponsorship is a recurring requirement for onboarding users and for product |
| 25 | +flows that should not require the end user to hold native funds. Today, the only |
| 26 | +available approach in reth is to bundle sponsorship logic off-chain or via |
| 27 | +custom infrastructure, which increases integration complexity and makes |
| 28 | +transaction handling inconsistent across clients. |
| 29 | + |
| 30 | +EIP-2718 introduces typed transactions, providing a structured way to extend |
| 31 | +transaction formats while keeping backward compatibility with existing |
| 32 | +processing pipelines. This creates an opportunity to standardize a sponsorship |
| 33 | +mechanism within the transaction itself rather than relying on external |
| 34 | +conventions. |
| 35 | + |
| 36 | +The project needs a minimal, explicit mechanism to separate the gas payer from |
| 37 | +the executor, without changing the execution semantics of the underlying call. |
| 38 | +At the same time, it must remain compatible with existing tooling, avoid |
| 39 | +breaking current transaction flows, and be straightforward to implement in |
| 40 | +reth's transaction validation and propagation layers. |
| 41 | + |
| 42 | +## Alternatives |
| 43 | + |
| 44 | +TODO |
| 45 | + |
| 46 | +## Decision |
| 47 | + |
| 48 | +> This section describes our response to these forces. It is stated in full |
| 49 | +> sentences, with active voice. "We will ..." |
| 50 | +We will implement gas sponsorship by introducing a new EIP-2718 typed |
| 51 | +transaction in ev-reth. The new type (0x76) encodes both the execution call |
| 52 | +and a separate sponsor authorization, enabling a sponsor account to pay fees |
| 53 | +while preserving normal EVM execution semantics for the user call. The type is |
| 54 | +added to the transaction envelope, validated in the txpool, and executed by |
| 55 | +charging the sponsor while the sender remains the call origin. |
| 56 | + |
| 57 | +## Implementation Plan |
| 58 | + |
| 59 | +1. Define the transaction envelope and typed transaction. |
| 60 | + - We will mirror the Tempo-style envelope pattern, extending the envelope |
| 61 | + with a sponsorship transaction type (0x76) and a typed wrapper. |
| 62 | + - The sponsorship transaction is specific to ev-reth and is not a wrapper |
| 63 | + around an existing type: it carries explicit sponsor authorization fields. |
| 64 | + |
| 65 | +```rust |
| 66 | +#[derive(Clone, Debug, alloy_consensus::TransactionEnvelope)] |
| 67 | +#[envelope( |
| 68 | + tx_type_name = EvRethTxType, |
| 69 | + typed = EvRethTypedTransaction, |
| 70 | + arbitrary_cfg(any(test, feature = "arbitrary")), |
| 71 | + serde_cfg(feature = "serde") |
| 72 | +)] |
| 73 | +#[cfg_attr(test, reth_codecs::add_arbitrary_tests(compact, rlp))] |
| 74 | +#[expect(clippy::large_enum_variant)] |
| 75 | +pub enum EvRethTxEnvelope { |
| 76 | + #[envelope(ty = 0)] |
| 77 | + Legacy(Signed<TxLegacy>), |
| 78 | + #[envelope(ty = 1)] |
| 79 | + Eip2930(Signed<TxEip2930>), |
| 80 | + #[envelope(ty = 2)] |
| 81 | + Eip1559(Signed<TxEip1559>), |
| 82 | + #[envelope(ty = 3)] |
| 83 | + Eip4844(Signed<TxEip4844>), |
| 84 | + #[envelope(ty = 0x76, typed = SponsorTransaction)] |
| 85 | + Sponsor(SponsorSigned), |
| 86 | +} |
| 87 | + |
| 88 | +pub struct SponsorTransaction { |
| 89 | + // User/executor call fields (sender remains call origin) |
| 90 | + pub chain_id: u64, |
| 91 | + // Sponsorship fields (payer is separate) |
| 92 | + pub fee_payer_signature: Signature, |
| 93 | + pub fee_token: Address, |
| 94 | +} |
| 95 | +``` |
| 96 | + |
| 97 | +## Consequences |
| 98 | + |
| 99 | +> This section describes the resulting context, after applying the decision. All |
| 100 | +> consequences should be listed here, not just the "positive" ones. A particular |
| 101 | +> decision may have positive, negative, and neutral consequences, but all of them |
| 102 | +> affect the team and project in the future. |
| 103 | +
|
| 104 | +### Backwards Compatibility |
| 105 | + |
| 106 | +> All ADRs that introduce backwards incompatibilities must include a section |
| 107 | +> describing these incompatibilities and their severity. The ADR must explain |
| 108 | +> how the author proposes to deal with these incompatibilities. ADR submissions |
| 109 | +> without a sufficient backwards compatibility treatise may be rejected outright. |
| 110 | +
|
| 111 | +### Positive |
| 112 | + |
| 113 | +> {positive consequences} |
| 114 | +
|
| 115 | +### Negative |
| 116 | + |
| 117 | +> {negative consequences} |
| 118 | +
|
| 119 | +### Neutral |
| 120 | + |
| 121 | +> {neutral consequences} |
| 122 | +
|
| 123 | +## Further Discussions |
| 124 | + |
| 125 | +> While an ADR is in the DRAFT or PROPOSED stage, this section should contain a |
| 126 | +> summary of issues to be solved in future iterations (usually referencing comments |
| 127 | +> from a pull-request discussion). |
| 128 | +> |
| 129 | +> Later, this section can optionally list ideas or improvements the author or |
| 130 | +> reviewers found during the analysis of this ADR. |
| 131 | +
|
| 132 | +## Test Cases [optional] |
| 133 | + |
| 134 | +Test cases for an implementation are mandatory for ADRs that are affecting consensus |
| 135 | +changes. Other ADRs can choose to include links to test cases if applicable. |
| 136 | + |
| 137 | +## References |
| 138 | + |
| 139 | +* {reference link} |
0 commit comments