Skip to content

feat(rpc): Add RpcTxConverter to allow for providing custom converters with extra context#17827

Merged
mattsse merged 2 commits intomainfrom
rpc-tx-converter
Aug 14, 2025
Merged

feat(rpc): Add RpcTxConverter to allow for providing custom converters with extra context#17827
mattsse merged 2 commits intomainfrom
rpc-tx-converter

Conversation

@RomanHodulak
Copy link
Contributor

@RomanHodulak RomanHodulak commented Aug 12, 2025

Part of #17545

Motivation

Custom nodes with custom transactions need their own Consensus Transaction -> Rpc Transaction Response algorithm.

The input for this conversion is the consensus transaction, it's signer address and an associated TxInfo type.

Solution

Adds a new trait called RpcTxConverter with two blanket implementations:

  • () assuming Tx implements IntoRpcTx and is used as default for RpcConverter
  • Fn(Tx, Address, TxInfo) -> RpcTx and can be applied using RpcConverter::with_rpc_tx_converter

Discussion

Compared to TxEnv and SimTx, custom conversions are easy to achieve thanks to TxInfoMapper being able to generate a custom extra context object that is then used as part of the input for IntoRpcTx. This is being actively used for Optimism deposit transactions.

Therefore, it is somewhat questionable how useful this change is. At the very least it is being consistent with SimTxConverter and TxEnvConverter. To make it more useful, we may merge TxInfoMapper with RpcTxConverter, but then we're broadening the scope of the custom overrides (just tx info vs rpc tx conversion).

@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Aug 12, 2025
@RomanHodulak RomanHodulak marked this pull request as ready for review August 12, 2025 15:44
…count for possible errors in custom implementations
Base automatically changed from rpc-sim-tx-converter to main August 13, 2025 17:28
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Aug 14, 2025
@mattsse mattsse added this pull request to the merge queue Aug 14, 2025
Merged via the queue into main with commit d030ef8 Aug 14, 2025
42 checks passed
@mattsse mattsse deleted the rpc-tx-converter branch August 14, 2025 13:30
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Aug 14, 2025
lwedge99 pushed a commit to sentioxyz/reth that referenced this pull request Sep 16, 2025
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 22, 2026
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants