feat(rpc): Add SimTxConverter to allow for providing custom converters with extra context#17821
Merged
feat(rpc): Add SimTxConverter to allow for providing custom converters with extra context#17821
SimTxConverter to allow for providing custom converters with extra context#17821Conversation
…ers with extra context
… from `SimTxConverter`
…erter` implementation for `()`
fgimenez
reviewed
Aug 12, 2025
…count for different errors than `ValueError`
lwedge99
pushed a commit
to sentioxyz/reth
that referenced
this pull request
Sep 16, 2025
…ers with extra context (paradigmxyz#17821)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
RpcConverterimplementsRpcConvertonly if your Transaction Request type implementsTryIntoSimTx. TheTryIntoSimTxcannot carry more information than the input. Therefore, if you need to implement the conversion differently, you need to override the entireRpcConvertimplementation, which is way more than you really need.Solution
Adds a new trait called
SimTxConverterwith two blanket implementations:()assumingTxReqimplementsTryIntoSimTxand is used as default forRpcConverterFn(TxReq) -> Result<SimTx, ValueError<TxReq>>and can be applied usingRpcConverter::with_sim_tx_converter