-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: separate transaction builders for tx types #1259
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type safety ftw
crates/provider/src/fillers/gas.rs
Outdated
@@ -210,8 +157,6 @@ impl<N: Network> TxFiller<N> for GasFiller { | |||
{ | |||
if tx.gas_price().is_some() || tx.access_list().is_some() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our GasFiller
automatically treats transaction as legacy if it has an accessList
set which is not really correct. We also have a test enforcing this, wondering if this should be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is a bug, should be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated in 5697944
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
this should be okay
pub trait RecommendedFillers { | ||
/// Recommended fillers for this network. | ||
type RecomendedFillters: TxFiller; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes a ton of sense, so we can network specific defaults
should we merge this now or hold off until next breaking release? |
I'd like to hold off and see if we can do a smaller patch soon because @tcoratger is flagging a few more missing features |
* refactor: txtype-specific transaction builders * enforce legacy if access list * ignore access list
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