-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
A-op-rethRelated to Optimism and op-rethRelated to Optimism and op-rethC-enhancementNew feature or requestNew feature or requestD-good-first-issueNice and easy! A great choice to get startedNice and easy! A great choice to get started
Description
Describe the feature
we currently do during validation:
reth/crates/optimism/txpool/src/validator.rs
Lines 271 to 273 in 4f4986c
| let mut encoded = Vec::with_capacity(valid_tx.transaction().encoded_length()); | |
| let tx = valid_tx.transaction().clone_into_consensus(); | |
| tx.encode_2718(&mut encoded); |
because we need this to check for sufficient funds to cover the L1 DA fee
but we currently throw this away after validation.
instead we could obtain this from the tx itself, which would then just call:
reth/crates/optimism/txpool/src/transaction.rs
Lines 76 to 79 in 4f4986c
| /// Returns lazily computed EIP-2718 encoded bytes of the transaction. | |
| pub fn encoded_2718(&self) -> &Bytes { | |
| self.encoded_2718.get_or_init(|| self.inner.transaction().encoded_2718().into()) | |
| } |
then we'd already have the bytes stored for building.
to do this we need a way to call this generically, because rn this is restricted to:
| Tx: EthPoolTransaction + MaybeInteropTransaction, |
so need a trait function that returns
fn encoded_2718(&self) -> Cow<Bytes>we can add this to the existing OpPooledTx
| pub trait OpPooledTx: |
and update the restriction in the implementation to OpPooledTx
Additional context
No response
Metadata
Metadata
Assignees
Labels
A-op-rethRelated to Optimism and op-rethRelated to Optimism and op-rethC-enhancementNew feature or requestNew feature or requestD-good-first-issueNice and easy! A great choice to get startedNice and easy! A great choice to get started
Type
Projects
Status
Done