Skip to content

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

Merged
mattsse merged 4 commits intomainfrom
rpc-sim-tx-converter
Aug 13, 2025
Merged

feat(rpc): Add SimTxConverter to allow for providing custom converters with extra context#17821
mattsse merged 4 commits intomainfrom
rpc-sim-tx-converter

Conversation

@RomanHodulak
Copy link
Contributor

Part of #17545

Motivation

If the conversion algorithm of a custom node for Rpc Transaction Request -> Simulate Transaction requires more information than just the input, then it's really difficult to accomplish.

The reason is that RpcConverter implements RpcConvert only if your Transaction Request type implements TryIntoSimTx. The TryIntoSimTx cannot carry more information than the input. Therefore, if you need to implement the conversion differently, you need to override the entire RpcConvert implementation, which is way more than you really need.

Solution

Adds a new trait called SimTxConverter with two blanket implementations:

  • () assuming TxReq implements TryIntoSimTx and is used as default for RpcConverter
  • Fn(TxReq) -> Result<SimTx, ValueError<TxReq>> and can be applied using RpcConverter::with_sim_tx_converter

@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 12:41
@RomanHodulak RomanHodulak requested a review from klkvr August 12, 2025 12:43
@RomanHodulak RomanHodulak requested a review from fgimenez August 12, 2025 12:51
@mattsse mattsse added the A-sdk Related to reth's use as a library label Aug 12, 2025
…count for different errors than `ValueError`
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 13, 2025
@mattsse mattsse added this pull request to the merge queue Aug 13, 2025
Merged via the queue into main with commit 8065229 Aug 13, 2025
41 checks passed
@mattsse mattsse deleted the rpc-sim-tx-converter branch August 13, 2025 17:28
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Aug 13, 2025
lwedge99 pushed a commit to sentioxyz/reth that referenced this pull request Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-sdk Related to reth's use as a library

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants