refactor: separate transaction builders for tx types #1259
Merged
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.
Motivation
Not all netwoks support 7702 and 4844 transactions, however, current network abstraction requires
TransactionRequest
to contain setters for both of those tx types. This results in custom network implementations either having no-op setters/getters on builders, or introducing additional fallible steps during transaction conversion pipeline to reject attempts to construct unsupported transactions.Solution
Extracts part of
TransactionBuilder
methods intoTransactionBuilder4844
andTransactionBuilder7702
. Extracts blob fee filling fromGasFiller
intoBlobGasFiller
which enforcesN::TxRequest: TransactionBuilder4844
bound.Given that filling logic now depends on transaction request properties, I've extracted recomended fillers into
RecommendedFillers
trait which can be implemented on custom network implementations, adding support for filling custom transaction types. Right now it is implemented onEthereum
andAnyNetwork
.This makes it a bit harder to use transaction builder due to need to import 2 additional traits, so I'm wondering if we should consider adding some of the methods directly to it?
PR Checklist